@swype-org/react-sdk 0.1.130 → 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 +41 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6004,6 +6004,8 @@ function SwypePaymentInner({
|
|
|
6004
6004
|
const initializedSelectSourceActionRef = useRef(null);
|
|
6005
6005
|
const preSelectSourceStepRef = useRef(null);
|
|
6006
6006
|
const pendingTokenAuthRef = useRef(null);
|
|
6007
|
+
const pendingTokenSelectionRef = useRef(null);
|
|
6008
|
+
const pendingTokenAuthSessionRef = useRef(null);
|
|
6007
6009
|
const reauthSessionIdRef = useRef(null);
|
|
6008
6010
|
const reauthTokenRef = useRef(null);
|
|
6009
6011
|
const checkingPasskeyRef = useRef(false);
|
|
@@ -6502,10 +6504,15 @@ function SwypePaymentInner({
|
|
|
6502
6504
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
|
|
6503
6505
|
triggerDeeplink(session.uri);
|
|
6504
6506
|
} else {
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6507
|
+
pendingTokenAuthSessionRef.current = {
|
|
6508
|
+
sessionId: session.id,
|
|
6509
|
+
walletId: _walletId,
|
|
6510
|
+
tokenSymbol,
|
|
6511
|
+
tokenAddress,
|
|
6512
|
+
chainId
|
|
6513
|
+
};
|
|
6508
6514
|
dispatch({ type: "SELECT_TOKEN", walletId: _walletId, tokenSymbol });
|
|
6515
|
+
dispatch({ type: "NAVIGATE", step: "setup" });
|
|
6509
6516
|
}
|
|
6510
6517
|
} catch (err) {
|
|
6511
6518
|
captureException(err);
|
|
@@ -6655,6 +6662,32 @@ function SwypePaymentInner({
|
|
|
6655
6662
|
await updateUserConfig(apiBaseUrl, token, { defaultAllowance: limit });
|
|
6656
6663
|
if (authExecutor.pendingOneTapSetup) {
|
|
6657
6664
|
authExecutor.resolveOneTapSetup();
|
|
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
|
+
}
|
|
6658
6691
|
} else {
|
|
6659
6692
|
dispatch({ type: "NAVIGATE", step: "deposit" });
|
|
6660
6693
|
}
|
|
@@ -6667,12 +6700,14 @@ function SwypePaymentInner({
|
|
|
6667
6700
|
} finally {
|
|
6668
6701
|
setSavingOneTapLimit(false);
|
|
6669
6702
|
}
|
|
6670
|
-
}, [getAccessToken, apiBaseUrl, authExecutor]);
|
|
6703
|
+
}, [getAccessToken, apiBaseUrl, authExecutor, reloadAccounts, onError]);
|
|
6671
6704
|
const handleNewPayment = useCallback(() => {
|
|
6672
6705
|
clearMobileFlowState();
|
|
6673
6706
|
processingStartedAtRef.current = null;
|
|
6674
6707
|
pollingTransferIdRef.current = null;
|
|
6675
6708
|
preSelectSourceStepRef.current = null;
|
|
6709
|
+
pendingTokenSelectionRef.current = null;
|
|
6710
|
+
pendingTokenAuthSessionRef.current = null;
|
|
6676
6711
|
dispatch({
|
|
6677
6712
|
type: "NEW_PAYMENT",
|
|
6678
6713
|
depositAmount,
|
|
@@ -6690,6 +6725,8 @@ function SwypePaymentInner({
|
|
|
6690
6725
|
}
|
|
6691
6726
|
polling.stopPolling();
|
|
6692
6727
|
preSelectSourceStepRef.current = null;
|
|
6728
|
+
pendingTokenSelectionRef.current = null;
|
|
6729
|
+
pendingTokenAuthSessionRef.current = null;
|
|
6693
6730
|
checkingPasskeyRef.current = false;
|
|
6694
6731
|
setAuthInput("");
|
|
6695
6732
|
setOtpCode("");
|