|
1 | 1 | import { |
2 | 2 | ContractorOnboardingRenderProps, |
3 | 3 | NormalizedFieldError, |
| 4 | + useMagicLink, |
4 | 5 | } from '@remoteoss/remote-flows'; |
| 6 | +import { Button } from '@remoteoss/remote-flows/internals'; |
| 7 | +import { InfoIcon } from 'lucide-react'; |
5 | 8 | import { InviteSection, ReviewMeta } from './ReviewOnboardingStep'; |
6 | 9 | import { AlertError } from './AlertError'; |
7 | 10 |
|
| 11 | +const RemotePaymentServicesSetUp = () => { |
| 12 | + const magicLink = useMagicLink(); |
| 13 | + |
| 14 | + const generateMagicLinkToPayments = async () => { |
| 15 | + const response = await magicLink.mutateAsync({ |
| 16 | + path: `/dashboard/company-settings/payments`, |
| 17 | + user_id: import.meta.env.VITE_USER_ID, |
| 18 | + }); |
| 19 | + |
| 20 | + if (response.data) { |
| 21 | + window.open(response.data.data.url, '_blank', 'noopener,noreferrer'); |
| 22 | + } |
| 23 | + }; |
| 24 | + |
| 25 | + return ( |
| 26 | + <div className='flex items-center gap-4 rounded-lg border bg-card px-4 py-3'> |
| 27 | + <div className='flex h-10 w-10 shrink-0 items-center justify-center rounded-full'> |
| 28 | + <InfoIcon className='h-4 w-4' /> |
| 29 | + </div> |
| 30 | + <div className='flex-1'> |
| 31 | + <h3 className='font-medium text-card-foreground'> |
| 32 | + Set up Remote Payments |
| 33 | + </h3> |
| 34 | + <p className='text-sm text-muted-foreground'> |
| 35 | + Gain access to additional payment methods and streamlined payment |
| 36 | + management. |
| 37 | + </p> |
| 38 | + </div> |
| 39 | + <Button |
| 40 | + className='bg-[#000000] text-white hover:bg-[#000000]/80' |
| 41 | + onClick={generateMagicLinkToPayments} |
| 42 | + > |
| 43 | + Set up now |
| 44 | + </Button> |
| 45 | + </div> |
| 46 | + ); |
| 47 | +}; |
| 48 | + |
| 49 | +// ... existing code ... |
| 50 | + |
8 | 51 | export const ReviewContractorOnboardingStep = ({ |
9 | 52 | onboardingBag, |
10 | 53 | components, |
@@ -83,9 +126,7 @@ export const ReviewContractorOnboardingStep = ({ |
83 | 126 | has been invited to Remote. We’ll let you know once they complete |
84 | 127 | their onboarding process |
85 | 128 | </p> |
86 | | - <div> |
87 | | - <button type='submit'>Go to dashboard</button> |
88 | | - </div> |
| 129 | + <RemotePaymentServicesSetUp /> |
89 | 130 | </div> |
90 | 131 | )} |
91 | 132 |
|
|
0 commit comments