@swype-org/react-sdk 0.1.91 → 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 +25 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -20
- 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(
|
|
@@ -5230,12 +5230,20 @@ function SwypePaymentInner({
|
|
|
5230
5230
|
const processingStartedAtRef = useRef(null);
|
|
5231
5231
|
const initializedSelectSourceActionRef = useRef(null);
|
|
5232
5232
|
const preSelectSourceStepRef = useRef(null);
|
|
5233
|
+
const checkingPasskeyRef = useRef(false);
|
|
5234
|
+
const onCompleteRef = useRef(onComplete);
|
|
5235
|
+
onCompleteRef.current = onComplete;
|
|
5236
|
+
const pollingRef = useRef(null);
|
|
5237
|
+
const handleAuthorizedMobileReturnRef = useRef(
|
|
5238
|
+
null
|
|
5239
|
+
);
|
|
5233
5240
|
const [authInput, setAuthInput] = useState("");
|
|
5234
5241
|
const [otpCode, setOtpCode] = useState("");
|
|
5235
5242
|
const [selectSourceChainName, setSelectSourceChainName] = useState("");
|
|
5236
5243
|
const [selectSourceTokenSymbol, setSelectSourceTokenSymbol] = useState("");
|
|
5237
5244
|
const authExecutor = useAuthorizationExecutor();
|
|
5238
5245
|
const polling = useTransferPolling();
|
|
5246
|
+
pollingRef.current = polling;
|
|
5239
5247
|
const transferSigning = useTransferSigning();
|
|
5240
5248
|
const { sourceType, sourceId } = deriveSourceTypeAndId(state);
|
|
5241
5249
|
const selectedAccount = state.accounts.find((a) => a.id === state.selectedAccountId);
|
|
@@ -5489,6 +5497,7 @@ function SwypePaymentInner({
|
|
|
5489
5497
|
clearMobileFlowState();
|
|
5490
5498
|
dispatch({ type: "MOBILE_SIGN_READY", transfer: authorizedTransfer });
|
|
5491
5499
|
}, [polling.stopPolling, reloadAccounts]);
|
|
5500
|
+
handleAuthorizedMobileReturnRef.current = handleAuthorizedMobileReturn;
|
|
5492
5501
|
const handlePay = useCallback(async (payAmount, sourceOverrides) => {
|
|
5493
5502
|
if (isNaN(payAmount) || payAmount < MIN_SEND_AMOUNT_USD) {
|
|
5494
5503
|
dispatch({ type: "SET_ERROR", error: `Minimum amount is $${MIN_SEND_AMOUNT_USD.toFixed(2)}.` });
|
|
@@ -5758,6 +5767,7 @@ function SwypePaymentInner({
|
|
|
5758
5767
|
}
|
|
5759
5768
|
polling.stopPolling();
|
|
5760
5769
|
preSelectSourceStepRef.current = null;
|
|
5770
|
+
checkingPasskeyRef.current = false;
|
|
5761
5771
|
setAuthInput("");
|
|
5762
5772
|
setOtpCode("");
|
|
5763
5773
|
dispatch({ type: "LOGOUT", depositAmount });
|
|
@@ -5806,8 +5816,13 @@ function SwypePaymentInner({
|
|
|
5806
5816
|
}
|
|
5807
5817
|
}, [otpCode, state.step, activeOtpStatus, handleVerifyLoginCode]);
|
|
5808
5818
|
useEffect(() => {
|
|
5809
|
-
if (!ready || !authenticated)
|
|
5819
|
+
if (!ready || !authenticated) {
|
|
5820
|
+
checkingPasskeyRef.current = false;
|
|
5821
|
+
return;
|
|
5822
|
+
}
|
|
5810
5823
|
if (state.step !== "login" && state.step !== "otp-verify") return;
|
|
5824
|
+
if (checkingPasskeyRef.current) return;
|
|
5825
|
+
checkingPasskeyRef.current = true;
|
|
5811
5826
|
let cancelled = false;
|
|
5812
5827
|
dispatch({ type: "SET_ERROR", error: null });
|
|
5813
5828
|
setAuthInput("");
|
|
@@ -5833,7 +5848,7 @@ function SwypePaymentInner({
|
|
|
5833
5848
|
const existingTransfer = await fetchTransfer(apiBaseUrl, token, persisted.transferId);
|
|
5834
5849
|
if (cancelled) return;
|
|
5835
5850
|
if (existingTransfer.status === "AUTHORIZED") {
|
|
5836
|
-
await
|
|
5851
|
+
await handleAuthorizedMobileReturnRef.current(existingTransfer, true);
|
|
5837
5852
|
return;
|
|
5838
5853
|
}
|
|
5839
5854
|
} catch {
|
|
@@ -5848,17 +5863,17 @@ function SwypePaymentInner({
|
|
|
5848
5863
|
persisted.isSetup
|
|
5849
5864
|
);
|
|
5850
5865
|
if (mobileResolution.kind === "resume-setup-deposit") {
|
|
5851
|
-
await
|
|
5866
|
+
await handleAuthorizedMobileReturnRef.current(existingTransfer, true);
|
|
5852
5867
|
return;
|
|
5853
5868
|
}
|
|
5854
5869
|
if (mobileResolution.kind === "resume-confirm-sign") {
|
|
5855
|
-
await
|
|
5870
|
+
await handleAuthorizedMobileReturnRef.current(existingTransfer, false);
|
|
5856
5871
|
return;
|
|
5857
5872
|
}
|
|
5858
5873
|
if (mobileResolution.kind === "resume-success") {
|
|
5859
5874
|
clearMobileFlowState();
|
|
5860
5875
|
dispatch({ type: "MOBILE_RESUME_SUCCESS", transfer: existingTransfer });
|
|
5861
|
-
|
|
5876
|
+
onCompleteRef.current?.(existingTransfer);
|
|
5862
5877
|
return;
|
|
5863
5878
|
}
|
|
5864
5879
|
if (mobileResolution.kind === "resume-failed") {
|
|
@@ -5869,7 +5884,7 @@ function SwypePaymentInner({
|
|
|
5869
5884
|
if (mobileResolution.kind === "resume-processing") {
|
|
5870
5885
|
clearMobileFlowState();
|
|
5871
5886
|
dispatch({ type: "MOBILE_RESUME_PROCESSING", transfer: existingTransfer });
|
|
5872
|
-
|
|
5887
|
+
pollingRef.current.startPolling(existingTransfer.id);
|
|
5873
5888
|
return;
|
|
5874
5889
|
}
|
|
5875
5890
|
if (mobileResolution.kind === "resume-stale-setup") {
|
|
@@ -5887,7 +5902,7 @@ function SwypePaymentInner({
|
|
|
5887
5902
|
});
|
|
5888
5903
|
pollingTransferIdRef.current = persisted.transferId;
|
|
5889
5904
|
mobileSetupFlowRef.current = persisted.isSetup;
|
|
5890
|
-
|
|
5905
|
+
pollingRef.current.startPolling(persisted.transferId);
|
|
5891
5906
|
return;
|
|
5892
5907
|
}
|
|
5893
5908
|
dispatch({
|
|
@@ -5897,7 +5912,7 @@ function SwypePaymentInner({
|
|
|
5897
5912
|
});
|
|
5898
5913
|
pollingTransferIdRef.current = persisted.transferId;
|
|
5899
5914
|
mobileSetupFlowRef.current = persisted.isSetup;
|
|
5900
|
-
|
|
5915
|
+
pollingRef.current.startPolling(persisted.transferId);
|
|
5901
5916
|
return;
|
|
5902
5917
|
}
|
|
5903
5918
|
dispatch({ type: "NAVIGATE", step: resolved.step });
|
|
@@ -5956,17 +5971,7 @@ function SwypePaymentInner({
|
|
|
5956
5971
|
return () => {
|
|
5957
5972
|
cancelled = true;
|
|
5958
5973
|
};
|
|
5959
|
-
}, [
|
|
5960
|
-
ready,
|
|
5961
|
-
authenticated,
|
|
5962
|
-
state.step,
|
|
5963
|
-
apiBaseUrl,
|
|
5964
|
-
getAccessToken,
|
|
5965
|
-
state.activeCredentialId,
|
|
5966
|
-
handleAuthorizedMobileReturn,
|
|
5967
|
-
onComplete,
|
|
5968
|
-
polling
|
|
5969
|
-
]);
|
|
5974
|
+
}, [ready, authenticated, state.step, apiBaseUrl, getAccessToken, state.activeCredentialId]);
|
|
5970
5975
|
useEffect(() => {
|
|
5971
5976
|
const loadAction = resolveDataLoadAction({
|
|
5972
5977
|
authenticated,
|