@swype-org/react-sdk 0.1.163 → 0.1.165
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 +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2426,7 +2426,14 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
|
2426
2426
|
inputsRef.current[clamped]?.focus();
|
|
2427
2427
|
}, [length]);
|
|
2428
2428
|
const handleChange = useCallback((index, char) => {
|
|
2429
|
-
const
|
|
2429
|
+
const cleaned = char.replace(/\D/g, "");
|
|
2430
|
+
if (cleaned.length > 1) {
|
|
2431
|
+
const filled = cleaned.slice(0, length);
|
|
2432
|
+
onChange(filled);
|
|
2433
|
+
focusInput(Math.min(filled.length, length - 1));
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
const digit = cleaned.slice(0, 1);
|
|
2430
2437
|
const next = digits.slice();
|
|
2431
2438
|
next[index] = digit;
|
|
2432
2439
|
const joined = next.join("").replace(/\s/g, "");
|
|
@@ -2464,7 +2471,7 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
|
|
|
2464
2471
|
disabled,
|
|
2465
2472
|
onChange: (e) => handleChange(i, e.target.value),
|
|
2466
2473
|
onKeyDown: (e) => handleKeyDown(i, e),
|
|
2467
|
-
onPaste:
|
|
2474
|
+
onPaste: handlePaste,
|
|
2468
2475
|
onFocus: (e) => e.target.select(),
|
|
2469
2476
|
style: inputStyle(tokens, !!digit.trim())
|
|
2470
2477
|
},
|
|
@@ -6991,6 +6998,7 @@ function usePaymentEffects(deps) {
|
|
|
6991
6998
|
pollingRef.current = polling;
|
|
6992
6999
|
const handleAuthorizedMobileReturnRef = useRef(handleAuthorizedMobileReturn);
|
|
6993
7000
|
handleAuthorizedMobileReturnRef.current = handleAuthorizedMobileReturn;
|
|
7001
|
+
const lastAccountFetchRef = useRef(0);
|
|
6994
7002
|
useEffect(() => {
|
|
6995
7003
|
if (depositAmount != null) {
|
|
6996
7004
|
dispatch({ type: "SYNC_AMOUNT", amount: depositAmount.toString() });
|
|
@@ -7307,11 +7315,18 @@ function usePaymentEffects(deps) {
|
|
|
7307
7315
|
clearMobileFlowState();
|
|
7308
7316
|
dispatch({ type: "TRANSFER_COMPLETED", transfer: polling.transfer });
|
|
7309
7317
|
onComplete?.(polling.transfer);
|
|
7318
|
+
reloadAccounts();
|
|
7310
7319
|
} else if (polling.transfer.status === "FAILED") {
|
|
7311
7320
|
clearMobileFlowState();
|
|
7312
7321
|
dispatch({ type: "TRANSFER_FAILED", transfer: polling.transfer, error: "Transfer failed." });
|
|
7313
7322
|
}
|
|
7314
|
-
}, [polling.transfer, onComplete, dispatch]);
|
|
7323
|
+
}, [polling.transfer, onComplete, dispatch, reloadAccounts]);
|
|
7324
|
+
useEffect(() => {
|
|
7325
|
+
if (state.step === "deposit" && state.accounts.length > 0 && authenticated && Date.now() - lastAccountFetchRef.current > 15e3) {
|
|
7326
|
+
lastAccountFetchRef.current = Date.now();
|
|
7327
|
+
reloadAccounts();
|
|
7328
|
+
}
|
|
7329
|
+
}, [state.step, state.accounts.length, authenticated, reloadAccounts]);
|
|
7315
7330
|
useEffect(() => {
|
|
7316
7331
|
if (state.step !== "processing") {
|
|
7317
7332
|
processingStartedAtRef.current = null;
|