@swype-org/react-sdk 0.1.11 → 0.1.12

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
@@ -2197,19 +2197,22 @@ function SwypePayment({
2197
2197
  void sign();
2198
2198
  }, [mobileFlow, polling.transfer, transferSigning, onError]);
2199
2199
  react.useEffect(() => {
2200
- if (!mobileFlow || !polling.isPolling) return;
2200
+ if (!mobileFlow) return;
2201
+ const transferIdToResume = pollingTransferIdRef.current ?? transfer?.id;
2202
+ if (!transferIdToResume) return;
2203
+ if (!polling.isPolling) {
2204
+ polling.startPolling(transferIdToResume);
2205
+ }
2201
2206
  const handleVisibility = () => {
2202
2207
  if (document.visibilityState === "visible") {
2203
- if (pollingTransferIdRef.current) {
2204
- polling.startPolling(pollingTransferIdRef.current);
2205
- }
2208
+ polling.startPolling(transferIdToResume);
2206
2209
  }
2207
2210
  };
2208
2211
  document.addEventListener("visibilitychange", handleVisibility);
2209
2212
  return () => {
2210
2213
  document.removeEventListener("visibilitychange", handleVisibility);
2211
2214
  };
2212
- }, [mobileFlow, polling]);
2215
+ }, [mobileFlow, transfer?.id, polling.isPolling, polling.startPolling]);
2213
2216
  const pendingSelectSourceAction = authExecutor.pendingSelectSource;
2214
2217
  const selectSourceChoices = react.useMemo(() => {
2215
2218
  if (!pendingSelectSourceAction) return [];