@swype-org/react-sdk 0.1.90 → 0.1.92
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 +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5233,6 +5233,9 @@ function SwypePaymentInner({
|
|
|
5233
5233
|
const processingStartedAtRef = react.useRef(null);
|
|
5234
5234
|
const initializedSelectSourceActionRef = react.useRef(null);
|
|
5235
5235
|
const preSelectSourceStepRef = react.useRef(null);
|
|
5236
|
+
const checkingPasskeyRef = react.useRef(false);
|
|
5237
|
+
const onCompleteRef = react.useRef(onComplete);
|
|
5238
|
+
onCompleteRef.current = onComplete;
|
|
5236
5239
|
const [authInput, setAuthInput] = react.useState("");
|
|
5237
5240
|
const [otpCode, setOtpCode] = react.useState("");
|
|
5238
5241
|
const [selectSourceChainName, setSelectSourceChainName] = react.useState("");
|
|
@@ -5811,6 +5814,8 @@ function SwypePaymentInner({
|
|
|
5811
5814
|
react.useEffect(() => {
|
|
5812
5815
|
if (!ready || !authenticated) return;
|
|
5813
5816
|
if (state.step !== "login" && state.step !== "otp-verify") return;
|
|
5817
|
+
if (checkingPasskeyRef.current) return;
|
|
5818
|
+
checkingPasskeyRef.current = true;
|
|
5814
5819
|
let cancelled = false;
|
|
5815
5820
|
dispatch({ type: "SET_ERROR", error: null });
|
|
5816
5821
|
setAuthInput("");
|
|
@@ -5907,8 +5912,17 @@ function SwypePaymentInner({
|
|
|
5907
5912
|
};
|
|
5908
5913
|
const checkPasskey = async () => {
|
|
5909
5914
|
try {
|
|
5910
|
-
|
|
5911
|
-
|
|
5915
|
+
let token = null;
|
|
5916
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
5917
|
+
token = await getAccessToken();
|
|
5918
|
+
if (token || cancelled) break;
|
|
5919
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
5920
|
+
}
|
|
5921
|
+
if (!token) {
|
|
5922
|
+
if (!cancelled) dispatch({ type: "NAVIGATE", step: "create-passkey" });
|
|
5923
|
+
return;
|
|
5924
|
+
}
|
|
5925
|
+
if (cancelled) return;
|
|
5912
5926
|
const { config } = await fetchUserConfig(apiBaseUrl, token);
|
|
5913
5927
|
if (cancelled) return;
|
|
5914
5928
|
const allPasskeys = config.passkeys ?? (config.passkey ? [config.passkey] : []);
|
|
@@ -5949,6 +5963,7 @@ function SwypePaymentInner({
|
|
|
5949
5963
|
checkPasskey();
|
|
5950
5964
|
return () => {
|
|
5951
5965
|
cancelled = true;
|
|
5966
|
+
checkingPasskeyRef.current = false;
|
|
5952
5967
|
};
|
|
5953
5968
|
}, [
|
|
5954
5969
|
ready,
|