@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.js
CHANGED
|
@@ -39611,7 +39611,7 @@ __export(index_exports, {
|
|
|
39611
39611
|
module.exports = __toCommonJS(index_exports);
|
|
39612
39612
|
|
|
39613
39613
|
// src/unifold.tsx
|
|
39614
|
-
var
|
|
39614
|
+
var import_react48 = __toESM(require_react());
|
|
39615
39615
|
var import_client = __toESM(require_client());
|
|
39616
39616
|
|
|
39617
39617
|
// ../connect-react/dist/index.mjs
|
|
@@ -39769,7 +39769,7 @@ function generateKSUID() {
|
|
|
39769
39769
|
function generatePrefixedKSUID(prefix) {
|
|
39770
39770
|
return `${prefix}_${generateKSUID()}`;
|
|
39771
39771
|
}
|
|
39772
|
-
var SDK_VERSION = true ? "0.1.
|
|
39772
|
+
var SDK_VERSION = true ? "0.1.78" : "0.0.0-dev";
|
|
39773
39773
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
39774
39774
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
39775
39775
|
function detectRuntime() {
|
|
@@ -41595,8 +41595,8 @@ var OnrampSessionEventType = ((OnrampSessionEventType2) => {
|
|
|
41595
41595
|
})(OnrampSessionEventType || {});
|
|
41596
41596
|
|
|
41597
41597
|
// ../connect-react/dist/index.mjs
|
|
41598
|
-
var import_react8 = __toESM(require_react(), 1);
|
|
41599
41598
|
var import_react_query3 = __toESM(require_modern2(), 1);
|
|
41599
|
+
var import_react8 = __toESM(require_react(), 1);
|
|
41600
41600
|
var React52 = __toESM(require_react(), 1);
|
|
41601
41601
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
41602
41602
|
var import_react9 = __toESM(require_react(), 1);
|
|
@@ -41782,14 +41782,13 @@ var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
|
|
|
41782
41782
|
var import_react44 = __toESM(require_react(), 1);
|
|
41783
41783
|
var import_react_query26 = __toESM(require_modern2(), 1);
|
|
41784
41784
|
var import_react45 = __toESM(require_react(), 1);
|
|
41785
|
-
var import_react46 = __toESM(require_react(), 1);
|
|
41786
41785
|
var import_react_query27 = __toESM(require_modern2(), 1);
|
|
41787
41786
|
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
41788
41787
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
41789
|
-
var
|
|
41788
|
+
var import_react46 = __toESM(require_react(), 1);
|
|
41790
41789
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
41791
41790
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
41792
|
-
var
|
|
41791
|
+
var import_react47 = __toESM(require_react(), 1);
|
|
41793
41792
|
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
41794
41793
|
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
41795
41794
|
var __create2 = Object.create;
|
|
@@ -47914,7 +47913,7 @@ function generateKSUID2() {
|
|
|
47914
47913
|
function generatePrefixedKSUID2(prefix) {
|
|
47915
47914
|
return `${prefix}_${generateKSUID2()}`;
|
|
47916
47915
|
}
|
|
47917
|
-
var PACKAGE_VERSION = "0.1.
|
|
47916
|
+
var PACKAGE_VERSION = "0.1.78";
|
|
47918
47917
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
47919
47918
|
var DEFAULT_DEDUP_MS = 500;
|
|
47920
47919
|
var SESSION_PREFIX = "asess";
|
|
@@ -48004,8 +48003,12 @@ var EventTracker = class {
|
|
|
48004
48003
|
}
|
|
48005
48004
|
/**
|
|
48006
48005
|
* Associate subsequent events with an internal Unifold user.id
|
|
48007
|
-
* (`user_<ksuid>`). Pass `null` to clear.
|
|
48008
|
-
*
|
|
48006
|
+
* (`user_<ksuid>`). Pass `null` to clear.
|
|
48007
|
+
*
|
|
48008
|
+
* The tracker is shared across flows and outlives any one journey, so a
|
|
48009
|
+
* journey stamps its own user at the start — with the id if it already
|
|
48010
|
+
* knows one, `null` if it doesn't — rather than inheriting whatever the
|
|
48011
|
+
* previous journey left here.
|
|
48009
48012
|
*/
|
|
48010
48013
|
setUserId(userId) {
|
|
48011
48014
|
this.userId = userId || void 0;
|
|
@@ -48016,8 +48019,8 @@ var EventTracker = class {
|
|
|
48016
48019
|
* {@link EventTracker.endSession} carries it.
|
|
48017
48020
|
*
|
|
48018
48021
|
* Does not touch `userId`: the internal `user_<ksuid>` is attached separately
|
|
48019
|
-
* via {@link EventTracker.setUserId}
|
|
48020
|
-
*
|
|
48022
|
+
* via {@link EventTracker.setUserId}, and persists until the host replaces
|
|
48023
|
+
* it — which the SDK's modals do on every journey start.
|
|
48021
48024
|
*/
|
|
48022
48025
|
startSession() {
|
|
48023
48026
|
this.sessionId = generatePrefixedKSUID2(SESSION_PREFIX);
|
|
@@ -54362,6 +54365,9 @@ var en_default = {
|
|
|
54362
54365
|
transactionBreakdown: "Transaction breakdown",
|
|
54363
54366
|
networkFee: "Network fee",
|
|
54364
54367
|
confirmOrder: "Confirm Order",
|
|
54368
|
+
mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
|
|
54369
|
+
mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
|
|
54370
|
+
mfaEnrollmentSettingsLink: "Open Coinbase security settings",
|
|
54365
54371
|
termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
|
|
54366
54372
|
termsNoticeLink: "terms",
|
|
54367
54373
|
termsNoticeSuffix: "."
|
|
@@ -54492,7 +54498,12 @@ var en_default = {
|
|
|
54492
54498
|
prefix: "By continuing, you agree to Coinbase's ",
|
|
54493
54499
|
separator: ", ",
|
|
54494
54500
|
lastSeparator: ", and ",
|
|
54495
|
-
suffix: ".
|
|
54501
|
+
suffix: ".",
|
|
54502
|
+
agreements: {
|
|
54503
|
+
guest_checkout_terms: "Terms of Service",
|
|
54504
|
+
user_agreement: "User Agreement",
|
|
54505
|
+
privacy_policy: "Privacy Policy"
|
|
54506
|
+
}
|
|
54496
54507
|
},
|
|
54497
54508
|
errors: {
|
|
54498
54509
|
rateLimited: "Too many attempts. Please wait a few minutes and try again.",
|
|
@@ -55151,6 +55162,9 @@ var zh_default = {
|
|
|
55151
55162
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
|
|
55152
55163
|
networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
|
|
55153
55164
|
confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
|
|
55165
|
+
mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
|
|
55166
|
+
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",
|
|
55167
|
+
mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
|
|
55154
55168
|
termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
|
|
55155
55169
|
termsNoticeLink: "\u6761\u6B3E",
|
|
55156
55170
|
termsNoticeSuffix: "\u3002"
|
|
@@ -55281,7 +55295,12 @@ var zh_default = {
|
|
|
55281
55295
|
prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
55282
55296
|
separator: "\u3001",
|
|
55283
55297
|
lastSeparator: "\u548C",
|
|
55284
|
-
suffix: "\
|
|
55298
|
+
suffix: "\u3002",
|
|
55299
|
+
agreements: {
|
|
55300
|
+
guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
|
|
55301
|
+
user_agreement: "\u7528\u6237\u534F\u8BAE",
|
|
55302
|
+
privacy_policy: "\u9690\u79C1\u653F\u7B56"
|
|
55303
|
+
}
|
|
55285
55304
|
},
|
|
55286
55305
|
errors: {
|
|
55287
55306
|
rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
|
|
@@ -55940,6 +55959,9 @@ var zh_TW_default = {
|
|
|
55940
55959
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
|
|
55941
55960
|
networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
|
|
55942
55961
|
confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
|
|
55962
|
+
mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
|
|
55963
|
+
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",
|
|
55964
|
+
mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
|
|
55943
55965
|
termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
|
|
55944
55966
|
termsNoticeLink: "\u689D\u6B3E",
|
|
55945
55967
|
termsNoticeSuffix: "\u3002"
|
|
@@ -56070,7 +56092,12 @@ var zh_TW_default = {
|
|
|
56070
56092
|
prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
56071
56093
|
separator: "\u3001",
|
|
56072
56094
|
lastSeparator: "\u548C",
|
|
56073
|
-
suffix: "\
|
|
56095
|
+
suffix: "\u3002",
|
|
56096
|
+
agreements: {
|
|
56097
|
+
guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
|
|
56098
|
+
user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
|
|
56099
|
+
privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
|
|
56100
|
+
}
|
|
56074
56101
|
},
|
|
56075
56102
|
errors: {
|
|
56076
56103
|
rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
|
|
@@ -56985,6 +57012,13 @@ function useAnalytics() {
|
|
|
56985
57012
|
);
|
|
56986
57013
|
return { track, startSession, endSession, getSessionId, setUserId, subscribe };
|
|
56987
57014
|
}
|
|
57015
|
+
function useStampInternalUserId({ internalUserId }) {
|
|
57016
|
+
const { setUserId } = useAnalytics();
|
|
57017
|
+
(0, import_react8.useEffect)(() => {
|
|
57018
|
+
if (!internalUserId) return;
|
|
57019
|
+
setUserId(internalUserId);
|
|
57020
|
+
}, [internalUserId, setUserId]);
|
|
57021
|
+
}
|
|
56988
57022
|
function useDepositAddress(params) {
|
|
56989
57023
|
const {
|
|
56990
57024
|
userId,
|
|
@@ -56997,7 +57031,6 @@ function useDepositAddress(params) {
|
|
|
56997
57031
|
contractCalls,
|
|
56998
57032
|
enabled = true
|
|
56999
57033
|
} = params;
|
|
57000
|
-
const { setUserId } = useAnalytics();
|
|
57001
57034
|
const query = (0, import_react_query3.useQuery)({
|
|
57002
57035
|
queryKey: [
|
|
57003
57036
|
"unifold",
|
|
@@ -57040,11 +57073,7 @@ function useDepositAddress(params) {
|
|
|
57040
57073
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
|
|
57041
57074
|
// 1s, 2s, 4s (max 10s)
|
|
57042
57075
|
});
|
|
57043
|
-
(
|
|
57044
|
-
if (query.data?.user_id) {
|
|
57045
|
-
setUserId(query.data.user_id);
|
|
57046
|
-
}
|
|
57047
|
-
}, [query.data?.user_id, setUserId]);
|
|
57076
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
57048
57077
|
return query;
|
|
57049
57078
|
}
|
|
57050
57079
|
function useDebounce(value, delay) {
|
|
@@ -59267,7 +59296,11 @@ function BuyWithCard({
|
|
|
59267
59296
|
method: "card",
|
|
59268
59297
|
flow_type: "deposit",
|
|
59269
59298
|
provider: selectedProvider.service_provider,
|
|
59270
|
-
amount_usd: amount
|
|
59299
|
+
amount_usd: amount,
|
|
59300
|
+
// The execution only exists once the provider's payout lands on this
|
|
59301
|
+
// wallet, and it carries this id — so it's the join key for a purchase
|
|
59302
|
+
// that starts here and never reaches flow_completed.
|
|
59303
|
+
deposit_wallet_id: depositWalletId
|
|
59271
59304
|
});
|
|
59272
59305
|
onEvent?.({
|
|
59273
59306
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -60704,6 +60737,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60704
60737
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react16.useState)(null);
|
|
60705
60738
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react16.useState)(false);
|
|
60706
60739
|
const upgradeFlowAbortRef = (0, import_react16.useRef)(null);
|
|
60740
|
+
const applyLimitRoutingRef = (0, import_react16.useRef)(() => {
|
|
60741
|
+
});
|
|
60707
60742
|
const [amount, setAmount] = (0, import_react16.useState)(amountUsd ?? "");
|
|
60708
60743
|
const [preparedOrder, setPreparedOrder] = (0, import_react16.useState)(null);
|
|
60709
60744
|
const sessionAbortRef = (0, import_react16.useRef)(null);
|
|
@@ -60838,6 +60873,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60838
60873
|
},
|
|
60839
60874
|
[email, normalizedPhone, userId]
|
|
60840
60875
|
);
|
|
60876
|
+
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60877
|
+
userId,
|
|
60878
|
+
publishableKey,
|
|
60879
|
+
normalizedPhone,
|
|
60880
|
+
userEmail,
|
|
60881
|
+
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60882
|
+
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60883
|
+
});
|
|
60841
60884
|
const createSessionAndSendOtp = (0, import_react16.useCallback)(async () => {
|
|
60842
60885
|
setView("submitting_session");
|
|
60843
60886
|
setErrorMessage("");
|
|
@@ -60847,7 +60890,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60847
60890
|
email,
|
|
60848
60891
|
phone: normalizedPhone,
|
|
60849
60892
|
terms_accepted: true,
|
|
60850
|
-
|
|
60893
|
+
// TODO: when the API honors `false`, this will trigger email OTP.
|
|
60894
|
+
// Today `false` still skips email (we don't verify it) and JWT ev
|
|
60895
|
+
// is null. Don't send `true` — that was a fake attest.
|
|
60896
|
+
email_already_verified: false
|
|
60897
|
+
// Coinbase stays Redis-only + JWT until bank-transfer identity
|
|
60898
|
+
// is live. Do not persist from this path yet.
|
|
60851
60899
|
},
|
|
60852
60900
|
publishableKey
|
|
60853
60901
|
);
|
|
@@ -60857,6 +60905,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60857
60905
|
}
|
|
60858
60906
|
setClientSecret(session.client_secret);
|
|
60859
60907
|
storeWalletPaySession();
|
|
60908
|
+
if (session.status === "verified") {
|
|
60909
|
+
const tokenRes = await exchangeOnrampVerificationToken(
|
|
60910
|
+
session.id,
|
|
60911
|
+
session.client_secret,
|
|
60912
|
+
publishableKey
|
|
60913
|
+
);
|
|
60914
|
+
setOnrampToken(tokenRes);
|
|
60915
|
+
storeWalletPaySession({
|
|
60916
|
+
emailVerifiedAt: session.email.verified_at,
|
|
60917
|
+
phoneVerifiedAt: session.phone.verified_at,
|
|
60918
|
+
onrampToken: tokenRes.token,
|
|
60919
|
+
onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
|
|
60920
|
+
});
|
|
60921
|
+
if (amountUsd) setAmount(amountUsd);
|
|
60922
|
+
try {
|
|
60923
|
+
const result = await refetchWalletPayLimits();
|
|
60924
|
+
if (result.data) {
|
|
60925
|
+
const nextView = getViewForLimitStatus(result.data);
|
|
60926
|
+
if (nextView) {
|
|
60927
|
+
applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
|
|
60928
|
+
return;
|
|
60929
|
+
}
|
|
60930
|
+
}
|
|
60931
|
+
} catch {
|
|
60932
|
+
}
|
|
60933
|
+
setView("amount");
|
|
60934
|
+
return;
|
|
60935
|
+
}
|
|
60860
60936
|
await sendOnrampVerificationOtp(session.id, "phone", session.client_secret, publishableKey);
|
|
60861
60937
|
setResendCooldown(30);
|
|
60862
60938
|
setView("phone_otp");
|
|
@@ -60865,19 +60941,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60865
60941
|
setErrorMessage(prettifyVerificationError(raw));
|
|
60866
60942
|
setView("phone_input");
|
|
60867
60943
|
}
|
|
60868
|
-
}, [
|
|
60944
|
+
}, [
|
|
60945
|
+
email,
|
|
60946
|
+
normalizedPhone,
|
|
60947
|
+
publishableKey,
|
|
60948
|
+
storeWalletPaySession,
|
|
60949
|
+
userId,
|
|
60950
|
+
amountUsd,
|
|
60951
|
+
refetchWalletPayLimits
|
|
60952
|
+
]);
|
|
60869
60953
|
const clearUpgradeFields = (0, import_react16.useCallback)(() => {
|
|
60870
60954
|
setSsnLast4("");
|
|
60871
60955
|
setDobInput("");
|
|
60872
60956
|
}, []);
|
|
60873
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60874
|
-
userId,
|
|
60875
|
-
publishableKey,
|
|
60876
|
-
normalizedPhone,
|
|
60877
|
-
userEmail,
|
|
60878
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60879
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60880
|
-
});
|
|
60881
60957
|
const pollLimitUpgradeStatus = (0, import_react16.useCallback)(
|
|
60882
60958
|
async (signal) => {
|
|
60883
60959
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -60988,6 +61064,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60988
61064
|
},
|
|
60989
61065
|
[startUpgradePolling]
|
|
60990
61066
|
);
|
|
61067
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
60991
61068
|
const hasInitializedRef = (0, import_react16.useRef)(false);
|
|
60992
61069
|
(0, import_react16.useEffect)(() => {
|
|
60993
61070
|
if (hasInitializedRef.current) return;
|
|
@@ -61217,7 +61294,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61217
61294
|
track("flow_started", {
|
|
61218
61295
|
method,
|
|
61219
61296
|
flow_type: "deposit",
|
|
61220
|
-
amount_usd: walletPayAmountUsd
|
|
61297
|
+
amount_usd: walletPayAmountUsd,
|
|
61298
|
+
// No execution yet — one appears when the payout lands on this
|
|
61299
|
+
// wallet, carrying the same id.
|
|
61300
|
+
deposit_wallet_id: depositWalletId
|
|
61221
61301
|
});
|
|
61222
61302
|
onEvent?.({
|
|
61223
61303
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -61267,6 +61347,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61267
61347
|
defaultTokenLoading,
|
|
61268
61348
|
defaultTokenError,
|
|
61269
61349
|
depositWallet?.address,
|
|
61350
|
+
depositWalletId,
|
|
61270
61351
|
userEmail,
|
|
61271
61352
|
publishableKey,
|
|
61272
61353
|
onEvent,
|
|
@@ -62241,7 +62322,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
62241
62322
|
{
|
|
62242
62323
|
key: "guest_checkout_terms",
|
|
62243
62324
|
name: "Guest Checkout Terms of Service",
|
|
62244
|
-
url: "https://www.coinbase.com/legal/
|
|
62325
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
62245
62326
|
},
|
|
62246
62327
|
{
|
|
62247
62328
|
key: "user_agreement",
|
|
@@ -62261,22 +62342,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62261
62342
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62262
62343
|
"div",
|
|
62263
62344
|
{
|
|
62264
|
-
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
|
|
62345
|
+
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
|
|
62265
62346
|
"aria-hidden": true,
|
|
62266
62347
|
"aria-busy": "true",
|
|
62267
62348
|
children: [
|
|
62268
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62269
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62270
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62349
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
|
|
62350
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
|
|
62351
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
|
|
62271
62352
|
]
|
|
62272
62353
|
}
|
|
62273
62354
|
);
|
|
62274
62355
|
}
|
|
62275
62356
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
62357
|
+
const shortLabels = t.agreements;
|
|
62358
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
62276
62359
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62277
62360
|
"p",
|
|
62278
62361
|
{
|
|
62279
|
-
className: "uf-text-[
|
|
62362
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
62280
62363
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
62281
62364
|
children: [
|
|
62282
62365
|
t.prefix,
|
|
@@ -62287,12 +62370,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62287
62370
|
href: a.url,
|
|
62288
62371
|
target: "_blank",
|
|
62289
62372
|
rel: "noopener noreferrer",
|
|
62290
|
-
className: "uf-underline",
|
|
62291
|
-
style: { color:
|
|
62292
|
-
children: a.name
|
|
62373
|
+
className: "uf-no-underline",
|
|
62374
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
62375
|
+
children: shortLabels[a.key] ?? a.name
|
|
62293
62376
|
}
|
|
62294
62377
|
),
|
|
62295
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
62378
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
62296
62379
|
] }, a.key)),
|
|
62297
62380
|
t.suffix
|
|
62298
62381
|
]
|
|
@@ -62935,6 +63018,7 @@ function PayWithCashApp({
|
|
|
62935
63018
|
destinationChainType,
|
|
62936
63019
|
destinationChainId,
|
|
62937
63020
|
destinationTokenAddress,
|
|
63021
|
+
contractCalls,
|
|
62938
63022
|
cashAppIconUrl,
|
|
62939
63023
|
view: controlledView,
|
|
62940
63024
|
onViewChange,
|
|
@@ -63027,7 +63111,8 @@ function PayWithCashApp({
|
|
|
63027
63111
|
destination_token_address: destinationTokenAddress,
|
|
63028
63112
|
recipient_address: recipientAddress,
|
|
63029
63113
|
source_amount: amount,
|
|
63030
|
-
external_id: externalId
|
|
63114
|
+
external_id: externalId,
|
|
63115
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
63031
63116
|
},
|
|
63032
63117
|
publishableKey
|
|
63033
63118
|
);
|
|
@@ -63040,7 +63125,10 @@ function PayWithCashApp({
|
|
|
63040
63125
|
track("flow_started", {
|
|
63041
63126
|
method: "cashapp",
|
|
63042
63127
|
flow_type: "deposit",
|
|
63043
|
-
amount_usd: amount
|
|
63128
|
+
amount_usd: amount,
|
|
63129
|
+
// No execution yet — one appears when the payout lands on this
|
|
63130
|
+
// wallet, carrying the same id.
|
|
63131
|
+
deposit_wallet_id: depositWalletId
|
|
63044
63132
|
});
|
|
63045
63133
|
onEvent?.({
|
|
63046
63134
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -63065,6 +63153,8 @@ function PayWithCashApp({
|
|
|
63065
63153
|
destinationChainType,
|
|
63066
63154
|
destinationChainId,
|
|
63067
63155
|
destinationTokenAddress,
|
|
63156
|
+
contractCalls,
|
|
63157
|
+
depositWalletId,
|
|
63068
63158
|
onEvent,
|
|
63069
63159
|
onDepositError,
|
|
63070
63160
|
track,
|
|
@@ -63666,7 +63756,10 @@ function BankTransfer({
|
|
|
63666
63756
|
method: "bank_transfer",
|
|
63667
63757
|
flow_type: "deposit",
|
|
63668
63758
|
provider: request.service_provider,
|
|
63669
|
-
amount_usd: request.source_amount
|
|
63759
|
+
amount_usd: request.source_amount,
|
|
63760
|
+
// No execution yet — one appears when the provider's payout lands on
|
|
63761
|
+
// this wallet, carrying the same id.
|
|
63762
|
+
deposit_wallet_id: pollingWalletId
|
|
63670
63763
|
});
|
|
63671
63764
|
onEvent?.({
|
|
63672
63765
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -69747,7 +69840,11 @@ function PayWithStripeLink({
|
|
|
69747
69840
|
if (checkoutResult.successful) {
|
|
69748
69841
|
handledTerminalSessionRef.current = null;
|
|
69749
69842
|
executionReconciledSessionRef.current = null;
|
|
69750
|
-
track("flow_started", {
|
|
69843
|
+
track("flow_started", {
|
|
69844
|
+
method: "stripe_link",
|
|
69845
|
+
flow_type: "deposit",
|
|
69846
|
+
deposit_wallet_id: depositWalletId
|
|
69847
|
+
});
|
|
69751
69848
|
setConfirmedSessionId(activeSessionId);
|
|
69752
69849
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
69753
69850
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -71244,7 +71341,14 @@ function PayWithStripeLink({
|
|
|
71244
71341
|
]
|
|
71245
71342
|
}
|
|
71246
71343
|
),
|
|
71247
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71344
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71345
|
+
"div",
|
|
71346
|
+
{
|
|
71347
|
+
ref: authMountRef,
|
|
71348
|
+
className: "uf-w-full uf-min-h-[200px]",
|
|
71349
|
+
style: { colorScheme: "only light" }
|
|
71350
|
+
}
|
|
71351
|
+
)
|
|
71248
71352
|
]
|
|
71249
71353
|
}
|
|
71250
71354
|
);
|
|
@@ -72507,6 +72611,9 @@ function CoinbaseConnect({
|
|
|
72507
72611
|
flow_type: "deposit",
|
|
72508
72612
|
method: "exchange_connect",
|
|
72509
72613
|
provider: IntegrationProvider.COINBASE,
|
|
72614
|
+
// No execution yet — one appears when the exchange's transfer lands on
|
|
72615
|
+
// this wallet, carrying the same id.
|
|
72616
|
+
deposit_wallet_id: transferDepositWalletId,
|
|
72510
72617
|
amount_usd: sendAmount || void 0,
|
|
72511
72618
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
72512
72619
|
chain: sourceChain?.chain_id,
|
|
@@ -72514,6 +72621,34 @@ function CoinbaseConnect({
|
|
|
72514
72621
|
network: sourceChain?.network
|
|
72515
72622
|
});
|
|
72516
72623
|
};
|
|
72624
|
+
const applyConfirmResult = (result) => {
|
|
72625
|
+
if (result.status === "mfa_required") {
|
|
72626
|
+
track("verification_started", {
|
|
72627
|
+
flow_type: "deposit",
|
|
72628
|
+
method: "exchange_connect",
|
|
72629
|
+
provider: IntegrationProvider.COINBASE,
|
|
72630
|
+
verification_type: "mfa",
|
|
72631
|
+
verification_status: result.status
|
|
72632
|
+
});
|
|
72633
|
+
transitionTo("mfa");
|
|
72634
|
+
setMfaCode("");
|
|
72635
|
+
setMfaError(false);
|
|
72636
|
+
} else if (result.status === "mfa_enrollment_required") {
|
|
72637
|
+
transitionTo("mfa_enrollment");
|
|
72638
|
+
} else if (result.status === "completed") {
|
|
72639
|
+
trackTransferStarted();
|
|
72640
|
+
setConfirmResult(result);
|
|
72641
|
+
transitionTo("success");
|
|
72642
|
+
onTransferSuccess?.(result);
|
|
72643
|
+
} else {
|
|
72644
|
+
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72645
|
+
transitionTo("error");
|
|
72646
|
+
onTransferError?.({
|
|
72647
|
+
message: result.message || t.errors.transferFailed,
|
|
72648
|
+
code: result.status
|
|
72649
|
+
});
|
|
72650
|
+
}
|
|
72651
|
+
};
|
|
72517
72652
|
const handleConfirmTransfer = async () => {
|
|
72518
72653
|
if (!transferIntent || !accessToken) return;
|
|
72519
72654
|
setIsLoading(true);
|
|
@@ -72548,30 +72683,7 @@ function CoinbaseConnect({
|
|
|
72548
72683
|
});
|
|
72549
72684
|
throw err;
|
|
72550
72685
|
});
|
|
72551
|
-
|
|
72552
|
-
track("verification_started", {
|
|
72553
|
-
flow_type: "deposit",
|
|
72554
|
-
method: "exchange_connect",
|
|
72555
|
-
provider: IntegrationProvider.COINBASE,
|
|
72556
|
-
verification_type: "mfa",
|
|
72557
|
-
verification_status: result.status
|
|
72558
|
-
});
|
|
72559
|
-
transitionTo("mfa");
|
|
72560
|
-
setMfaCode("");
|
|
72561
|
-
setMfaError(false);
|
|
72562
|
-
} else if (result.status === "completed") {
|
|
72563
|
-
trackTransferStarted();
|
|
72564
|
-
setConfirmResult(result);
|
|
72565
|
-
transitionTo("success");
|
|
72566
|
-
onTransferSuccess?.(result);
|
|
72567
|
-
} else {
|
|
72568
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72569
|
-
transitionTo("error");
|
|
72570
|
-
onTransferError?.({
|
|
72571
|
-
message: result.message || t.errors.transferFailed,
|
|
72572
|
-
code: result.status
|
|
72573
|
-
});
|
|
72574
|
-
}
|
|
72686
|
+
applyConfirmResult(result);
|
|
72575
72687
|
} catch (err) {
|
|
72576
72688
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
72577
72689
|
setErrorMessage(message);
|
|
@@ -72728,6 +72840,9 @@ function CoinbaseConnect({
|
|
|
72728
72840
|
setShowTransferDetails(false);
|
|
72729
72841
|
transitionTo("enter_amount");
|
|
72730
72842
|
break;
|
|
72843
|
+
case "mfa_enrollment":
|
|
72844
|
+
transitionTo("transfer_confirm");
|
|
72845
|
+
break;
|
|
72731
72846
|
case "mfa":
|
|
72732
72847
|
transitionTo("transfer_confirm");
|
|
72733
72848
|
break;
|
|
@@ -74284,6 +74399,55 @@ function CoinbaseConnect({
|
|
|
74284
74399
|
] })
|
|
74285
74400
|
] });
|
|
74286
74401
|
}
|
|
74402
|
+
if (view === "mfa_enrollment") {
|
|
74403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74404
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
74405
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74406
|
+
"div",
|
|
74407
|
+
{
|
|
74408
|
+
className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
|
|
74409
|
+
style: viewTransitionStyle,
|
|
74410
|
+
children: [
|
|
74411
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74412
|
+
DepositErrorState,
|
|
74413
|
+
{
|
|
74414
|
+
title: t.transfer.mfaEnrollmentTitle,
|
|
74415
|
+
message: t.transfer.mfaEnrollmentMessage
|
|
74416
|
+
}
|
|
74417
|
+
),
|
|
74418
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74419
|
+
"a",
|
|
74420
|
+
{
|
|
74421
|
+
href: "https://www.coinbase.com/settings/security",
|
|
74422
|
+
target: "_blank",
|
|
74423
|
+
rel: "noopener noreferrer",
|
|
74424
|
+
className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
|
|
74425
|
+
style: { color: colors2.primary, fontFamily: fonts.medium },
|
|
74426
|
+
children: [
|
|
74427
|
+
t.transfer.mfaEnrollmentSettingsLink,
|
|
74428
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
|
|
74429
|
+
]
|
|
74430
|
+
}
|
|
74431
|
+
),
|
|
74432
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74433
|
+
"button",
|
|
74434
|
+
{
|
|
74435
|
+
onClick: handleConfirmTransfer,
|
|
74436
|
+
disabled: isLoading,
|
|
74437
|
+
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",
|
|
74438
|
+
style: {
|
|
74439
|
+
backgroundColor: colors2.primary,
|
|
74440
|
+
color: "#fff",
|
|
74441
|
+
fontFamily: fonts.medium
|
|
74442
|
+
},
|
|
74443
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
|
|
74444
|
+
}
|
|
74445
|
+
)
|
|
74446
|
+
]
|
|
74447
|
+
}
|
|
74448
|
+
)
|
|
74449
|
+
] });
|
|
74450
|
+
}
|
|
74287
74451
|
if (view === "mfa") {
|
|
74288
74452
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74289
74453
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -80211,7 +80375,11 @@ function WalletConnect({
|
|
|
80211
80375
|
chain: String(token.chain_id),
|
|
80212
80376
|
network: token.network,
|
|
80213
80377
|
token: token.symbol ?? token.token_address,
|
|
80214
|
-
currency: token.currency
|
|
80378
|
+
currency: token.currency,
|
|
80379
|
+
// No execution exists yet — it's created when this send lands on the
|
|
80380
|
+
// wallet. The wallet id is what that execution will carry, so it's
|
|
80381
|
+
// how a send that never completes is matched to what followed.
|
|
80382
|
+
deposit_wallet_id: activeDepositWallet?.id
|
|
80215
80383
|
});
|
|
80216
80384
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
80217
80385
|
setHasSignedTransaction(true);
|
|
@@ -80798,7 +80966,7 @@ function DepositModal({
|
|
|
80798
80966
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
80799
80967
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
80800
80968
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
80801
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
80969
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
80802
80970
|
const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
|
|
80803
80971
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
80804
80972
|
[prefilledAmountUsd]
|
|
@@ -80806,6 +80974,7 @@ function DepositModal({
|
|
|
80806
80974
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
80807
80975
|
const journeyActiveRef = (0, import_react3.useRef)(false);
|
|
80808
80976
|
const journeySessionIdRef = (0, import_react3.useRef)(void 0);
|
|
80977
|
+
const journeyExternalUserIdRef = (0, import_react3.useRef)(void 0);
|
|
80809
80978
|
const externalUserId = userId || void 0;
|
|
80810
80979
|
const emitEvent = (0, import_react3.useCallback)(
|
|
80811
80980
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -80833,6 +81002,9 @@ function DepositModal({
|
|
|
80833
81002
|
method: analyticsMethod(method),
|
|
80834
81003
|
flow_type: "deposit",
|
|
80835
81004
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
81005
|
+
// The one high-cardinality field we do send: the join key from a
|
|
81006
|
+
// funnel session back to the execution row it produced.
|
|
81007
|
+
execution_id: data.executionId ?? execution?.id,
|
|
80836
81008
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
80837
81009
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
80838
81010
|
// the onEvent DirectExecution instead).
|
|
@@ -80860,6 +81032,7 @@ function DepositModal({
|
|
|
80860
81032
|
method: analyticsMethod(method),
|
|
80861
81033
|
flow_type: "deposit",
|
|
80862
81034
|
error_code: error.code,
|
|
81035
|
+
execution_id: execution?.id,
|
|
80863
81036
|
failure_reason: execution?.failureReason ?? void 0,
|
|
80864
81037
|
status: execution?.status,
|
|
80865
81038
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -81288,8 +81461,10 @@ function DepositModal({
|
|
|
81288
81461
|
const beginJourney = (0, import_react3.useCallback)(() => {
|
|
81289
81462
|
journeySessionIdRef.current = startSession();
|
|
81290
81463
|
journeyActiveRef.current = true;
|
|
81464
|
+
journeyExternalUserIdRef.current = userId;
|
|
81465
|
+
setUserId(null);
|
|
81291
81466
|
track("widget_opened", { flow_type: "deposit" });
|
|
81292
|
-
}, [startSession, track]);
|
|
81467
|
+
}, [startSession, track, setUserId, userId]);
|
|
81293
81468
|
const handleClose = () => {
|
|
81294
81469
|
finalizeJourney();
|
|
81295
81470
|
onOpenChange(false);
|
|
@@ -81314,6 +81489,11 @@ function DepositModal({
|
|
|
81314
81489
|
}
|
|
81315
81490
|
beginJourney();
|
|
81316
81491
|
}, [open]);
|
|
81492
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
81493
|
+
if (!open || journeyExternalUserIdRef.current === userId) return;
|
|
81494
|
+
journeyExternalUserIdRef.current = userId;
|
|
81495
|
+
setUserId(null);
|
|
81496
|
+
}, [open, userId, setUserId]);
|
|
81317
81497
|
(0, import_react3.useLayoutEffect)(() => {
|
|
81318
81498
|
if (!open) return;
|
|
81319
81499
|
if (resetViewTimeoutRef.current) {
|
|
@@ -82225,6 +82405,7 @@ function DepositModal({
|
|
|
82225
82405
|
destinationChainType,
|
|
82226
82406
|
destinationChainId,
|
|
82227
82407
|
destinationTokenAddress,
|
|
82408
|
+
contractCalls,
|
|
82228
82409
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
82229
82410
|
view: cashAppView,
|
|
82230
82411
|
onViewChange: setCashAppView,
|
|
@@ -82560,6 +82741,9 @@ function CheckoutModal({
|
|
|
82560
82741
|
flowCompletedRef.current = true;
|
|
82561
82742
|
track("flow_completed", {
|
|
82562
82743
|
flow_type: "checkout",
|
|
82744
|
+
// Checkout has no direct execution; the intent is what a funnel
|
|
82745
|
+
// session joins back to.
|
|
82746
|
+
payment_intent_id: data.paymentIntentId,
|
|
82563
82747
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
82564
82748
|
});
|
|
82565
82749
|
}
|
|
@@ -82780,7 +82964,7 @@ function CheckoutModal({
|
|
|
82780
82964
|
journeySessionIdRef.current = startSession();
|
|
82781
82965
|
journeyActiveRef.current = true;
|
|
82782
82966
|
flowCompletedRef.current = false;
|
|
82783
|
-
setUserId(null);
|
|
82967
|
+
setUserId(paymentIntentUserId ?? null);
|
|
82784
82968
|
track("widget_opened", { flow_type: "checkout" });
|
|
82785
82969
|
if (resetViewTimeoutRef.current) {
|
|
82786
82970
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -83365,7 +83549,7 @@ function useAddressBalance(params) {
|
|
|
83365
83549
|
}
|
|
83366
83550
|
function useExecutions(userId, publishableKey, options2) {
|
|
83367
83551
|
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
83368
|
-
|
|
83552
|
+
const query = (0, import_react_query25.useQuery)({
|
|
83369
83553
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
83370
83554
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
83371
83555
|
enabled: (options2?.enabled ?? true) && !!userId,
|
|
@@ -83374,6 +83558,8 @@ function useExecutions(userId, publishableKey, options2) {
|
|
|
83374
83558
|
gcTime: 1e3 * 60 * 5,
|
|
83375
83559
|
refetchOnWindowFocus: false
|
|
83376
83560
|
});
|
|
83561
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
83562
|
+
return query;
|
|
83377
83563
|
}
|
|
83378
83564
|
var POLL_INTERVAL_MS4 = 2500;
|
|
83379
83565
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -83748,7 +83934,6 @@ function useGetDepositAddress(params) {
|
|
|
83748
83934
|
actionType,
|
|
83749
83935
|
enabled = true
|
|
83750
83936
|
} = params;
|
|
83751
|
-
const { setUserId } = useAnalytics();
|
|
83752
83937
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
83753
83938
|
const query = (0, import_react_query27.useQuery)({
|
|
83754
83939
|
queryKey: [
|
|
@@ -83780,11 +83965,7 @@ function useGetDepositAddress(params) {
|
|
|
83780
83965
|
refetchOnWindowFocus: false,
|
|
83781
83966
|
retry: 1
|
|
83782
83967
|
});
|
|
83783
|
-
(
|
|
83784
|
-
if (query.data?.user_id) {
|
|
83785
|
-
setUserId(query.data.user_id);
|
|
83786
|
-
}
|
|
83787
|
-
}, [query.data?.user_id, setUserId]);
|
|
83968
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
83788
83969
|
return query;
|
|
83789
83970
|
}
|
|
83790
83971
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -84734,9 +84915,9 @@ function WithdrawConfirmingView({
|
|
|
84734
84915
|
const { colors: colors2, fonts, components } = useTheme();
|
|
84735
84916
|
const { t: strings } = useI18n();
|
|
84736
84917
|
const t = strings.withdrawModal.details;
|
|
84737
|
-
const [showButton, setShowButton] = (0,
|
|
84918
|
+
const [showButton, setShowButton] = (0, import_react46.useState)(false);
|
|
84738
84919
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
84739
|
-
(0,
|
|
84920
|
+
(0, import_react46.useEffect)(() => {
|
|
84740
84921
|
if (latestExecution) return;
|
|
84741
84922
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
84742
84923
|
return () => clearTimeout(timer);
|
|
@@ -84905,12 +85086,16 @@ function WithdrawModal({
|
|
|
84905
85086
|
);
|
|
84906
85087
|
const journeyActiveRef = (0, import_react42.useRef)(false);
|
|
84907
85088
|
const journeySessionIdRef = (0, import_react42.useRef)(void 0);
|
|
85089
|
+
const journeyExternalUserIdRef = (0, import_react42.useRef)(void 0);
|
|
84908
85090
|
const onWithdrawSuccessFor = (0, import_react42.useCallback)(
|
|
84909
85091
|
(data) => {
|
|
84910
85092
|
const execution = data.execution?.data.object;
|
|
84911
85093
|
track("flow_completed", {
|
|
84912
85094
|
flow_type: "withdraw",
|
|
84913
85095
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
85096
|
+
// The one high-cardinality field we do send: the join key from a
|
|
85097
|
+
// funnel session back to the execution row it produced.
|
|
85098
|
+
execution_id: data.executionId ?? execution?.id,
|
|
84914
85099
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
84915
85100
|
status: execution?.status,
|
|
84916
85101
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -84931,6 +85116,7 @@ function WithdrawModal({
|
|
|
84931
85116
|
track("flow_failed", {
|
|
84932
85117
|
flow_type: "withdraw",
|
|
84933
85118
|
error_code: error.code,
|
|
85119
|
+
execution_id: execution?.id,
|
|
84934
85120
|
failure_reason: execution?.failureReason ?? void 0,
|
|
84935
85121
|
status: execution?.status,
|
|
84936
85122
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -85004,6 +85190,7 @@ function WithdrawModal({
|
|
|
85004
85190
|
) ?? null : null;
|
|
85005
85191
|
const [view, setView] = (0, import_react42.useState)("form");
|
|
85006
85192
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react42.useState)();
|
|
85193
|
+
const withdrawDepositWalletIdRef = (0, import_react42.useRef)(void 0);
|
|
85007
85194
|
const [selectedExecution, setSelectedExecution] = (0, import_react42.useState)(null);
|
|
85008
85195
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react42.useState)(null);
|
|
85009
85196
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -85041,6 +85228,7 @@ function WithdrawModal({
|
|
|
85041
85228
|
if (!depositWallet) {
|
|
85042
85229
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
85043
85230
|
}
|
|
85231
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
85044
85232
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
85045
85233
|
return depositWallet;
|
|
85046
85234
|
},
|
|
@@ -85060,7 +85248,12 @@ function WithdrawModal({
|
|
|
85060
85248
|
currency: tokenData?.currency,
|
|
85061
85249
|
amount: txInfo.amount,
|
|
85062
85250
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
85063
|
-
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
|
|
85251
|
+
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
|
|
85252
|
+
// The execution doesn't exist yet — it's created when the user's send
|
|
85253
|
+
// lands on the withdraw deposit wallet, and carries this id. So a
|
|
85254
|
+
// withdrawal confirmed but never completed still joins to whatever
|
|
85255
|
+
// did (or didn't) follow on that wallet.
|
|
85256
|
+
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
85064
85257
|
});
|
|
85065
85258
|
emitEvent({
|
|
85066
85259
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -85094,8 +85287,10 @@ function WithdrawModal({
|
|
|
85094
85287
|
const beginJourney = (0, import_react42.useCallback)(() => {
|
|
85095
85288
|
journeySessionIdRef.current = startSession();
|
|
85096
85289
|
journeyActiveRef.current = true;
|
|
85290
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85291
|
+
setUserId(null);
|
|
85097
85292
|
track("widget_opened", { flow_type: "withdraw" });
|
|
85098
|
-
}, [startSession, track]);
|
|
85293
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
85099
85294
|
const handleClose = (0, import_react42.useCallback)(() => {
|
|
85100
85295
|
finalizeJourney();
|
|
85101
85296
|
onOpenChange(false);
|
|
@@ -85104,6 +85299,7 @@ function WithdrawModal({
|
|
|
85104
85299
|
setView("form");
|
|
85105
85300
|
setSelectedExecution(null);
|
|
85106
85301
|
setSubmittedTxInfo(null);
|
|
85302
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85107
85303
|
setWithdrawDepositWalletId(void 0);
|
|
85108
85304
|
resetViewTimeoutRef.current = null;
|
|
85109
85305
|
}, 200);
|
|
@@ -85121,8 +85317,14 @@ function WithdrawModal({
|
|
|
85121
85317
|
setView("form");
|
|
85122
85318
|
setSelectedExecution(null);
|
|
85123
85319
|
setSubmittedTxInfo(null);
|
|
85320
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85124
85321
|
setWithdrawDepositWalletId(void 0);
|
|
85125
85322
|
}, [open]);
|
|
85323
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
85324
|
+
if (!open || journeyExternalUserIdRef.current === externalUserId) return;
|
|
85325
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85326
|
+
setUserId(null);
|
|
85327
|
+
}, [open, externalUserId, setUserId]);
|
|
85126
85328
|
(0, import_react42.useEffect)(
|
|
85127
85329
|
() => () => {
|
|
85128
85330
|
if (journeyActiveRef.current) {
|
|
@@ -85808,9 +86010,9 @@ function useUnifold2() {
|
|
|
85808
86010
|
}
|
|
85809
86011
|
|
|
85810
86012
|
// src/unifold.tsx
|
|
85811
|
-
var UnifoldBridge = (0,
|
|
86013
|
+
var UnifoldBridge = (0, import_react48.forwardRef)((_, ref) => {
|
|
85812
86014
|
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
85813
|
-
(0,
|
|
86015
|
+
(0, import_react48.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
85814
86016
|
beginDeposit,
|
|
85815
86017
|
closeDeposit,
|
|
85816
86018
|
beginWithdraw,
|
|
@@ -85819,7 +86021,7 @@ var UnifoldBridge = (0, import_react49.forwardRef)((_, ref) => {
|
|
|
85819
86021
|
return null;
|
|
85820
86022
|
});
|
|
85821
86023
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
85822
|
-
var RenderErrorBoundary = class extends
|
|
86024
|
+
var RenderErrorBoundary = class extends import_react48.Component {
|
|
85823
86025
|
constructor() {
|
|
85824
86026
|
super(...arguments);
|
|
85825
86027
|
this.state = { hasError: false };
|
|
@@ -85891,13 +86093,13 @@ function createUnifold(publishableKey, config) {
|
|
|
85891
86093
|
};
|
|
85892
86094
|
try {
|
|
85893
86095
|
root.render(
|
|
85894
|
-
|
|
86096
|
+
import_react48.default.createElement(
|
|
85895
86097
|
RenderErrorBoundary,
|
|
85896
86098
|
{ onError: handleRenderError },
|
|
85897
|
-
|
|
86099
|
+
import_react48.default.createElement(
|
|
85898
86100
|
UnifoldProvider2,
|
|
85899
86101
|
{ publishableKey, config },
|
|
85900
|
-
|
|
86102
|
+
import_react48.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
85901
86103
|
)
|
|
85902
86104
|
)
|
|
85903
86105
|
);
|