@unifold/connect-react 0.1.77 → 0.1.79
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/README.md +7 -1
- package/dist/index.js +630 -442
- package/dist/index.mjs +344 -156
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1152,66 +1152,66 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
|
1152
1152
|
// src/index.ts
|
|
1153
1153
|
var index_exports = {};
|
|
1154
1154
|
__export(index_exports, {
|
|
1155
|
-
ActionType: () =>
|
|
1155
|
+
ActionType: () => import_core60.ActionType,
|
|
1156
1156
|
Button: () => Button,
|
|
1157
|
-
CheckoutEventType: () =>
|
|
1157
|
+
CheckoutEventType: () => import_core60.CheckoutEventType,
|
|
1158
1158
|
ConfirmingView: () => ConfirmingView,
|
|
1159
|
-
DepositEventType: () =>
|
|
1160
|
-
ExecutionStatus: () =>
|
|
1159
|
+
DepositEventType: () => import_core60.DepositEventType,
|
|
1160
|
+
ExecutionStatus: () => import_core60.ExecutionStatus,
|
|
1161
1161
|
I18nProvider: () => I18nProvider,
|
|
1162
|
-
SOLANA_USDC_ADDRESS: () =>
|
|
1162
|
+
SOLANA_USDC_ADDRESS: () => import_core60.SOLANA_USDC_ADDRESS,
|
|
1163
1163
|
SUPPORTED_LOCALES: () => SUPPORTED_LOCALES,
|
|
1164
1164
|
UnifoldProvider: () => UnifoldProvider,
|
|
1165
|
-
WithdrawEventType: () =>
|
|
1166
|
-
createDepositAddress: () =>
|
|
1167
|
-
createOnrampSession: () =>
|
|
1165
|
+
WithdrawEventType: () => import_core60.WithdrawEventType,
|
|
1166
|
+
createDepositAddress: () => import_core60.createDepositAddress,
|
|
1167
|
+
createOnrampSession: () => import_core60.createOnrampSession,
|
|
1168
1168
|
detectBrowserLocale: () => detectBrowserLocale,
|
|
1169
|
-
generatePrefixedKSUID: () =>
|
|
1170
|
-
getApiBaseUrl: () =>
|
|
1171
|
-
getChainName: () =>
|
|
1172
|
-
getDefaultOnrampToken: () =>
|
|
1173
|
-
getDepositQuote: () =>
|
|
1174
|
-
getFiatCurrencies: () =>
|
|
1175
|
-
getIconUrl: () =>
|
|
1176
|
-
getIconUrlWithCdn: () =>
|
|
1177
|
-
getIpAddress: () =>
|
|
1178
|
-
getOnrampQuotes: () =>
|
|
1179
|
-
getPreferredIconUrl: () =>
|
|
1180
|
-
getProjectConfig: () =>
|
|
1181
|
-
getSupportedDepositTokens: () =>
|
|
1182
|
-
getSupportedDestinationTokens: () =>
|
|
1183
|
-
getTokenChains: () =>
|
|
1184
|
-
getWalletByChainType: () =>
|
|
1185
|
-
i18n: () =>
|
|
1169
|
+
generatePrefixedKSUID: () => import_core60.generatePrefixedKSUID,
|
|
1170
|
+
getApiBaseUrl: () => import_core60.getApiBaseUrl,
|
|
1171
|
+
getChainName: () => import_core60.getChainName,
|
|
1172
|
+
getDefaultOnrampToken: () => import_core60.getDefaultOnrampToken,
|
|
1173
|
+
getDepositQuote: () => import_core60.getDepositQuote,
|
|
1174
|
+
getFiatCurrencies: () => import_core60.getFiatCurrencies,
|
|
1175
|
+
getIconUrl: () => import_core60.getIconUrl,
|
|
1176
|
+
getIconUrlWithCdn: () => import_core60.getIconUrlWithCdn,
|
|
1177
|
+
getIpAddress: () => import_core60.getIpAddress,
|
|
1178
|
+
getOnrampQuotes: () => import_core60.getOnrampQuotes,
|
|
1179
|
+
getPreferredIconUrl: () => import_core60.getPreferredIconUrl,
|
|
1180
|
+
getProjectConfig: () => import_core60.getProjectConfig,
|
|
1181
|
+
getSupportedDepositTokens: () => import_core60.getSupportedDepositTokens,
|
|
1182
|
+
getSupportedDestinationTokens: () => import_core60.getSupportedDestinationTokens,
|
|
1183
|
+
getTokenChains: () => import_core60.getTokenChains,
|
|
1184
|
+
getWalletByChainType: () => import_core60.getWalletByChainType,
|
|
1185
|
+
i18n: () => import_core60.i18n,
|
|
1186
1186
|
interpolate: () => interpolate,
|
|
1187
1187
|
normalizeLocale: () => normalizeLocale,
|
|
1188
|
-
queryExecutions: () =>
|
|
1189
|
-
retrievePaymentIntent: () =>
|
|
1190
|
-
sendSolanaTransaction: () =>
|
|
1191
|
-
setApiConfig: () =>
|
|
1192
|
-
stripeConfirmSession: () =>
|
|
1193
|
-
stripeCreateAuthIntent: () =>
|
|
1194
|
-
stripeCreateSession: () =>
|
|
1195
|
-
stripeExchangeTokens: () =>
|
|
1196
|
-
stripeGetConfig: () =>
|
|
1197
|
-
stripeGetCustomer: () =>
|
|
1198
|
-
stripeGetDefaultToken: () =>
|
|
1199
|
-
stripeGetQuotes: () =>
|
|
1200
|
-
stripeGetSession: () =>
|
|
1201
|
-
stripeListPaymentTokens: () =>
|
|
1202
|
-
stripeListWallets: () =>
|
|
1203
|
-
stripeRefreshQuote: () =>
|
|
1204
|
-
stripeRefreshToken: () =>
|
|
1188
|
+
queryExecutions: () => import_core60.queryExecutions,
|
|
1189
|
+
retrievePaymentIntent: () => import_core60.retrievePaymentIntent,
|
|
1190
|
+
sendSolanaTransaction: () => import_core60.sendSolanaTransaction,
|
|
1191
|
+
setApiConfig: () => import_core60.setApiConfig,
|
|
1192
|
+
stripeConfirmSession: () => import_core60.stripeConfirmSession,
|
|
1193
|
+
stripeCreateAuthIntent: () => import_core60.stripeCreateAuthIntent,
|
|
1194
|
+
stripeCreateSession: () => import_core60.stripeCreateSession,
|
|
1195
|
+
stripeExchangeTokens: () => import_core60.stripeExchangeTokens,
|
|
1196
|
+
stripeGetConfig: () => import_core60.stripeGetConfig,
|
|
1197
|
+
stripeGetCustomer: () => import_core60.stripeGetCustomer,
|
|
1198
|
+
stripeGetDefaultToken: () => import_core60.stripeGetDefaultToken,
|
|
1199
|
+
stripeGetQuotes: () => import_core60.stripeGetQuotes,
|
|
1200
|
+
stripeGetSession: () => import_core60.stripeGetSession,
|
|
1201
|
+
stripeListPaymentTokens: () => import_core60.stripeListPaymentTokens,
|
|
1202
|
+
stripeListWallets: () => import_core60.stripeListWallets,
|
|
1203
|
+
stripeRefreshQuote: () => import_core60.stripeRefreshQuote,
|
|
1204
|
+
stripeRefreshToken: () => import_core60.stripeRefreshToken,
|
|
1205
1205
|
useAllowedCountry: () => useAllowedCountry2,
|
|
1206
1206
|
useI18n: () => useI18n,
|
|
1207
1207
|
useSupportedDepositTokens: () => useSupportedDepositTokens,
|
|
1208
1208
|
useUnifold: () => useUnifold,
|
|
1209
|
-
useUserIp: () =>
|
|
1209
|
+
useUserIp: () => import_core60.useUserIp
|
|
1210
1210
|
});
|
|
1211
1211
|
module.exports = __toCommonJS(index_exports);
|
|
1212
1212
|
|
|
1213
1213
|
// src/provider.tsx
|
|
1214
|
-
var
|
|
1214
|
+
var import_react46 = __toESM(require("react"));
|
|
1215
1215
|
var import_react_provider = require("@unifold/react-provider");
|
|
1216
1216
|
|
|
1217
1217
|
// ../ui-react/dist/index.mjs
|
|
@@ -6138,9 +6138,9 @@ var React72 = __toESM(require("react"), 1);
|
|
|
6138
6138
|
var import_react8 = require("react");
|
|
6139
6139
|
var import_react_query = require("@tanstack/react-query");
|
|
6140
6140
|
var import_core2 = require("@unifold/core");
|
|
6141
|
-
var import_react9 = require("react");
|
|
6142
6141
|
var import_react_query2 = require("@tanstack/react-query");
|
|
6143
6142
|
var import_core3 = require("@unifold/core");
|
|
6143
|
+
var import_react9 = require("react");
|
|
6144
6144
|
var React52 = __toESM(require("react"), 1);
|
|
6145
6145
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6146
6146
|
var import_react10 = require("react");
|
|
@@ -6198,15 +6198,13 @@ var import_core18 = require("@unifold/core");
|
|
|
6198
6198
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6199
6199
|
var import_react25 = require("react");
|
|
6200
6200
|
var import_core19 = require("@unifold/core");
|
|
6201
|
-
var import_react_query9 = require("@tanstack/react-query");
|
|
6202
|
-
var import_core20 = require("@unifold/core");
|
|
6203
6201
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6204
6202
|
var import_react26 = require("react");
|
|
6203
|
+
var import_core20 = require("@unifold/core");
|
|
6204
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
6205
6205
|
var import_core21 = require("@unifold/core");
|
|
6206
|
-
var import_react_query10 = require("@tanstack/react-query");
|
|
6207
|
-
var import_core22 = require("@unifold/core");
|
|
6208
6206
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6209
|
-
var
|
|
6207
|
+
var import_core22 = require("@unifold/core");
|
|
6210
6208
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6211
6209
|
var React92 = __toESM(require("react"), 1);
|
|
6212
6210
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
@@ -6374,7 +6372,7 @@ var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
|
6374
6372
|
var React182 = __toESM(require("react"), 1);
|
|
6375
6373
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6376
6374
|
var React332 = __toESM(require("react"), 1);
|
|
6377
|
-
var
|
|
6375
|
+
var import_core23 = require("@unifold/core");
|
|
6378
6376
|
|
|
6379
6377
|
// ../../node_modules/.pnpm/mipd@0.0.7_typescript@5.9.3/node_modules/mipd/dist/esm/utils.js
|
|
6380
6378
|
function requestProviders(listener) {
|
|
@@ -6464,25 +6462,25 @@ var React342 = __toESM(require("react"), 1);
|
|
|
6464
6462
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6465
6463
|
var import_react27 = require("react");
|
|
6466
6464
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6467
|
-
var
|
|
6465
|
+
var import_core24 = require("@unifold/core");
|
|
6468
6466
|
var import_react28 = require("react");
|
|
6469
6467
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6470
6468
|
var import_react29 = require("react");
|
|
6469
|
+
var import_core25 = require("@unifold/core");
|
|
6470
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
6471
6471
|
var import_core26 = require("@unifold/core");
|
|
6472
6472
|
var import_react_query11 = require("@tanstack/react-query");
|
|
6473
6473
|
var import_core27 = require("@unifold/core");
|
|
6474
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6474
6475
|
var import_react_query12 = require("@tanstack/react-query");
|
|
6475
6476
|
var import_core28 = require("@unifold/core");
|
|
6476
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6477
6477
|
var import_react_query13 = require("@tanstack/react-query");
|
|
6478
6478
|
var import_core29 = require("@unifold/core");
|
|
6479
6479
|
var import_react_query14 = require("@tanstack/react-query");
|
|
6480
6480
|
var import_core30 = require("@unifold/core");
|
|
6481
|
-
var import_react_query15 = require("@tanstack/react-query");
|
|
6482
6481
|
var import_core31 = require("@unifold/core");
|
|
6483
|
-
var import_core32 = require("@unifold/core");
|
|
6484
6482
|
var import_react30 = require("react");
|
|
6485
|
-
var
|
|
6483
|
+
var import_core32 = require("@unifold/core");
|
|
6486
6484
|
|
|
6487
6485
|
// ../analytics/dist/index.mjs
|
|
6488
6486
|
var __defProp2 = Object.defineProperty;
|
|
@@ -6577,7 +6575,7 @@ function generateKSUID() {
|
|
|
6577
6575
|
function generatePrefixedKSUID(prefix) {
|
|
6578
6576
|
return `${prefix}_${generateKSUID()}`;
|
|
6579
6577
|
}
|
|
6580
|
-
var PACKAGE_VERSION = "0.1.
|
|
6578
|
+
var PACKAGE_VERSION = "0.1.79";
|
|
6581
6579
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
6582
6580
|
var DEFAULT_DEDUP_MS = 500;
|
|
6583
6581
|
var SESSION_PREFIX = "asess";
|
|
@@ -6667,8 +6665,12 @@ var EventTracker = class {
|
|
|
6667
6665
|
}
|
|
6668
6666
|
/**
|
|
6669
6667
|
* Associate subsequent events with an internal Unifold user.id
|
|
6670
|
-
* (`user_<ksuid>`). Pass `null` to clear.
|
|
6671
|
-
*
|
|
6668
|
+
* (`user_<ksuid>`). Pass `null` to clear.
|
|
6669
|
+
*
|
|
6670
|
+
* The tracker is shared across flows and outlives any one journey, so a
|
|
6671
|
+
* journey stamps its own user at the start — with the id if it already
|
|
6672
|
+
* knows one, `null` if it doesn't — rather than inheriting whatever the
|
|
6673
|
+
* previous journey left here.
|
|
6672
6674
|
*/
|
|
6673
6675
|
setUserId(userId) {
|
|
6674
6676
|
this.userId = userId || void 0;
|
|
@@ -6679,8 +6681,8 @@ var EventTracker = class {
|
|
|
6679
6681
|
* {@link EventTracker.endSession} carries it.
|
|
6680
6682
|
*
|
|
6681
6683
|
* Does not touch `userId`: the internal `user_<ksuid>` is attached separately
|
|
6682
|
-
* via {@link EventTracker.setUserId}
|
|
6683
|
-
*
|
|
6684
|
+
* via {@link EventTracker.setUserId}, and persists until the host replaces
|
|
6685
|
+
* it — which the SDK's modals do on every journey start.
|
|
6684
6686
|
*/
|
|
6685
6687
|
startSession() {
|
|
6686
6688
|
this.sessionId = generatePrefixedKSUID(SESSION_PREFIX);
|
|
@@ -6725,16 +6727,16 @@ function createEventTracker(config) {
|
|
|
6725
6727
|
}
|
|
6726
6728
|
|
|
6727
6729
|
// ../ui-react/dist/index.mjs
|
|
6730
|
+
var import_core33 = require("@unifold/core");
|
|
6728
6731
|
var import_core34 = require("@unifold/core");
|
|
6732
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
6729
6733
|
var import_core35 = require("@unifold/core");
|
|
6730
|
-
var import_react_query16 = require("@tanstack/react-query");
|
|
6731
|
-
var import_core36 = require("@unifold/core");
|
|
6732
6734
|
var import_react31 = require("react");
|
|
6733
6735
|
var import_react32 = require("react");
|
|
6734
6736
|
var React362 = __toESM(require("react"), 1);
|
|
6735
6737
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6736
6738
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6737
|
-
var
|
|
6739
|
+
var import_core36 = require("@unifold/core");
|
|
6738
6740
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6739
6741
|
var import_react33 = require("react");
|
|
6740
6742
|
|
|
@@ -11480,9 +11482,9 @@ var Content22 = TooltipContent;
|
|
|
11480
11482
|
|
|
11481
11483
|
// ../ui-react/dist/index.mjs
|
|
11482
11484
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11485
|
+
var import_core37 = require("@unifold/core");
|
|
11486
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
11483
11487
|
var import_core38 = require("@unifold/core");
|
|
11484
|
-
var import_react_query17 = require("@tanstack/react-query");
|
|
11485
|
-
var import_core39 = require("@unifold/core");
|
|
11486
11488
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11487
11489
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11488
11490
|
var import_react36 = require("react");
|
|
@@ -12722,15 +12724,15 @@ var Separator = SelectSeparator;
|
|
|
12722
12724
|
|
|
12723
12725
|
// ../ui-react/dist/index.mjs
|
|
12724
12726
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12725
|
-
var
|
|
12727
|
+
var import_core39 = require("@unifold/core");
|
|
12726
12728
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
12727
12729
|
var React39 = __toESM(require("react"), 1);
|
|
12730
|
+
var import_core40 = require("@unifold/core");
|
|
12728
12731
|
var import_core41 = require("@unifold/core");
|
|
12732
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
12729
12733
|
var import_core42 = require("@unifold/core");
|
|
12730
12734
|
var import_react_query18 = require("@tanstack/react-query");
|
|
12731
12735
|
var import_core43 = require("@unifold/core");
|
|
12732
|
-
var import_react_query19 = require("@tanstack/react-query");
|
|
12733
|
-
var import_core44 = require("@unifold/core");
|
|
12734
12736
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
12735
12737
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12736
12738
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
@@ -12745,41 +12747,40 @@ var React41 = __toESM(require("react"), 1);
|
|
|
12745
12747
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12746
12748
|
var import_react38 = require("react");
|
|
12747
12749
|
var import_react39 = require("react");
|
|
12750
|
+
var import_core44 = require("@unifold/core");
|
|
12751
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
12748
12752
|
var import_core45 = require("@unifold/core");
|
|
12749
|
-
var import_react_query20 = require("@tanstack/react-query");
|
|
12750
12753
|
var import_core46 = require("@unifold/core");
|
|
12751
|
-
var import_core47 = require("@unifold/core");
|
|
12752
12754
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12753
12755
|
var import_react40 = require("react");
|
|
12756
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
12757
|
+
var import_core47 = require("@unifold/core");
|
|
12754
12758
|
var import_react_query21 = require("@tanstack/react-query");
|
|
12755
12759
|
var import_core48 = require("@unifold/core");
|
|
12756
12760
|
var import_react_query22 = require("@tanstack/react-query");
|
|
12757
12761
|
var import_core49 = require("@unifold/core");
|
|
12758
12762
|
var import_react_query23 = require("@tanstack/react-query");
|
|
12759
12763
|
var import_core50 = require("@unifold/core");
|
|
12760
|
-
var import_react_query24 = require("@tanstack/react-query");
|
|
12761
|
-
var import_core51 = require("@unifold/core");
|
|
12762
12764
|
var import_react41 = require("react");
|
|
12763
|
-
var
|
|
12765
|
+
var import_core51 = require("@unifold/core");
|
|
12764
12766
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12765
12767
|
var import_react42 = require("react");
|
|
12768
|
+
var import_core52 = require("@unifold/core");
|
|
12769
|
+
var import_react_query24 = require("@tanstack/react-query");
|
|
12766
12770
|
var import_core53 = require("@unifold/core");
|
|
12767
|
-
var import_react_query25 = require("@tanstack/react-query");
|
|
12768
12771
|
var import_core54 = require("@unifold/core");
|
|
12769
|
-
var import_core55 = require("@unifold/core");
|
|
12770
12772
|
var import_react43 = require("react");
|
|
12773
|
+
var import_core55 = require("@unifold/core");
|
|
12774
|
+
var import_react_query25 = require("@tanstack/react-query");
|
|
12771
12775
|
var import_core56 = require("@unifold/core");
|
|
12772
|
-
var import_react44 = require("react");
|
|
12773
|
-
var import_react_query26 = require("@tanstack/react-query");
|
|
12774
|
-
var import_core57 = require("@unifold/core");
|
|
12775
12776
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12776
|
-
var
|
|
12777
|
+
var import_core57 = require("@unifold/core");
|
|
12777
12778
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12778
|
-
var
|
|
12779
|
+
var import_react44 = require("react");
|
|
12779
12780
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12780
|
-
var
|
|
12781
|
+
var import_core58 = require("@unifold/core");
|
|
12781
12782
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12782
|
-
var
|
|
12783
|
+
var import_react45 = require("react");
|
|
12783
12784
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
12784
12785
|
var en_default = {
|
|
12785
12786
|
common: {
|
|
@@ -13179,6 +13180,9 @@ var en_default = {
|
|
|
13179
13180
|
transactionBreakdown: "Transaction breakdown",
|
|
13180
13181
|
networkFee: "Network fee",
|
|
13181
13182
|
confirmOrder: "Confirm Order",
|
|
13183
|
+
mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
|
|
13184
|
+
mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
|
|
13185
|
+
mfaEnrollmentSettingsLink: "Open Coinbase security settings",
|
|
13182
13186
|
termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
|
|
13183
13187
|
termsNoticeLink: "terms",
|
|
13184
13188
|
termsNoticeSuffix: "."
|
|
@@ -13309,7 +13313,12 @@ var en_default = {
|
|
|
13309
13313
|
prefix: "By continuing, you agree to Coinbase's ",
|
|
13310
13314
|
separator: ", ",
|
|
13311
13315
|
lastSeparator: ", and ",
|
|
13312
|
-
suffix: ".
|
|
13316
|
+
suffix: ".",
|
|
13317
|
+
agreements: {
|
|
13318
|
+
guest_checkout_terms: "Terms of Service",
|
|
13319
|
+
user_agreement: "User Agreement",
|
|
13320
|
+
privacy_policy: "Privacy Policy"
|
|
13321
|
+
}
|
|
13313
13322
|
},
|
|
13314
13323
|
errors: {
|
|
13315
13324
|
rateLimited: "Too many attempts. Please wait a few minutes and try again.",
|
|
@@ -13968,6 +13977,9 @@ var zh_default = {
|
|
|
13968
13977
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
|
|
13969
13978
|
networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
|
|
13970
13979
|
confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
|
|
13980
|
+
mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
|
|
13981
|
+
mfaEnrollmentMessage: "\u8BF7\u786E\u8BA4\u60A8\u5DF2\u5728 Coinbase \u8D26\u6237\u4E2D\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1\u3002\u542F\u7528\u540E\u8BF7\u6309\u7EE7\u7EED\u3002",
|
|
13982
|
+
mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
|
|
13971
13983
|
termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
|
|
13972
13984
|
termsNoticeLink: "\u6761\u6B3E",
|
|
13973
13985
|
termsNoticeSuffix: "\u3002"
|
|
@@ -14098,7 +14110,12 @@ var zh_default = {
|
|
|
14098
14110
|
prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
14099
14111
|
separator: "\u3001",
|
|
14100
14112
|
lastSeparator: "\u548C",
|
|
14101
|
-
suffix: "\
|
|
14113
|
+
suffix: "\u3002",
|
|
14114
|
+
agreements: {
|
|
14115
|
+
guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
|
|
14116
|
+
user_agreement: "\u7528\u6237\u534F\u8BAE",
|
|
14117
|
+
privacy_policy: "\u9690\u79C1\u653F\u7B56"
|
|
14118
|
+
}
|
|
14102
14119
|
},
|
|
14103
14120
|
errors: {
|
|
14104
14121
|
rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
|
|
@@ -14757,6 +14774,9 @@ var zh_TW_default = {
|
|
|
14757
14774
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
|
|
14758
14775
|
networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
|
|
14759
14776
|
confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
|
|
14777
|
+
mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
|
|
14778
|
+
mfaEnrollmentMessage: "\u8ACB\u78BA\u8A8D\u60A8\u5DF2\u5728 Coinbase \u5E33\u6236\u4E2D\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49\u3002\u555F\u7528\u5F8C\u8ACB\u6309\u7E7C\u7E8C\u3002",
|
|
14779
|
+
mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
|
|
14760
14780
|
termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
|
|
14761
14781
|
termsNoticeLink: "\u689D\u6B3E",
|
|
14762
14782
|
termsNoticeSuffix: "\u3002"
|
|
@@ -14887,7 +14907,12 @@ var zh_TW_default = {
|
|
|
14887
14907
|
prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
14888
14908
|
separator: "\u3001",
|
|
14889
14909
|
lastSeparator: "\u548C",
|
|
14890
|
-
suffix: "\
|
|
14910
|
+
suffix: "\u3002",
|
|
14911
|
+
agreements: {
|
|
14912
|
+
guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
|
|
14913
|
+
user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
|
|
14914
|
+
privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
|
|
14915
|
+
}
|
|
14891
14916
|
},
|
|
14892
14917
|
errors: {
|
|
14893
14918
|
rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
|
|
@@ -15803,6 +15828,13 @@ function useAnalytics() {
|
|
|
15803
15828
|
);
|
|
15804
15829
|
return { track, startSession, endSession, getSessionId, setUserId, subscribe };
|
|
15805
15830
|
}
|
|
15831
|
+
function useStampInternalUserId({ internalUserId }) {
|
|
15832
|
+
const { setUserId } = useAnalytics();
|
|
15833
|
+
(0, import_react9.useEffect)(() => {
|
|
15834
|
+
if (!internalUserId) return;
|
|
15835
|
+
setUserId(internalUserId);
|
|
15836
|
+
}, [internalUserId, setUserId]);
|
|
15837
|
+
}
|
|
15806
15838
|
function useDepositAddress(params) {
|
|
15807
15839
|
const {
|
|
15808
15840
|
userId,
|
|
@@ -15815,7 +15847,6 @@ function useDepositAddress(params) {
|
|
|
15815
15847
|
contractCalls,
|
|
15816
15848
|
enabled = true
|
|
15817
15849
|
} = params;
|
|
15818
|
-
const { setUserId } = useAnalytics();
|
|
15819
15850
|
const query = (0, import_react_query2.useQuery)({
|
|
15820
15851
|
queryKey: [
|
|
15821
15852
|
"unifold",
|
|
@@ -15858,11 +15889,7 @@ function useDepositAddress(params) {
|
|
|
15858
15889
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
|
|
15859
15890
|
// 1s, 2s, 4s (max 10s)
|
|
15860
15891
|
});
|
|
15861
|
-
(
|
|
15862
|
-
if (query.data?.user_id) {
|
|
15863
|
-
setUserId(query.data.user_id);
|
|
15864
|
-
}
|
|
15865
|
-
}, [query.data?.user_id, setUserId]);
|
|
15892
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
15866
15893
|
return query;
|
|
15867
15894
|
}
|
|
15868
15895
|
function useDebounce(value, delay) {
|
|
@@ -18085,7 +18112,11 @@ function BuyWithCard({
|
|
|
18085
18112
|
method: "card",
|
|
18086
18113
|
flow_type: "deposit",
|
|
18087
18114
|
provider: selectedProvider.service_provider,
|
|
18088
|
-
amount_usd: amount
|
|
18115
|
+
amount_usd: amount,
|
|
18116
|
+
// The execution only exists once the provider's payout lands on this
|
|
18117
|
+
// wallet, and it carries this id — so it's the join key for a purchase
|
|
18118
|
+
// that starts here and never reaches flow_completed.
|
|
18119
|
+
deposit_wallet_id: depositWalletId
|
|
18089
18120
|
});
|
|
18090
18121
|
onEvent?.({
|
|
18091
18122
|
id: (0, import_core2.generatePrefixedKSUID)("sevt"),
|
|
@@ -19522,6 +19553,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19522
19553
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react17.useState)(null);
|
|
19523
19554
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react17.useState)(false);
|
|
19524
19555
|
const upgradeFlowAbortRef = (0, import_react17.useRef)(null);
|
|
19556
|
+
const applyLimitRoutingRef = (0, import_react17.useRef)(() => {
|
|
19557
|
+
});
|
|
19525
19558
|
const [amount, setAmount] = (0, import_react17.useState)(amountUsd ?? "");
|
|
19526
19559
|
const [preparedOrder, setPreparedOrder] = (0, import_react17.useState)(null);
|
|
19527
19560
|
const sessionAbortRef = (0, import_react17.useRef)(null);
|
|
@@ -19656,6 +19689,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19656
19689
|
},
|
|
19657
19690
|
[email, normalizedPhone, userId]
|
|
19658
19691
|
);
|
|
19692
|
+
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
19693
|
+
userId,
|
|
19694
|
+
publishableKey,
|
|
19695
|
+
normalizedPhone,
|
|
19696
|
+
userEmail,
|
|
19697
|
+
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
19698
|
+
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
19699
|
+
});
|
|
19659
19700
|
const createSessionAndSendOtp = (0, import_react17.useCallback)(async () => {
|
|
19660
19701
|
setView("submitting_session");
|
|
19661
19702
|
setErrorMessage("");
|
|
@@ -19665,7 +19706,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19665
19706
|
email,
|
|
19666
19707
|
phone: normalizedPhone,
|
|
19667
19708
|
terms_accepted: true,
|
|
19668
|
-
|
|
19709
|
+
// TODO: when the API honors `false`, this will trigger email OTP.
|
|
19710
|
+
// Today `false` still skips email (we don't verify it) and JWT ev
|
|
19711
|
+
// is null. Don't send `true` — that was a fake attest.
|
|
19712
|
+
email_already_verified: false
|
|
19713
|
+
// Coinbase stays Redis-only + JWT until bank-transfer identity
|
|
19714
|
+
// is live. Do not persist from this path yet.
|
|
19669
19715
|
},
|
|
19670
19716
|
publishableKey
|
|
19671
19717
|
);
|
|
@@ -19675,6 +19721,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19675
19721
|
}
|
|
19676
19722
|
setClientSecret(session.client_secret);
|
|
19677
19723
|
storeWalletPaySession();
|
|
19724
|
+
if (session.status === "verified") {
|
|
19725
|
+
const tokenRes = await (0, import_core11.exchangeOnrampVerificationToken)(
|
|
19726
|
+
session.id,
|
|
19727
|
+
session.client_secret,
|
|
19728
|
+
publishableKey
|
|
19729
|
+
);
|
|
19730
|
+
setOnrampToken(tokenRes);
|
|
19731
|
+
storeWalletPaySession({
|
|
19732
|
+
emailVerifiedAt: session.email.verified_at,
|
|
19733
|
+
phoneVerifiedAt: session.phone.verified_at,
|
|
19734
|
+
onrampToken: tokenRes.token,
|
|
19735
|
+
onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
|
|
19736
|
+
});
|
|
19737
|
+
if (amountUsd) setAmount(amountUsd);
|
|
19738
|
+
try {
|
|
19739
|
+
const result = await refetchWalletPayLimits();
|
|
19740
|
+
if (result.data) {
|
|
19741
|
+
const nextView = getViewForLimitStatus(result.data);
|
|
19742
|
+
if (nextView) {
|
|
19743
|
+
applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
|
|
19744
|
+
return;
|
|
19745
|
+
}
|
|
19746
|
+
}
|
|
19747
|
+
} catch {
|
|
19748
|
+
}
|
|
19749
|
+
setView("amount");
|
|
19750
|
+
return;
|
|
19751
|
+
}
|
|
19678
19752
|
await (0, import_core11.sendOnrampVerificationOtp)(session.id, "phone", session.client_secret, publishableKey);
|
|
19679
19753
|
setResendCooldown(30);
|
|
19680
19754
|
setView("phone_otp");
|
|
@@ -19683,19 +19757,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19683
19757
|
setErrorMessage(prettifyVerificationError(raw));
|
|
19684
19758
|
setView("phone_input");
|
|
19685
19759
|
}
|
|
19686
|
-
}, [
|
|
19760
|
+
}, [
|
|
19761
|
+
email,
|
|
19762
|
+
normalizedPhone,
|
|
19763
|
+
publishableKey,
|
|
19764
|
+
storeWalletPaySession,
|
|
19765
|
+
userId,
|
|
19766
|
+
amountUsd,
|
|
19767
|
+
refetchWalletPayLimits
|
|
19768
|
+
]);
|
|
19687
19769
|
const clearUpgradeFields = (0, import_react17.useCallback)(() => {
|
|
19688
19770
|
setSsnLast4("");
|
|
19689
19771
|
setDobInput("");
|
|
19690
19772
|
}, []);
|
|
19691
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
19692
|
-
userId,
|
|
19693
|
-
publishableKey,
|
|
19694
|
-
normalizedPhone,
|
|
19695
|
-
userEmail,
|
|
19696
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
19697
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
19698
|
-
});
|
|
19699
19773
|
const pollLimitUpgradeStatus = (0, import_react17.useCallback)(
|
|
19700
19774
|
async (signal) => {
|
|
19701
19775
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -19806,6 +19880,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19806
19880
|
},
|
|
19807
19881
|
[startUpgradePolling]
|
|
19808
19882
|
);
|
|
19883
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
19809
19884
|
const hasInitializedRef = (0, import_react17.useRef)(false);
|
|
19810
19885
|
(0, import_react17.useEffect)(() => {
|
|
19811
19886
|
if (hasInitializedRef.current) return;
|
|
@@ -20035,7 +20110,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
20035
20110
|
track("flow_started", {
|
|
20036
20111
|
method,
|
|
20037
20112
|
flow_type: "deposit",
|
|
20038
|
-
amount_usd: walletPayAmountUsd
|
|
20113
|
+
amount_usd: walletPayAmountUsd,
|
|
20114
|
+
// No execution yet — one appears when the payout lands on this
|
|
20115
|
+
// wallet, carrying the same id.
|
|
20116
|
+
deposit_wallet_id: depositWalletId
|
|
20039
20117
|
});
|
|
20040
20118
|
onEvent?.({
|
|
20041
20119
|
id: (0, import_core11.generatePrefixedKSUID)("sevt"),
|
|
@@ -20085,6 +20163,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
20085
20163
|
defaultTokenLoading,
|
|
20086
20164
|
defaultTokenError,
|
|
20087
20165
|
depositWallet?.address,
|
|
20166
|
+
depositWalletId,
|
|
20088
20167
|
userEmail,
|
|
20089
20168
|
publishableKey,
|
|
20090
20169
|
onEvent,
|
|
@@ -21059,7 +21138,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
21059
21138
|
{
|
|
21060
21139
|
key: "guest_checkout_terms",
|
|
21061
21140
|
name: "Guest Checkout Terms of Service",
|
|
21062
|
-
url: "https://www.coinbase.com/legal/
|
|
21141
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
21063
21142
|
},
|
|
21064
21143
|
{
|
|
21065
21144
|
key: "user_agreement",
|
|
@@ -21079,22 +21158,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
21079
21158
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
21080
21159
|
"div",
|
|
21081
21160
|
{
|
|
21082
|
-
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
|
|
21161
|
+
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
|
|
21083
21162
|
"aria-hidden": true,
|
|
21084
21163
|
"aria-busy": "true",
|
|
21085
21164
|
children: [
|
|
21086
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21087
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21088
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21165
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
|
|
21166
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
|
|
21167
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
|
|
21089
21168
|
]
|
|
21090
21169
|
}
|
|
21091
21170
|
);
|
|
21092
21171
|
}
|
|
21093
21172
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
21173
|
+
const shortLabels = t.agreements;
|
|
21174
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
21094
21175
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
21095
21176
|
"p",
|
|
21096
21177
|
{
|
|
21097
|
-
className: "uf-text-[
|
|
21178
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
21098
21179
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
21099
21180
|
children: [
|
|
21100
21181
|
t.prefix,
|
|
@@ -21105,12 +21186,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
21105
21186
|
href: a.url,
|
|
21106
21187
|
target: "_blank",
|
|
21107
21188
|
rel: "noopener noreferrer",
|
|
21108
|
-
className: "uf-underline",
|
|
21109
|
-
style: { color:
|
|
21110
|
-
children: a.name
|
|
21189
|
+
className: "uf-no-underline",
|
|
21190
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
21191
|
+
children: shortLabels[a.key] ?? a.name
|
|
21111
21192
|
}
|
|
21112
21193
|
),
|
|
21113
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
21194
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
21114
21195
|
] }, a.key)),
|
|
21115
21196
|
t.suffix
|
|
21116
21197
|
]
|
|
@@ -21732,16 +21813,6 @@ function PayWithExchange({
|
|
|
21732
21813
|
}
|
|
21733
21814
|
);
|
|
21734
21815
|
}
|
|
21735
|
-
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
21736
|
-
return (0, import_react_query9.useQuery)({
|
|
21737
|
-
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
21738
|
-
queryFn: () => (0, import_core20.getCashAppLimits)(currency, publishableKey),
|
|
21739
|
-
enabled: !!publishableKey,
|
|
21740
|
-
staleTime: 2 * 60 * 6e4,
|
|
21741
|
-
gcTime: 4 * 60 * 6e4,
|
|
21742
|
-
retry: 2
|
|
21743
|
-
});
|
|
21744
|
-
}
|
|
21745
21816
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
21746
21817
|
var FALLBACK_MIN_USD = 5;
|
|
21747
21818
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
@@ -21753,6 +21824,7 @@ function PayWithCashApp({
|
|
|
21753
21824
|
destinationChainType,
|
|
21754
21825
|
destinationChainId,
|
|
21755
21826
|
destinationTokenAddress,
|
|
21827
|
+
contractCalls,
|
|
21756
21828
|
cashAppIconUrl,
|
|
21757
21829
|
view: controlledView,
|
|
21758
21830
|
onViewChange,
|
|
@@ -21776,9 +21848,11 @@ function PayWithCashApp({
|
|
|
21776
21848
|
const b = parseInt(bg.slice(4, 6), 16);
|
|
21777
21849
|
return (r2 * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
21778
21850
|
})();
|
|
21779
|
-
const { data:
|
|
21780
|
-
|
|
21781
|
-
|
|
21851
|
+
const { data: fiatCurrencies, isLoading: limitsLoading } = useFiatCurrencies({
|
|
21852
|
+
publishableKey
|
|
21853
|
+
});
|
|
21854
|
+
const minUsd = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === "usd")?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
21855
|
+
const quickAmounts = SUGGESTED_AMOUNTS.filter((value) => value >= minUsd);
|
|
21782
21856
|
const [amount, setAmount] = (0, import_react25.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
21783
21857
|
const [loading, setLoading] = (0, import_react25.useState)(false);
|
|
21784
21858
|
const [session, setSession] = (0, import_react25.useState)(null);
|
|
@@ -21833,6 +21907,8 @@ function PayWithCashApp({
|
|
|
21833
21907
|
setError(strings.depositModal.cashAppErrors.missingFields);
|
|
21834
21908
|
return;
|
|
21835
21909
|
}
|
|
21910
|
+
const amountNum2 = parseFloat(amount);
|
|
21911
|
+
if (isNaN(amountNum2) || amountNum2 < minUsd) return;
|
|
21836
21912
|
setLoading(true);
|
|
21837
21913
|
setError(null);
|
|
21838
21914
|
try {
|
|
@@ -21845,7 +21921,8 @@ function PayWithCashApp({
|
|
|
21845
21921
|
destination_token_address: destinationTokenAddress,
|
|
21846
21922
|
recipient_address: recipientAddress,
|
|
21847
21923
|
source_amount: amount,
|
|
21848
|
-
external_id: externalId
|
|
21924
|
+
external_id: externalId,
|
|
21925
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
21849
21926
|
},
|
|
21850
21927
|
publishableKey
|
|
21851
21928
|
);
|
|
@@ -21858,7 +21935,10 @@ function PayWithCashApp({
|
|
|
21858
21935
|
track("flow_started", {
|
|
21859
21936
|
method: "cashapp",
|
|
21860
21937
|
flow_type: "deposit",
|
|
21861
|
-
amount_usd: amount
|
|
21938
|
+
amount_usd: amount,
|
|
21939
|
+
// No execution yet — one appears when the payout lands on this
|
|
21940
|
+
// wallet, carrying the same id.
|
|
21941
|
+
deposit_wallet_id: depositWalletId
|
|
21862
21942
|
});
|
|
21863
21943
|
onEvent?.({
|
|
21864
21944
|
id: (0, import_core19.generatePrefixedKSUID)("sevt"),
|
|
@@ -21877,12 +21957,15 @@ function PayWithCashApp({
|
|
|
21877
21957
|
}
|
|
21878
21958
|
}, [
|
|
21879
21959
|
amount,
|
|
21960
|
+
minUsd,
|
|
21880
21961
|
userId,
|
|
21881
21962
|
publishableKey,
|
|
21882
21963
|
recipientAddress,
|
|
21883
21964
|
destinationChainType,
|
|
21884
21965
|
destinationChainId,
|
|
21885
21966
|
destinationTokenAddress,
|
|
21967
|
+
contractCalls,
|
|
21968
|
+
depositWalletId,
|
|
21886
21969
|
onEvent,
|
|
21887
21970
|
onDepositError,
|
|
21888
21971
|
track,
|
|
@@ -21978,8 +22061,7 @@ function PayWithCashApp({
|
|
|
21978
22061
|
const amountNum = parseFloat(amount);
|
|
21979
22062
|
const hasInput = !isNaN(amountNum) && amountNum > 0;
|
|
21980
22063
|
const belowMin = hasInput && amountNum < minUsd;
|
|
21981
|
-
const
|
|
21982
|
-
const isValidAmount = hasInput && !belowMin && !aboveMax;
|
|
22064
|
+
const isValidAmount = hasInput && !belowMin;
|
|
21983
22065
|
if (view === "amount") {
|
|
21984
22066
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
21985
22067
|
"div",
|
|
@@ -22008,7 +22090,7 @@ function PayWithCashApp({
|
|
|
22008
22090
|
}
|
|
22009
22091
|
}
|
|
22010
22092
|
) }) }),
|
|
22011
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children:
|
|
22093
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children: quickAmounts.map((quickAmount) => {
|
|
22012
22094
|
const isSelected = parseFloat(amount) === quickAmount;
|
|
22013
22095
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
22014
22096
|
"button",
|
|
@@ -22034,23 +22116,17 @@ function PayWithCashApp({
|
|
|
22034
22116
|
quickAmount
|
|
22035
22117
|
);
|
|
22036
22118
|
}) }),
|
|
22037
|
-
|
|
22038
|
-
"div",
|
|
22039
|
-
{
|
|
22040
|
-
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
22041
|
-
style: { color: colors2.error, fontFamily: fonts.regular },
|
|
22042
|
-
children: interpolate(strings.common.minimumAmount, { amount: `$${minUsd}` })
|
|
22043
|
-
}
|
|
22044
|
-
) : amount && maxUsd !== null && amountNum > maxUsd && !error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22119
|
+
!limitsLoading && minUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22045
22120
|
"div",
|
|
22046
22121
|
{
|
|
22047
|
-
className: "uf-text-
|
|
22048
|
-
style: { color: colors2.
|
|
22049
|
-
children: interpolate(strings.common.
|
|
22050
|
-
amount: `$${
|
|
22122
|
+
className: "uf-text-center uf-text-xs uf-mt-4",
|
|
22123
|
+
style: { color: colors2.warning, fontFamily: fonts.regular },
|
|
22124
|
+
children: interpolate(strings.common.minimumDeposit, {
|
|
22125
|
+
amount: `$${minUsd.toFixed(2)}`
|
|
22051
22126
|
})
|
|
22052
22127
|
}
|
|
22053
|
-
)
|
|
22128
|
+
),
|
|
22129
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22054
22130
|
"div",
|
|
22055
22131
|
{
|
|
22056
22132
|
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
@@ -22059,7 +22135,7 @@ function PayWithCashApp({
|
|
|
22059
22135
|
}
|
|
22060
22136
|
) : null
|
|
22061
22137
|
] }),
|
|
22062
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-px-1", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22138
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-px-1 uf-mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22063
22139
|
"button",
|
|
22064
22140
|
{
|
|
22065
22141
|
onClick: handleCreateSession,
|
|
@@ -22280,9 +22356,9 @@ function useBankTransferProviders({
|
|
|
22280
22356
|
countryCode
|
|
22281
22357
|
}) {
|
|
22282
22358
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
22283
|
-
const { data: providers, isLoading } = (0,
|
|
22359
|
+
const { data: providers, isLoading } = (0, import_react_query9.useQuery)({
|
|
22284
22360
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
22285
|
-
queryFn: () => (0,
|
|
22361
|
+
queryFn: () => (0, import_core21.getBankTransferProviders)(publishableKey, { countryCode: normalizedCountry }),
|
|
22286
22362
|
enabled,
|
|
22287
22363
|
staleTime: 1e3 * 60 * 30,
|
|
22288
22364
|
refetchOnMount: true,
|
|
@@ -22362,7 +22438,7 @@ function BankTransfer({
|
|
|
22362
22438
|
const providers = providersResponse?.data ?? [];
|
|
22363
22439
|
const pollingWalletId = (0, import_react26.useMemo)(() => {
|
|
22364
22440
|
if (!defaultToken) return void 0;
|
|
22365
|
-
return (0,
|
|
22441
|
+
return (0, import_core20.getWalletByChainType)(
|
|
22366
22442
|
wallets,
|
|
22367
22443
|
defaultToken.destination_token_metadata.chain_type
|
|
22368
22444
|
)?.id;
|
|
@@ -22395,7 +22471,7 @@ function BankTransfer({
|
|
|
22395
22471
|
let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
|
|
22396
22472
|
if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
|
|
22397
22473
|
try {
|
|
22398
|
-
const response = await (0,
|
|
22474
|
+
const response = await (0, import_core20.getFiatExchangeRates)({}, publishableKey);
|
|
22399
22475
|
if (response?.rates) {
|
|
22400
22476
|
setFiatExchangeRates((prev) => ({
|
|
22401
22477
|
...prev,
|
|
@@ -22428,7 +22504,7 @@ function BankTransfer({
|
|
|
22428
22504
|
setSessionError(strings.buyWithCard.errors.destinationTokenUnresolved);
|
|
22429
22505
|
return;
|
|
22430
22506
|
}
|
|
22431
|
-
const wallet = (0,
|
|
22507
|
+
const wallet = (0, import_core20.getWalletByChainType)(
|
|
22432
22508
|
wallets,
|
|
22433
22509
|
defaultToken.destination_token_metadata.chain_type
|
|
22434
22510
|
);
|
|
@@ -22477,18 +22553,21 @@ function BankTransfer({
|
|
|
22477
22553
|
setView("pending");
|
|
22478
22554
|
};
|
|
22479
22555
|
const openSession = (request) => {
|
|
22480
|
-
const externalId = (0,
|
|
22556
|
+
const externalId = (0, import_core20.generatePrefixedKSUID)("orsext");
|
|
22481
22557
|
const requestWithId = { ...request, external_id: externalId };
|
|
22482
|
-
const sessionStartUrl = (0,
|
|
22558
|
+
const sessionStartUrl = (0, import_core20.getOnrampSessionStartUrl)(requestWithId, publishableKey);
|
|
22483
22559
|
track("flow_started", {
|
|
22484
22560
|
method: "bank_transfer",
|
|
22485
22561
|
flow_type: "deposit",
|
|
22486
22562
|
provider: request.service_provider,
|
|
22487
|
-
amount_usd: request.source_amount
|
|
22563
|
+
amount_usd: request.source_amount,
|
|
22564
|
+
// No execution yet — one appears when the provider's payout lands on
|
|
22565
|
+
// this wallet, carrying the same id.
|
|
22566
|
+
deposit_wallet_id: pollingWalletId
|
|
22488
22567
|
});
|
|
22489
22568
|
onEvent?.({
|
|
22490
|
-
id: (0,
|
|
22491
|
-
type:
|
|
22569
|
+
id: (0, import_core20.generatePrefixedKSUID)("sevt"),
|
|
22570
|
+
type: import_core20.DepositEventType.ONRAMP_SESSION_CREATED,
|
|
22492
22571
|
created: Math.floor(Date.now() / 1e3),
|
|
22493
22572
|
sessionId: getSessionId() ?? "",
|
|
22494
22573
|
method: "bank_transfer",
|
|
@@ -22502,7 +22581,7 @@ function BankTransfer({
|
|
|
22502
22581
|
};
|
|
22503
22582
|
const offerable = providers.filter((provider) => provider.enabled);
|
|
22504
22583
|
const noEnabledProviders = providers.length > 0 && offerable.length === 0;
|
|
22505
|
-
const sourceCurrencyIcon = assetCdnUrl ? (0,
|
|
22584
|
+
const sourceCurrencyIcon = assetCdnUrl ? (0, import_core20.getIconUrlWithCdn)(`/icons/currencies/png/${sourceCurrency}.png`, assetCdnUrl) : void 0;
|
|
22506
22585
|
const onrampTokenIcon = defaultToken?.destination_token_metadata?.icon_url;
|
|
22507
22586
|
const onrampChainIcon = defaultToken?.destination_token_metadata?.chain?.icon_url;
|
|
22508
22587
|
const onrampTokenSymbol = defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? "USDC";
|
|
@@ -22963,7 +23042,7 @@ function BankTransfer({
|
|
|
22963
23042
|
function DepositExecutionItem({ execution, onClick }) {
|
|
22964
23043
|
const { colors: colors2, fonts, components } = useTheme();
|
|
22965
23044
|
const { t: strings, locale } = useI18n();
|
|
22966
|
-
const isPending = execution.status ===
|
|
23045
|
+
const isPending = execution.status === import_core22.ExecutionStatus.PENDING || execution.status === import_core22.ExecutionStatus.WAITING || execution.status === import_core22.ExecutionStatus.DELAYED;
|
|
22967
23046
|
const formatDateTime = (timestamp) => {
|
|
22968
23047
|
try {
|
|
22969
23048
|
const date = new Date(timestamp);
|
|
@@ -23010,7 +23089,7 @@ function DepositExecutionItem({ execution, onClick }) {
|
|
|
23010
23089
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
23011
23090
|
"img",
|
|
23012
23091
|
{
|
|
23013
|
-
src: execution.destination_token_metadata?.icon_url || (0,
|
|
23092
|
+
src: execution.destination_token_metadata?.icon_url || (0, import_core22.getIconUrl)("/icons/tokens/svg/usdc.svg"),
|
|
23014
23093
|
alt: "Token",
|
|
23015
23094
|
width: 36,
|
|
23016
23095
|
height: 36,
|
|
@@ -26379,7 +26458,7 @@ function BrowserWalletButton({
|
|
|
26379
26458
|
let cancelled = false;
|
|
26380
26459
|
const walletChainType = wallet.type === "phantom-solana" || wallet.type === "solflare" || wallet.type === "backpack" || wallet.type === "glow" ? "solana" : "ethereum";
|
|
26381
26460
|
setIsLoadingBalance(true);
|
|
26382
|
-
(0,
|
|
26461
|
+
(0, import_core23.getAddressBalances)(wallet.address, walletChainType, publishableKey).then((response) => {
|
|
26383
26462
|
if (cancelled) return;
|
|
26384
26463
|
if (response.balances && response.balances.length > 0) {
|
|
26385
26464
|
const totalUsd = response.balances.reduce((sum, balance) => {
|
|
@@ -27083,7 +27162,7 @@ var STRIPE_SESSION_STATUS = {
|
|
|
27083
27162
|
var STRIPE_SESSION_POLL_INTERVAL_MS = 3e3;
|
|
27084
27163
|
var STRIPE_CONSUMED_PAYMENT_METHOD_CODE = "payment_method_unexpected_state";
|
|
27085
27164
|
function isConsumedPaymentMethodError(err) {
|
|
27086
|
-
return err instanceof
|
|
27165
|
+
return err instanceof import_core24.StripeApiResponseError && (err.errorType === "stripe_onramp_payment_method_consumed" || err.stripeCode === STRIPE_CONSUMED_PAYMENT_METHOD_CODE);
|
|
27087
27166
|
}
|
|
27088
27167
|
function describeStripePaymentFailure(reason) {
|
|
27089
27168
|
if (!reason) return null;
|
|
@@ -27241,7 +27320,7 @@ function PayWithStripeLink({
|
|
|
27241
27320
|
let active = true;
|
|
27242
27321
|
const fetchConfig = async () => {
|
|
27243
27322
|
try {
|
|
27244
|
-
const cfg = await (0,
|
|
27323
|
+
const cfg = await (0, import_core24.stripeGetConfig)(publishableKey);
|
|
27245
27324
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
27246
27325
|
else if (active) {
|
|
27247
27326
|
console.error("[PayWithStripeLink] Config response missing publishable_key");
|
|
@@ -27263,7 +27342,7 @@ function PayWithStripeLink({
|
|
|
27263
27342
|
let active = true;
|
|
27264
27343
|
const retryConfig = async () => {
|
|
27265
27344
|
try {
|
|
27266
|
-
const cfg = await (0,
|
|
27345
|
+
const cfg = await (0, import_core24.stripeGetConfig)(publishableKey);
|
|
27267
27346
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
27268
27347
|
} catch (err) {
|
|
27269
27348
|
const msg = err instanceof Error ? err.message : t.formErrors.configLoadFailed;
|
|
@@ -27329,7 +27408,7 @@ function PayWithStripeLink({
|
|
|
27329
27408
|
if (!rt) return null;
|
|
27330
27409
|
const doRefresh = async () => {
|
|
27331
27410
|
try {
|
|
27332
|
-
const res = await (0,
|
|
27411
|
+
const res = await (0, import_core24.stripeRefreshToken)(rt, publishableKey);
|
|
27333
27412
|
const newToken = res.access_token;
|
|
27334
27413
|
const newRefresh = extractRefreshToken(res) || rt;
|
|
27335
27414
|
setOauthToken(newToken);
|
|
@@ -27363,7 +27442,7 @@ function PayWithStripeLink({
|
|
|
27363
27442
|
try {
|
|
27364
27443
|
return await fn(token);
|
|
27365
27444
|
} catch (err) {
|
|
27366
|
-
const is403 = err instanceof
|
|
27445
|
+
const is403 = err instanceof import_core24.StripeApiResponseError && err.statusCode === 403 || err instanceof Error && (err.message.includes("403") || err.message.toLowerCase().includes("forbidden"));
|
|
27367
27446
|
if (is403) {
|
|
27368
27447
|
if (!refreshTokenRef.current) {
|
|
27369
27448
|
setStep("email");
|
|
@@ -27398,7 +27477,7 @@ function PayWithStripeLink({
|
|
|
27398
27477
|
return;
|
|
27399
27478
|
}
|
|
27400
27479
|
try {
|
|
27401
|
-
const res = await (0,
|
|
27480
|
+
const res = await (0, import_core24.stripeRefreshToken)(stored.refreshToken, publishableKey);
|
|
27402
27481
|
if (cancelled) return;
|
|
27403
27482
|
token = res.access_token;
|
|
27404
27483
|
refresh = extractRefreshToken(res) || stored.refreshToken;
|
|
@@ -27421,7 +27500,7 @@ function PayWithStripeLink({
|
|
|
27421
27500
|
refreshTokenRef.current = refresh;
|
|
27422
27501
|
if (stored.email) setEmail(stored.email);
|
|
27423
27502
|
try {
|
|
27424
|
-
const cust = await (0,
|
|
27503
|
+
const cust = await (0, import_core24.stripeGetCustomer)(stored.customerId, token, publishableKey);
|
|
27425
27504
|
if (cancelled) return;
|
|
27426
27505
|
setCustomer(cust);
|
|
27427
27506
|
const tiers = cust.kyc_tiers ?? [];
|
|
@@ -27430,7 +27509,7 @@ function PayWithStripeLink({
|
|
|
27430
27509
|
const hasPending = ["l0", "l1", "l2"].some((t2) => getTierStatus(t2) === "pending");
|
|
27431
27510
|
if (l1Status === "verified" && !hasPending) {
|
|
27432
27511
|
try {
|
|
27433
|
-
const pmResult = await (0,
|
|
27512
|
+
const pmResult = await (0, import_core24.stripeListPaymentTokens)(
|
|
27434
27513
|
stored.customerId,
|
|
27435
27514
|
token,
|
|
27436
27515
|
publishableKey
|
|
@@ -27590,7 +27669,7 @@ function PayWithStripeLink({
|
|
|
27590
27669
|
(0, import_react27.useEffect)(() => {
|
|
27591
27670
|
if (!destinationTokenAddress || !destinationChainId || !destinationChainType) return;
|
|
27592
27671
|
let cancelled = false;
|
|
27593
|
-
(0,
|
|
27672
|
+
(0, import_core24.stripeGetDefaultToken)(
|
|
27594
27673
|
{
|
|
27595
27674
|
tokenAddress: destinationTokenAddress,
|
|
27596
27675
|
chainId: destinationChainId,
|
|
@@ -27660,7 +27739,7 @@ function PayWithStripeLink({
|
|
|
27660
27739
|
enabled: !externalWallets?.length
|
|
27661
27740
|
});
|
|
27662
27741
|
const depositWallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
|
|
27663
|
-
const onrampWalletAddress = (0,
|
|
27742
|
+
const onrampWalletAddress = (0, import_core24.getWalletByChainType)(depositWallets, stripeDestChainType)?.address;
|
|
27664
27743
|
const [registeredWalletKey, setRegisteredWalletKey] = (0, import_react27.useState)(null);
|
|
27665
27744
|
const walletKeyFor = (address) => `${stripeDestNetwork}:${stripeDestChainType === "ethereum" ? address.toLowerCase() : address}`;
|
|
27666
27745
|
const isOnrampWalletRegistered = !!onrampWalletAddress && registeredWalletKey === walletKeyFor(onrampWalletAddress);
|
|
@@ -27673,7 +27752,7 @@ function PayWithStripeLink({
|
|
|
27673
27752
|
);
|
|
27674
27753
|
}
|
|
27675
27754
|
}, [depositWallets, onrampWalletAddress, stripeDestChainType]);
|
|
27676
|
-
const depositWalletId = (0,
|
|
27755
|
+
const depositWalletId = (0, import_core24.getWalletByChainType)(depositWallets, stripeDestChainType)?.id;
|
|
27677
27756
|
const depositPollingActive = step === "checkout" || step === "success";
|
|
27678
27757
|
const { executions } = useDepositPolling({
|
|
27679
27758
|
userId,
|
|
@@ -27700,7 +27779,7 @@ function PayWithStripeLink({
|
|
|
27700
27779
|
executionReconciledSessionRef.current = confirmedSessionId;
|
|
27701
27780
|
handledTerminalSessionRef.current = confirmedSessionId;
|
|
27702
27781
|
let cancelled = false;
|
|
27703
|
-
void withTokenRefresh((tok) => (0,
|
|
27782
|
+
void withTokenRefresh((tok) => (0, import_core24.stripeGetSession)(confirmedSessionId, tok, publishableKey)).then((session) => {
|
|
27704
27783
|
if (cancelled) return;
|
|
27705
27784
|
setSessionStatus(
|
|
27706
27785
|
session.status === STRIPE_SESSION_STATUS.REJECTED || session.status === STRIPE_SESSION_STATUS.EXPIRED ? session.status : STRIPE_SESSION_STATUS.FULFILLMENT_COMPLETE
|
|
@@ -27726,7 +27805,7 @@ function PayWithStripeLink({
|
|
|
27726
27805
|
const poll = async () => {
|
|
27727
27806
|
try {
|
|
27728
27807
|
const session = await withTokenRefresh(
|
|
27729
|
-
(tok) => (0,
|
|
27808
|
+
(tok) => (0, import_core24.stripeGetSession)(confirmedSessionId, tok, publishableKey)
|
|
27730
27809
|
);
|
|
27731
27810
|
if (cancelled) return;
|
|
27732
27811
|
setSessionStatus(session.status);
|
|
@@ -27765,7 +27844,7 @@ function PayWithStripeLink({
|
|
|
27765
27844
|
setLoading(true);
|
|
27766
27845
|
setError(null);
|
|
27767
27846
|
try {
|
|
27768
|
-
const result = await (0,
|
|
27847
|
+
const result = await (0, import_core24.stripeCreateAuthIntent)(emailToUse.trim(), publishableKey);
|
|
27769
27848
|
setAuthIntentId(result.auth_intent_id);
|
|
27770
27849
|
setStep("auth");
|
|
27771
27850
|
} catch (err) {
|
|
@@ -27799,7 +27878,7 @@ function PayWithStripeLink({
|
|
|
27799
27878
|
}
|
|
27800
27879
|
const formattedPhone = `+1${digits}`;
|
|
27801
27880
|
await sdk.registerLinkUser(email.trim(), formattedPhone, "US");
|
|
27802
|
-
const result = await (0,
|
|
27881
|
+
const result = await (0, import_core24.stripeCreateAuthIntent)(email.trim(), publishableKey);
|
|
27803
27882
|
setAuthIntentId(result.auth_intent_id);
|
|
27804
27883
|
setStep("auth");
|
|
27805
27884
|
} catch (err) {
|
|
@@ -27842,7 +27921,7 @@ function PayWithStripeLink({
|
|
|
27842
27921
|
return;
|
|
27843
27922
|
}
|
|
27844
27923
|
try {
|
|
27845
|
-
const authResult = await (0,
|
|
27924
|
+
const authResult = await (0, import_core24.stripeCreateAuthIntent)(knownEmail, publishableKey);
|
|
27846
27925
|
setAuthIntentId(authResult.auth_intent_id);
|
|
27847
27926
|
setStep("auth");
|
|
27848
27927
|
} catch (err) {
|
|
@@ -27869,7 +27948,7 @@ function PayWithStripeLink({
|
|
|
27869
27948
|
setCustomerId(result.crypto_customer_id);
|
|
27870
27949
|
sdkAuthenticatedRef.current = true;
|
|
27871
27950
|
everAuthenticatedRef.current = true;
|
|
27872
|
-
const tokens = await (0,
|
|
27951
|
+
const tokens = await (0, import_core24.stripeExchangeTokens)(
|
|
27873
27952
|
authIntentId,
|
|
27874
27953
|
publishableKey,
|
|
27875
27954
|
result.crypto_customer_id
|
|
@@ -27947,7 +28026,7 @@ function PayWithStripeLink({
|
|
|
27947
28026
|
}
|
|
27948
28027
|
try {
|
|
27949
28028
|
const cust = await withTokenRefresh(
|
|
27950
|
-
(tok) => (0,
|
|
28029
|
+
(tok) => (0, import_core24.stripeGetCustomer)(customerId, tok, publishableKey)
|
|
27951
28030
|
);
|
|
27952
28031
|
if (!mounted) return;
|
|
27953
28032
|
setCustomer(cust);
|
|
@@ -28146,7 +28225,7 @@ function PayWithStripeLink({
|
|
|
28146
28225
|
try {
|
|
28147
28226
|
if (!onrampWalletAddress) return;
|
|
28148
28227
|
const existingWallets = await withTokenRefresh(
|
|
28149
|
-
(tok) => (0,
|
|
28228
|
+
(tok) => (0, import_core24.stripeListWallets)(customerId, tok, publishableKey)
|
|
28150
28229
|
);
|
|
28151
28230
|
if (!mounted) return;
|
|
28152
28231
|
setWallets(existingWallets.data);
|
|
@@ -28206,7 +28285,7 @@ function PayWithStripeLink({
|
|
|
28206
28285
|
return isEvm ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
28207
28286
|
};
|
|
28208
28287
|
const list = await withTokenRefresh(
|
|
28209
|
-
(tok) => (0,
|
|
28288
|
+
(tok) => (0, import_core24.stripeListWallets)(customerId, tok, publishableKey)
|
|
28210
28289
|
);
|
|
28211
28290
|
if (cancelled) return;
|
|
28212
28291
|
setWallets(list.data);
|
|
@@ -28256,7 +28335,7 @@ function PayWithStripeLink({
|
|
|
28256
28335
|
setLoading(true);
|
|
28257
28336
|
try {
|
|
28258
28337
|
const existing = await withTokenRefresh(
|
|
28259
|
-
(tok) => (0,
|
|
28338
|
+
(tok) => (0, import_core24.stripeListPaymentTokens)(customerId, tok, publishableKey)
|
|
28260
28339
|
);
|
|
28261
28340
|
if (!mounted) return;
|
|
28262
28341
|
setPaymentTokens(existing.data);
|
|
@@ -28276,7 +28355,7 @@ function PayWithStripeLink({
|
|
|
28276
28355
|
try {
|
|
28277
28356
|
const sdk = await initialize();
|
|
28278
28357
|
if (!sdk) throw new Error("SDK failed to load");
|
|
28279
|
-
const authResult = await (0,
|
|
28358
|
+
const authResult = await (0, import_core24.stripeCreateAuthIntent)(email, publishableKey);
|
|
28280
28359
|
if (!mounted) return;
|
|
28281
28360
|
setAuthIntentId(authResult.auth_intent_id);
|
|
28282
28361
|
setStep("auth");
|
|
@@ -28327,7 +28406,7 @@ function PayWithStripeLink({
|
|
|
28327
28406
|
if (!sdkAuthenticatedRef.current) {
|
|
28328
28407
|
if (email) {
|
|
28329
28408
|
pendingAddPaymentRef.current = true;
|
|
28330
|
-
const authResult = await (0,
|
|
28409
|
+
const authResult = await (0, import_core24.stripeCreateAuthIntent)(email, publishableKey);
|
|
28331
28410
|
if (!mounted) return;
|
|
28332
28411
|
setAuthIntentId(authResult.auth_intent_id);
|
|
28333
28412
|
setStep("auth");
|
|
@@ -28362,7 +28441,7 @@ function PayWithStripeLink({
|
|
|
28362
28441
|
if (display) {
|
|
28363
28442
|
applyAndAdvance();
|
|
28364
28443
|
if (customerId && accessTokenRef.current) {
|
|
28365
|
-
(0,
|
|
28444
|
+
(0, import_core24.stripeListPaymentTokens)(customerId, accessTokenRef.current, publishableKey).then((tokens) => {
|
|
28366
28445
|
if (mounted) setPaymentTokens(tokens.data);
|
|
28367
28446
|
}).catch(() => {
|
|
28368
28447
|
});
|
|
@@ -28371,7 +28450,7 @@ function PayWithStripeLink({
|
|
|
28371
28450
|
}
|
|
28372
28451
|
try {
|
|
28373
28452
|
if (customerId && accessTokenRef.current) {
|
|
28374
|
-
const tokens = await (0,
|
|
28453
|
+
const tokens = await (0, import_core24.stripeListPaymentTokens)(
|
|
28375
28454
|
customerId,
|
|
28376
28455
|
accessTokenRef.current,
|
|
28377
28456
|
publishableKey
|
|
@@ -28432,10 +28511,10 @@ function PayWithStripeLink({
|
|
|
28432
28511
|
setRequiredStepUp(tier ?? null);
|
|
28433
28512
|
setStep("amount");
|
|
28434
28513
|
if (customerId && onrampWalletAddress) {
|
|
28435
|
-
void withTokenRefresh((tok) => (0,
|
|
28514
|
+
void withTokenRefresh((tok) => (0, import_core24.stripeGetCustomer)(customerId, tok, publishableKey)).then((cust) => setCustomer(cust)).catch(() => {
|
|
28436
28515
|
});
|
|
28437
28516
|
void withTokenRefresh(
|
|
28438
|
-
(tok) => (0,
|
|
28517
|
+
(tok) => (0, import_core24.stripeGetTransactionLimits)(
|
|
28439
28518
|
{
|
|
28440
28519
|
cryptoCustomerId: customerId,
|
|
28441
28520
|
destinationNetwork: getStripeNetwork(),
|
|
@@ -28496,13 +28575,13 @@ function PayWithStripeLink({
|
|
|
28496
28575
|
return coordinator.performCheckout(sid, async (onrampSessionId) => {
|
|
28497
28576
|
try {
|
|
28498
28577
|
await withTokenRefresh(
|
|
28499
|
-
(tok) => (0,
|
|
28578
|
+
(tok) => (0, import_core24.stripeRefreshQuote)(onrampSessionId, tok, publishableKey)
|
|
28500
28579
|
);
|
|
28501
28580
|
} catch {
|
|
28502
28581
|
}
|
|
28503
28582
|
try {
|
|
28504
28583
|
const confirmResponse = await withTokenRefresh(
|
|
28505
|
-
(tok) => (0,
|
|
28584
|
+
(tok) => (0, import_core24.stripeConfirmSession)(onrampSessionId, tok, {}, publishableKey)
|
|
28506
28585
|
);
|
|
28507
28586
|
lastConfirmError = null;
|
|
28508
28587
|
return confirmResponse.client_secret ?? "";
|
|
@@ -28514,13 +28593,13 @@ function PayWithStripeLink({
|
|
|
28514
28593
|
};
|
|
28515
28594
|
const lastErrorFor = async (sid) => {
|
|
28516
28595
|
const sessionState = await withTokenRefresh(
|
|
28517
|
-
(tok) => (0,
|
|
28596
|
+
(tok) => (0, import_core24.stripeGetSession)(sid, tok, publishableKey)
|
|
28518
28597
|
);
|
|
28519
28598
|
return sessionState.transaction_details?.last_error ?? null;
|
|
28520
28599
|
};
|
|
28521
28600
|
const createFreshSession = async () => {
|
|
28522
28601
|
const fresh = await withTokenRefresh(
|
|
28523
|
-
(tok) => (0,
|
|
28602
|
+
(tok) => (0, import_core24.stripeCreateSession)(
|
|
28524
28603
|
{
|
|
28525
28604
|
cryptoCustomerId: customerId,
|
|
28526
28605
|
paymentToken: selectedPaymentToken,
|
|
@@ -28565,7 +28644,11 @@ function PayWithStripeLink({
|
|
|
28565
28644
|
if (checkoutResult.successful) {
|
|
28566
28645
|
handledTerminalSessionRef.current = null;
|
|
28567
28646
|
executionReconciledSessionRef.current = null;
|
|
28568
|
-
track("flow_started", {
|
|
28647
|
+
track("flow_started", {
|
|
28648
|
+
method: "stripe_link",
|
|
28649
|
+
flow_type: "deposit",
|
|
28650
|
+
deposit_wallet_id: depositWalletId
|
|
28651
|
+
});
|
|
28569
28652
|
setConfirmedSessionId(activeSessionId);
|
|
28570
28653
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
28571
28654
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -28588,7 +28671,7 @@ function PayWithStripeLink({
|
|
|
28588
28671
|
} else if (isConsumedPaymentMethodError(lastConfirmError)) {
|
|
28589
28672
|
dropConsumedToken(CONSUMED_TOKEN_MESSAGE, lastConfirmError);
|
|
28590
28673
|
} else {
|
|
28591
|
-
const confirmErr = lastConfirmError instanceof
|
|
28674
|
+
const confirmErr = lastConfirmError instanceof import_core24.StripeApiResponseError ? lastConfirmError : void 0;
|
|
28592
28675
|
const reason = describeStripePaymentFailure(lastError) ?? describeStripePaymentFailure(confirmErr?.stripeCode) ?? unmappedPaymentFailureMessage(confirmErr?.stripeMessage);
|
|
28593
28676
|
if (!isRetriablePaymentToken(selectedPaymentToken)) {
|
|
28594
28677
|
dropConsumedToken(reason, lastConfirmError ?? void 0);
|
|
@@ -28606,7 +28689,7 @@ function PayWithStripeLink({
|
|
|
28606
28689
|
}
|
|
28607
28690
|
} catch (err) {
|
|
28608
28691
|
if (isStale()) return;
|
|
28609
|
-
const stripeErr = lastConfirmError instanceof
|
|
28692
|
+
const stripeErr = lastConfirmError instanceof import_core24.StripeApiResponseError ? lastConfirmError : err instanceof import_core24.StripeApiResponseError ? err : void 0;
|
|
28610
28693
|
const effectiveError = stripeErr ?? err;
|
|
28611
28694
|
const msg = stripeErr?.message ?? (err instanceof Error ? err.message : t.formErrors.checkoutFailed);
|
|
28612
28695
|
const errorType = stripeErr?.errorType;
|
|
@@ -28654,7 +28737,7 @@ function PayWithStripeLink({
|
|
|
28654
28737
|
if (!customerId) return;
|
|
28655
28738
|
try {
|
|
28656
28739
|
const existing = await withTokenRefresh(
|
|
28657
|
-
(tok) => (0,
|
|
28740
|
+
(tok) => (0, import_core24.stripeListPaymentTokens)(customerId, tok, publishableKey)
|
|
28658
28741
|
);
|
|
28659
28742
|
setPaymentTokens(existing.data);
|
|
28660
28743
|
const stored = getStoredSelectedToken(customerId);
|
|
@@ -28691,7 +28774,7 @@ function PayWithStripeLink({
|
|
|
28691
28774
|
const fetchLimits = async () => {
|
|
28692
28775
|
try {
|
|
28693
28776
|
const result = await withTokenRefresh(
|
|
28694
|
-
(tok) => (0,
|
|
28777
|
+
(tok) => (0, import_core24.stripeGetTransactionLimits)(
|
|
28695
28778
|
{
|
|
28696
28779
|
cryptoCustomerId: customerId,
|
|
28697
28780
|
destinationNetwork: getStripeNetwork(),
|
|
@@ -28767,8 +28850,8 @@ function PayWithStripeLink({
|
|
|
28767
28850
|
const canRefreshExisting = step === "review" && existing != null && existing.amount === amount && existing.paymentToken === selectedPaymentToken && // Never refresh (and thereby reuse) a session already checked out —
|
|
28768
28851
|
// its PaymentIntent is spent. Build a fresh one instead.
|
|
28769
28852
|
!spentSessionIdsRef.current.has(existing.id);
|
|
28770
|
-
const session = canRefreshExisting ? await withTokenRefresh((tok) => (0,
|
|
28771
|
-
(tok) => (0,
|
|
28853
|
+
const session = canRefreshExisting ? await withTokenRefresh((tok) => (0, import_core24.stripeRefreshQuote)(existing.id, tok, publishableKey)) : await withTokenRefresh(
|
|
28854
|
+
(tok) => (0, import_core24.stripeCreateSession)(
|
|
28772
28855
|
{
|
|
28773
28856
|
cryptoCustomerId: customerId,
|
|
28774
28857
|
paymentToken: selectedPaymentToken,
|
|
@@ -28810,7 +28893,7 @@ function PayWithStripeLink({
|
|
|
28810
28893
|
}
|
|
28811
28894
|
} else {
|
|
28812
28895
|
setSessionForCheckout(null);
|
|
28813
|
-
const result = await (0,
|
|
28896
|
+
const result = await (0, import_core24.stripeGetQuotes)(
|
|
28814
28897
|
{
|
|
28815
28898
|
sourceAmount: amount,
|
|
28816
28899
|
sourceCurrency: "usd",
|
|
@@ -28838,7 +28921,7 @@ function PayWithStripeLink({
|
|
|
28838
28921
|
if (!active) return;
|
|
28839
28922
|
setQuote(null);
|
|
28840
28923
|
setSessionForCheckout(null);
|
|
28841
|
-
const qErrorType = err instanceof
|
|
28924
|
+
const qErrorType = err instanceof import_core24.StripeApiResponseError ? err.errorType : void 0;
|
|
28842
28925
|
if (qErrorType === "stripe_onramp_missing_document_verification") {
|
|
28843
28926
|
setLimitReachedAmount(num);
|
|
28844
28927
|
setRequiredStepUp("l2");
|
|
@@ -30062,7 +30145,14 @@ function PayWithStripeLink({
|
|
|
30062
30145
|
]
|
|
30063
30146
|
}
|
|
30064
30147
|
),
|
|
30065
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
30148
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
30149
|
+
"div",
|
|
30150
|
+
{
|
|
30151
|
+
ref: authMountRef,
|
|
30152
|
+
className: "uf-w-full uf-min-h-[200px]",
|
|
30153
|
+
style: { colorScheme: "only light" }
|
|
30154
|
+
}
|
|
30155
|
+
)
|
|
30066
30156
|
]
|
|
30067
30157
|
}
|
|
30068
30158
|
);
|
|
@@ -30620,17 +30710,17 @@ function useProjectConfig({
|
|
|
30620
30710
|
data: projectConfig,
|
|
30621
30711
|
isLoading,
|
|
30622
30712
|
error
|
|
30623
|
-
} = (0,
|
|
30713
|
+
} = (0, import_react_query10.useQuery)({
|
|
30624
30714
|
// Country is part of the key so a region change refetches the region-aware
|
|
30625
30715
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
30626
30716
|
// sharing the base cache entry.
|
|
30627
30717
|
queryKey: countryCode ? ["unifold", "projectConfig", publishableKey, countryCode, subdivisionCode ?? null] : ["unifold", "projectConfig", publishableKey],
|
|
30628
|
-
queryFn: () => (0,
|
|
30718
|
+
queryFn: () => (0, import_core26.getProjectConfig)(publishableKey, countryCode ? { countryCode, subdivisionCode } : void 0),
|
|
30629
30719
|
enabled,
|
|
30630
30720
|
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
30631
30721
|
// config refetches after the country resolves, so unrelated config-driven
|
|
30632
30722
|
// UI doesn't flash back to defaults.
|
|
30633
|
-
placeholderData:
|
|
30723
|
+
placeholderData: import_react_query10.keepPreviousData,
|
|
30634
30724
|
staleTime: 1e3 * 60 * 30,
|
|
30635
30725
|
refetchOnMount: true,
|
|
30636
30726
|
refetchOnWindowFocus: true
|
|
@@ -30642,7 +30732,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
30642
30732
|
publishableKey,
|
|
30643
30733
|
enabled = true
|
|
30644
30734
|
}) {
|
|
30645
|
-
return (0,
|
|
30735
|
+
return (0, import_react_query11.useQuery)({
|
|
30646
30736
|
queryKey: [
|
|
30647
30737
|
"unifold",
|
|
30648
30738
|
"integrationTransferDefaultToken",
|
|
@@ -30655,7 +30745,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
30655
30745
|
params?.country_code ?? null,
|
|
30656
30746
|
params?.subdivision_code ?? null
|
|
30657
30747
|
],
|
|
30658
|
-
queryFn: () => (0,
|
|
30748
|
+
queryFn: () => (0, import_core27.getIntegrationTransferDefaultToken)(params, publishableKey),
|
|
30659
30749
|
enabled: enabled && !!params,
|
|
30660
30750
|
staleTime: 1e3 * 60 * 5,
|
|
30661
30751
|
gcTime: 1e3 * 60 * 30,
|
|
@@ -30754,7 +30844,7 @@ function CoinbaseConnect({
|
|
|
30754
30844
|
const appName = projectConfig?.project_name ?? "Unifold";
|
|
30755
30845
|
const { t: strings } = useI18n();
|
|
30756
30846
|
const t = strings.connectExchange;
|
|
30757
|
-
const initialView = skipToHoldings && getStoredIntegrationToken(
|
|
30847
|
+
const initialView = skipToHoldings && getStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE) ? "holdings" : "select_exchange";
|
|
30758
30848
|
const [view, setView] = (0, import_react29.useState)(initialView);
|
|
30759
30849
|
const [prevView, setPrevView] = (0, import_react29.useState)(initialView);
|
|
30760
30850
|
const [isTransitioning, setIsTransitioning] = (0, import_react29.useState)(false);
|
|
@@ -30790,7 +30880,7 @@ function CoinbaseConnect({
|
|
|
30790
30880
|
}, [selectedExchange]);
|
|
30791
30881
|
const defaultTokenParams = (0, import_react29.useMemo)(
|
|
30792
30882
|
() => selectedAsset ? {
|
|
30793
|
-
integration_provider:
|
|
30883
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
30794
30884
|
source_currency: selectedAsset.currency.toLowerCase(),
|
|
30795
30885
|
destination_token_address: destinationTokenAddress,
|
|
30796
30886
|
destination_chain_id: destinationChainId,
|
|
@@ -30911,16 +31001,16 @@ function CoinbaseConnect({
|
|
|
30911
31001
|
const tryRefreshToken = (0, import_react29.useCallback)(
|
|
30912
31002
|
async (currentToken) => {
|
|
30913
31003
|
try {
|
|
30914
|
-
const result = await (0,
|
|
31004
|
+
const result = await (0, import_core25.refreshIntegrationToken)(currentToken, publishableKey);
|
|
30915
31005
|
setStoredIntegrationToken({
|
|
30916
|
-
integration_provider:
|
|
31006
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
30917
31007
|
access_token: result.access_token,
|
|
30918
31008
|
expires_at: result.expires_at
|
|
30919
31009
|
});
|
|
30920
31010
|
setAccessToken(result.access_token);
|
|
30921
31011
|
return result.access_token;
|
|
30922
31012
|
} catch {
|
|
30923
|
-
clearStoredIntegrationToken(
|
|
31013
|
+
clearStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
30924
31014
|
setAccessToken(null);
|
|
30925
31015
|
return null;
|
|
30926
31016
|
}
|
|
@@ -30928,7 +31018,7 @@ function CoinbaseConnect({
|
|
|
30928
31018
|
[publishableKey]
|
|
30929
31019
|
);
|
|
30930
31020
|
(0, import_react29.useEffect)(() => {
|
|
30931
|
-
const stored = getStoredIntegrationToken(
|
|
31021
|
+
const stored = getStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
30932
31022
|
if (stored) {
|
|
30933
31023
|
setAccessToken(stored.access_token);
|
|
30934
31024
|
if (skipToHoldings) {
|
|
@@ -30940,7 +31030,7 @@ function CoinbaseConnect({
|
|
|
30940
31030
|
const userSubdivisionCode = userIpInfo?.subdivisionCode ?? void 0;
|
|
30941
31031
|
(0, import_react29.useEffect)(() => {
|
|
30942
31032
|
let cancelled = false;
|
|
30943
|
-
(0,
|
|
31033
|
+
(0, import_core25.getIntegrationExchanges)(
|
|
30944
31034
|
publishableKey,
|
|
30945
31035
|
userCountryCode ? {
|
|
30946
31036
|
country_code: userCountryCode,
|
|
@@ -30953,7 +31043,7 @@ function CoinbaseConnect({
|
|
|
30953
31043
|
if (prev) {
|
|
30954
31044
|
return res.data.find((e) => e.service_provider === prev.service_provider) ?? prev;
|
|
30955
31045
|
}
|
|
30956
|
-
return res.data.find((e) => e.service_provider ===
|
|
31046
|
+
return res.data.find((e) => e.service_provider === import_core25.IntegrationProvider.COINBASE) ?? null;
|
|
30957
31047
|
});
|
|
30958
31048
|
}).catch(() => {
|
|
30959
31049
|
}).finally(() => {
|
|
@@ -30967,8 +31057,8 @@ function CoinbaseConnect({
|
|
|
30967
31057
|
async (token) => {
|
|
30968
31058
|
setIsLoading(true);
|
|
30969
31059
|
try {
|
|
30970
|
-
const result = await (0,
|
|
30971
|
-
|
|
31060
|
+
const result = await (0, import_core25.getIntegrationHoldings)(
|
|
31061
|
+
import_core25.IntegrationProvider.COINBASE,
|
|
30972
31062
|
token,
|
|
30973
31063
|
publishableKey
|
|
30974
31064
|
);
|
|
@@ -30985,8 +31075,8 @@ function CoinbaseConnect({
|
|
|
30985
31075
|
const refreshed = await tryRefreshToken(token);
|
|
30986
31076
|
if (refreshed) {
|
|
30987
31077
|
try {
|
|
30988
|
-
const retryResult = await (0,
|
|
30989
|
-
|
|
31078
|
+
const retryResult = await (0, import_core25.getIntegrationHoldings)(
|
|
31079
|
+
import_core25.IntegrationProvider.COINBASE,
|
|
30990
31080
|
refreshed,
|
|
30991
31081
|
publishableKey
|
|
30992
31082
|
);
|
|
@@ -31003,12 +31093,12 @@ function CoinbaseConnect({
|
|
|
31003
31093
|
retryFailed = true;
|
|
31004
31094
|
}
|
|
31005
31095
|
}
|
|
31006
|
-
clearStoredIntegrationToken(
|
|
31096
|
+
clearStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
31007
31097
|
setAccessToken(null);
|
|
31008
31098
|
track("account_connection_failed", {
|
|
31009
31099
|
flow_type: "deposit",
|
|
31010
31100
|
method: "exchange_connect",
|
|
31011
|
-
provider:
|
|
31101
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31012
31102
|
failure_reason: retryFailed ? "holdings_unavailable" : "token_refresh_failed"
|
|
31013
31103
|
});
|
|
31014
31104
|
transitionTo("select_exchange");
|
|
@@ -31084,7 +31174,7 @@ function CoinbaseConnect({
|
|
|
31084
31174
|
...userIpInfo?.subdivisionCode ? { subdivision_code: userIpInfo.subdivisionCode } : {}
|
|
31085
31175
|
};
|
|
31086
31176
|
setRedirectSession({ exchange, requestParams });
|
|
31087
|
-
window.open((0,
|
|
31177
|
+
window.open((0, import_core25.getIntegrationExchangeSessionStartUrl)(requestParams, publishableKey), "_blank");
|
|
31088
31178
|
transitionTo("redirect_pending");
|
|
31089
31179
|
};
|
|
31090
31180
|
const handleCreateRedirectTransferSession = async () => {
|
|
@@ -31095,7 +31185,7 @@ function CoinbaseConnect({
|
|
|
31095
31185
|
if (redirectMinDepositUsd > 0 && amountNum < redirectMinDepositUsd) return;
|
|
31096
31186
|
setIsLoading(true);
|
|
31097
31187
|
try {
|
|
31098
|
-
const result = await (0,
|
|
31188
|
+
const result = await (0, import_core25.createIntegrationExchangeSession)(
|
|
31099
31189
|
{
|
|
31100
31190
|
service_provider: exchange.service_provider,
|
|
31101
31191
|
wallet_addresses: [{ address: wallet.address, chain_type: wallet.chain_type }],
|
|
@@ -31129,7 +31219,7 @@ function CoinbaseConnect({
|
|
|
31129
31219
|
const handleReopenRedirectExchange = () => {
|
|
31130
31220
|
if (!redirectSession?.requestParams) return;
|
|
31131
31221
|
window.open(
|
|
31132
|
-
(0,
|
|
31222
|
+
(0, import_core25.getIntegrationExchangeSessionStartUrl)(redirectSession.requestParams, publishableKey),
|
|
31133
31223
|
"_blank"
|
|
31134
31224
|
);
|
|
31135
31225
|
};
|
|
@@ -31146,7 +31236,7 @@ function CoinbaseConnect({
|
|
|
31146
31236
|
const externalId = redirectSession.externalId;
|
|
31147
31237
|
const poll = async () => {
|
|
31148
31238
|
try {
|
|
31149
|
-
const result = await (0,
|
|
31239
|
+
const result = await (0, import_core25.getOnrampSessionStatus)(externalId, publishableKey);
|
|
31150
31240
|
setRedirectStatus(result.status);
|
|
31151
31241
|
if (result.status === "failed") {
|
|
31152
31242
|
setErrorMessage("Payment failed");
|
|
@@ -31176,8 +31266,8 @@ function CoinbaseConnect({
|
|
|
31176
31266
|
handleOpenRedirectExchange(exchange);
|
|
31177
31267
|
return;
|
|
31178
31268
|
}
|
|
31179
|
-
if (exchange.service_provider ===
|
|
31180
|
-
const stored = getStoredIntegrationToken(
|
|
31269
|
+
if (exchange.service_provider === import_core25.IntegrationProvider.COINBASE) {
|
|
31270
|
+
const stored = getStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
31181
31271
|
if (stored) {
|
|
31182
31272
|
setAccessToken(stored.access_token);
|
|
31183
31273
|
connectingReasonRef.current = "holdings";
|
|
@@ -31195,20 +31285,20 @@ function CoinbaseConnect({
|
|
|
31195
31285
|
track("account_connection_started", {
|
|
31196
31286
|
flow_type: "deposit",
|
|
31197
31287
|
method: "exchange_connect",
|
|
31198
|
-
provider:
|
|
31288
|
+
provider: import_core25.IntegrationProvider.COINBASE
|
|
31199
31289
|
});
|
|
31200
31290
|
try {
|
|
31201
|
-
const { redirect_url, state } = await (0,
|
|
31291
|
+
const { redirect_url, state } = await (0, import_core25.startIntegrationOAuth)(publishableKey);
|
|
31202
31292
|
popupRef.current = window.open(redirect_url, "_blank", "width=500,height=700");
|
|
31203
31293
|
pollRef.current = setInterval(async () => {
|
|
31204
31294
|
try {
|
|
31205
|
-
const result = await (0,
|
|
31295
|
+
const result = await (0, import_core25.authenticateIntegrationOAuth)({ state }, publishableKey);
|
|
31206
31296
|
if (result.status === "completed") {
|
|
31207
31297
|
if (pollRef.current) clearInterval(pollRef.current);
|
|
31208
31298
|
pollRef.current = null;
|
|
31209
31299
|
if (oauthAbandonedRef.current || viewRef.current !== "connecting") return;
|
|
31210
31300
|
setStoredIntegrationToken({
|
|
31211
|
-
integration_provider:
|
|
31301
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
31212
31302
|
access_token: result.access_token,
|
|
31213
31303
|
expires_at: result.expires_at
|
|
31214
31304
|
});
|
|
@@ -31216,7 +31306,7 @@ function CoinbaseConnect({
|
|
|
31216
31306
|
track("account_connected", {
|
|
31217
31307
|
flow_type: "deposit",
|
|
31218
31308
|
method: "exchange_connect",
|
|
31219
|
-
provider:
|
|
31309
|
+
provider: import_core25.IntegrationProvider.COINBASE
|
|
31220
31310
|
});
|
|
31221
31311
|
transitionTo("connected");
|
|
31222
31312
|
}
|
|
@@ -31228,7 +31318,7 @@ function CoinbaseConnect({
|
|
|
31228
31318
|
track("account_connection_failed", {
|
|
31229
31319
|
flow_type: "deposit",
|
|
31230
31320
|
method: "exchange_connect",
|
|
31231
|
-
provider:
|
|
31321
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31232
31322
|
failure_reason: "oauth_start_failed",
|
|
31233
31323
|
error_code: message
|
|
31234
31324
|
});
|
|
@@ -31274,9 +31364,9 @@ function CoinbaseConnect({
|
|
|
31274
31364
|
if (matchingWallet?.id) {
|
|
31275
31365
|
setTransferDepositWalletId(matchingWallet.id);
|
|
31276
31366
|
}
|
|
31277
|
-
const createTransfer = async (token) => (0,
|
|
31367
|
+
const createTransfer = async (token) => (0, import_core25.createIntegrationTransfer)(
|
|
31278
31368
|
{
|
|
31279
|
-
integration_provider:
|
|
31369
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
31280
31370
|
access_token: token,
|
|
31281
31371
|
currency: selectedAsset.currency.toLowerCase(),
|
|
31282
31372
|
amount: cryptoAmount,
|
|
@@ -31301,7 +31391,7 @@ function CoinbaseConnect({
|
|
|
31301
31391
|
track("account_connection_failed", {
|
|
31302
31392
|
flow_type: "deposit",
|
|
31303
31393
|
method: "exchange_connect",
|
|
31304
|
-
provider:
|
|
31394
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31305
31395
|
failure_reason: "token_refresh_failed"
|
|
31306
31396
|
});
|
|
31307
31397
|
throw new Error("Session expired. Please reconnect your exchange.");
|
|
@@ -31319,12 +31409,15 @@ function CoinbaseConnect({
|
|
|
31319
31409
|
setIsLoading(false);
|
|
31320
31410
|
}
|
|
31321
31411
|
};
|
|
31322
|
-
const transferErrorType = (err) => err instanceof
|
|
31412
|
+
const transferErrorType = (err) => err instanceof import_core25.IntegrationTransferError ? err.errorType : void 0;
|
|
31323
31413
|
const trackTransferStarted = () => {
|
|
31324
31414
|
track("flow_started", {
|
|
31325
31415
|
flow_type: "deposit",
|
|
31326
31416
|
method: "exchange_connect",
|
|
31327
|
-
provider:
|
|
31417
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31418
|
+
// No execution yet — one appears when the exchange's transfer lands on
|
|
31419
|
+
// this wallet, carrying the same id.
|
|
31420
|
+
deposit_wallet_id: transferDepositWalletId,
|
|
31328
31421
|
amount_usd: sendAmount || void 0,
|
|
31329
31422
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
31330
31423
|
chain: sourceChain?.chain_id,
|
|
@@ -31332,13 +31425,41 @@ function CoinbaseConnect({
|
|
|
31332
31425
|
network: sourceChain?.network
|
|
31333
31426
|
});
|
|
31334
31427
|
};
|
|
31428
|
+
const applyConfirmResult = (result) => {
|
|
31429
|
+
if (result.status === "mfa_required") {
|
|
31430
|
+
track("verification_started", {
|
|
31431
|
+
flow_type: "deposit",
|
|
31432
|
+
method: "exchange_connect",
|
|
31433
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31434
|
+
verification_type: "mfa",
|
|
31435
|
+
verification_status: result.status
|
|
31436
|
+
});
|
|
31437
|
+
transitionTo("mfa");
|
|
31438
|
+
setMfaCode("");
|
|
31439
|
+
setMfaError(false);
|
|
31440
|
+
} else if (result.status === "mfa_enrollment_required") {
|
|
31441
|
+
transitionTo("mfa_enrollment");
|
|
31442
|
+
} else if (result.status === "completed") {
|
|
31443
|
+
trackTransferStarted();
|
|
31444
|
+
setConfirmResult(result);
|
|
31445
|
+
transitionTo("success");
|
|
31446
|
+
onTransferSuccess?.(result);
|
|
31447
|
+
} else {
|
|
31448
|
+
setErrorMessage(result.message || t.errors.transferFailed);
|
|
31449
|
+
transitionTo("error");
|
|
31450
|
+
onTransferError?.({
|
|
31451
|
+
message: result.message || t.errors.transferFailed,
|
|
31452
|
+
code: result.status
|
|
31453
|
+
});
|
|
31454
|
+
}
|
|
31455
|
+
};
|
|
31335
31456
|
const handleConfirmTransfer = async () => {
|
|
31336
31457
|
if (!transferIntent || !accessToken) return;
|
|
31337
31458
|
setIsLoading(true);
|
|
31338
31459
|
let sessionExpired = false;
|
|
31339
31460
|
try {
|
|
31340
31461
|
let token = accessToken;
|
|
31341
|
-
const result = await (0,
|
|
31462
|
+
const result = await (0, import_core25.confirmIntegrationTransfer)(
|
|
31342
31463
|
transferIntent.id,
|
|
31343
31464
|
token,
|
|
31344
31465
|
void 0,
|
|
@@ -31350,7 +31471,7 @@ function CoinbaseConnect({
|
|
|
31350
31471
|
const refreshed = await tryRefreshToken(token);
|
|
31351
31472
|
if (refreshed) {
|
|
31352
31473
|
token = refreshed;
|
|
31353
|
-
return (0,
|
|
31474
|
+
return (0, import_core25.confirmIntegrationTransfer)(
|
|
31354
31475
|
transferIntent.id,
|
|
31355
31476
|
refreshed,
|
|
31356
31477
|
void 0,
|
|
@@ -31361,35 +31482,12 @@ function CoinbaseConnect({
|
|
|
31361
31482
|
track("account_connection_failed", {
|
|
31362
31483
|
flow_type: "deposit",
|
|
31363
31484
|
method: "exchange_connect",
|
|
31364
|
-
provider:
|
|
31485
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31365
31486
|
failure_reason: "token_refresh_failed"
|
|
31366
31487
|
});
|
|
31367
31488
|
throw err;
|
|
31368
31489
|
});
|
|
31369
|
-
|
|
31370
|
-
track("verification_started", {
|
|
31371
|
-
flow_type: "deposit",
|
|
31372
|
-
method: "exchange_connect",
|
|
31373
|
-
provider: import_core26.IntegrationProvider.COINBASE,
|
|
31374
|
-
verification_type: "mfa",
|
|
31375
|
-
verification_status: result.status
|
|
31376
|
-
});
|
|
31377
|
-
transitionTo("mfa");
|
|
31378
|
-
setMfaCode("");
|
|
31379
|
-
setMfaError(false);
|
|
31380
|
-
} else if (result.status === "completed") {
|
|
31381
|
-
trackTransferStarted();
|
|
31382
|
-
setConfirmResult(result);
|
|
31383
|
-
transitionTo("success");
|
|
31384
|
-
onTransferSuccess?.(result);
|
|
31385
|
-
} else {
|
|
31386
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
31387
|
-
transitionTo("error");
|
|
31388
|
-
onTransferError?.({
|
|
31389
|
-
message: result.message || t.errors.transferFailed,
|
|
31390
|
-
code: result.status
|
|
31391
|
-
});
|
|
31392
|
-
}
|
|
31490
|
+
applyConfirmResult(result);
|
|
31393
31491
|
} catch (err) {
|
|
31394
31492
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
31395
31493
|
setErrorMessage(message);
|
|
@@ -31409,11 +31507,11 @@ function CoinbaseConnect({
|
|
|
31409
31507
|
track("verification_submitted", {
|
|
31410
31508
|
flow_type: "deposit",
|
|
31411
31509
|
method: "exchange_connect",
|
|
31412
|
-
provider:
|
|
31510
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31413
31511
|
verification_type: "mfa"
|
|
31414
31512
|
});
|
|
31415
31513
|
try {
|
|
31416
|
-
const result = await (0,
|
|
31514
|
+
const result = await (0, import_core25.confirmIntegrationTransfer)(
|
|
31417
31515
|
transferIntent.id,
|
|
31418
31516
|
accessToken,
|
|
31419
31517
|
mfaCode,
|
|
@@ -31423,7 +31521,7 @@ function CoinbaseConnect({
|
|
|
31423
31521
|
track("verification_failed", {
|
|
31424
31522
|
flow_type: "deposit",
|
|
31425
31523
|
method: "exchange_connect",
|
|
31426
|
-
provider:
|
|
31524
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31427
31525
|
verification_type: "mfa",
|
|
31428
31526
|
verification_status: result.status,
|
|
31429
31527
|
failure_reason: "invalid_code"
|
|
@@ -31434,7 +31532,7 @@ function CoinbaseConnect({
|
|
|
31434
31532
|
track("verification_completed", {
|
|
31435
31533
|
flow_type: "deposit",
|
|
31436
31534
|
method: "exchange_connect",
|
|
31437
|
-
provider:
|
|
31535
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31438
31536
|
verification_type: "mfa",
|
|
31439
31537
|
verification_status: result.status
|
|
31440
31538
|
});
|
|
@@ -31446,7 +31544,7 @@ function CoinbaseConnect({
|
|
|
31446
31544
|
track("verification_failed", {
|
|
31447
31545
|
flow_type: "deposit",
|
|
31448
31546
|
method: "exchange_connect",
|
|
31449
|
-
provider:
|
|
31547
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31450
31548
|
verification_type: "mfa",
|
|
31451
31549
|
verification_status: result.status,
|
|
31452
31550
|
failure_reason: result.message || "transfer_failed"
|
|
@@ -31463,7 +31561,7 @@ function CoinbaseConnect({
|
|
|
31463
31561
|
track("verification_failed", {
|
|
31464
31562
|
flow_type: "deposit",
|
|
31465
31563
|
method: "exchange_connect",
|
|
31466
|
-
provider:
|
|
31564
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31467
31565
|
verification_type: "mfa",
|
|
31468
31566
|
failure_reason: errorType || (err instanceof Error ? err.message : "mfa_request_failed")
|
|
31469
31567
|
});
|
|
@@ -31496,14 +31594,14 @@ function CoinbaseConnect({
|
|
|
31496
31594
|
track("account_connection_failed", {
|
|
31497
31595
|
flow_type: "deposit",
|
|
31498
31596
|
method: "exchange_connect",
|
|
31499
|
-
provider:
|
|
31597
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31500
31598
|
failure_reason: "abandoned"
|
|
31501
31599
|
});
|
|
31502
31600
|
} else if (view === "mfa") {
|
|
31503
31601
|
track("verification_failed", {
|
|
31504
31602
|
flow_type: "deposit",
|
|
31505
31603
|
method: "exchange_connect",
|
|
31506
|
-
provider:
|
|
31604
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31507
31605
|
verification_type: "mfa",
|
|
31508
31606
|
failure_reason: "abandoned"
|
|
31509
31607
|
});
|
|
@@ -31546,6 +31644,9 @@ function CoinbaseConnect({
|
|
|
31546
31644
|
setShowTransferDetails(false);
|
|
31547
31645
|
transitionTo("enter_amount");
|
|
31548
31646
|
break;
|
|
31647
|
+
case "mfa_enrollment":
|
|
31648
|
+
transitionTo("transfer_confirm");
|
|
31649
|
+
break;
|
|
31549
31650
|
case "mfa":
|
|
31550
31651
|
transitionTo("transfer_confirm");
|
|
31551
31652
|
break;
|
|
@@ -31661,7 +31762,7 @@ function CoinbaseConnect({
|
|
|
31661
31762
|
},
|
|
31662
31763
|
children: t.comingSoon
|
|
31663
31764
|
}
|
|
31664
|
-
) : accessToken && exchange.service_provider ===
|
|
31765
|
+
) : accessToken && exchange.service_provider === import_core25.IntegrationProvider.COINBASE ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
31665
31766
|
"span",
|
|
31666
31767
|
{
|
|
31667
31768
|
className: "uf-text-xs uf-px-2.5 uf-py-1 uf-rounded-full",
|
|
@@ -33102,6 +33203,55 @@ function CoinbaseConnect({
|
|
|
33102
33203
|
] })
|
|
33103
33204
|
] });
|
|
33104
33205
|
}
|
|
33206
|
+
if (view === "mfa_enrollment") {
|
|
33207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
33208
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
33209
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
33210
|
+
"div",
|
|
33211
|
+
{
|
|
33212
|
+
className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
|
|
33213
|
+
style: viewTransitionStyle,
|
|
33214
|
+
children: [
|
|
33215
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
33216
|
+
DepositErrorState,
|
|
33217
|
+
{
|
|
33218
|
+
title: t.transfer.mfaEnrollmentTitle,
|
|
33219
|
+
message: t.transfer.mfaEnrollmentMessage
|
|
33220
|
+
}
|
|
33221
|
+
),
|
|
33222
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
33223
|
+
"a",
|
|
33224
|
+
{
|
|
33225
|
+
href: "https://www.coinbase.com/settings/security",
|
|
33226
|
+
target: "_blank",
|
|
33227
|
+
rel: "noopener noreferrer",
|
|
33228
|
+
className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
|
|
33229
|
+
style: { color: colors2.primary, fontFamily: fonts.medium },
|
|
33230
|
+
children: [
|
|
33231
|
+
t.transfer.mfaEnrollmentSettingsLink,
|
|
33232
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
|
|
33233
|
+
]
|
|
33234
|
+
}
|
|
33235
|
+
),
|
|
33236
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
33237
|
+
"button",
|
|
33238
|
+
{
|
|
33239
|
+
onClick: handleConfirmTransfer,
|
|
33240
|
+
disabled: isLoading,
|
|
33241
|
+
className: "uf-w-full uf-rounded-xl uf-py-3.5 uf-text-sm uf-font-medium uf-transition-all hover:uf-opacity-90 disabled:uf-opacity-50 uf-flex uf-items-center uf-justify-center uf-gap-2",
|
|
33242
|
+
style: {
|
|
33243
|
+
backgroundColor: colors2.primary,
|
|
33244
|
+
color: "#fff",
|
|
33245
|
+
fontFamily: fonts.medium
|
|
33246
|
+
},
|
|
33247
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
|
|
33248
|
+
}
|
|
33249
|
+
)
|
|
33250
|
+
]
|
|
33251
|
+
}
|
|
33252
|
+
)
|
|
33253
|
+
] });
|
|
33254
|
+
}
|
|
33105
33255
|
if (view === "mfa") {
|
|
33106
33256
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
33107
33257
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -33385,9 +33535,9 @@ function useExchanges({
|
|
|
33385
33535
|
publishableKey,
|
|
33386
33536
|
enabled = true
|
|
33387
33537
|
}) {
|
|
33388
|
-
const { data: exchanges = [], isLoading } = (0,
|
|
33538
|
+
const { data: exchanges = [], isLoading } = (0, import_react_query12.useQuery)({
|
|
33389
33539
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
33390
|
-
queryFn: () => (0,
|
|
33540
|
+
queryFn: () => (0, import_core28.getExchanges)(void 0, publishableKey).then((res) => res.data),
|
|
33391
33541
|
enabled,
|
|
33392
33542
|
staleTime: 1e3 * 60 * 30,
|
|
33393
33543
|
refetchOnMount: false,
|
|
@@ -33403,9 +33553,9 @@ function usePublicIncident({
|
|
|
33403
33553
|
data: incident,
|
|
33404
33554
|
isLoading,
|
|
33405
33555
|
error
|
|
33406
|
-
} = (0,
|
|
33556
|
+
} = (0, import_react_query13.useQuery)({
|
|
33407
33557
|
queryKey: ["unifold", "publicIncident", publishableKey],
|
|
33408
|
-
queryFn: () => (0,
|
|
33558
|
+
queryFn: () => (0, import_core29.getPublicIncident)(publishableKey),
|
|
33409
33559
|
enabled,
|
|
33410
33560
|
staleTime: 1e3 * 30,
|
|
33411
33561
|
refetchInterval: 1e3 * 30,
|
|
@@ -33418,9 +33568,9 @@ function useWalletPayProviders({
|
|
|
33418
33568
|
publishableKey,
|
|
33419
33569
|
enabled = true
|
|
33420
33570
|
}) {
|
|
33421
|
-
const { data: providers, isLoading } = (0,
|
|
33571
|
+
const { data: providers, isLoading } = (0, import_react_query14.useQuery)({
|
|
33422
33572
|
queryKey: ["unifold", "walletPayProviders", method, publishableKey],
|
|
33423
|
-
queryFn: () => (0,
|
|
33573
|
+
queryFn: () => (0, import_core30.getWalletPayProviders)(method, publishableKey),
|
|
33424
33574
|
enabled,
|
|
33425
33575
|
staleTime: 1e3 * 60 * 30,
|
|
33426
33576
|
refetchOnMount: true,
|
|
@@ -33498,9 +33648,9 @@ function walletConnectionPayload(event) {
|
|
|
33498
33648
|
};
|
|
33499
33649
|
}
|
|
33500
33650
|
var ACCOUNT_CONNECTION_EVENTS = {
|
|
33501
|
-
account_connection_started:
|
|
33502
|
-
account_connected:
|
|
33503
|
-
account_connection_failed:
|
|
33651
|
+
account_connection_started: import_core33.DepositEventType.ACCOUNT_CONNECTION_STARTED,
|
|
33652
|
+
account_connected: import_core33.DepositEventType.ACCOUNT_CONNECTED,
|
|
33653
|
+
account_connection_failed: import_core33.DepositEventType.ACCOUNT_CONNECTION_FAILED
|
|
33504
33654
|
};
|
|
33505
33655
|
var str3 = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
33506
33656
|
function accountConnectionPayload(event) {
|
|
@@ -33519,9 +33669,9 @@ function accountConnectionPayload(event) {
|
|
|
33519
33669
|
};
|
|
33520
33670
|
}
|
|
33521
33671
|
var VERIFICATION_EVENTS = {
|
|
33522
|
-
verification_started:
|
|
33523
|
-
verification_completed:
|
|
33524
|
-
verification_failed:
|
|
33672
|
+
verification_started: import_core34.DepositEventType.VERIFICATION_STARTED,
|
|
33673
|
+
verification_completed: import_core34.DepositEventType.VERIFICATION_COMPLETED,
|
|
33674
|
+
verification_failed: import_core34.DepositEventType.VERIFICATION_FAILED
|
|
33525
33675
|
};
|
|
33526
33676
|
function verificationPayload(event) {
|
|
33527
33677
|
const type = VERIFICATION_EVENTS[event.event];
|
|
@@ -33533,9 +33683,9 @@ function verificationPayload(event) {
|
|
|
33533
33683
|
};
|
|
33534
33684
|
}
|
|
33535
33685
|
var WALLET_CONNECTION_TYPES = {
|
|
33536
|
-
started:
|
|
33537
|
-
connected:
|
|
33538
|
-
failed:
|
|
33686
|
+
started: import_core32.DepositEventType.WALLET_CONNECTION_STARTED,
|
|
33687
|
+
connected: import_core32.DepositEventType.WALLET_CONNECTED,
|
|
33688
|
+
failed: import_core32.DepositEventType.WALLET_CONNECTION_FAILED
|
|
33539
33689
|
};
|
|
33540
33690
|
function depositMethodFromAnalytics(method) {
|
|
33541
33691
|
if (typeof method !== "string") return void 0;
|
|
@@ -33559,7 +33709,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33559
33709
|
if (event.event === "flow_started") {
|
|
33560
33710
|
onEventRef.current?.({
|
|
33561
33711
|
...base,
|
|
33562
|
-
type:
|
|
33712
|
+
type: import_core32.DepositEventType.FLOW_STARTED,
|
|
33563
33713
|
...withMethod,
|
|
33564
33714
|
data: {
|
|
33565
33715
|
object: {
|
|
@@ -33608,7 +33758,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33608
33758
|
case "token":
|
|
33609
33759
|
onEventRef.current?.({
|
|
33610
33760
|
...base,
|
|
33611
|
-
type:
|
|
33761
|
+
type: import_core32.DepositEventType.TOKEN_SELECTED,
|
|
33612
33762
|
...withMethod,
|
|
33613
33763
|
data: { object: selection.data }
|
|
33614
33764
|
});
|
|
@@ -33616,7 +33766,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33616
33766
|
case "wallet":
|
|
33617
33767
|
onEventRef.current?.({
|
|
33618
33768
|
...base,
|
|
33619
|
-
type:
|
|
33769
|
+
type: import_core32.DepositEventType.WALLET_SELECTED,
|
|
33620
33770
|
...withMethod,
|
|
33621
33771
|
data: { object: selection.data }
|
|
33622
33772
|
});
|
|
@@ -33624,7 +33774,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33624
33774
|
case "provider":
|
|
33625
33775
|
onEventRef.current?.({
|
|
33626
33776
|
...base,
|
|
33627
|
-
type:
|
|
33777
|
+
type: import_core32.DepositEventType.PROVIDER_SELECTED,
|
|
33628
33778
|
...withMethod,
|
|
33629
33779
|
data: { object: selection.data }
|
|
33630
33780
|
});
|
|
@@ -33684,7 +33834,7 @@ function useAddressValidation({
|
|
|
33684
33834
|
refetchOnMount = false
|
|
33685
33835
|
}) {
|
|
33686
33836
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
33687
|
-
const { data, isLoading, error } = (0,
|
|
33837
|
+
const { data, isLoading, error } = (0, import_react_query15.useQuery)({
|
|
33688
33838
|
queryKey: [
|
|
33689
33839
|
"unifold",
|
|
33690
33840
|
"addressValidation",
|
|
@@ -33693,7 +33843,7 @@ function useAddressValidation({
|
|
|
33693
33843
|
destinationChainId,
|
|
33694
33844
|
destinationTokenAddress
|
|
33695
33845
|
],
|
|
33696
|
-
queryFn: () => (0,
|
|
33846
|
+
queryFn: () => (0, import_core35.verifyRecipientAddress)(
|
|
33697
33847
|
{
|
|
33698
33848
|
chain_type: destinationChainType,
|
|
33699
33849
|
chain_id: destinationChainId,
|
|
@@ -33977,7 +34127,7 @@ function DepositsModal({
|
|
|
33977
34127
|
if (!open || !userId) return;
|
|
33978
34128
|
const fetchExecutions = async () => {
|
|
33979
34129
|
try {
|
|
33980
|
-
const response = await (0,
|
|
34130
|
+
const response = await (0, import_core36.queryExecutions)(userId, publishableKey, import_core36.ActionType.Deposit);
|
|
33981
34131
|
const sorted = [...response.data].sort((a, b) => {
|
|
33982
34132
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
33983
34133
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -35087,9 +35237,9 @@ function useHypercoreActivation(params) {
|
|
|
35087
35237
|
const recipient = recipientAddress?.trim() ?? "";
|
|
35088
35238
|
const source = sourceAddress?.trim() ?? "";
|
|
35089
35239
|
const hasAddresses = !!recipient && !!source;
|
|
35090
|
-
const { data, isLoading } = (0,
|
|
35240
|
+
const { data, isLoading } = (0, import_react_query16.useQuery)({
|
|
35091
35241
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
35092
|
-
queryFn: () => (0,
|
|
35242
|
+
queryFn: () => (0, import_core38.checkHypercoreActivation)(
|
|
35093
35243
|
{
|
|
35094
35244
|
source_address: source,
|
|
35095
35245
|
recipient_address: recipient
|
|
@@ -35235,7 +35385,7 @@ function TransferCryptoSingleInput({
|
|
|
35235
35385
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
35236
35386
|
) : void 0;
|
|
35237
35387
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
35238
|
-
const currentWallet = (0,
|
|
35388
|
+
const currentWallet = (0, import_core37.getWalletByChainType)(wallets, currentChainType);
|
|
35239
35389
|
const depositAddress = currentWallet?.address || "";
|
|
35240
35390
|
const {
|
|
35241
35391
|
executions: depositExecutions,
|
|
@@ -35477,7 +35627,7 @@ function TransferCryptoSingleInput({
|
|
|
35477
35627
|
className: "uf-text-sm uf-font-semibold",
|
|
35478
35628
|
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
35479
35629
|
children: [
|
|
35480
|
-
checkoutQuote.isStablecoin ? (0,
|
|
35630
|
+
checkoutQuote.isStablecoin ? (0, import_core37.formatStablecoinAmount)(
|
|
35481
35631
|
checkoutQuote.sourceAmount,
|
|
35482
35632
|
checkoutQuote.sourceTokenDecimals
|
|
35483
35633
|
) : (Number(checkoutQuote.sourceAmount) / 10 ** checkoutQuote.sourceTokenDecimals).toFixed(Math.min(checkoutQuote.sourceTokenDecimals, 6)),
|
|
@@ -36067,7 +36217,7 @@ function TransferCryptoDoubleInput({
|
|
|
36067
36217
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
36068
36218
|
) : void 0;
|
|
36069
36219
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
36070
|
-
const currentWallet = (0,
|
|
36220
|
+
const currentWallet = (0, import_core39.getWalletByChainType)(wallets, currentChainType);
|
|
36071
36221
|
const depositAddress = currentWallet?.address || "";
|
|
36072
36222
|
const {
|
|
36073
36223
|
executions: depositExecutions,
|
|
@@ -36818,7 +36968,7 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
36818
36968
|
params: []
|
|
36819
36969
|
});
|
|
36820
36970
|
const activeChainId = String(parseInt(currentChainHex, 16));
|
|
36821
|
-
const buildResult = await (0,
|
|
36971
|
+
const buildResult = await (0, import_core41.buildHypercoreTransaction)(
|
|
36822
36972
|
{
|
|
36823
36973
|
signature_chain_id: activeChainId,
|
|
36824
36974
|
recipient_address: recipientAddress,
|
|
@@ -36831,7 +36981,7 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
36831
36981
|
method: "eth_signTypedData_v4",
|
|
36832
36982
|
params: [fromAddress, JSON.stringify(buildResult.typed_data)]
|
|
36833
36983
|
});
|
|
36834
|
-
await (0,
|
|
36984
|
+
await (0, import_core41.sendHypercoreTransaction)(
|
|
36835
36985
|
{
|
|
36836
36986
|
action_payload: buildResult.action_payload,
|
|
36837
36987
|
signature,
|
|
@@ -36866,7 +37016,7 @@ function useDepositQuote(params) {
|
|
|
36866
37016
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
36867
37017
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
36868
37018
|
};
|
|
36869
|
-
return (0,
|
|
37019
|
+
return (0, import_react_query17.useQuery)({
|
|
36870
37020
|
queryKey: [
|
|
36871
37021
|
"unifold",
|
|
36872
37022
|
"depositQuote",
|
|
@@ -36881,7 +37031,7 @@ function useDepositQuote(params) {
|
|
|
36881
37031
|
stablecoinParity,
|
|
36882
37032
|
publishableKey
|
|
36883
37033
|
],
|
|
36884
|
-
queryFn: () => (0,
|
|
37034
|
+
queryFn: () => (0, import_core42.getDepositQuote)(request, publishableKey),
|
|
36885
37035
|
enabled: enabled && !!publishableKey && !!sourceChainType && !!sourceChainId && !!sourceTokenAddress && !!destinationAmount && destinationAmount !== "0" && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress,
|
|
36886
37036
|
staleTime: 3e4,
|
|
36887
37037
|
gcTime: 5 * 6e4,
|
|
@@ -36896,9 +37046,9 @@ function useExternalWallets({
|
|
|
36896
37046
|
publishableKey,
|
|
36897
37047
|
enabled = true
|
|
36898
37048
|
}) {
|
|
36899
|
-
const { data: wallets = [], isLoading } = (0,
|
|
37049
|
+
const { data: wallets = [], isLoading } = (0, import_react_query18.useQuery)({
|
|
36900
37050
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
36901
|
-
queryFn: () => (0,
|
|
37051
|
+
queryFn: () => (0, import_core43.getExternalWallets)(publishableKey).then((res) => res.data),
|
|
36902
37052
|
enabled: enabled && !!publishableKey,
|
|
36903
37053
|
staleTime: 1e3 * 60 * 30,
|
|
36904
37054
|
refetchOnMount: false,
|
|
@@ -38281,7 +38431,7 @@ function WalletConnect({
|
|
|
38281
38431
|
try {
|
|
38282
38432
|
const cleanedAmountUsd = amountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
38283
38433
|
const forwardedAmountUsd = parseFloat(cleanedAmountUsd) > 0 ? cleanedAmountUsd : void 0;
|
|
38284
|
-
const res = await (0,
|
|
38434
|
+
const res = await (0, import_core40.getWalletMobileDeepLink)(
|
|
38285
38435
|
wallet.id,
|
|
38286
38436
|
depositAddresses,
|
|
38287
38437
|
publishableKey,
|
|
@@ -38613,7 +38763,7 @@ function WalletConnect({
|
|
|
38613
38763
|
destination_chain_type: activeDepositWallet.destination_chain_type,
|
|
38614
38764
|
...productType ? { product_type: productType } : {}
|
|
38615
38765
|
};
|
|
38616
|
-
const response = await (0,
|
|
38766
|
+
const response = await (0, import_core40.getSupportedDepositTokens)(publishableKey, options);
|
|
38617
38767
|
if (cancelled) return;
|
|
38618
38768
|
const supportedToken = response.data.find(
|
|
38619
38769
|
(t2) => t2.symbol.toLowerCase() === token.symbol.toLowerCase()
|
|
@@ -38641,7 +38791,7 @@ function WalletConnect({
|
|
|
38641
38791
|
setIsLoading(true);
|
|
38642
38792
|
setError(null);
|
|
38643
38793
|
const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" || activeDepositWallet.chain_type === "tron" ? "ethereum" : activeDepositWallet.chain_type;
|
|
38644
|
-
(0,
|
|
38794
|
+
(0, import_core40.getAddressBalances)(activeWalletInfo.address, sct, publishableKey).then((response) => {
|
|
38645
38795
|
if (cancelled) return;
|
|
38646
38796
|
const nonZero = response.balances.filter((b) => b.amount !== "0");
|
|
38647
38797
|
const defaultSource = {
|
|
@@ -38934,7 +39084,7 @@ function WalletConnect({
|
|
|
38934
39084
|
if (!provider.publicKey) await provider.connect();
|
|
38935
39085
|
const isNative = token.token_address === "native" || token.token_address === "So11111111111111111111111111111111111111112" || token.token_address === "";
|
|
38936
39086
|
const smallestUnit = isNative ? decimalToSmallestUnit(amountStr, 9) : decimalToSmallestUnit(amountStr, token.decimals);
|
|
38937
|
-
const buildResp = await (0,
|
|
39087
|
+
const buildResp = await (0, import_core40.buildSolanaTransaction)(
|
|
38938
39088
|
{
|
|
38939
39089
|
chain_id: "mainnet",
|
|
38940
39090
|
token_address: token.token_address === "" ? "native" : token.token_address,
|
|
@@ -38956,7 +39106,7 @@ function WalletConnect({
|
|
|
38956
39106
|
const ser = signed.serialize();
|
|
38957
39107
|
let bs = "";
|
|
38958
39108
|
for (let i = 0; i < ser.length; i++) bs += String.fromCharCode(ser[i]);
|
|
38959
|
-
const resp = await (0,
|
|
39109
|
+
const resp = await (0, import_core40.sendSolanaTransaction)(
|
|
38960
39110
|
{ chain_id: "mainnet", signed_transaction: btoa(bs) },
|
|
38961
39111
|
publishableKey
|
|
38962
39112
|
);
|
|
@@ -39002,7 +39152,7 @@ function WalletConnect({
|
|
|
39002
39152
|
} else if (isHypercoreToken) {
|
|
39003
39153
|
let sendAmount = tokenAmount;
|
|
39004
39154
|
try {
|
|
39005
|
-
const activation = await (0,
|
|
39155
|
+
const activation = await (0, import_core40.checkHypercoreActivation)(
|
|
39006
39156
|
{ source_address: walletInfo.address, recipient_address: recipientAddress },
|
|
39007
39157
|
publishableKey
|
|
39008
39158
|
);
|
|
@@ -39029,7 +39179,11 @@ function WalletConnect({
|
|
|
39029
39179
|
chain: String(token.chain_id),
|
|
39030
39180
|
network: token.network,
|
|
39031
39181
|
token: token.symbol ?? token.token_address,
|
|
39032
|
-
currency: token.currency
|
|
39182
|
+
currency: token.currency,
|
|
39183
|
+
// No execution exists yet — it's created when this send lands on the
|
|
39184
|
+
// wallet. The wallet id is what that execution will carry, so it's
|
|
39185
|
+
// how a send that never completes is matched to what followed.
|
|
39186
|
+
deposit_wallet_id: activeDepositWallet?.id
|
|
39033
39187
|
});
|
|
39034
39188
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
39035
39189
|
setHasSignedTransaction(true);
|
|
@@ -39359,8 +39513,8 @@ function WalletConnect({
|
|
|
39359
39513
|
] }) });
|
|
39360
39514
|
}
|
|
39361
39515
|
if (view === "mobile_deposit_status" && latestDepositExecution) {
|
|
39362
|
-
const isComplete = latestDepositExecution.status ===
|
|
39363
|
-
const isFailed = latestDepositExecution.status ===
|
|
39516
|
+
const isComplete = latestDepositExecution.status === import_core40.ExecutionStatus.SUCCEEDED;
|
|
39517
|
+
const isFailed = latestDepositExecution.status === import_core40.ExecutionStatus.FAILED;
|
|
39364
39518
|
const title = isComplete ? t.paymentComplete : isFailed ? t.paymentFailed : t.paymentProcessing;
|
|
39365
39519
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
39366
39520
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
@@ -39616,7 +39770,7 @@ function DepositModal({
|
|
|
39616
39770
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
39617
39771
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
39618
39772
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
39619
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
39773
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
39620
39774
|
const normalizedPrefilledAmountUsd = (0, import_react7.useMemo)(
|
|
39621
39775
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
39622
39776
|
[prefilledAmountUsd]
|
|
@@ -39624,6 +39778,7 @@ function DepositModal({
|
|
|
39624
39778
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
39625
39779
|
const journeyActiveRef = (0, import_react7.useRef)(false);
|
|
39626
39780
|
const journeySessionIdRef = (0, import_react7.useRef)(void 0);
|
|
39781
|
+
const journeyExternalUserIdRef = (0, import_react7.useRef)(void 0);
|
|
39627
39782
|
const externalUserId = userId || void 0;
|
|
39628
39783
|
const emitEvent = (0, import_react7.useCallback)(
|
|
39629
39784
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -39634,8 +39789,8 @@ function DepositModal({
|
|
|
39634
39789
|
(method) => {
|
|
39635
39790
|
track("payment_method_selected", { method: analyticsMethod(method), flow_type: "deposit" });
|
|
39636
39791
|
emitEvent({
|
|
39637
|
-
id: (0,
|
|
39638
|
-
type:
|
|
39792
|
+
id: (0, import_core31.generatePrefixedKSUID)("sevt"),
|
|
39793
|
+
type: import_core31.DepositEventType.METHOD_SELECTED,
|
|
39639
39794
|
created: Math.floor(Date.now() / 1e3),
|
|
39640
39795
|
sessionId: getSessionId() ?? "",
|
|
39641
39796
|
method,
|
|
@@ -39651,6 +39806,9 @@ function DepositModal({
|
|
|
39651
39806
|
method: analyticsMethod(method),
|
|
39652
39807
|
flow_type: "deposit",
|
|
39653
39808
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
39809
|
+
// The one high-cardinality field we do send: the join key from a
|
|
39810
|
+
// funnel session back to the execution row it produced.
|
|
39811
|
+
execution_id: data.executionId ?? execution?.id,
|
|
39654
39812
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
39655
39813
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
39656
39814
|
// the onEvent DirectExecution instead).
|
|
@@ -39678,6 +39836,7 @@ function DepositModal({
|
|
|
39678
39836
|
method: analyticsMethod(method),
|
|
39679
39837
|
flow_type: "deposit",
|
|
39680
39838
|
error_code: error.code,
|
|
39839
|
+
execution_id: execution?.id,
|
|
39681
39840
|
failure_reason: execution?.failureReason ?? void 0,
|
|
39682
39841
|
status: execution?.status,
|
|
39683
39842
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -39687,8 +39846,8 @@ function DepositModal({
|
|
|
39687
39846
|
});
|
|
39688
39847
|
onDepositError?.({ ...error, method });
|
|
39689
39848
|
emitEvent({
|
|
39690
|
-
id: (0,
|
|
39691
|
-
type:
|
|
39849
|
+
id: (0, import_core31.generatePrefixedKSUID)("sevt"),
|
|
39850
|
+
type: import_core31.DepositEventType.FLOW_FAILED,
|
|
39692
39851
|
created: Math.floor(Date.now() / 1e3),
|
|
39693
39852
|
sessionId: getSessionId() ?? "",
|
|
39694
39853
|
method,
|
|
@@ -39794,7 +39953,7 @@ function DepositModal({
|
|
|
39794
39953
|
const [integrationExchanges, setIntegrationExchanges] = (0, import_react7.useState)([]);
|
|
39795
39954
|
(0, import_react7.useEffect)(() => {
|
|
39796
39955
|
if (!showConnectExchange || !open) return;
|
|
39797
|
-
(0,
|
|
39956
|
+
(0, import_core31.getIntegrationExchanges)(
|
|
39798
39957
|
publishableKey,
|
|
39799
39958
|
userIpInfo?.alpha2 ? {
|
|
39800
39959
|
country_code: userIpInfo.alpha2,
|
|
@@ -39805,13 +39964,13 @@ function DepositModal({
|
|
|
39805
39964
|
}, [showConnectExchange, open, publishableKey, userIpInfo?.alpha2, userIpInfo?.subdivisionCode]);
|
|
39806
39965
|
const [connectedExchange, setConnectedExchange] = (0, import_react7.useState)(() => {
|
|
39807
39966
|
if (!showConnectExchange) return null;
|
|
39808
|
-
const stored = getStoredIntegrationToken(
|
|
39967
|
+
const stored = getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
39809
39968
|
if (!stored) return null;
|
|
39810
39969
|
return { name: "Coinbase", iconUrl: void 0, balanceUsd: null, isLoading: true };
|
|
39811
39970
|
});
|
|
39812
39971
|
(0, import_react7.useEffect)(() => {
|
|
39813
39972
|
if (!showConnectExchange || !open || view !== "main") return;
|
|
39814
|
-
const stored = getStoredIntegrationToken(
|
|
39973
|
+
const stored = getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
39815
39974
|
if (!stored) {
|
|
39816
39975
|
setConnectedExchange(null);
|
|
39817
39976
|
return;
|
|
@@ -39831,24 +39990,24 @@ function DepositModal({
|
|
|
39831
39990
|
}) : null;
|
|
39832
39991
|
setConnectedExchange((prev) => prev ? { ...prev, balanceUsd, isLoading: false } : null);
|
|
39833
39992
|
};
|
|
39834
|
-
(0,
|
|
39993
|
+
(0, import_core31.getIntegrationHoldings)(import_core31.IntegrationProvider.COINBASE, stored.access_token, publishableKey).then(processHoldings).catch(async () => {
|
|
39835
39994
|
try {
|
|
39836
|
-
const refreshResult = await (0,
|
|
39837
|
-
if (!getStoredIntegrationToken(
|
|
39995
|
+
const refreshResult = await (0, import_core31.refreshIntegrationToken)(stored.access_token, publishableKey);
|
|
39996
|
+
if (!getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE)) return;
|
|
39838
39997
|
setStoredIntegrationToken({
|
|
39839
|
-
integration_provider:
|
|
39998
|
+
integration_provider: import_core31.IntegrationProvider.COINBASE,
|
|
39840
39999
|
access_token: refreshResult.access_token,
|
|
39841
40000
|
expires_at: refreshResult.expires_at
|
|
39842
40001
|
});
|
|
39843
|
-
const retryResult = await (0,
|
|
39844
|
-
|
|
40002
|
+
const retryResult = await (0, import_core31.getIntegrationHoldings)(
|
|
40003
|
+
import_core31.IntegrationProvider.COINBASE,
|
|
39845
40004
|
refreshResult.access_token,
|
|
39846
40005
|
publishableKey
|
|
39847
40006
|
);
|
|
39848
40007
|
processHoldings(retryResult);
|
|
39849
40008
|
} catch {
|
|
39850
|
-
if (!getStoredIntegrationToken(
|
|
39851
|
-
clearStoredIntegrationToken(
|
|
40009
|
+
if (!getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE)) return;
|
|
40010
|
+
clearStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
39852
40011
|
setConnectedExchange(null);
|
|
39853
40012
|
}
|
|
39854
40013
|
});
|
|
@@ -39856,7 +40015,7 @@ function DepositModal({
|
|
|
39856
40015
|
(0, import_react7.useEffect)(() => {
|
|
39857
40016
|
if (!connectedExchange || integrationExchanges.length === 0) return;
|
|
39858
40017
|
const cbExchange = integrationExchanges.find(
|
|
39859
|
-
(e) => e.service_provider ===
|
|
40018
|
+
(e) => e.service_provider === import_core31.IntegrationProvider.COINBASE
|
|
39860
40019
|
);
|
|
39861
40020
|
const iconUrl = cbExchange?.icon_urls?.find((u) => u.format === "svg")?.url || cbExchange?.icon_urls?.find((u) => u.format === "png")?.url || cbExchange?.icon_url;
|
|
39862
40021
|
if (iconUrl && iconUrl !== connectedExchange.iconUrl) {
|
|
@@ -39975,7 +40134,7 @@ function DepositModal({
|
|
|
39975
40134
|
if (view !== "tracker" || !userId) return;
|
|
39976
40135
|
const fetchExecutions = async () => {
|
|
39977
40136
|
try {
|
|
39978
|
-
const response = await (0,
|
|
40137
|
+
const response = await (0, import_core31.queryExecutions)(userId, publishableKey, import_core31.ActionType.Deposit);
|
|
39979
40138
|
const sorted = [...response.data].sort((a, b) => {
|
|
39980
40139
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
39981
40140
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -40031,7 +40190,7 @@ function DepositModal({
|
|
|
40031
40190
|
const template = errors[code] ?? addressValidationMessages.defaultError;
|
|
40032
40191
|
return interpolate(template, metadata);
|
|
40033
40192
|
};
|
|
40034
|
-
const walletsRecipientError = (0,
|
|
40193
|
+
const walletsRecipientError = (0, import_core31.isDepositAddressValidationError)(walletsError) ? walletsError.message : null;
|
|
40035
40194
|
const isRecipientAddressInvalid = isAddressValid === false || walletsRecipientError !== null;
|
|
40036
40195
|
const recipientInvalidMessage = getAddressValidationErrorMessage(
|
|
40037
40196
|
addressFailureMessage ?? walletsRecipientError,
|
|
@@ -40089,11 +40248,11 @@ function DepositModal({
|
|
|
40089
40248
|
if (view === "wallet_connect" && sessionOpenedFromMenu) setView("main");
|
|
40090
40249
|
};
|
|
40091
40250
|
const handleExchangeDisconnect = () => {
|
|
40092
|
-
const stored = getStoredIntegrationToken(
|
|
40251
|
+
const stored = getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
40093
40252
|
if (stored) {
|
|
40094
|
-
(0,
|
|
40253
|
+
(0, import_core31.revokeIntegrationToken)(stored.access_token, publishableKey);
|
|
40095
40254
|
}
|
|
40096
|
-
clearStoredIntegrationToken(
|
|
40255
|
+
clearStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
40097
40256
|
setConnectedExchange(null);
|
|
40098
40257
|
if (view === "coinbase_connect" && sessionOpenedFromMenu) setView("main");
|
|
40099
40258
|
};
|
|
@@ -40106,8 +40265,10 @@ function DepositModal({
|
|
|
40106
40265
|
const beginJourney = (0, import_react7.useCallback)(() => {
|
|
40107
40266
|
journeySessionIdRef.current = startSession();
|
|
40108
40267
|
journeyActiveRef.current = true;
|
|
40268
|
+
journeyExternalUserIdRef.current = userId;
|
|
40269
|
+
setUserId(null);
|
|
40109
40270
|
track("widget_opened", { flow_type: "deposit" });
|
|
40110
|
-
}, [startSession, track]);
|
|
40271
|
+
}, [startSession, track, setUserId, userId]);
|
|
40111
40272
|
const handleClose = () => {
|
|
40112
40273
|
finalizeJourney();
|
|
40113
40274
|
onOpenChange(false);
|
|
@@ -40132,6 +40293,11 @@ function DepositModal({
|
|
|
40132
40293
|
}
|
|
40133
40294
|
beginJourney();
|
|
40134
40295
|
}, [open]);
|
|
40296
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
40297
|
+
if (!open || journeyExternalUserIdRef.current === userId) return;
|
|
40298
|
+
journeyExternalUserIdRef.current = userId;
|
|
40299
|
+
setUserId(null);
|
|
40300
|
+
}, [open, userId, setUserId]);
|
|
40135
40301
|
(0, import_react7.useLayoutEffect)(() => {
|
|
40136
40302
|
if (!open) return;
|
|
40137
40303
|
if (resetViewTimeoutRef.current) {
|
|
@@ -41043,6 +41209,7 @@ function DepositModal({
|
|
|
41043
41209
|
destinationChainType,
|
|
41044
41210
|
destinationChainId,
|
|
41045
41211
|
destinationTokenAddress,
|
|
41212
|
+
contractCalls,
|
|
41046
41213
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
41047
41214
|
view: cashAppView,
|
|
41048
41215
|
onViewChange: setCashAppView,
|
|
@@ -41130,9 +41297,9 @@ var BuyWithGooglePay = React41.forwardRef(
|
|
|
41130
41297
|
);
|
|
41131
41298
|
BuyWithGooglePay.displayName = "BuyWithGooglePay";
|
|
41132
41299
|
var WALLET_CONNECTION_TYPES2 = {
|
|
41133
|
-
started:
|
|
41134
|
-
connected:
|
|
41135
|
-
failed:
|
|
41300
|
+
started: import_core44.CheckoutEventType.WALLET_CONNECTION_STARTED,
|
|
41301
|
+
connected: import_core44.CheckoutEventType.WALLET_CONNECTED,
|
|
41302
|
+
failed: import_core44.CheckoutEventType.WALLET_CONNECTION_FAILED
|
|
41136
41303
|
};
|
|
41137
41304
|
function checkoutMethodFromAnalytics(method) {
|
|
41138
41305
|
if (method !== "transfer_crypto" && method !== "transfer" && method !== "wallet_connect") {
|
|
@@ -41158,7 +41325,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41158
41325
|
if (event.event === "flow_started") {
|
|
41159
41326
|
onEventRef.current?.({
|
|
41160
41327
|
...base,
|
|
41161
|
-
type:
|
|
41328
|
+
type: import_core44.CheckoutEventType.FLOW_STARTED,
|
|
41162
41329
|
...withMethod,
|
|
41163
41330
|
data: {
|
|
41164
41331
|
object: {
|
|
@@ -41186,7 +41353,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41186
41353
|
case "token":
|
|
41187
41354
|
onEventRef.current?.({
|
|
41188
41355
|
...base,
|
|
41189
|
-
type:
|
|
41356
|
+
type: import_core44.CheckoutEventType.TOKEN_SELECTED,
|
|
41190
41357
|
...withMethod,
|
|
41191
41358
|
data: { object: selection.data }
|
|
41192
41359
|
});
|
|
@@ -41194,7 +41361,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41194
41361
|
case "wallet":
|
|
41195
41362
|
onEventRef.current?.({
|
|
41196
41363
|
...base,
|
|
41197
|
-
type:
|
|
41364
|
+
type: import_core44.CheckoutEventType.WALLET_SELECTED,
|
|
41198
41365
|
...withMethod,
|
|
41199
41366
|
data: { object: selection.data }
|
|
41200
41367
|
});
|
|
@@ -41211,9 +41378,9 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41211
41378
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
41212
41379
|
function usePaymentIntent(params) {
|
|
41213
41380
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
41214
|
-
return (0,
|
|
41381
|
+
return (0, import_react_query19.useQuery)({
|
|
41215
41382
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
41216
|
-
queryFn: () => (0,
|
|
41383
|
+
queryFn: () => (0, import_core45.retrievePaymentIntent)(clientSecret, publishableKey),
|
|
41217
41384
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
41218
41385
|
staleTime: 0,
|
|
41219
41386
|
refetchInterval: (query) => {
|
|
@@ -41328,8 +41495,8 @@ function CheckoutModal({
|
|
|
41328
41495
|
flow_type: "checkout"
|
|
41329
41496
|
});
|
|
41330
41497
|
emitEvent({
|
|
41331
|
-
id: (0,
|
|
41332
|
-
type:
|
|
41498
|
+
id: (0, import_core46.generatePrefixedKSUID)("sevt"),
|
|
41499
|
+
type: import_core46.CheckoutEventType.METHOD_SELECTED,
|
|
41333
41500
|
created: Math.floor(Date.now() / 1e3),
|
|
41334
41501
|
sessionId: getSessionId() ?? "",
|
|
41335
41502
|
method,
|
|
@@ -41347,8 +41514,8 @@ function CheckoutModal({
|
|
|
41347
41514
|
});
|
|
41348
41515
|
onCheckoutError?.(error);
|
|
41349
41516
|
emitEvent({
|
|
41350
|
-
id: (0,
|
|
41351
|
-
type:
|
|
41517
|
+
id: (0, import_core46.generatePrefixedKSUID)("sevt"),
|
|
41518
|
+
type: import_core46.CheckoutEventType.FLOW_FAILED,
|
|
41352
41519
|
created: Math.floor(Date.now() / 1e3),
|
|
41353
41520
|
sessionId: journeySessionIdRef.current ?? getSessionId() ?? "",
|
|
41354
41521
|
method: error.method,
|
|
@@ -41378,14 +41545,17 @@ function CheckoutModal({
|
|
|
41378
41545
|
flowCompletedRef.current = true;
|
|
41379
41546
|
track("flow_completed", {
|
|
41380
41547
|
flow_type: "checkout",
|
|
41548
|
+
// Checkout has no direct execution; the intent is what a funnel
|
|
41549
|
+
// session joins back to.
|
|
41550
|
+
payment_intent_id: data.paymentIntentId,
|
|
41381
41551
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
41382
41552
|
});
|
|
41383
41553
|
}
|
|
41384
41554
|
if (isSucceeded && richIntent) {
|
|
41385
41555
|
const createdSec = data.paymentIntent?.updated_at ? Math.floor(new Date(data.paymentIntent.updated_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3);
|
|
41386
41556
|
emitEvent({
|
|
41387
|
-
id: (0,
|
|
41388
|
-
type:
|
|
41557
|
+
id: (0, import_core46.generatePrefixedKSUID)("sevt"),
|
|
41558
|
+
type: import_core46.CheckoutEventType.PAYMENT_INTENT_SUCCEEDED,
|
|
41389
41559
|
// A poll can land after the journey ends, when getSessionId() is
|
|
41390
41560
|
// either empty or already another flow's. The payment belongs to
|
|
41391
41561
|
// the journey that started it.
|
|
@@ -41598,7 +41768,7 @@ function CheckoutModal({
|
|
|
41598
41768
|
journeySessionIdRef.current = startSession();
|
|
41599
41769
|
journeyActiveRef.current = true;
|
|
41600
41770
|
flowCompletedRef.current = false;
|
|
41601
|
-
setUserId(null);
|
|
41771
|
+
setUserId(paymentIntentUserId ?? null);
|
|
41602
41772
|
track("widget_opened", { flow_type: "checkout" });
|
|
41603
41773
|
if (resetViewTimeoutRef.current) {
|
|
41604
41774
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -42038,9 +42208,9 @@ function CheckoutModal({
|
|
|
42038
42208
|
) }) });
|
|
42039
42209
|
}
|
|
42040
42210
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
42041
|
-
return (0,
|
|
42211
|
+
return (0, import_react_query20.useQuery)({
|
|
42042
42212
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
42043
|
-
queryFn: () => (0,
|
|
42213
|
+
queryFn: () => (0, import_core47.getSupportedDestinationTokens)(publishableKey),
|
|
42044
42214
|
staleTime: 1e3 * 60 * 5,
|
|
42045
42215
|
gcTime: 1e3 * 60 * 30,
|
|
42046
42216
|
refetchOnMount: false,
|
|
@@ -42076,7 +42246,7 @@ function useSourceTokenValidation(params) {
|
|
|
42076
42246
|
enabled = true
|
|
42077
42247
|
} = params;
|
|
42078
42248
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
42079
|
-
return (0,
|
|
42249
|
+
return (0, import_react_query21.useQuery)({
|
|
42080
42250
|
queryKey: [
|
|
42081
42251
|
"unifold",
|
|
42082
42252
|
"sourceTokenValidation",
|
|
@@ -42086,7 +42256,7 @@ function useSourceTokenValidation(params) {
|
|
|
42086
42256
|
publishableKey
|
|
42087
42257
|
],
|
|
42088
42258
|
queryFn: async () => {
|
|
42089
|
-
const res = await (0,
|
|
42259
|
+
const res = await (0, import_core48.getSupportedDepositTokens)(publishableKey);
|
|
42090
42260
|
let matchedMinUsd = null;
|
|
42091
42261
|
let matchedProcessingTime = null;
|
|
42092
42262
|
let matchedSlippage = null;
|
|
@@ -42127,7 +42297,7 @@ function useSourceTokenValidation(params) {
|
|
|
42127
42297
|
function useAddressBalance(params) {
|
|
42128
42298
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
42129
42299
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
42130
|
-
return (0,
|
|
42300
|
+
return (0, import_react_query22.useQuery)({
|
|
42131
42301
|
queryKey: [
|
|
42132
42302
|
"unifold",
|
|
42133
42303
|
"addressBalance",
|
|
@@ -42138,7 +42308,7 @@ function useAddressBalance(params) {
|
|
|
42138
42308
|
publishableKey
|
|
42139
42309
|
],
|
|
42140
42310
|
queryFn: async () => {
|
|
42141
|
-
const res = await (0,
|
|
42311
|
+
const res = await (0, import_core49.getAddressBalance)(
|
|
42142
42312
|
address,
|
|
42143
42313
|
chainType,
|
|
42144
42314
|
chainId,
|
|
@@ -42182,16 +42352,18 @@ function useAddressBalance(params) {
|
|
|
42182
42352
|
});
|
|
42183
42353
|
}
|
|
42184
42354
|
function useExecutions(userId, publishableKey, options) {
|
|
42185
|
-
const actionType = options?.actionType ??
|
|
42186
|
-
|
|
42355
|
+
const actionType = options?.actionType ?? import_core50.ActionType.Deposit;
|
|
42356
|
+
const query = (0, import_react_query23.useQuery)({
|
|
42187
42357
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
42188
|
-
queryFn: () => (0,
|
|
42358
|
+
queryFn: () => (0, import_core50.queryExecutions)(userId, publishableKey, actionType),
|
|
42189
42359
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
42190
42360
|
refetchInterval: options?.refetchInterval ?? 3e3,
|
|
42191
42361
|
staleTime: 0,
|
|
42192
42362
|
gcTime: 1e3 * 60 * 5,
|
|
42193
42363
|
refetchOnWindowFocus: false
|
|
42194
42364
|
});
|
|
42365
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
42366
|
+
return query;
|
|
42195
42367
|
}
|
|
42196
42368
|
var POLL_INTERVAL_MS4 = 2500;
|
|
42197
42369
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -42215,15 +42387,15 @@ function useWithdrawPolling({
|
|
|
42215
42387
|
const journeySessionId = () => sessionIdRef.current || (getSessionId() ?? "");
|
|
42216
42388
|
const executionCreatedSec = (execution) => execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3);
|
|
42217
42389
|
const createExecutionSuccessEvent = (execution) => ({
|
|
42218
|
-
id: (0,
|
|
42219
|
-
type:
|
|
42390
|
+
id: (0, import_core51.generatePrefixedKSUID)("sevt"),
|
|
42391
|
+
type: import_core51.WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
42220
42392
|
created: executionCreatedSec(execution),
|
|
42221
42393
|
sessionId: journeySessionId(),
|
|
42222
42394
|
data: { object: mapToDirectExecution(execution) }
|
|
42223
42395
|
});
|
|
42224
42396
|
const createExecutionFailedEvent = (execution) => ({
|
|
42225
|
-
id: (0,
|
|
42226
|
-
type:
|
|
42397
|
+
id: (0, import_core51.generatePrefixedKSUID)("sevt"),
|
|
42398
|
+
type: import_core51.WithdrawEventType.DIRECT_EXECUTION_FAILED,
|
|
42227
42399
|
created: executionCreatedSec(execution),
|
|
42228
42400
|
sessionId: journeySessionId(),
|
|
42229
42401
|
data: { object: mapToDirectExecution(execution) }
|
|
@@ -42275,7 +42447,7 @@ function useWithdrawPolling({
|
|
|
42275
42447
|
const enabledAt = enabledAtRef.current;
|
|
42276
42448
|
const poll = async () => {
|
|
42277
42449
|
try {
|
|
42278
|
-
const response = await (0,
|
|
42450
|
+
const response = await (0, import_core51.queryExecutions)(userId, publishableKey, import_core51.ActionType.Withdraw);
|
|
42279
42451
|
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
42280
42452
|
const sorted = [...response.data].sort((a, b) => {
|
|
42281
42453
|
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -42283,11 +42455,11 @@ function useWithdrawPolling({
|
|
|
42283
42455
|
return tB - tA;
|
|
42284
42456
|
});
|
|
42285
42457
|
const inProgress = [
|
|
42286
|
-
|
|
42287
|
-
|
|
42288
|
-
|
|
42458
|
+
import_core51.ExecutionStatus.PENDING,
|
|
42459
|
+
import_core51.ExecutionStatus.WAITING,
|
|
42460
|
+
import_core51.ExecutionStatus.DELAYED
|
|
42289
42461
|
];
|
|
42290
|
-
const terminal = [
|
|
42462
|
+
const terminal = [import_core51.ExecutionStatus.SUCCEEDED, import_core51.ExecutionStatus.FAILED];
|
|
42291
42463
|
let target = null;
|
|
42292
42464
|
for (const ex of sorted) {
|
|
42293
42465
|
const t = ex.created_at ? new Date(ex.created_at) : null;
|
|
@@ -42317,7 +42489,7 @@ function useWithdrawPolling({
|
|
|
42317
42489
|
}
|
|
42318
42490
|
return [...list, ex];
|
|
42319
42491
|
});
|
|
42320
|
-
if (ex.status ===
|
|
42492
|
+
if (ex.status === import_core51.ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
42321
42493
|
onSuccessRef.current?.({
|
|
42322
42494
|
message: "Withdrawal completed successfully",
|
|
42323
42495
|
executionId: ex.id,
|
|
@@ -42325,7 +42497,7 @@ function useWithdrawPolling({
|
|
|
42325
42497
|
transaction: ex,
|
|
42326
42498
|
execution: createExecutionSuccessEvent(ex)
|
|
42327
42499
|
});
|
|
42328
|
-
} else if (ex.status ===
|
|
42500
|
+
} else if (ex.status === import_core51.ExecutionStatus.FAILED && prev !== import_core51.ExecutionStatus.FAILED) {
|
|
42329
42501
|
onErrorRef.current?.({
|
|
42330
42502
|
message: "Withdrawal failed",
|
|
42331
42503
|
code: "WITHDRAW_FAILED",
|
|
@@ -42355,7 +42527,7 @@ function useWithdrawPolling({
|
|
|
42355
42527
|
if (!enabled || !depositWalletId) return;
|
|
42356
42528
|
const trigger = async () => {
|
|
42357
42529
|
try {
|
|
42358
|
-
await (0,
|
|
42530
|
+
await (0, import_core51.pollDirectExecutions)({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
42359
42531
|
} catch {
|
|
42360
42532
|
}
|
|
42361
42533
|
};
|
|
@@ -42528,7 +42700,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
42528
42700
|
} = params;
|
|
42529
42701
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
42530
42702
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
42531
|
-
return (0,
|
|
42703
|
+
return (0, import_react_query24.useQuery)({
|
|
42532
42704
|
queryKey: [
|
|
42533
42705
|
"unifold",
|
|
42534
42706
|
"verifyRecipientAddress",
|
|
@@ -42538,7 +42710,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
42538
42710
|
trimmedAddress,
|
|
42539
42711
|
publishableKey
|
|
42540
42712
|
],
|
|
42541
|
-
queryFn: () => (0,
|
|
42713
|
+
queryFn: () => (0, import_core53.verifyRecipientAddress)(
|
|
42542
42714
|
{
|
|
42543
42715
|
chain_type: chainType,
|
|
42544
42716
|
chain_id: chainId,
|
|
@@ -42566,9 +42738,8 @@ function useGetDepositAddress(params) {
|
|
|
42566
42738
|
actionType,
|
|
42567
42739
|
enabled = true
|
|
42568
42740
|
} = params;
|
|
42569
|
-
const { setUserId } = useAnalytics();
|
|
42570
42741
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
42571
|
-
const query = (0,
|
|
42742
|
+
const query = (0, import_react_query25.useQuery)({
|
|
42572
42743
|
queryKey: [
|
|
42573
42744
|
"unifold",
|
|
42574
42745
|
"getDepositAddress",
|
|
@@ -42580,7 +42751,7 @@ function useGetDepositAddress(params) {
|
|
|
42580
42751
|
actionType ?? null,
|
|
42581
42752
|
publishableKey
|
|
42582
42753
|
],
|
|
42583
|
-
queryFn: () => (0,
|
|
42754
|
+
queryFn: () => (0, import_core56.getDepositAddress)(
|
|
42584
42755
|
{
|
|
42585
42756
|
external_user_id: userId,
|
|
42586
42757
|
recipient_address: recipientAddress,
|
|
@@ -42598,11 +42769,7 @@ function useGetDepositAddress(params) {
|
|
|
42598
42769
|
refetchOnWindowFocus: false,
|
|
42599
42770
|
retry: 1
|
|
42600
42771
|
});
|
|
42601
|
-
(
|
|
42602
|
-
if (query.data?.user_id) {
|
|
42603
|
-
setUserId(query.data.user_id);
|
|
42604
|
-
}
|
|
42605
|
-
}, [query.data?.user_id, setUserId]);
|
|
42772
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
42606
42773
|
return query;
|
|
42607
42774
|
}
|
|
42608
42775
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -42638,7 +42805,7 @@ function useHypercoreWithdrawActivation(params) {
|
|
|
42638
42805
|
destinationChainType,
|
|
42639
42806
|
destinationChainId,
|
|
42640
42807
|
destinationTokenAddress,
|
|
42641
|
-
actionType:
|
|
42808
|
+
actionType: import_core55.ActionType.Withdraw,
|
|
42642
42809
|
enabled: enabled && isHypercore(sourceChainId)
|
|
42643
42810
|
});
|
|
42644
42811
|
const depositWalletAddress = (0, import_react43.useMemo)(() => {
|
|
@@ -42938,7 +43105,7 @@ function WithdrawForm({
|
|
|
42938
43105
|
let humanAmount = isMaxed ? balanceData.balanceHuman : toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
42939
43106
|
if (isHypercoreChain(sourceChainId)) {
|
|
42940
43107
|
try {
|
|
42941
|
-
const check = await (0,
|
|
43108
|
+
const check = await (0, import_core52.checkHypercoreActivation)(
|
|
42942
43109
|
{
|
|
42943
43110
|
source_address: senderAddress,
|
|
42944
43111
|
recipient_address: depositWallet.address
|
|
@@ -43394,7 +43561,7 @@ function WithdrawForm({
|
|
|
43394
43561
|
function WithdrawExecutionItem({ execution, onClick }) {
|
|
43395
43562
|
const { colors: colors2, fonts, components } = useTheme();
|
|
43396
43563
|
const { t: strings, locale } = useI18n();
|
|
43397
|
-
const isPending = execution.status ===
|
|
43564
|
+
const isPending = execution.status === import_core57.ExecutionStatus.PENDING || execution.status === import_core57.ExecutionStatus.WAITING || execution.status === import_core57.ExecutionStatus.DELAYED;
|
|
43398
43565
|
const formatDateTime = (timestamp) => {
|
|
43399
43566
|
try {
|
|
43400
43567
|
const date = new Date(timestamp);
|
|
@@ -43441,7 +43608,7 @@ function WithdrawExecutionItem({ execution, onClick }) {
|
|
|
43441
43608
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
43442
43609
|
"img",
|
|
43443
43610
|
{
|
|
43444
|
-
src: execution.destination_token_metadata?.icon_url || (0,
|
|
43611
|
+
src: execution.destination_token_metadata?.icon_url || (0, import_core57.getIconUrl)("/icons/tokens/svg/usdc.svg"),
|
|
43445
43612
|
alt: "Token",
|
|
43446
43613
|
width: 36,
|
|
43447
43614
|
height: 36,
|
|
@@ -43552,9 +43719,9 @@ function WithdrawConfirmingView({
|
|
|
43552
43719
|
const { colors: colors2, fonts, components } = useTheme();
|
|
43553
43720
|
const { t: strings } = useI18n();
|
|
43554
43721
|
const t = strings.withdrawModal.details;
|
|
43555
|
-
const [showButton, setShowButton] = (0,
|
|
43722
|
+
const [showButton, setShowButton] = (0, import_react44.useState)(false);
|
|
43556
43723
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
43557
|
-
(0,
|
|
43724
|
+
(0, import_react44.useEffect)(() => {
|
|
43558
43725
|
if (latestExecution) return;
|
|
43559
43726
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
43560
43727
|
return () => clearTimeout(timer);
|
|
@@ -43712,10 +43879,10 @@ function WithdrawModal({
|
|
|
43712
43879
|
const selection = selectionPayload(event);
|
|
43713
43880
|
if (selection?.kind !== "token") return;
|
|
43714
43881
|
onEventRef.current?.({
|
|
43715
|
-
id: (0,
|
|
43882
|
+
id: (0, import_core58.generatePrefixedKSUID)("sevt"),
|
|
43716
43883
|
created: Math.floor(Date.now() / 1e3),
|
|
43717
43884
|
sessionId: getSessionId() ?? "",
|
|
43718
|
-
type:
|
|
43885
|
+
type: import_core58.WithdrawEventType.TOKEN_SELECTED,
|
|
43719
43886
|
data: { object: selection.data }
|
|
43720
43887
|
});
|
|
43721
43888
|
}),
|
|
@@ -43723,12 +43890,16 @@ function WithdrawModal({
|
|
|
43723
43890
|
);
|
|
43724
43891
|
const journeyActiveRef = (0, import_react40.useRef)(false);
|
|
43725
43892
|
const journeySessionIdRef = (0, import_react40.useRef)(void 0);
|
|
43893
|
+
const journeyExternalUserIdRef = (0, import_react40.useRef)(void 0);
|
|
43726
43894
|
const onWithdrawSuccessFor = (0, import_react40.useCallback)(
|
|
43727
43895
|
(data) => {
|
|
43728
43896
|
const execution = data.execution?.data.object;
|
|
43729
43897
|
track("flow_completed", {
|
|
43730
43898
|
flow_type: "withdraw",
|
|
43731
43899
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
43900
|
+
// The one high-cardinality field we do send: the join key from a
|
|
43901
|
+
// funnel session back to the execution row it produced.
|
|
43902
|
+
execution_id: data.executionId ?? execution?.id,
|
|
43732
43903
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
43733
43904
|
status: execution?.status,
|
|
43734
43905
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -43749,6 +43920,7 @@ function WithdrawModal({
|
|
|
43749
43920
|
track("flow_failed", {
|
|
43750
43921
|
flow_type: "withdraw",
|
|
43751
43922
|
error_code: error.code,
|
|
43923
|
+
execution_id: execution?.id,
|
|
43752
43924
|
failure_reason: execution?.failureReason ?? void 0,
|
|
43753
43925
|
status: execution?.status,
|
|
43754
43926
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -43822,6 +43994,7 @@ function WithdrawModal({
|
|
|
43822
43994
|
) ?? null : null;
|
|
43823
43995
|
const [view, setView] = (0, import_react40.useState)("form");
|
|
43824
43996
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react40.useState)();
|
|
43997
|
+
const withdrawDepositWalletIdRef = (0, import_react40.useRef)(void 0);
|
|
43825
43998
|
const [selectedExecution, setSelectedExecution] = (0, import_react40.useState)(null);
|
|
43826
43999
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react40.useState)(null);
|
|
43827
44000
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -43833,21 +44006,21 @@ function WithdrawModal({
|
|
|
43833
44006
|
onWithdrawError: onWithdrawErrorFor
|
|
43834
44007
|
});
|
|
43835
44008
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
43836
|
-
actionType:
|
|
44009
|
+
actionType: import_core58.ActionType.Withdraw,
|
|
43837
44010
|
enabled: open,
|
|
43838
44011
|
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
43839
44012
|
});
|
|
43840
44013
|
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
43841
44014
|
const handleDepositWalletCreation = (0, import_react40.useCallback)(
|
|
43842
44015
|
async (params) => {
|
|
43843
|
-
const response = await (0,
|
|
44016
|
+
const response = await (0, import_core58.createDepositAddress)(
|
|
43844
44017
|
{
|
|
43845
44018
|
external_user_id: externalUserId,
|
|
43846
44019
|
destination_chain_type: params.destinationChainType,
|
|
43847
44020
|
destination_chain_id: params.destinationChainId,
|
|
43848
44021
|
destination_token_address: params.destinationTokenAddress,
|
|
43849
44022
|
recipient_address: params.recipientAddress,
|
|
43850
|
-
action_type:
|
|
44023
|
+
action_type: import_core58.ActionType.Withdraw,
|
|
43851
44024
|
source_chain_type: sourceChainType
|
|
43852
44025
|
},
|
|
43853
44026
|
publishableKey
|
|
@@ -43855,10 +44028,11 @@ function WithdrawModal({
|
|
|
43855
44028
|
if (response.user_id) {
|
|
43856
44029
|
setUserId(response.user_id);
|
|
43857
44030
|
}
|
|
43858
|
-
const depositWallet = (0,
|
|
44031
|
+
const depositWallet = (0, import_core58.getWalletByChainType)(response.data, sourceChainType);
|
|
43859
44032
|
if (!depositWallet) {
|
|
43860
44033
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
43861
44034
|
}
|
|
44035
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
43862
44036
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
43863
44037
|
return depositWallet;
|
|
43864
44038
|
},
|
|
@@ -43878,11 +44052,16 @@ function WithdrawModal({
|
|
|
43878
44052
|
currency: tokenData?.currency,
|
|
43879
44053
|
amount: txInfo.amount,
|
|
43880
44054
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
43881
|
-
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
|
|
44055
|
+
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
|
|
44056
|
+
// The execution doesn't exist yet — it's created when the user's send
|
|
44057
|
+
// lands on the withdraw deposit wallet, and carries this id. So a
|
|
44058
|
+
// withdrawal confirmed but never completed still joins to whatever
|
|
44059
|
+
// did (or didn't) follow on that wallet.
|
|
44060
|
+
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
43882
44061
|
});
|
|
43883
44062
|
emitEvent({
|
|
43884
|
-
id: (0,
|
|
43885
|
-
type:
|
|
44063
|
+
id: (0, import_core58.generatePrefixedKSUID)("sevt"),
|
|
44064
|
+
type: import_core58.WithdrawEventType.FLOW_STARTED,
|
|
43886
44065
|
created: Math.floor(Date.now() / 1e3),
|
|
43887
44066
|
sessionId: getSessionId() ?? "",
|
|
43888
44067
|
data: {
|
|
@@ -43912,8 +44091,10 @@ function WithdrawModal({
|
|
|
43912
44091
|
const beginJourney = (0, import_react40.useCallback)(() => {
|
|
43913
44092
|
journeySessionIdRef.current = startSession();
|
|
43914
44093
|
journeyActiveRef.current = true;
|
|
44094
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
44095
|
+
setUserId(null);
|
|
43915
44096
|
track("widget_opened", { flow_type: "withdraw" });
|
|
43916
|
-
}, [startSession, track]);
|
|
44097
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
43917
44098
|
const handleClose = (0, import_react40.useCallback)(() => {
|
|
43918
44099
|
finalizeJourney();
|
|
43919
44100
|
onOpenChange(false);
|
|
@@ -43922,6 +44103,7 @@ function WithdrawModal({
|
|
|
43922
44103
|
setView("form");
|
|
43923
44104
|
setSelectedExecution(null);
|
|
43924
44105
|
setSubmittedTxInfo(null);
|
|
44106
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
43925
44107
|
setWithdrawDepositWalletId(void 0);
|
|
43926
44108
|
resetViewTimeoutRef.current = null;
|
|
43927
44109
|
}, 200);
|
|
@@ -43939,8 +44121,14 @@ function WithdrawModal({
|
|
|
43939
44121
|
setView("form");
|
|
43940
44122
|
setSelectedExecution(null);
|
|
43941
44123
|
setSubmittedTxInfo(null);
|
|
44124
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
43942
44125
|
setWithdrawDepositWalletId(void 0);
|
|
43943
44126
|
}, [open]);
|
|
44127
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
44128
|
+
if (!open || journeyExternalUserIdRef.current === externalUserId) return;
|
|
44129
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
44130
|
+
setUserId(null);
|
|
44131
|
+
}, [open, externalUserId, setUserId]);
|
|
43944
44132
|
(0, import_react40.useEffect)(
|
|
43945
44133
|
() => () => {
|
|
43946
44134
|
if (journeyActiveRef.current) {
|
|
@@ -44175,7 +44363,7 @@ function WithdrawModal({
|
|
|
44175
44363
|
}
|
|
44176
44364
|
|
|
44177
44365
|
// src/provider.tsx
|
|
44178
|
-
var
|
|
44366
|
+
var import_core59 = require("@unifold/core");
|
|
44179
44367
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
44180
44368
|
function UnifoldProvider({
|
|
44181
44369
|
children,
|
|
@@ -44183,32 +44371,32 @@ function UnifoldProvider({
|
|
|
44183
44371
|
queryClient,
|
|
44184
44372
|
config
|
|
44185
44373
|
}) {
|
|
44186
|
-
const [isOpen, setIsOpen] = (0,
|
|
44187
|
-
const [depositConfig, setDepositConfig] = (0,
|
|
44188
|
-
const [isCheckoutOpen, setIsCheckoutOpen] = (0,
|
|
44189
|
-
const [checkoutConfig, setCheckoutConfig] = (0,
|
|
44190
|
-
const [isWithdrawOpen, setIsWithdrawOpen] = (0,
|
|
44191
|
-
const [withdrawConfig, setWithdrawConfig] = (0,
|
|
44192
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
44374
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(false);
|
|
44375
|
+
const [depositConfig, setDepositConfig] = (0, import_react46.useState)(null);
|
|
44376
|
+
const [isCheckoutOpen, setIsCheckoutOpen] = (0, import_react46.useState)(false);
|
|
44377
|
+
const [checkoutConfig, setCheckoutConfig] = (0, import_react46.useState)(null);
|
|
44378
|
+
const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react46.useState)(false);
|
|
44379
|
+
const [withdrawConfig, setWithdrawConfig] = (0, import_react46.useState)(null);
|
|
44380
|
+
const [resolvedTheme, setResolvedTheme] = import_react46.default.useState("dark");
|
|
44193
44381
|
const incidentBannerEnabled = config?.notifications?.incidentBanner;
|
|
44194
|
-
const tracker = (0,
|
|
44382
|
+
const tracker = (0, import_react46.useMemo)(
|
|
44195
44383
|
() => createEventTracker({
|
|
44196
44384
|
publishableKey,
|
|
44197
|
-
endpoint: `${(0,
|
|
44385
|
+
endpoint: `${(0, import_core59.getApiBaseUrl)()}/v1/public/events`
|
|
44198
44386
|
}),
|
|
44199
44387
|
[publishableKey]
|
|
44200
44388
|
);
|
|
44201
|
-
(0,
|
|
44389
|
+
(0, import_react46.useEffect)(() => {
|
|
44202
44390
|
return () => {
|
|
44203
44391
|
tracker?.destroy();
|
|
44204
44392
|
};
|
|
44205
44393
|
}, [tracker]);
|
|
44206
|
-
(0,
|
|
44394
|
+
(0, import_react46.useEffect)(() => {
|
|
44207
44395
|
if (publishableKey) {
|
|
44208
|
-
(0,
|
|
44396
|
+
(0, import_core59.setApiConfig)({ publishableKey });
|
|
44209
44397
|
}
|
|
44210
44398
|
}, [publishableKey]);
|
|
44211
|
-
|
|
44399
|
+
import_react46.default.useEffect(() => {
|
|
44212
44400
|
const appearance = config?.appearance || "dark";
|
|
44213
44401
|
if (appearance === "auto") {
|
|
44214
44402
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -44223,17 +44411,17 @@ function UnifoldProvider({
|
|
|
44223
44411
|
setResolvedTheme(appearance);
|
|
44224
44412
|
}
|
|
44225
44413
|
}, [config?.appearance]);
|
|
44226
|
-
const depositPromiseRef =
|
|
44227
|
-
const depositConfigRef =
|
|
44414
|
+
const depositPromiseRef = import_react46.default.useRef(null);
|
|
44415
|
+
const depositConfigRef = import_react46.default.useRef(null);
|
|
44228
44416
|
depositConfigRef.current = depositConfig;
|
|
44229
|
-
const closeTimeoutRef =
|
|
44230
|
-
const closeGuardRef =
|
|
44231
|
-
const withdrawPromiseRef =
|
|
44232
|
-
const withdrawConfigRef =
|
|
44417
|
+
const closeTimeoutRef = import_react46.default.useRef(null);
|
|
44418
|
+
const closeGuardRef = import_react46.default.useRef(false);
|
|
44419
|
+
const withdrawPromiseRef = import_react46.default.useRef(null);
|
|
44420
|
+
const withdrawConfigRef = import_react46.default.useRef(null);
|
|
44233
44421
|
withdrawConfigRef.current = withdrawConfig;
|
|
44234
|
-
const withdrawCloseTimeoutRef =
|
|
44235
|
-
const withdrawCloseGuardRef =
|
|
44236
|
-
const beginDeposit = (0,
|
|
44422
|
+
const withdrawCloseTimeoutRef = import_react46.default.useRef(null);
|
|
44423
|
+
const withdrawCloseGuardRef = import_react46.default.useRef(false);
|
|
44424
|
+
const beginDeposit = (0, import_react46.useCallback)((config2) => {
|
|
44237
44425
|
if (closeTimeoutRef.current) {
|
|
44238
44426
|
clearTimeout(closeTimeoutRef.current);
|
|
44239
44427
|
closeTimeoutRef.current = null;
|
|
@@ -44268,7 +44456,7 @@ function UnifoldProvider({
|
|
|
44268
44456
|
setIsOpen(true);
|
|
44269
44457
|
return promise;
|
|
44270
44458
|
}, []);
|
|
44271
|
-
const closeDeposit = (0,
|
|
44459
|
+
const closeDeposit = (0, import_react46.useCallback)(() => {
|
|
44272
44460
|
if (closeGuardRef.current) {
|
|
44273
44461
|
return;
|
|
44274
44462
|
}
|
|
@@ -44290,7 +44478,7 @@ function UnifoldProvider({
|
|
|
44290
44478
|
closeTimeoutRef.current = null;
|
|
44291
44479
|
}, 200);
|
|
44292
44480
|
}, []);
|
|
44293
|
-
const handleDepositSuccess = (0,
|
|
44481
|
+
const handleDepositSuccess = (0, import_react46.useCallback)(
|
|
44294
44482
|
(data) => {
|
|
44295
44483
|
if (depositConfig?.onSuccess) {
|
|
44296
44484
|
depositConfig.onSuccess(data);
|
|
@@ -44302,7 +44490,7 @@ function UnifoldProvider({
|
|
|
44302
44490
|
},
|
|
44303
44491
|
[depositConfig]
|
|
44304
44492
|
);
|
|
44305
|
-
const handleDepositError = (0,
|
|
44493
|
+
const handleDepositError = (0, import_react46.useCallback)(
|
|
44306
44494
|
(error) => {
|
|
44307
44495
|
console.error("[UnifoldProvider] Deposit error:", error);
|
|
44308
44496
|
if (depositConfig?.onError) {
|
|
@@ -44315,12 +44503,12 @@ function UnifoldProvider({
|
|
|
44315
44503
|
},
|
|
44316
44504
|
[depositConfig]
|
|
44317
44505
|
);
|
|
44318
|
-
const checkoutPromiseRef =
|
|
44319
|
-
const checkoutConfigRef =
|
|
44506
|
+
const checkoutPromiseRef = import_react46.default.useRef(null);
|
|
44507
|
+
const checkoutConfigRef = import_react46.default.useRef(null);
|
|
44320
44508
|
checkoutConfigRef.current = checkoutConfig;
|
|
44321
|
-
const checkoutCloseTimeoutRef =
|
|
44322
|
-
const checkoutCloseGuardRef =
|
|
44323
|
-
const beginCheckout = (0,
|
|
44509
|
+
const checkoutCloseTimeoutRef = import_react46.default.useRef(null);
|
|
44510
|
+
const checkoutCloseGuardRef = import_react46.default.useRef(false);
|
|
44511
|
+
const beginCheckout = (0, import_react46.useCallback)((config2) => {
|
|
44324
44512
|
if (checkoutCloseTimeoutRef.current) {
|
|
44325
44513
|
clearTimeout(checkoutCloseTimeoutRef.current);
|
|
44326
44514
|
checkoutCloseTimeoutRef.current = null;
|
|
@@ -44345,7 +44533,7 @@ function UnifoldProvider({
|
|
|
44345
44533
|
setIsCheckoutOpen(true);
|
|
44346
44534
|
return promise;
|
|
44347
44535
|
}, []);
|
|
44348
|
-
const closeCheckout = (0,
|
|
44536
|
+
const closeCheckout = (0, import_react46.useCallback)(() => {
|
|
44349
44537
|
if (checkoutCloseGuardRef.current) {
|
|
44350
44538
|
return;
|
|
44351
44539
|
}
|
|
@@ -44367,7 +44555,7 @@ function UnifoldProvider({
|
|
|
44367
44555
|
checkoutCloseTimeoutRef.current = null;
|
|
44368
44556
|
}, 200);
|
|
44369
44557
|
}, []);
|
|
44370
|
-
const handleCheckoutSuccess = (0,
|
|
44558
|
+
const handleCheckoutSuccess = (0, import_react46.useCallback)(
|
|
44371
44559
|
(data) => {
|
|
44372
44560
|
if (checkoutConfig?.onSuccess) {
|
|
44373
44561
|
checkoutConfig.onSuccess(data);
|
|
@@ -44379,7 +44567,7 @@ function UnifoldProvider({
|
|
|
44379
44567
|
},
|
|
44380
44568
|
[checkoutConfig]
|
|
44381
44569
|
);
|
|
44382
|
-
const handleCheckoutError = (0,
|
|
44570
|
+
const handleCheckoutError = (0, import_react46.useCallback)(
|
|
44383
44571
|
(error) => {
|
|
44384
44572
|
console.error("[UnifoldProvider] Checkout error:", error);
|
|
44385
44573
|
if (checkoutConfig?.onError) {
|
|
@@ -44392,7 +44580,7 @@ function UnifoldProvider({
|
|
|
44392
44580
|
},
|
|
44393
44581
|
[checkoutConfig]
|
|
44394
44582
|
);
|
|
44395
|
-
const beginWithdraw = (0,
|
|
44583
|
+
const beginWithdraw = (0, import_react46.useCallback)((config2) => {
|
|
44396
44584
|
if (withdrawCloseTimeoutRef.current) {
|
|
44397
44585
|
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
44398
44586
|
withdrawCloseTimeoutRef.current = null;
|
|
@@ -44417,7 +44605,7 @@ function UnifoldProvider({
|
|
|
44417
44605
|
setIsWithdrawOpen(true);
|
|
44418
44606
|
return promise;
|
|
44419
44607
|
}, []);
|
|
44420
|
-
const closeWithdraw = (0,
|
|
44608
|
+
const closeWithdraw = (0, import_react46.useCallback)(() => {
|
|
44421
44609
|
if (withdrawCloseGuardRef.current) {
|
|
44422
44610
|
return;
|
|
44423
44611
|
}
|
|
@@ -44439,7 +44627,7 @@ function UnifoldProvider({
|
|
|
44439
44627
|
withdrawCloseTimeoutRef.current = null;
|
|
44440
44628
|
}, 200);
|
|
44441
44629
|
}, []);
|
|
44442
|
-
const handleWithdrawSuccess = (0,
|
|
44630
|
+
const handleWithdrawSuccess = (0, import_react46.useCallback)((data) => {
|
|
44443
44631
|
if (withdrawConfigRef.current?.onSuccess) {
|
|
44444
44632
|
withdrawConfigRef.current.onSuccess(data);
|
|
44445
44633
|
}
|
|
@@ -44448,7 +44636,7 @@ function UnifoldProvider({
|
|
|
44448
44636
|
withdrawPromiseRef.current = null;
|
|
44449
44637
|
}
|
|
44450
44638
|
}, []);
|
|
44451
|
-
const handleWithdrawError = (0,
|
|
44639
|
+
const handleWithdrawError = (0, import_react46.useCallback)((error) => {
|
|
44452
44640
|
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
44453
44641
|
if (withdrawConfigRef.current?.onError) {
|
|
44454
44642
|
withdrawConfigRef.current.onError(error);
|
|
@@ -44458,7 +44646,7 @@ function UnifoldProvider({
|
|
|
44458
44646
|
withdrawPromiseRef.current = null;
|
|
44459
44647
|
}
|
|
44460
44648
|
}, []);
|
|
44461
|
-
const contextValue = (0,
|
|
44649
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
44462
44650
|
() => ({
|
|
44463
44651
|
beginDeposit,
|
|
44464
44652
|
closeDeposit,
|
|
@@ -44597,10 +44785,10 @@ function UnifoldProvider({
|
|
|
44597
44785
|
}
|
|
44598
44786
|
) }) }) }) });
|
|
44599
44787
|
}
|
|
44600
|
-
var ConnectContext =
|
|
44788
|
+
var ConnectContext = import_react46.default.createContext(null);
|
|
44601
44789
|
function useUnifold() {
|
|
44602
44790
|
const baseContext = (0, import_react_provider.useUnifold)();
|
|
44603
|
-
const connectContext =
|
|
44791
|
+
const connectContext = import_react46.default.useContext(ConnectContext);
|
|
44604
44792
|
if (typeof window === "undefined") {
|
|
44605
44793
|
return {
|
|
44606
44794
|
publishableKey: "",
|
|
@@ -44634,7 +44822,7 @@ function useAllowedCountry2() {
|
|
|
44634
44822
|
}
|
|
44635
44823
|
|
|
44636
44824
|
// src/index.ts
|
|
44637
|
-
var
|
|
44825
|
+
var import_core60 = require("@unifold/core");
|
|
44638
44826
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44639
44827
|
0 && (module.exports = {
|
|
44640
44828
|
ActionType,
|