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