@unifold/ui-web 0.1.77 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +294 -92
- package/dist/index.mjs +294 -92
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -39598,7 +39598,7 @@ var require_modern2 = __commonJS({
|
|
|
39598
39598
|
});
|
|
39599
39599
|
|
|
39600
39600
|
// src/unifold.tsx
|
|
39601
|
-
var
|
|
39601
|
+
var import_react48 = __toESM(require_react());
|
|
39602
39602
|
var import_client = __toESM(require_client());
|
|
39603
39603
|
|
|
39604
39604
|
// ../connect-react/dist/index.mjs
|
|
@@ -39756,7 +39756,7 @@ function generateKSUID() {
|
|
|
39756
39756
|
function generatePrefixedKSUID(prefix) {
|
|
39757
39757
|
return `${prefix}_${generateKSUID()}`;
|
|
39758
39758
|
}
|
|
39759
|
-
var SDK_VERSION = true ? "0.1.
|
|
39759
|
+
var SDK_VERSION = true ? "0.1.78" : "0.0.0-dev";
|
|
39760
39760
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
39761
39761
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
39762
39762
|
function detectRuntime() {
|
|
@@ -41582,8 +41582,8 @@ var OnrampSessionEventType = ((OnrampSessionEventType2) => {
|
|
|
41582
41582
|
})(OnrampSessionEventType || {});
|
|
41583
41583
|
|
|
41584
41584
|
// ../connect-react/dist/index.mjs
|
|
41585
|
-
var import_react8 = __toESM(require_react(), 1);
|
|
41586
41585
|
var import_react_query3 = __toESM(require_modern2(), 1);
|
|
41586
|
+
var import_react8 = __toESM(require_react(), 1);
|
|
41587
41587
|
var React52 = __toESM(require_react(), 1);
|
|
41588
41588
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
41589
41589
|
var import_react9 = __toESM(require_react(), 1);
|
|
@@ -41769,14 +41769,13 @@ var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
|
|
|
41769
41769
|
var import_react44 = __toESM(require_react(), 1);
|
|
41770
41770
|
var import_react_query26 = __toESM(require_modern2(), 1);
|
|
41771
41771
|
var import_react45 = __toESM(require_react(), 1);
|
|
41772
|
-
var import_react46 = __toESM(require_react(), 1);
|
|
41773
41772
|
var import_react_query27 = __toESM(require_modern2(), 1);
|
|
41774
41773
|
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
41775
41774
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
41776
|
-
var
|
|
41775
|
+
var import_react46 = __toESM(require_react(), 1);
|
|
41777
41776
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
41778
41777
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
41779
|
-
var
|
|
41778
|
+
var import_react47 = __toESM(require_react(), 1);
|
|
41780
41779
|
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
41781
41780
|
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
41782
41781
|
var __create2 = Object.create;
|
|
@@ -47901,7 +47900,7 @@ function generateKSUID2() {
|
|
|
47901
47900
|
function generatePrefixedKSUID2(prefix) {
|
|
47902
47901
|
return `${prefix}_${generateKSUID2()}`;
|
|
47903
47902
|
}
|
|
47904
|
-
var PACKAGE_VERSION = "0.1.
|
|
47903
|
+
var PACKAGE_VERSION = "0.1.78";
|
|
47905
47904
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
47906
47905
|
var DEFAULT_DEDUP_MS = 500;
|
|
47907
47906
|
var SESSION_PREFIX = "asess";
|
|
@@ -47991,8 +47990,12 @@ var EventTracker = class {
|
|
|
47991
47990
|
}
|
|
47992
47991
|
/**
|
|
47993
47992
|
* Associate subsequent events with an internal Unifold user.id
|
|
47994
|
-
* (`user_<ksuid>`). Pass `null` to clear.
|
|
47995
|
-
*
|
|
47993
|
+
* (`user_<ksuid>`). Pass `null` to clear.
|
|
47994
|
+
*
|
|
47995
|
+
* The tracker is shared across flows and outlives any one journey, so a
|
|
47996
|
+
* journey stamps its own user at the start — with the id if it already
|
|
47997
|
+
* knows one, `null` if it doesn't — rather than inheriting whatever the
|
|
47998
|
+
* previous journey left here.
|
|
47996
47999
|
*/
|
|
47997
48000
|
setUserId(userId) {
|
|
47998
48001
|
this.userId = userId || void 0;
|
|
@@ -48003,8 +48006,8 @@ var EventTracker = class {
|
|
|
48003
48006
|
* {@link EventTracker.endSession} carries it.
|
|
48004
48007
|
*
|
|
48005
48008
|
* Does not touch `userId`: the internal `user_<ksuid>` is attached separately
|
|
48006
|
-
* via {@link EventTracker.setUserId}
|
|
48007
|
-
*
|
|
48009
|
+
* via {@link EventTracker.setUserId}, and persists until the host replaces
|
|
48010
|
+
* it — which the SDK's modals do on every journey start.
|
|
48008
48011
|
*/
|
|
48009
48012
|
startSession() {
|
|
48010
48013
|
this.sessionId = generatePrefixedKSUID2(SESSION_PREFIX);
|
|
@@ -54349,6 +54352,9 @@ var en_default = {
|
|
|
54349
54352
|
transactionBreakdown: "Transaction breakdown",
|
|
54350
54353
|
networkFee: "Network fee",
|
|
54351
54354
|
confirmOrder: "Confirm Order",
|
|
54355
|
+
mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
|
|
54356
|
+
mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
|
|
54357
|
+
mfaEnrollmentSettingsLink: "Open Coinbase security settings",
|
|
54352
54358
|
termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
|
|
54353
54359
|
termsNoticeLink: "terms",
|
|
54354
54360
|
termsNoticeSuffix: "."
|
|
@@ -54479,7 +54485,12 @@ var en_default = {
|
|
|
54479
54485
|
prefix: "By continuing, you agree to Coinbase's ",
|
|
54480
54486
|
separator: ", ",
|
|
54481
54487
|
lastSeparator: ", and ",
|
|
54482
|
-
suffix: ".
|
|
54488
|
+
suffix: ".",
|
|
54489
|
+
agreements: {
|
|
54490
|
+
guest_checkout_terms: "Terms of Service",
|
|
54491
|
+
user_agreement: "User Agreement",
|
|
54492
|
+
privacy_policy: "Privacy Policy"
|
|
54493
|
+
}
|
|
54483
54494
|
},
|
|
54484
54495
|
errors: {
|
|
54485
54496
|
rateLimited: "Too many attempts. Please wait a few minutes and try again.",
|
|
@@ -55138,6 +55149,9 @@ var zh_default = {
|
|
|
55138
55149
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
|
|
55139
55150
|
networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
|
|
55140
55151
|
confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
|
|
55152
|
+
mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
|
|
55153
|
+
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",
|
|
55154
|
+
mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
|
|
55141
55155
|
termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
|
|
55142
55156
|
termsNoticeLink: "\u6761\u6B3E",
|
|
55143
55157
|
termsNoticeSuffix: "\u3002"
|
|
@@ -55268,7 +55282,12 @@ var zh_default = {
|
|
|
55268
55282
|
prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
55269
55283
|
separator: "\u3001",
|
|
55270
55284
|
lastSeparator: "\u548C",
|
|
55271
|
-
suffix: "\
|
|
55285
|
+
suffix: "\u3002",
|
|
55286
|
+
agreements: {
|
|
55287
|
+
guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
|
|
55288
|
+
user_agreement: "\u7528\u6237\u534F\u8BAE",
|
|
55289
|
+
privacy_policy: "\u9690\u79C1\u653F\u7B56"
|
|
55290
|
+
}
|
|
55272
55291
|
},
|
|
55273
55292
|
errors: {
|
|
55274
55293
|
rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
|
|
@@ -55927,6 +55946,9 @@ var zh_TW_default = {
|
|
|
55927
55946
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
|
|
55928
55947
|
networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
|
|
55929
55948
|
confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
|
|
55949
|
+
mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
|
|
55950
|
+
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",
|
|
55951
|
+
mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
|
|
55930
55952
|
termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
|
|
55931
55953
|
termsNoticeLink: "\u689D\u6B3E",
|
|
55932
55954
|
termsNoticeSuffix: "\u3002"
|
|
@@ -56057,7 +56079,12 @@ var zh_TW_default = {
|
|
|
56057
56079
|
prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
56058
56080
|
separator: "\u3001",
|
|
56059
56081
|
lastSeparator: "\u548C",
|
|
56060
|
-
suffix: "\
|
|
56082
|
+
suffix: "\u3002",
|
|
56083
|
+
agreements: {
|
|
56084
|
+
guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
|
|
56085
|
+
user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
|
|
56086
|
+
privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
|
|
56087
|
+
}
|
|
56061
56088
|
},
|
|
56062
56089
|
errors: {
|
|
56063
56090
|
rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
|
|
@@ -56972,6 +56999,13 @@ function useAnalytics() {
|
|
|
56972
56999
|
);
|
|
56973
57000
|
return { track, startSession, endSession, getSessionId, setUserId, subscribe };
|
|
56974
57001
|
}
|
|
57002
|
+
function useStampInternalUserId({ internalUserId }) {
|
|
57003
|
+
const { setUserId } = useAnalytics();
|
|
57004
|
+
(0, import_react8.useEffect)(() => {
|
|
57005
|
+
if (!internalUserId) return;
|
|
57006
|
+
setUserId(internalUserId);
|
|
57007
|
+
}, [internalUserId, setUserId]);
|
|
57008
|
+
}
|
|
56975
57009
|
function useDepositAddress(params) {
|
|
56976
57010
|
const {
|
|
56977
57011
|
userId,
|
|
@@ -56984,7 +57018,6 @@ function useDepositAddress(params) {
|
|
|
56984
57018
|
contractCalls,
|
|
56985
57019
|
enabled = true
|
|
56986
57020
|
} = params;
|
|
56987
|
-
const { setUserId } = useAnalytics();
|
|
56988
57021
|
const query = (0, import_react_query3.useQuery)({
|
|
56989
57022
|
queryKey: [
|
|
56990
57023
|
"unifold",
|
|
@@ -57027,11 +57060,7 @@ function useDepositAddress(params) {
|
|
|
57027
57060
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
|
|
57028
57061
|
// 1s, 2s, 4s (max 10s)
|
|
57029
57062
|
});
|
|
57030
|
-
(
|
|
57031
|
-
if (query.data?.user_id) {
|
|
57032
|
-
setUserId(query.data.user_id);
|
|
57033
|
-
}
|
|
57034
|
-
}, [query.data?.user_id, setUserId]);
|
|
57063
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
57035
57064
|
return query;
|
|
57036
57065
|
}
|
|
57037
57066
|
function useDebounce(value, delay) {
|
|
@@ -59254,7 +59283,11 @@ function BuyWithCard({
|
|
|
59254
59283
|
method: "card",
|
|
59255
59284
|
flow_type: "deposit",
|
|
59256
59285
|
provider: selectedProvider.service_provider,
|
|
59257
|
-
amount_usd: amount
|
|
59286
|
+
amount_usd: amount,
|
|
59287
|
+
// The execution only exists once the provider's payout lands on this
|
|
59288
|
+
// wallet, and it carries this id — so it's the join key for a purchase
|
|
59289
|
+
// that starts here and never reaches flow_completed.
|
|
59290
|
+
deposit_wallet_id: depositWalletId
|
|
59258
59291
|
});
|
|
59259
59292
|
onEvent?.({
|
|
59260
59293
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -60691,6 +60724,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60691
60724
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react16.useState)(null);
|
|
60692
60725
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react16.useState)(false);
|
|
60693
60726
|
const upgradeFlowAbortRef = (0, import_react16.useRef)(null);
|
|
60727
|
+
const applyLimitRoutingRef = (0, import_react16.useRef)(() => {
|
|
60728
|
+
});
|
|
60694
60729
|
const [amount, setAmount] = (0, import_react16.useState)(amountUsd ?? "");
|
|
60695
60730
|
const [preparedOrder, setPreparedOrder] = (0, import_react16.useState)(null);
|
|
60696
60731
|
const sessionAbortRef = (0, import_react16.useRef)(null);
|
|
@@ -60825,6 +60860,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60825
60860
|
},
|
|
60826
60861
|
[email, normalizedPhone, userId]
|
|
60827
60862
|
);
|
|
60863
|
+
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60864
|
+
userId,
|
|
60865
|
+
publishableKey,
|
|
60866
|
+
normalizedPhone,
|
|
60867
|
+
userEmail,
|
|
60868
|
+
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60869
|
+
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60870
|
+
});
|
|
60828
60871
|
const createSessionAndSendOtp = (0, import_react16.useCallback)(async () => {
|
|
60829
60872
|
setView("submitting_session");
|
|
60830
60873
|
setErrorMessage("");
|
|
@@ -60834,7 +60877,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60834
60877
|
email,
|
|
60835
60878
|
phone: normalizedPhone,
|
|
60836
60879
|
terms_accepted: true,
|
|
60837
|
-
|
|
60880
|
+
// TODO: when the API honors `false`, this will trigger email OTP.
|
|
60881
|
+
// Today `false` still skips email (we don't verify it) and JWT ev
|
|
60882
|
+
// is null. Don't send `true` — that was a fake attest.
|
|
60883
|
+
email_already_verified: false
|
|
60884
|
+
// Coinbase stays Redis-only + JWT until bank-transfer identity
|
|
60885
|
+
// is live. Do not persist from this path yet.
|
|
60838
60886
|
},
|
|
60839
60887
|
publishableKey
|
|
60840
60888
|
);
|
|
@@ -60844,6 +60892,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60844
60892
|
}
|
|
60845
60893
|
setClientSecret(session.client_secret);
|
|
60846
60894
|
storeWalletPaySession();
|
|
60895
|
+
if (session.status === "verified") {
|
|
60896
|
+
const tokenRes = await exchangeOnrampVerificationToken(
|
|
60897
|
+
session.id,
|
|
60898
|
+
session.client_secret,
|
|
60899
|
+
publishableKey
|
|
60900
|
+
);
|
|
60901
|
+
setOnrampToken(tokenRes);
|
|
60902
|
+
storeWalletPaySession({
|
|
60903
|
+
emailVerifiedAt: session.email.verified_at,
|
|
60904
|
+
phoneVerifiedAt: session.phone.verified_at,
|
|
60905
|
+
onrampToken: tokenRes.token,
|
|
60906
|
+
onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
|
|
60907
|
+
});
|
|
60908
|
+
if (amountUsd) setAmount(amountUsd);
|
|
60909
|
+
try {
|
|
60910
|
+
const result = await refetchWalletPayLimits();
|
|
60911
|
+
if (result.data) {
|
|
60912
|
+
const nextView = getViewForLimitStatus(result.data);
|
|
60913
|
+
if (nextView) {
|
|
60914
|
+
applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
|
|
60915
|
+
return;
|
|
60916
|
+
}
|
|
60917
|
+
}
|
|
60918
|
+
} catch {
|
|
60919
|
+
}
|
|
60920
|
+
setView("amount");
|
|
60921
|
+
return;
|
|
60922
|
+
}
|
|
60847
60923
|
await sendOnrampVerificationOtp(session.id, "phone", session.client_secret, publishableKey);
|
|
60848
60924
|
setResendCooldown(30);
|
|
60849
60925
|
setView("phone_otp");
|
|
@@ -60852,19 +60928,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60852
60928
|
setErrorMessage(prettifyVerificationError(raw));
|
|
60853
60929
|
setView("phone_input");
|
|
60854
60930
|
}
|
|
60855
|
-
}, [
|
|
60931
|
+
}, [
|
|
60932
|
+
email,
|
|
60933
|
+
normalizedPhone,
|
|
60934
|
+
publishableKey,
|
|
60935
|
+
storeWalletPaySession,
|
|
60936
|
+
userId,
|
|
60937
|
+
amountUsd,
|
|
60938
|
+
refetchWalletPayLimits
|
|
60939
|
+
]);
|
|
60856
60940
|
const clearUpgradeFields = (0, import_react16.useCallback)(() => {
|
|
60857
60941
|
setSsnLast4("");
|
|
60858
60942
|
setDobInput("");
|
|
60859
60943
|
}, []);
|
|
60860
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60861
|
-
userId,
|
|
60862
|
-
publishableKey,
|
|
60863
|
-
normalizedPhone,
|
|
60864
|
-
userEmail,
|
|
60865
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60866
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60867
|
-
});
|
|
60868
60944
|
const pollLimitUpgradeStatus = (0, import_react16.useCallback)(
|
|
60869
60945
|
async (signal) => {
|
|
60870
60946
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -60975,6 +61051,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60975
61051
|
},
|
|
60976
61052
|
[startUpgradePolling]
|
|
60977
61053
|
);
|
|
61054
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
60978
61055
|
const hasInitializedRef = (0, import_react16.useRef)(false);
|
|
60979
61056
|
(0, import_react16.useEffect)(() => {
|
|
60980
61057
|
if (hasInitializedRef.current) return;
|
|
@@ -61204,7 +61281,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61204
61281
|
track("flow_started", {
|
|
61205
61282
|
method,
|
|
61206
61283
|
flow_type: "deposit",
|
|
61207
|
-
amount_usd: walletPayAmountUsd
|
|
61284
|
+
amount_usd: walletPayAmountUsd,
|
|
61285
|
+
// No execution yet — one appears when the payout lands on this
|
|
61286
|
+
// wallet, carrying the same id.
|
|
61287
|
+
deposit_wallet_id: depositWalletId
|
|
61208
61288
|
});
|
|
61209
61289
|
onEvent?.({
|
|
61210
61290
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -61254,6 +61334,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61254
61334
|
defaultTokenLoading,
|
|
61255
61335
|
defaultTokenError,
|
|
61256
61336
|
depositWallet?.address,
|
|
61337
|
+
depositWalletId,
|
|
61257
61338
|
userEmail,
|
|
61258
61339
|
publishableKey,
|
|
61259
61340
|
onEvent,
|
|
@@ -62228,7 +62309,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
62228
62309
|
{
|
|
62229
62310
|
key: "guest_checkout_terms",
|
|
62230
62311
|
name: "Guest Checkout Terms of Service",
|
|
62231
|
-
url: "https://www.coinbase.com/legal/
|
|
62312
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
62232
62313
|
},
|
|
62233
62314
|
{
|
|
62234
62315
|
key: "user_agreement",
|
|
@@ -62248,22 +62329,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62248
62329
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62249
62330
|
"div",
|
|
62250
62331
|
{
|
|
62251
|
-
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
|
|
62332
|
+
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
|
|
62252
62333
|
"aria-hidden": true,
|
|
62253
62334
|
"aria-busy": "true",
|
|
62254
62335
|
children: [
|
|
62255
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62256
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62257
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62336
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
|
|
62337
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
|
|
62338
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
|
|
62258
62339
|
]
|
|
62259
62340
|
}
|
|
62260
62341
|
);
|
|
62261
62342
|
}
|
|
62262
62343
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
62344
|
+
const shortLabels = t.agreements;
|
|
62345
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
62263
62346
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62264
62347
|
"p",
|
|
62265
62348
|
{
|
|
62266
|
-
className: "uf-text-[
|
|
62349
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
62267
62350
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
62268
62351
|
children: [
|
|
62269
62352
|
t.prefix,
|
|
@@ -62274,12 +62357,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62274
62357
|
href: a.url,
|
|
62275
62358
|
target: "_blank",
|
|
62276
62359
|
rel: "noopener noreferrer",
|
|
62277
|
-
className: "uf-underline",
|
|
62278
|
-
style: { color:
|
|
62279
|
-
children: a.name
|
|
62360
|
+
className: "uf-no-underline",
|
|
62361
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
62362
|
+
children: shortLabels[a.key] ?? a.name
|
|
62280
62363
|
}
|
|
62281
62364
|
),
|
|
62282
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
62365
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
62283
62366
|
] }, a.key)),
|
|
62284
62367
|
t.suffix
|
|
62285
62368
|
]
|
|
@@ -62922,6 +63005,7 @@ function PayWithCashApp({
|
|
|
62922
63005
|
destinationChainType,
|
|
62923
63006
|
destinationChainId,
|
|
62924
63007
|
destinationTokenAddress,
|
|
63008
|
+
contractCalls,
|
|
62925
63009
|
cashAppIconUrl,
|
|
62926
63010
|
view: controlledView,
|
|
62927
63011
|
onViewChange,
|
|
@@ -63014,7 +63098,8 @@ function PayWithCashApp({
|
|
|
63014
63098
|
destination_token_address: destinationTokenAddress,
|
|
63015
63099
|
recipient_address: recipientAddress,
|
|
63016
63100
|
source_amount: amount,
|
|
63017
|
-
external_id: externalId
|
|
63101
|
+
external_id: externalId,
|
|
63102
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
63018
63103
|
},
|
|
63019
63104
|
publishableKey
|
|
63020
63105
|
);
|
|
@@ -63027,7 +63112,10 @@ function PayWithCashApp({
|
|
|
63027
63112
|
track("flow_started", {
|
|
63028
63113
|
method: "cashapp",
|
|
63029
63114
|
flow_type: "deposit",
|
|
63030
|
-
amount_usd: amount
|
|
63115
|
+
amount_usd: amount,
|
|
63116
|
+
// No execution yet — one appears when the payout lands on this
|
|
63117
|
+
// wallet, carrying the same id.
|
|
63118
|
+
deposit_wallet_id: depositWalletId
|
|
63031
63119
|
});
|
|
63032
63120
|
onEvent?.({
|
|
63033
63121
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -63052,6 +63140,8 @@ function PayWithCashApp({
|
|
|
63052
63140
|
destinationChainType,
|
|
63053
63141
|
destinationChainId,
|
|
63054
63142
|
destinationTokenAddress,
|
|
63143
|
+
contractCalls,
|
|
63144
|
+
depositWalletId,
|
|
63055
63145
|
onEvent,
|
|
63056
63146
|
onDepositError,
|
|
63057
63147
|
track,
|
|
@@ -63653,7 +63743,10 @@ function BankTransfer({
|
|
|
63653
63743
|
method: "bank_transfer",
|
|
63654
63744
|
flow_type: "deposit",
|
|
63655
63745
|
provider: request.service_provider,
|
|
63656
|
-
amount_usd: request.source_amount
|
|
63746
|
+
amount_usd: request.source_amount,
|
|
63747
|
+
// No execution yet — one appears when the provider's payout lands on
|
|
63748
|
+
// this wallet, carrying the same id.
|
|
63749
|
+
deposit_wallet_id: pollingWalletId
|
|
63657
63750
|
});
|
|
63658
63751
|
onEvent?.({
|
|
63659
63752
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -69734,7 +69827,11 @@ function PayWithStripeLink({
|
|
|
69734
69827
|
if (checkoutResult.successful) {
|
|
69735
69828
|
handledTerminalSessionRef.current = null;
|
|
69736
69829
|
executionReconciledSessionRef.current = null;
|
|
69737
|
-
track("flow_started", {
|
|
69830
|
+
track("flow_started", {
|
|
69831
|
+
method: "stripe_link",
|
|
69832
|
+
flow_type: "deposit",
|
|
69833
|
+
deposit_wallet_id: depositWalletId
|
|
69834
|
+
});
|
|
69738
69835
|
setConfirmedSessionId(activeSessionId);
|
|
69739
69836
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
69740
69837
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -71231,7 +71328,14 @@ function PayWithStripeLink({
|
|
|
71231
71328
|
]
|
|
71232
71329
|
}
|
|
71233
71330
|
),
|
|
71234
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71331
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71332
|
+
"div",
|
|
71333
|
+
{
|
|
71334
|
+
ref: authMountRef,
|
|
71335
|
+
className: "uf-w-full uf-min-h-[200px]",
|
|
71336
|
+
style: { colorScheme: "only light" }
|
|
71337
|
+
}
|
|
71338
|
+
)
|
|
71235
71339
|
]
|
|
71236
71340
|
}
|
|
71237
71341
|
);
|
|
@@ -72494,6 +72598,9 @@ function CoinbaseConnect({
|
|
|
72494
72598
|
flow_type: "deposit",
|
|
72495
72599
|
method: "exchange_connect",
|
|
72496
72600
|
provider: IntegrationProvider.COINBASE,
|
|
72601
|
+
// No execution yet — one appears when the exchange's transfer lands on
|
|
72602
|
+
// this wallet, carrying the same id.
|
|
72603
|
+
deposit_wallet_id: transferDepositWalletId,
|
|
72497
72604
|
amount_usd: sendAmount || void 0,
|
|
72498
72605
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
72499
72606
|
chain: sourceChain?.chain_id,
|
|
@@ -72501,6 +72608,34 @@ function CoinbaseConnect({
|
|
|
72501
72608
|
network: sourceChain?.network
|
|
72502
72609
|
});
|
|
72503
72610
|
};
|
|
72611
|
+
const applyConfirmResult = (result) => {
|
|
72612
|
+
if (result.status === "mfa_required") {
|
|
72613
|
+
track("verification_started", {
|
|
72614
|
+
flow_type: "deposit",
|
|
72615
|
+
method: "exchange_connect",
|
|
72616
|
+
provider: IntegrationProvider.COINBASE,
|
|
72617
|
+
verification_type: "mfa",
|
|
72618
|
+
verification_status: result.status
|
|
72619
|
+
});
|
|
72620
|
+
transitionTo("mfa");
|
|
72621
|
+
setMfaCode("");
|
|
72622
|
+
setMfaError(false);
|
|
72623
|
+
} else if (result.status === "mfa_enrollment_required") {
|
|
72624
|
+
transitionTo("mfa_enrollment");
|
|
72625
|
+
} else if (result.status === "completed") {
|
|
72626
|
+
trackTransferStarted();
|
|
72627
|
+
setConfirmResult(result);
|
|
72628
|
+
transitionTo("success");
|
|
72629
|
+
onTransferSuccess?.(result);
|
|
72630
|
+
} else {
|
|
72631
|
+
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72632
|
+
transitionTo("error");
|
|
72633
|
+
onTransferError?.({
|
|
72634
|
+
message: result.message || t.errors.transferFailed,
|
|
72635
|
+
code: result.status
|
|
72636
|
+
});
|
|
72637
|
+
}
|
|
72638
|
+
};
|
|
72504
72639
|
const handleConfirmTransfer = async () => {
|
|
72505
72640
|
if (!transferIntent || !accessToken) return;
|
|
72506
72641
|
setIsLoading(true);
|
|
@@ -72535,30 +72670,7 @@ function CoinbaseConnect({
|
|
|
72535
72670
|
});
|
|
72536
72671
|
throw err;
|
|
72537
72672
|
});
|
|
72538
|
-
|
|
72539
|
-
track("verification_started", {
|
|
72540
|
-
flow_type: "deposit",
|
|
72541
|
-
method: "exchange_connect",
|
|
72542
|
-
provider: IntegrationProvider.COINBASE,
|
|
72543
|
-
verification_type: "mfa",
|
|
72544
|
-
verification_status: result.status
|
|
72545
|
-
});
|
|
72546
|
-
transitionTo("mfa");
|
|
72547
|
-
setMfaCode("");
|
|
72548
|
-
setMfaError(false);
|
|
72549
|
-
} else if (result.status === "completed") {
|
|
72550
|
-
trackTransferStarted();
|
|
72551
|
-
setConfirmResult(result);
|
|
72552
|
-
transitionTo("success");
|
|
72553
|
-
onTransferSuccess?.(result);
|
|
72554
|
-
} else {
|
|
72555
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72556
|
-
transitionTo("error");
|
|
72557
|
-
onTransferError?.({
|
|
72558
|
-
message: result.message || t.errors.transferFailed,
|
|
72559
|
-
code: result.status
|
|
72560
|
-
});
|
|
72561
|
-
}
|
|
72673
|
+
applyConfirmResult(result);
|
|
72562
72674
|
} catch (err) {
|
|
72563
72675
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
72564
72676
|
setErrorMessage(message);
|
|
@@ -72715,6 +72827,9 @@ function CoinbaseConnect({
|
|
|
72715
72827
|
setShowTransferDetails(false);
|
|
72716
72828
|
transitionTo("enter_amount");
|
|
72717
72829
|
break;
|
|
72830
|
+
case "mfa_enrollment":
|
|
72831
|
+
transitionTo("transfer_confirm");
|
|
72832
|
+
break;
|
|
72718
72833
|
case "mfa":
|
|
72719
72834
|
transitionTo("transfer_confirm");
|
|
72720
72835
|
break;
|
|
@@ -74271,6 +74386,55 @@ function CoinbaseConnect({
|
|
|
74271
74386
|
] })
|
|
74272
74387
|
] });
|
|
74273
74388
|
}
|
|
74389
|
+
if (view === "mfa_enrollment") {
|
|
74390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74391
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
74392
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74393
|
+
"div",
|
|
74394
|
+
{
|
|
74395
|
+
className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
|
|
74396
|
+
style: viewTransitionStyle,
|
|
74397
|
+
children: [
|
|
74398
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74399
|
+
DepositErrorState,
|
|
74400
|
+
{
|
|
74401
|
+
title: t.transfer.mfaEnrollmentTitle,
|
|
74402
|
+
message: t.transfer.mfaEnrollmentMessage
|
|
74403
|
+
}
|
|
74404
|
+
),
|
|
74405
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74406
|
+
"a",
|
|
74407
|
+
{
|
|
74408
|
+
href: "https://www.coinbase.com/settings/security",
|
|
74409
|
+
target: "_blank",
|
|
74410
|
+
rel: "noopener noreferrer",
|
|
74411
|
+
className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
|
|
74412
|
+
style: { color: colors2.primary, fontFamily: fonts.medium },
|
|
74413
|
+
children: [
|
|
74414
|
+
t.transfer.mfaEnrollmentSettingsLink,
|
|
74415
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
|
|
74416
|
+
]
|
|
74417
|
+
}
|
|
74418
|
+
),
|
|
74419
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74420
|
+
"button",
|
|
74421
|
+
{
|
|
74422
|
+
onClick: handleConfirmTransfer,
|
|
74423
|
+
disabled: isLoading,
|
|
74424
|
+
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",
|
|
74425
|
+
style: {
|
|
74426
|
+
backgroundColor: colors2.primary,
|
|
74427
|
+
color: "#fff",
|
|
74428
|
+
fontFamily: fonts.medium
|
|
74429
|
+
},
|
|
74430
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
|
|
74431
|
+
}
|
|
74432
|
+
)
|
|
74433
|
+
]
|
|
74434
|
+
}
|
|
74435
|
+
)
|
|
74436
|
+
] });
|
|
74437
|
+
}
|
|
74274
74438
|
if (view === "mfa") {
|
|
74275
74439
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74276
74440
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -80198,7 +80362,11 @@ function WalletConnect({
|
|
|
80198
80362
|
chain: String(token.chain_id),
|
|
80199
80363
|
network: token.network,
|
|
80200
80364
|
token: token.symbol ?? token.token_address,
|
|
80201
|
-
currency: token.currency
|
|
80365
|
+
currency: token.currency,
|
|
80366
|
+
// No execution exists yet — it's created when this send lands on the
|
|
80367
|
+
// wallet. The wallet id is what that execution will carry, so it's
|
|
80368
|
+
// how a send that never completes is matched to what followed.
|
|
80369
|
+
deposit_wallet_id: activeDepositWallet?.id
|
|
80202
80370
|
});
|
|
80203
80371
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
80204
80372
|
setHasSignedTransaction(true);
|
|
@@ -80785,7 +80953,7 @@ function DepositModal({
|
|
|
80785
80953
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
80786
80954
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
80787
80955
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
80788
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
80956
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
80789
80957
|
const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
|
|
80790
80958
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
80791
80959
|
[prefilledAmountUsd]
|
|
@@ -80793,6 +80961,7 @@ function DepositModal({
|
|
|
80793
80961
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
80794
80962
|
const journeyActiveRef = (0, import_react3.useRef)(false);
|
|
80795
80963
|
const journeySessionIdRef = (0, import_react3.useRef)(void 0);
|
|
80964
|
+
const journeyExternalUserIdRef = (0, import_react3.useRef)(void 0);
|
|
80796
80965
|
const externalUserId = userId || void 0;
|
|
80797
80966
|
const emitEvent = (0, import_react3.useCallback)(
|
|
80798
80967
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -80820,6 +80989,9 @@ function DepositModal({
|
|
|
80820
80989
|
method: analyticsMethod(method),
|
|
80821
80990
|
flow_type: "deposit",
|
|
80822
80991
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
80992
|
+
// The one high-cardinality field we do send: the join key from a
|
|
80993
|
+
// funnel session back to the execution row it produced.
|
|
80994
|
+
execution_id: data.executionId ?? execution?.id,
|
|
80823
80995
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
80824
80996
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
80825
80997
|
// the onEvent DirectExecution instead).
|
|
@@ -80847,6 +81019,7 @@ function DepositModal({
|
|
|
80847
81019
|
method: analyticsMethod(method),
|
|
80848
81020
|
flow_type: "deposit",
|
|
80849
81021
|
error_code: error.code,
|
|
81022
|
+
execution_id: execution?.id,
|
|
80850
81023
|
failure_reason: execution?.failureReason ?? void 0,
|
|
80851
81024
|
status: execution?.status,
|
|
80852
81025
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -81275,8 +81448,10 @@ function DepositModal({
|
|
|
81275
81448
|
const beginJourney = (0, import_react3.useCallback)(() => {
|
|
81276
81449
|
journeySessionIdRef.current = startSession();
|
|
81277
81450
|
journeyActiveRef.current = true;
|
|
81451
|
+
journeyExternalUserIdRef.current = userId;
|
|
81452
|
+
setUserId(null);
|
|
81278
81453
|
track("widget_opened", { flow_type: "deposit" });
|
|
81279
|
-
}, [startSession, track]);
|
|
81454
|
+
}, [startSession, track, setUserId, userId]);
|
|
81280
81455
|
const handleClose = () => {
|
|
81281
81456
|
finalizeJourney();
|
|
81282
81457
|
onOpenChange(false);
|
|
@@ -81301,6 +81476,11 @@ function DepositModal({
|
|
|
81301
81476
|
}
|
|
81302
81477
|
beginJourney();
|
|
81303
81478
|
}, [open]);
|
|
81479
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
81480
|
+
if (!open || journeyExternalUserIdRef.current === userId) return;
|
|
81481
|
+
journeyExternalUserIdRef.current = userId;
|
|
81482
|
+
setUserId(null);
|
|
81483
|
+
}, [open, userId, setUserId]);
|
|
81304
81484
|
(0, import_react3.useLayoutEffect)(() => {
|
|
81305
81485
|
if (!open) return;
|
|
81306
81486
|
if (resetViewTimeoutRef.current) {
|
|
@@ -82212,6 +82392,7 @@ function DepositModal({
|
|
|
82212
82392
|
destinationChainType,
|
|
82213
82393
|
destinationChainId,
|
|
82214
82394
|
destinationTokenAddress,
|
|
82395
|
+
contractCalls,
|
|
82215
82396
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
82216
82397
|
view: cashAppView,
|
|
82217
82398
|
onViewChange: setCashAppView,
|
|
@@ -82547,6 +82728,9 @@ function CheckoutModal({
|
|
|
82547
82728
|
flowCompletedRef.current = true;
|
|
82548
82729
|
track("flow_completed", {
|
|
82549
82730
|
flow_type: "checkout",
|
|
82731
|
+
// Checkout has no direct execution; the intent is what a funnel
|
|
82732
|
+
// session joins back to.
|
|
82733
|
+
payment_intent_id: data.paymentIntentId,
|
|
82550
82734
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
82551
82735
|
});
|
|
82552
82736
|
}
|
|
@@ -82767,7 +82951,7 @@ function CheckoutModal({
|
|
|
82767
82951
|
journeySessionIdRef.current = startSession();
|
|
82768
82952
|
journeyActiveRef.current = true;
|
|
82769
82953
|
flowCompletedRef.current = false;
|
|
82770
|
-
setUserId(null);
|
|
82954
|
+
setUserId(paymentIntentUserId ?? null);
|
|
82771
82955
|
track("widget_opened", { flow_type: "checkout" });
|
|
82772
82956
|
if (resetViewTimeoutRef.current) {
|
|
82773
82957
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -83352,7 +83536,7 @@ function useAddressBalance(params) {
|
|
|
83352
83536
|
}
|
|
83353
83537
|
function useExecutions(userId, publishableKey, options2) {
|
|
83354
83538
|
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
83355
|
-
|
|
83539
|
+
const query = (0, import_react_query25.useQuery)({
|
|
83356
83540
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
83357
83541
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
83358
83542
|
enabled: (options2?.enabled ?? true) && !!userId,
|
|
@@ -83361,6 +83545,8 @@ function useExecutions(userId, publishableKey, options2) {
|
|
|
83361
83545
|
gcTime: 1e3 * 60 * 5,
|
|
83362
83546
|
refetchOnWindowFocus: false
|
|
83363
83547
|
});
|
|
83548
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
83549
|
+
return query;
|
|
83364
83550
|
}
|
|
83365
83551
|
var POLL_INTERVAL_MS4 = 2500;
|
|
83366
83552
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -83735,7 +83921,6 @@ function useGetDepositAddress(params) {
|
|
|
83735
83921
|
actionType,
|
|
83736
83922
|
enabled = true
|
|
83737
83923
|
} = params;
|
|
83738
|
-
const { setUserId } = useAnalytics();
|
|
83739
83924
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
83740
83925
|
const query = (0, import_react_query27.useQuery)({
|
|
83741
83926
|
queryKey: [
|
|
@@ -83767,11 +83952,7 @@ function useGetDepositAddress(params) {
|
|
|
83767
83952
|
refetchOnWindowFocus: false,
|
|
83768
83953
|
retry: 1
|
|
83769
83954
|
});
|
|
83770
|
-
(
|
|
83771
|
-
if (query.data?.user_id) {
|
|
83772
|
-
setUserId(query.data.user_id);
|
|
83773
|
-
}
|
|
83774
|
-
}, [query.data?.user_id, setUserId]);
|
|
83955
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
83775
83956
|
return query;
|
|
83776
83957
|
}
|
|
83777
83958
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -84721,9 +84902,9 @@ function WithdrawConfirmingView({
|
|
|
84721
84902
|
const { colors: colors2, fonts, components } = useTheme();
|
|
84722
84903
|
const { t: strings } = useI18n();
|
|
84723
84904
|
const t = strings.withdrawModal.details;
|
|
84724
|
-
const [showButton, setShowButton] = (0,
|
|
84905
|
+
const [showButton, setShowButton] = (0, import_react46.useState)(false);
|
|
84725
84906
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
84726
|
-
(0,
|
|
84907
|
+
(0, import_react46.useEffect)(() => {
|
|
84727
84908
|
if (latestExecution) return;
|
|
84728
84909
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
84729
84910
|
return () => clearTimeout(timer);
|
|
@@ -84892,12 +85073,16 @@ function WithdrawModal({
|
|
|
84892
85073
|
);
|
|
84893
85074
|
const journeyActiveRef = (0, import_react42.useRef)(false);
|
|
84894
85075
|
const journeySessionIdRef = (0, import_react42.useRef)(void 0);
|
|
85076
|
+
const journeyExternalUserIdRef = (0, import_react42.useRef)(void 0);
|
|
84895
85077
|
const onWithdrawSuccessFor = (0, import_react42.useCallback)(
|
|
84896
85078
|
(data) => {
|
|
84897
85079
|
const execution = data.execution?.data.object;
|
|
84898
85080
|
track("flow_completed", {
|
|
84899
85081
|
flow_type: "withdraw",
|
|
84900
85082
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
85083
|
+
// The one high-cardinality field we do send: the join key from a
|
|
85084
|
+
// funnel session back to the execution row it produced.
|
|
85085
|
+
execution_id: data.executionId ?? execution?.id,
|
|
84901
85086
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
84902
85087
|
status: execution?.status,
|
|
84903
85088
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -84918,6 +85103,7 @@ function WithdrawModal({
|
|
|
84918
85103
|
track("flow_failed", {
|
|
84919
85104
|
flow_type: "withdraw",
|
|
84920
85105
|
error_code: error.code,
|
|
85106
|
+
execution_id: execution?.id,
|
|
84921
85107
|
failure_reason: execution?.failureReason ?? void 0,
|
|
84922
85108
|
status: execution?.status,
|
|
84923
85109
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -84991,6 +85177,7 @@ function WithdrawModal({
|
|
|
84991
85177
|
) ?? null : null;
|
|
84992
85178
|
const [view, setView] = (0, import_react42.useState)("form");
|
|
84993
85179
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react42.useState)();
|
|
85180
|
+
const withdrawDepositWalletIdRef = (0, import_react42.useRef)(void 0);
|
|
84994
85181
|
const [selectedExecution, setSelectedExecution] = (0, import_react42.useState)(null);
|
|
84995
85182
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react42.useState)(null);
|
|
84996
85183
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -85028,6 +85215,7 @@ function WithdrawModal({
|
|
|
85028
85215
|
if (!depositWallet) {
|
|
85029
85216
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
85030
85217
|
}
|
|
85218
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
85031
85219
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
85032
85220
|
return depositWallet;
|
|
85033
85221
|
},
|
|
@@ -85047,7 +85235,12 @@ function WithdrawModal({
|
|
|
85047
85235
|
currency: tokenData?.currency,
|
|
85048
85236
|
amount: txInfo.amount,
|
|
85049
85237
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
85050
|
-
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
|
|
85238
|
+
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
|
|
85239
|
+
// The execution doesn't exist yet — it's created when the user's send
|
|
85240
|
+
// lands on the withdraw deposit wallet, and carries this id. So a
|
|
85241
|
+
// withdrawal confirmed but never completed still joins to whatever
|
|
85242
|
+
// did (or didn't) follow on that wallet.
|
|
85243
|
+
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
85051
85244
|
});
|
|
85052
85245
|
emitEvent({
|
|
85053
85246
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -85081,8 +85274,10 @@ function WithdrawModal({
|
|
|
85081
85274
|
const beginJourney = (0, import_react42.useCallback)(() => {
|
|
85082
85275
|
journeySessionIdRef.current = startSession();
|
|
85083
85276
|
journeyActiveRef.current = true;
|
|
85277
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85278
|
+
setUserId(null);
|
|
85084
85279
|
track("widget_opened", { flow_type: "withdraw" });
|
|
85085
|
-
}, [startSession, track]);
|
|
85280
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
85086
85281
|
const handleClose = (0, import_react42.useCallback)(() => {
|
|
85087
85282
|
finalizeJourney();
|
|
85088
85283
|
onOpenChange(false);
|
|
@@ -85091,6 +85286,7 @@ function WithdrawModal({
|
|
|
85091
85286
|
setView("form");
|
|
85092
85287
|
setSelectedExecution(null);
|
|
85093
85288
|
setSubmittedTxInfo(null);
|
|
85289
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85094
85290
|
setWithdrawDepositWalletId(void 0);
|
|
85095
85291
|
resetViewTimeoutRef.current = null;
|
|
85096
85292
|
}, 200);
|
|
@@ -85108,8 +85304,14 @@ function WithdrawModal({
|
|
|
85108
85304
|
setView("form");
|
|
85109
85305
|
setSelectedExecution(null);
|
|
85110
85306
|
setSubmittedTxInfo(null);
|
|
85307
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85111
85308
|
setWithdrawDepositWalletId(void 0);
|
|
85112
85309
|
}, [open]);
|
|
85310
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
85311
|
+
if (!open || journeyExternalUserIdRef.current === externalUserId) return;
|
|
85312
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85313
|
+
setUserId(null);
|
|
85314
|
+
}, [open, externalUserId, setUserId]);
|
|
85113
85315
|
(0, import_react42.useEffect)(
|
|
85114
85316
|
() => () => {
|
|
85115
85317
|
if (journeyActiveRef.current) {
|
|
@@ -85795,9 +85997,9 @@ function useUnifold2() {
|
|
|
85795
85997
|
}
|
|
85796
85998
|
|
|
85797
85999
|
// src/unifold.tsx
|
|
85798
|
-
var UnifoldBridge = (0,
|
|
86000
|
+
var UnifoldBridge = (0, import_react48.forwardRef)((_, ref) => {
|
|
85799
86001
|
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
85800
|
-
(0,
|
|
86002
|
+
(0, import_react48.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
85801
86003
|
beginDeposit,
|
|
85802
86004
|
closeDeposit,
|
|
85803
86005
|
beginWithdraw,
|
|
@@ -85806,7 +86008,7 @@ var UnifoldBridge = (0, import_react49.forwardRef)((_, ref) => {
|
|
|
85806
86008
|
return null;
|
|
85807
86009
|
});
|
|
85808
86010
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
85809
|
-
var RenderErrorBoundary = class extends
|
|
86011
|
+
var RenderErrorBoundary = class extends import_react48.Component {
|
|
85810
86012
|
constructor() {
|
|
85811
86013
|
super(...arguments);
|
|
85812
86014
|
this.state = { hasError: false };
|
|
@@ -85878,13 +86080,13 @@ function createUnifold(publishableKey, config) {
|
|
|
85878
86080
|
};
|
|
85879
86081
|
try {
|
|
85880
86082
|
root.render(
|
|
85881
|
-
|
|
86083
|
+
import_react48.default.createElement(
|
|
85882
86084
|
RenderErrorBoundary,
|
|
85883
86085
|
{ onError: handleRenderError },
|
|
85884
|
-
|
|
86086
|
+
import_react48.default.createElement(
|
|
85885
86087
|
UnifoldProvider2,
|
|
85886
86088
|
{ publishableKey, config },
|
|
85887
|
-
|
|
86089
|
+
import_react48.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
85888
86090
|
)
|
|
85889
86091
|
)
|
|
85890
86092
|
);
|