@swype-org/react-sdk 0.1.269 → 0.1.272
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 +132 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +132 -184
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6818,7 +6818,7 @@ function useAuthHandlers(dispatch, verificationTarget) {
|
|
|
6818
6818
|
handleResendLoginCode
|
|
6819
6819
|
};
|
|
6820
6820
|
}
|
|
6821
|
-
function usePasskeyHandlers(dispatch, apiBaseUrl, accounts, knownCredentialIds
|
|
6821
|
+
function usePasskeyHandlers(dispatch, apiBaseUrl, accounts, knownCredentialIds) {
|
|
6822
6822
|
const { user, getAccessToken } = reactAuth.usePrivy();
|
|
6823
6823
|
const checkingPasskeyRef = react.useRef(false);
|
|
6824
6824
|
const activateExistingCredential = react.useCallback(async (credentialId) => {
|
|
@@ -7342,7 +7342,8 @@ function useProviderHandlers(deps) {
|
|
|
7342
7342
|
destination,
|
|
7343
7343
|
guestSessionToken,
|
|
7344
7344
|
guestTransferId,
|
|
7345
|
-
selectedProviderId
|
|
7345
|
+
selectedProviderId,
|
|
7346
|
+
startGuestAccountPolling
|
|
7346
7347
|
} = deps;
|
|
7347
7348
|
const wagmiConfig2 = wagmi.useConfig();
|
|
7348
7349
|
const { connectAsync, connectors } = wagmi.useConnect();
|
|
@@ -7782,6 +7783,7 @@ function useProviderHandlers(deps) {
|
|
|
7782
7783
|
triggerDeeplink(created.sessionUri);
|
|
7783
7784
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: created.sessionUri });
|
|
7784
7785
|
}
|
|
7786
|
+
startGuestAccountPolling(guestSessionToken, session.id);
|
|
7785
7787
|
dispatch({
|
|
7786
7788
|
type: "GUEST_PREAUTH_DETECTED",
|
|
7787
7789
|
accountId: created.accountId,
|
|
@@ -7809,7 +7811,8 @@ function useProviderHandlers(deps) {
|
|
|
7809
7811
|
useWalletConnectorProp,
|
|
7810
7812
|
mobileSetupFlowRef,
|
|
7811
7813
|
handlingMobileReturnRef,
|
|
7812
|
-
setupAccountIdRef
|
|
7814
|
+
setupAccountIdRef,
|
|
7815
|
+
startGuestAccountPolling
|
|
7813
7816
|
]);
|
|
7814
7817
|
return {
|
|
7815
7818
|
handlePrepareProvider,
|
|
@@ -8679,7 +8682,7 @@ function useMobilePollingEffect(deps) {
|
|
|
8679
8682
|
handlingMobileReturnRef.current = false;
|
|
8680
8683
|
return;
|
|
8681
8684
|
}
|
|
8682
|
-
if (state.isGuestFlow && state.guestPreauthSessionId != null
|
|
8685
|
+
if (state.isGuestFlow && state.guestPreauthSessionId != null) {
|
|
8683
8686
|
return;
|
|
8684
8687
|
}
|
|
8685
8688
|
if (handlingMobileReturnRef.current) return;
|
|
@@ -8694,102 +8697,6 @@ function useMobilePollingEffect(deps) {
|
|
|
8694
8697
|
handlingMobileReturnRef,
|
|
8695
8698
|
mobileSetupFlowRef
|
|
8696
8699
|
]);
|
|
8697
|
-
react.useEffect(() => {
|
|
8698
|
-
if (!state.mobileFlow || !mobileSetupFlowRef.current) return;
|
|
8699
|
-
if (!setupAccountIdRef.current) return;
|
|
8700
|
-
if (!state.guestPreauthSessionId || !state.isGuestFlow) return;
|
|
8701
|
-
const guestToken = state.guestSessionToken ?? loadMobileFlowState()?.guestSessionToken ?? null;
|
|
8702
|
-
const preauthAccountId = state.guestPreauthAccountId;
|
|
8703
|
-
const preauthSessionId = state.guestPreauthSessionId;
|
|
8704
|
-
let cancelled = false;
|
|
8705
|
-
let completedGuestPreauth = false;
|
|
8706
|
-
const POLL_INTERVAL_MS = 3e3;
|
|
8707
|
-
const finishMobileAndDispatch = async () => {
|
|
8708
|
-
mobileSetupFlowRef.current = false;
|
|
8709
|
-
setupAccountIdRef.current = null;
|
|
8710
|
-
try {
|
|
8711
|
-
await reloadAccounts();
|
|
8712
|
-
} catch {
|
|
8713
|
-
}
|
|
8714
|
-
};
|
|
8715
|
-
const completeGuestPreauthWithoutToken = async () => {
|
|
8716
|
-
if (completedGuestPreauth) return;
|
|
8717
|
-
completedGuestPreauth = true;
|
|
8718
|
-
cancelled = true;
|
|
8719
|
-
await finishMobileAndDispatch();
|
|
8720
|
-
clearMobileFlowState();
|
|
8721
|
-
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
8722
|
-
};
|
|
8723
|
-
const completeGuestPreauthWithAccount = async (guestLookup) => {
|
|
8724
|
-
if (completedGuestPreauth) return;
|
|
8725
|
-
completedGuestPreauth = true;
|
|
8726
|
-
cancelled = true;
|
|
8727
|
-
await finishMobileAndDispatch();
|
|
8728
|
-
if (guestLookup.accountId !== preauthAccountId) {
|
|
8729
|
-
dispatch({
|
|
8730
|
-
type: "GUEST_PREAUTH_DETECTED",
|
|
8731
|
-
accountId: guestLookup.accountId,
|
|
8732
|
-
sessionId: preauthSessionId ?? void 0
|
|
8733
|
-
});
|
|
8734
|
-
}
|
|
8735
|
-
dispatch({ type: "REQUEST_LOGIN" });
|
|
8736
|
-
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
8737
|
-
};
|
|
8738
|
-
const pollGuestAccount = async () => {
|
|
8739
|
-
try {
|
|
8740
|
-
if (cancelled) return;
|
|
8741
|
-
if (!guestToken) {
|
|
8742
|
-
await completeGuestPreauthWithoutToken();
|
|
8743
|
-
return;
|
|
8744
|
-
}
|
|
8745
|
-
const guestLookup = await fetchGuestAccount(apiBaseUrl, guestToken);
|
|
8746
|
-
if (cancelled) return;
|
|
8747
|
-
if (guestLookup != null) {
|
|
8748
|
-
if (preauthSessionId) {
|
|
8749
|
-
try {
|
|
8750
|
-
const session = await fetchAuthorizationSession(
|
|
8751
|
-
apiBaseUrl,
|
|
8752
|
-
preauthSessionId
|
|
8753
|
-
);
|
|
8754
|
-
if (cancelled) return;
|
|
8755
|
-
if (session.status !== "AUTHORIZED") return;
|
|
8756
|
-
} catch {
|
|
8757
|
-
return;
|
|
8758
|
-
}
|
|
8759
|
-
}
|
|
8760
|
-
await completeGuestPreauthWithAccount(guestLookup);
|
|
8761
|
-
}
|
|
8762
|
-
} catch {
|
|
8763
|
-
}
|
|
8764
|
-
};
|
|
8765
|
-
pollGuestAccount();
|
|
8766
|
-
const intervalId = window.setInterval(pollGuestAccount, POLL_INTERVAL_MS);
|
|
8767
|
-
const handleVisibility = () => {
|
|
8768
|
-
if (document.visibilityState === "visible" && !cancelled) void pollGuestAccount();
|
|
8769
|
-
};
|
|
8770
|
-
const handlePageShow = () => {
|
|
8771
|
-
if (document.visibilityState === "visible" && !cancelled) void pollGuestAccount();
|
|
8772
|
-
};
|
|
8773
|
-
document.addEventListener("visibilitychange", handleVisibility);
|
|
8774
|
-
window.addEventListener("pageshow", handlePageShow);
|
|
8775
|
-
return () => {
|
|
8776
|
-
cancelled = true;
|
|
8777
|
-
window.clearInterval(intervalId);
|
|
8778
|
-
document.removeEventListener("visibilitychange", handleVisibility);
|
|
8779
|
-
window.removeEventListener("pageshow", handlePageShow);
|
|
8780
|
-
};
|
|
8781
|
-
}, [
|
|
8782
|
-
state.mobileFlow,
|
|
8783
|
-
state.guestPreauthSessionId,
|
|
8784
|
-
state.isGuestFlow,
|
|
8785
|
-
state.guestSessionToken,
|
|
8786
|
-
state.guestPreauthAccountId,
|
|
8787
|
-
apiBaseUrl,
|
|
8788
|
-
reloadAccounts,
|
|
8789
|
-
dispatch,
|
|
8790
|
-
mobileSetupFlowRef,
|
|
8791
|
-
setupAccountIdRef
|
|
8792
|
-
]);
|
|
8793
8700
|
react.useEffect(() => {
|
|
8794
8701
|
if (!state.mobileFlow || !mobileSetupFlowRef.current) return;
|
|
8795
8702
|
if (state.isGuestFlow && state.guestPreauthSessionId != null) return;
|
|
@@ -8895,6 +8802,8 @@ function useMobilePollingEffect(deps) {
|
|
|
8895
8802
|
react.useEffect(() => {
|
|
8896
8803
|
if (!state.mobileFlow) return;
|
|
8897
8804
|
if (handlingMobileReturnRef.current) return;
|
|
8805
|
+
const isGuestPostPayPreauthMobile = state.isGuestFlow && state.guestPreauthSessionId != null && state.guestPreauthAccountId != null;
|
|
8806
|
+
if (isGuestPostPayPreauthMobile) return;
|
|
8898
8807
|
const transferIdToResume = pollingTransferIdRef.current ?? state.transfer?.id;
|
|
8899
8808
|
if (!transferIdToResume) return;
|
|
8900
8809
|
if (!polling.isPolling) polling.startPolling(transferIdToResume);
|
|
@@ -8917,112 +8826,64 @@ function useMobilePollingEffect(deps) {
|
|
|
8917
8826
|
}, [
|
|
8918
8827
|
state.mobileFlow,
|
|
8919
8828
|
state.transfer?.id,
|
|
8829
|
+
state.isGuestFlow,
|
|
8830
|
+
state.guestPreauthSessionId,
|
|
8831
|
+
state.guestPreauthAccountId,
|
|
8920
8832
|
polling.isPolling,
|
|
8921
8833
|
polling.startPolling,
|
|
8922
8834
|
handlingMobileReturnRef,
|
|
8923
8835
|
pollingTransferIdRef
|
|
8924
8836
|
]);
|
|
8925
8837
|
}
|
|
8926
|
-
var guestPreauthRestoreAttemptedKeys = /* @__PURE__ */ new Set();
|
|
8927
|
-
function guestPreauthRestoreKey(guestToken) {
|
|
8928
|
-
return guestToken;
|
|
8929
|
-
}
|
|
8930
8838
|
function useGuestPreauthMobileRestoreEffect(deps) {
|
|
8931
|
-
const {
|
|
8932
|
-
|
|
8933
|
-
|
|
8839
|
+
const {
|
|
8840
|
+
dispatch,
|
|
8841
|
+
privyReady,
|
|
8842
|
+
mobileSetupFlowRef,
|
|
8843
|
+
setupAccountIdRef,
|
|
8844
|
+
startGuestAccountPolling
|
|
8845
|
+
} = deps;
|
|
8846
|
+
const startedRef = react.useRef(false);
|
|
8934
8847
|
react.useEffect(() => {
|
|
8935
8848
|
if (!privyReady) return;
|
|
8936
8849
|
const tryStart = () => {
|
|
8937
|
-
if (
|
|
8850
|
+
if (startedRef.current) return;
|
|
8938
8851
|
const persisted = loadMobileFlowState();
|
|
8939
|
-
if (!persisted?.isGuestPreauth || !persisted.guestSessionToken) {
|
|
8852
|
+
if (!persisted?.isGuestPreauth || !persisted.guestSessionToken || !persisted.sessionId) {
|
|
8940
8853
|
return;
|
|
8941
8854
|
}
|
|
8942
|
-
|
|
8943
|
-
const key = guestPreauthRestoreKey(guestToken);
|
|
8944
|
-
if (guestPreauthRestoreAttemptedKeys.has(key)) return;
|
|
8945
|
-
guestPreauthRestoreAttemptedKeys.add(key);
|
|
8946
|
-
let cancelled = false;
|
|
8947
|
-
const POLL_INTERVAL_MS = 3e3;
|
|
8855
|
+
startedRef.current = true;
|
|
8948
8856
|
mobileSetupFlowRef.current = true;
|
|
8949
8857
|
if (persisted.accountId) {
|
|
8950
8858
|
setupAccountIdRef.current = persisted.accountId;
|
|
8951
8859
|
}
|
|
8952
|
-
|
|
8953
|
-
if (completedRef.current) return;
|
|
8954
|
-
completedRef.current = true;
|
|
8955
|
-
cancelled = true;
|
|
8956
|
-
clearMobileFlowState();
|
|
8957
|
-
mobileSetupFlowRef.current = false;
|
|
8958
|
-
setupAccountIdRef.current = null;
|
|
8860
|
+
if (persisted.accountId) {
|
|
8959
8861
|
dispatch({
|
|
8960
8862
|
type: "GUEST_PREAUTH_DETECTED",
|
|
8961
|
-
accountId:
|
|
8962
|
-
sessionId: persisted.sessionId
|
|
8863
|
+
accountId: persisted.accountId,
|
|
8864
|
+
sessionId: persisted.sessionId
|
|
8963
8865
|
});
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
const guestLookup = await fetchGuestAccount(apiBaseUrl, guestToken);
|
|
8971
|
-
if (cancelled) return;
|
|
8972
|
-
if (guestLookup != null) {
|
|
8973
|
-
if (persisted.sessionId) {
|
|
8974
|
-
try {
|
|
8975
|
-
const session = await fetchAuthorizationSession(
|
|
8976
|
-
apiBaseUrl,
|
|
8977
|
-
persisted.sessionId
|
|
8978
|
-
);
|
|
8979
|
-
if (cancelled) return;
|
|
8980
|
-
if (session.status !== "AUTHORIZED") return;
|
|
8981
|
-
} catch {
|
|
8982
|
-
return;
|
|
8983
|
-
}
|
|
8984
|
-
}
|
|
8985
|
-
await handleAccountFound(guestLookup);
|
|
8986
|
-
}
|
|
8987
|
-
} catch {
|
|
8988
|
-
}
|
|
8989
|
-
};
|
|
8990
|
-
pollGuestAccount();
|
|
8991
|
-
const intervalId = window.setInterval(pollGuestAccount, POLL_INTERVAL_MS);
|
|
8992
|
-
const handlePollVisibility = () => {
|
|
8993
|
-
if (document.visibilityState === "visible" && !cancelled) void pollGuestAccount();
|
|
8994
|
-
};
|
|
8995
|
-
const handlePollPageShow = () => {
|
|
8996
|
-
if (document.visibilityState === "visible" && !cancelled) void pollGuestAccount();
|
|
8997
|
-
};
|
|
8998
|
-
document.addEventListener("visibilitychange", handlePollVisibility);
|
|
8999
|
-
window.addEventListener("pageshow", handlePollPageShow);
|
|
9000
|
-
pollingCleanupRef.current = () => {
|
|
9001
|
-
cancelled = true;
|
|
9002
|
-
window.clearInterval(intervalId);
|
|
9003
|
-
document.removeEventListener("visibilitychange", handlePollVisibility);
|
|
9004
|
-
window.removeEventListener("pageshow", handlePollPageShow);
|
|
9005
|
-
if (!completedRef.current) {
|
|
9006
|
-
guestPreauthRestoreAttemptedKeys.delete(key);
|
|
9007
|
-
}
|
|
9008
|
-
pollingCleanupRef.current = null;
|
|
9009
|
-
};
|
|
8866
|
+
}
|
|
8867
|
+
dispatch({
|
|
8868
|
+
type: "MOBILE_DEEPLINK_READY",
|
|
8869
|
+
deeplinkUri: persisted.deeplinkUri
|
|
8870
|
+
});
|
|
8871
|
+
startGuestAccountPolling(persisted.guestSessionToken, persisted.sessionId);
|
|
9010
8872
|
};
|
|
9011
|
-
const
|
|
8873
|
+
const onVisibility = () => {
|
|
9012
8874
|
if (document.visibilityState === "visible") tryStart();
|
|
9013
8875
|
};
|
|
9014
|
-
const
|
|
8876
|
+
const onPageShow = () => {
|
|
9015
8877
|
if (document.visibilityState === "visible") tryStart();
|
|
9016
8878
|
};
|
|
9017
8879
|
tryStart();
|
|
9018
|
-
document.addEventListener("visibilitychange",
|
|
9019
|
-
window.addEventListener("pageshow",
|
|
8880
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
8881
|
+
window.addEventListener("pageshow", onPageShow);
|
|
9020
8882
|
return () => {
|
|
9021
|
-
document.removeEventListener("visibilitychange",
|
|
9022
|
-
window.removeEventListener("pageshow",
|
|
9023
|
-
pollingCleanupRef.current?.();
|
|
8883
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
8884
|
+
window.removeEventListener("pageshow", onPageShow);
|
|
9024
8885
|
};
|
|
9025
|
-
}, [privyReady,
|
|
8886
|
+
}, [privyReady, dispatch, mobileSetupFlowRef, setupAccountIdRef, startGuestAccountPolling]);
|
|
9026
8887
|
}
|
|
9027
8888
|
function useSelectSourceEffect(deps) {
|
|
9028
8889
|
const {
|
|
@@ -9283,6 +9144,77 @@ function useGuestPreauthWalletSetupEffect(deps) {
|
|
|
9283
9144
|
dispatch
|
|
9284
9145
|
]);
|
|
9285
9146
|
}
|
|
9147
|
+
function useGuestAccountPolling(intervalMs = 3e3) {
|
|
9148
|
+
const { apiBaseUrl } = useBlinkConfig();
|
|
9149
|
+
const [guestAccount, setGuestAccount] = react.useState(null);
|
|
9150
|
+
const [isPolling, setIsPolling] = react.useState(false);
|
|
9151
|
+
const intervalRef = react.useRef(null);
|
|
9152
|
+
const guestTokenRef = react.useRef(null);
|
|
9153
|
+
const sessionIdRef = react.useRef(null);
|
|
9154
|
+
const apiBaseUrlRef = react.useRef(apiBaseUrl);
|
|
9155
|
+
apiBaseUrlRef.current = apiBaseUrl;
|
|
9156
|
+
const stopPolling = react.useCallback(() => {
|
|
9157
|
+
if (intervalRef.current) {
|
|
9158
|
+
clearInterval(intervalRef.current);
|
|
9159
|
+
intervalRef.current = null;
|
|
9160
|
+
}
|
|
9161
|
+
guestTokenRef.current = null;
|
|
9162
|
+
sessionIdRef.current = null;
|
|
9163
|
+
setIsPolling(false);
|
|
9164
|
+
}, []);
|
|
9165
|
+
const poll = react.useCallback(async () => {
|
|
9166
|
+
const token = guestTokenRef.current;
|
|
9167
|
+
const sessionId = sessionIdRef.current;
|
|
9168
|
+
if (!token || !sessionId) return;
|
|
9169
|
+
try {
|
|
9170
|
+
const lookup = await fetchGuestAccount(apiBaseUrlRef.current, token);
|
|
9171
|
+
if (!guestTokenRef.current) return;
|
|
9172
|
+
if (lookup == null) return;
|
|
9173
|
+
try {
|
|
9174
|
+
const session = await fetchAuthorizationSession(apiBaseUrlRef.current, sessionId);
|
|
9175
|
+
if (!guestTokenRef.current) return;
|
|
9176
|
+
if (session.status !== "AUTHORIZED") return;
|
|
9177
|
+
} catch {
|
|
9178
|
+
return;
|
|
9179
|
+
}
|
|
9180
|
+
setGuestAccount(lookup);
|
|
9181
|
+
stopPolling();
|
|
9182
|
+
} catch {
|
|
9183
|
+
}
|
|
9184
|
+
}, [stopPolling]);
|
|
9185
|
+
const startPolling = react.useCallback(
|
|
9186
|
+
(guestToken, sessionId) => {
|
|
9187
|
+
stopPolling();
|
|
9188
|
+
guestTokenRef.current = guestToken;
|
|
9189
|
+
sessionIdRef.current = sessionId;
|
|
9190
|
+
setGuestAccount(null);
|
|
9191
|
+
setIsPolling(true);
|
|
9192
|
+
poll();
|
|
9193
|
+
intervalRef.current = setInterval(poll, intervalMs);
|
|
9194
|
+
},
|
|
9195
|
+
[poll, intervalMs, stopPolling]
|
|
9196
|
+
);
|
|
9197
|
+
react.useEffect(() => {
|
|
9198
|
+
const handleVisibility = () => {
|
|
9199
|
+
if (document.visibilityState === "visible" && guestTokenRef.current) {
|
|
9200
|
+
void poll();
|
|
9201
|
+
}
|
|
9202
|
+
};
|
|
9203
|
+
const handlePageShow = () => {
|
|
9204
|
+
if (document.visibilityState === "visible" && guestTokenRef.current) {
|
|
9205
|
+
void poll();
|
|
9206
|
+
}
|
|
9207
|
+
};
|
|
9208
|
+
document.addEventListener("visibilitychange", handleVisibility);
|
|
9209
|
+
window.addEventListener("pageshow", handlePageShow);
|
|
9210
|
+
return () => {
|
|
9211
|
+
document.removeEventListener("visibilitychange", handleVisibility);
|
|
9212
|
+
window.removeEventListener("pageshow", handlePageShow);
|
|
9213
|
+
};
|
|
9214
|
+
}, [poll]);
|
|
9215
|
+
react.useEffect(() => () => stopPolling(), [stopPolling]);
|
|
9216
|
+
return { guestAccount, isPolling, startPolling, stopPolling };
|
|
9217
|
+
}
|
|
9286
9218
|
function BlinkPayment(props) {
|
|
9287
9219
|
const resetKey = react.useRef(0);
|
|
9288
9220
|
const handleBoundaryReset = react.useCallback(() => {
|
|
@@ -9319,6 +9251,7 @@ function BlinkPaymentInner({
|
|
|
9319
9251
|
);
|
|
9320
9252
|
const authExecutor = useAuthorizationExecutor();
|
|
9321
9253
|
const polling = useTransferPolling();
|
|
9254
|
+
const guestAccountPolling = useGuestAccountPolling();
|
|
9322
9255
|
const transferSigning = useTransferSigning();
|
|
9323
9256
|
const mobileFlowRefs = {
|
|
9324
9257
|
mobileSetupFlowRef: react.useRef(false),
|
|
@@ -9334,9 +9267,7 @@ function BlinkPaymentInner({
|
|
|
9334
9267
|
dispatch,
|
|
9335
9268
|
apiBaseUrl,
|
|
9336
9269
|
state.accounts,
|
|
9337
|
-
state.knownCredentialIds
|
|
9338
|
-
mobileFlowRefs.mobileSetupFlowRef,
|
|
9339
|
-
state.guestPreauthAccountId
|
|
9270
|
+
state.knownCredentialIds
|
|
9340
9271
|
);
|
|
9341
9272
|
const transfer = useTransferHandlers({
|
|
9342
9273
|
dispatch,
|
|
@@ -9400,7 +9331,8 @@ function BlinkPaymentInner({
|
|
|
9400
9331
|
destination,
|
|
9401
9332
|
guestSessionToken: state.guestSessionToken,
|
|
9402
9333
|
guestTransferId: state.guestTransferId,
|
|
9403
|
-
selectedProviderId: state.selectedProviderId
|
|
9334
|
+
selectedProviderId: state.selectedProviderId,
|
|
9335
|
+
startGuestAccountPolling: guestAccountPolling.startPolling
|
|
9404
9336
|
});
|
|
9405
9337
|
const guestPostPayPreauth = react.useMemo(
|
|
9406
9338
|
() => !!state.guestPreauthSessionId && state.isGuestFlow || state.guestPreauthorizing && isDesktop,
|
|
@@ -9463,11 +9395,27 @@ function BlinkPaymentInner({
|
|
|
9463
9395
|
usePrivySessionSyncEffect({ dispatch, ready, authenticated });
|
|
9464
9396
|
useGuestPreauthMobileRestoreEffect({
|
|
9465
9397
|
dispatch,
|
|
9466
|
-
apiBaseUrl,
|
|
9467
9398
|
privyReady: state.privyReady,
|
|
9468
9399
|
mobileSetupFlowRef: mobileFlowRefs.mobileSetupFlowRef,
|
|
9469
|
-
setupAccountIdRef: mobileFlowRefs.setupAccountIdRef
|
|
9400
|
+
setupAccountIdRef: mobileFlowRefs.setupAccountIdRef,
|
|
9401
|
+
startGuestAccountPolling: guestAccountPolling.startPolling
|
|
9470
9402
|
});
|
|
9403
|
+
react.useEffect(() => {
|
|
9404
|
+
if (!guestAccountPolling.guestAccount) return;
|
|
9405
|
+
const acct = guestAccountPolling.guestAccount;
|
|
9406
|
+
if (acct.accountId !== state.guestPreauthAccountId) {
|
|
9407
|
+
dispatch({
|
|
9408
|
+
type: "GUEST_PREAUTH_DETECTED",
|
|
9409
|
+
accountId: acct.accountId,
|
|
9410
|
+
sessionId: state.guestPreauthSessionId ?? void 0
|
|
9411
|
+
});
|
|
9412
|
+
}
|
|
9413
|
+
mobileFlowRefs.mobileSetupFlowRef.current = false;
|
|
9414
|
+
mobileFlowRefs.setupAccountIdRef.current = null;
|
|
9415
|
+
clearMobileFlowState();
|
|
9416
|
+
dispatch({ type: "REQUEST_LOGIN" });
|
|
9417
|
+
dispatch({ type: "MOBILE_SETUP_COMPLETE" });
|
|
9418
|
+
}, [guestAccountPolling.guestAccount]);
|
|
9471
9419
|
useOtpEffects({
|
|
9472
9420
|
state,
|
|
9473
9421
|
dispatch,
|