@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.js CHANGED
@@ -5613,6 +5613,7 @@ function StepRenderer({
5613
5613
  otpCode,
5614
5614
  selectSourceChainName,
5615
5615
  selectSourceTokenSymbol,
5616
+ savingOneTapLimit,
5616
5617
  merchantName,
5617
5618
  onBack,
5618
5619
  onDismiss,
@@ -5736,7 +5737,7 @@ function StepRenderer({
5736
5737
  onSetupOneTap: handlers.onSetupOneTap,
5737
5738
  onBack: () => handlers.onNavigate("deposit"),
5738
5739
  onLogout: handlers.onLogout,
5739
- loading: state.creatingTransfer,
5740
+ loading: savingOneTapLimit,
5740
5741
  error: state.error
5741
5742
  }
5742
5743
  );
@@ -6013,6 +6014,7 @@ function SwypePaymentInner({
6013
6014
  const [otpCode, setOtpCode] = useState("");
6014
6015
  const [selectSourceChainName, setSelectSourceChainName] = useState("");
6015
6016
  const [selectSourceTokenSymbol, setSelectSourceTokenSymbol] = useState("");
6017
+ const [savingOneTapLimit, setSavingOneTapLimit] = useState(false);
6016
6018
  const authExecutor = useAuthorizationExecutor();
6017
6019
  const polling = useTransferPolling();
6018
6020
  pollingRef.current = polling;
@@ -6641,6 +6643,7 @@ function SwypePaymentInner({
6641
6643
  [state.accounts, depositAmount]
6642
6644
  );
6643
6645
  const handleSetupOneTap = useCallback(async (limit) => {
6646
+ setSavingOneTapLimit(true);
6644
6647
  try {
6645
6648
  const token = await getAccessToken();
6646
6649
  if (!token) throw new Error("Not authenticated");
@@ -6656,6 +6659,8 @@ function SwypePaymentInner({
6656
6659
  type: "SET_ERROR",
6657
6660
  error: err instanceof Error ? err.message : "Failed to save One-Tap limit"
6658
6661
  });
6662
+ } finally {
6663
+ setSavingOneTapLimit(false);
6659
6664
  }
6660
6665
  }, [getAccessToken, apiBaseUrl, authExecutor]);
6661
6666
  const handleNewPayment = useCallback(() => {
@@ -7192,12 +7197,14 @@ function SwypePaymentInner({
7192
7197
  useEffect(() => {
7193
7198
  if (pendingOneTapSetupAction && state.step === "setup-status") {
7194
7199
  preOneTapSetupStepRef.current = state.step;
7195
- dispatch({ type: "NAVIGATE", step: "setup" });
7200
+ reloadAccounts().then(() => {
7201
+ dispatch({ type: "NAVIGATE", step: "setup" });
7202
+ });
7196
7203
  } else if (!pendingOneTapSetupAction && state.step === "setup" && preOneTapSetupStepRef.current) {
7197
7204
  dispatch({ type: "NAVIGATE", step: preOneTapSetupStepRef.current });
7198
7205
  preOneTapSetupStepRef.current = null;
7199
7206
  }
7200
- }, [pendingOneTapSetupAction, state.step]);
7207
+ }, [pendingOneTapSetupAction, state.step, reloadAccounts]);
7201
7208
  const handlers = useMemo(() => ({
7202
7209
  onSendLoginCode: handleSendLoginCode,
7203
7210
  onVerifyLoginCode: handleVerifyLoginCode,
@@ -7281,6 +7288,7 @@ function SwypePaymentInner({
7281
7288
  otpCode,
7282
7289
  selectSourceChainName,
7283
7290
  selectSourceTokenSymbol,
7291
+ savingOneTapLimit,
7284
7292
  merchantName,
7285
7293
  onBack,
7286
7294
  onDismiss,