Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/AddWithdraw/DynamicBankAccountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export const DynamicBankAccountForm = forwardRef<{ handleSubmit: () => void }, D
const result = await onSuccess(payload as AddBankAccountPayload, {
...data,
iban: isIban ? data.accountNumber : undefined,
accountNumber: isIban ? '' : data.accountNumber,
bic: bic,
country,
firstName: data.firstName.trim(),
lastName: data.lastName.trim(),
Expand Down
6 changes: 5 additions & 1 deletion src/components/Claim/Link/Initial.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,11 @@ export const InitialClaimLinkView = (props: IClaimScreenProps) => {
className: 'md:py-2.5',
onClick: () => {
saveRedirectUrl()
router.push('/setup')
// push to setup page with redirect uri, to prevent the user from losing their claim context
const redirectUri = encodeURIComponent(
window.location.pathname + window.location.search + window.location.hash
)
router.push(`/setup?redirect_uri=${redirectUri}`)
},
},
{
Expand Down
6 changes: 5 additions & 1 deletion src/components/Common/ActionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ export default function ActionList({ claimLinkData, isLoggedIn }: IActionListPro
shadowSize="4"
onClick={() => {
saveRedirectUrl()
router.push('/setup')
// push to setup page with redirect uri, to prevent the user from losing the flow context
const redirectUri = encodeURIComponent(
window.location.pathname + window.location.search + window.location.hash
)
router.push(`/setup?redirect_uri=${redirectUri}`)
}}
className="flex w-full items-center gap-1"
>
Expand Down
22 changes: 19 additions & 3 deletions src/components/Global/UnsupportedBrowserModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import ActionModal, { ActionModalButtonProps } from '@/components/Global/ActionM
import { useToast } from '@/components/0_Bruddle/Toast'
import { IconName } from '@/components/Global/Icons/Icon'
import { copyTextToClipboardWithFallback } from '@/utils/general.utils'
import { useEffect, useState } from 'react'
import { useEffect, useState, Suspense } from 'react'
import { useSearchParams } from 'next/navigation'

export const inAppSignatures = [
'WebView',
Expand Down Expand Up @@ -34,13 +35,14 @@ export const inAppSignatures = [
'Electron', // Electron App
]

const UnsupportedBrowserModal = ({
const UnsupportedBrowserModalContent = ({
allowClose = true,
visible = false,
}: {
allowClose?: boolean
visible?: boolean
}) => {
const searchParams = useSearchParams()
const [showInAppBrowserModalViaDetection, setShowInAppBrowserModalViaDetection] = useState(false)
const [copyButtonText, setCopyButtonText] = useState('Copy Link')
const toast = useToast()
Expand Down Expand Up @@ -85,7 +87,12 @@ const UnsupportedBrowserModal = ({
iconPosition: 'left',
onClick: async () => {
try {
await copyTextToClipboardWithFallback(window.location.href)
// copy the redirect uri if it exists, otherwise copy the current url
const redirectUri = searchParams.get('redirect_uri')
const urlToCopy = redirectUri
? `${window.location.origin}${decodeURIComponent(redirectUri)}`
: window.location.href
await copyTextToClipboardWithFallback(urlToCopy)
setCopyButtonText('Copied!')
toast.success('Link copied to clipboard!')
setTimeout(() => setCopyButtonText('Copy Link'), 2000)
Expand Down Expand Up @@ -124,4 +131,13 @@ const UnsupportedBrowserModal = ({
)
}

// suspense is being used to prevent hydration errors that may be caused by useSearchParams
const UnsupportedBrowserModal = (props: { allowClose?: boolean; visible?: boolean }) => {
return (
<Suspense fallback={null}>
<UnsupportedBrowserModalContent {...props} />
</Suspense>
)
}

export default UnsupportedBrowserModal
Loading