@swype-org/react-sdk 0.1.124 → 0.1.126

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 CHANGED
@@ -5616,6 +5616,7 @@ function StepRenderer({
5616
5616
  otpCode,
5617
5617
  selectSourceChainName,
5618
5618
  selectSourceTokenSymbol,
5619
+ savingOneTapLimit,
5619
5620
  merchantName,
5620
5621
  onBack,
5621
5622
  onDismiss,
@@ -5739,7 +5740,7 @@ function StepRenderer({
5739
5740
  onSetupOneTap: handlers.onSetupOneTap,
5740
5741
  onBack: () => handlers.onNavigate("deposit"),
5741
5742
  onLogout: handlers.onLogout,
5742
- loading: state.creatingTransfer,
5743
+ loading: savingOneTapLimit,
5743
5744
  error: state.error
5744
5745
  }
5745
5746
  );
@@ -6016,6 +6017,7 @@ function SwypePaymentInner({
6016
6017
  const [otpCode, setOtpCode] = react.useState("");
6017
6018
  const [selectSourceChainName, setSelectSourceChainName] = react.useState("");
6018
6019
  const [selectSourceTokenSymbol, setSelectSourceTokenSymbol] = react.useState("");
6020
+ const [savingOneTapLimit, setSavingOneTapLimit] = react.useState(false);
6019
6021
  const authExecutor = useAuthorizationExecutor();
6020
6022
  const polling = useTransferPolling();
6021
6023
  pollingRef.current = polling;
@@ -6644,6 +6646,7 @@ function SwypePaymentInner({
6644
6646
  [state.accounts, depositAmount]
6645
6647
  );
6646
6648
  const handleSetupOneTap = react.useCallback(async (limit) => {
6649
+ setSavingOneTapLimit(true);
6647
6650
  try {
6648
6651
  const token = await getAccessToken();
6649
6652
  if (!token) throw new Error("Not authenticated");
@@ -6659,6 +6662,8 @@ function SwypePaymentInner({
6659
6662
  type: "SET_ERROR",
6660
6663
  error: err instanceof Error ? err.message : "Failed to save One-Tap limit"
6661
6664
  });
6665
+ } finally {
6666
+ setSavingOneTapLimit(false);
6662
6667
  }
6663
6668
  }, [getAccessToken, apiBaseUrl, authExecutor]);
6664
6669
  const handleNewPayment = react.useCallback(() => {
@@ -7195,12 +7200,14 @@ function SwypePaymentInner({
7195
7200
  react.useEffect(() => {
7196
7201
  if (pendingOneTapSetupAction && state.step === "setup-status") {
7197
7202
  preOneTapSetupStepRef.current = state.step;
7198
- dispatch({ type: "NAVIGATE", step: "setup" });
7203
+ reloadAccounts().then(() => {
7204
+ dispatch({ type: "NAVIGATE", step: "setup" });
7205
+ });
7199
7206
  } else if (!pendingOneTapSetupAction && state.step === "setup" && preOneTapSetupStepRef.current) {
7200
7207
  dispatch({ type: "NAVIGATE", step: preOneTapSetupStepRef.current });
7201
7208
  preOneTapSetupStepRef.current = null;
7202
7209
  }
7203
- }, [pendingOneTapSetupAction, state.step]);
7210
+ }, [pendingOneTapSetupAction, state.step, reloadAccounts]);
7204
7211
  const handlers = react.useMemo(() => ({
7205
7212
  onSendLoginCode: handleSendLoginCode,
7206
7213
  onVerifyLoginCode: handleVerifyLoginCode,
@@ -7284,6 +7291,7 @@ function SwypePaymentInner({
7284
7291
  otpCode,
7285
7292
  selectSourceChainName,
7286
7293
  selectSourceTokenSymbol,
7294
+ savingOneTapLimit,
7287
7295
  merchantName,
7288
7296
  onBack,
7289
7297
  onDismiss,