@unifold/connect-react 0.1.76 → 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/README.md +7 -1
- package/dist/index.js +329 -123
- package/dist/index.mjs +297 -91
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1211,7 +1211,7 @@ __export(index_exports, {
|
|
|
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");
|
|
@@ -6577,7 +6577,7 @@ function generateKSUID() {
|
|
|
6577
6577
|
function generatePrefixedKSUID(prefix) {
|
|
6578
6578
|
return `${prefix}_${generateKSUID()}`;
|
|
6579
6579
|
}
|
|
6580
|
-
var PACKAGE_VERSION = "0.1.
|
|
6580
|
+
var PACKAGE_VERSION = "0.1.78";
|
|
6581
6581
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
6582
6582
|
var DEFAULT_DEDUP_MS = 500;
|
|
6583
6583
|
var SESSION_PREFIX = "asess";
|
|
@@ -6667,8 +6667,12 @@ var EventTracker = class {
|
|
|
6667
6667
|
}
|
|
6668
6668
|
/**
|
|
6669
6669
|
* Associate subsequent events with an internal Unifold user.id
|
|
6670
|
-
* (`user_<ksuid>`). Pass `null` to clear.
|
|
6671
|
-
*
|
|
6670
|
+
* (`user_<ksuid>`). Pass `null` to clear.
|
|
6671
|
+
*
|
|
6672
|
+
* The tracker is shared across flows and outlives any one journey, so a
|
|
6673
|
+
* journey stamps its own user at the start — with the id if it already
|
|
6674
|
+
* knows one, `null` if it doesn't — rather than inheriting whatever the
|
|
6675
|
+
* previous journey left here.
|
|
6672
6676
|
*/
|
|
6673
6677
|
setUserId(userId) {
|
|
6674
6678
|
this.userId = userId || void 0;
|
|
@@ -6679,8 +6683,8 @@ var EventTracker = class {
|
|
|
6679
6683
|
* {@link EventTracker.endSession} carries it.
|
|
6680
6684
|
*
|
|
6681
6685
|
* Does not touch `userId`: the internal `user_<ksuid>` is attached separately
|
|
6682
|
-
* via {@link EventTracker.setUserId}
|
|
6683
|
-
*
|
|
6686
|
+
* via {@link EventTracker.setUserId}, and persists until the host replaces
|
|
6687
|
+
* it — which the SDK's modals do on every journey start.
|
|
6684
6688
|
*/
|
|
6685
6689
|
startSession() {
|
|
6686
6690
|
this.sessionId = generatePrefixedKSUID(SESSION_PREFIX);
|
|
@@ -12769,17 +12773,16 @@ var import_core54 = require("@unifold/core");
|
|
|
12769
12773
|
var import_core55 = require("@unifold/core");
|
|
12770
12774
|
var import_react43 = require("react");
|
|
12771
12775
|
var import_core56 = require("@unifold/core");
|
|
12772
|
-
var import_react44 = require("react");
|
|
12773
12776
|
var import_react_query26 = require("@tanstack/react-query");
|
|
12774
12777
|
var import_core57 = require("@unifold/core");
|
|
12775
12778
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12776
12779
|
var import_core58 = require("@unifold/core");
|
|
12777
12780
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12778
|
-
var
|
|
12781
|
+
var import_react44 = require("react");
|
|
12779
12782
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12780
12783
|
var import_core59 = require("@unifold/core");
|
|
12781
12784
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12782
|
-
var
|
|
12785
|
+
var import_react45 = require("react");
|
|
12783
12786
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
12784
12787
|
var en_default = {
|
|
12785
12788
|
common: {
|
|
@@ -13179,6 +13182,9 @@ var en_default = {
|
|
|
13179
13182
|
transactionBreakdown: "Transaction breakdown",
|
|
13180
13183
|
networkFee: "Network fee",
|
|
13181
13184
|
confirmOrder: "Confirm Order",
|
|
13185
|
+
mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
|
|
13186
|
+
mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
|
|
13187
|
+
mfaEnrollmentSettingsLink: "Open Coinbase security settings",
|
|
13182
13188
|
termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
|
|
13183
13189
|
termsNoticeLink: "terms",
|
|
13184
13190
|
termsNoticeSuffix: "."
|
|
@@ -13309,7 +13315,12 @@ var en_default = {
|
|
|
13309
13315
|
prefix: "By continuing, you agree to Coinbase's ",
|
|
13310
13316
|
separator: ", ",
|
|
13311
13317
|
lastSeparator: ", and ",
|
|
13312
|
-
suffix: ".
|
|
13318
|
+
suffix: ".",
|
|
13319
|
+
agreements: {
|
|
13320
|
+
guest_checkout_terms: "Terms of Service",
|
|
13321
|
+
user_agreement: "User Agreement",
|
|
13322
|
+
privacy_policy: "Privacy Policy"
|
|
13323
|
+
}
|
|
13313
13324
|
},
|
|
13314
13325
|
errors: {
|
|
13315
13326
|
rateLimited: "Too many attempts. Please wait a few minutes and try again.",
|
|
@@ -13968,6 +13979,9 @@ var zh_default = {
|
|
|
13968
13979
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
|
|
13969
13980
|
networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
|
|
13970
13981
|
confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
|
|
13982
|
+
mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
|
|
13983
|
+
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",
|
|
13984
|
+
mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
|
|
13971
13985
|
termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
|
|
13972
13986
|
termsNoticeLink: "\u6761\u6B3E",
|
|
13973
13987
|
termsNoticeSuffix: "\u3002"
|
|
@@ -14098,7 +14112,12 @@ var zh_default = {
|
|
|
14098
14112
|
prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
14099
14113
|
separator: "\u3001",
|
|
14100
14114
|
lastSeparator: "\u548C",
|
|
14101
|
-
suffix: "\
|
|
14115
|
+
suffix: "\u3002",
|
|
14116
|
+
agreements: {
|
|
14117
|
+
guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
|
|
14118
|
+
user_agreement: "\u7528\u6237\u534F\u8BAE",
|
|
14119
|
+
privacy_policy: "\u9690\u79C1\u653F\u7B56"
|
|
14120
|
+
}
|
|
14102
14121
|
},
|
|
14103
14122
|
errors: {
|
|
14104
14123
|
rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
|
|
@@ -14757,6 +14776,9 @@ var zh_TW_default = {
|
|
|
14757
14776
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
|
|
14758
14777
|
networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
|
|
14759
14778
|
confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
|
|
14779
|
+
mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
|
|
14780
|
+
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",
|
|
14781
|
+
mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
|
|
14760
14782
|
termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
|
|
14761
14783
|
termsNoticeLink: "\u689D\u6B3E",
|
|
14762
14784
|
termsNoticeSuffix: "\u3002"
|
|
@@ -14887,7 +14909,12 @@ var zh_TW_default = {
|
|
|
14887
14909
|
prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
14888
14910
|
separator: "\u3001",
|
|
14889
14911
|
lastSeparator: "\u548C",
|
|
14890
|
-
suffix: "\
|
|
14912
|
+
suffix: "\u3002",
|
|
14913
|
+
agreements: {
|
|
14914
|
+
guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
|
|
14915
|
+
user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
|
|
14916
|
+
privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
|
|
14917
|
+
}
|
|
14891
14918
|
},
|
|
14892
14919
|
errors: {
|
|
14893
14920
|
rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
|
|
@@ -15803,6 +15830,13 @@ function useAnalytics() {
|
|
|
15803
15830
|
);
|
|
15804
15831
|
return { track, startSession, endSession, getSessionId, setUserId, subscribe };
|
|
15805
15832
|
}
|
|
15833
|
+
function useStampInternalUserId({ internalUserId }) {
|
|
15834
|
+
const { setUserId } = useAnalytics();
|
|
15835
|
+
(0, import_react9.useEffect)(() => {
|
|
15836
|
+
if (!internalUserId) return;
|
|
15837
|
+
setUserId(internalUserId);
|
|
15838
|
+
}, [internalUserId, setUserId]);
|
|
15839
|
+
}
|
|
15806
15840
|
function useDepositAddress(params) {
|
|
15807
15841
|
const {
|
|
15808
15842
|
userId,
|
|
@@ -15815,7 +15849,6 @@ function useDepositAddress(params) {
|
|
|
15815
15849
|
contractCalls,
|
|
15816
15850
|
enabled = true
|
|
15817
15851
|
} = params;
|
|
15818
|
-
const { setUserId } = useAnalytics();
|
|
15819
15852
|
const query = (0, import_react_query2.useQuery)({
|
|
15820
15853
|
queryKey: [
|
|
15821
15854
|
"unifold",
|
|
@@ -15858,11 +15891,7 @@ function useDepositAddress(params) {
|
|
|
15858
15891
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
|
|
15859
15892
|
// 1s, 2s, 4s (max 10s)
|
|
15860
15893
|
});
|
|
15861
|
-
(
|
|
15862
|
-
if (query.data?.user_id) {
|
|
15863
|
-
setUserId(query.data.user_id);
|
|
15864
|
-
}
|
|
15865
|
-
}, [query.data?.user_id, setUserId]);
|
|
15894
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
15866
15895
|
return query;
|
|
15867
15896
|
}
|
|
15868
15897
|
function useDebounce(value, delay) {
|
|
@@ -18064,6 +18093,10 @@ function BuyWithCard({
|
|
|
18064
18093
|
wallet_address: wallet.address,
|
|
18065
18094
|
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
18066
18095
|
external_id: externalId,
|
|
18096
|
+
// The rail this quote was priced for, so the provider opens on it. Most
|
|
18097
|
+
// are `card`, which is also the server default, but a local rail (e.g.
|
|
18098
|
+
// `upi` in India) is the whole reason its provider was quoted.
|
|
18099
|
+
payment_method_type: selectedProvider.payment_method_type,
|
|
18067
18100
|
// Exactly one of source_amount / destination_amount (mutually exclusive):
|
|
18068
18101
|
// destination mode starts the session by the fixed crypto amount (fees on
|
|
18069
18102
|
// top); otherwise by the entered fiat amount.
|
|
@@ -18081,7 +18114,11 @@ function BuyWithCard({
|
|
|
18081
18114
|
method: "card",
|
|
18082
18115
|
flow_type: "deposit",
|
|
18083
18116
|
provider: selectedProvider.service_provider,
|
|
18084
|
-
amount_usd: amount
|
|
18117
|
+
amount_usd: amount,
|
|
18118
|
+
// The execution only exists once the provider's payout lands on this
|
|
18119
|
+
// wallet, and it carries this id — so it's the join key for a purchase
|
|
18120
|
+
// that starts here and never reaches flow_completed.
|
|
18121
|
+
deposit_wallet_id: depositWalletId
|
|
18085
18122
|
});
|
|
18086
18123
|
onEvent?.({
|
|
18087
18124
|
id: (0, import_core2.generatePrefixedKSUID)("sevt"),
|
|
@@ -19518,6 +19555,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19518
19555
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react17.useState)(null);
|
|
19519
19556
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react17.useState)(false);
|
|
19520
19557
|
const upgradeFlowAbortRef = (0, import_react17.useRef)(null);
|
|
19558
|
+
const applyLimitRoutingRef = (0, import_react17.useRef)(() => {
|
|
19559
|
+
});
|
|
19521
19560
|
const [amount, setAmount] = (0, import_react17.useState)(amountUsd ?? "");
|
|
19522
19561
|
const [preparedOrder, setPreparedOrder] = (0, import_react17.useState)(null);
|
|
19523
19562
|
const sessionAbortRef = (0, import_react17.useRef)(null);
|
|
@@ -19652,6 +19691,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19652
19691
|
},
|
|
19653
19692
|
[email, normalizedPhone, userId]
|
|
19654
19693
|
);
|
|
19694
|
+
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
19695
|
+
userId,
|
|
19696
|
+
publishableKey,
|
|
19697
|
+
normalizedPhone,
|
|
19698
|
+
userEmail,
|
|
19699
|
+
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
19700
|
+
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
19701
|
+
});
|
|
19655
19702
|
const createSessionAndSendOtp = (0, import_react17.useCallback)(async () => {
|
|
19656
19703
|
setView("submitting_session");
|
|
19657
19704
|
setErrorMessage("");
|
|
@@ -19661,7 +19708,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19661
19708
|
email,
|
|
19662
19709
|
phone: normalizedPhone,
|
|
19663
19710
|
terms_accepted: true,
|
|
19664
|
-
|
|
19711
|
+
// TODO: when the API honors `false`, this will trigger email OTP.
|
|
19712
|
+
// Today `false` still skips email (we don't verify it) and JWT ev
|
|
19713
|
+
// is null. Don't send `true` — that was a fake attest.
|
|
19714
|
+
email_already_verified: false
|
|
19715
|
+
// Coinbase stays Redis-only + JWT until bank-transfer identity
|
|
19716
|
+
// is live. Do not persist from this path yet.
|
|
19665
19717
|
},
|
|
19666
19718
|
publishableKey
|
|
19667
19719
|
);
|
|
@@ -19671,6 +19723,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19671
19723
|
}
|
|
19672
19724
|
setClientSecret(session.client_secret);
|
|
19673
19725
|
storeWalletPaySession();
|
|
19726
|
+
if (session.status === "verified") {
|
|
19727
|
+
const tokenRes = await (0, import_core11.exchangeOnrampVerificationToken)(
|
|
19728
|
+
session.id,
|
|
19729
|
+
session.client_secret,
|
|
19730
|
+
publishableKey
|
|
19731
|
+
);
|
|
19732
|
+
setOnrampToken(tokenRes);
|
|
19733
|
+
storeWalletPaySession({
|
|
19734
|
+
emailVerifiedAt: session.email.verified_at,
|
|
19735
|
+
phoneVerifiedAt: session.phone.verified_at,
|
|
19736
|
+
onrampToken: tokenRes.token,
|
|
19737
|
+
onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
|
|
19738
|
+
});
|
|
19739
|
+
if (amountUsd) setAmount(amountUsd);
|
|
19740
|
+
try {
|
|
19741
|
+
const result = await refetchWalletPayLimits();
|
|
19742
|
+
if (result.data) {
|
|
19743
|
+
const nextView = getViewForLimitStatus(result.data);
|
|
19744
|
+
if (nextView) {
|
|
19745
|
+
applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
|
|
19746
|
+
return;
|
|
19747
|
+
}
|
|
19748
|
+
}
|
|
19749
|
+
} catch {
|
|
19750
|
+
}
|
|
19751
|
+
setView("amount");
|
|
19752
|
+
return;
|
|
19753
|
+
}
|
|
19674
19754
|
await (0, import_core11.sendOnrampVerificationOtp)(session.id, "phone", session.client_secret, publishableKey);
|
|
19675
19755
|
setResendCooldown(30);
|
|
19676
19756
|
setView("phone_otp");
|
|
@@ -19679,19 +19759,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19679
19759
|
setErrorMessage(prettifyVerificationError(raw));
|
|
19680
19760
|
setView("phone_input");
|
|
19681
19761
|
}
|
|
19682
|
-
}, [
|
|
19762
|
+
}, [
|
|
19763
|
+
email,
|
|
19764
|
+
normalizedPhone,
|
|
19765
|
+
publishableKey,
|
|
19766
|
+
storeWalletPaySession,
|
|
19767
|
+
userId,
|
|
19768
|
+
amountUsd,
|
|
19769
|
+
refetchWalletPayLimits
|
|
19770
|
+
]);
|
|
19683
19771
|
const clearUpgradeFields = (0, import_react17.useCallback)(() => {
|
|
19684
19772
|
setSsnLast4("");
|
|
19685
19773
|
setDobInput("");
|
|
19686
19774
|
}, []);
|
|
19687
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
19688
|
-
userId,
|
|
19689
|
-
publishableKey,
|
|
19690
|
-
normalizedPhone,
|
|
19691
|
-
userEmail,
|
|
19692
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
19693
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
19694
|
-
});
|
|
19695
19775
|
const pollLimitUpgradeStatus = (0, import_react17.useCallback)(
|
|
19696
19776
|
async (signal) => {
|
|
19697
19777
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -19802,6 +19882,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19802
19882
|
},
|
|
19803
19883
|
[startUpgradePolling]
|
|
19804
19884
|
);
|
|
19885
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
19805
19886
|
const hasInitializedRef = (0, import_react17.useRef)(false);
|
|
19806
19887
|
(0, import_react17.useEffect)(() => {
|
|
19807
19888
|
if (hasInitializedRef.current) return;
|
|
@@ -20031,7 +20112,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
20031
20112
|
track("flow_started", {
|
|
20032
20113
|
method,
|
|
20033
20114
|
flow_type: "deposit",
|
|
20034
|
-
amount_usd: walletPayAmountUsd
|
|
20115
|
+
amount_usd: walletPayAmountUsd,
|
|
20116
|
+
// No execution yet — one appears when the payout lands on this
|
|
20117
|
+
// wallet, carrying the same id.
|
|
20118
|
+
deposit_wallet_id: depositWalletId
|
|
20035
20119
|
});
|
|
20036
20120
|
onEvent?.({
|
|
20037
20121
|
id: (0, import_core11.generatePrefixedKSUID)("sevt"),
|
|
@@ -20081,6 +20165,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
20081
20165
|
defaultTokenLoading,
|
|
20082
20166
|
defaultTokenError,
|
|
20083
20167
|
depositWallet?.address,
|
|
20168
|
+
depositWalletId,
|
|
20084
20169
|
userEmail,
|
|
20085
20170
|
publishableKey,
|
|
20086
20171
|
onEvent,
|
|
@@ -21055,7 +21140,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
21055
21140
|
{
|
|
21056
21141
|
key: "guest_checkout_terms",
|
|
21057
21142
|
name: "Guest Checkout Terms of Service",
|
|
21058
|
-
url: "https://www.coinbase.com/legal/
|
|
21143
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
21059
21144
|
},
|
|
21060
21145
|
{
|
|
21061
21146
|
key: "user_agreement",
|
|
@@ -21075,22 +21160,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
21075
21160
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
21076
21161
|
"div",
|
|
21077
21162
|
{
|
|
21078
|
-
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
|
|
21163
|
+
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
|
|
21079
21164
|
"aria-hidden": true,
|
|
21080
21165
|
"aria-busy": "true",
|
|
21081
21166
|
children: [
|
|
21082
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21083
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21084
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21167
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
|
|
21168
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
|
|
21169
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
|
|
21085
21170
|
]
|
|
21086
21171
|
}
|
|
21087
21172
|
);
|
|
21088
21173
|
}
|
|
21089
21174
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
21175
|
+
const shortLabels = t.agreements;
|
|
21176
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
21090
21177
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
21091
21178
|
"p",
|
|
21092
21179
|
{
|
|
21093
|
-
className: "uf-text-[
|
|
21180
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
21094
21181
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
21095
21182
|
children: [
|
|
21096
21183
|
t.prefix,
|
|
@@ -21101,12 +21188,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
21101
21188
|
href: a.url,
|
|
21102
21189
|
target: "_blank",
|
|
21103
21190
|
rel: "noopener noreferrer",
|
|
21104
|
-
className: "uf-underline",
|
|
21105
|
-
style: { color:
|
|
21106
|
-
children: a.name
|
|
21191
|
+
className: "uf-no-underline",
|
|
21192
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
21193
|
+
children: shortLabels[a.key] ?? a.name
|
|
21107
21194
|
}
|
|
21108
21195
|
),
|
|
21109
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
21196
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
21110
21197
|
] }, a.key)),
|
|
21111
21198
|
t.suffix
|
|
21112
21199
|
]
|
|
@@ -21749,6 +21836,7 @@ function PayWithCashApp({
|
|
|
21749
21836
|
destinationChainType,
|
|
21750
21837
|
destinationChainId,
|
|
21751
21838
|
destinationTokenAddress,
|
|
21839
|
+
contractCalls,
|
|
21752
21840
|
cashAppIconUrl,
|
|
21753
21841
|
view: controlledView,
|
|
21754
21842
|
onViewChange,
|
|
@@ -21841,7 +21929,8 @@ function PayWithCashApp({
|
|
|
21841
21929
|
destination_token_address: destinationTokenAddress,
|
|
21842
21930
|
recipient_address: recipientAddress,
|
|
21843
21931
|
source_amount: amount,
|
|
21844
|
-
external_id: externalId
|
|
21932
|
+
external_id: externalId,
|
|
21933
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
21845
21934
|
},
|
|
21846
21935
|
publishableKey
|
|
21847
21936
|
);
|
|
@@ -21854,7 +21943,10 @@ function PayWithCashApp({
|
|
|
21854
21943
|
track("flow_started", {
|
|
21855
21944
|
method: "cashapp",
|
|
21856
21945
|
flow_type: "deposit",
|
|
21857
|
-
amount_usd: amount
|
|
21946
|
+
amount_usd: amount,
|
|
21947
|
+
// No execution yet — one appears when the payout lands on this
|
|
21948
|
+
// wallet, carrying the same id.
|
|
21949
|
+
deposit_wallet_id: depositWalletId
|
|
21858
21950
|
});
|
|
21859
21951
|
onEvent?.({
|
|
21860
21952
|
id: (0, import_core19.generatePrefixedKSUID)("sevt"),
|
|
@@ -21879,6 +21971,8 @@ function PayWithCashApp({
|
|
|
21879
21971
|
destinationChainType,
|
|
21880
21972
|
destinationChainId,
|
|
21881
21973
|
destinationTokenAddress,
|
|
21974
|
+
contractCalls,
|
|
21975
|
+
depositWalletId,
|
|
21882
21976
|
onEvent,
|
|
21883
21977
|
onDepositError,
|
|
21884
21978
|
track,
|
|
@@ -22480,7 +22574,10 @@ function BankTransfer({
|
|
|
22480
22574
|
method: "bank_transfer",
|
|
22481
22575
|
flow_type: "deposit",
|
|
22482
22576
|
provider: request.service_provider,
|
|
22483
|
-
amount_usd: request.source_amount
|
|
22577
|
+
amount_usd: request.source_amount,
|
|
22578
|
+
// No execution yet — one appears when the provider's payout lands on
|
|
22579
|
+
// this wallet, carrying the same id.
|
|
22580
|
+
deposit_wallet_id: pollingWalletId
|
|
22484
22581
|
});
|
|
22485
22582
|
onEvent?.({
|
|
22486
22583
|
id: (0, import_core21.generatePrefixedKSUID)("sevt"),
|
|
@@ -28561,7 +28658,11 @@ function PayWithStripeLink({
|
|
|
28561
28658
|
if (checkoutResult.successful) {
|
|
28562
28659
|
handledTerminalSessionRef.current = null;
|
|
28563
28660
|
executionReconciledSessionRef.current = null;
|
|
28564
|
-
track("flow_started", {
|
|
28661
|
+
track("flow_started", {
|
|
28662
|
+
method: "stripe_link",
|
|
28663
|
+
flow_type: "deposit",
|
|
28664
|
+
deposit_wallet_id: depositWalletId
|
|
28665
|
+
});
|
|
28565
28666
|
setConfirmedSessionId(activeSessionId);
|
|
28566
28667
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
28567
28668
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -30058,7 +30159,14 @@ function PayWithStripeLink({
|
|
|
30058
30159
|
]
|
|
30059
30160
|
}
|
|
30060
30161
|
),
|
|
30061
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
30162
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
30163
|
+
"div",
|
|
30164
|
+
{
|
|
30165
|
+
ref: authMountRef,
|
|
30166
|
+
className: "uf-w-full uf-min-h-[200px]",
|
|
30167
|
+
style: { colorScheme: "only light" }
|
|
30168
|
+
}
|
|
30169
|
+
)
|
|
30062
30170
|
]
|
|
30063
30171
|
}
|
|
30064
30172
|
);
|
|
@@ -31321,6 +31429,9 @@ function CoinbaseConnect({
|
|
|
31321
31429
|
flow_type: "deposit",
|
|
31322
31430
|
method: "exchange_connect",
|
|
31323
31431
|
provider: import_core26.IntegrationProvider.COINBASE,
|
|
31432
|
+
// No execution yet — one appears when the exchange's transfer lands on
|
|
31433
|
+
// this wallet, carrying the same id.
|
|
31434
|
+
deposit_wallet_id: transferDepositWalletId,
|
|
31324
31435
|
amount_usd: sendAmount || void 0,
|
|
31325
31436
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
31326
31437
|
chain: sourceChain?.chain_id,
|
|
@@ -31328,6 +31439,34 @@ function CoinbaseConnect({
|
|
|
31328
31439
|
network: sourceChain?.network
|
|
31329
31440
|
});
|
|
31330
31441
|
};
|
|
31442
|
+
const applyConfirmResult = (result) => {
|
|
31443
|
+
if (result.status === "mfa_required") {
|
|
31444
|
+
track("verification_started", {
|
|
31445
|
+
flow_type: "deposit",
|
|
31446
|
+
method: "exchange_connect",
|
|
31447
|
+
provider: import_core26.IntegrationProvider.COINBASE,
|
|
31448
|
+
verification_type: "mfa",
|
|
31449
|
+
verification_status: result.status
|
|
31450
|
+
});
|
|
31451
|
+
transitionTo("mfa");
|
|
31452
|
+
setMfaCode("");
|
|
31453
|
+
setMfaError(false);
|
|
31454
|
+
} else if (result.status === "mfa_enrollment_required") {
|
|
31455
|
+
transitionTo("mfa_enrollment");
|
|
31456
|
+
} else if (result.status === "completed") {
|
|
31457
|
+
trackTransferStarted();
|
|
31458
|
+
setConfirmResult(result);
|
|
31459
|
+
transitionTo("success");
|
|
31460
|
+
onTransferSuccess?.(result);
|
|
31461
|
+
} else {
|
|
31462
|
+
setErrorMessage(result.message || t.errors.transferFailed);
|
|
31463
|
+
transitionTo("error");
|
|
31464
|
+
onTransferError?.({
|
|
31465
|
+
message: result.message || t.errors.transferFailed,
|
|
31466
|
+
code: result.status
|
|
31467
|
+
});
|
|
31468
|
+
}
|
|
31469
|
+
};
|
|
31331
31470
|
const handleConfirmTransfer = async () => {
|
|
31332
31471
|
if (!transferIntent || !accessToken) return;
|
|
31333
31472
|
setIsLoading(true);
|
|
@@ -31362,30 +31501,7 @@ function CoinbaseConnect({
|
|
|
31362
31501
|
});
|
|
31363
31502
|
throw err;
|
|
31364
31503
|
});
|
|
31365
|
-
|
|
31366
|
-
track("verification_started", {
|
|
31367
|
-
flow_type: "deposit",
|
|
31368
|
-
method: "exchange_connect",
|
|
31369
|
-
provider: import_core26.IntegrationProvider.COINBASE,
|
|
31370
|
-
verification_type: "mfa",
|
|
31371
|
-
verification_status: result.status
|
|
31372
|
-
});
|
|
31373
|
-
transitionTo("mfa");
|
|
31374
|
-
setMfaCode("");
|
|
31375
|
-
setMfaError(false);
|
|
31376
|
-
} else if (result.status === "completed") {
|
|
31377
|
-
trackTransferStarted();
|
|
31378
|
-
setConfirmResult(result);
|
|
31379
|
-
transitionTo("success");
|
|
31380
|
-
onTransferSuccess?.(result);
|
|
31381
|
-
} else {
|
|
31382
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
31383
|
-
transitionTo("error");
|
|
31384
|
-
onTransferError?.({
|
|
31385
|
-
message: result.message || t.errors.transferFailed,
|
|
31386
|
-
code: result.status
|
|
31387
|
-
});
|
|
31388
|
-
}
|
|
31504
|
+
applyConfirmResult(result);
|
|
31389
31505
|
} catch (err) {
|
|
31390
31506
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
31391
31507
|
setErrorMessage(message);
|
|
@@ -31542,6 +31658,9 @@ function CoinbaseConnect({
|
|
|
31542
31658
|
setShowTransferDetails(false);
|
|
31543
31659
|
transitionTo("enter_amount");
|
|
31544
31660
|
break;
|
|
31661
|
+
case "mfa_enrollment":
|
|
31662
|
+
transitionTo("transfer_confirm");
|
|
31663
|
+
break;
|
|
31545
31664
|
case "mfa":
|
|
31546
31665
|
transitionTo("transfer_confirm");
|
|
31547
31666
|
break;
|
|
@@ -33098,6 +33217,55 @@ function CoinbaseConnect({
|
|
|
33098
33217
|
] })
|
|
33099
33218
|
] });
|
|
33100
33219
|
}
|
|
33220
|
+
if (view === "mfa_enrollment") {
|
|
33221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
33222
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
33223
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
33224
|
+
"div",
|
|
33225
|
+
{
|
|
33226
|
+
className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
|
|
33227
|
+
style: viewTransitionStyle,
|
|
33228
|
+
children: [
|
|
33229
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
33230
|
+
DepositErrorState,
|
|
33231
|
+
{
|
|
33232
|
+
title: t.transfer.mfaEnrollmentTitle,
|
|
33233
|
+
message: t.transfer.mfaEnrollmentMessage
|
|
33234
|
+
}
|
|
33235
|
+
),
|
|
33236
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
33237
|
+
"a",
|
|
33238
|
+
{
|
|
33239
|
+
href: "https://www.coinbase.com/settings/security",
|
|
33240
|
+
target: "_blank",
|
|
33241
|
+
rel: "noopener noreferrer",
|
|
33242
|
+
className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
|
|
33243
|
+
style: { color: colors2.primary, fontFamily: fonts.medium },
|
|
33244
|
+
children: [
|
|
33245
|
+
t.transfer.mfaEnrollmentSettingsLink,
|
|
33246
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
|
|
33247
|
+
]
|
|
33248
|
+
}
|
|
33249
|
+
),
|
|
33250
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
33251
|
+
"button",
|
|
33252
|
+
{
|
|
33253
|
+
onClick: handleConfirmTransfer,
|
|
33254
|
+
disabled: isLoading,
|
|
33255
|
+
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",
|
|
33256
|
+
style: {
|
|
33257
|
+
backgroundColor: colors2.primary,
|
|
33258
|
+
color: "#fff",
|
|
33259
|
+
fontFamily: fonts.medium
|
|
33260
|
+
},
|
|
33261
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
|
|
33262
|
+
}
|
|
33263
|
+
)
|
|
33264
|
+
]
|
|
33265
|
+
}
|
|
33266
|
+
)
|
|
33267
|
+
] });
|
|
33268
|
+
}
|
|
33101
33269
|
if (view === "mfa") {
|
|
33102
33270
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
33103
33271
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -39025,7 +39193,11 @@ function WalletConnect({
|
|
|
39025
39193
|
chain: String(token.chain_id),
|
|
39026
39194
|
network: token.network,
|
|
39027
39195
|
token: token.symbol ?? token.token_address,
|
|
39028
|
-
currency: token.currency
|
|
39196
|
+
currency: token.currency,
|
|
39197
|
+
// No execution exists yet — it's created when this send lands on the
|
|
39198
|
+
// wallet. The wallet id is what that execution will carry, so it's
|
|
39199
|
+
// how a send that never completes is matched to what followed.
|
|
39200
|
+
deposit_wallet_id: activeDepositWallet?.id
|
|
39029
39201
|
});
|
|
39030
39202
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
39031
39203
|
setHasSignedTransaction(true);
|
|
@@ -39612,7 +39784,7 @@ function DepositModal({
|
|
|
39612
39784
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
39613
39785
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
39614
39786
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
39615
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
39787
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
39616
39788
|
const normalizedPrefilledAmountUsd = (0, import_react7.useMemo)(
|
|
39617
39789
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
39618
39790
|
[prefilledAmountUsd]
|
|
@@ -39620,6 +39792,7 @@ function DepositModal({
|
|
|
39620
39792
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
39621
39793
|
const journeyActiveRef = (0, import_react7.useRef)(false);
|
|
39622
39794
|
const journeySessionIdRef = (0, import_react7.useRef)(void 0);
|
|
39795
|
+
const journeyExternalUserIdRef = (0, import_react7.useRef)(void 0);
|
|
39623
39796
|
const externalUserId = userId || void 0;
|
|
39624
39797
|
const emitEvent = (0, import_react7.useCallback)(
|
|
39625
39798
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -39647,6 +39820,9 @@ function DepositModal({
|
|
|
39647
39820
|
method: analyticsMethod(method),
|
|
39648
39821
|
flow_type: "deposit",
|
|
39649
39822
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
39823
|
+
// The one high-cardinality field we do send: the join key from a
|
|
39824
|
+
// funnel session back to the execution row it produced.
|
|
39825
|
+
execution_id: data.executionId ?? execution?.id,
|
|
39650
39826
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
39651
39827
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
39652
39828
|
// the onEvent DirectExecution instead).
|
|
@@ -39674,6 +39850,7 @@ function DepositModal({
|
|
|
39674
39850
|
method: analyticsMethod(method),
|
|
39675
39851
|
flow_type: "deposit",
|
|
39676
39852
|
error_code: error.code,
|
|
39853
|
+
execution_id: execution?.id,
|
|
39677
39854
|
failure_reason: execution?.failureReason ?? void 0,
|
|
39678
39855
|
status: execution?.status,
|
|
39679
39856
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -40102,8 +40279,10 @@ function DepositModal({
|
|
|
40102
40279
|
const beginJourney = (0, import_react7.useCallback)(() => {
|
|
40103
40280
|
journeySessionIdRef.current = startSession();
|
|
40104
40281
|
journeyActiveRef.current = true;
|
|
40282
|
+
journeyExternalUserIdRef.current = userId;
|
|
40283
|
+
setUserId(null);
|
|
40105
40284
|
track("widget_opened", { flow_type: "deposit" });
|
|
40106
|
-
}, [startSession, track]);
|
|
40285
|
+
}, [startSession, track, setUserId, userId]);
|
|
40107
40286
|
const handleClose = () => {
|
|
40108
40287
|
finalizeJourney();
|
|
40109
40288
|
onOpenChange(false);
|
|
@@ -40128,6 +40307,11 @@ function DepositModal({
|
|
|
40128
40307
|
}
|
|
40129
40308
|
beginJourney();
|
|
40130
40309
|
}, [open]);
|
|
40310
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
40311
|
+
if (!open || journeyExternalUserIdRef.current === userId) return;
|
|
40312
|
+
journeyExternalUserIdRef.current = userId;
|
|
40313
|
+
setUserId(null);
|
|
40314
|
+
}, [open, userId, setUserId]);
|
|
40131
40315
|
(0, import_react7.useLayoutEffect)(() => {
|
|
40132
40316
|
if (!open) return;
|
|
40133
40317
|
if (resetViewTimeoutRef.current) {
|
|
@@ -41039,6 +41223,7 @@ function DepositModal({
|
|
|
41039
41223
|
destinationChainType,
|
|
41040
41224
|
destinationChainId,
|
|
41041
41225
|
destinationTokenAddress,
|
|
41226
|
+
contractCalls,
|
|
41042
41227
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
41043
41228
|
view: cashAppView,
|
|
41044
41229
|
onViewChange: setCashAppView,
|
|
@@ -41374,6 +41559,9 @@ function CheckoutModal({
|
|
|
41374
41559
|
flowCompletedRef.current = true;
|
|
41375
41560
|
track("flow_completed", {
|
|
41376
41561
|
flow_type: "checkout",
|
|
41562
|
+
// Checkout has no direct execution; the intent is what a funnel
|
|
41563
|
+
// session joins back to.
|
|
41564
|
+
payment_intent_id: data.paymentIntentId,
|
|
41377
41565
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
41378
41566
|
});
|
|
41379
41567
|
}
|
|
@@ -41594,7 +41782,7 @@ function CheckoutModal({
|
|
|
41594
41782
|
journeySessionIdRef.current = startSession();
|
|
41595
41783
|
journeyActiveRef.current = true;
|
|
41596
41784
|
flowCompletedRef.current = false;
|
|
41597
|
-
setUserId(null);
|
|
41785
|
+
setUserId(paymentIntentUserId ?? null);
|
|
41598
41786
|
track("widget_opened", { flow_type: "checkout" });
|
|
41599
41787
|
if (resetViewTimeoutRef.current) {
|
|
41600
41788
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -42179,7 +42367,7 @@ function useAddressBalance(params) {
|
|
|
42179
42367
|
}
|
|
42180
42368
|
function useExecutions(userId, publishableKey, options) {
|
|
42181
42369
|
const actionType = options?.actionType ?? import_core51.ActionType.Deposit;
|
|
42182
|
-
|
|
42370
|
+
const query = (0, import_react_query24.useQuery)({
|
|
42183
42371
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
42184
42372
|
queryFn: () => (0, import_core51.queryExecutions)(userId, publishableKey, actionType),
|
|
42185
42373
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
@@ -42188,6 +42376,8 @@ function useExecutions(userId, publishableKey, options) {
|
|
|
42188
42376
|
gcTime: 1e3 * 60 * 5,
|
|
42189
42377
|
refetchOnWindowFocus: false
|
|
42190
42378
|
});
|
|
42379
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
42380
|
+
return query;
|
|
42191
42381
|
}
|
|
42192
42382
|
var POLL_INTERVAL_MS4 = 2500;
|
|
42193
42383
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -42562,7 +42752,6 @@ function useGetDepositAddress(params) {
|
|
|
42562
42752
|
actionType,
|
|
42563
42753
|
enabled = true
|
|
42564
42754
|
} = params;
|
|
42565
|
-
const { setUserId } = useAnalytics();
|
|
42566
42755
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
42567
42756
|
const query = (0, import_react_query26.useQuery)({
|
|
42568
42757
|
queryKey: [
|
|
@@ -42594,11 +42783,7 @@ function useGetDepositAddress(params) {
|
|
|
42594
42783
|
refetchOnWindowFocus: false,
|
|
42595
42784
|
retry: 1
|
|
42596
42785
|
});
|
|
42597
|
-
(
|
|
42598
|
-
if (query.data?.user_id) {
|
|
42599
|
-
setUserId(query.data.user_id);
|
|
42600
|
-
}
|
|
42601
|
-
}, [query.data?.user_id, setUserId]);
|
|
42786
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
42602
42787
|
return query;
|
|
42603
42788
|
}
|
|
42604
42789
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -43548,9 +43733,9 @@ function WithdrawConfirmingView({
|
|
|
43548
43733
|
const { colors: colors2, fonts, components } = useTheme();
|
|
43549
43734
|
const { t: strings } = useI18n();
|
|
43550
43735
|
const t = strings.withdrawModal.details;
|
|
43551
|
-
const [showButton, setShowButton] = (0,
|
|
43736
|
+
const [showButton, setShowButton] = (0, import_react44.useState)(false);
|
|
43552
43737
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
43553
|
-
(0,
|
|
43738
|
+
(0, import_react44.useEffect)(() => {
|
|
43554
43739
|
if (latestExecution) return;
|
|
43555
43740
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
43556
43741
|
return () => clearTimeout(timer);
|
|
@@ -43719,12 +43904,16 @@ function WithdrawModal({
|
|
|
43719
43904
|
);
|
|
43720
43905
|
const journeyActiveRef = (0, import_react40.useRef)(false);
|
|
43721
43906
|
const journeySessionIdRef = (0, import_react40.useRef)(void 0);
|
|
43907
|
+
const journeyExternalUserIdRef = (0, import_react40.useRef)(void 0);
|
|
43722
43908
|
const onWithdrawSuccessFor = (0, import_react40.useCallback)(
|
|
43723
43909
|
(data) => {
|
|
43724
43910
|
const execution = data.execution?.data.object;
|
|
43725
43911
|
track("flow_completed", {
|
|
43726
43912
|
flow_type: "withdraw",
|
|
43727
43913
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
43914
|
+
// The one high-cardinality field we do send: the join key from a
|
|
43915
|
+
// funnel session back to the execution row it produced.
|
|
43916
|
+
execution_id: data.executionId ?? execution?.id,
|
|
43728
43917
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
43729
43918
|
status: execution?.status,
|
|
43730
43919
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -43745,6 +43934,7 @@ function WithdrawModal({
|
|
|
43745
43934
|
track("flow_failed", {
|
|
43746
43935
|
flow_type: "withdraw",
|
|
43747
43936
|
error_code: error.code,
|
|
43937
|
+
execution_id: execution?.id,
|
|
43748
43938
|
failure_reason: execution?.failureReason ?? void 0,
|
|
43749
43939
|
status: execution?.status,
|
|
43750
43940
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -43818,6 +44008,7 @@ function WithdrawModal({
|
|
|
43818
44008
|
) ?? null : null;
|
|
43819
44009
|
const [view, setView] = (0, import_react40.useState)("form");
|
|
43820
44010
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react40.useState)();
|
|
44011
|
+
const withdrawDepositWalletIdRef = (0, import_react40.useRef)(void 0);
|
|
43821
44012
|
const [selectedExecution, setSelectedExecution] = (0, import_react40.useState)(null);
|
|
43822
44013
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react40.useState)(null);
|
|
43823
44014
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -43855,6 +44046,7 @@ function WithdrawModal({
|
|
|
43855
44046
|
if (!depositWallet) {
|
|
43856
44047
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
43857
44048
|
}
|
|
44049
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
43858
44050
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
43859
44051
|
return depositWallet;
|
|
43860
44052
|
},
|
|
@@ -43874,7 +44066,12 @@ function WithdrawModal({
|
|
|
43874
44066
|
currency: tokenData?.currency,
|
|
43875
44067
|
amount: txInfo.amount,
|
|
43876
44068
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
43877
|
-
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
|
|
44069
|
+
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
|
|
44070
|
+
// The execution doesn't exist yet — it's created when the user's send
|
|
44071
|
+
// lands on the withdraw deposit wallet, and carries this id. So a
|
|
44072
|
+
// withdrawal confirmed but never completed still joins to whatever
|
|
44073
|
+
// did (or didn't) follow on that wallet.
|
|
44074
|
+
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
43878
44075
|
});
|
|
43879
44076
|
emitEvent({
|
|
43880
44077
|
id: (0, import_core59.generatePrefixedKSUID)("sevt"),
|
|
@@ -43908,8 +44105,10 @@ function WithdrawModal({
|
|
|
43908
44105
|
const beginJourney = (0, import_react40.useCallback)(() => {
|
|
43909
44106
|
journeySessionIdRef.current = startSession();
|
|
43910
44107
|
journeyActiveRef.current = true;
|
|
44108
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
44109
|
+
setUserId(null);
|
|
43911
44110
|
track("widget_opened", { flow_type: "withdraw" });
|
|
43912
|
-
}, [startSession, track]);
|
|
44111
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
43913
44112
|
const handleClose = (0, import_react40.useCallback)(() => {
|
|
43914
44113
|
finalizeJourney();
|
|
43915
44114
|
onOpenChange(false);
|
|
@@ -43918,6 +44117,7 @@ function WithdrawModal({
|
|
|
43918
44117
|
setView("form");
|
|
43919
44118
|
setSelectedExecution(null);
|
|
43920
44119
|
setSubmittedTxInfo(null);
|
|
44120
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
43921
44121
|
setWithdrawDepositWalletId(void 0);
|
|
43922
44122
|
resetViewTimeoutRef.current = null;
|
|
43923
44123
|
}, 200);
|
|
@@ -43935,8 +44135,14 @@ function WithdrawModal({
|
|
|
43935
44135
|
setView("form");
|
|
43936
44136
|
setSelectedExecution(null);
|
|
43937
44137
|
setSubmittedTxInfo(null);
|
|
44138
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
43938
44139
|
setWithdrawDepositWalletId(void 0);
|
|
43939
44140
|
}, [open]);
|
|
44141
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
44142
|
+
if (!open || journeyExternalUserIdRef.current === externalUserId) return;
|
|
44143
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
44144
|
+
setUserId(null);
|
|
44145
|
+
}, [open, externalUserId, setUserId]);
|
|
43940
44146
|
(0, import_react40.useEffect)(
|
|
43941
44147
|
() => () => {
|
|
43942
44148
|
if (journeyActiveRef.current) {
|
|
@@ -44179,32 +44385,32 @@ function UnifoldProvider({
|
|
|
44179
44385
|
queryClient,
|
|
44180
44386
|
config
|
|
44181
44387
|
}) {
|
|
44182
|
-
const [isOpen, setIsOpen] = (0,
|
|
44183
|
-
const [depositConfig, setDepositConfig] = (0,
|
|
44184
|
-
const [isCheckoutOpen, setIsCheckoutOpen] = (0,
|
|
44185
|
-
const [checkoutConfig, setCheckoutConfig] = (0,
|
|
44186
|
-
const [isWithdrawOpen, setIsWithdrawOpen] = (0,
|
|
44187
|
-
const [withdrawConfig, setWithdrawConfig] = (0,
|
|
44188
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
44388
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(false);
|
|
44389
|
+
const [depositConfig, setDepositConfig] = (0, import_react46.useState)(null);
|
|
44390
|
+
const [isCheckoutOpen, setIsCheckoutOpen] = (0, import_react46.useState)(false);
|
|
44391
|
+
const [checkoutConfig, setCheckoutConfig] = (0, import_react46.useState)(null);
|
|
44392
|
+
const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react46.useState)(false);
|
|
44393
|
+
const [withdrawConfig, setWithdrawConfig] = (0, import_react46.useState)(null);
|
|
44394
|
+
const [resolvedTheme, setResolvedTheme] = import_react46.default.useState("dark");
|
|
44189
44395
|
const incidentBannerEnabled = config?.notifications?.incidentBanner;
|
|
44190
|
-
const tracker = (0,
|
|
44396
|
+
const tracker = (0, import_react46.useMemo)(
|
|
44191
44397
|
() => createEventTracker({
|
|
44192
44398
|
publishableKey,
|
|
44193
44399
|
endpoint: `${(0, import_core60.getApiBaseUrl)()}/v1/public/events`
|
|
44194
44400
|
}),
|
|
44195
44401
|
[publishableKey]
|
|
44196
44402
|
);
|
|
44197
|
-
(0,
|
|
44403
|
+
(0, import_react46.useEffect)(() => {
|
|
44198
44404
|
return () => {
|
|
44199
44405
|
tracker?.destroy();
|
|
44200
44406
|
};
|
|
44201
44407
|
}, [tracker]);
|
|
44202
|
-
(0,
|
|
44408
|
+
(0, import_react46.useEffect)(() => {
|
|
44203
44409
|
if (publishableKey) {
|
|
44204
44410
|
(0, import_core60.setApiConfig)({ publishableKey });
|
|
44205
44411
|
}
|
|
44206
44412
|
}, [publishableKey]);
|
|
44207
|
-
|
|
44413
|
+
import_react46.default.useEffect(() => {
|
|
44208
44414
|
const appearance = config?.appearance || "dark";
|
|
44209
44415
|
if (appearance === "auto") {
|
|
44210
44416
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -44219,17 +44425,17 @@ function UnifoldProvider({
|
|
|
44219
44425
|
setResolvedTheme(appearance);
|
|
44220
44426
|
}
|
|
44221
44427
|
}, [config?.appearance]);
|
|
44222
|
-
const depositPromiseRef =
|
|
44223
|
-
const depositConfigRef =
|
|
44428
|
+
const depositPromiseRef = import_react46.default.useRef(null);
|
|
44429
|
+
const depositConfigRef = import_react46.default.useRef(null);
|
|
44224
44430
|
depositConfigRef.current = depositConfig;
|
|
44225
|
-
const closeTimeoutRef =
|
|
44226
|
-
const closeGuardRef =
|
|
44227
|
-
const withdrawPromiseRef =
|
|
44228
|
-
const withdrawConfigRef =
|
|
44431
|
+
const closeTimeoutRef = import_react46.default.useRef(null);
|
|
44432
|
+
const closeGuardRef = import_react46.default.useRef(false);
|
|
44433
|
+
const withdrawPromiseRef = import_react46.default.useRef(null);
|
|
44434
|
+
const withdrawConfigRef = import_react46.default.useRef(null);
|
|
44229
44435
|
withdrawConfigRef.current = withdrawConfig;
|
|
44230
|
-
const withdrawCloseTimeoutRef =
|
|
44231
|
-
const withdrawCloseGuardRef =
|
|
44232
|
-
const beginDeposit = (0,
|
|
44436
|
+
const withdrawCloseTimeoutRef = import_react46.default.useRef(null);
|
|
44437
|
+
const withdrawCloseGuardRef = import_react46.default.useRef(false);
|
|
44438
|
+
const beginDeposit = (0, import_react46.useCallback)((config2) => {
|
|
44233
44439
|
if (closeTimeoutRef.current) {
|
|
44234
44440
|
clearTimeout(closeTimeoutRef.current);
|
|
44235
44441
|
closeTimeoutRef.current = null;
|
|
@@ -44264,7 +44470,7 @@ function UnifoldProvider({
|
|
|
44264
44470
|
setIsOpen(true);
|
|
44265
44471
|
return promise;
|
|
44266
44472
|
}, []);
|
|
44267
|
-
const closeDeposit = (0,
|
|
44473
|
+
const closeDeposit = (0, import_react46.useCallback)(() => {
|
|
44268
44474
|
if (closeGuardRef.current) {
|
|
44269
44475
|
return;
|
|
44270
44476
|
}
|
|
@@ -44286,7 +44492,7 @@ function UnifoldProvider({
|
|
|
44286
44492
|
closeTimeoutRef.current = null;
|
|
44287
44493
|
}, 200);
|
|
44288
44494
|
}, []);
|
|
44289
|
-
const handleDepositSuccess = (0,
|
|
44495
|
+
const handleDepositSuccess = (0, import_react46.useCallback)(
|
|
44290
44496
|
(data) => {
|
|
44291
44497
|
if (depositConfig?.onSuccess) {
|
|
44292
44498
|
depositConfig.onSuccess(data);
|
|
@@ -44298,7 +44504,7 @@ function UnifoldProvider({
|
|
|
44298
44504
|
},
|
|
44299
44505
|
[depositConfig]
|
|
44300
44506
|
);
|
|
44301
|
-
const handleDepositError = (0,
|
|
44507
|
+
const handleDepositError = (0, import_react46.useCallback)(
|
|
44302
44508
|
(error) => {
|
|
44303
44509
|
console.error("[UnifoldProvider] Deposit error:", error);
|
|
44304
44510
|
if (depositConfig?.onError) {
|
|
@@ -44311,12 +44517,12 @@ function UnifoldProvider({
|
|
|
44311
44517
|
},
|
|
44312
44518
|
[depositConfig]
|
|
44313
44519
|
);
|
|
44314
|
-
const checkoutPromiseRef =
|
|
44315
|
-
const checkoutConfigRef =
|
|
44520
|
+
const checkoutPromiseRef = import_react46.default.useRef(null);
|
|
44521
|
+
const checkoutConfigRef = import_react46.default.useRef(null);
|
|
44316
44522
|
checkoutConfigRef.current = checkoutConfig;
|
|
44317
|
-
const checkoutCloseTimeoutRef =
|
|
44318
|
-
const checkoutCloseGuardRef =
|
|
44319
|
-
const beginCheckout = (0,
|
|
44523
|
+
const checkoutCloseTimeoutRef = import_react46.default.useRef(null);
|
|
44524
|
+
const checkoutCloseGuardRef = import_react46.default.useRef(false);
|
|
44525
|
+
const beginCheckout = (0, import_react46.useCallback)((config2) => {
|
|
44320
44526
|
if (checkoutCloseTimeoutRef.current) {
|
|
44321
44527
|
clearTimeout(checkoutCloseTimeoutRef.current);
|
|
44322
44528
|
checkoutCloseTimeoutRef.current = null;
|
|
@@ -44341,7 +44547,7 @@ function UnifoldProvider({
|
|
|
44341
44547
|
setIsCheckoutOpen(true);
|
|
44342
44548
|
return promise;
|
|
44343
44549
|
}, []);
|
|
44344
|
-
const closeCheckout = (0,
|
|
44550
|
+
const closeCheckout = (0, import_react46.useCallback)(() => {
|
|
44345
44551
|
if (checkoutCloseGuardRef.current) {
|
|
44346
44552
|
return;
|
|
44347
44553
|
}
|
|
@@ -44363,7 +44569,7 @@ function UnifoldProvider({
|
|
|
44363
44569
|
checkoutCloseTimeoutRef.current = null;
|
|
44364
44570
|
}, 200);
|
|
44365
44571
|
}, []);
|
|
44366
|
-
const handleCheckoutSuccess = (0,
|
|
44572
|
+
const handleCheckoutSuccess = (0, import_react46.useCallback)(
|
|
44367
44573
|
(data) => {
|
|
44368
44574
|
if (checkoutConfig?.onSuccess) {
|
|
44369
44575
|
checkoutConfig.onSuccess(data);
|
|
@@ -44375,7 +44581,7 @@ function UnifoldProvider({
|
|
|
44375
44581
|
},
|
|
44376
44582
|
[checkoutConfig]
|
|
44377
44583
|
);
|
|
44378
|
-
const handleCheckoutError = (0,
|
|
44584
|
+
const handleCheckoutError = (0, import_react46.useCallback)(
|
|
44379
44585
|
(error) => {
|
|
44380
44586
|
console.error("[UnifoldProvider] Checkout error:", error);
|
|
44381
44587
|
if (checkoutConfig?.onError) {
|
|
@@ -44388,7 +44594,7 @@ function UnifoldProvider({
|
|
|
44388
44594
|
},
|
|
44389
44595
|
[checkoutConfig]
|
|
44390
44596
|
);
|
|
44391
|
-
const beginWithdraw = (0,
|
|
44597
|
+
const beginWithdraw = (0, import_react46.useCallback)((config2) => {
|
|
44392
44598
|
if (withdrawCloseTimeoutRef.current) {
|
|
44393
44599
|
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
44394
44600
|
withdrawCloseTimeoutRef.current = null;
|
|
@@ -44413,7 +44619,7 @@ function UnifoldProvider({
|
|
|
44413
44619
|
setIsWithdrawOpen(true);
|
|
44414
44620
|
return promise;
|
|
44415
44621
|
}, []);
|
|
44416
|
-
const closeWithdraw = (0,
|
|
44622
|
+
const closeWithdraw = (0, import_react46.useCallback)(() => {
|
|
44417
44623
|
if (withdrawCloseGuardRef.current) {
|
|
44418
44624
|
return;
|
|
44419
44625
|
}
|
|
@@ -44435,7 +44641,7 @@ function UnifoldProvider({
|
|
|
44435
44641
|
withdrawCloseTimeoutRef.current = null;
|
|
44436
44642
|
}, 200);
|
|
44437
44643
|
}, []);
|
|
44438
|
-
const handleWithdrawSuccess = (0,
|
|
44644
|
+
const handleWithdrawSuccess = (0, import_react46.useCallback)((data) => {
|
|
44439
44645
|
if (withdrawConfigRef.current?.onSuccess) {
|
|
44440
44646
|
withdrawConfigRef.current.onSuccess(data);
|
|
44441
44647
|
}
|
|
@@ -44444,7 +44650,7 @@ function UnifoldProvider({
|
|
|
44444
44650
|
withdrawPromiseRef.current = null;
|
|
44445
44651
|
}
|
|
44446
44652
|
}, []);
|
|
44447
|
-
const handleWithdrawError = (0,
|
|
44653
|
+
const handleWithdrawError = (0, import_react46.useCallback)((error) => {
|
|
44448
44654
|
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
44449
44655
|
if (withdrawConfigRef.current?.onError) {
|
|
44450
44656
|
withdrawConfigRef.current.onError(error);
|
|
@@ -44454,7 +44660,7 @@ function UnifoldProvider({
|
|
|
44454
44660
|
withdrawPromiseRef.current = null;
|
|
44455
44661
|
}
|
|
44456
44662
|
}, []);
|
|
44457
|
-
const contextValue = (0,
|
|
44663
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
44458
44664
|
() => ({
|
|
44459
44665
|
beginDeposit,
|
|
44460
44666
|
closeDeposit,
|
|
@@ -44593,10 +44799,10 @@ function UnifoldProvider({
|
|
|
44593
44799
|
}
|
|
44594
44800
|
) }) }) }) });
|
|
44595
44801
|
}
|
|
44596
|
-
var ConnectContext =
|
|
44802
|
+
var ConnectContext = import_react46.default.createContext(null);
|
|
44597
44803
|
function useUnifold() {
|
|
44598
44804
|
const baseContext = (0, import_react_provider.useUnifold)();
|
|
44599
|
-
const connectContext =
|
|
44805
|
+
const connectContext = import_react46.default.useContext(ConnectContext);
|
|
44600
44806
|
if (typeof window === "undefined") {
|
|
44601
44807
|
return {
|
|
44602
44808
|
publishableKey: "",
|