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