@swype-org/react-sdk 0.1.208 → 0.2.1-betatest
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +674 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -3
- package/dist/index.d.ts +98 -3
- package/dist/index.js +672 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -421,11 +421,14 @@ var api_exports = {};
|
|
|
421
421
|
__export(api_exports, {
|
|
422
422
|
createAccount: () => createAccount,
|
|
423
423
|
createAccountAuthorizationSession: () => createAccountAuthorizationSession,
|
|
424
|
+
createGuestTransfer: () => createGuestTransfer,
|
|
424
425
|
createTransfer: () => createTransfer,
|
|
425
426
|
fetchAccount: () => fetchAccount,
|
|
426
427
|
fetchAccounts: () => fetchAccounts,
|
|
427
428
|
fetchAuthorizationSession: () => fetchAuthorizationSession,
|
|
428
429
|
fetchChains: () => fetchChains,
|
|
430
|
+
fetchGuestQuote: () => fetchGuestQuote,
|
|
431
|
+
fetchGuestTransfer: () => fetchGuestTransfer,
|
|
429
432
|
fetchMerchantPublicKey: () => fetchMerchantPublicKey,
|
|
430
433
|
fetchProviders: () => fetchProviders,
|
|
431
434
|
fetchTransfer: () => fetchTransfer,
|
|
@@ -657,6 +660,31 @@ async function reportActionCompletion(apiBaseUrl, actionId, result) {
|
|
|
657
660
|
if (!res.ok) await throwApiError(res);
|
|
658
661
|
return await res.json();
|
|
659
662
|
}
|
|
663
|
+
async function fetchGuestQuote(apiBaseUrl, params) {
|
|
664
|
+
const res = await fetch(`${apiBaseUrl}/v1/guest-transfers/quote`, {
|
|
665
|
+
method: "POST",
|
|
666
|
+
headers: { "Content-Type": "application/json" },
|
|
667
|
+
body: JSON.stringify(params)
|
|
668
|
+
});
|
|
669
|
+
if (!res.ok) await throwApiError(res);
|
|
670
|
+
return await res.json();
|
|
671
|
+
}
|
|
672
|
+
async function createGuestTransfer(apiBaseUrl, params) {
|
|
673
|
+
const res = await fetch(`${apiBaseUrl}/v1/guest-transfers`, {
|
|
674
|
+
method: "POST",
|
|
675
|
+
headers: { "Content-Type": "application/json" },
|
|
676
|
+
body: JSON.stringify(params)
|
|
677
|
+
});
|
|
678
|
+
if (!res.ok) await throwApiError(res);
|
|
679
|
+
return await res.json();
|
|
680
|
+
}
|
|
681
|
+
async function fetchGuestTransfer(apiBaseUrl, transferId) {
|
|
682
|
+
const res = await fetch(
|
|
683
|
+
`${apiBaseUrl}/v1/guest-transfers/${transferId}`
|
|
684
|
+
);
|
|
685
|
+
if (!res.ok) await throwApiError(res);
|
|
686
|
+
return await res.json();
|
|
687
|
+
}
|
|
660
688
|
|
|
661
689
|
// src/passkeyRpId.ts
|
|
662
690
|
function normalizeConfiguredDomain(value) {
|
|
@@ -1792,7 +1820,7 @@ function deriveSourceTypeAndId(state) {
|
|
|
1792
1820
|
}
|
|
1793
1821
|
function createInitialState(config) {
|
|
1794
1822
|
return {
|
|
1795
|
-
step: "
|
|
1823
|
+
step: "guest-deposit",
|
|
1796
1824
|
error: null,
|
|
1797
1825
|
providers: [],
|
|
1798
1826
|
accounts: [],
|
|
@@ -1815,7 +1843,14 @@ function createInitialState(config) {
|
|
|
1815
1843
|
mobileFlow: false,
|
|
1816
1844
|
deeplinkUri: null,
|
|
1817
1845
|
increasingLimit: false,
|
|
1818
|
-
previousStep: null
|
|
1846
|
+
previousStep: null,
|
|
1847
|
+
isGuestFlow: true,
|
|
1848
|
+
guestQuote: null,
|
|
1849
|
+
guestOriginTxHash: null,
|
|
1850
|
+
guestTransferId: null,
|
|
1851
|
+
guestTransferComplete: false,
|
|
1852
|
+
guestWalletAddress: null,
|
|
1853
|
+
guestWalletChainId: null
|
|
1819
1854
|
};
|
|
1820
1855
|
}
|
|
1821
1856
|
function paymentReducer(state, action) {
|
|
@@ -1955,7 +1990,7 @@ function paymentReducer(state, action) {
|
|
|
1955
1990
|
deeplinkUri: null
|
|
1956
1991
|
};
|
|
1957
1992
|
case "PROCESSING_TIMEOUT":
|
|
1958
|
-
return { ...state, error: action.error, step: "deposit" };
|
|
1993
|
+
return { ...state, error: action.error, step: state.isGuestFlow ? "guest-deposit" : "deposit" };
|
|
1959
1994
|
case "CONFIRM_SIGN_SUCCESS":
|
|
1960
1995
|
return {
|
|
1961
1996
|
...state,
|
|
@@ -2067,6 +2102,54 @@ function paymentReducer(state, action) {
|
|
|
2067
2102
|
};
|
|
2068
2103
|
case "SYNC_AMOUNT":
|
|
2069
2104
|
return { ...state, amount: action.amount };
|
|
2105
|
+
// ── Guest flow ───────────────────────────────────────────────
|
|
2106
|
+
case "GUEST_WALLET_CONNECTED":
|
|
2107
|
+
return {
|
|
2108
|
+
...state,
|
|
2109
|
+
guestWalletAddress: action.address,
|
|
2110
|
+
guestWalletChainId: action.chainId,
|
|
2111
|
+
step: "guest-signing",
|
|
2112
|
+
error: null
|
|
2113
|
+
};
|
|
2114
|
+
case "GUEST_QUOTE_RECEIVED":
|
|
2115
|
+
return {
|
|
2116
|
+
...state,
|
|
2117
|
+
guestQuote: action.quote
|
|
2118
|
+
};
|
|
2119
|
+
case "GUEST_DEPOSIT_SIGNED":
|
|
2120
|
+
return {
|
|
2121
|
+
...state,
|
|
2122
|
+
guestOriginTxHash: action.txHash,
|
|
2123
|
+
step: "processing"
|
|
2124
|
+
};
|
|
2125
|
+
case "GUEST_TRANSFER_SUBMITTED":
|
|
2126
|
+
return {
|
|
2127
|
+
...state,
|
|
2128
|
+
guestTransferId: action.transferId
|
|
2129
|
+
};
|
|
2130
|
+
case "GUEST_TRANSFER_COMPLETED":
|
|
2131
|
+
return {
|
|
2132
|
+
...state,
|
|
2133
|
+
guestTransferComplete: true,
|
|
2134
|
+
step: "success"
|
|
2135
|
+
};
|
|
2136
|
+
case "GUEST_TRANSFER_FAILED":
|
|
2137
|
+
return {
|
|
2138
|
+
...state,
|
|
2139
|
+
error: action.error,
|
|
2140
|
+
step: "success"
|
|
2141
|
+
};
|
|
2142
|
+
case "START_SETUP_FLOW":
|
|
2143
|
+
return {
|
|
2144
|
+
...state,
|
|
2145
|
+
isGuestFlow: false,
|
|
2146
|
+
step: "login"
|
|
2147
|
+
};
|
|
2148
|
+
case "SETUP_FLOW_COMPLETE":
|
|
2149
|
+
return {
|
|
2150
|
+
...state,
|
|
2151
|
+
step: "setup-complete"
|
|
2152
|
+
};
|
|
2070
2153
|
default:
|
|
2071
2154
|
return state;
|
|
2072
2155
|
}
|
|
@@ -4245,7 +4328,9 @@ function SuccessScreen({
|
|
|
4245
4328
|
onLogout,
|
|
4246
4329
|
onIncreaseLimits,
|
|
4247
4330
|
onManageAccount,
|
|
4248
|
-
autoCloseSeconds
|
|
4331
|
+
autoCloseSeconds,
|
|
4332
|
+
isGuestTransfer,
|
|
4333
|
+
onOfferSetup
|
|
4249
4334
|
}) {
|
|
4250
4335
|
const { tokens } = useSwypeConfig();
|
|
4251
4336
|
const effectiveAutoClose = succeeded ? autoCloseSeconds : void 0;
|
|
@@ -4254,8 +4339,12 @@ function SuccessScreen({
|
|
|
4254
4339
|
const handleDone = react.useCallback(() => {
|
|
4255
4340
|
if (doneCalledRef.current) return;
|
|
4256
4341
|
doneCalledRef.current = true;
|
|
4257
|
-
|
|
4258
|
-
|
|
4342
|
+
if (isGuestTransfer && succeeded && onOfferSetup) {
|
|
4343
|
+
onOfferSetup();
|
|
4344
|
+
} else {
|
|
4345
|
+
onDone();
|
|
4346
|
+
}
|
|
4347
|
+
}, [onDone, isGuestTransfer, succeeded, onOfferSetup]);
|
|
4259
4348
|
react.useEffect(() => {
|
|
4260
4349
|
if (!effectiveAutoClose || effectiveAutoClose <= 0) return;
|
|
4261
4350
|
const intervalId = window.setInterval(() => {
|
|
@@ -4278,7 +4367,7 @@ function SuccessScreen({
|
|
|
4278
4367
|
ScreenLayout,
|
|
4279
4368
|
{
|
|
4280
4369
|
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4281
|
-
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: handleDone, children: succeeded ? "
|
|
4370
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: handleDone, children: !succeeded ? "Try again" : isGuestTransfer ? "Continue" : "Done" }),
|
|
4282
4371
|
effectiveAutoClose != null && effectiveAutoClose > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: countdownStyle(tokens.textMuted), children: [
|
|
4283
4372
|
"Returning to app in ",
|
|
4284
4373
|
countdown,
|
|
@@ -5399,6 +5488,317 @@ var selectCircleSelectedStyle = (color) => ({
|
|
|
5399
5488
|
justifyContent: "center",
|
|
5400
5489
|
flexShrink: 0
|
|
5401
5490
|
});
|
|
5491
|
+
function GuestDepositScreen({
|
|
5492
|
+
amount,
|
|
5493
|
+
currency,
|
|
5494
|
+
merchantName,
|
|
5495
|
+
onConfirm,
|
|
5496
|
+
onSignIn,
|
|
5497
|
+
onBack,
|
|
5498
|
+
loading,
|
|
5499
|
+
error
|
|
5500
|
+
}) {
|
|
5501
|
+
const { tokens } = useSwypeConfig();
|
|
5502
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5503
|
+
ScreenLayout,
|
|
5504
|
+
{
|
|
5505
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5506
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onConfirm, loading, children: "Confirm" }),
|
|
5507
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5508
|
+
"button",
|
|
5509
|
+
{
|
|
5510
|
+
type: "button",
|
|
5511
|
+
onClick: onSignIn,
|
|
5512
|
+
style: signInStyle(tokens.textMuted),
|
|
5513
|
+
children: "Returning user? Sign in"
|
|
5514
|
+
}
|
|
5515
|
+
),
|
|
5516
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5517
|
+
] }),
|
|
5518
|
+
children: [
|
|
5519
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
5520
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle9, children: [
|
|
5521
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountCircle(tokens), children: [
|
|
5522
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: currencyStyle(tokens.textSecondary), children: currency === "USD" ? "$" : currency }),
|
|
5523
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: amountStyle(tokens.text), children: amount.toFixed(2) })
|
|
5524
|
+
] }),
|
|
5525
|
+
merchantName && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: merchantStyle(tokens.textSecondary), children: [
|
|
5526
|
+
"to ",
|
|
5527
|
+
merchantName
|
|
5528
|
+
] }),
|
|
5529
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: descriptionStyle(tokens.textSecondary), children: "Connect your wallet to complete this deposit. No account required." }),
|
|
5530
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorStyle3(tokens), children: error })
|
|
5531
|
+
] })
|
|
5532
|
+
]
|
|
5533
|
+
}
|
|
5534
|
+
);
|
|
5535
|
+
}
|
|
5536
|
+
var contentStyle9 = {
|
|
5537
|
+
flex: 1,
|
|
5538
|
+
display: "flex",
|
|
5539
|
+
flexDirection: "column",
|
|
5540
|
+
alignItems: "center",
|
|
5541
|
+
paddingTop: 32
|
|
5542
|
+
};
|
|
5543
|
+
var amountCircle = (tokens) => ({
|
|
5544
|
+
display: "flex",
|
|
5545
|
+
alignItems: "baseline",
|
|
5546
|
+
justifyContent: "center",
|
|
5547
|
+
gap: 4,
|
|
5548
|
+
padding: "24px 36px",
|
|
5549
|
+
background: tokens.bgInput,
|
|
5550
|
+
border: `1px solid ${tokens.border}`,
|
|
5551
|
+
borderRadius: 24,
|
|
5552
|
+
marginBottom: 12
|
|
5553
|
+
});
|
|
5554
|
+
var currencyStyle = (color) => ({
|
|
5555
|
+
fontSize: "1.5rem",
|
|
5556
|
+
fontWeight: 600,
|
|
5557
|
+
color
|
|
5558
|
+
});
|
|
5559
|
+
var amountStyle = (color) => ({
|
|
5560
|
+
fontSize: "2.5rem",
|
|
5561
|
+
fontWeight: 700,
|
|
5562
|
+
letterSpacing: "-0.02em",
|
|
5563
|
+
color
|
|
5564
|
+
});
|
|
5565
|
+
var merchantStyle = (color) => ({
|
|
5566
|
+
fontSize: "0.9rem",
|
|
5567
|
+
color,
|
|
5568
|
+
margin: "0 0 16px"
|
|
5569
|
+
});
|
|
5570
|
+
var descriptionStyle = (color) => ({
|
|
5571
|
+
fontSize: "0.88rem",
|
|
5572
|
+
color,
|
|
5573
|
+
textAlign: "center",
|
|
5574
|
+
lineHeight: 1.6,
|
|
5575
|
+
maxWidth: 300,
|
|
5576
|
+
margin: "0 0 20px"
|
|
5577
|
+
});
|
|
5578
|
+
var signInStyle = (color) => ({
|
|
5579
|
+
background: "transparent",
|
|
5580
|
+
border: "none",
|
|
5581
|
+
color,
|
|
5582
|
+
cursor: "pointer",
|
|
5583
|
+
fontFamily: "inherit",
|
|
5584
|
+
fontSize: "0.84rem",
|
|
5585
|
+
fontWeight: 500,
|
|
5586
|
+
display: "block",
|
|
5587
|
+
width: "100%",
|
|
5588
|
+
textAlign: "center",
|
|
5589
|
+
padding: "14px 0 0"
|
|
5590
|
+
});
|
|
5591
|
+
var errorStyle3 = (tokens) => ({
|
|
5592
|
+
width: "100%",
|
|
5593
|
+
padding: "12px 16px",
|
|
5594
|
+
background: tokens.errorBg,
|
|
5595
|
+
color: tokens.error,
|
|
5596
|
+
borderRadius: 14,
|
|
5597
|
+
fontSize: "0.84rem",
|
|
5598
|
+
lineHeight: 1.5
|
|
5599
|
+
});
|
|
5600
|
+
var PHASE_LABELS = {
|
|
5601
|
+
connecting: "Connecting wallet...",
|
|
5602
|
+
"fetching-quote": "Getting best rate...",
|
|
5603
|
+
approving: "Approve token access",
|
|
5604
|
+
signing: "Confirm deposit in your wallet",
|
|
5605
|
+
submitting: "Submitting transfer..."
|
|
5606
|
+
};
|
|
5607
|
+
var PHASE_DESCRIPTIONS = {
|
|
5608
|
+
connecting: "Please connect your wallet to continue.",
|
|
5609
|
+
"fetching-quote": "Finding the best route for your transfer.",
|
|
5610
|
+
approving: "Your wallet will ask you to approve token access for this transfer.",
|
|
5611
|
+
signing: "Sign the deposit transaction in your wallet to send funds.",
|
|
5612
|
+
submitting: "Your transaction has been signed. Submitting to the network..."
|
|
5613
|
+
};
|
|
5614
|
+
function GuestWalletScreen({
|
|
5615
|
+
phase,
|
|
5616
|
+
amount,
|
|
5617
|
+
currency,
|
|
5618
|
+
onBack,
|
|
5619
|
+
error,
|
|
5620
|
+
onRetry
|
|
5621
|
+
}) {
|
|
5622
|
+
const { tokens } = useSwypeConfig();
|
|
5623
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5624
|
+
ScreenLayout,
|
|
5625
|
+
{
|
|
5626
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5627
|
+
error && onRetry && /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onRetry, children: "Try again" }),
|
|
5628
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5629
|
+
] }),
|
|
5630
|
+
children: [
|
|
5631
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
5632
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle10, children: [
|
|
5633
|
+
!error && /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
5634
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle12(tokens.text), children: error ? "Something went wrong" : PHASE_LABELS[phase] }),
|
|
5635
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: descriptionStyle2(tokens.textSecondary), children: error ?? PHASE_DESCRIPTIONS[phase] }),
|
|
5636
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountBadgeStyle(tokens), children: [
|
|
5637
|
+
currency === "USD" ? "$" : currency,
|
|
5638
|
+
amount.toFixed(2)
|
|
5639
|
+
] })
|
|
5640
|
+
] })
|
|
5641
|
+
]
|
|
5642
|
+
}
|
|
5643
|
+
);
|
|
5644
|
+
}
|
|
5645
|
+
var contentStyle10 = {
|
|
5646
|
+
flex: 1,
|
|
5647
|
+
display: "flex",
|
|
5648
|
+
flexDirection: "column",
|
|
5649
|
+
alignItems: "center",
|
|
5650
|
+
justifyContent: "center",
|
|
5651
|
+
paddingTop: 24,
|
|
5652
|
+
gap: 12
|
|
5653
|
+
};
|
|
5654
|
+
var headingStyle12 = (color) => ({
|
|
5655
|
+
fontSize: "1.25rem",
|
|
5656
|
+
fontWeight: 700,
|
|
5657
|
+
letterSpacing: "-0.02em",
|
|
5658
|
+
color,
|
|
5659
|
+
margin: "16px 0 4px",
|
|
5660
|
+
textAlign: "center"
|
|
5661
|
+
});
|
|
5662
|
+
var descriptionStyle2 = (color) => ({
|
|
5663
|
+
fontSize: "0.88rem",
|
|
5664
|
+
color,
|
|
5665
|
+
textAlign: "center",
|
|
5666
|
+
lineHeight: 1.6,
|
|
5667
|
+
maxWidth: 300,
|
|
5668
|
+
margin: 0
|
|
5669
|
+
});
|
|
5670
|
+
var amountBadgeStyle = (tokens) => ({
|
|
5671
|
+
display: "inline-block",
|
|
5672
|
+
padding: "8px 20px",
|
|
5673
|
+
background: tokens.bgInput,
|
|
5674
|
+
border: `1px solid ${tokens.border}`,
|
|
5675
|
+
borderRadius: 999,
|
|
5676
|
+
fontSize: "0.95rem",
|
|
5677
|
+
fontWeight: 600,
|
|
5678
|
+
color: tokens.text,
|
|
5679
|
+
marginTop: 8
|
|
5680
|
+
});
|
|
5681
|
+
function OfferSetupScreen({
|
|
5682
|
+
amount,
|
|
5683
|
+
currency,
|
|
5684
|
+
onSetup,
|
|
5685
|
+
onDone
|
|
5686
|
+
}) {
|
|
5687
|
+
const { tokens } = useSwypeConfig();
|
|
5688
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5689
|
+
ScreenLayout,
|
|
5690
|
+
{
|
|
5691
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5692
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onSetup, children: "Set up One-Tap" }),
|
|
5693
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ jsxRuntime.jsx(OutlineButton, { onClick: onDone, children: "Not now" }) }),
|
|
5694
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5695
|
+
] }),
|
|
5696
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle11, children: [
|
|
5697
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.success }) }) }),
|
|
5698
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h2", { style: headingStyle13(tokens.text), children: [
|
|
5699
|
+
"$",
|
|
5700
|
+
amount.toFixed(2),
|
|
5701
|
+
" deposited"
|
|
5702
|
+
] }),
|
|
5703
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle10(tokens.textSecondary), children: "Your transfer is complete!" }),
|
|
5704
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: cardStyle2(tokens), children: [
|
|
5705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: cardIconRow, children: [
|
|
5706
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 10V3L4 14h7v7l9-11h-7z", fill: tokens.accent }) }),
|
|
5707
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { style: { color: tokens.text }, children: "Enable One-Tap deposits" })
|
|
5708
|
+
] }),
|
|
5709
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: cardBodyStyle(tokens.textSecondary), children: "Next time, deposit with a single tap \u2014 no wallet signing needed. Set up takes about 30 seconds." })
|
|
5710
|
+
] })
|
|
5711
|
+
] })
|
|
5712
|
+
}
|
|
5713
|
+
);
|
|
5714
|
+
}
|
|
5715
|
+
var contentStyle11 = {
|
|
5716
|
+
flex: 1,
|
|
5717
|
+
display: "flex",
|
|
5718
|
+
flexDirection: "column",
|
|
5719
|
+
alignItems: "center",
|
|
5720
|
+
paddingTop: 48
|
|
5721
|
+
};
|
|
5722
|
+
var headingStyle13 = (color) => ({
|
|
5723
|
+
fontSize: "1.5rem",
|
|
5724
|
+
fontWeight: 700,
|
|
5725
|
+
letterSpacing: "-0.02em",
|
|
5726
|
+
color,
|
|
5727
|
+
margin: "20px 0 4px"
|
|
5728
|
+
});
|
|
5729
|
+
var subtitleStyle10 = (color) => ({
|
|
5730
|
+
fontSize: "0.9rem",
|
|
5731
|
+
color,
|
|
5732
|
+
margin: "0 0 28px"
|
|
5733
|
+
});
|
|
5734
|
+
var cardStyle2 = (tokens) => ({
|
|
5735
|
+
width: "100%",
|
|
5736
|
+
padding: "18px 16px",
|
|
5737
|
+
background: tokens.bgInput,
|
|
5738
|
+
border: `1px solid ${tokens.border}`,
|
|
5739
|
+
borderRadius: 20
|
|
5740
|
+
});
|
|
5741
|
+
var cardIconRow = {
|
|
5742
|
+
display: "flex",
|
|
5743
|
+
alignItems: "center",
|
|
5744
|
+
gap: 8,
|
|
5745
|
+
fontSize: "0.92rem",
|
|
5746
|
+
marginBottom: 6
|
|
5747
|
+
};
|
|
5748
|
+
var cardBodyStyle = (color) => ({
|
|
5749
|
+
fontSize: "0.84rem",
|
|
5750
|
+
color,
|
|
5751
|
+
lineHeight: 1.6,
|
|
5752
|
+
margin: 0
|
|
5753
|
+
});
|
|
5754
|
+
function SetupCompleteScreen({ onDone }) {
|
|
5755
|
+
const { tokens } = useSwypeConfig();
|
|
5756
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5757
|
+
ScreenLayout,
|
|
5758
|
+
{
|
|
5759
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5760
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onDone, children: "Done" }),
|
|
5761
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5762
|
+
] }),
|
|
5763
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle12, children: [
|
|
5764
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 10V3L4 14h7v7l9-11h-7z", fill: tokens.accent }) }) }),
|
|
5765
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle14(tokens.text), children: "One-Tap deposits are ready!" }),
|
|
5766
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle11(tokens.textSecondary), children: "Next time you deposit, just tap confirm \u2014 no wallet signing needed." })
|
|
5767
|
+
] })
|
|
5768
|
+
}
|
|
5769
|
+
);
|
|
5770
|
+
}
|
|
5771
|
+
var contentStyle12 = {
|
|
5772
|
+
flex: 1,
|
|
5773
|
+
display: "flex",
|
|
5774
|
+
flexDirection: "column",
|
|
5775
|
+
alignItems: "center",
|
|
5776
|
+
justifyContent: "center",
|
|
5777
|
+
paddingTop: 24
|
|
5778
|
+
};
|
|
5779
|
+
var headingStyle14 = (color) => ({
|
|
5780
|
+
fontSize: "1.5rem",
|
|
5781
|
+
fontWeight: 700,
|
|
5782
|
+
letterSpacing: "-0.02em",
|
|
5783
|
+
color,
|
|
5784
|
+
margin: "20px 0 8px",
|
|
5785
|
+
textAlign: "center"
|
|
5786
|
+
});
|
|
5787
|
+
var subtitleStyle11 = (color) => ({
|
|
5788
|
+
fontSize: "0.9rem",
|
|
5789
|
+
color,
|
|
5790
|
+
textAlign: "center",
|
|
5791
|
+
lineHeight: 1.6,
|
|
5792
|
+
maxWidth: 300,
|
|
5793
|
+
margin: 0
|
|
5794
|
+
});
|
|
5795
|
+
var GUEST_STEPS = /* @__PURE__ */ new Set([
|
|
5796
|
+
"guest-deposit",
|
|
5797
|
+
"guest-connecting",
|
|
5798
|
+
"guest-signing",
|
|
5799
|
+
"offer-setup",
|
|
5800
|
+
"setup-complete"
|
|
5801
|
+
]);
|
|
5402
5802
|
var LINK_STEPS = /* @__PURE__ */ new Set([
|
|
5403
5803
|
"create-passkey",
|
|
5404
5804
|
"verify-passkey",
|
|
@@ -5415,6 +5815,7 @@ var DEPOSIT_STEPS = /* @__PURE__ */ new Set([
|
|
|
5415
5815
|
"success"
|
|
5416
5816
|
]);
|
|
5417
5817
|
function getFlowPhase(step, previousStep) {
|
|
5818
|
+
if (GUEST_STEPS.has(step)) return null;
|
|
5418
5819
|
if (LINK_STEPS.has(step)) return "link";
|
|
5419
5820
|
if (DEPOSIT_STEPS.has(step)) return "deposit";
|
|
5420
5821
|
if (step === "token-picker" || step === "select-source") {
|
|
@@ -5464,6 +5865,57 @@ function StepRendererContent({
|
|
|
5464
5865
|
if (!ready) {
|
|
5465
5866
|
return /* @__PURE__ */ jsxRuntime.jsx(SwypeLoadingScreen, {});
|
|
5466
5867
|
}
|
|
5868
|
+
if (step === "guest-deposit") {
|
|
5869
|
+
const parsedAmt = depositAmount != null ? depositAmount : 5;
|
|
5870
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5871
|
+
GuestDepositScreen,
|
|
5872
|
+
{
|
|
5873
|
+
amount: parsedAmt,
|
|
5874
|
+
currency: "USD",
|
|
5875
|
+
merchantName,
|
|
5876
|
+
onConfirm: handlers.onGuestConfirm,
|
|
5877
|
+
onSignIn: handlers.onGuestSignIn,
|
|
5878
|
+
onBack,
|
|
5879
|
+
loading: state.loadingData,
|
|
5880
|
+
error: state.error
|
|
5881
|
+
}
|
|
5882
|
+
);
|
|
5883
|
+
}
|
|
5884
|
+
if (step === "guest-connecting" || step === "guest-signing") {
|
|
5885
|
+
const parsedAmt = depositAmount != null ? depositAmount : 5;
|
|
5886
|
+
const phase = step === "guest-connecting" ? "connecting" : "signing";
|
|
5887
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5888
|
+
GuestWalletScreen,
|
|
5889
|
+
{
|
|
5890
|
+
phase: state.guestQuote ? step === "guest-signing" ? "signing" : "fetching-quote" : phase,
|
|
5891
|
+
amount: parsedAmt,
|
|
5892
|
+
currency: "USD",
|
|
5893
|
+
onBack: () => handlers.onNavigate("guest-deposit"),
|
|
5894
|
+
error: state.error,
|
|
5895
|
+
onRetry: handlers.onGuestRetry
|
|
5896
|
+
}
|
|
5897
|
+
);
|
|
5898
|
+
}
|
|
5899
|
+
if (step === "offer-setup") {
|
|
5900
|
+
const displayAmount = parseFloat(state.amount) || (depositAmount ?? 5);
|
|
5901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5902
|
+
OfferSetupScreen,
|
|
5903
|
+
{
|
|
5904
|
+
amount: displayAmount,
|
|
5905
|
+
currency: "USD",
|
|
5906
|
+
onSetup: handlers.onOfferSetup,
|
|
5907
|
+
onDone: onDismiss ?? handlers.onNewPayment
|
|
5908
|
+
}
|
|
5909
|
+
);
|
|
5910
|
+
}
|
|
5911
|
+
if (step === "setup-complete") {
|
|
5912
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5913
|
+
SetupCompleteScreen,
|
|
5914
|
+
{
|
|
5915
|
+
onDone: onDismiss ?? handlers.onNewPayment
|
|
5916
|
+
}
|
|
5917
|
+
);
|
|
5918
|
+
}
|
|
5467
5919
|
if (step === "login") {
|
|
5468
5920
|
if (authenticated) {
|
|
5469
5921
|
return /* @__PURE__ */ jsxRuntime.jsx(SwypeLoadingScreen, {});
|
|
@@ -5695,8 +6147,9 @@ function StepRendererContent({
|
|
|
5695
6147
|
);
|
|
5696
6148
|
}
|
|
5697
6149
|
if (step === "success") {
|
|
5698
|
-
const
|
|
5699
|
-
const
|
|
6150
|
+
const isGuest = state.isGuestFlow && state.guestTransferComplete;
|
|
6151
|
+
const succeeded = isGuest ? true : state.transfer?.status === "COMPLETED";
|
|
6152
|
+
const displayAmount = isGuest ? parseFloat(state.amount) || (depositAmount ?? 0) : state.transfer?.amount?.amount ?? 0;
|
|
5700
6153
|
const displayCurrency = state.transfer?.amount?.currency ?? "USD";
|
|
5701
6154
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5702
6155
|
SuccessScreen,
|
|
@@ -5706,15 +6159,17 @@ function StepRendererContent({
|
|
|
5706
6159
|
succeeded,
|
|
5707
6160
|
error: state.error,
|
|
5708
6161
|
merchantName,
|
|
5709
|
-
sourceName,
|
|
5710
|
-
remainingLimit: succeeded ? (() => {
|
|
6162
|
+
sourceName: isGuest ? void 0 : sourceName,
|
|
6163
|
+
remainingLimit: !isGuest && succeeded ? (() => {
|
|
5711
6164
|
const limit = selectedSource != null ? selectedSource.remainingAllowance ?? null : selectedAccount?.remainingAllowance ?? null;
|
|
5712
6165
|
if (limit == null) return null;
|
|
5713
6166
|
return limit > displayAmount ? limit - displayAmount : 0;
|
|
5714
6167
|
})() : void 0,
|
|
5715
6168
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
5716
6169
|
onLogout: handlers.onLogout,
|
|
5717
|
-
autoCloseSeconds
|
|
6170
|
+
autoCloseSeconds: isGuest ? void 0 : autoCloseSeconds,
|
|
6171
|
+
isGuestTransfer: isGuest,
|
|
6172
|
+
onOfferSetup: () => handlers.onNavigate("offer-setup")
|
|
5718
6173
|
}
|
|
5719
6174
|
);
|
|
5720
6175
|
}
|
|
@@ -5786,7 +6241,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
5786
6241
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
5787
6242
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
5788
6243
|
] }) }),
|
|
5789
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
6244
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle15, children: "Something went wrong" }),
|
|
5790
6245
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: messageStyle, children: "An unexpected error occurred. Please try again." }),
|
|
5791
6246
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: this.handleReset, style: buttonStyle3, children: "Try again" })
|
|
5792
6247
|
] });
|
|
@@ -5806,7 +6261,7 @@ var containerStyle9 = {
|
|
|
5806
6261
|
var iconStyle3 = {
|
|
5807
6262
|
marginBottom: 20
|
|
5808
6263
|
};
|
|
5809
|
-
var
|
|
6264
|
+
var headingStyle15 = {
|
|
5810
6265
|
fontSize: "1.25rem",
|
|
5811
6266
|
fontWeight: 700,
|
|
5812
6267
|
color: "#1a1a1a",
|
|
@@ -7504,6 +7959,183 @@ function usePaymentEffects(deps) {
|
|
|
7504
7959
|
}
|
|
7505
7960
|
}, [pendingOneTapSetupAction, state.step, reloadAccounts, authExecutor, dispatch, oneTapLimitSavedDuringSetupRef]);
|
|
7506
7961
|
}
|
|
7962
|
+
var GUEST_POLL_INTERVAL_MS = 2e3;
|
|
7963
|
+
var GUEST_POLL_MAX_ATTEMPTS = 150;
|
|
7964
|
+
function useGuestTransferHandlers(deps) {
|
|
7965
|
+
const {
|
|
7966
|
+
dispatch,
|
|
7967
|
+
apiBaseUrl,
|
|
7968
|
+
destination,
|
|
7969
|
+
depositAmount,
|
|
7970
|
+
idempotencyKey,
|
|
7971
|
+
merchantAuthorization,
|
|
7972
|
+
onComplete,
|
|
7973
|
+
onError,
|
|
7974
|
+
sourceChainId,
|
|
7975
|
+
sourceToken,
|
|
7976
|
+
destinationChainId
|
|
7977
|
+
} = deps;
|
|
7978
|
+
const { connectAsync, connectors } = wagmi.useConnect();
|
|
7979
|
+
const { address, chainId: connectedChainId, isConnected } = wagmi.useAccount();
|
|
7980
|
+
const { sendTransactionAsync } = wagmi.useSendTransaction();
|
|
7981
|
+
const { switchChainAsync } = wagmi.useSwitchChain();
|
|
7982
|
+
const guestPollingRef = react.useRef(false);
|
|
7983
|
+
const pollGuestTransfer = react.useCallback(async (transferId) => {
|
|
7984
|
+
if (guestPollingRef.current) return;
|
|
7985
|
+
guestPollingRef.current = true;
|
|
7986
|
+
try {
|
|
7987
|
+
for (let i = 0; i < GUEST_POLL_MAX_ATTEMPTS; i++) {
|
|
7988
|
+
await new Promise((r) => setTimeout(r, GUEST_POLL_INTERVAL_MS));
|
|
7989
|
+
if (!guestPollingRef.current) return;
|
|
7990
|
+
const result = await fetchGuestTransfer(apiBaseUrl, transferId);
|
|
7991
|
+
if (result.status === "COMPLETED") {
|
|
7992
|
+
dispatch({ type: "GUEST_TRANSFER_COMPLETED", transferId });
|
|
7993
|
+
onComplete?.(result);
|
|
7994
|
+
return;
|
|
7995
|
+
}
|
|
7996
|
+
if (result.status === "FAILED") {
|
|
7997
|
+
dispatch({ type: "GUEST_TRANSFER_FAILED", error: "Transfer failed." });
|
|
7998
|
+
onError?.("Transfer failed.");
|
|
7999
|
+
return;
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
dispatch({ type: "GUEST_TRANSFER_FAILED", error: "Transfer timed out." });
|
|
8003
|
+
onError?.("Transfer timed out.");
|
|
8004
|
+
} finally {
|
|
8005
|
+
guestPollingRef.current = false;
|
|
8006
|
+
}
|
|
8007
|
+
}, [apiBaseUrl, dispatch, onComplete, onError]);
|
|
8008
|
+
const executeGuestFlow = react.useCallback(async () => {
|
|
8009
|
+
if (!merchantAuthorization) {
|
|
8010
|
+
dispatch({ type: "SET_ERROR", error: "Missing merchant authorization." });
|
|
8011
|
+
return;
|
|
8012
|
+
}
|
|
8013
|
+
const amount = depositAmount ?? 5;
|
|
8014
|
+
try {
|
|
8015
|
+
dispatch({ type: "NAVIGATE", step: "guest-connecting" });
|
|
8016
|
+
let walletAddress = address;
|
|
8017
|
+
let walletChainId = connectedChainId;
|
|
8018
|
+
if (!isConnected || !walletAddress) {
|
|
8019
|
+
const injected2 = connectors.find((c) => c.id === "injected" || c.id === "metaMask");
|
|
8020
|
+
if (!injected2) {
|
|
8021
|
+
dispatch({ type: "SET_ERROR", error: "No wallet found. Please install a browser wallet." });
|
|
8022
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8023
|
+
return;
|
|
8024
|
+
}
|
|
8025
|
+
const result = await connectAsync({ connector: injected2 });
|
|
8026
|
+
walletAddress = result.accounts[0];
|
|
8027
|
+
walletChainId = result.chainId;
|
|
8028
|
+
}
|
|
8029
|
+
if (!walletAddress) {
|
|
8030
|
+
dispatch({ type: "SET_ERROR", error: "Failed to connect wallet." });
|
|
8031
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8032
|
+
return;
|
|
8033
|
+
}
|
|
8034
|
+
dispatch({ type: "GUEST_WALLET_CONNECTED", address: walletAddress, chainId: walletChainId ?? 1 });
|
|
8035
|
+
const effectiveSourceChainId = sourceChainId ?? walletChainId ?? 8453;
|
|
8036
|
+
const effectiveDestChainId = destinationChainId ?? 8453;
|
|
8037
|
+
const effectiveSourceToken = sourceToken ?? destination.token.address;
|
|
8038
|
+
const quote = await fetchGuestQuote(apiBaseUrl, {
|
|
8039
|
+
merchantAuthorization,
|
|
8040
|
+
sourceAddress: walletAddress,
|
|
8041
|
+
sourceChainId: effectiveSourceChainId,
|
|
8042
|
+
sourceToken: effectiveSourceToken,
|
|
8043
|
+
destinationChainId: effectiveDestChainId,
|
|
8044
|
+
destinationAddress: destination.address,
|
|
8045
|
+
destinationToken: destination.token.address,
|
|
8046
|
+
amount: String(Math.round(amount * 1e6))
|
|
8047
|
+
});
|
|
8048
|
+
dispatch({ type: "GUEST_QUOTE_RECEIVED", quote });
|
|
8049
|
+
if (quote.steps.length === 0) {
|
|
8050
|
+
dispatch({ type: "SET_ERROR", error: "No bridge route available." });
|
|
8051
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8052
|
+
return;
|
|
8053
|
+
}
|
|
8054
|
+
const targetChainId = quote.steps[0].chainId;
|
|
8055
|
+
if (walletChainId !== targetChainId) {
|
|
8056
|
+
try {
|
|
8057
|
+
await switchChainAsync({ chainId: targetChainId });
|
|
8058
|
+
} catch {
|
|
8059
|
+
dispatch({ type: "SET_ERROR", error: `Please switch your wallet to chain ${targetChainId}.` });
|
|
8060
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8061
|
+
return;
|
|
8062
|
+
}
|
|
8063
|
+
}
|
|
8064
|
+
let lastTxHash;
|
|
8065
|
+
for (const step of quote.steps) {
|
|
8066
|
+
const txHash = await sendTransactionAsync({
|
|
8067
|
+
to: step.to,
|
|
8068
|
+
data: step.data || "0x",
|
|
8069
|
+
value: step.value ? BigInt(step.value) : 0n,
|
|
8070
|
+
chainId: step.chainId
|
|
8071
|
+
});
|
|
8072
|
+
lastTxHash = txHash;
|
|
8073
|
+
}
|
|
8074
|
+
if (!lastTxHash) {
|
|
8075
|
+
dispatch({ type: "SET_ERROR", error: "Transaction was not submitted." });
|
|
8076
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8077
|
+
return;
|
|
8078
|
+
}
|
|
8079
|
+
dispatch({ type: "GUEST_DEPOSIT_SIGNED", txHash: lastTxHash });
|
|
8080
|
+
const transferResult = await createGuestTransfer(apiBaseUrl, {
|
|
8081
|
+
id: idempotencyKey ?? crypto.randomUUID(),
|
|
8082
|
+
merchantAuthorization,
|
|
8083
|
+
requestId: quote.requestId,
|
|
8084
|
+
originTxHash: lastTxHash,
|
|
8085
|
+
sourceChainId: effectiveSourceChainId,
|
|
8086
|
+
sourceAddress: walletAddress,
|
|
8087
|
+
destinationChainId: effectiveDestChainId,
|
|
8088
|
+
destinationAddress: destination.address,
|
|
8089
|
+
destinationToken: destination.token.address,
|
|
8090
|
+
amount: { amount, currency: "USD" }
|
|
8091
|
+
});
|
|
8092
|
+
dispatch({ type: "GUEST_TRANSFER_SUBMITTED", transferId: transferResult.id });
|
|
8093
|
+
await pollGuestTransfer(transferResult.id);
|
|
8094
|
+
} catch (err) {
|
|
8095
|
+
const message = err instanceof Error ? err.message : "Transaction failed.";
|
|
8096
|
+
if (message.includes("rejected") || message.includes("denied") || message.includes("User rejected")) {
|
|
8097
|
+
dispatch({ type: "SET_ERROR", error: "Transaction was rejected." });
|
|
8098
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8099
|
+
} else {
|
|
8100
|
+
dispatch({ type: "SET_ERROR", error: message });
|
|
8101
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8102
|
+
}
|
|
8103
|
+
onError?.(message);
|
|
8104
|
+
}
|
|
8105
|
+
}, [
|
|
8106
|
+
address,
|
|
8107
|
+
apiBaseUrl,
|
|
8108
|
+
connectAsync,
|
|
8109
|
+
connectedChainId,
|
|
8110
|
+
connectors,
|
|
8111
|
+
depositAmount,
|
|
8112
|
+
destination,
|
|
8113
|
+
destinationChainId,
|
|
8114
|
+
dispatch,
|
|
8115
|
+
idempotencyKey,
|
|
8116
|
+
isConnected,
|
|
8117
|
+
merchantAuthorization,
|
|
8118
|
+
onComplete,
|
|
8119
|
+
onError,
|
|
8120
|
+
pollGuestTransfer,
|
|
8121
|
+
sendTransactionAsync,
|
|
8122
|
+
sourceChainId,
|
|
8123
|
+
sourceToken,
|
|
8124
|
+
switchChainAsync
|
|
8125
|
+
]);
|
|
8126
|
+
const handleGuestConfirm = react.useCallback(() => {
|
|
8127
|
+
void executeGuestFlow();
|
|
8128
|
+
}, [executeGuestFlow]);
|
|
8129
|
+
const handleGuestRetry = react.useCallback(() => {
|
|
8130
|
+
dispatch({ type: "SET_ERROR", error: null });
|
|
8131
|
+
dispatch({ type: "NAVIGATE", step: "guest-deposit" });
|
|
8132
|
+
}, [dispatch]);
|
|
8133
|
+
return {
|
|
8134
|
+
handleGuestConfirm,
|
|
8135
|
+
handleGuestRetry,
|
|
8136
|
+
guestPollingRef
|
|
8137
|
+
};
|
|
8138
|
+
}
|
|
7507
8139
|
function SwypePayment(props) {
|
|
7508
8140
|
const resetKey = react.useRef(0);
|
|
7509
8141
|
const handleBoundaryReset = react.useCallback(() => {
|
|
@@ -7521,7 +8153,10 @@ function SwypePaymentInner({
|
|
|
7521
8153
|
merchantName,
|
|
7522
8154
|
onBack,
|
|
7523
8155
|
onDismiss,
|
|
7524
|
-
autoCloseSeconds
|
|
8156
|
+
autoCloseSeconds,
|
|
8157
|
+
sourceChainId,
|
|
8158
|
+
sourceToken,
|
|
8159
|
+
destinationChainId
|
|
7525
8160
|
}) {
|
|
7526
8161
|
const { apiBaseUrl, depositAmount } = useSwypeConfig();
|
|
7527
8162
|
const { ready, authenticated, logout, getAccessToken } = reactAuth.usePrivy();
|
|
@@ -7614,6 +8249,19 @@ function SwypePaymentInner({
|
|
|
7614
8249
|
selectSourceChainName: sourceSelection.selectSourceChainName,
|
|
7615
8250
|
selectSourceTokenSymbol: sourceSelection.selectSourceTokenSymbol
|
|
7616
8251
|
});
|
|
8252
|
+
const guest = useGuestTransferHandlers({
|
|
8253
|
+
dispatch,
|
|
8254
|
+
apiBaseUrl,
|
|
8255
|
+
destination,
|
|
8256
|
+
depositAmount,
|
|
8257
|
+
idempotencyKey,
|
|
8258
|
+
merchantAuthorization,
|
|
8259
|
+
onComplete,
|
|
8260
|
+
onError,
|
|
8261
|
+
sourceChainId,
|
|
8262
|
+
sourceToken,
|
|
8263
|
+
destinationChainId
|
|
8264
|
+
});
|
|
7617
8265
|
const handleNewPayment = react.useCallback(() => {
|
|
7618
8266
|
clearMobileFlowState();
|
|
7619
8267
|
transfer.processingStartedAtRef.current = null;
|
|
@@ -7714,7 +8362,12 @@ function SwypePaymentInner({
|
|
|
7714
8362
|
onSetupOneTap: oneTapSetup.handleSetupOneTap,
|
|
7715
8363
|
onSelectToken: provider.handleNavigateToTokenPicker,
|
|
7716
8364
|
onSelectAuthorizedToken: provider.handleSelectAuthorizedToken,
|
|
7717
|
-
onAuthorizeToken: provider.handleAuthorizeToken
|
|
8365
|
+
onAuthorizeToken: provider.handleAuthorizeToken,
|
|
8366
|
+
onGuestConfirm: guest.handleGuestConfirm,
|
|
8367
|
+
onGuestSignIn: () => dispatch({ type: "START_SETUP_FLOW" }),
|
|
8368
|
+
onGuestRetry: guest.handleGuestRetry,
|
|
8369
|
+
onOfferSetup: () => dispatch({ type: "START_SETUP_FLOW" }),
|
|
8370
|
+
onSetupComplete: () => dispatch({ type: "SETUP_FLOW_COMPLETE" })
|
|
7718
8371
|
}), [
|
|
7719
8372
|
auth,
|
|
7720
8373
|
passkey,
|
|
@@ -7723,6 +8376,7 @@ function SwypePaymentInner({
|
|
|
7723
8376
|
mobileFlow,
|
|
7724
8377
|
sourceSelection,
|
|
7725
8378
|
oneTapSetup,
|
|
8379
|
+
guest,
|
|
7726
8380
|
handleLogout,
|
|
7727
8381
|
handleNewPayment
|
|
7728
8382
|
]);
|
|
@@ -7765,8 +8419,11 @@ function SwypePaymentInner({
|
|
|
7765
8419
|
|
|
7766
8420
|
exports.AdvancedSourceScreen = AdvancedSourceScreen;
|
|
7767
8421
|
exports.FlowPhaseProvider = FlowPhaseProvider;
|
|
8422
|
+
exports.GuestDepositScreen = GuestDepositScreen;
|
|
8423
|
+
exports.GuestWalletScreen = GuestWalletScreen;
|
|
7768
8424
|
exports.IconCircle = IconCircle;
|
|
7769
8425
|
exports.InfoBanner = InfoBanner;
|
|
8426
|
+
exports.OfferSetupScreen = OfferSetupScreen;
|
|
7770
8427
|
exports.OutlineButton = OutlineButton;
|
|
7771
8428
|
exports.PasskeyIframeBlockedError = PasskeyIframeBlockedError;
|
|
7772
8429
|
exports.PasskeyScreen = PasskeyScreen;
|
|
@@ -7778,6 +8435,7 @@ exports.ScreenHeader = ScreenHeader;
|
|
|
7778
8435
|
exports.ScreenLayout = ScreenLayout;
|
|
7779
8436
|
exports.SelectSourceScreen = SelectSourceScreen;
|
|
7780
8437
|
exports.SettingsMenu = SettingsMenu;
|
|
8438
|
+
exports.SetupCompleteScreen = SetupCompleteScreen;
|
|
7781
8439
|
exports.SetupScreen = SetupScreen;
|
|
7782
8440
|
exports.Spinner = Spinner;
|
|
7783
8441
|
exports.StepList = StepList;
|