@swype-org/react-sdk 0.1.92 → 0.1.93
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 +20 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4946,7 +4946,7 @@ function StepRenderer({
|
|
|
4946
4946
|
);
|
|
4947
4947
|
}
|
|
4948
4948
|
if ((step === "login" || step === "otp-verify") && authenticated) {
|
|
4949
|
-
return /* @__PURE__ */ jsx(CenteredSpinner, { label: "Verifying your passkey..." });
|
|
4949
|
+
return /* @__PURE__ */ jsx(CenteredSpinner, { label: "Verifying your passkey...test2" });
|
|
4950
4950
|
}
|
|
4951
4951
|
if (step === "verify-passkey") {
|
|
4952
4952
|
return /* @__PURE__ */ jsx(
|
|
@@ -5233,12 +5233,17 @@ function SwypePaymentInner({
|
|
|
5233
5233
|
const checkingPasskeyRef = useRef(false);
|
|
5234
5234
|
const onCompleteRef = useRef(onComplete);
|
|
5235
5235
|
onCompleteRef.current = onComplete;
|
|
5236
|
+
const pollingRef = useRef(null);
|
|
5237
|
+
const handleAuthorizedMobileReturnRef = useRef(
|
|
5238
|
+
null
|
|
5239
|
+
);
|
|
5236
5240
|
const [authInput, setAuthInput] = useState("");
|
|
5237
5241
|
const [otpCode, setOtpCode] = useState("");
|
|
5238
5242
|
const [selectSourceChainName, setSelectSourceChainName] = useState("");
|
|
5239
5243
|
const [selectSourceTokenSymbol, setSelectSourceTokenSymbol] = useState("");
|
|
5240
5244
|
const authExecutor = useAuthorizationExecutor();
|
|
5241
5245
|
const polling = useTransferPolling();
|
|
5246
|
+
pollingRef.current = polling;
|
|
5242
5247
|
const transferSigning = useTransferSigning();
|
|
5243
5248
|
const { sourceType, sourceId } = deriveSourceTypeAndId(state);
|
|
5244
5249
|
const selectedAccount = state.accounts.find((a) => a.id === state.selectedAccountId);
|
|
@@ -5492,6 +5497,7 @@ function SwypePaymentInner({
|
|
|
5492
5497
|
clearMobileFlowState();
|
|
5493
5498
|
dispatch({ type: "MOBILE_SIGN_READY", transfer: authorizedTransfer });
|
|
5494
5499
|
}, [polling.stopPolling, reloadAccounts]);
|
|
5500
|
+
handleAuthorizedMobileReturnRef.current = handleAuthorizedMobileReturn;
|
|
5495
5501
|
const handlePay = useCallback(async (payAmount, sourceOverrides) => {
|
|
5496
5502
|
if (isNaN(payAmount) || payAmount < MIN_SEND_AMOUNT_USD) {
|
|
5497
5503
|
dispatch({ type: "SET_ERROR", error: `Minimum amount is $${MIN_SEND_AMOUNT_USD.toFixed(2)}.` });
|
|
@@ -5761,6 +5767,7 @@ function SwypePaymentInner({
|
|
|
5761
5767
|
}
|
|
5762
5768
|
polling.stopPolling();
|
|
5763
5769
|
preSelectSourceStepRef.current = null;
|
|
5770
|
+
checkingPasskeyRef.current = false;
|
|
5764
5771
|
setAuthInput("");
|
|
5765
5772
|
setOtpCode("");
|
|
5766
5773
|
dispatch({ type: "LOGOUT", depositAmount });
|
|
@@ -5809,7 +5816,10 @@ function SwypePaymentInner({
|
|
|
5809
5816
|
}
|
|
5810
5817
|
}, [otpCode, state.step, activeOtpStatus, handleVerifyLoginCode]);
|
|
5811
5818
|
useEffect(() => {
|
|
5812
|
-
if (!ready || !authenticated)
|
|
5819
|
+
if (!ready || !authenticated) {
|
|
5820
|
+
checkingPasskeyRef.current = false;
|
|
5821
|
+
return;
|
|
5822
|
+
}
|
|
5813
5823
|
if (state.step !== "login" && state.step !== "otp-verify") return;
|
|
5814
5824
|
if (checkingPasskeyRef.current) return;
|
|
5815
5825
|
checkingPasskeyRef.current = true;
|
|
@@ -5838,7 +5848,7 @@ function SwypePaymentInner({
|
|
|
5838
5848
|
const existingTransfer = await fetchTransfer(apiBaseUrl, token, persisted.transferId);
|
|
5839
5849
|
if (cancelled) return;
|
|
5840
5850
|
if (existingTransfer.status === "AUTHORIZED") {
|
|
5841
|
-
await
|
|
5851
|
+
await handleAuthorizedMobileReturnRef.current(existingTransfer, true);
|
|
5842
5852
|
return;
|
|
5843
5853
|
}
|
|
5844
5854
|
} catch {
|
|
@@ -5853,17 +5863,17 @@ function SwypePaymentInner({
|
|
|
5853
5863
|
persisted.isSetup
|
|
5854
5864
|
);
|
|
5855
5865
|
if (mobileResolution.kind === "resume-setup-deposit") {
|
|
5856
|
-
await
|
|
5866
|
+
await handleAuthorizedMobileReturnRef.current(existingTransfer, true);
|
|
5857
5867
|
return;
|
|
5858
5868
|
}
|
|
5859
5869
|
if (mobileResolution.kind === "resume-confirm-sign") {
|
|
5860
|
-
await
|
|
5870
|
+
await handleAuthorizedMobileReturnRef.current(existingTransfer, false);
|
|
5861
5871
|
return;
|
|
5862
5872
|
}
|
|
5863
5873
|
if (mobileResolution.kind === "resume-success") {
|
|
5864
5874
|
clearMobileFlowState();
|
|
5865
5875
|
dispatch({ type: "MOBILE_RESUME_SUCCESS", transfer: existingTransfer });
|
|
5866
|
-
|
|
5876
|
+
onCompleteRef.current?.(existingTransfer);
|
|
5867
5877
|
return;
|
|
5868
5878
|
}
|
|
5869
5879
|
if (mobileResolution.kind === "resume-failed") {
|
|
@@ -5874,7 +5884,7 @@ function SwypePaymentInner({
|
|
|
5874
5884
|
if (mobileResolution.kind === "resume-processing") {
|
|
5875
5885
|
clearMobileFlowState();
|
|
5876
5886
|
dispatch({ type: "MOBILE_RESUME_PROCESSING", transfer: existingTransfer });
|
|
5877
|
-
|
|
5887
|
+
pollingRef.current.startPolling(existingTransfer.id);
|
|
5878
5888
|
return;
|
|
5879
5889
|
}
|
|
5880
5890
|
if (mobileResolution.kind === "resume-stale-setup") {
|
|
@@ -5892,7 +5902,7 @@ function SwypePaymentInner({
|
|
|
5892
5902
|
});
|
|
5893
5903
|
pollingTransferIdRef.current = persisted.transferId;
|
|
5894
5904
|
mobileSetupFlowRef.current = persisted.isSetup;
|
|
5895
|
-
|
|
5905
|
+
pollingRef.current.startPolling(persisted.transferId);
|
|
5896
5906
|
return;
|
|
5897
5907
|
}
|
|
5898
5908
|
dispatch({
|
|
@@ -5902,7 +5912,7 @@ function SwypePaymentInner({
|
|
|
5902
5912
|
});
|
|
5903
5913
|
pollingTransferIdRef.current = persisted.transferId;
|
|
5904
5914
|
mobileSetupFlowRef.current = persisted.isSetup;
|
|
5905
|
-
|
|
5915
|
+
pollingRef.current.startPolling(persisted.transferId);
|
|
5906
5916
|
return;
|
|
5907
5917
|
}
|
|
5908
5918
|
dispatch({ type: "NAVIGATE", step: resolved.step });
|
|
@@ -5960,19 +5970,8 @@ function SwypePaymentInner({
|
|
|
5960
5970
|
checkPasskey();
|
|
5961
5971
|
return () => {
|
|
5962
5972
|
cancelled = true;
|
|
5963
|
-
checkingPasskeyRef.current = false;
|
|
5964
5973
|
};
|
|
5965
|
-
}, [
|
|
5966
|
-
ready,
|
|
5967
|
-
authenticated,
|
|
5968
|
-
state.step,
|
|
5969
|
-
apiBaseUrl,
|
|
5970
|
-
getAccessToken,
|
|
5971
|
-
state.activeCredentialId,
|
|
5972
|
-
handleAuthorizedMobileReturn,
|
|
5973
|
-
onComplete,
|
|
5974
|
-
polling
|
|
5975
|
-
]);
|
|
5974
|
+
}, [ready, authenticated, state.step, apiBaseUrl, getAccessToken, state.activeCredentialId]);
|
|
5976
5975
|
useEffect(() => {
|
|
5977
5976
|
const loadAction = resolveDataLoadAction({
|
|
5978
5977
|
authenticated,
|