@swype-org/react-sdk 0.1.241 → 0.1.251
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 +217 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +217 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2011,7 +2011,8 @@ function isGuestPreauthCompletedTransferPinPhase(phase) {
|
|
|
2011
2011
|
case "one-tap-setup":
|
|
2012
2012
|
case "token-picker":
|
|
2013
2013
|
case "login":
|
|
2014
|
-
|
|
2014
|
+
// otp-verify not pinned: after OTP, verificationTarget clears but phase can be stale until
|
|
2015
|
+
// resolvePhase runs; pinning would block passkey.
|
|
2015
2016
|
case "passkey-create":
|
|
2016
2017
|
case "passkey-verify":
|
|
2017
2018
|
case "data-loading":
|
|
@@ -2024,11 +2025,20 @@ function isGuestPreauthCompletedTransferPinPhase(phase) {
|
|
|
2024
2025
|
}
|
|
2025
2026
|
function resolvePhase(state) {
|
|
2026
2027
|
const p = state.phase;
|
|
2027
|
-
if (state.
|
|
2028
|
+
if (state.guestPreauthSetupCompletePending && state.privyReady && state.privyAuthenticated) {
|
|
2029
|
+
return { step: "guest-setup-complete" };
|
|
2030
|
+
}
|
|
2031
|
+
if (state.transfer?.status === "COMPLETED" && state.guestPreauthorizing && !state.verificationTarget && isGuestPreauthCompletedTransferPinPhase(p)) {
|
|
2028
2032
|
return p;
|
|
2029
2033
|
}
|
|
2030
|
-
if (state.transfer?.status === "COMPLETED") {
|
|
2031
|
-
return { step: "
|
|
2034
|
+
if (state.transfer?.status === "COMPLETED" && state.isGuestFlow && state.guestPreauthSessionId && !state.guestPreauthorizing && !state.verificationTarget && !state.privyAuthenticated) {
|
|
2035
|
+
return { step: "login" };
|
|
2036
|
+
}
|
|
2037
|
+
if (state.transfer?.status === "COMPLETED" && !state.verificationTarget) {
|
|
2038
|
+
const needsPasskeyBootstrap = state.privyAuthenticated && !state.activeCredentialId;
|
|
2039
|
+
if (!needsPasskeyBootstrap) {
|
|
2040
|
+
return { step: "completed", transfer: state.transfer };
|
|
2041
|
+
}
|
|
2032
2042
|
}
|
|
2033
2043
|
if (state.transfer?.status === "FAILED") {
|
|
2034
2044
|
return { step: "failed", transfer: state.transfer, error: state.error ?? "Transfer failed." };
|
|
@@ -2046,10 +2056,10 @@ function resolvePhase(state) {
|
|
|
2046
2056
|
accountId: null
|
|
2047
2057
|
};
|
|
2048
2058
|
}
|
|
2049
|
-
if (p.step === "wallet-setup" && p.mobile == null) {
|
|
2059
|
+
if (p.step === "wallet-setup" && p.mobile == null && state.guestPreauthorizing) {
|
|
2050
2060
|
return p;
|
|
2051
2061
|
}
|
|
2052
|
-
if (state.isGuestFlow && state.selectedProviderId != null && !state.transfer) {
|
|
2062
|
+
if (state.isGuestFlow && state.selectedProviderId != null && !state.transfer && !state.guestPreauthAccountId) {
|
|
2053
2063
|
return { step: "guest-token-picker" };
|
|
2054
2064
|
}
|
|
2055
2065
|
if (p.step === "wallet-picker" && !state.creatingTransfer && !(state.mobileFlow && state.deeplinkUri)) {
|
|
@@ -2061,7 +2071,7 @@ function resolvePhase(state) {
|
|
|
2061
2071
|
if (state.privyAuthenticated && !state.activeCredentialId && !state.passkeyConfigLoaded) {
|
|
2062
2072
|
return { step: "initializing" };
|
|
2063
2073
|
}
|
|
2064
|
-
if (state.verificationTarget) {
|
|
2074
|
+
if (state.verificationTarget && !state.privyAuthenticated) {
|
|
2065
2075
|
return { step: "otp-verify", target: state.verificationTarget };
|
|
2066
2076
|
}
|
|
2067
2077
|
if (state.loginRequested) {
|
|
@@ -2133,13 +2143,26 @@ function createInitialState(config) {
|
|
|
2133
2143
|
activePublicKey: null,
|
|
2134
2144
|
loginRequested: false,
|
|
2135
2145
|
guestPreauthorizing: false,
|
|
2146
|
+
guestPreauthSetupCompletePending: false,
|
|
2136
2147
|
privyReady: false,
|
|
2137
2148
|
privyAuthenticated: false
|
|
2138
2149
|
};
|
|
2139
2150
|
}
|
|
2140
2151
|
function paymentReducer(state, action) {
|
|
2141
2152
|
const next = applyAction(state, action);
|
|
2142
|
-
|
|
2153
|
+
const phase = resolvePhase(next);
|
|
2154
|
+
if (action.type === "CODE_SENT") {
|
|
2155
|
+
console.debug("[Swype SDK] login code sent", {
|
|
2156
|
+
resolvedPhase: phase.step,
|
|
2157
|
+
verificationTargetKind: action.target.kind,
|
|
2158
|
+
guestPreauthorizing: next.guestPreauthorizing,
|
|
2159
|
+
transferStatus: next.transfer?.status ?? null,
|
|
2160
|
+
isGuestFlow: next.isGuestFlow,
|
|
2161
|
+
hasGuestPreauthSessionId: next.guestPreauthSessionId != null,
|
|
2162
|
+
loginRequested: next.loginRequested
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
return { ...next, phase };
|
|
2143
2166
|
}
|
|
2144
2167
|
function applyAction(state, action) {
|
|
2145
2168
|
switch (action.type) {
|
|
@@ -2400,13 +2423,20 @@ function applyAction(state, action) {
|
|
|
2400
2423
|
case "ACCOUNT_OWNER_SET":
|
|
2401
2424
|
return {
|
|
2402
2425
|
...state,
|
|
2426
|
+
transfer: null,
|
|
2403
2427
|
guestPreauthAccountId: null,
|
|
2404
2428
|
guestPreauthSessionId: null,
|
|
2405
2429
|
activePublicKey: null,
|
|
2406
2430
|
error: null,
|
|
2407
2431
|
guestPreauthorizing: false,
|
|
2408
|
-
|
|
2432
|
+
isGuestFlow: false,
|
|
2433
|
+
selectedProviderId: null,
|
|
2434
|
+
guestTransferId: null,
|
|
2435
|
+
guestSessionToken: null,
|
|
2436
|
+
guestPreauthSetupCompletePending: true
|
|
2409
2437
|
};
|
|
2438
|
+
case "GUEST_PREAUTH_SETUP_COMPLETE_DISMISSED":
|
|
2439
|
+
return { ...state, guestPreauthSetupCompletePending: false };
|
|
2410
2440
|
// ── User intent & error ──────────────────────────────────────
|
|
2411
2441
|
case "SET_USER_INTENT":
|
|
2412
2442
|
return { ...state, phase: action.intent };
|
|
@@ -2441,7 +2471,8 @@ function applyAction(state, action) {
|
|
|
2441
2471
|
activePublicKey: null,
|
|
2442
2472
|
loginRequested: false,
|
|
2443
2473
|
oneTapLimitSavedDuringSetup: false,
|
|
2444
|
-
guestPreauthorizing: false
|
|
2474
|
+
guestPreauthorizing: false,
|
|
2475
|
+
guestPreauthSetupCompletePending: false
|
|
2445
2476
|
};
|
|
2446
2477
|
case "LOGOUT":
|
|
2447
2478
|
return {
|
|
@@ -2457,7 +2488,10 @@ function applyAction(state, action) {
|
|
|
2457
2488
|
return {
|
|
2458
2489
|
...state,
|
|
2459
2490
|
privyReady: action.ready,
|
|
2460
|
-
privyAuthenticated: action.authenticated
|
|
2491
|
+
privyAuthenticated: action.authenticated,
|
|
2492
|
+
// OTP complete: Privy is source of truth; clear so resolvePhase can leave otp-verify
|
|
2493
|
+
// and guest-preauth pin rules cannot re-pin a stale otp-verify phase.
|
|
2494
|
+
...action.authenticated ? { verificationTarget: null, loginRequested: false } : {}
|
|
2461
2495
|
};
|
|
2462
2496
|
case "SYNC_AMOUNT":
|
|
2463
2497
|
return { ...state, amount: action.amount };
|
|
@@ -2523,7 +2557,10 @@ function screenForPhase(phase) {
|
|
|
2523
2557
|
case "wallet-picker":
|
|
2524
2558
|
return "wallet-picker";
|
|
2525
2559
|
case "wallet-setup":
|
|
2526
|
-
|
|
2560
|
+
if (phase.mobile || phase.guestDesktopExtension) {
|
|
2561
|
+
return "open-wallet";
|
|
2562
|
+
}
|
|
2563
|
+
return "setup-status";
|
|
2527
2564
|
case "select-source":
|
|
2528
2565
|
return phase.isDesktop ? "setup" : "select-source";
|
|
2529
2566
|
case "one-tap-setup":
|
|
@@ -2541,6 +2578,8 @@ function screenForPhase(phase) {
|
|
|
2541
2578
|
case "completed":
|
|
2542
2579
|
case "failed":
|
|
2543
2580
|
return "success";
|
|
2581
|
+
case "guest-setup-complete":
|
|
2582
|
+
return "guest-setup-complete";
|
|
2544
2583
|
}
|
|
2545
2584
|
}
|
|
2546
2585
|
var MUTED = "#7fa4b0";
|
|
@@ -6010,6 +6049,60 @@ var emptyStyle = (color) => ({
|
|
|
6010
6049
|
padding: "32px 0",
|
|
6011
6050
|
lineHeight: 1.5
|
|
6012
6051
|
});
|
|
6052
|
+
function GuestPreauthSetupCompleteScreen({
|
|
6053
|
+
onClose,
|
|
6054
|
+
onLogout
|
|
6055
|
+
}) {
|
|
6056
|
+
const { tokens } = useBlinkConfig();
|
|
6057
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6058
|
+
ScreenLayout,
|
|
6059
|
+
{
|
|
6060
|
+
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6061
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onClose, children: "Close" }),
|
|
6062
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
6063
|
+
] }),
|
|
6064
|
+
children: [
|
|
6065
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
6066
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle9, children: [
|
|
6067
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6068
|
+
"path",
|
|
6069
|
+
{
|
|
6070
|
+
d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
|
|
6071
|
+
fill: tokens.success
|
|
6072
|
+
}
|
|
6073
|
+
) }) }),
|
|
6074
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle12(tokens.text), children: "Setup complete" }),
|
|
6075
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle10(tokens.textSecondary), children: "Your account is linked and ready. You can close this window or make another deposit." })
|
|
6076
|
+
] })
|
|
6077
|
+
]
|
|
6078
|
+
}
|
|
6079
|
+
);
|
|
6080
|
+
}
|
|
6081
|
+
var contentStyle9 = {
|
|
6082
|
+
display: "flex",
|
|
6083
|
+
flexDirection: "column",
|
|
6084
|
+
alignItems: "center",
|
|
6085
|
+
textAlign: "center",
|
|
6086
|
+
gap: 12,
|
|
6087
|
+
paddingTop: 8
|
|
6088
|
+
};
|
|
6089
|
+
function headingStyle12(color) {
|
|
6090
|
+
return {
|
|
6091
|
+
margin: 0,
|
|
6092
|
+
fontSize: 22,
|
|
6093
|
+
fontWeight: 600,
|
|
6094
|
+
color
|
|
6095
|
+
};
|
|
6096
|
+
}
|
|
6097
|
+
function subtitleStyle10(color) {
|
|
6098
|
+
return {
|
|
6099
|
+
margin: 0,
|
|
6100
|
+
fontSize: 15,
|
|
6101
|
+
lineHeight: 1.45,
|
|
6102
|
+
color,
|
|
6103
|
+
maxWidth: 320
|
|
6104
|
+
};
|
|
6105
|
+
}
|
|
6013
6106
|
var LINK_SCREENS = /* @__PURE__ */ new Set([
|
|
6014
6107
|
"create-passkey",
|
|
6015
6108
|
"verify-passkey",
|
|
@@ -6311,6 +6404,14 @@ function StepRendererContent({
|
|
|
6311
6404
|
onBack: handlers.onGuestBackFromTokenPicker
|
|
6312
6405
|
}
|
|
6313
6406
|
);
|
|
6407
|
+
case "guest-setup-complete":
|
|
6408
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6409
|
+
GuestPreauthSetupCompleteScreen,
|
|
6410
|
+
{
|
|
6411
|
+
onClose: handlers.onGuestSetupCompleteClose,
|
|
6412
|
+
onLogout: handlers.onLogout
|
|
6413
|
+
}
|
|
6414
|
+
);
|
|
6314
6415
|
case "processing": {
|
|
6315
6416
|
const polledStatus = pollingTransfer?.status;
|
|
6316
6417
|
const transferPhase = state.creatingTransfer ? "creating" : polledStatus === "SENDING" || polledStatus === "SENT" ? "sent" : "verifying";
|
|
@@ -6404,7 +6505,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
6404
6505
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
6405
6506
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
6406
6507
|
] }) }),
|
|
6407
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
6508
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle13, children: "Something went wrong" }),
|
|
6408
6509
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: messageStyle, children: "An unexpected error occurred. Please try again." }),
|
|
6409
6510
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: this.handleReset, style: buttonStyle3, children: "Try again" })
|
|
6410
6511
|
] });
|
|
@@ -6424,7 +6525,7 @@ var containerStyle9 = {
|
|
|
6424
6525
|
var iconStyle3 = {
|
|
6425
6526
|
marginBottom: 20
|
|
6426
6527
|
};
|
|
6427
|
-
var
|
|
6528
|
+
var headingStyle13 = {
|
|
6428
6529
|
fontSize: "1.25rem",
|
|
6429
6530
|
fontWeight: 700,
|
|
6430
6531
|
color: "#1a1a1a",
|
|
@@ -6923,18 +7024,31 @@ function useSourceSelectionHandlers(dispatch, authExecutor, options) {
|
|
|
6923
7024
|
[selectSourceChoices, selectSourceRecommended]
|
|
6924
7025
|
);
|
|
6925
7026
|
const handleConfirmSelectSource = react.useCallback(() => {
|
|
7027
|
+
const guestPostPayPreauth = !!options?.guestPreauthSessionId && !!options?.isGuestFlow || !!options?.guestPreauthorizing && !!options?.isDesktop;
|
|
7028
|
+
if (guestPostPayPreauth) {
|
|
7029
|
+
dispatch({ type: "REQUEST_LOGIN" });
|
|
7030
|
+
if (options?.guestPreauthAccountId != null) {
|
|
7031
|
+
const intent = {
|
|
7032
|
+
step: "wallet-setup",
|
|
7033
|
+
mobile: null,
|
|
7034
|
+
accountId: options.guestPreauthAccountId,
|
|
7035
|
+
guestDesktopExtension: true
|
|
7036
|
+
};
|
|
7037
|
+
dispatch({ type: "SET_USER_INTENT", intent });
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
6926
7040
|
authExecutor.resolveSelectSource({
|
|
6927
7041
|
chainName: selectSourceChainName,
|
|
6928
7042
|
tokenSymbol: selectSourceTokenSymbol
|
|
6929
7043
|
});
|
|
6930
|
-
if (options?.guestPreauthorizing && options?.isDesktop) {
|
|
6931
|
-
dispatch({ type: "REQUEST_LOGIN" });
|
|
6932
|
-
}
|
|
6933
7044
|
}, [
|
|
6934
7045
|
authExecutor,
|
|
6935
7046
|
dispatch,
|
|
7047
|
+
options?.guestPreauthSessionId,
|
|
7048
|
+
options?.guestPreauthAccountId,
|
|
6936
7049
|
options?.guestPreauthorizing,
|
|
6937
7050
|
options?.isDesktop,
|
|
7051
|
+
options?.isGuestFlow,
|
|
6938
7052
|
selectSourceChainName,
|
|
6939
7053
|
selectSourceTokenSymbol
|
|
6940
7054
|
]);
|
|
@@ -8311,6 +8425,10 @@ function useProcessingEffect(deps) {
|
|
|
8311
8425
|
} = deps;
|
|
8312
8426
|
react.useEffect(() => {
|
|
8313
8427
|
if (!polling.transfer) return;
|
|
8428
|
+
if (state.loginRequested || state.verificationTarget) return;
|
|
8429
|
+
if (!state.transfer && (polling.transfer.status === "COMPLETED" || polling.transfer.status === "FAILED")) {
|
|
8430
|
+
return;
|
|
8431
|
+
}
|
|
8314
8432
|
if (polling.transfer.status === "COMPLETED") {
|
|
8315
8433
|
clearMobileFlowState();
|
|
8316
8434
|
dispatch({ type: "TRANSFER_COMPLETED", transfer: polling.transfer });
|
|
@@ -8320,7 +8438,15 @@ function useProcessingEffect(deps) {
|
|
|
8320
8438
|
clearMobileFlowState();
|
|
8321
8439
|
dispatch({ type: "TRANSFER_FAILED", transfer: polling.transfer, error: "Transfer failed." });
|
|
8322
8440
|
}
|
|
8323
|
-
}, [
|
|
8441
|
+
}, [
|
|
8442
|
+
polling.transfer,
|
|
8443
|
+
state.transfer,
|
|
8444
|
+
state.loginRequested,
|
|
8445
|
+
state.verificationTarget,
|
|
8446
|
+
onComplete,
|
|
8447
|
+
dispatch,
|
|
8448
|
+
reloadAccounts
|
|
8449
|
+
]);
|
|
8324
8450
|
react.useEffect(() => {
|
|
8325
8451
|
const isProcessing = state.creatingTransfer || state.transfer != null && ["CREATED", "SENDING", "SENT"].includes(state.transfer.status);
|
|
8326
8452
|
if (!isProcessing) {
|
|
@@ -8571,6 +8697,42 @@ function useOneTapAutoResolveEffect(deps) {
|
|
|
8571
8697
|
}
|
|
8572
8698
|
}, [pendingOneTapSetupAction, reloadAccounts, oneTapLimitSavedDuringSetup]);
|
|
8573
8699
|
}
|
|
8700
|
+
|
|
8701
|
+
// src/guestPreauthClaimWait.ts
|
|
8702
|
+
var GUEST_PREAUTH_SESSION_POLL_INTERVAL_MS = 1e3;
|
|
8703
|
+
var GUEST_PREAUTH_SESSION_POLL_TIMEOUT_MS = 12e4;
|
|
8704
|
+
async function waitForGuestPreauthAuthorizationSession(apiBaseUrl, sessionId, fetchSession, signal, options) {
|
|
8705
|
+
const intervalMs = GUEST_PREAUTH_SESSION_POLL_INTERVAL_MS;
|
|
8706
|
+
const timeoutMs = GUEST_PREAUTH_SESSION_POLL_TIMEOUT_MS;
|
|
8707
|
+
const deadline = Date.now() + timeoutMs;
|
|
8708
|
+
const sleepAbortable = (ms) => new Promise((resolve, reject) => {
|
|
8709
|
+
if (signal.aborted) {
|
|
8710
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
8711
|
+
return;
|
|
8712
|
+
}
|
|
8713
|
+
const t = setTimeout(() => {
|
|
8714
|
+
signal.removeEventListener("abort", onAbort);
|
|
8715
|
+
resolve();
|
|
8716
|
+
}, ms);
|
|
8717
|
+
const onAbort = () => {
|
|
8718
|
+
clearTimeout(t);
|
|
8719
|
+
signal.removeEventListener("abort", onAbort);
|
|
8720
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
8721
|
+
};
|
|
8722
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
8723
|
+
});
|
|
8724
|
+
while (Date.now() < deadline) {
|
|
8725
|
+
if (signal.aborted) {
|
|
8726
|
+
throw new DOMException("Aborted", "AbortError");
|
|
8727
|
+
}
|
|
8728
|
+
const session = await fetchSession(apiBaseUrl, sessionId);
|
|
8729
|
+
if (session.status === "AUTHORIZED") return;
|
|
8730
|
+
await sleepAbortable(intervalMs);
|
|
8731
|
+
}
|
|
8732
|
+
throw new Error("Authorization session did not become AUTHORIZED in time.");
|
|
8733
|
+
}
|
|
8734
|
+
|
|
8735
|
+
// src/hooks/useGuestPreauthEffect.ts
|
|
8574
8736
|
function useGuestPreauthEffect(deps) {
|
|
8575
8737
|
const { state, dispatch, authenticated, apiBaseUrl, reloadAccounts } = deps;
|
|
8576
8738
|
const { getAccessToken } = reactAuth.usePrivy();
|
|
@@ -8584,12 +8746,25 @@ function useGuestPreauthEffect(deps) {
|
|
|
8584
8746
|
if (!authenticated) return;
|
|
8585
8747
|
if (!state.guestSessionToken) return;
|
|
8586
8748
|
if (settingOwnerRef.current) return;
|
|
8587
|
-
const hasActive = state.accounts.some((a) => a.wallets.some((w) => w.status === "ACTIVE"));
|
|
8588
|
-
if (!hasActive) return;
|
|
8589
8749
|
settingOwnerRef.current = true;
|
|
8750
|
+
const abort = new AbortController();
|
|
8590
8751
|
let cancelled = false;
|
|
8591
8752
|
const setOwner = async () => {
|
|
8592
8753
|
try {
|
|
8754
|
+
if (state.guestPreauthSessionId) {
|
|
8755
|
+
try {
|
|
8756
|
+
await waitForGuestPreauthAuthorizationSession(
|
|
8757
|
+
apiBaseUrl,
|
|
8758
|
+
state.guestPreauthSessionId,
|
|
8759
|
+
fetchAuthorizationSession,
|
|
8760
|
+
abort.signal
|
|
8761
|
+
);
|
|
8762
|
+
} catch (waitErr) {
|
|
8763
|
+
if (waitErr instanceof DOMException && waitErr.name === "AbortError") return;
|
|
8764
|
+
throw waitErr;
|
|
8765
|
+
}
|
|
8766
|
+
}
|
|
8767
|
+
if (cancelled) return;
|
|
8593
8768
|
const token = await getAccessTokenRef.current();
|
|
8594
8769
|
if (!token || cancelled) return;
|
|
8595
8770
|
await setAccountOwner(apiBaseUrl, token, state.guestPreauthAccountId, state.guestSessionToken, {
|
|
@@ -8614,16 +8789,17 @@ function useGuestPreauthEffect(deps) {
|
|
|
8614
8789
|
settingOwnerRef.current = false;
|
|
8615
8790
|
}
|
|
8616
8791
|
};
|
|
8617
|
-
setOwner();
|
|
8792
|
+
void setOwner();
|
|
8618
8793
|
return () => {
|
|
8619
8794
|
cancelled = true;
|
|
8795
|
+
abort.abort();
|
|
8620
8796
|
};
|
|
8621
8797
|
}, [
|
|
8622
8798
|
state.guestPreauthAccountId,
|
|
8799
|
+
state.guestPreauthSessionId,
|
|
8623
8800
|
state.activeCredentialId,
|
|
8624
8801
|
state.activePublicKey,
|
|
8625
8802
|
state.guestSessionToken,
|
|
8626
|
-
state.accounts,
|
|
8627
8803
|
authenticated,
|
|
8628
8804
|
apiBaseUrl,
|
|
8629
8805
|
dispatch,
|
|
@@ -8694,24 +8870,23 @@ function useGuestPreauthPhaseSyncEffect(deps) {
|
|
|
8694
8870
|
]);
|
|
8695
8871
|
}
|
|
8696
8872
|
function useGuestPreauthWalletSetupEffect(deps) {
|
|
8697
|
-
const { state, dispatch, authExecutor, isDesktop
|
|
8873
|
+
const { state, dispatch, authExecutor, isDesktop } = deps;
|
|
8698
8874
|
react.useEffect(() => {
|
|
8699
8875
|
if (!isDesktop || !state.guestPreauthorizing || !state.guestPreauthSessionId) return;
|
|
8876
|
+
if (!state.guestPreauthAccountId) return;
|
|
8700
8877
|
if (!authExecutor.executing || authExecutor.pendingSelectSource) return;
|
|
8701
|
-
if (!privyAuthenticated || !state.activeCredentialId) return;
|
|
8702
8878
|
if (state.verificationTarget) return;
|
|
8703
|
-
if (state.loginRequested) return;
|
|
8704
8879
|
const p = state.phase;
|
|
8705
|
-
if (p.step === "wallet-setup" && p.mobile == null) {
|
|
8706
|
-
|
|
8707
|
-
if (id != null && p.accountId === id) return;
|
|
8880
|
+
if (p.step === "wallet-setup" && p.mobile == null && p.guestDesktopExtension && p.accountId === state.guestPreauthAccountId) {
|
|
8881
|
+
return;
|
|
8708
8882
|
}
|
|
8709
8883
|
dispatch({
|
|
8710
8884
|
type: "SET_USER_INTENT",
|
|
8711
8885
|
intent: {
|
|
8712
8886
|
step: "wallet-setup",
|
|
8713
8887
|
mobile: null,
|
|
8714
|
-
accountId: state.guestPreauthAccountId
|
|
8888
|
+
accountId: state.guestPreauthAccountId,
|
|
8889
|
+
guestDesktopExtension: true
|
|
8715
8890
|
}
|
|
8716
8891
|
});
|
|
8717
8892
|
}, [
|
|
@@ -8719,14 +8894,11 @@ function useGuestPreauthWalletSetupEffect(deps) {
|
|
|
8719
8894
|
state.guestPreauthorizing,
|
|
8720
8895
|
state.guestPreauthSessionId,
|
|
8721
8896
|
state.guestPreauthAccountId,
|
|
8722
|
-
state.activeCredentialId,
|
|
8723
8897
|
state.verificationTarget,
|
|
8724
|
-
state.loginRequested,
|
|
8725
8898
|
state.phase,
|
|
8726
8899
|
authExecutor.executing,
|
|
8727
8900
|
authExecutor.pendingSelectSource,
|
|
8728
|
-
dispatch
|
|
8729
|
-
privyAuthenticated
|
|
8901
|
+
dispatch
|
|
8730
8902
|
]);
|
|
8731
8903
|
}
|
|
8732
8904
|
function BlinkPayment(props) {
|
|
@@ -8814,6 +8986,9 @@ function BlinkPaymentInner({
|
|
|
8814
8986
|
onComplete
|
|
8815
8987
|
);
|
|
8816
8988
|
const sourceSelection = useSourceSelectionHandlers(dispatch, authExecutor, {
|
|
8989
|
+
guestPreauthSessionId: state.guestPreauthSessionId,
|
|
8990
|
+
guestPreauthAccountId: state.guestPreauthAccountId,
|
|
8991
|
+
isGuestFlow: state.isGuestFlow,
|
|
8817
8992
|
guestPreauthorizing: state.guestPreauthorizing,
|
|
8818
8993
|
isDesktop
|
|
8819
8994
|
});
|
|
@@ -8993,8 +9168,7 @@ function BlinkPaymentInner({
|
|
|
8993
9168
|
state,
|
|
8994
9169
|
dispatch,
|
|
8995
9170
|
authExecutor,
|
|
8996
|
-
isDesktop
|
|
8997
|
-
privyAuthenticated: authenticated
|
|
9171
|
+
isDesktop
|
|
8998
9172
|
});
|
|
8999
9173
|
const handlers = react.useMemo(() => ({
|
|
9000
9174
|
onSendLoginCode: auth.handleSendLoginCode,
|
|
@@ -9034,7 +9208,11 @@ function BlinkPaymentInner({
|
|
|
9034
9208
|
onSelectGuestToken: guestTransfer.handleSelectGuestToken,
|
|
9035
9209
|
onGuestBackFromTokenPicker: guestTransfer.handleGuestBackFromTokenPicker,
|
|
9036
9210
|
onLogin: () => dispatch({ type: "REQUEST_LOGIN" }),
|
|
9037
|
-
onPreauthorize: provider.handlePreauthorize
|
|
9211
|
+
onPreauthorize: provider.handlePreauthorize,
|
|
9212
|
+
onGuestSetupCompleteClose: () => {
|
|
9213
|
+
dispatch({ type: "GUEST_PREAUTH_SETUP_COMPLETE_DISMISSED" });
|
|
9214
|
+
onDismiss?.();
|
|
9215
|
+
}
|
|
9038
9216
|
}), [
|
|
9039
9217
|
auth,
|
|
9040
9218
|
passkey,
|
|
@@ -9045,7 +9223,9 @@ function BlinkPaymentInner({
|
|
|
9045
9223
|
oneTapSetup,
|
|
9046
9224
|
guestTransfer,
|
|
9047
9225
|
handleLogout,
|
|
9048
|
-
handleNewPayment
|
|
9226
|
+
handleNewPayment,
|
|
9227
|
+
onDismiss,
|
|
9228
|
+
dispatch
|
|
9049
9229
|
]);
|
|
9050
9230
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9051
9231
|
StepRenderer,
|