@unifold/connect-react 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/README.md +7 -1
- package/dist/index.js +325 -123
- package/dist/index.mjs +293 -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) {
|
|
@@ -18085,7 +18114,11 @@ function BuyWithCard({
|
|
|
18085
18114
|
method: "card",
|
|
18086
18115
|
flow_type: "deposit",
|
|
18087
18116
|
provider: selectedProvider.service_provider,
|
|
18088
|
-
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
|
|
18089
18122
|
});
|
|
18090
18123
|
onEvent?.({
|
|
18091
18124
|
id: (0, import_core2.generatePrefixedKSUID)("sevt"),
|
|
@@ -19522,6 +19555,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19522
19555
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react17.useState)(null);
|
|
19523
19556
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react17.useState)(false);
|
|
19524
19557
|
const upgradeFlowAbortRef = (0, import_react17.useRef)(null);
|
|
19558
|
+
const applyLimitRoutingRef = (0, import_react17.useRef)(() => {
|
|
19559
|
+
});
|
|
19525
19560
|
const [amount, setAmount] = (0, import_react17.useState)(amountUsd ?? "");
|
|
19526
19561
|
const [preparedOrder, setPreparedOrder] = (0, import_react17.useState)(null);
|
|
19527
19562
|
const sessionAbortRef = (0, import_react17.useRef)(null);
|
|
@@ -19656,6 +19691,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19656
19691
|
},
|
|
19657
19692
|
[email, normalizedPhone, userId]
|
|
19658
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
|
+
});
|
|
19659
19702
|
const createSessionAndSendOtp = (0, import_react17.useCallback)(async () => {
|
|
19660
19703
|
setView("submitting_session");
|
|
19661
19704
|
setErrorMessage("");
|
|
@@ -19665,7 +19708,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19665
19708
|
email,
|
|
19666
19709
|
phone: normalizedPhone,
|
|
19667
19710
|
terms_accepted: true,
|
|
19668
|
-
|
|
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.
|
|
19669
19717
|
},
|
|
19670
19718
|
publishableKey
|
|
19671
19719
|
);
|
|
@@ -19675,6 +19723,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19675
19723
|
}
|
|
19676
19724
|
setClientSecret(session.client_secret);
|
|
19677
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
|
+
}
|
|
19678
19754
|
await (0, import_core11.sendOnrampVerificationOtp)(session.id, "phone", session.client_secret, publishableKey);
|
|
19679
19755
|
setResendCooldown(30);
|
|
19680
19756
|
setView("phone_otp");
|
|
@@ -19683,19 +19759,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19683
19759
|
setErrorMessage(prettifyVerificationError(raw));
|
|
19684
19760
|
setView("phone_input");
|
|
19685
19761
|
}
|
|
19686
|
-
}, [
|
|
19762
|
+
}, [
|
|
19763
|
+
email,
|
|
19764
|
+
normalizedPhone,
|
|
19765
|
+
publishableKey,
|
|
19766
|
+
storeWalletPaySession,
|
|
19767
|
+
userId,
|
|
19768
|
+
amountUsd,
|
|
19769
|
+
refetchWalletPayLimits
|
|
19770
|
+
]);
|
|
19687
19771
|
const clearUpgradeFields = (0, import_react17.useCallback)(() => {
|
|
19688
19772
|
setSsnLast4("");
|
|
19689
19773
|
setDobInput("");
|
|
19690
19774
|
}, []);
|
|
19691
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
19692
|
-
userId,
|
|
19693
|
-
publishableKey,
|
|
19694
|
-
normalizedPhone,
|
|
19695
|
-
userEmail,
|
|
19696
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
19697
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
19698
|
-
});
|
|
19699
19775
|
const pollLimitUpgradeStatus = (0, import_react17.useCallback)(
|
|
19700
19776
|
async (signal) => {
|
|
19701
19777
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -19806,6 +19882,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
19806
19882
|
},
|
|
19807
19883
|
[startUpgradePolling]
|
|
19808
19884
|
);
|
|
19885
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
19809
19886
|
const hasInitializedRef = (0, import_react17.useRef)(false);
|
|
19810
19887
|
(0, import_react17.useEffect)(() => {
|
|
19811
19888
|
if (hasInitializedRef.current) return;
|
|
@@ -20035,7 +20112,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
20035
20112
|
track("flow_started", {
|
|
20036
20113
|
method,
|
|
20037
20114
|
flow_type: "deposit",
|
|
20038
|
-
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
|
|
20039
20119
|
});
|
|
20040
20120
|
onEvent?.({
|
|
20041
20121
|
id: (0, import_core11.generatePrefixedKSUID)("sevt"),
|
|
@@ -20085,6 +20165,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
20085
20165
|
defaultTokenLoading,
|
|
20086
20166
|
defaultTokenError,
|
|
20087
20167
|
depositWallet?.address,
|
|
20168
|
+
depositWalletId,
|
|
20088
20169
|
userEmail,
|
|
20089
20170
|
publishableKey,
|
|
20090
20171
|
onEvent,
|
|
@@ -21059,7 +21140,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
21059
21140
|
{
|
|
21060
21141
|
key: "guest_checkout_terms",
|
|
21061
21142
|
name: "Guest Checkout Terms of Service",
|
|
21062
|
-
url: "https://www.coinbase.com/legal/
|
|
21143
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
21063
21144
|
},
|
|
21064
21145
|
{
|
|
21065
21146
|
key: "user_agreement",
|
|
@@ -21079,22 +21160,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
21079
21160
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
21080
21161
|
"div",
|
|
21081
21162
|
{
|
|
21082
|
-
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",
|
|
21083
21164
|
"aria-hidden": true,
|
|
21084
21165
|
"aria-busy": "true",
|
|
21085
21166
|
children: [
|
|
21086
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21087
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
21088
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "uf-h-2
|
|
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 } })
|
|
21089
21170
|
]
|
|
21090
21171
|
}
|
|
21091
21172
|
);
|
|
21092
21173
|
}
|
|
21093
21174
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
21175
|
+
const shortLabels = t.agreements;
|
|
21176
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
21094
21177
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
21095
21178
|
"p",
|
|
21096
21179
|
{
|
|
21097
|
-
className: "uf-text-[
|
|
21180
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
21098
21181
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
21099
21182
|
children: [
|
|
21100
21183
|
t.prefix,
|
|
@@ -21105,12 +21188,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
21105
21188
|
href: a.url,
|
|
21106
21189
|
target: "_blank",
|
|
21107
21190
|
rel: "noopener noreferrer",
|
|
21108
|
-
className: "uf-underline",
|
|
21109
|
-
style: { color:
|
|
21110
|
-
children: a.name
|
|
21191
|
+
className: "uf-no-underline",
|
|
21192
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
21193
|
+
children: shortLabels[a.key] ?? a.name
|
|
21111
21194
|
}
|
|
21112
21195
|
),
|
|
21113
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
21196
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
21114
21197
|
] }, a.key)),
|
|
21115
21198
|
t.suffix
|
|
21116
21199
|
]
|
|
@@ -21753,6 +21836,7 @@ function PayWithCashApp({
|
|
|
21753
21836
|
destinationChainType,
|
|
21754
21837
|
destinationChainId,
|
|
21755
21838
|
destinationTokenAddress,
|
|
21839
|
+
contractCalls,
|
|
21756
21840
|
cashAppIconUrl,
|
|
21757
21841
|
view: controlledView,
|
|
21758
21842
|
onViewChange,
|
|
@@ -21845,7 +21929,8 @@ function PayWithCashApp({
|
|
|
21845
21929
|
destination_token_address: destinationTokenAddress,
|
|
21846
21930
|
recipient_address: recipientAddress,
|
|
21847
21931
|
source_amount: amount,
|
|
21848
|
-
external_id: externalId
|
|
21932
|
+
external_id: externalId,
|
|
21933
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
21849
21934
|
},
|
|
21850
21935
|
publishableKey
|
|
21851
21936
|
);
|
|
@@ -21858,7 +21943,10 @@ function PayWithCashApp({
|
|
|
21858
21943
|
track("flow_started", {
|
|
21859
21944
|
method: "cashapp",
|
|
21860
21945
|
flow_type: "deposit",
|
|
21861
|
-
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
|
|
21862
21950
|
});
|
|
21863
21951
|
onEvent?.({
|
|
21864
21952
|
id: (0, import_core19.generatePrefixedKSUID)("sevt"),
|
|
@@ -21883,6 +21971,8 @@ function PayWithCashApp({
|
|
|
21883
21971
|
destinationChainType,
|
|
21884
21972
|
destinationChainId,
|
|
21885
21973
|
destinationTokenAddress,
|
|
21974
|
+
contractCalls,
|
|
21975
|
+
depositWalletId,
|
|
21886
21976
|
onEvent,
|
|
21887
21977
|
onDepositError,
|
|
21888
21978
|
track,
|
|
@@ -22484,7 +22574,10 @@ function BankTransfer({
|
|
|
22484
22574
|
method: "bank_transfer",
|
|
22485
22575
|
flow_type: "deposit",
|
|
22486
22576
|
provider: request.service_provider,
|
|
22487
|
-
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
|
|
22488
22581
|
});
|
|
22489
22582
|
onEvent?.({
|
|
22490
22583
|
id: (0, import_core21.generatePrefixedKSUID)("sevt"),
|
|
@@ -28565,7 +28658,11 @@ function PayWithStripeLink({
|
|
|
28565
28658
|
if (checkoutResult.successful) {
|
|
28566
28659
|
handledTerminalSessionRef.current = null;
|
|
28567
28660
|
executionReconciledSessionRef.current = null;
|
|
28568
|
-
track("flow_started", {
|
|
28661
|
+
track("flow_started", {
|
|
28662
|
+
method: "stripe_link",
|
|
28663
|
+
flow_type: "deposit",
|
|
28664
|
+
deposit_wallet_id: depositWalletId
|
|
28665
|
+
});
|
|
28569
28666
|
setConfirmedSessionId(activeSessionId);
|
|
28570
28667
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
28571
28668
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -30062,7 +30159,14 @@ function PayWithStripeLink({
|
|
|
30062
30159
|
]
|
|
30063
30160
|
}
|
|
30064
30161
|
),
|
|
30065
|
-
/* @__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
|
+
)
|
|
30066
30170
|
]
|
|
30067
30171
|
}
|
|
30068
30172
|
);
|
|
@@ -31325,6 +31429,9 @@ function CoinbaseConnect({
|
|
|
31325
31429
|
flow_type: "deposit",
|
|
31326
31430
|
method: "exchange_connect",
|
|
31327
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,
|
|
31328
31435
|
amount_usd: sendAmount || void 0,
|
|
31329
31436
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
31330
31437
|
chain: sourceChain?.chain_id,
|
|
@@ -31332,6 +31439,34 @@ function CoinbaseConnect({
|
|
|
31332
31439
|
network: sourceChain?.network
|
|
31333
31440
|
});
|
|
31334
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
|
+
};
|
|
31335
31470
|
const handleConfirmTransfer = async () => {
|
|
31336
31471
|
if (!transferIntent || !accessToken) return;
|
|
31337
31472
|
setIsLoading(true);
|
|
@@ -31366,30 +31501,7 @@ function CoinbaseConnect({
|
|
|
31366
31501
|
});
|
|
31367
31502
|
throw err;
|
|
31368
31503
|
});
|
|
31369
|
-
|
|
31370
|
-
track("verification_started", {
|
|
31371
|
-
flow_type: "deposit",
|
|
31372
|
-
method: "exchange_connect",
|
|
31373
|
-
provider: import_core26.IntegrationProvider.COINBASE,
|
|
31374
|
-
verification_type: "mfa",
|
|
31375
|
-
verification_status: result.status
|
|
31376
|
-
});
|
|
31377
|
-
transitionTo("mfa");
|
|
31378
|
-
setMfaCode("");
|
|
31379
|
-
setMfaError(false);
|
|
31380
|
-
} else if (result.status === "completed") {
|
|
31381
|
-
trackTransferStarted();
|
|
31382
|
-
setConfirmResult(result);
|
|
31383
|
-
transitionTo("success");
|
|
31384
|
-
onTransferSuccess?.(result);
|
|
31385
|
-
} else {
|
|
31386
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
31387
|
-
transitionTo("error");
|
|
31388
|
-
onTransferError?.({
|
|
31389
|
-
message: result.message || t.errors.transferFailed,
|
|
31390
|
-
code: result.status
|
|
31391
|
-
});
|
|
31392
|
-
}
|
|
31504
|
+
applyConfirmResult(result);
|
|
31393
31505
|
} catch (err) {
|
|
31394
31506
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
31395
31507
|
setErrorMessage(message);
|
|
@@ -31546,6 +31658,9 @@ function CoinbaseConnect({
|
|
|
31546
31658
|
setShowTransferDetails(false);
|
|
31547
31659
|
transitionTo("enter_amount");
|
|
31548
31660
|
break;
|
|
31661
|
+
case "mfa_enrollment":
|
|
31662
|
+
transitionTo("transfer_confirm");
|
|
31663
|
+
break;
|
|
31549
31664
|
case "mfa":
|
|
31550
31665
|
transitionTo("transfer_confirm");
|
|
31551
31666
|
break;
|
|
@@ -33102,6 +33217,55 @@ function CoinbaseConnect({
|
|
|
33102
33217
|
] })
|
|
33103
33218
|
] });
|
|
33104
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
|
+
}
|
|
33105
33269
|
if (view === "mfa") {
|
|
33106
33270
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
33107
33271
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -39029,7 +39193,11 @@ function WalletConnect({
|
|
|
39029
39193
|
chain: String(token.chain_id),
|
|
39030
39194
|
network: token.network,
|
|
39031
39195
|
token: token.symbol ?? token.token_address,
|
|
39032
|
-
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
|
|
39033
39201
|
});
|
|
39034
39202
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
39035
39203
|
setHasSignedTransaction(true);
|
|
@@ -39616,7 +39784,7 @@ function DepositModal({
|
|
|
39616
39784
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
39617
39785
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
39618
39786
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
39619
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
39787
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
39620
39788
|
const normalizedPrefilledAmountUsd = (0, import_react7.useMemo)(
|
|
39621
39789
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
39622
39790
|
[prefilledAmountUsd]
|
|
@@ -39624,6 +39792,7 @@ function DepositModal({
|
|
|
39624
39792
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
39625
39793
|
const journeyActiveRef = (0, import_react7.useRef)(false);
|
|
39626
39794
|
const journeySessionIdRef = (0, import_react7.useRef)(void 0);
|
|
39795
|
+
const journeyExternalUserIdRef = (0, import_react7.useRef)(void 0);
|
|
39627
39796
|
const externalUserId = userId || void 0;
|
|
39628
39797
|
const emitEvent = (0, import_react7.useCallback)(
|
|
39629
39798
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -39651,6 +39820,9 @@ function DepositModal({
|
|
|
39651
39820
|
method: analyticsMethod(method),
|
|
39652
39821
|
flow_type: "deposit",
|
|
39653
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,
|
|
39654
39826
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
39655
39827
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
39656
39828
|
// the onEvent DirectExecution instead).
|
|
@@ -39678,6 +39850,7 @@ function DepositModal({
|
|
|
39678
39850
|
method: analyticsMethod(method),
|
|
39679
39851
|
flow_type: "deposit",
|
|
39680
39852
|
error_code: error.code,
|
|
39853
|
+
execution_id: execution?.id,
|
|
39681
39854
|
failure_reason: execution?.failureReason ?? void 0,
|
|
39682
39855
|
status: execution?.status,
|
|
39683
39856
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -40106,8 +40279,10 @@ function DepositModal({
|
|
|
40106
40279
|
const beginJourney = (0, import_react7.useCallback)(() => {
|
|
40107
40280
|
journeySessionIdRef.current = startSession();
|
|
40108
40281
|
journeyActiveRef.current = true;
|
|
40282
|
+
journeyExternalUserIdRef.current = userId;
|
|
40283
|
+
setUserId(null);
|
|
40109
40284
|
track("widget_opened", { flow_type: "deposit" });
|
|
40110
|
-
}, [startSession, track]);
|
|
40285
|
+
}, [startSession, track, setUserId, userId]);
|
|
40111
40286
|
const handleClose = () => {
|
|
40112
40287
|
finalizeJourney();
|
|
40113
40288
|
onOpenChange(false);
|
|
@@ -40132,6 +40307,11 @@ function DepositModal({
|
|
|
40132
40307
|
}
|
|
40133
40308
|
beginJourney();
|
|
40134
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]);
|
|
40135
40315
|
(0, import_react7.useLayoutEffect)(() => {
|
|
40136
40316
|
if (!open) return;
|
|
40137
40317
|
if (resetViewTimeoutRef.current) {
|
|
@@ -41043,6 +41223,7 @@ function DepositModal({
|
|
|
41043
41223
|
destinationChainType,
|
|
41044
41224
|
destinationChainId,
|
|
41045
41225
|
destinationTokenAddress,
|
|
41226
|
+
contractCalls,
|
|
41046
41227
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
41047
41228
|
view: cashAppView,
|
|
41048
41229
|
onViewChange: setCashAppView,
|
|
@@ -41378,6 +41559,9 @@ function CheckoutModal({
|
|
|
41378
41559
|
flowCompletedRef.current = true;
|
|
41379
41560
|
track("flow_completed", {
|
|
41380
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,
|
|
41381
41565
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
41382
41566
|
});
|
|
41383
41567
|
}
|
|
@@ -41598,7 +41782,7 @@ function CheckoutModal({
|
|
|
41598
41782
|
journeySessionIdRef.current = startSession();
|
|
41599
41783
|
journeyActiveRef.current = true;
|
|
41600
41784
|
flowCompletedRef.current = false;
|
|
41601
|
-
setUserId(null);
|
|
41785
|
+
setUserId(paymentIntentUserId ?? null);
|
|
41602
41786
|
track("widget_opened", { flow_type: "checkout" });
|
|
41603
41787
|
if (resetViewTimeoutRef.current) {
|
|
41604
41788
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -42183,7 +42367,7 @@ function useAddressBalance(params) {
|
|
|
42183
42367
|
}
|
|
42184
42368
|
function useExecutions(userId, publishableKey, options) {
|
|
42185
42369
|
const actionType = options?.actionType ?? import_core51.ActionType.Deposit;
|
|
42186
|
-
|
|
42370
|
+
const query = (0, import_react_query24.useQuery)({
|
|
42187
42371
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
42188
42372
|
queryFn: () => (0, import_core51.queryExecutions)(userId, publishableKey, actionType),
|
|
42189
42373
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
@@ -42192,6 +42376,8 @@ function useExecutions(userId, publishableKey, options) {
|
|
|
42192
42376
|
gcTime: 1e3 * 60 * 5,
|
|
42193
42377
|
refetchOnWindowFocus: false
|
|
42194
42378
|
});
|
|
42379
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
42380
|
+
return query;
|
|
42195
42381
|
}
|
|
42196
42382
|
var POLL_INTERVAL_MS4 = 2500;
|
|
42197
42383
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -42566,7 +42752,6 @@ function useGetDepositAddress(params) {
|
|
|
42566
42752
|
actionType,
|
|
42567
42753
|
enabled = true
|
|
42568
42754
|
} = params;
|
|
42569
|
-
const { setUserId } = useAnalytics();
|
|
42570
42755
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
42571
42756
|
const query = (0, import_react_query26.useQuery)({
|
|
42572
42757
|
queryKey: [
|
|
@@ -42598,11 +42783,7 @@ function useGetDepositAddress(params) {
|
|
|
42598
42783
|
refetchOnWindowFocus: false,
|
|
42599
42784
|
retry: 1
|
|
42600
42785
|
});
|
|
42601
|
-
(
|
|
42602
|
-
if (query.data?.user_id) {
|
|
42603
|
-
setUserId(query.data.user_id);
|
|
42604
|
-
}
|
|
42605
|
-
}, [query.data?.user_id, setUserId]);
|
|
42786
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
42606
42787
|
return query;
|
|
42607
42788
|
}
|
|
42608
42789
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -43552,9 +43733,9 @@ function WithdrawConfirmingView({
|
|
|
43552
43733
|
const { colors: colors2, fonts, components } = useTheme();
|
|
43553
43734
|
const { t: strings } = useI18n();
|
|
43554
43735
|
const t = strings.withdrawModal.details;
|
|
43555
|
-
const [showButton, setShowButton] = (0,
|
|
43736
|
+
const [showButton, setShowButton] = (0, import_react44.useState)(false);
|
|
43556
43737
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
43557
|
-
(0,
|
|
43738
|
+
(0, import_react44.useEffect)(() => {
|
|
43558
43739
|
if (latestExecution) return;
|
|
43559
43740
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
43560
43741
|
return () => clearTimeout(timer);
|
|
@@ -43723,12 +43904,16 @@ function WithdrawModal({
|
|
|
43723
43904
|
);
|
|
43724
43905
|
const journeyActiveRef = (0, import_react40.useRef)(false);
|
|
43725
43906
|
const journeySessionIdRef = (0, import_react40.useRef)(void 0);
|
|
43907
|
+
const journeyExternalUserIdRef = (0, import_react40.useRef)(void 0);
|
|
43726
43908
|
const onWithdrawSuccessFor = (0, import_react40.useCallback)(
|
|
43727
43909
|
(data) => {
|
|
43728
43910
|
const execution = data.execution?.data.object;
|
|
43729
43911
|
track("flow_completed", {
|
|
43730
43912
|
flow_type: "withdraw",
|
|
43731
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,
|
|
43732
43917
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
43733
43918
|
status: execution?.status,
|
|
43734
43919
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -43749,6 +43934,7 @@ function WithdrawModal({
|
|
|
43749
43934
|
track("flow_failed", {
|
|
43750
43935
|
flow_type: "withdraw",
|
|
43751
43936
|
error_code: error.code,
|
|
43937
|
+
execution_id: execution?.id,
|
|
43752
43938
|
failure_reason: execution?.failureReason ?? void 0,
|
|
43753
43939
|
status: execution?.status,
|
|
43754
43940
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -43822,6 +44008,7 @@ function WithdrawModal({
|
|
|
43822
44008
|
) ?? null : null;
|
|
43823
44009
|
const [view, setView] = (0, import_react40.useState)("form");
|
|
43824
44010
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react40.useState)();
|
|
44011
|
+
const withdrawDepositWalletIdRef = (0, import_react40.useRef)(void 0);
|
|
43825
44012
|
const [selectedExecution, setSelectedExecution] = (0, import_react40.useState)(null);
|
|
43826
44013
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react40.useState)(null);
|
|
43827
44014
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -43859,6 +44046,7 @@ function WithdrawModal({
|
|
|
43859
44046
|
if (!depositWallet) {
|
|
43860
44047
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
43861
44048
|
}
|
|
44049
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
43862
44050
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
43863
44051
|
return depositWallet;
|
|
43864
44052
|
},
|
|
@@ -43878,7 +44066,12 @@ function WithdrawModal({
|
|
|
43878
44066
|
currency: tokenData?.currency,
|
|
43879
44067
|
amount: txInfo.amount,
|
|
43880
44068
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
43881
|
-
...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
|
|
43882
44075
|
});
|
|
43883
44076
|
emitEvent({
|
|
43884
44077
|
id: (0, import_core59.generatePrefixedKSUID)("sevt"),
|
|
@@ -43912,8 +44105,10 @@ function WithdrawModal({
|
|
|
43912
44105
|
const beginJourney = (0, import_react40.useCallback)(() => {
|
|
43913
44106
|
journeySessionIdRef.current = startSession();
|
|
43914
44107
|
journeyActiveRef.current = true;
|
|
44108
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
44109
|
+
setUserId(null);
|
|
43915
44110
|
track("widget_opened", { flow_type: "withdraw" });
|
|
43916
|
-
}, [startSession, track]);
|
|
44111
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
43917
44112
|
const handleClose = (0, import_react40.useCallback)(() => {
|
|
43918
44113
|
finalizeJourney();
|
|
43919
44114
|
onOpenChange(false);
|
|
@@ -43922,6 +44117,7 @@ function WithdrawModal({
|
|
|
43922
44117
|
setView("form");
|
|
43923
44118
|
setSelectedExecution(null);
|
|
43924
44119
|
setSubmittedTxInfo(null);
|
|
44120
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
43925
44121
|
setWithdrawDepositWalletId(void 0);
|
|
43926
44122
|
resetViewTimeoutRef.current = null;
|
|
43927
44123
|
}, 200);
|
|
@@ -43939,8 +44135,14 @@ function WithdrawModal({
|
|
|
43939
44135
|
setView("form");
|
|
43940
44136
|
setSelectedExecution(null);
|
|
43941
44137
|
setSubmittedTxInfo(null);
|
|
44138
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
43942
44139
|
setWithdrawDepositWalletId(void 0);
|
|
43943
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]);
|
|
43944
44146
|
(0, import_react40.useEffect)(
|
|
43945
44147
|
() => () => {
|
|
43946
44148
|
if (journeyActiveRef.current) {
|
|
@@ -44183,32 +44385,32 @@ function UnifoldProvider({
|
|
|
44183
44385
|
queryClient,
|
|
44184
44386
|
config
|
|
44185
44387
|
}) {
|
|
44186
|
-
const [isOpen, setIsOpen] = (0,
|
|
44187
|
-
const [depositConfig, setDepositConfig] = (0,
|
|
44188
|
-
const [isCheckoutOpen, setIsCheckoutOpen] = (0,
|
|
44189
|
-
const [checkoutConfig, setCheckoutConfig] = (0,
|
|
44190
|
-
const [isWithdrawOpen, setIsWithdrawOpen] = (0,
|
|
44191
|
-
const [withdrawConfig, setWithdrawConfig] = (0,
|
|
44192
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
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");
|
|
44193
44395
|
const incidentBannerEnabled = config?.notifications?.incidentBanner;
|
|
44194
|
-
const tracker = (0,
|
|
44396
|
+
const tracker = (0, import_react46.useMemo)(
|
|
44195
44397
|
() => createEventTracker({
|
|
44196
44398
|
publishableKey,
|
|
44197
44399
|
endpoint: `${(0, import_core60.getApiBaseUrl)()}/v1/public/events`
|
|
44198
44400
|
}),
|
|
44199
44401
|
[publishableKey]
|
|
44200
44402
|
);
|
|
44201
|
-
(0,
|
|
44403
|
+
(0, import_react46.useEffect)(() => {
|
|
44202
44404
|
return () => {
|
|
44203
44405
|
tracker?.destroy();
|
|
44204
44406
|
};
|
|
44205
44407
|
}, [tracker]);
|
|
44206
|
-
(0,
|
|
44408
|
+
(0, import_react46.useEffect)(() => {
|
|
44207
44409
|
if (publishableKey) {
|
|
44208
44410
|
(0, import_core60.setApiConfig)({ publishableKey });
|
|
44209
44411
|
}
|
|
44210
44412
|
}, [publishableKey]);
|
|
44211
|
-
|
|
44413
|
+
import_react46.default.useEffect(() => {
|
|
44212
44414
|
const appearance = config?.appearance || "dark";
|
|
44213
44415
|
if (appearance === "auto") {
|
|
44214
44416
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -44223,17 +44425,17 @@ function UnifoldProvider({
|
|
|
44223
44425
|
setResolvedTheme(appearance);
|
|
44224
44426
|
}
|
|
44225
44427
|
}, [config?.appearance]);
|
|
44226
|
-
const depositPromiseRef =
|
|
44227
|
-
const depositConfigRef =
|
|
44428
|
+
const depositPromiseRef = import_react46.default.useRef(null);
|
|
44429
|
+
const depositConfigRef = import_react46.default.useRef(null);
|
|
44228
44430
|
depositConfigRef.current = depositConfig;
|
|
44229
|
-
const closeTimeoutRef =
|
|
44230
|
-
const closeGuardRef =
|
|
44231
|
-
const withdrawPromiseRef =
|
|
44232
|
-
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);
|
|
44233
44435
|
withdrawConfigRef.current = withdrawConfig;
|
|
44234
|
-
const withdrawCloseTimeoutRef =
|
|
44235
|
-
const withdrawCloseGuardRef =
|
|
44236
|
-
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) => {
|
|
44237
44439
|
if (closeTimeoutRef.current) {
|
|
44238
44440
|
clearTimeout(closeTimeoutRef.current);
|
|
44239
44441
|
closeTimeoutRef.current = null;
|
|
@@ -44268,7 +44470,7 @@ function UnifoldProvider({
|
|
|
44268
44470
|
setIsOpen(true);
|
|
44269
44471
|
return promise;
|
|
44270
44472
|
}, []);
|
|
44271
|
-
const closeDeposit = (0,
|
|
44473
|
+
const closeDeposit = (0, import_react46.useCallback)(() => {
|
|
44272
44474
|
if (closeGuardRef.current) {
|
|
44273
44475
|
return;
|
|
44274
44476
|
}
|
|
@@ -44290,7 +44492,7 @@ function UnifoldProvider({
|
|
|
44290
44492
|
closeTimeoutRef.current = null;
|
|
44291
44493
|
}, 200);
|
|
44292
44494
|
}, []);
|
|
44293
|
-
const handleDepositSuccess = (0,
|
|
44495
|
+
const handleDepositSuccess = (0, import_react46.useCallback)(
|
|
44294
44496
|
(data) => {
|
|
44295
44497
|
if (depositConfig?.onSuccess) {
|
|
44296
44498
|
depositConfig.onSuccess(data);
|
|
@@ -44302,7 +44504,7 @@ function UnifoldProvider({
|
|
|
44302
44504
|
},
|
|
44303
44505
|
[depositConfig]
|
|
44304
44506
|
);
|
|
44305
|
-
const handleDepositError = (0,
|
|
44507
|
+
const handleDepositError = (0, import_react46.useCallback)(
|
|
44306
44508
|
(error) => {
|
|
44307
44509
|
console.error("[UnifoldProvider] Deposit error:", error);
|
|
44308
44510
|
if (depositConfig?.onError) {
|
|
@@ -44315,12 +44517,12 @@ function UnifoldProvider({
|
|
|
44315
44517
|
},
|
|
44316
44518
|
[depositConfig]
|
|
44317
44519
|
);
|
|
44318
|
-
const checkoutPromiseRef =
|
|
44319
|
-
const checkoutConfigRef =
|
|
44520
|
+
const checkoutPromiseRef = import_react46.default.useRef(null);
|
|
44521
|
+
const checkoutConfigRef = import_react46.default.useRef(null);
|
|
44320
44522
|
checkoutConfigRef.current = checkoutConfig;
|
|
44321
|
-
const checkoutCloseTimeoutRef =
|
|
44322
|
-
const checkoutCloseGuardRef =
|
|
44323
|
-
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) => {
|
|
44324
44526
|
if (checkoutCloseTimeoutRef.current) {
|
|
44325
44527
|
clearTimeout(checkoutCloseTimeoutRef.current);
|
|
44326
44528
|
checkoutCloseTimeoutRef.current = null;
|
|
@@ -44345,7 +44547,7 @@ function UnifoldProvider({
|
|
|
44345
44547
|
setIsCheckoutOpen(true);
|
|
44346
44548
|
return promise;
|
|
44347
44549
|
}, []);
|
|
44348
|
-
const closeCheckout = (0,
|
|
44550
|
+
const closeCheckout = (0, import_react46.useCallback)(() => {
|
|
44349
44551
|
if (checkoutCloseGuardRef.current) {
|
|
44350
44552
|
return;
|
|
44351
44553
|
}
|
|
@@ -44367,7 +44569,7 @@ function UnifoldProvider({
|
|
|
44367
44569
|
checkoutCloseTimeoutRef.current = null;
|
|
44368
44570
|
}, 200);
|
|
44369
44571
|
}, []);
|
|
44370
|
-
const handleCheckoutSuccess = (0,
|
|
44572
|
+
const handleCheckoutSuccess = (0, import_react46.useCallback)(
|
|
44371
44573
|
(data) => {
|
|
44372
44574
|
if (checkoutConfig?.onSuccess) {
|
|
44373
44575
|
checkoutConfig.onSuccess(data);
|
|
@@ -44379,7 +44581,7 @@ function UnifoldProvider({
|
|
|
44379
44581
|
},
|
|
44380
44582
|
[checkoutConfig]
|
|
44381
44583
|
);
|
|
44382
|
-
const handleCheckoutError = (0,
|
|
44584
|
+
const handleCheckoutError = (0, import_react46.useCallback)(
|
|
44383
44585
|
(error) => {
|
|
44384
44586
|
console.error("[UnifoldProvider] Checkout error:", error);
|
|
44385
44587
|
if (checkoutConfig?.onError) {
|
|
@@ -44392,7 +44594,7 @@ function UnifoldProvider({
|
|
|
44392
44594
|
},
|
|
44393
44595
|
[checkoutConfig]
|
|
44394
44596
|
);
|
|
44395
|
-
const beginWithdraw = (0,
|
|
44597
|
+
const beginWithdraw = (0, import_react46.useCallback)((config2) => {
|
|
44396
44598
|
if (withdrawCloseTimeoutRef.current) {
|
|
44397
44599
|
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
44398
44600
|
withdrawCloseTimeoutRef.current = null;
|
|
@@ -44417,7 +44619,7 @@ function UnifoldProvider({
|
|
|
44417
44619
|
setIsWithdrawOpen(true);
|
|
44418
44620
|
return promise;
|
|
44419
44621
|
}, []);
|
|
44420
|
-
const closeWithdraw = (0,
|
|
44622
|
+
const closeWithdraw = (0, import_react46.useCallback)(() => {
|
|
44421
44623
|
if (withdrawCloseGuardRef.current) {
|
|
44422
44624
|
return;
|
|
44423
44625
|
}
|
|
@@ -44439,7 +44641,7 @@ function UnifoldProvider({
|
|
|
44439
44641
|
withdrawCloseTimeoutRef.current = null;
|
|
44440
44642
|
}, 200);
|
|
44441
44643
|
}, []);
|
|
44442
|
-
const handleWithdrawSuccess = (0,
|
|
44644
|
+
const handleWithdrawSuccess = (0, import_react46.useCallback)((data) => {
|
|
44443
44645
|
if (withdrawConfigRef.current?.onSuccess) {
|
|
44444
44646
|
withdrawConfigRef.current.onSuccess(data);
|
|
44445
44647
|
}
|
|
@@ -44448,7 +44650,7 @@ function UnifoldProvider({
|
|
|
44448
44650
|
withdrawPromiseRef.current = null;
|
|
44449
44651
|
}
|
|
44450
44652
|
}, []);
|
|
44451
|
-
const handleWithdrawError = (0,
|
|
44653
|
+
const handleWithdrawError = (0, import_react46.useCallback)((error) => {
|
|
44452
44654
|
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
44453
44655
|
if (withdrawConfigRef.current?.onError) {
|
|
44454
44656
|
withdrawConfigRef.current.onError(error);
|
|
@@ -44458,7 +44660,7 @@ function UnifoldProvider({
|
|
|
44458
44660
|
withdrawPromiseRef.current = null;
|
|
44459
44661
|
}
|
|
44460
44662
|
}, []);
|
|
44461
|
-
const contextValue = (0,
|
|
44663
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
44462
44664
|
() => ({
|
|
44463
44665
|
beginDeposit,
|
|
44464
44666
|
closeDeposit,
|
|
@@ -44597,10 +44799,10 @@ function UnifoldProvider({
|
|
|
44597
44799
|
}
|
|
44598
44800
|
) }) }) }) });
|
|
44599
44801
|
}
|
|
44600
|
-
var ConnectContext =
|
|
44802
|
+
var ConnectContext = import_react46.default.createContext(null);
|
|
44601
44803
|
function useUnifold() {
|
|
44602
44804
|
const baseContext = (0, import_react_provider.useUnifold)();
|
|
44603
|
-
const connectContext =
|
|
44805
|
+
const connectContext = import_react46.default.useContext(ConnectContext);
|
|
44604
44806
|
if (typeof window === "undefined") {
|
|
44605
44807
|
return {
|
|
44606
44808
|
publishableKey: "",
|