@swype-org/react-sdk 0.1.158 → 0.1.159
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 +55 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +55 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6469,16 +6469,10 @@ function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransfe
|
|
|
6469
6469
|
clearMobileFlowState();
|
|
6470
6470
|
try {
|
|
6471
6471
|
await reloadAccounts();
|
|
6472
|
-
|
|
6473
|
-
dispatch({ type: "MOBILE_SETUP_COMPLETE", transfer: authorizedTransfer });
|
|
6474
|
-
} catch (err) {
|
|
6475
|
-
handlingMobileReturnRef.current = false;
|
|
6476
|
-
dispatch({
|
|
6477
|
-
type: "SET_ERROR",
|
|
6478
|
-
error: err instanceof Error ? err.message : "Wallet authorized, but we could not refresh your account yet."
|
|
6479
|
-
});
|
|
6480
|
-
dispatch({ type: "NAVIGATE", step: "open-wallet" });
|
|
6472
|
+
} catch {
|
|
6481
6473
|
}
|
|
6474
|
+
loadingDataRef.current = false;
|
|
6475
|
+
dispatch({ type: "MOBILE_SETUP_COMPLETE", transfer: authorizedTransfer });
|
|
6482
6476
|
return;
|
|
6483
6477
|
}
|
|
6484
6478
|
mobileSetupFlowRef.current = false;
|
|
@@ -6659,7 +6653,17 @@ function useProviderHandlers(deps) {
|
|
|
6659
6653
|
const acct = accounts.find((a) => a.id === accountId);
|
|
6660
6654
|
if (!acct) return;
|
|
6661
6655
|
const matchedProvider = providers.find((p) => p.name === acct.name);
|
|
6662
|
-
if (matchedProvider)
|
|
6656
|
+
if (!matchedProvider) return;
|
|
6657
|
+
const pendingSession = acct.authorizationSessions?.find(
|
|
6658
|
+
(s) => s.status === "PENDING"
|
|
6659
|
+
);
|
|
6660
|
+
if (pendingSession) {
|
|
6661
|
+
handleSelectProvider(matchedProvider.id, {
|
|
6662
|
+
accountId: acct.id,
|
|
6663
|
+
sessionId: pendingSession.id,
|
|
6664
|
+
uri: pendingSession.uri
|
|
6665
|
+
});
|
|
6666
|
+
} else {
|
|
6663
6667
|
handleSelectProvider(matchedProvider.id);
|
|
6664
6668
|
}
|
|
6665
6669
|
},
|
|
@@ -7096,8 +7100,25 @@ function usePaymentEffects(deps) {
|
|
|
7096
7100
|
return;
|
|
7097
7101
|
}
|
|
7098
7102
|
if (resolved.step === "open-wallet" && persisted && persisted.accountId && !persisted.transferId) {
|
|
7099
|
-
|
|
7100
|
-
|
|
7103
|
+
if (persisted.sessionId) {
|
|
7104
|
+
try {
|
|
7105
|
+
const session = await fetchAuthorizationSession(apiBaseUrl, persisted.sessionId);
|
|
7106
|
+
if (cancelled) return;
|
|
7107
|
+
if (session.status === "AUTHORIZED") {
|
|
7108
|
+
clearMobileFlowState();
|
|
7109
|
+
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
7110
|
+
return;
|
|
7111
|
+
}
|
|
7112
|
+
} catch {
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
mobileSetupFlowRef.current = true;
|
|
7116
|
+
setupAccountIdRef.current = persisted.accountId;
|
|
7117
|
+
dispatch({
|
|
7118
|
+
type: "ENTER_MOBILE_FLOW",
|
|
7119
|
+
deeplinkUri: persisted.deeplinkUri,
|
|
7120
|
+
providerId: persisted.providerId
|
|
7121
|
+
});
|
|
7101
7122
|
return;
|
|
7102
7123
|
}
|
|
7103
7124
|
if (resolved.step === "open-wallet" && persisted && persisted.transferId) {
|
|
@@ -7366,6 +7387,8 @@ function usePaymentEffects(deps) {
|
|
|
7366
7387
|
const isReauth = !!reauthSessionIdRef.current;
|
|
7367
7388
|
const sessionId = reauthSessionIdRef.current;
|
|
7368
7389
|
const tokenSelection = reauthTokenRef.current;
|
|
7390
|
+
const persistedFlow = loadMobileFlowState();
|
|
7391
|
+
const setupSessionId = !isReauth ? persistedFlow?.sessionId : void 0;
|
|
7369
7392
|
let cancelled = false;
|
|
7370
7393
|
const POLL_INTERVAL_MS = 3e3;
|
|
7371
7394
|
const pollReauthorization = async () => {
|
|
@@ -7392,6 +7415,17 @@ function usePaymentEffects(deps) {
|
|
|
7392
7415
|
} catch {
|
|
7393
7416
|
}
|
|
7394
7417
|
};
|
|
7418
|
+
const completeSetup = async () => {
|
|
7419
|
+
cancelled = true;
|
|
7420
|
+
mobileSetupFlowRef.current = false;
|
|
7421
|
+
setupAccountIdRef.current = null;
|
|
7422
|
+
clearMobileFlowState();
|
|
7423
|
+
try {
|
|
7424
|
+
await reloadAccounts();
|
|
7425
|
+
} catch {
|
|
7426
|
+
}
|
|
7427
|
+
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
7428
|
+
};
|
|
7395
7429
|
const pollWalletActive = async () => {
|
|
7396
7430
|
try {
|
|
7397
7431
|
const token = await getAccessTokenRef.current();
|
|
@@ -7400,15 +7434,18 @@ function usePaymentEffects(deps) {
|
|
|
7400
7434
|
if (cancelled) return;
|
|
7401
7435
|
const hasActive = acct.wallets.some((w) => w.status === "ACTIVE");
|
|
7402
7436
|
if (hasActive) {
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7437
|
+
await completeSetup();
|
|
7438
|
+
return;
|
|
7439
|
+
}
|
|
7440
|
+
if (setupSessionId) {
|
|
7407
7441
|
try {
|
|
7408
|
-
await
|
|
7442
|
+
const session = await fetchAuthorizationSession(apiBaseUrl, setupSessionId);
|
|
7443
|
+
if (cancelled) return;
|
|
7444
|
+
if (session.status === "AUTHORIZED") {
|
|
7445
|
+
await completeSetup();
|
|
7446
|
+
}
|
|
7409
7447
|
} catch {
|
|
7410
7448
|
}
|
|
7411
|
-
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
7412
7449
|
}
|
|
7413
7450
|
} catch {
|
|
7414
7451
|
}
|