@swype-org/react-sdk 0.1.280 → 0.1.285
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 +155 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +155 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -799,9 +799,9 @@ async function fetchGuestTransferBalances(apiBaseUrl, transferId, guestSessionTo
|
|
|
799
799
|
async function fetchGuestAccount(apiBaseUrl, guestToken) {
|
|
800
800
|
const params = new URLSearchParams({ guestToken });
|
|
801
801
|
const res = await fetch(`${apiBaseUrl}/v1/accounts?${params.toString()}`);
|
|
802
|
-
if (res.status === 404) return null;
|
|
803
802
|
if (!res.ok) await throwApiError(res);
|
|
804
|
-
|
|
803
|
+
const data = await res.json();
|
|
804
|
+
return data.items[0] ?? null;
|
|
805
805
|
}
|
|
806
806
|
async function createGuestAccount(apiBaseUrl, guestSessionToken, providerId, name) {
|
|
807
807
|
const res = await fetch(`${apiBaseUrl}/v1/accounts`, {
|
|
@@ -2093,19 +2093,21 @@ function resolvePhase(state) {
|
|
|
2093
2093
|
const branchProcessing = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && (state.creatingTransfer || isTransferAwaitingCompletion(state.transfer));
|
|
2094
2094
|
const branchKeepFundingSubflow = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && isFundingSourceSubflow;
|
|
2095
2095
|
const branchMobileWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && state.mobileFlow && state.deeplinkUri != null;
|
|
2096
|
-
const
|
|
2097
|
-
const
|
|
2098
|
-
const
|
|
2099
|
-
const
|
|
2100
|
-
const
|
|
2101
|
-
const
|
|
2102
|
-
const
|
|
2103
|
-
const
|
|
2104
|
-
const
|
|
2105
|
-
const
|
|
2106
|
-
const
|
|
2107
|
-
const
|
|
2108
|
-
const
|
|
2096
|
+
const branchKeepGuestPreauthDesktopOpenWallet = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && currentPhase.step === "wallet-setup" && currentPhase.mobile == null && currentPhase.guestDesktopExtension === true && state.guestPreauthorizing && !state.privyAuthenticated && !state.loginRequested;
|
|
2097
|
+
const branchKeepGuestWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && currentPhase.step === "wallet-setup" && currentPhase.mobile == null && state.guestPreauthorizing && state.privyAuthenticated && state.activeCredentialId != null;
|
|
2098
|
+
const branchGuestTokenPicker = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && guestTokenPickerEligible;
|
|
2099
|
+
const branchKeepWalletPickerSwitch = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && walletPickerSwitchEligible;
|
|
2100
|
+
const branchInitializingPrivy = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !state.privyReady;
|
|
2101
|
+
const branchInitializingPasskeyConfig = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && state.privyAuthenticated && !state.activeCredentialId && !state.passkeyConfigLoaded;
|
|
2102
|
+
const branchOtpVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && state.verificationTarget != null && !state.privyAuthenticated;
|
|
2103
|
+
const branchLoginRequested = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && state.loginRequested;
|
|
2104
|
+
const branchPasskeyVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && shouldPromptPasskeyVerification;
|
|
2105
|
+
const branchPasskeyCreate = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && missingActivePasskeyCredential;
|
|
2106
|
+
const branchGuestPreauthClaiming = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && state.guestPreauthAccountId != null && state.guestSessionToken != null && state.privyAuthenticated && state.activeCredentialId != null && !state.guestPreauthSetupCompletePending && !state.error;
|
|
2107
|
+
const branchDataLoading = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && state.loadingData && state.activeCredentialId != null && hasActiveWallet(state.accounts);
|
|
2108
|
+
const branchWalletPickerLink = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && !branchDataLoading && state.activeCredentialId != null && !hasActiveWallet(state.accounts) && !state.mobileFlow;
|
|
2109
|
+
const branchDeposit = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && !branchDataLoading && !branchWalletPickerLink && state.activeCredentialId != null && hasActiveWallet(state.accounts) && !state.loadingData;
|
|
2110
|
+
const branchWalletPickerGuestEntry = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && !branchDataLoading && !branchWalletPickerLink && !branchDeposit && state.isGuestFlow;
|
|
2109
2111
|
const exclusiveBranchFlags = [
|
|
2110
2112
|
branchGuestSetupComplete,
|
|
2111
2113
|
branchKeepGuestPreauthPin,
|
|
@@ -2115,6 +2117,7 @@ function resolvePhase(state) {
|
|
|
2115
2117
|
branchProcessing,
|
|
2116
2118
|
branchKeepFundingSubflow,
|
|
2117
2119
|
branchMobileWalletSetup,
|
|
2120
|
+
branchKeepGuestPreauthDesktopOpenWallet,
|
|
2118
2121
|
branchKeepGuestWalletSetup,
|
|
2119
2122
|
branchGuestTokenPicker,
|
|
2120
2123
|
branchKeepWalletPickerSwitch,
|
|
@@ -2124,6 +2127,7 @@ function resolvePhase(state) {
|
|
|
2124
2127
|
branchLoginRequested,
|
|
2125
2128
|
branchPasskeyVerify,
|
|
2126
2129
|
branchPasskeyCreate,
|
|
2130
|
+
branchGuestPreauthClaiming,
|
|
2127
2131
|
branchDataLoading,
|
|
2128
2132
|
branchWalletPickerLink,
|
|
2129
2133
|
branchDeposit,
|
|
@@ -2141,6 +2145,7 @@ function resolvePhase(state) {
|
|
|
2141
2145
|
branchProcessing,
|
|
2142
2146
|
branchKeepFundingSubflow,
|
|
2143
2147
|
branchMobileWalletSetup,
|
|
2148
|
+
branchKeepGuestPreauthDesktopOpenWallet,
|
|
2144
2149
|
branchKeepGuestWalletSetup,
|
|
2145
2150
|
branchGuestTokenPicker,
|
|
2146
2151
|
branchKeepWalletPickerSwitch,
|
|
@@ -2150,6 +2155,7 @@ function resolvePhase(state) {
|
|
|
2150
2155
|
branchLoginRequested,
|
|
2151
2156
|
branchPasskeyVerify,
|
|
2152
2157
|
branchPasskeyCreate,
|
|
2158
|
+
branchGuestPreauthClaiming,
|
|
2153
2159
|
branchDataLoading,
|
|
2154
2160
|
branchWalletPickerLink,
|
|
2155
2161
|
branchDeposit,
|
|
@@ -2182,6 +2188,8 @@ function resolvePhase(state) {
|
|
|
2182
2188
|
mobile: { deeplinkUri: state.deeplinkUri, providerId: state.selectedProviderId },
|
|
2183
2189
|
accountId: null
|
|
2184
2190
|
};
|
|
2191
|
+
} else if (branchKeepGuestPreauthDesktopOpenWallet) {
|
|
2192
|
+
nextPhase = currentPhase;
|
|
2185
2193
|
} else if (branchKeepGuestWalletSetup) {
|
|
2186
2194
|
nextPhase = currentPhase;
|
|
2187
2195
|
} else if (branchGuestTokenPicker) {
|
|
@@ -2200,6 +2208,8 @@ function resolvePhase(state) {
|
|
|
2200
2208
|
nextPhase = { step: "passkey-verify" };
|
|
2201
2209
|
} else if (branchPasskeyCreate) {
|
|
2202
2210
|
nextPhase = { step: "passkey-create", popupFallback: state.passkeyPopupNeeded };
|
|
2211
|
+
} else if (branchGuestPreauthClaiming) {
|
|
2212
|
+
nextPhase = { step: "guest-preauth-linking" };
|
|
2203
2213
|
} else if (branchDataLoading) {
|
|
2204
2214
|
nextPhase = { step: "data-loading" };
|
|
2205
2215
|
} else if (branchWalletPickerLink) {
|
|
@@ -2647,6 +2657,12 @@ function applyAction(state, action) {
|
|
|
2647
2657
|
// ── User intent & error ──────────────────────────────────────
|
|
2648
2658
|
case "SET_USER_INTENT":
|
|
2649
2659
|
return { ...state, phase: action.intent };
|
|
2660
|
+
case "GUEST_PREAUTH_CLEAR_TRANSFER":
|
|
2661
|
+
return {
|
|
2662
|
+
...state,
|
|
2663
|
+
transfer: null,
|
|
2664
|
+
creatingTransfer: false
|
|
2665
|
+
};
|
|
2650
2666
|
case "REQUEST_LOGIN":
|
|
2651
2667
|
return {
|
|
2652
2668
|
...state,
|
|
@@ -2787,6 +2803,8 @@ function screenForPhase(phase) {
|
|
|
2787
2803
|
return "success";
|
|
2788
2804
|
case "guest-setup-complete":
|
|
2789
2805
|
return "guest-setup-complete";
|
|
2806
|
+
case "guest-preauth-linking":
|
|
2807
|
+
return "guest-preauth-linking";
|
|
2790
2808
|
}
|
|
2791
2809
|
}
|
|
2792
2810
|
var MUTED = "#7fa4b0";
|
|
@@ -4972,14 +4990,10 @@ function SuccessScreen({
|
|
|
4972
4990
|
ScreenLayout,
|
|
4973
4991
|
{
|
|
4974
4992
|
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4975
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
onClick: onPreauthorize,
|
|
4980
|
-
children: "Preauthorize future transfers"
|
|
4981
|
-
}
|
|
4982
|
-
),
|
|
4993
|
+
succeeded && onPreauthorize ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4994
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onPreauthorize, children: "Preauthorize future transfers" }),
|
|
4995
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onDone, style: skipButtonStyle(tokens.textMuted), children: "Skip this time" })
|
|
4996
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onDone, children: succeeded ? "Done" : "Try again" }),
|
|
4983
4997
|
onManageAccount && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onManageAccount, style: manageStyle(tokens.textMuted), children: "Manage Blink account \u2192" }),
|
|
4984
4998
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
4985
4999
|
] }),
|
|
@@ -5117,6 +5131,17 @@ var manageStyle = (color) => ({
|
|
|
5117
5131
|
textAlign: "center",
|
|
5118
5132
|
padding: "12px 0 0"
|
|
5119
5133
|
});
|
|
5134
|
+
var skipButtonStyle = (color) => ({
|
|
5135
|
+
background: "none",
|
|
5136
|
+
border: "none",
|
|
5137
|
+
color,
|
|
5138
|
+
fontSize: "0.85rem",
|
|
5139
|
+
cursor: "pointer",
|
|
5140
|
+
padding: "8px 16px",
|
|
5141
|
+
textDecoration: "underline",
|
|
5142
|
+
fontFamily: "inherit",
|
|
5143
|
+
width: "100%"
|
|
5144
|
+
});
|
|
5120
5145
|
function SelectSourceScreen({
|
|
5121
5146
|
choices,
|
|
5122
5147
|
selectedChainName,
|
|
@@ -5125,6 +5150,7 @@ function SelectSourceScreen({
|
|
|
5125
5150
|
onChainChange,
|
|
5126
5151
|
onTokenChange,
|
|
5127
5152
|
onConfirm,
|
|
5153
|
+
confirmLabel = "Confirm source",
|
|
5128
5154
|
onBack,
|
|
5129
5155
|
onLogout
|
|
5130
5156
|
}) {
|
|
@@ -5136,7 +5162,7 @@ function SelectSourceScreen({
|
|
|
5136
5162
|
ScreenLayout,
|
|
5137
5163
|
{
|
|
5138
5164
|
footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5139
|
-
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onConfirm, disabled: !canConfirm, children:
|
|
5165
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onConfirm, disabled: !canConfirm, children: confirmLabel }),
|
|
5140
5166
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
5141
5167
|
] }),
|
|
5142
5168
|
children: [
|
|
@@ -6295,6 +6321,44 @@ function subtitleStyle10(color) {
|
|
|
6295
6321
|
maxWidth: 320
|
|
6296
6322
|
};
|
|
6297
6323
|
}
|
|
6324
|
+
function GuestPreauthLinkingScreen({ onLogout }) {
|
|
6325
|
+
const { tokens } = useBlinkConfig();
|
|
6326
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { children: [
|
|
6327
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
6328
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle10, children: [
|
|
6329
|
+
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
6330
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle13(tokens.text), children: "Setting up your account..." }),
|
|
6331
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle11(tokens.textSecondary), children: "Linking your wallet to your Blink account. This usually takes a few seconds." })
|
|
6332
|
+
] })
|
|
6333
|
+
] });
|
|
6334
|
+
}
|
|
6335
|
+
var contentStyle10 = {
|
|
6336
|
+
flex: 1,
|
|
6337
|
+
display: "flex",
|
|
6338
|
+
flexDirection: "column",
|
|
6339
|
+
alignItems: "center",
|
|
6340
|
+
justifyContent: "center",
|
|
6341
|
+
textAlign: "center",
|
|
6342
|
+
padding: "0 24px 32px"
|
|
6343
|
+
};
|
|
6344
|
+
function headingStyle13(color) {
|
|
6345
|
+
return {
|
|
6346
|
+
margin: "20px 0 8px",
|
|
6347
|
+
fontSize: "1.45rem",
|
|
6348
|
+
fontWeight: 700,
|
|
6349
|
+
letterSpacing: "-0.02em",
|
|
6350
|
+
color
|
|
6351
|
+
};
|
|
6352
|
+
}
|
|
6353
|
+
function subtitleStyle11(color) {
|
|
6354
|
+
return {
|
|
6355
|
+
margin: 0,
|
|
6356
|
+
fontSize: "0.9rem",
|
|
6357
|
+
lineHeight: 1.5,
|
|
6358
|
+
color,
|
|
6359
|
+
maxWidth: 280
|
|
6360
|
+
};
|
|
6361
|
+
}
|
|
6298
6362
|
var LINK_SCREENS = /* @__PURE__ */ new Set([
|
|
6299
6363
|
"create-passkey",
|
|
6300
6364
|
"verify-passkey",
|
|
@@ -6377,6 +6441,8 @@ function StepRendererContent({
|
|
|
6377
6441
|
switch (screen) {
|
|
6378
6442
|
case "loading":
|
|
6379
6443
|
return /* @__PURE__ */ jsxRuntime.jsx(BlinkLoadingScreen, {});
|
|
6444
|
+
case "guest-preauth-linking":
|
|
6445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GuestPreauthLinkingScreen, { onLogout: handlers.onLogout });
|
|
6380
6446
|
case "login":
|
|
6381
6447
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6382
6448
|
LoginScreen,
|
|
@@ -6560,7 +6626,12 @@ function StepRendererContent({
|
|
|
6560
6626
|
recommended: selectSourceRecommended,
|
|
6561
6627
|
onChainChange: handlers.onSelectSourceChainChange,
|
|
6562
6628
|
onTokenChange: handlers.onSetSelectSourceTokenSymbol,
|
|
6563
|
-
onConfirm: handlers.
|
|
6629
|
+
onConfirm: isDesktop ? () => handlers.onSetPhase({
|
|
6630
|
+
step: "select-source",
|
|
6631
|
+
action: pendingSelectSource,
|
|
6632
|
+
isDesktop
|
|
6633
|
+
}) : handlers.onConfirmSelectSource,
|
|
6634
|
+
confirmLabel: isDesktop ? "Done" : void 0,
|
|
6564
6635
|
onBack: () => handlers.onSetPhase({
|
|
6565
6636
|
step: "select-source",
|
|
6566
6637
|
action: pendingSelectSource,
|
|
@@ -6653,7 +6724,7 @@ function StepRendererContent({
|
|
|
6653
6724
|
return limit > displayAmount ? limit - displayAmount : 0;
|
|
6654
6725
|
})() : void 0,
|
|
6655
6726
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
6656
|
-
onLogout: handlers.onLogout,
|
|
6727
|
+
onLogout: authenticated ? handlers.onLogout : void 0,
|
|
6657
6728
|
onPreauthorize: state.isGuestFlow ? handlers.onPreauthorize : void 0
|
|
6658
6729
|
}
|
|
6659
6730
|
);
|
|
@@ -6701,7 +6772,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
6701
6772
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
6702
6773
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
6703
6774
|
] }) }),
|
|
6704
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
6775
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle14, children: "Something went wrong" }),
|
|
6705
6776
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: messageStyle, children: "An unexpected error occurred. Please try again." }),
|
|
6706
6777
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: this.handleReset, style: buttonStyle3, children: "Try again" })
|
|
6707
6778
|
] });
|
|
@@ -6721,7 +6792,7 @@ var containerStyle9 = {
|
|
|
6721
6792
|
var iconStyle3 = {
|
|
6722
6793
|
marginBottom: 20
|
|
6723
6794
|
};
|
|
6724
|
-
var
|
|
6795
|
+
var headingStyle14 = {
|
|
6725
6796
|
fontSize: "1.25rem",
|
|
6726
6797
|
fontWeight: 700,
|
|
6727
6798
|
color: "#1a1a1a",
|
|
@@ -7224,15 +7295,10 @@ function useSourceSelectionHandlers(dispatch, authExecutor, options) {
|
|
|
7224
7295
|
const handleConfirmSelectSource = react.useCallback(() => {
|
|
7225
7296
|
const guestPostPayPreauth = !!options?.guestPreauthSessionId && !!options?.isGuestFlow || !!options?.guestPreauthorizing && !!options?.isDesktop;
|
|
7226
7297
|
if (guestPostPayPreauth) {
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
mobile: null,
|
|
7232
|
-
accountId: options.guestPreauthAccountId,
|
|
7233
|
-
guestDesktopExtension: true
|
|
7234
|
-
};
|
|
7235
|
-
dispatch({ type: "SET_USER_INTENT", intent });
|
|
7298
|
+
if (options?.guestPreauthorizing && options?.isDesktop) {
|
|
7299
|
+
dispatch({ type: "GUEST_PREAUTH_CLEAR_TRANSFER" });
|
|
7300
|
+
} else {
|
|
7301
|
+
dispatch({ type: "REQUEST_LOGIN" });
|
|
7236
7302
|
}
|
|
7237
7303
|
}
|
|
7238
7304
|
authExecutor.resolveSelectSource({
|
|
@@ -7243,7 +7309,6 @@ function useSourceSelectionHandlers(dispatch, authExecutor, options) {
|
|
|
7243
7309
|
authExecutor,
|
|
7244
7310
|
dispatch,
|
|
7245
7311
|
options?.guestPreauthSessionId,
|
|
7246
|
-
options?.guestPreauthAccountId,
|
|
7247
7312
|
options?.guestPreauthorizing,
|
|
7248
7313
|
options?.isDesktop,
|
|
7249
7314
|
options?.isGuestFlow,
|
|
@@ -8126,7 +8191,7 @@ function useOneTapSetupHandlers(deps) {
|
|
|
8126
8191
|
selectSourceTokenSymbol,
|
|
8127
8192
|
authorizationSessionIdForGuest,
|
|
8128
8193
|
guestPostPayPreauth,
|
|
8129
|
-
|
|
8194
|
+
deferGuestPreauthLogin = false
|
|
8130
8195
|
} = deps;
|
|
8131
8196
|
const [savingOneTapLimit, setSavingOneTapLimit] = react.useState(false);
|
|
8132
8197
|
const handleSetupOneTap = react.useCallback(async (limit) => {
|
|
@@ -8145,15 +8210,10 @@ function useOneTapSetupHandlers(deps) {
|
|
|
8145
8210
|
}
|
|
8146
8211
|
const willResolveSession = authExecutor.pendingSelectSource != null || authExecutor.pendingOneTapSetup != null;
|
|
8147
8212
|
if (guestPostPayPreauth && willResolveSession) {
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
mobile: null,
|
|
8153
|
-
accountId: guestPreauthAccountId,
|
|
8154
|
-
guestDesktopExtension: true
|
|
8155
|
-
};
|
|
8156
|
-
dispatch({ type: "SET_USER_INTENT", intent });
|
|
8213
|
+
if (deferGuestPreauthLogin) {
|
|
8214
|
+
dispatch({ type: "GUEST_PREAUTH_CLEAR_TRANSFER" });
|
|
8215
|
+
} else {
|
|
8216
|
+
dispatch({ type: "REQUEST_LOGIN" });
|
|
8157
8217
|
}
|
|
8158
8218
|
}
|
|
8159
8219
|
if (authExecutor.pendingSelectSource) {
|
|
@@ -8196,7 +8256,7 @@ function useOneTapSetupHandlers(deps) {
|
|
|
8196
8256
|
selectSourceTokenSymbol,
|
|
8197
8257
|
authorizationSessionIdForGuest,
|
|
8198
8258
|
guestPostPayPreauth,
|
|
8199
|
-
|
|
8259
|
+
deferGuestPreauthLogin
|
|
8200
8260
|
]);
|
|
8201
8261
|
return {
|
|
8202
8262
|
handleSetupOneTap,
|
|
@@ -9171,7 +9231,7 @@ function useGuestPreauthEffect(deps) {
|
|
|
9171
9231
|
]);
|
|
9172
9232
|
}
|
|
9173
9233
|
function useGuestDesktopPreauthSessionEffect(deps) {
|
|
9174
|
-
const { state, authExecutor, reloadAccounts, dispatch, desktopGuestPreauth } = deps;
|
|
9234
|
+
const { state, authExecutor, reloadAccounts, dispatch, desktopGuestPreauth, privyAuthenticatedRef } = deps;
|
|
9175
9235
|
const preauthExecutingRef = react.useRef(false);
|
|
9176
9236
|
react.useEffect(() => {
|
|
9177
9237
|
if (!desktopGuestPreauth) return;
|
|
@@ -9186,6 +9246,9 @@ function useGuestDesktopPreauthSessionEffect(deps) {
|
|
|
9186
9246
|
} finally {
|
|
9187
9247
|
preauthExecutingRef.current = false;
|
|
9188
9248
|
dispatch({ type: "GUEST_PREAUTH_END" });
|
|
9249
|
+
if (!privyAuthenticatedRef.current) {
|
|
9250
|
+
dispatch({ type: "REQUEST_LOGIN" });
|
|
9251
|
+
}
|
|
9189
9252
|
}
|
|
9190
9253
|
};
|
|
9191
9254
|
void runPreauthSession();
|
|
@@ -9195,11 +9258,12 @@ function useGuestDesktopPreauthSessionEffect(deps) {
|
|
|
9195
9258
|
state.guestPreauthSessionId,
|
|
9196
9259
|
authExecutor,
|
|
9197
9260
|
reloadAccounts,
|
|
9198
|
-
dispatch
|
|
9261
|
+
dispatch,
|
|
9262
|
+
privyAuthenticatedRef
|
|
9199
9263
|
]);
|
|
9200
9264
|
}
|
|
9201
9265
|
function useGuestPreauthPhaseSyncEffect(deps) {
|
|
9202
|
-
const { state, dispatch, authExecutor, isDesktop } = deps;
|
|
9266
|
+
const { state, dispatch, authExecutor, isDesktop, privyAuthenticated } = deps;
|
|
9203
9267
|
react.useEffect(() => {
|
|
9204
9268
|
if (!state.guestPreauthorizing || !isDesktop) return;
|
|
9205
9269
|
const pending = authExecutor.pendingSelectSource;
|
|
@@ -9218,6 +9282,30 @@ function useGuestPreauthPhaseSyncEffect(deps) {
|
|
|
9218
9282
|
dispatch({ type: "SET_USER_INTENT", intent });
|
|
9219
9283
|
return;
|
|
9220
9284
|
}
|
|
9285
|
+
if (authExecutor.pendingOneTapSetup) {
|
|
9286
|
+
if (state.phase.step === "one-tap-setup") {
|
|
9287
|
+
return;
|
|
9288
|
+
}
|
|
9289
|
+
dispatch({ type: "SET_USER_INTENT", intent: { step: "one-tap-setup", action: null } });
|
|
9290
|
+
return;
|
|
9291
|
+
}
|
|
9292
|
+
if (!privyAuthenticated && authExecutor.executing && state.guestPreauthAccountId) {
|
|
9293
|
+
const accountId = state.guestPreauthAccountId;
|
|
9294
|
+
const p = state.phase;
|
|
9295
|
+
if (p.step === "wallet-setup" && p.mobile == null && p.guestDesktopExtension && p.accountId === accountId) {
|
|
9296
|
+
return;
|
|
9297
|
+
}
|
|
9298
|
+
dispatch({
|
|
9299
|
+
type: "SET_USER_INTENT",
|
|
9300
|
+
intent: {
|
|
9301
|
+
step: "wallet-setup",
|
|
9302
|
+
mobile: null,
|
|
9303
|
+
accountId,
|
|
9304
|
+
guestDesktopExtension: true
|
|
9305
|
+
}
|
|
9306
|
+
});
|
|
9307
|
+
return;
|
|
9308
|
+
}
|
|
9221
9309
|
if (state.phase.step === "select-source") {
|
|
9222
9310
|
dispatch({ type: "SET_USER_INTENT", intent: { step: "one-tap-setup", action: null } });
|
|
9223
9311
|
return;
|
|
@@ -9228,8 +9316,12 @@ function useGuestPreauthPhaseSyncEffect(deps) {
|
|
|
9228
9316
|
}, [
|
|
9229
9317
|
state.guestPreauthorizing,
|
|
9230
9318
|
state.phase,
|
|
9319
|
+
state.guestPreauthAccountId,
|
|
9231
9320
|
isDesktop,
|
|
9321
|
+
privyAuthenticated,
|
|
9232
9322
|
authExecutor.pendingSelectSource,
|
|
9323
|
+
authExecutor.pendingOneTapSetup,
|
|
9324
|
+
authExecutor.executing,
|
|
9233
9325
|
dispatch
|
|
9234
9326
|
]);
|
|
9235
9327
|
}
|
|
@@ -9238,6 +9330,7 @@ function useGuestPreauthWalletSetupEffect(deps) {
|
|
|
9238
9330
|
react.useEffect(() => {
|
|
9239
9331
|
if (!isDesktop || !state.guestPreauthorizing || !state.guestPreauthSessionId) return;
|
|
9240
9332
|
if (!state.guestPreauthAccountId) return;
|
|
9333
|
+
if (!state.privyAuthenticated || state.activeCredentialId == null) return;
|
|
9241
9334
|
if (!authExecutor.executing || authExecutor.pendingSelectSource) return;
|
|
9242
9335
|
if (state.verificationTarget) return;
|
|
9243
9336
|
const p = state.phase;
|
|
@@ -9258,6 +9351,8 @@ function useGuestPreauthWalletSetupEffect(deps) {
|
|
|
9258
9351
|
state.guestPreauthorizing,
|
|
9259
9352
|
state.guestPreauthSessionId,
|
|
9260
9353
|
state.guestPreauthAccountId,
|
|
9354
|
+
state.privyAuthenticated,
|
|
9355
|
+
state.activeCredentialId,
|
|
9261
9356
|
state.verificationTarget,
|
|
9262
9357
|
state.phase,
|
|
9263
9358
|
authExecutor.executing,
|
|
@@ -9430,6 +9525,8 @@ function BlinkPaymentInner({
|
|
|
9430
9525
|
const { apiBaseUrl, depositAmount } = useBlinkConfig();
|
|
9431
9526
|
const { ready, authenticated, logout, getAccessToken } = reactAuth.usePrivy();
|
|
9432
9527
|
reactAuth.useLoginWithOAuth();
|
|
9528
|
+
const privyAuthenticatedRef = react.useRef(false);
|
|
9529
|
+
privyAuthenticatedRef.current = authenticated;
|
|
9433
9530
|
const isDesktop = shouldUseWalletConnector({
|
|
9434
9531
|
useWalletConnector: useWalletConnectorProp,
|
|
9435
9532
|
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
@@ -9500,7 +9597,6 @@ function BlinkPaymentInner({
|
|
|
9500
9597
|
);
|
|
9501
9598
|
const sourceSelection = useSourceSelectionHandlers(dispatch, authExecutor, {
|
|
9502
9599
|
guestPreauthSessionId: state.guestPreauthSessionId,
|
|
9503
|
-
guestPreauthAccountId: state.guestPreauthAccountId,
|
|
9504
9600
|
isGuestFlow: state.isGuestFlow,
|
|
9505
9601
|
guestPreauthorizing: state.guestPreauthorizing,
|
|
9506
9602
|
isDesktop
|
|
@@ -9543,6 +9639,7 @@ function BlinkPaymentInner({
|
|
|
9543
9639
|
isDesktop
|
|
9544
9640
|
]
|
|
9545
9641
|
);
|
|
9642
|
+
const deferGuestPreauthLogin = state.guestPreauthorizing && isDesktop;
|
|
9546
9643
|
const oneTapSetup = useOneTapSetupHandlers({
|
|
9547
9644
|
dispatch,
|
|
9548
9645
|
getAccessToken,
|
|
@@ -9552,7 +9649,7 @@ function BlinkPaymentInner({
|
|
|
9552
9649
|
selectSourceTokenSymbol: sourceSelection.selectSourceTokenSymbol,
|
|
9553
9650
|
authorizationSessionIdForGuest: state.guestPreauthSessionId,
|
|
9554
9651
|
guestPostPayPreauth,
|
|
9555
|
-
|
|
9652
|
+
deferGuestPreauthLogin
|
|
9556
9653
|
});
|
|
9557
9654
|
const guestTransfer = useGuestTransferHandlers({
|
|
9558
9655
|
dispatch,
|
|
@@ -9745,14 +9842,16 @@ function BlinkPaymentInner({
|
|
|
9745
9842
|
state,
|
|
9746
9843
|
dispatch,
|
|
9747
9844
|
authExecutor,
|
|
9748
|
-
isDesktop
|
|
9845
|
+
isDesktop,
|
|
9846
|
+
privyAuthenticated: authenticated
|
|
9749
9847
|
});
|
|
9750
9848
|
useGuestDesktopPreauthSessionEffect({
|
|
9751
9849
|
state,
|
|
9752
9850
|
authExecutor,
|
|
9753
9851
|
reloadAccounts: transfer.reloadAccounts,
|
|
9754
9852
|
dispatch,
|
|
9755
|
-
desktopGuestPreauth: isDesktop
|
|
9853
|
+
desktopGuestPreauth: isDesktop,
|
|
9854
|
+
privyAuthenticatedRef
|
|
9756
9855
|
});
|
|
9757
9856
|
useGuestPreauthWalletSetupEffect({
|
|
9758
9857
|
state,
|