@swype-org/react-sdk 0.1.272 → 0.1.277
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 +216 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +216 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1856,6 +1856,17 @@ function effectiveMinTransferAmountUsd(depositAmount) {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
function persistMobileFlowState(data) {
|
|
1858
1858
|
try {
|
|
1859
|
+
console.info("[blink-sdk] persistMobileFlowState", {
|
|
1860
|
+
isGuestPreauth: data.isGuestPreauth ?? false,
|
|
1861
|
+
isGuestCheckout: data.isGuestCheckout ?? false,
|
|
1862
|
+
isReauthorization: data.isReauthorization ?? false,
|
|
1863
|
+
isSetup: data.isSetup,
|
|
1864
|
+
hasGuestSessionToken: !!data.guestSessionToken,
|
|
1865
|
+
hasSessionId: !!data.sessionId,
|
|
1866
|
+
hasAccountId: !!data.accountId,
|
|
1867
|
+
hasTransferId: !!data.transferId,
|
|
1868
|
+
caller: new Error().stack?.split("\n")[2]?.trim()
|
|
1869
|
+
});
|
|
1859
1870
|
sessionStorage.setItem(MOBILE_FLOW_STORAGE_KEY, JSON.stringify(data));
|
|
1860
1871
|
} catch {
|
|
1861
1872
|
}
|
|
@@ -1871,6 +1882,10 @@ function loadMobileFlowState() {
|
|
|
1871
1882
|
}
|
|
1872
1883
|
function clearMobileFlowState() {
|
|
1873
1884
|
try {
|
|
1885
|
+
console.info("[blink-sdk] clearMobileFlowState", {
|
|
1886
|
+
hadState: sessionStorage.getItem(MOBILE_FLOW_STORAGE_KEY) != null,
|
|
1887
|
+
caller: new Error().stack?.split("\n")[2]?.trim()
|
|
1888
|
+
});
|
|
1874
1889
|
sessionStorage.removeItem(MOBILE_FLOW_STORAGE_KEY);
|
|
1875
1890
|
} catch {
|
|
1876
1891
|
}
|
|
@@ -2196,6 +2211,25 @@ function resolvePhase(state) {
|
|
|
2196
2211
|
} else {
|
|
2197
2212
|
nextPhase = { step: "wallet-picker", reason: "entry" };
|
|
2198
2213
|
}
|
|
2214
|
+
if (state.guestPreauthSessionId != null) {
|
|
2215
|
+
console.info("[blink-sdk] resolvePhase (guest preauth context)", {
|
|
2216
|
+
resolvedStep: nextPhase.step,
|
|
2217
|
+
currentStep: currentPhase.step,
|
|
2218
|
+
branchGuestPostPayLogin,
|
|
2219
|
+
branchMobileWalletSetup,
|
|
2220
|
+
branchLoginRequested,
|
|
2221
|
+
branchCompleted,
|
|
2222
|
+
branchKeepGuestPreauthPin,
|
|
2223
|
+
branchGuestSetupComplete,
|
|
2224
|
+
transferStatus: state.transfer?.status ?? null,
|
|
2225
|
+
mobileFlow: state.mobileFlow,
|
|
2226
|
+
deeplinkUri: state.deeplinkUri != null,
|
|
2227
|
+
loginRequested: state.loginRequested,
|
|
2228
|
+
guestPreauthorizing: state.guestPreauthorizing,
|
|
2229
|
+
privyAuthenticated: state.privyAuthenticated,
|
|
2230
|
+
isGuestFlow: state.isGuestFlow
|
|
2231
|
+
});
|
|
2232
|
+
}
|
|
2199
2233
|
return nextPhase;
|
|
2200
2234
|
}
|
|
2201
2235
|
|
|
@@ -2263,6 +2297,30 @@ function paymentReducer(state, action) {
|
|
|
2263
2297
|
loginRequested: next.loginRequested
|
|
2264
2298
|
});
|
|
2265
2299
|
}
|
|
2300
|
+
if (action.type === "REQUEST_LOGIN") {
|
|
2301
|
+
console.info("[blink-sdk] reducer REQUEST_LOGIN", {
|
|
2302
|
+
resolvedPhase: phase.step,
|
|
2303
|
+
mobileFlow: next.mobileFlow,
|
|
2304
|
+
loginRequested: next.loginRequested,
|
|
2305
|
+
guestPreauthSessionId: next.guestPreauthSessionId,
|
|
2306
|
+
guestPreauthAccountId: next.guestPreauthAccountId,
|
|
2307
|
+
transferStatus: next.transfer?.status ?? null,
|
|
2308
|
+
isGuestFlow: next.isGuestFlow,
|
|
2309
|
+
privyReady: next.privyReady,
|
|
2310
|
+
privyAuthenticated: next.privyAuthenticated
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
if (action.type === "MOBILE_SETUP_COMPLETE") {
|
|
2314
|
+
console.info("[blink-sdk] reducer MOBILE_SETUP_COMPLETE", {
|
|
2315
|
+
resolvedPhase: phase.step,
|
|
2316
|
+
mobileFlow: next.mobileFlow,
|
|
2317
|
+
deeplinkUri: next.deeplinkUri,
|
|
2318
|
+
loginRequested: next.loginRequested,
|
|
2319
|
+
guestPreauthSessionId: next.guestPreauthSessionId,
|
|
2320
|
+
transferStatus: next.transfer?.status ?? null,
|
|
2321
|
+
isGuestFlow: next.isGuestFlow
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2266
2324
|
return { ...next, phase };
|
|
2267
2325
|
}
|
|
2268
2326
|
function applyAction(state, action) {
|
|
@@ -2413,7 +2471,12 @@ function applyAction(state, action) {
|
|
|
2413
2471
|
return {
|
|
2414
2472
|
...state,
|
|
2415
2473
|
mobileFlow: true,
|
|
2416
|
-
deeplinkUri: action.deeplinkUri
|
|
2474
|
+
deeplinkUri: action.deeplinkUri,
|
|
2475
|
+
...action.guestTransferId != null && {
|
|
2476
|
+
guestTransferId: action.guestTransferId,
|
|
2477
|
+
guestSessionToken: action.guestSessionToken ?? null,
|
|
2478
|
+
isGuestFlow: true
|
|
2479
|
+
}
|
|
2417
2480
|
};
|
|
2418
2481
|
case "MOBILE_SETUP_COMPLETE":
|
|
2419
2482
|
return {
|
|
@@ -2531,6 +2594,7 @@ function applyAction(state, action) {
|
|
|
2531
2594
|
mobileFlow: false,
|
|
2532
2595
|
deeplinkUri: null,
|
|
2533
2596
|
isGuestFlow: true,
|
|
2597
|
+
guestTransferId: null,
|
|
2534
2598
|
guestSessionToken: action.guestSessionToken ?? state.guestSessionToken
|
|
2535
2599
|
};
|
|
2536
2600
|
case "GUEST_PREAUTH_DETECTED":
|
|
@@ -7199,7 +7263,7 @@ function useSourceSelectionHandlers(dispatch, authExecutor, options) {
|
|
|
7199
7263
|
initializedSelectSourceActionRef
|
|
7200
7264
|
};
|
|
7201
7265
|
}
|
|
7202
|
-
function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransferIdRef, stateTransfer, refs, onComplete) {
|
|
7266
|
+
function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransferIdRef, stateTransfer, refs, guestCheckout, onComplete) {
|
|
7203
7267
|
const {
|
|
7204
7268
|
mobileSetupFlowRef,
|
|
7205
7269
|
handlingMobileReturnRef,
|
|
@@ -7210,6 +7274,10 @@ function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransfe
|
|
|
7210
7274
|
onCompleteRef.current = onComplete;
|
|
7211
7275
|
const guestPollingActiveRef = react.useRef(false);
|
|
7212
7276
|
const guestPollingCleanupRef = react.useRef(null);
|
|
7277
|
+
const guestTransferIdRef = react.useRef(guestCheckout.guestTransferId);
|
|
7278
|
+
guestTransferIdRef.current = guestCheckout.guestTransferId;
|
|
7279
|
+
const guestSessionTokenRef = react.useRef(guestCheckout.guestSessionToken);
|
|
7280
|
+
guestSessionTokenRef.current = guestCheckout.guestSessionToken;
|
|
7213
7281
|
const startGuestPolling = react.useCallback((transferId, guestSessionToken) => {
|
|
7214
7282
|
if (guestPollingActiveRef.current) return;
|
|
7215
7283
|
guestPollingActiveRef.current = true;
|
|
@@ -7225,14 +7293,12 @@ function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransfe
|
|
|
7225
7293
|
cancelled = true;
|
|
7226
7294
|
guestPollingActiveRef.current = false;
|
|
7227
7295
|
guestPollingCleanupRef.current = null;
|
|
7228
|
-
clearMobileFlowState();
|
|
7229
7296
|
dispatch({ type: "GUEST_TRANSFER_COMPLETED", transfer, guestSessionToken });
|
|
7230
7297
|
onCompleteRef.current?.(transfer);
|
|
7231
7298
|
} else if (transfer.status === "FAILED") {
|
|
7232
7299
|
cancelled = true;
|
|
7233
7300
|
guestPollingActiveRef.current = false;
|
|
7234
7301
|
guestPollingCleanupRef.current = null;
|
|
7235
|
-
clearMobileFlowState();
|
|
7236
7302
|
dispatch({ type: "TRANSFER_FAILED", transfer, error: "Transfer failed." });
|
|
7237
7303
|
}
|
|
7238
7304
|
} catch {
|
|
@@ -7249,20 +7315,26 @@ function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransfe
|
|
|
7249
7315
|
guestPollingCleanupRef.current = cleanup;
|
|
7250
7316
|
}, [apiBaseUrl, dispatch]);
|
|
7251
7317
|
react.useEffect(() => {
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
startGuestPolling(persisted.transferId, persisted.guestSessionToken);
|
|
7318
|
+
if (guestCheckout.mobileFlow && guestCheckout.isGuestFlow && guestCheckout.guestTransferId && guestCheckout.guestSessionToken) {
|
|
7319
|
+
startGuestPolling(guestCheckout.guestTransferId, guestCheckout.guestSessionToken);
|
|
7255
7320
|
}
|
|
7256
7321
|
return () => {
|
|
7257
7322
|
guestPollingCleanupRef.current?.();
|
|
7258
7323
|
};
|
|
7259
|
-
}, [
|
|
7324
|
+
}, [
|
|
7325
|
+
guestCheckout.mobileFlow,
|
|
7326
|
+
guestCheckout.isGuestFlow,
|
|
7327
|
+
guestCheckout.guestTransferId,
|
|
7328
|
+
guestCheckout.guestSessionToken,
|
|
7329
|
+
startGuestPolling
|
|
7330
|
+
]);
|
|
7260
7331
|
react.useEffect(() => {
|
|
7261
7332
|
const tryStartPolling = () => {
|
|
7262
7333
|
if (guestPollingActiveRef.current) return;
|
|
7263
|
-
const
|
|
7264
|
-
|
|
7265
|
-
|
|
7334
|
+
const transferId = guestTransferIdRef.current;
|
|
7335
|
+
const token = guestSessionTokenRef.current;
|
|
7336
|
+
if (transferId && token) {
|
|
7337
|
+
startGuestPolling(transferId, token);
|
|
7266
7338
|
}
|
|
7267
7339
|
};
|
|
7268
7340
|
const handleVisibility = () => {
|
|
@@ -7406,16 +7478,13 @@ function useProviderHandlers(deps) {
|
|
|
7406
7478
|
dispatch({ type: "PAY_ERROR", error: "This wallet is not available on mobile." });
|
|
7407
7479
|
return;
|
|
7408
7480
|
}
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
isGuestCheckout: true,
|
|
7481
|
+
triggerDeeplink(result.uri);
|
|
7482
|
+
dispatch({
|
|
7483
|
+
type: "MOBILE_DEEPLINK_READY",
|
|
7413
7484
|
deeplinkUri: result.uri,
|
|
7414
|
-
|
|
7415
|
-
|
|
7485
|
+
guestTransferId: result.id,
|
|
7486
|
+
guestSessionToken: result.guestSessionToken
|
|
7416
7487
|
});
|
|
7417
|
-
triggerDeeplink(result.uri);
|
|
7418
|
-
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: result.uri });
|
|
7419
7488
|
} else {
|
|
7420
7489
|
const account = getAccount(wagmiConfig2);
|
|
7421
7490
|
if (!account.isConnected) {
|
|
@@ -7751,6 +7820,14 @@ function useProviderHandlers(deps) {
|
|
|
7751
7820
|
useWalletConnector: useWalletConnectorProp,
|
|
7752
7821
|
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
7753
7822
|
});
|
|
7823
|
+
console.info("[blink-sdk] handlePreauthorize", {
|
|
7824
|
+
isMobile,
|
|
7825
|
+
useWalletConnectorProp,
|
|
7826
|
+
hasGuestSessionToken: !!guestSessionToken,
|
|
7827
|
+
selectedProviderId,
|
|
7828
|
+
guestTransferId,
|
|
7829
|
+
userAgent: typeof navigator === "undefined" ? null : navigator.userAgent
|
|
7830
|
+
});
|
|
7754
7831
|
const providerName = providers.find((p) => p.id === selectedProviderId)?.name ?? "Wallet";
|
|
7755
7832
|
if (!isMobile) {
|
|
7756
7833
|
dispatch({ type: "GUEST_PREAUTH_BEGIN" });
|
|
@@ -8172,7 +8249,8 @@ function usePasskeyCheckEffect(deps) {
|
|
|
8172
8249
|
setupAccountIdRef,
|
|
8173
8250
|
reauthSessionIdRef,
|
|
8174
8251
|
reauthTokenRef,
|
|
8175
|
-
pollingTransferIdRef
|
|
8252
|
+
pollingTransferIdRef,
|
|
8253
|
+
startGuestAccountPolling
|
|
8176
8254
|
} = deps;
|
|
8177
8255
|
const { getAccessToken } = reactAuth.usePrivy();
|
|
8178
8256
|
const onCompleteRef = react.useRef(deps.onComplete);
|
|
@@ -8195,8 +8273,23 @@ function usePasskeyCheckEffect(deps) {
|
|
|
8195
8273
|
dispatch({ type: "SET_ERROR", error: null });
|
|
8196
8274
|
setAuthInput("");
|
|
8197
8275
|
setOtpCode("");
|
|
8276
|
+
const startGuestAccountPollingRef = startGuestAccountPolling;
|
|
8198
8277
|
const restoreState = async (credId, token) => {
|
|
8199
8278
|
const persisted = loadMobileFlowState();
|
|
8279
|
+
if (persisted?.isGuestPreauth && persisted.guestSessionToken && persisted.sessionId) {
|
|
8280
|
+
mobileSetupFlowRef.current = true;
|
|
8281
|
+
if (persisted.accountId) {
|
|
8282
|
+
setupAccountIdRef.current = persisted.accountId;
|
|
8283
|
+
dispatch({
|
|
8284
|
+
type: "GUEST_PREAUTH_DETECTED",
|
|
8285
|
+
accountId: persisted.accountId,
|
|
8286
|
+
sessionId: persisted.sessionId
|
|
8287
|
+
});
|
|
8288
|
+
}
|
|
8289
|
+
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: persisted.deeplinkUri });
|
|
8290
|
+
startGuestAccountPollingRef(persisted.guestSessionToken, persisted.sessionId);
|
|
8291
|
+
return;
|
|
8292
|
+
}
|
|
8200
8293
|
let accts = [];
|
|
8201
8294
|
try {
|
|
8202
8295
|
accts = await fetchAccounts(apiBaseUrl, token, credId);
|
|
@@ -8845,10 +8938,24 @@ function useGuestPreauthMobileRestoreEffect(deps) {
|
|
|
8845
8938
|
} = deps;
|
|
8846
8939
|
const startedRef = react.useRef(false);
|
|
8847
8940
|
react.useEffect(() => {
|
|
8848
|
-
if (!privyReady)
|
|
8849
|
-
|
|
8850
|
-
|
|
8941
|
+
if (!privyReady) {
|
|
8942
|
+
console.info("[blink-sdk] guestPreauthMobileRestore: skipping, privyReady=false");
|
|
8943
|
+
return;
|
|
8944
|
+
}
|
|
8945
|
+
const tryStart = (trigger) => {
|
|
8946
|
+
if (startedRef.current) {
|
|
8947
|
+
console.info("[blink-sdk] guestPreauthMobileRestore.tryStart: already started", { trigger });
|
|
8948
|
+
return;
|
|
8949
|
+
}
|
|
8851
8950
|
const persisted = loadMobileFlowState();
|
|
8951
|
+
console.info("[blink-sdk] guestPreauthMobileRestore.tryStart", {
|
|
8952
|
+
trigger,
|
|
8953
|
+
hasPersistedState: !!persisted,
|
|
8954
|
+
isGuestPreauth: persisted?.isGuestPreauth ?? false,
|
|
8955
|
+
hasGuestSessionToken: !!persisted?.guestSessionToken,
|
|
8956
|
+
hasSessionId: !!persisted?.sessionId,
|
|
8957
|
+
accountId: persisted?.accountId ?? null
|
|
8958
|
+
});
|
|
8852
8959
|
if (!persisted?.isGuestPreauth || !persisted.guestSessionToken || !persisted.sessionId) {
|
|
8853
8960
|
return;
|
|
8854
8961
|
}
|
|
@@ -8868,15 +8975,28 @@ function useGuestPreauthMobileRestoreEffect(deps) {
|
|
|
8868
8975
|
type: "MOBILE_DEEPLINK_READY",
|
|
8869
8976
|
deeplinkUri: persisted.deeplinkUri
|
|
8870
8977
|
});
|
|
8978
|
+
console.info("[blink-sdk] guestPreauthMobileRestore: starting guest account polling", {
|
|
8979
|
+
trigger,
|
|
8980
|
+
sessionId: persisted.sessionId
|
|
8981
|
+
});
|
|
8871
8982
|
startGuestAccountPolling(persisted.guestSessionToken, persisted.sessionId);
|
|
8872
8983
|
};
|
|
8873
8984
|
const onVisibility = () => {
|
|
8874
|
-
|
|
8985
|
+
console.info("[blink-sdk] guestPreauthMobileRestore: visibilitychange fired", {
|
|
8986
|
+
visibilityState: document.visibilityState,
|
|
8987
|
+
startedRef: startedRef.current
|
|
8988
|
+
});
|
|
8989
|
+
if (document.visibilityState === "visible") tryStart("visibilitychange");
|
|
8875
8990
|
};
|
|
8876
|
-
const onPageShow = () => {
|
|
8877
|
-
|
|
8991
|
+
const onPageShow = (e) => {
|
|
8992
|
+
console.info("[blink-sdk] guestPreauthMobileRestore: pageshow fired", {
|
|
8993
|
+
persisted: e.persisted,
|
|
8994
|
+
visibilityState: document.visibilityState,
|
|
8995
|
+
startedRef: startedRef.current
|
|
8996
|
+
});
|
|
8997
|
+
if (document.visibilityState === "visible") tryStart("pageshow");
|
|
8878
8998
|
};
|
|
8879
|
-
tryStart();
|
|
8999
|
+
tryStart("initial");
|
|
8880
9000
|
document.addEventListener("visibilitychange", onVisibility);
|
|
8881
9001
|
window.addEventListener("pageshow", onPageShow);
|
|
8882
9002
|
return () => {
|
|
@@ -9154,6 +9274,10 @@ function useGuestAccountPolling(intervalMs = 3e3) {
|
|
|
9154
9274
|
const apiBaseUrlRef = react.useRef(apiBaseUrl);
|
|
9155
9275
|
apiBaseUrlRef.current = apiBaseUrl;
|
|
9156
9276
|
const stopPolling = react.useCallback(() => {
|
|
9277
|
+
console.info("[blink-sdk] useGuestAccountPolling.stopPolling called", {
|
|
9278
|
+
hadInterval: !!intervalRef.current,
|
|
9279
|
+
hadToken: !!guestTokenRef.current
|
|
9280
|
+
});
|
|
9157
9281
|
if (intervalRef.current) {
|
|
9158
9282
|
clearInterval(intervalRef.current);
|
|
9159
9283
|
intervalRef.current = null;
|
|
@@ -9165,25 +9289,51 @@ function useGuestAccountPolling(intervalMs = 3e3) {
|
|
|
9165
9289
|
const poll = react.useCallback(async () => {
|
|
9166
9290
|
const token = guestTokenRef.current;
|
|
9167
9291
|
const sessionId = sessionIdRef.current;
|
|
9168
|
-
if (!token || !sessionId)
|
|
9292
|
+
if (!token || !sessionId) {
|
|
9293
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll skipped (no token or sessionId)", {
|
|
9294
|
+
hasToken: !!token,
|
|
9295
|
+
hasSessionId: !!sessionId
|
|
9296
|
+
});
|
|
9297
|
+
return;
|
|
9298
|
+
}
|
|
9299
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll executing", {
|
|
9300
|
+
apiBaseUrl: apiBaseUrlRef.current,
|
|
9301
|
+
tokenPrefix: token.slice(0, 8),
|
|
9302
|
+
sessionId
|
|
9303
|
+
});
|
|
9169
9304
|
try {
|
|
9170
9305
|
const lookup = await fetchGuestAccount(apiBaseUrlRef.current, token);
|
|
9171
9306
|
if (!guestTokenRef.current) return;
|
|
9172
|
-
if (lookup == null)
|
|
9307
|
+
if (lookup == null) {
|
|
9308
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll: account not found yet");
|
|
9309
|
+
return;
|
|
9310
|
+
}
|
|
9311
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll: account found, checking session");
|
|
9173
9312
|
try {
|
|
9174
9313
|
const session = await fetchAuthorizationSession(apiBaseUrlRef.current, sessionId);
|
|
9175
9314
|
if (!guestTokenRef.current) return;
|
|
9176
|
-
if (session.status !== "AUTHORIZED")
|
|
9177
|
-
|
|
9315
|
+
if (session.status !== "AUTHORIZED") {
|
|
9316
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll: session not AUTHORIZED yet", session.status);
|
|
9317
|
+
return;
|
|
9318
|
+
}
|
|
9319
|
+
} catch (err) {
|
|
9320
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll: session fetch failed", err);
|
|
9178
9321
|
return;
|
|
9179
9322
|
}
|
|
9323
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll: COMPLETE \u2014 account + AUTHORIZED");
|
|
9180
9324
|
setGuestAccount(lookup);
|
|
9181
9325
|
stopPolling();
|
|
9182
|
-
} catch {
|
|
9326
|
+
} catch (err) {
|
|
9327
|
+
console.info("[blink-sdk] useGuestAccountPolling.poll: fetch error, will retry", err);
|
|
9183
9328
|
}
|
|
9184
9329
|
}, [stopPolling]);
|
|
9185
9330
|
const startPolling = react.useCallback(
|
|
9186
9331
|
(guestToken, sessionId) => {
|
|
9332
|
+
console.info("[blink-sdk] useGuestAccountPolling.startPolling called", {
|
|
9333
|
+
tokenPrefix: guestToken.slice(0, 8),
|
|
9334
|
+
sessionId,
|
|
9335
|
+
intervalMs
|
|
9336
|
+
});
|
|
9187
9337
|
stopPolling();
|
|
9188
9338
|
guestTokenRef.current = guestToken;
|
|
9189
9339
|
sessionIdRef.current = sessionId;
|
|
@@ -9196,11 +9346,22 @@ function useGuestAccountPolling(intervalMs = 3e3) {
|
|
|
9196
9346
|
);
|
|
9197
9347
|
react.useEffect(() => {
|
|
9198
9348
|
const handleVisibility = () => {
|
|
9349
|
+
console.info("[blink-sdk] useGuestAccountPolling: visibilitychange fired", {
|
|
9350
|
+
visibilityState: document.visibilityState,
|
|
9351
|
+
hasToken: !!guestTokenRef.current,
|
|
9352
|
+
hasSessionId: !!sessionIdRef.current
|
|
9353
|
+
});
|
|
9199
9354
|
if (document.visibilityState === "visible" && guestTokenRef.current) {
|
|
9200
9355
|
void poll();
|
|
9201
9356
|
}
|
|
9202
9357
|
};
|
|
9203
|
-
const handlePageShow = () => {
|
|
9358
|
+
const handlePageShow = (e) => {
|
|
9359
|
+
console.info("[blink-sdk] useGuestAccountPolling: pageshow fired", {
|
|
9360
|
+
persisted: e.persisted,
|
|
9361
|
+
visibilityState: document.visibilityState,
|
|
9362
|
+
hasToken: !!guestTokenRef.current,
|
|
9363
|
+
hasSessionId: !!sessionIdRef.current
|
|
9364
|
+
});
|
|
9204
9365
|
if (document.visibilityState === "visible" && guestTokenRef.current) {
|
|
9205
9366
|
void poll();
|
|
9206
9367
|
}
|
|
@@ -9296,6 +9457,12 @@ function BlinkPaymentInner({
|
|
|
9296
9457
|
transfer.pollingTransferIdRef,
|
|
9297
9458
|
state.transfer,
|
|
9298
9459
|
mobileFlowRefs,
|
|
9460
|
+
{
|
|
9461
|
+
mobileFlow: state.mobileFlow,
|
|
9462
|
+
isGuestFlow: state.isGuestFlow,
|
|
9463
|
+
guestTransferId: state.guestTransferId,
|
|
9464
|
+
guestSessionToken: state.guestSessionToken
|
|
9465
|
+
},
|
|
9299
9466
|
onComplete
|
|
9300
9467
|
);
|
|
9301
9468
|
const sourceSelection = useSourceSelectionHandlers(dispatch, authExecutor, {
|
|
@@ -9401,9 +9568,22 @@ function BlinkPaymentInner({
|
|
|
9401
9568
|
startGuestAccountPolling: guestAccountPolling.startPolling
|
|
9402
9569
|
});
|
|
9403
9570
|
react.useEffect(() => {
|
|
9571
|
+
console.info("[blink-sdk] guestPreauthCompletion effect", {
|
|
9572
|
+
hasGuestAccount: !!guestAccountPolling.guestAccount,
|
|
9573
|
+
guestAccountId: guestAccountPolling.guestAccount?.accountId ?? null,
|
|
9574
|
+
currentPreauthAccountId: state.guestPreauthAccountId,
|
|
9575
|
+
currentPhase: state.phase.step,
|
|
9576
|
+
mobileFlow: state.mobileFlow,
|
|
9577
|
+
loginRequested: state.loginRequested
|
|
9578
|
+
});
|
|
9404
9579
|
if (!guestAccountPolling.guestAccount) return;
|
|
9405
9580
|
const acct = guestAccountPolling.guestAccount;
|
|
9406
|
-
|
|
9581
|
+
const needsDetect = acct.accountId !== state.guestPreauthAccountId;
|
|
9582
|
+
console.info("[blink-sdk] guestPreauthCompletion: dispatching REQUEST_LOGIN + MOBILE_SETUP_COMPLETE", {
|
|
9583
|
+
accountId: acct.accountId,
|
|
9584
|
+
dispatchingGuestPreauthDetected: needsDetect
|
|
9585
|
+
});
|
|
9586
|
+
if (needsDetect) {
|
|
9407
9587
|
dispatch({
|
|
9408
9588
|
type: "GUEST_PREAUTH_DETECTED",
|
|
9409
9589
|
accountId: acct.accountId,
|
|
@@ -9445,7 +9625,8 @@ function BlinkPaymentInner({
|
|
|
9445
9625
|
reauthTokenRef: mobileFlowRefs.reauthTokenRef,
|
|
9446
9626
|
pollingTransferIdRef: transfer.pollingTransferIdRef,
|
|
9447
9627
|
handleAuthorizedMobileReturn: mobileFlow.handleAuthorizedMobileReturn,
|
|
9448
|
-
onComplete
|
|
9628
|
+
onComplete,
|
|
9629
|
+
startGuestAccountPolling: guestAccountPolling.startPolling
|
|
9449
9630
|
});
|
|
9450
9631
|
useDataLoadEffect({
|
|
9451
9632
|
state,
|