@swype-org/react-sdk 0.1.116 → 0.1.123
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 +120 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +120 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -714,7 +714,7 @@ declare function Spinner({ size, label }: SpinnerProps): react_jsx_runtime.JSX.E
|
|
|
714
714
|
|
|
715
715
|
declare function SwypeLoadingScreen(): react_jsx_runtime.JSX.Element;
|
|
716
716
|
|
|
717
|
-
interface
|
|
717
|
+
interface PasskeyScreenProps {
|
|
718
718
|
onCreatePasskey: () => void;
|
|
719
719
|
onBack?: () => void;
|
|
720
720
|
creating: boolean;
|
|
@@ -724,7 +724,7 @@ interface CreatePasskeyScreenProps {
|
|
|
724
724
|
/** Opens a pop-up window on the Swype domain for passkey registration. */
|
|
725
725
|
onCreatePasskeyViaPopup?: () => void;
|
|
726
726
|
}
|
|
727
|
-
declare function
|
|
727
|
+
declare function PasskeyScreen({ onCreatePasskey, onBack, creating, error, popupFallback, onCreatePasskeyViaPopup, }: PasskeyScreenProps): react_jsx_runtime.JSX.Element;
|
|
728
728
|
|
|
729
729
|
interface SetupScreenProps {
|
|
730
730
|
availableBalance: number;
|
|
@@ -797,4 +797,4 @@ interface TokenPickerScreenProps {
|
|
|
797
797
|
}
|
|
798
798
|
declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
|
|
799
799
|
|
|
800
|
-
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain,
|
|
800
|
+
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, PasskeyScreen, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypeLoadingScreen, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, TokenPickerScreen, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
package/dist/index.d.ts
CHANGED
|
@@ -714,7 +714,7 @@ declare function Spinner({ size, label }: SpinnerProps): react_jsx_runtime.JSX.E
|
|
|
714
714
|
|
|
715
715
|
declare function SwypeLoadingScreen(): react_jsx_runtime.JSX.Element;
|
|
716
716
|
|
|
717
|
-
interface
|
|
717
|
+
interface PasskeyScreenProps {
|
|
718
718
|
onCreatePasskey: () => void;
|
|
719
719
|
onBack?: () => void;
|
|
720
720
|
creating: boolean;
|
|
@@ -724,7 +724,7 @@ interface CreatePasskeyScreenProps {
|
|
|
724
724
|
/** Opens a pop-up window on the Swype domain for passkey registration. */
|
|
725
725
|
onCreatePasskeyViaPopup?: () => void;
|
|
726
726
|
}
|
|
727
|
-
declare function
|
|
727
|
+
declare function PasskeyScreen({ onCreatePasskey, onBack, creating, error, popupFallback, onCreatePasskeyViaPopup, }: PasskeyScreenProps): react_jsx_runtime.JSX.Element;
|
|
728
728
|
|
|
729
729
|
interface SetupScreenProps {
|
|
730
730
|
availableBalance: number;
|
|
@@ -797,4 +797,4 @@ interface TokenPickerScreenProps {
|
|
|
797
797
|
}
|
|
798
798
|
declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
|
|
799
799
|
|
|
800
|
-
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain,
|
|
800
|
+
export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, PasskeyScreen, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypeLoadingScreen, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, TokenPickerScreen, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
package/dist/index.js
CHANGED
|
@@ -808,10 +808,10 @@ function createPasskeyViaPopup(options) {
|
|
|
808
808
|
if (result) {
|
|
809
809
|
resolve(result);
|
|
810
810
|
} else {
|
|
811
|
-
reject(new Error("Passkey
|
|
811
|
+
reject(new Error("Passkey window was closed before completing."));
|
|
812
812
|
}
|
|
813
813
|
}).catch(() => {
|
|
814
|
-
reject(new Error("Passkey
|
|
814
|
+
reject(new Error("Passkey window was closed before completing."));
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
817
|
}, POPUP_CLOSED_GRACE_MS);
|
|
@@ -1737,6 +1737,9 @@ function resolvePostAuthStep(state) {
|
|
|
1737
1737
|
return { step: "create-passkey", clearPersistedFlow: false };
|
|
1738
1738
|
}
|
|
1739
1739
|
if (state.persistedMobileFlow) {
|
|
1740
|
+
if (state.persistedMobileFlow.isReauthorization) {
|
|
1741
|
+
return { step: "open-wallet", clearPersistedFlow: false };
|
|
1742
|
+
}
|
|
1740
1743
|
if (state.persistedMobileFlow.isSetup && hasActiveWallet(state.accounts)) {
|
|
1741
1744
|
return { step: "deposit", clearPersistedFlow: true };
|
|
1742
1745
|
}
|
|
@@ -1905,7 +1908,10 @@ function buildSelectSourceChoices(options) {
|
|
|
1905
1908
|
chainChoice.tokens.push({ tokenSymbol, balance });
|
|
1906
1909
|
}
|
|
1907
1910
|
}
|
|
1908
|
-
return chainChoices
|
|
1911
|
+
return chainChoices.map((chain) => ({
|
|
1912
|
+
...chain,
|
|
1913
|
+
tokens: chain.tokens.filter((t) => t.balance > 0)
|
|
1914
|
+
})).filter((chain) => chain.tokens.length > 0);
|
|
1909
1915
|
}
|
|
1910
1916
|
|
|
1911
1917
|
// src/paymentReducer.ts
|
|
@@ -2245,7 +2251,7 @@ var spinnerStyle = {
|
|
|
2245
2251
|
};
|
|
2246
2252
|
var FOOTER_CSS = `
|
|
2247
2253
|
.swype-screen-footer {
|
|
2248
|
-
padding-bottom: max(
|
|
2254
|
+
padding-bottom: max(32px, env(safe-area-inset-bottom, 32px));
|
|
2249
2255
|
}`;
|
|
2250
2256
|
function ScreenLayout({ children, footer }) {
|
|
2251
2257
|
const { tokens } = useSwypeConfig();
|
|
@@ -2268,12 +2274,16 @@ var containerStyle2 = (bg) => ({
|
|
|
2268
2274
|
});
|
|
2269
2275
|
var bodyStyle = {
|
|
2270
2276
|
flex: 1,
|
|
2277
|
+
minHeight: 0,
|
|
2271
2278
|
padding: "0 24px",
|
|
2272
2279
|
display: "flex",
|
|
2273
|
-
flexDirection: "column"
|
|
2280
|
+
flexDirection: "column",
|
|
2281
|
+
overflowY: "auto"
|
|
2274
2282
|
};
|
|
2275
2283
|
var footerStyle = {
|
|
2276
|
-
|
|
2284
|
+
paddingTop: 16,
|
|
2285
|
+
paddingLeft: 24,
|
|
2286
|
+
paddingRight: 24,
|
|
2277
2287
|
marginTop: "auto"
|
|
2278
2288
|
};
|
|
2279
2289
|
function ScreenHeader({ title, right, onBack, badge }) {
|
|
@@ -3150,7 +3160,7 @@ function LoginScreen({
|
|
|
3150
3160
|
] }),
|
|
3151
3161
|
/* @__PURE__ */ jsxs("div", { style: walletSectionStyle, children: [
|
|
3152
3162
|
/* @__PURE__ */ jsx("span", { style: walletLabelStyle(tokens.textMuted), children: "Works with" }),
|
|
3153
|
-
/* @__PURE__ */ jsx("div", { style: walletLogosStyle, children: walletIcons.map(({ key,
|
|
3163
|
+
/* @__PURE__ */ jsx("div", { style: walletLogosStyle, children: walletIcons.map(({ key, logo }) => /* @__PURE__ */ jsx("img", { src: logo, alt: key, style: walletLogoImgStyle }, key)) })
|
|
3154
3164
|
] }),
|
|
3155
3165
|
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
3156
3166
|
] }),
|
|
@@ -3189,11 +3199,9 @@ function LoginScreen({
|
|
|
3189
3199
|
);
|
|
3190
3200
|
}
|
|
3191
3201
|
var walletIcons = [
|
|
3192
|
-
{ key: "metamask",
|
|
3193
|
-
{ key: "
|
|
3194
|
-
{ key: "
|
|
3195
|
-
{ key: "rainbow", emoji: "\u{1F439}" },
|
|
3196
|
-
{ key: "coinbase", emoji: "\u{1F535}", logo: KNOWN_LOGOS["base"] }
|
|
3202
|
+
{ key: "metamask", logo: KNOWN_LOGOS["metamask"] },
|
|
3203
|
+
{ key: "base", logo: KNOWN_LOGOS["base"] },
|
|
3204
|
+
{ key: "trust wallet", logo: KNOWN_LOGOS["trust wallet"] }
|
|
3197
3205
|
];
|
|
3198
3206
|
function socialLabel(provider) {
|
|
3199
3207
|
switch (provider) {
|
|
@@ -3313,10 +3321,6 @@ var walletLogosStyle = {
|
|
|
3313
3321
|
justifyContent: "center",
|
|
3314
3322
|
gap: 16
|
|
3315
3323
|
};
|
|
3316
|
-
var walletEmojiStyle = {
|
|
3317
|
-
fontSize: "1.4rem",
|
|
3318
|
-
lineHeight: 1
|
|
3319
|
-
};
|
|
3320
3324
|
var walletLogoImgStyle = {
|
|
3321
3325
|
width: 24,
|
|
3322
3326
|
height: 24,
|
|
@@ -3468,7 +3472,7 @@ var hintStyle = (color) => ({
|
|
|
3468
3472
|
color,
|
|
3469
3473
|
margin: "12px 0 0"
|
|
3470
3474
|
});
|
|
3471
|
-
function
|
|
3475
|
+
function PasskeyScreen({
|
|
3472
3476
|
onCreatePasskey,
|
|
3473
3477
|
onBack,
|
|
3474
3478
|
creating,
|
|
@@ -3478,7 +3482,7 @@ function CreatePasskeyScreen({
|
|
|
3478
3482
|
}) {
|
|
3479
3483
|
const { tokens } = useSwypeConfig();
|
|
3480
3484
|
const handleCreate = popupFallback && onCreatePasskeyViaPopup ? onCreatePasskeyViaPopup : onCreatePasskey;
|
|
3481
|
-
const buttonLabel = popupFallback ? "Open passkey
|
|
3485
|
+
const buttonLabel = popupFallback ? "Open passkey window" : "Create or verify passkey";
|
|
3482
3486
|
return /* @__PURE__ */ jsxs(
|
|
3483
3487
|
ScreenLayout,
|
|
3484
3488
|
{
|
|
@@ -3495,8 +3499,8 @@ function CreatePasskeyScreen({
|
|
|
3495
3499
|
/* @__PURE__ */ jsx("circle", { cx: "15", cy: "10", r: "1", fill: tokens.accent }),
|
|
3496
3500
|
/* @__PURE__ */ jsx("path", { d: "M9 14c0 1.5 1.34 2.5 3 2.5s3-1 3-2.5", stroke: tokens.accent, strokeWidth: "1.2", strokeLinecap: "round" })
|
|
3497
3501
|
] }) }),
|
|
3498
|
-
/* @__PURE__ */ jsx("h2", { style: headingStyle3(tokens.text), children: "Create your passkey" }),
|
|
3499
|
-
/* @__PURE__ */ jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: popupFallback ? "Your browser requires a separate window
|
|
3502
|
+
/* @__PURE__ */ jsx("h2", { style: headingStyle3(tokens.text), children: "Create or verify your passkey" }),
|
|
3503
|
+
/* @__PURE__ */ jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: popupFallback ? "Your browser requires a separate window to continue. Tap the button below to continue." : "Use Face ID to sign in instantly \u2014 no passwords, no codes." }),
|
|
3500
3504
|
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle2(tokens), children: error }),
|
|
3501
3505
|
/* @__PURE__ */ jsx(InfoBanner, { children: "Your passkey is stored securely on your device. Swype never sees your biometric data." })
|
|
3502
3506
|
] })
|
|
@@ -3839,16 +3843,16 @@ function SetupScreen({
|
|
|
3839
3843
|
error
|
|
3840
3844
|
}) {
|
|
3841
3845
|
const { tokens } = useSwypeConfig();
|
|
3842
|
-
const effectiveMax = DEFAULT_MAX;
|
|
3846
|
+
const effectiveMax = Math.min(DEFAULT_MAX, availableBalance);
|
|
3843
3847
|
const effectiveMin = Math.min(ABSOLUTE_MIN, effectiveMax);
|
|
3844
|
-
const [limit, setLimit] = useState(() => effectiveMax);
|
|
3848
|
+
const [limit, setLimit] = useState(() => Math.min(availableBalance, effectiveMax));
|
|
3845
3849
|
const [editing, setEditing] = useState(false);
|
|
3846
3850
|
const [inputValue, setInputValue] = useState("");
|
|
3847
3851
|
const inputRef = useRef(null);
|
|
3848
3852
|
const startEditing = useCallback(() => {
|
|
3849
3853
|
setInputValue(limit.toFixed(2));
|
|
3850
3854
|
setEditing(true);
|
|
3851
|
-
requestAnimationFrame(() => inputRef.current?.
|
|
3855
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
3852
3856
|
}, [limit]);
|
|
3853
3857
|
const commitEdit = useCallback(() => {
|
|
3854
3858
|
const parsed = parseFloat(inputValue);
|
|
@@ -5138,6 +5142,7 @@ function OpenWalletScreen({
|
|
|
5138
5142
|
loading,
|
|
5139
5143
|
error,
|
|
5140
5144
|
onRetryStatus,
|
|
5145
|
+
onBack,
|
|
5141
5146
|
onLogout
|
|
5142
5147
|
}) {
|
|
5143
5148
|
const { tokens } = useSwypeConfig();
|
|
@@ -5168,7 +5173,7 @@ function OpenWalletScreen({
|
|
|
5168
5173
|
/* @__PURE__ */ jsx("p", { style: hintStyle3(tokens.textMuted), children: loading ? "Preparing authorization..." : error ? "Retry the status check after returning to the browser, or reopen your wallet if needed." : "If your wallet didn't open automatically, tap the button above" })
|
|
5169
5174
|
] }),
|
|
5170
5175
|
children: [
|
|
5171
|
-
/* @__PURE__ */ jsx(ScreenHeader, { right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) }),
|
|
5176
|
+
/* @__PURE__ */ jsx(ScreenHeader, { onBack, right: /* @__PURE__ */ jsx(SettingsMenu, { onLogout }) }),
|
|
5172
5177
|
/* @__PURE__ */ jsxs("div", { style: contentStyle8, children: [
|
|
5173
5178
|
logoSrc ? /* @__PURE__ */ jsx("img", { src: logoSrc, alt: displayName, style: logoStyle }) : /* @__PURE__ */ jsx(Spinner, { size: 48 }),
|
|
5174
5179
|
/* @__PURE__ */ jsx("h2", { style: headingStyle10(tokens.text), children: loading ? "Connecting..." : `Open ${displayName}` }),
|
|
@@ -5627,7 +5632,7 @@ function StepRenderer({
|
|
|
5627
5632
|
}
|
|
5628
5633
|
if (step === "create-passkey") {
|
|
5629
5634
|
return /* @__PURE__ */ jsx(
|
|
5630
|
-
|
|
5635
|
+
PasskeyScreen,
|
|
5631
5636
|
{
|
|
5632
5637
|
onCreatePasskey: handlers.onRegisterPasskey,
|
|
5633
5638
|
onBack: handlers.onLogout,
|
|
@@ -5638,6 +5643,19 @@ function StepRenderer({
|
|
|
5638
5643
|
}
|
|
5639
5644
|
);
|
|
5640
5645
|
}
|
|
5646
|
+
if (step === "verify-passkey") {
|
|
5647
|
+
return /* @__PURE__ */ jsx(
|
|
5648
|
+
PasskeyScreen,
|
|
5649
|
+
{
|
|
5650
|
+
onCreatePasskey: handlers.onRegisterPasskey,
|
|
5651
|
+
onBack: handlers.onLogout,
|
|
5652
|
+
creating: state.verifyingPasskeyPopup,
|
|
5653
|
+
error: state.error,
|
|
5654
|
+
popupFallback: true,
|
|
5655
|
+
onCreatePasskeyViaPopup: handlers.onVerifyPasskeyViaPopup
|
|
5656
|
+
}
|
|
5657
|
+
);
|
|
5658
|
+
}
|
|
5641
5659
|
if (step === "wallet-picker") {
|
|
5642
5660
|
return /* @__PURE__ */ jsx(
|
|
5643
5661
|
WalletPickerScreen,
|
|
@@ -5661,6 +5679,7 @@ function StepRenderer({
|
|
|
5661
5679
|
loading: state.creatingTransfer || !state.deeplinkUri,
|
|
5662
5680
|
error: state.error || pollingError,
|
|
5663
5681
|
onRetryStatus: handlers.onRetryMobileStatus,
|
|
5682
|
+
onBack: () => handlers.onNavigate("wallet-picker"),
|
|
5664
5683
|
onLogout: handlers.onLogout
|
|
5665
5684
|
}
|
|
5666
5685
|
);
|
|
@@ -5951,6 +5970,8 @@ function SwypePaymentInner({
|
|
|
5951
5970
|
const initializedSelectSourceActionRef = useRef(null);
|
|
5952
5971
|
const preSelectSourceStepRef = useRef(null);
|
|
5953
5972
|
const pendingTokenAuthRef = useRef(null);
|
|
5973
|
+
const reauthSessionIdRef = useRef(null);
|
|
5974
|
+
const reauthTokenRef = useRef(null);
|
|
5954
5975
|
const checkingPasskeyRef = useRef(false);
|
|
5955
5976
|
const onCompleteRef = useRef(onComplete);
|
|
5956
5977
|
onCompleteRef.current = onComplete;
|
|
@@ -6244,7 +6265,7 @@ function SwypePaymentInner({
|
|
|
6244
6265
|
return;
|
|
6245
6266
|
}
|
|
6246
6267
|
if (!state.activeCredentialId) {
|
|
6247
|
-
dispatch({ type: "SET_ERROR", error: "Create a passkey on this device before continuing." });
|
|
6268
|
+
dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
|
|
6248
6269
|
dispatch({ type: "NAVIGATE", step: "create-passkey" });
|
|
6249
6270
|
return;
|
|
6250
6271
|
}
|
|
@@ -6325,7 +6346,7 @@ function SwypePaymentInner({
|
|
|
6325
6346
|
return;
|
|
6326
6347
|
}
|
|
6327
6348
|
if (!state.activeCredentialId) {
|
|
6328
|
-
dispatch({ type: "SET_ERROR", error: "Create a passkey on this device before continuing." });
|
|
6349
|
+
dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
|
|
6329
6350
|
dispatch({ type: "NAVIGATE", step: "create-passkey" });
|
|
6330
6351
|
return;
|
|
6331
6352
|
}
|
|
@@ -6353,12 +6374,15 @@ function SwypePaymentInner({
|
|
|
6353
6374
|
handlingMobileReturnRef.current = false;
|
|
6354
6375
|
mobileSetupFlowRef.current = true;
|
|
6355
6376
|
setupAccountIdRef.current = state.selectedAccountId;
|
|
6377
|
+
reauthSessionIdRef.current = session.id;
|
|
6378
|
+
reauthTokenRef.current = null;
|
|
6356
6379
|
persistMobileFlowState({
|
|
6357
6380
|
accountId: state.selectedAccountId,
|
|
6358
6381
|
sessionId: session.id,
|
|
6359
6382
|
deeplinkUri: session.uri,
|
|
6360
6383
|
providerId: matchedProvider?.id ?? null,
|
|
6361
|
-
isSetup: true
|
|
6384
|
+
isSetup: true,
|
|
6385
|
+
isReauthorization: true
|
|
6362
6386
|
});
|
|
6363
6387
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6364
6388
|
triggerDeeplink(session.uri);
|
|
@@ -6399,7 +6423,7 @@ function SwypePaymentInner({
|
|
|
6399
6423
|
return;
|
|
6400
6424
|
}
|
|
6401
6425
|
if (!state.activeCredentialId) {
|
|
6402
|
-
dispatch({ type: "SET_ERROR", error: "Create a passkey on this device before continuing." });
|
|
6426
|
+
dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
|
|
6403
6427
|
dispatch({ type: "NAVIGATE", step: "create-passkey" });
|
|
6404
6428
|
return;
|
|
6405
6429
|
}
|
|
@@ -6429,12 +6453,16 @@ function SwypePaymentInner({
|
|
|
6429
6453
|
handlingMobileReturnRef.current = false;
|
|
6430
6454
|
mobileSetupFlowRef.current = true;
|
|
6431
6455
|
setupAccountIdRef.current = state.selectedAccountId;
|
|
6456
|
+
reauthSessionIdRef.current = session.id;
|
|
6457
|
+
reauthTokenRef.current = { walletId: _walletId, tokenSymbol };
|
|
6432
6458
|
persistMobileFlowState({
|
|
6433
6459
|
accountId: state.selectedAccountId,
|
|
6434
6460
|
sessionId: session.id,
|
|
6435
6461
|
deeplinkUri: session.uri,
|
|
6436
6462
|
providerId: matchedProvider?.id ?? null,
|
|
6437
|
-
isSetup: true
|
|
6463
|
+
isSetup: true,
|
|
6464
|
+
isReauthorization: true,
|
|
6465
|
+
reauthorizationToken: { walletId: _walletId, tokenSymbol }
|
|
6438
6466
|
});
|
|
6439
6467
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6440
6468
|
triggerDeeplink(session.uri);
|
|
@@ -6496,7 +6524,7 @@ function SwypePaymentInner({
|
|
|
6496
6524
|
const handleSelectProvider = useCallback(async (providerId) => {
|
|
6497
6525
|
dispatch({ type: "SELECT_PROVIDER", providerId });
|
|
6498
6526
|
if (!state.activeCredentialId) {
|
|
6499
|
-
dispatch({ type: "SET_ERROR", error: "Create a passkey on this device before continuing." });
|
|
6527
|
+
dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
|
|
6500
6528
|
dispatch({ type: "NAVIGATE", step: "create-passkey" });
|
|
6501
6529
|
return;
|
|
6502
6530
|
}
|
|
@@ -6707,6 +6735,31 @@ function SwypePaymentInner({
|
|
|
6707
6735
|
} catch {
|
|
6708
6736
|
}
|
|
6709
6737
|
}
|
|
6738
|
+
if (resolved.step === "open-wallet" && persisted && persisted.isReauthorization && persisted.sessionId) {
|
|
6739
|
+
try {
|
|
6740
|
+
const session = await fetchAuthorizationSession(apiBaseUrl, persisted.sessionId);
|
|
6741
|
+
if (cancelled) return;
|
|
6742
|
+
if (session.status === "AUTHORIZED") {
|
|
6743
|
+
clearMobileFlowState();
|
|
6744
|
+
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
6745
|
+
if (persisted.reauthorizationToken) {
|
|
6746
|
+
dispatch({ type: "SELECT_TOKEN", walletId: persisted.reauthorizationToken.walletId, tokenSymbol: persisted.reauthorizationToken.tokenSymbol });
|
|
6747
|
+
}
|
|
6748
|
+
return;
|
|
6749
|
+
}
|
|
6750
|
+
} catch {
|
|
6751
|
+
}
|
|
6752
|
+
reauthSessionIdRef.current = persisted.sessionId;
|
|
6753
|
+
reauthTokenRef.current = persisted.reauthorizationToken ?? null;
|
|
6754
|
+
mobileSetupFlowRef.current = true;
|
|
6755
|
+
setupAccountIdRef.current = persisted.accountId ?? null;
|
|
6756
|
+
dispatch({
|
|
6757
|
+
type: "ENTER_MOBILE_FLOW",
|
|
6758
|
+
deeplinkUri: persisted.deeplinkUri,
|
|
6759
|
+
providerId: persisted.providerId
|
|
6760
|
+
});
|
|
6761
|
+
return;
|
|
6762
|
+
}
|
|
6710
6763
|
if (resolved.step === "open-wallet" && persisted && persisted.accountId && !persisted.transferId) {
|
|
6711
6764
|
clearMobileFlowState();
|
|
6712
6765
|
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
@@ -6760,6 +6813,7 @@ function SwypePaymentInner({
|
|
|
6760
6813
|
});
|
|
6761
6814
|
pollingTransferIdRef.current = persisted.transferId ?? null;
|
|
6762
6815
|
mobileSetupFlowRef.current = persisted.isSetup;
|
|
6816
|
+
setupAccountIdRef.current = persisted.accountId ?? null;
|
|
6763
6817
|
if (persisted.transferId) pollingRef.current.startPolling(persisted.transferId);
|
|
6764
6818
|
return;
|
|
6765
6819
|
}
|
|
@@ -6770,6 +6824,7 @@ function SwypePaymentInner({
|
|
|
6770
6824
|
});
|
|
6771
6825
|
pollingTransferIdRef.current = persisted.transferId ?? null;
|
|
6772
6826
|
mobileSetupFlowRef.current = persisted.isSetup;
|
|
6827
|
+
setupAccountIdRef.current = persisted.accountId ?? null;
|
|
6773
6828
|
if (persisted.transferId) pollingRef.current.startPolling(persisted.transferId);
|
|
6774
6829
|
return;
|
|
6775
6830
|
}
|
|
@@ -6974,9 +7029,36 @@ function SwypePaymentInner({
|
|
|
6974
7029
|
if (!state.activeCredentialId || !setupAccountIdRef.current) return;
|
|
6975
7030
|
const accountId = setupAccountIdRef.current;
|
|
6976
7031
|
const credentialId = state.activeCredentialId;
|
|
7032
|
+
const isReauth = !!reauthSessionIdRef.current;
|
|
7033
|
+
const sessionId = reauthSessionIdRef.current;
|
|
7034
|
+
const tokenSelection = reauthTokenRef.current;
|
|
6977
7035
|
let cancelled = false;
|
|
6978
7036
|
const POLL_INTERVAL_MS = 3e3;
|
|
6979
|
-
const
|
|
7037
|
+
const pollReauthorization = async () => {
|
|
7038
|
+
try {
|
|
7039
|
+
if (!sessionId || cancelled) return;
|
|
7040
|
+
const session = await fetchAuthorizationSession(apiBaseUrl, sessionId);
|
|
7041
|
+
if (cancelled) return;
|
|
7042
|
+
if (session.status === "AUTHORIZED") {
|
|
7043
|
+
cancelled = true;
|
|
7044
|
+
mobileSetupFlowRef.current = false;
|
|
7045
|
+
setupAccountIdRef.current = null;
|
|
7046
|
+
reauthSessionIdRef.current = null;
|
|
7047
|
+
reauthTokenRef.current = null;
|
|
7048
|
+
clearMobileFlowState();
|
|
7049
|
+
try {
|
|
7050
|
+
await reloadAccounts();
|
|
7051
|
+
} catch {
|
|
7052
|
+
}
|
|
7053
|
+
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
7054
|
+
if (tokenSelection) {
|
|
7055
|
+
dispatch({ type: "SELECT_TOKEN", walletId: tokenSelection.walletId, tokenSymbol: tokenSelection.tokenSymbol });
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
} catch {
|
|
7059
|
+
}
|
|
7060
|
+
};
|
|
7061
|
+
const pollWalletActive = async () => {
|
|
6980
7062
|
try {
|
|
6981
7063
|
const token = await getAccessTokenRef.current();
|
|
6982
7064
|
if (!token || cancelled) return;
|
|
@@ -6988,12 +7070,16 @@ function SwypePaymentInner({
|
|
|
6988
7070
|
mobileSetupFlowRef.current = false;
|
|
6989
7071
|
setupAccountIdRef.current = null;
|
|
6990
7072
|
clearMobileFlowState();
|
|
6991
|
-
|
|
7073
|
+
try {
|
|
7074
|
+
await reloadAccounts();
|
|
7075
|
+
} catch {
|
|
7076
|
+
}
|
|
6992
7077
|
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
6993
7078
|
}
|
|
6994
7079
|
} catch {
|
|
6995
7080
|
}
|
|
6996
7081
|
};
|
|
7082
|
+
const poll = isReauth ? pollReauthorization : pollWalletActive;
|
|
6997
7083
|
poll();
|
|
6998
7084
|
const intervalId = window.setInterval(poll, POLL_INTERVAL_MS);
|
|
6999
7085
|
const handleVisibility = () => {
|
|
@@ -7162,6 +7248,6 @@ function SwypePaymentInner({
|
|
|
7162
7248
|
);
|
|
7163
7249
|
}
|
|
7164
7250
|
|
|
7165
|
-
export { AdvancedSourceScreen,
|
|
7251
|
+
export { AdvancedSourceScreen, IconCircle, InfoBanner, OutlineButton, PasskeyIframeBlockedError, PasskeyScreen, PoweredByFooter, PrimaryButton, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, Spinner, StepList, SwypeLoadingScreen, SwypePayment, SwypeProvider, TokenPickerScreen, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api_exports as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
|
|
7166
7252
|
//# sourceMappingURL=index.js.map
|
|
7167
7253
|
//# sourceMappingURL=index.js.map
|