@swype-org/react-sdk 0.1.131 → 0.1.132
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 +38 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6005,6 +6005,7 @@ function SwypePaymentInner({
|
|
|
6005
6005
|
const preSelectSourceStepRef = useRef(null);
|
|
6006
6006
|
const pendingTokenAuthRef = useRef(null);
|
|
6007
6007
|
const pendingTokenSelectionRef = useRef(null);
|
|
6008
|
+
const pendingTokenAuthSessionRef = useRef(null);
|
|
6008
6009
|
const reauthSessionIdRef = useRef(null);
|
|
6009
6010
|
const reauthTokenRef = useRef(null);
|
|
6010
6011
|
const checkingPasskeyRef = useRef(false);
|
|
@@ -6503,10 +6504,14 @@ function SwypePaymentInner({
|
|
|
6503
6504
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6504
6505
|
triggerDeeplink(session.uri);
|
|
6505
6506
|
} else {
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6507
|
+
pendingTokenAuthSessionRef.current = {
|
|
6508
|
+
sessionId: session.id,
|
|
6509
|
+
walletId: _walletId,
|
|
6510
|
+
tokenSymbol,
|
|
6511
|
+
tokenAddress,
|
|
6512
|
+
chainId
|
|
6513
|
+
};
|
|
6514
|
+
dispatch({ type: "SELECT_TOKEN", walletId: _walletId, tokenSymbol });
|
|
6510
6515
|
dispatch({ type: "NAVIGATE", step: "setup" });
|
|
6511
6516
|
}
|
|
6512
6517
|
} catch (err) {
|
|
@@ -6657,10 +6662,32 @@ function SwypePaymentInner({
|
|
|
6657
6662
|
await updateUserConfig(apiBaseUrl, token, { defaultAllowance: limit });
|
|
6658
6663
|
if (authExecutor.pendingOneTapSetup) {
|
|
6659
6664
|
authExecutor.resolveOneTapSetup();
|
|
6660
|
-
} else if (
|
|
6661
|
-
const
|
|
6662
|
-
|
|
6663
|
-
|
|
6665
|
+
} else if (pendingTokenAuthSessionRef.current) {
|
|
6666
|
+
const pending = pendingTokenAuthSessionRef.current;
|
|
6667
|
+
pendingTokenAuthSessionRef.current = null;
|
|
6668
|
+
pendingTokenAuthRef.current = {
|
|
6669
|
+
tokenAddress: pending.tokenAddress,
|
|
6670
|
+
chainId: pending.chainId,
|
|
6671
|
+
tokenSymbol: pending.tokenSymbol,
|
|
6672
|
+
walletId: pending.walletId
|
|
6673
|
+
};
|
|
6674
|
+
dispatch({ type: "SET_INCREASING_LIMIT", value: true });
|
|
6675
|
+
dispatch({ type: "NAVIGATE", step: "setup-status" });
|
|
6676
|
+
try {
|
|
6677
|
+
await authExecutor.executeSessionById(pending.sessionId);
|
|
6678
|
+
await reloadAccounts();
|
|
6679
|
+
dispatch({ type: "SELECT_TOKEN", walletId: pending.walletId, tokenSymbol: pending.tokenSymbol });
|
|
6680
|
+
} catch (authErr) {
|
|
6681
|
+
captureException(authErr);
|
|
6682
|
+
dispatch({
|
|
6683
|
+
type: "SET_ERROR",
|
|
6684
|
+
error: authErr instanceof Error ? authErr.message : "Failed to authorize token"
|
|
6685
|
+
});
|
|
6686
|
+
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
6687
|
+
} finally {
|
|
6688
|
+
pendingTokenAuthRef.current = null;
|
|
6689
|
+
dispatch({ type: "SET_INCREASING_LIMIT", value: false });
|
|
6690
|
+
}
|
|
6664
6691
|
} else {
|
|
6665
6692
|
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
6666
6693
|
}
|
|
@@ -6673,13 +6700,14 @@ function SwypePaymentInner({
|
|
|
6673
6700
|
} finally {
|
|
6674
6701
|
setSavingOneTapLimit(false);
|
|
6675
6702
|
}
|
|
6676
|
-
}, [getAccessToken, apiBaseUrl, authExecutor]);
|
|
6703
|
+
}, [getAccessToken, apiBaseUrl, authExecutor, reloadAccounts, onError]);
|
|
6677
6704
|
const handleNewPayment = useCallback(() => {
|
|
6678
6705
|
clearMobileFlowState();
|
|
6679
6706
|
processingStartedAtRef.current = null;
|
|
6680
6707
|
pollingTransferIdRef.current = null;
|
|
6681
6708
|
preSelectSourceStepRef.current = null;
|
|
6682
6709
|
pendingTokenSelectionRef.current = null;
|
|
6710
|
+
pendingTokenAuthSessionRef.current = null;
|
|
6683
6711
|
dispatch({
|
|
6684
6712
|
type: "NEW_PAYMENT",
|
|
6685
6713
|
depositAmount,
|
|
@@ -6698,6 +6726,7 @@ function SwypePaymentInner({
|
|
|
6698
6726
|
polling.stopPolling();
|
|
6699
6727
|
preSelectSourceStepRef.current = null;
|
|
6700
6728
|
pendingTokenSelectionRef.current = null;
|
|
6729
|
+
pendingTokenAuthSessionRef.current = null;
|
|
6701
6730
|
checkingPasskeyRef.current = false;
|
|
6702
6731
|
setAuthInput("");
|
|
6703
6732
|
setOtpCode("");
|