diff --git a/react/admin/ReturnDetails/components/ReturnLabel/ReturnLabel.tsx b/react/admin/ReturnDetails/components/ReturnLabel/ReturnLabel.tsx
new file mode 100644
index 000000000..4ea6cb2fa
--- /dev/null
+++ b/react/admin/ReturnDetails/components/ReturnLabel/ReturnLabel.tsx
@@ -0,0 +1,193 @@
+import React, { Fragment, useState } from 'react'
+import { useMutation, useQuery } from 'react-apollo'
+import { FormattedMessage } from 'react-intl'
+import {
+ ButtonPlain,
+ Collapsible,
+ Link,
+ ModalDialog,
+ Tooltip,
+ IconInfo,
+} from 'vtex.styleguide'
+
+import { useReturnDetails } from '../../../../common/hooks/useReturnDetails'
+import { useAlert } from '../../../hooks/userAlert'
+import GET_APP from './graphql/getInstalledApp.gql'
+import SEND_LABEL from './graphql/sendLabel.gql'
+import CREATE_LABEL from './graphql/createLabel.gql'
+
+const ReturnLabel = () => {
+ const { data } = useReturnDetails()
+ const { openAlert } = useAlert()
+
+ const [labelUrl, setLabelUrl] = useState(
+ data?.returnRequestDetails.pickupReturnData.labelUrl ?? ''
+ )
+
+ const [returnAddress, setReturnAddress] = useState
(
+ null
+ )
+
+ const [isModalOpen, setIsModalOpen] = useState(false)
+ const [isCollapsibleOpen, setIsCollapsibleOpen] = useState(false)
+
+ const { loading, error } = useQuery<{
+ app: {
+ settings: string
+ }
+ }>(GET_APP, {
+ variables: {
+ slug: 'vtex.easypost',
+ },
+ onCompleted(installedApp) {
+ const {
+ app: { settings },
+ } = installedApp
+
+ const { street1, street2, city, state, zip, country, name, phone } =
+ JSON.parse(settings) as ReturnLabelAddress
+
+ setReturnAddress({
+ street1,
+ street2,
+ city,
+ state,
+ zip,
+ country,
+ name,
+ phone,
+ })
+ },
+ })
+
+ const handleToggleModal = () => {
+ setIsModalOpen(!isModalOpen)
+ }
+
+ const handleToggleCollapsible = () => {
+ setIsCollapsibleOpen(!isCollapsibleOpen)
+ }
+
+ const handleCancelation = () => {
+ setIsModalOpen(false)
+ }
+
+ const [, { loading: loadingLabel }] = useMutation(CREATE_LABEL)
+ const [sendLabel, { loading: sendingEmail }] = useMutation(SEND_LABEL)
+
+ const handleConfirmation = async () => {
+ // temp labelUrl [DELETE when we have the client Key from easypost]
+ const createdLabelUrl =
+ 'https://assets.easypost.com/assets/images/usps-international-label.c7c603e0b25b12e4489a8c75db0d34b8.png'
+
+ try {
+ // Send mutation to EasyPost
+ // const createdLabelUrl = await createLabel({
+ // variables: {
+ // ...returnAddress,
+ // },
+ // })
+
+ await sendLabel({
+ variables: {
+ requestId: data?.returnRequestDetails.id,
+ labelUrl: createdLabelUrl,
+ },
+ })
+
+ setLabelUrl(createdLabelUrl)
+
+ openAlert(
+ 'success',
+
+ )
+ } catch (err) {
+ openAlert(
+ 'error',
+
+ )
+ }
+
+ setIsModalOpen(false)
+ }
+
+ if (loading || error) return null
+
+ return (
+
+
+ {returnAddress &&
+ (labelUrl === '' ? (
+
+
+
+
+
+
+ }
+ position="right"
+ >
+
+
+
+
+
+
+
+
+ ) : (
+
+
+
+ }
+ isOpen={isCollapsibleOpen}
+ onClick={handleToggleCollapsible}
+ >
+
+
+ {labelUrl}
+
+
+
+ ))}
+
+
+
+ ),
+ onClick: handleConfirmation,
+ }}
+ cancelation={{
+ label: (
+
+ ),
+ onClick: handleCancelation,
+ }}
+ >
+
+
+
+ )
+}
+
+export { ReturnLabel }
diff --git a/react/graphql/createLabel.gql b/react/admin/ReturnDetails/components/ReturnLabel/graphql/createLabel.gql
similarity index 100%
rename from react/graphql/createLabel.gql
rename to react/admin/ReturnDetails/components/ReturnLabel/graphql/createLabel.gql
diff --git a/react/admin/ReturnDetails/components/ReturnLabel/graphql/getInstalledApp.gql b/react/admin/ReturnDetails/components/ReturnLabel/graphql/getInstalledApp.gql
new file mode 100644
index 000000000..c95ac99b5
--- /dev/null
+++ b/react/admin/ReturnDetails/components/ReturnLabel/graphql/getInstalledApp.gql
@@ -0,0 +1,5 @@
+query GetInstalleApp($slug: String!) {
+ app: installedAppPublic(slug: $slug) @context(provider: "vtex.apps-graphql") {
+ settings
+ }
+}
diff --git a/react/admin/ReturnDetails/components/ReturnLabel/graphql/sendLabel.gql b/react/admin/ReturnDetails/components/ReturnLabel/graphql/sendLabel.gql
new file mode 100644
index 000000000..2a176d0d0
--- /dev/null
+++ b/react/admin/ReturnDetails/components/ReturnLabel/graphql/sendLabel.gql
@@ -0,0 +1,4 @@
+mutation SendLabel($requestId: String!, $labelUrl: String!) {
+ sendReturnLabel(requestId: $requestId, labelUrl: $labelUrl)
+ @context(provider: "vtex.return-app")
+}
diff --git a/react/common/components/ReturnDetails/ReturnLabel.tsx b/react/common/components/ReturnDetails/ReturnLabel.tsx
new file mode 100644
index 000000000..8e9b84bfa
--- /dev/null
+++ b/react/common/components/ReturnDetails/ReturnLabel.tsx
@@ -0,0 +1,47 @@
+import React, { useState } from 'react'
+import { FormattedMessage } from 'react-intl'
+import { useCssHandles } from 'vtex.css-handles'
+import { Collapsible, Link } from 'vtex.styleguide'
+
+import { useReturnDetails } from '../../hooks/useReturnDetails'
+
+const CSS_HANDLES = ['returnLabelContainer'] as const
+
+const ReturnLabel = () => {
+ const [isOpen, setIsOpen] = useState(false)
+ const handles = useCssHandles(CSS_HANDLES)
+
+ const { data } = useReturnDetails()
+
+ const handleToggleCollapsible = () => {
+ setIsOpen(!isOpen)
+ }
+
+ if (!data) return null
+
+ const {
+ pickupReturnData: { labelUrl },
+ } = data.returnRequestDetails
+
+ return (
+