@unifold/ui-web 0.1.77 → 0.1.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +341 -171
- package/dist/index.mjs +341 -171
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -38855,12 +38855,12 @@ var require_useQuery = __commonJS({
|
|
|
38855
38855
|
var __toCommonJS2 = (mod) => __copyProps3(__defProp4({}, "__esModule", { value: true }), mod);
|
|
38856
38856
|
var useQuery_exports = {};
|
|
38857
38857
|
__export2(useQuery_exports, {
|
|
38858
|
-
useQuery: () =>
|
|
38858
|
+
useQuery: () => useQuery26
|
|
38859
38859
|
});
|
|
38860
38860
|
module2.exports = __toCommonJS2(useQuery_exports);
|
|
38861
38861
|
var import_query_core = require_modern();
|
|
38862
38862
|
var import_useBaseQuery = require_useBaseQuery();
|
|
38863
|
-
function
|
|
38863
|
+
function useQuery26(options2, queryClient) {
|
|
38864
38864
|
return (0, import_useBaseQuery.useBaseQuery)(options2, import_query_core.QueryObserver, queryClient);
|
|
38865
38865
|
}
|
|
38866
38866
|
}
|
|
@@ -39611,7 +39611,7 @@ __export(index_exports, {
|
|
|
39611
39611
|
module.exports = __toCommonJS(index_exports);
|
|
39612
39612
|
|
|
39613
39613
|
// src/unifold.tsx
|
|
39614
|
-
var
|
|
39614
|
+
var import_react48 = __toESM(require_react());
|
|
39615
39615
|
var import_client = __toESM(require_client());
|
|
39616
39616
|
|
|
39617
39617
|
// ../connect-react/dist/index.mjs
|
|
@@ -39769,7 +39769,7 @@ function generateKSUID() {
|
|
|
39769
39769
|
function generatePrefixedKSUID(prefix) {
|
|
39770
39770
|
return `${prefix}_${generateKSUID()}`;
|
|
39771
39771
|
}
|
|
39772
|
-
var SDK_VERSION = true ? "0.1.
|
|
39772
|
+
var SDK_VERSION = true ? "0.1.79" : "0.0.0-dev";
|
|
39773
39773
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
39774
39774
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
39775
39775
|
function detectRuntime() {
|
|
@@ -40912,25 +40912,6 @@ async function buildHypercoreTransaction(request, publishableKey) {
|
|
|
40912
40912
|
}
|
|
40913
40913
|
return response.json();
|
|
40914
40914
|
}
|
|
40915
|
-
async function getCashAppLimits(currency = "usd", publishableKey) {
|
|
40916
|
-
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
40917
|
-
validatePublishableKey(pk);
|
|
40918
|
-
const response = await apiFetch(
|
|
40919
|
-
`${API_BASE_URL}/v1/public/onramps/cashapp/limits?currency=${encodeURIComponent(currency)}`,
|
|
40920
|
-
{
|
|
40921
|
-
method: "GET",
|
|
40922
|
-
headers: {
|
|
40923
|
-
accept: "application/json",
|
|
40924
|
-
"x-publishable-key": pk
|
|
40925
|
-
}
|
|
40926
|
-
}
|
|
40927
|
-
);
|
|
40928
|
-
if (!response.ok) {
|
|
40929
|
-
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
40930
|
-
throw new Error(`Failed to get Cash App limits: ${error.message || response.statusText}`);
|
|
40931
|
-
}
|
|
40932
|
-
return response.json();
|
|
40933
|
-
}
|
|
40934
40915
|
async function createCashAppSession(request, publishableKey) {
|
|
40935
40916
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
40936
40917
|
validatePublishableKey(pk);
|
|
@@ -41595,8 +41576,8 @@ var OnrampSessionEventType = ((OnrampSessionEventType2) => {
|
|
|
41595
41576
|
})(OnrampSessionEventType || {});
|
|
41596
41577
|
|
|
41597
41578
|
// ../connect-react/dist/index.mjs
|
|
41598
|
-
var import_react8 = __toESM(require_react(), 1);
|
|
41599
41579
|
var import_react_query3 = __toESM(require_modern2(), 1);
|
|
41580
|
+
var import_react8 = __toESM(require_react(), 1);
|
|
41600
41581
|
var React52 = __toESM(require_react(), 1);
|
|
41601
41582
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
41602
41583
|
var import_react9 = __toESM(require_react(), 1);
|
|
@@ -41637,10 +41618,9 @@ var import_react23 = __toESM(require_react(), 1);
|
|
|
41637
41618
|
var import_react_query9 = __toESM(require_modern2(), 1);
|
|
41638
41619
|
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
41639
41620
|
var import_react24 = __toESM(require_react(), 1);
|
|
41640
|
-
var import_react_query10 = __toESM(require_modern2(), 1);
|
|
41641
41621
|
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
41642
41622
|
var import_react25 = __toESM(require_react(), 1);
|
|
41643
|
-
var
|
|
41623
|
+
var import_react_query10 = __toESM(require_modern2(), 1);
|
|
41644
41624
|
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
41645
41625
|
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
41646
41626
|
var React92 = __toESM(require_react(), 1);
|
|
@@ -41702,14 +41682,14 @@ var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
|
41702
41682
|
var import_react27 = __toESM(require_react(), 1);
|
|
41703
41683
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
41704
41684
|
var import_react28 = __toESM(require_react(), 1);
|
|
41685
|
+
var import_react_query11 = __toESM(require_modern2(), 1);
|
|
41705
41686
|
var import_react_query12 = __toESM(require_modern2(), 1);
|
|
41706
|
-
var import_react_query13 = __toESM(require_modern2(), 1);
|
|
41707
41687
|
var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
|
|
41688
|
+
var import_react_query13 = __toESM(require_modern2(), 1);
|
|
41708
41689
|
var import_react_query14 = __toESM(require_modern2(), 1);
|
|
41709
41690
|
var import_react_query15 = __toESM(require_modern2(), 1);
|
|
41710
|
-
var import_react_query16 = __toESM(require_modern2(), 1);
|
|
41711
41691
|
var import_react29 = __toESM(require_react(), 1);
|
|
41712
|
-
var
|
|
41692
|
+
var import_react_query16 = __toESM(require_modern2(), 1);
|
|
41713
41693
|
var import_react30 = __toESM(require_react(), 1);
|
|
41714
41694
|
var import_react31 = __toESM(require_react(), 1);
|
|
41715
41695
|
var React362 = __toESM(require_react(), 1);
|
|
@@ -41736,7 +41716,7 @@ var React30 = __toESM(require_react(), 1);
|
|
|
41736
41716
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
41737
41717
|
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
|
|
41738
41718
|
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
41739
|
-
var
|
|
41719
|
+
var import_react_query17 = __toESM(require_modern2(), 1);
|
|
41740
41720
|
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
|
|
41741
41721
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
41742
41722
|
var import_react36 = __toESM(require_react(), 1);
|
|
@@ -41754,8 +41734,8 @@ var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
|
41754
41734
|
var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
|
|
41755
41735
|
var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
|
|
41756
41736
|
var React39 = __toESM(require_react(), 1);
|
|
41737
|
+
var import_react_query18 = __toESM(require_modern2(), 1);
|
|
41757
41738
|
var import_react_query19 = __toESM(require_modern2(), 1);
|
|
41758
|
-
var import_react_query20 = __toESM(require_modern2(), 1);
|
|
41759
41739
|
var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
|
|
41760
41740
|
var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
|
|
41761
41741
|
var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -41770,26 +41750,25 @@ var React41 = __toESM(require_react(), 1);
|
|
|
41770
41750
|
var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
|
|
41771
41751
|
var import_react40 = __toESM(require_react(), 1);
|
|
41772
41752
|
var import_react41 = __toESM(require_react(), 1);
|
|
41773
|
-
var
|
|
41753
|
+
var import_react_query20 = __toESM(require_modern2(), 1);
|
|
41774
41754
|
var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
|
|
41775
41755
|
var import_react42 = __toESM(require_react(), 1);
|
|
41756
|
+
var import_react_query21 = __toESM(require_modern2(), 1);
|
|
41776
41757
|
var import_react_query22 = __toESM(require_modern2(), 1);
|
|
41777
41758
|
var import_react_query23 = __toESM(require_modern2(), 1);
|
|
41778
41759
|
var import_react_query24 = __toESM(require_modern2(), 1);
|
|
41779
|
-
var import_react_query25 = __toESM(require_modern2(), 1);
|
|
41780
41760
|
var import_react43 = __toESM(require_react(), 1);
|
|
41781
41761
|
var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
|
|
41782
41762
|
var import_react44 = __toESM(require_react(), 1);
|
|
41783
|
-
var
|
|
41763
|
+
var import_react_query25 = __toESM(require_modern2(), 1);
|
|
41784
41764
|
var import_react45 = __toESM(require_react(), 1);
|
|
41785
|
-
var
|
|
41786
|
-
var import_react_query27 = __toESM(require_modern2(), 1);
|
|
41765
|
+
var import_react_query26 = __toESM(require_modern2(), 1);
|
|
41787
41766
|
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
41788
41767
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
41789
|
-
var
|
|
41768
|
+
var import_react46 = __toESM(require_react(), 1);
|
|
41790
41769
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
41791
41770
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
41792
|
-
var
|
|
41771
|
+
var import_react47 = __toESM(require_react(), 1);
|
|
41793
41772
|
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
41794
41773
|
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
41795
41774
|
var __create2 = Object.create;
|
|
@@ -47914,7 +47893,7 @@ function generateKSUID2() {
|
|
|
47914
47893
|
function generatePrefixedKSUID2(prefix) {
|
|
47915
47894
|
return `${prefix}_${generateKSUID2()}`;
|
|
47916
47895
|
}
|
|
47917
|
-
var PACKAGE_VERSION = "0.1.
|
|
47896
|
+
var PACKAGE_VERSION = "0.1.79";
|
|
47918
47897
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
47919
47898
|
var DEFAULT_DEDUP_MS = 500;
|
|
47920
47899
|
var SESSION_PREFIX = "asess";
|
|
@@ -48004,8 +47983,12 @@ var EventTracker = class {
|
|
|
48004
47983
|
}
|
|
48005
47984
|
/**
|
|
48006
47985
|
* Associate subsequent events with an internal Unifold user.id
|
|
48007
|
-
* (`user_<ksuid>`). Pass `null` to clear.
|
|
48008
|
-
*
|
|
47986
|
+
* (`user_<ksuid>`). Pass `null` to clear.
|
|
47987
|
+
*
|
|
47988
|
+
* The tracker is shared across flows and outlives any one journey, so a
|
|
47989
|
+
* journey stamps its own user at the start — with the id if it already
|
|
47990
|
+
* knows one, `null` if it doesn't — rather than inheriting whatever the
|
|
47991
|
+
* previous journey left here.
|
|
48009
47992
|
*/
|
|
48010
47993
|
setUserId(userId) {
|
|
48011
47994
|
this.userId = userId || void 0;
|
|
@@ -48016,8 +47999,8 @@ var EventTracker = class {
|
|
|
48016
47999
|
* {@link EventTracker.endSession} carries it.
|
|
48017
48000
|
*
|
|
48018
48001
|
* Does not touch `userId`: the internal `user_<ksuid>` is attached separately
|
|
48019
|
-
* via {@link EventTracker.setUserId}
|
|
48020
|
-
*
|
|
48002
|
+
* via {@link EventTracker.setUserId}, and persists until the host replaces
|
|
48003
|
+
* it — which the SDK's modals do on every journey start.
|
|
48021
48004
|
*/
|
|
48022
48005
|
startSession() {
|
|
48023
48006
|
this.sessionId = generatePrefixedKSUID2(SESSION_PREFIX);
|
|
@@ -54362,6 +54345,9 @@ var en_default = {
|
|
|
54362
54345
|
transactionBreakdown: "Transaction breakdown",
|
|
54363
54346
|
networkFee: "Network fee",
|
|
54364
54347
|
confirmOrder: "Confirm Order",
|
|
54348
|
+
mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
|
|
54349
|
+
mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
|
|
54350
|
+
mfaEnrollmentSettingsLink: "Open Coinbase security settings",
|
|
54365
54351
|
termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
|
|
54366
54352
|
termsNoticeLink: "terms",
|
|
54367
54353
|
termsNoticeSuffix: "."
|
|
@@ -54492,7 +54478,12 @@ var en_default = {
|
|
|
54492
54478
|
prefix: "By continuing, you agree to Coinbase's ",
|
|
54493
54479
|
separator: ", ",
|
|
54494
54480
|
lastSeparator: ", and ",
|
|
54495
|
-
suffix: ".
|
|
54481
|
+
suffix: ".",
|
|
54482
|
+
agreements: {
|
|
54483
|
+
guest_checkout_terms: "Terms of Service",
|
|
54484
|
+
user_agreement: "User Agreement",
|
|
54485
|
+
privacy_policy: "Privacy Policy"
|
|
54486
|
+
}
|
|
54496
54487
|
},
|
|
54497
54488
|
errors: {
|
|
54498
54489
|
rateLimited: "Too many attempts. Please wait a few minutes and try again.",
|
|
@@ -55151,6 +55142,9 @@ var zh_default = {
|
|
|
55151
55142
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
|
|
55152
55143
|
networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
|
|
55153
55144
|
confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
|
|
55145
|
+
mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
|
|
55146
|
+
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",
|
|
55147
|
+
mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
|
|
55154
55148
|
termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
|
|
55155
55149
|
termsNoticeLink: "\u6761\u6B3E",
|
|
55156
55150
|
termsNoticeSuffix: "\u3002"
|
|
@@ -55281,7 +55275,12 @@ var zh_default = {
|
|
|
55281
55275
|
prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
55282
55276
|
separator: "\u3001",
|
|
55283
55277
|
lastSeparator: "\u548C",
|
|
55284
|
-
suffix: "\
|
|
55278
|
+
suffix: "\u3002",
|
|
55279
|
+
agreements: {
|
|
55280
|
+
guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
|
|
55281
|
+
user_agreement: "\u7528\u6237\u534F\u8BAE",
|
|
55282
|
+
privacy_policy: "\u9690\u79C1\u653F\u7B56"
|
|
55283
|
+
}
|
|
55285
55284
|
},
|
|
55286
55285
|
errors: {
|
|
55287
55286
|
rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
|
|
@@ -55940,6 +55939,9 @@ var zh_TW_default = {
|
|
|
55940
55939
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
|
|
55941
55940
|
networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
|
|
55942
55941
|
confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
|
|
55942
|
+
mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
|
|
55943
|
+
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",
|
|
55944
|
+
mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
|
|
55943
55945
|
termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
|
|
55944
55946
|
termsNoticeLink: "\u689D\u6B3E",
|
|
55945
55947
|
termsNoticeSuffix: "\u3002"
|
|
@@ -56070,7 +56072,12 @@ var zh_TW_default = {
|
|
|
56070
56072
|
prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
56071
56073
|
separator: "\u3001",
|
|
56072
56074
|
lastSeparator: "\u548C",
|
|
56073
|
-
suffix: "\
|
|
56075
|
+
suffix: "\u3002",
|
|
56076
|
+
agreements: {
|
|
56077
|
+
guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
|
|
56078
|
+
user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
|
|
56079
|
+
privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
|
|
56080
|
+
}
|
|
56074
56081
|
},
|
|
56075
56082
|
errors: {
|
|
56076
56083
|
rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
|
|
@@ -56985,6 +56992,13 @@ function useAnalytics() {
|
|
|
56985
56992
|
);
|
|
56986
56993
|
return { track, startSession, endSession, getSessionId, setUserId, subscribe };
|
|
56987
56994
|
}
|
|
56995
|
+
function useStampInternalUserId({ internalUserId }) {
|
|
56996
|
+
const { setUserId } = useAnalytics();
|
|
56997
|
+
(0, import_react8.useEffect)(() => {
|
|
56998
|
+
if (!internalUserId) return;
|
|
56999
|
+
setUserId(internalUserId);
|
|
57000
|
+
}, [internalUserId, setUserId]);
|
|
57001
|
+
}
|
|
56988
57002
|
function useDepositAddress(params) {
|
|
56989
57003
|
const {
|
|
56990
57004
|
userId,
|
|
@@ -56997,7 +57011,6 @@ function useDepositAddress(params) {
|
|
|
56997
57011
|
contractCalls,
|
|
56998
57012
|
enabled = true
|
|
56999
57013
|
} = params;
|
|
57000
|
-
const { setUserId } = useAnalytics();
|
|
57001
57014
|
const query = (0, import_react_query3.useQuery)({
|
|
57002
57015
|
queryKey: [
|
|
57003
57016
|
"unifold",
|
|
@@ -57040,11 +57053,7 @@ function useDepositAddress(params) {
|
|
|
57040
57053
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
|
|
57041
57054
|
// 1s, 2s, 4s (max 10s)
|
|
57042
57055
|
});
|
|
57043
|
-
(
|
|
57044
|
-
if (query.data?.user_id) {
|
|
57045
|
-
setUserId(query.data.user_id);
|
|
57046
|
-
}
|
|
57047
|
-
}, [query.data?.user_id, setUserId]);
|
|
57056
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
57048
57057
|
return query;
|
|
57049
57058
|
}
|
|
57050
57059
|
function useDebounce(value, delay) {
|
|
@@ -59267,7 +59276,11 @@ function BuyWithCard({
|
|
|
59267
59276
|
method: "card",
|
|
59268
59277
|
flow_type: "deposit",
|
|
59269
59278
|
provider: selectedProvider.service_provider,
|
|
59270
|
-
amount_usd: amount
|
|
59279
|
+
amount_usd: amount,
|
|
59280
|
+
// The execution only exists once the provider's payout lands on this
|
|
59281
|
+
// wallet, and it carries this id — so it's the join key for a purchase
|
|
59282
|
+
// that starts here and never reaches flow_completed.
|
|
59283
|
+
deposit_wallet_id: depositWalletId
|
|
59271
59284
|
});
|
|
59272
59285
|
onEvent?.({
|
|
59273
59286
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -60704,6 +60717,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60704
60717
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react16.useState)(null);
|
|
60705
60718
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react16.useState)(false);
|
|
60706
60719
|
const upgradeFlowAbortRef = (0, import_react16.useRef)(null);
|
|
60720
|
+
const applyLimitRoutingRef = (0, import_react16.useRef)(() => {
|
|
60721
|
+
});
|
|
60707
60722
|
const [amount, setAmount] = (0, import_react16.useState)(amountUsd ?? "");
|
|
60708
60723
|
const [preparedOrder, setPreparedOrder] = (0, import_react16.useState)(null);
|
|
60709
60724
|
const sessionAbortRef = (0, import_react16.useRef)(null);
|
|
@@ -60838,6 +60853,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60838
60853
|
},
|
|
60839
60854
|
[email, normalizedPhone, userId]
|
|
60840
60855
|
);
|
|
60856
|
+
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60857
|
+
userId,
|
|
60858
|
+
publishableKey,
|
|
60859
|
+
normalizedPhone,
|
|
60860
|
+
userEmail,
|
|
60861
|
+
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60862
|
+
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60863
|
+
});
|
|
60841
60864
|
const createSessionAndSendOtp = (0, import_react16.useCallback)(async () => {
|
|
60842
60865
|
setView("submitting_session");
|
|
60843
60866
|
setErrorMessage("");
|
|
@@ -60847,7 +60870,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60847
60870
|
email,
|
|
60848
60871
|
phone: normalizedPhone,
|
|
60849
60872
|
terms_accepted: true,
|
|
60850
|
-
|
|
60873
|
+
// TODO: when the API honors `false`, this will trigger email OTP.
|
|
60874
|
+
// Today `false` still skips email (we don't verify it) and JWT ev
|
|
60875
|
+
// is null. Don't send `true` — that was a fake attest.
|
|
60876
|
+
email_already_verified: false
|
|
60877
|
+
// Coinbase stays Redis-only + JWT until bank-transfer identity
|
|
60878
|
+
// is live. Do not persist from this path yet.
|
|
60851
60879
|
},
|
|
60852
60880
|
publishableKey
|
|
60853
60881
|
);
|
|
@@ -60857,6 +60885,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60857
60885
|
}
|
|
60858
60886
|
setClientSecret(session.client_secret);
|
|
60859
60887
|
storeWalletPaySession();
|
|
60888
|
+
if (session.status === "verified") {
|
|
60889
|
+
const tokenRes = await exchangeOnrampVerificationToken(
|
|
60890
|
+
session.id,
|
|
60891
|
+
session.client_secret,
|
|
60892
|
+
publishableKey
|
|
60893
|
+
);
|
|
60894
|
+
setOnrampToken(tokenRes);
|
|
60895
|
+
storeWalletPaySession({
|
|
60896
|
+
emailVerifiedAt: session.email.verified_at,
|
|
60897
|
+
phoneVerifiedAt: session.phone.verified_at,
|
|
60898
|
+
onrampToken: tokenRes.token,
|
|
60899
|
+
onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
|
|
60900
|
+
});
|
|
60901
|
+
if (amountUsd) setAmount(amountUsd);
|
|
60902
|
+
try {
|
|
60903
|
+
const result = await refetchWalletPayLimits();
|
|
60904
|
+
if (result.data) {
|
|
60905
|
+
const nextView = getViewForLimitStatus(result.data);
|
|
60906
|
+
if (nextView) {
|
|
60907
|
+
applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
|
|
60908
|
+
return;
|
|
60909
|
+
}
|
|
60910
|
+
}
|
|
60911
|
+
} catch {
|
|
60912
|
+
}
|
|
60913
|
+
setView("amount");
|
|
60914
|
+
return;
|
|
60915
|
+
}
|
|
60860
60916
|
await sendOnrampVerificationOtp(session.id, "phone", session.client_secret, publishableKey);
|
|
60861
60917
|
setResendCooldown(30);
|
|
60862
60918
|
setView("phone_otp");
|
|
@@ -60865,19 +60921,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60865
60921
|
setErrorMessage(prettifyVerificationError(raw));
|
|
60866
60922
|
setView("phone_input");
|
|
60867
60923
|
}
|
|
60868
|
-
}, [
|
|
60924
|
+
}, [
|
|
60925
|
+
email,
|
|
60926
|
+
normalizedPhone,
|
|
60927
|
+
publishableKey,
|
|
60928
|
+
storeWalletPaySession,
|
|
60929
|
+
userId,
|
|
60930
|
+
amountUsd,
|
|
60931
|
+
refetchWalletPayLimits
|
|
60932
|
+
]);
|
|
60869
60933
|
const clearUpgradeFields = (0, import_react16.useCallback)(() => {
|
|
60870
60934
|
setSsnLast4("");
|
|
60871
60935
|
setDobInput("");
|
|
60872
60936
|
}, []);
|
|
60873
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60874
|
-
userId,
|
|
60875
|
-
publishableKey,
|
|
60876
|
-
normalizedPhone,
|
|
60877
|
-
userEmail,
|
|
60878
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60879
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60880
|
-
});
|
|
60881
60937
|
const pollLimitUpgradeStatus = (0, import_react16.useCallback)(
|
|
60882
60938
|
async (signal) => {
|
|
60883
60939
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -60988,6 +61044,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60988
61044
|
},
|
|
60989
61045
|
[startUpgradePolling]
|
|
60990
61046
|
);
|
|
61047
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
60991
61048
|
const hasInitializedRef = (0, import_react16.useRef)(false);
|
|
60992
61049
|
(0, import_react16.useEffect)(() => {
|
|
60993
61050
|
if (hasInitializedRef.current) return;
|
|
@@ -61217,7 +61274,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61217
61274
|
track("flow_started", {
|
|
61218
61275
|
method,
|
|
61219
61276
|
flow_type: "deposit",
|
|
61220
|
-
amount_usd: walletPayAmountUsd
|
|
61277
|
+
amount_usd: walletPayAmountUsd,
|
|
61278
|
+
// No execution yet — one appears when the payout lands on this
|
|
61279
|
+
// wallet, carrying the same id.
|
|
61280
|
+
deposit_wallet_id: depositWalletId
|
|
61221
61281
|
});
|
|
61222
61282
|
onEvent?.({
|
|
61223
61283
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -61267,6 +61327,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61267
61327
|
defaultTokenLoading,
|
|
61268
61328
|
defaultTokenError,
|
|
61269
61329
|
depositWallet?.address,
|
|
61330
|
+
depositWalletId,
|
|
61270
61331
|
userEmail,
|
|
61271
61332
|
publishableKey,
|
|
61272
61333
|
onEvent,
|
|
@@ -62241,7 +62302,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
62241
62302
|
{
|
|
62242
62303
|
key: "guest_checkout_terms",
|
|
62243
62304
|
name: "Guest Checkout Terms of Service",
|
|
62244
|
-
url: "https://www.coinbase.com/legal/
|
|
62305
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
62245
62306
|
},
|
|
62246
62307
|
{
|
|
62247
62308
|
key: "user_agreement",
|
|
@@ -62261,22 +62322,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62261
62322
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62262
62323
|
"div",
|
|
62263
62324
|
{
|
|
62264
|
-
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
|
|
62325
|
+
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
|
|
62265
62326
|
"aria-hidden": true,
|
|
62266
62327
|
"aria-busy": "true",
|
|
62267
62328
|
children: [
|
|
62268
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62269
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62270
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62329
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
|
|
62330
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
|
|
62331
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
|
|
62271
62332
|
]
|
|
62272
62333
|
}
|
|
62273
62334
|
);
|
|
62274
62335
|
}
|
|
62275
62336
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
62337
|
+
const shortLabels = t.agreements;
|
|
62338
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
62276
62339
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62277
62340
|
"p",
|
|
62278
62341
|
{
|
|
62279
|
-
className: "uf-text-[
|
|
62342
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
62280
62343
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
62281
62344
|
children: [
|
|
62282
62345
|
t.prefix,
|
|
@@ -62287,12 +62350,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62287
62350
|
href: a.url,
|
|
62288
62351
|
target: "_blank",
|
|
62289
62352
|
rel: "noopener noreferrer",
|
|
62290
|
-
className: "uf-underline",
|
|
62291
|
-
style: { color:
|
|
62292
|
-
children: a.name
|
|
62353
|
+
className: "uf-no-underline",
|
|
62354
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
62355
|
+
children: shortLabels[a.key] ?? a.name
|
|
62293
62356
|
}
|
|
62294
62357
|
),
|
|
62295
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
62358
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
62296
62359
|
] }, a.key)),
|
|
62297
62360
|
t.suffix
|
|
62298
62361
|
]
|
|
@@ -62914,16 +62977,6 @@ function PayWithExchange({
|
|
|
62914
62977
|
}
|
|
62915
62978
|
);
|
|
62916
62979
|
}
|
|
62917
|
-
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
62918
|
-
return (0, import_react_query10.useQuery)({
|
|
62919
|
-
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
62920
|
-
queryFn: () => getCashAppLimits(currency, publishableKey),
|
|
62921
|
-
enabled: !!publishableKey,
|
|
62922
|
-
staleTime: 2 * 60 * 6e4,
|
|
62923
|
-
gcTime: 4 * 60 * 6e4,
|
|
62924
|
-
retry: 2
|
|
62925
|
-
});
|
|
62926
|
-
}
|
|
62927
62980
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
62928
62981
|
var FALLBACK_MIN_USD = 5;
|
|
62929
62982
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
@@ -62935,6 +62988,7 @@ function PayWithCashApp({
|
|
|
62935
62988
|
destinationChainType,
|
|
62936
62989
|
destinationChainId,
|
|
62937
62990
|
destinationTokenAddress,
|
|
62991
|
+
contractCalls,
|
|
62938
62992
|
cashAppIconUrl,
|
|
62939
62993
|
view: controlledView,
|
|
62940
62994
|
onViewChange,
|
|
@@ -62958,9 +63012,11 @@ function PayWithCashApp({
|
|
|
62958
63012
|
const b = parseInt(bg.slice(4, 6), 16);
|
|
62959
63013
|
return (r2 * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
62960
63014
|
})();
|
|
62961
|
-
const { data:
|
|
62962
|
-
|
|
62963
|
-
|
|
63015
|
+
const { data: fiatCurrencies, isLoading: limitsLoading } = useFiatCurrencies({
|
|
63016
|
+
publishableKey
|
|
63017
|
+
});
|
|
63018
|
+
const minUsd = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === "usd")?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
63019
|
+
const quickAmounts = SUGGESTED_AMOUNTS.filter((value) => value >= minUsd);
|
|
62964
63020
|
const [amount, setAmount] = (0, import_react24.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
62965
63021
|
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
62966
63022
|
const [session, setSession] = (0, import_react24.useState)(null);
|
|
@@ -63015,6 +63071,8 @@ function PayWithCashApp({
|
|
|
63015
63071
|
setError(strings.depositModal.cashAppErrors.missingFields);
|
|
63016
63072
|
return;
|
|
63017
63073
|
}
|
|
63074
|
+
const amountNum2 = parseFloat(amount);
|
|
63075
|
+
if (isNaN(amountNum2) || amountNum2 < minUsd) return;
|
|
63018
63076
|
setLoading(true);
|
|
63019
63077
|
setError(null);
|
|
63020
63078
|
try {
|
|
@@ -63027,7 +63085,8 @@ function PayWithCashApp({
|
|
|
63027
63085
|
destination_token_address: destinationTokenAddress,
|
|
63028
63086
|
recipient_address: recipientAddress,
|
|
63029
63087
|
source_amount: amount,
|
|
63030
|
-
external_id: externalId
|
|
63088
|
+
external_id: externalId,
|
|
63089
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
63031
63090
|
},
|
|
63032
63091
|
publishableKey
|
|
63033
63092
|
);
|
|
@@ -63040,7 +63099,10 @@ function PayWithCashApp({
|
|
|
63040
63099
|
track("flow_started", {
|
|
63041
63100
|
method: "cashapp",
|
|
63042
63101
|
flow_type: "deposit",
|
|
63043
|
-
amount_usd: amount
|
|
63102
|
+
amount_usd: amount,
|
|
63103
|
+
// No execution yet — one appears when the payout lands on this
|
|
63104
|
+
// wallet, carrying the same id.
|
|
63105
|
+
deposit_wallet_id: depositWalletId
|
|
63044
63106
|
});
|
|
63045
63107
|
onEvent?.({
|
|
63046
63108
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -63059,12 +63121,15 @@ function PayWithCashApp({
|
|
|
63059
63121
|
}
|
|
63060
63122
|
}, [
|
|
63061
63123
|
amount,
|
|
63124
|
+
minUsd,
|
|
63062
63125
|
userId,
|
|
63063
63126
|
publishableKey,
|
|
63064
63127
|
recipientAddress,
|
|
63065
63128
|
destinationChainType,
|
|
63066
63129
|
destinationChainId,
|
|
63067
63130
|
destinationTokenAddress,
|
|
63131
|
+
contractCalls,
|
|
63132
|
+
depositWalletId,
|
|
63068
63133
|
onEvent,
|
|
63069
63134
|
onDepositError,
|
|
63070
63135
|
track,
|
|
@@ -63160,8 +63225,7 @@ function PayWithCashApp({
|
|
|
63160
63225
|
const amountNum = parseFloat(amount);
|
|
63161
63226
|
const hasInput = !isNaN(amountNum) && amountNum > 0;
|
|
63162
63227
|
const belowMin = hasInput && amountNum < minUsd;
|
|
63163
|
-
const
|
|
63164
|
-
const isValidAmount = hasInput && !belowMin && !aboveMax;
|
|
63228
|
+
const isValidAmount = hasInput && !belowMin;
|
|
63165
63229
|
if (view === "amount") {
|
|
63166
63230
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63167
63231
|
"div",
|
|
@@ -63190,7 +63254,7 @@ function PayWithCashApp({
|
|
|
63190
63254
|
}
|
|
63191
63255
|
}
|
|
63192
63256
|
) }) }),
|
|
63193
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children:
|
|
63257
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children: quickAmounts.map((quickAmount) => {
|
|
63194
63258
|
const isSelected = parseFloat(amount) === quickAmount;
|
|
63195
63259
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63196
63260
|
"button",
|
|
@@ -63216,23 +63280,17 @@ function PayWithCashApp({
|
|
|
63216
63280
|
quickAmount
|
|
63217
63281
|
);
|
|
63218
63282
|
}) }),
|
|
63219
|
-
|
|
63283
|
+
!limitsLoading && minUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63220
63284
|
"div",
|
|
63221
63285
|
{
|
|
63222
|
-
className: "uf-text-
|
|
63223
|
-
style: { color: colors2.
|
|
63224
|
-
children: interpolate(strings.common.
|
|
63225
|
-
|
|
63226
|
-
) : amount && maxUsd !== null && amountNum > maxUsd && !error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63227
|
-
"div",
|
|
63228
|
-
{
|
|
63229
|
-
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
63230
|
-
style: { color: colors2.error, fontFamily: fonts.regular },
|
|
63231
|
-
children: interpolate(strings.common.maximumAmount, {
|
|
63232
|
-
amount: `$${maxUsd.toLocaleString()}`
|
|
63286
|
+
className: "uf-text-center uf-text-xs uf-mt-4",
|
|
63287
|
+
style: { color: colors2.warning, fontFamily: fonts.regular },
|
|
63288
|
+
children: interpolate(strings.common.minimumDeposit, {
|
|
63289
|
+
amount: `$${minUsd.toFixed(2)}`
|
|
63233
63290
|
})
|
|
63234
63291
|
}
|
|
63235
|
-
)
|
|
63292
|
+
),
|
|
63293
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63236
63294
|
"div",
|
|
63237
63295
|
{
|
|
63238
63296
|
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
@@ -63241,7 +63299,7 @@ function PayWithCashApp({
|
|
|
63241
63299
|
}
|
|
63242
63300
|
) : null
|
|
63243
63301
|
] }),
|
|
63244
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-px-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63302
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-px-1 uf-mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63245
63303
|
"button",
|
|
63246
63304
|
{
|
|
63247
63305
|
onClick: handleCreateSession,
|
|
@@ -63462,7 +63520,7 @@ function useBankTransferProviders({
|
|
|
63462
63520
|
countryCode
|
|
63463
63521
|
}) {
|
|
63464
63522
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
63465
|
-
const { data: providers, isLoading } = (0,
|
|
63523
|
+
const { data: providers, isLoading } = (0, import_react_query10.useQuery)({
|
|
63466
63524
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
63467
63525
|
queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
|
|
63468
63526
|
enabled,
|
|
@@ -63666,7 +63724,10 @@ function BankTransfer({
|
|
|
63666
63724
|
method: "bank_transfer",
|
|
63667
63725
|
flow_type: "deposit",
|
|
63668
63726
|
provider: request.service_provider,
|
|
63669
|
-
amount_usd: request.source_amount
|
|
63727
|
+
amount_usd: request.source_amount,
|
|
63728
|
+
// No execution yet — one appears when the provider's payout lands on
|
|
63729
|
+
// this wallet, carrying the same id.
|
|
63730
|
+
deposit_wallet_id: pollingWalletId
|
|
63670
63731
|
});
|
|
63671
63732
|
onEvent?.({
|
|
63672
63733
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -69747,7 +69808,11 @@ function PayWithStripeLink({
|
|
|
69747
69808
|
if (checkoutResult.successful) {
|
|
69748
69809
|
handledTerminalSessionRef.current = null;
|
|
69749
69810
|
executionReconciledSessionRef.current = null;
|
|
69750
|
-
track("flow_started", {
|
|
69811
|
+
track("flow_started", {
|
|
69812
|
+
method: "stripe_link",
|
|
69813
|
+
flow_type: "deposit",
|
|
69814
|
+
deposit_wallet_id: depositWalletId
|
|
69815
|
+
});
|
|
69751
69816
|
setConfirmedSessionId(activeSessionId);
|
|
69752
69817
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
69753
69818
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -71244,7 +71309,14 @@ function PayWithStripeLink({
|
|
|
71244
71309
|
]
|
|
71245
71310
|
}
|
|
71246
71311
|
),
|
|
71247
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71312
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71313
|
+
"div",
|
|
71314
|
+
{
|
|
71315
|
+
ref: authMountRef,
|
|
71316
|
+
className: "uf-w-full uf-min-h-[200px]",
|
|
71317
|
+
style: { colorScheme: "only light" }
|
|
71318
|
+
}
|
|
71319
|
+
)
|
|
71248
71320
|
]
|
|
71249
71321
|
}
|
|
71250
71322
|
);
|
|
@@ -71802,7 +71874,7 @@ function useProjectConfig({
|
|
|
71802
71874
|
data: projectConfig,
|
|
71803
71875
|
isLoading,
|
|
71804
71876
|
error
|
|
71805
|
-
} = (0,
|
|
71877
|
+
} = (0, import_react_query11.useQuery)({
|
|
71806
71878
|
// Country is part of the key so a region change refetches the region-aware
|
|
71807
71879
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
71808
71880
|
// sharing the base cache entry.
|
|
@@ -71812,7 +71884,7 @@ function useProjectConfig({
|
|
|
71812
71884
|
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
71813
71885
|
// config refetches after the country resolves, so unrelated config-driven
|
|
71814
71886
|
// UI doesn't flash back to defaults.
|
|
71815
|
-
placeholderData:
|
|
71887
|
+
placeholderData: import_react_query11.keepPreviousData,
|
|
71816
71888
|
staleTime: 1e3 * 60 * 30,
|
|
71817
71889
|
refetchOnMount: true,
|
|
71818
71890
|
refetchOnWindowFocus: true
|
|
@@ -71824,7 +71896,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
71824
71896
|
publishableKey,
|
|
71825
71897
|
enabled = true
|
|
71826
71898
|
}) {
|
|
71827
|
-
return (0,
|
|
71899
|
+
return (0, import_react_query12.useQuery)({
|
|
71828
71900
|
queryKey: [
|
|
71829
71901
|
"unifold",
|
|
71830
71902
|
"integrationTransferDefaultToken",
|
|
@@ -72507,6 +72579,9 @@ function CoinbaseConnect({
|
|
|
72507
72579
|
flow_type: "deposit",
|
|
72508
72580
|
method: "exchange_connect",
|
|
72509
72581
|
provider: IntegrationProvider.COINBASE,
|
|
72582
|
+
// No execution yet — one appears when the exchange's transfer lands on
|
|
72583
|
+
// this wallet, carrying the same id.
|
|
72584
|
+
deposit_wallet_id: transferDepositWalletId,
|
|
72510
72585
|
amount_usd: sendAmount || void 0,
|
|
72511
72586
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
72512
72587
|
chain: sourceChain?.chain_id,
|
|
@@ -72514,6 +72589,34 @@ function CoinbaseConnect({
|
|
|
72514
72589
|
network: sourceChain?.network
|
|
72515
72590
|
});
|
|
72516
72591
|
};
|
|
72592
|
+
const applyConfirmResult = (result) => {
|
|
72593
|
+
if (result.status === "mfa_required") {
|
|
72594
|
+
track("verification_started", {
|
|
72595
|
+
flow_type: "deposit",
|
|
72596
|
+
method: "exchange_connect",
|
|
72597
|
+
provider: IntegrationProvider.COINBASE,
|
|
72598
|
+
verification_type: "mfa",
|
|
72599
|
+
verification_status: result.status
|
|
72600
|
+
});
|
|
72601
|
+
transitionTo("mfa");
|
|
72602
|
+
setMfaCode("");
|
|
72603
|
+
setMfaError(false);
|
|
72604
|
+
} else if (result.status === "mfa_enrollment_required") {
|
|
72605
|
+
transitionTo("mfa_enrollment");
|
|
72606
|
+
} else if (result.status === "completed") {
|
|
72607
|
+
trackTransferStarted();
|
|
72608
|
+
setConfirmResult(result);
|
|
72609
|
+
transitionTo("success");
|
|
72610
|
+
onTransferSuccess?.(result);
|
|
72611
|
+
} else {
|
|
72612
|
+
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72613
|
+
transitionTo("error");
|
|
72614
|
+
onTransferError?.({
|
|
72615
|
+
message: result.message || t.errors.transferFailed,
|
|
72616
|
+
code: result.status
|
|
72617
|
+
});
|
|
72618
|
+
}
|
|
72619
|
+
};
|
|
72517
72620
|
const handleConfirmTransfer = async () => {
|
|
72518
72621
|
if (!transferIntent || !accessToken) return;
|
|
72519
72622
|
setIsLoading(true);
|
|
@@ -72548,30 +72651,7 @@ function CoinbaseConnect({
|
|
|
72548
72651
|
});
|
|
72549
72652
|
throw err;
|
|
72550
72653
|
});
|
|
72551
|
-
|
|
72552
|
-
track("verification_started", {
|
|
72553
|
-
flow_type: "deposit",
|
|
72554
|
-
method: "exchange_connect",
|
|
72555
|
-
provider: IntegrationProvider.COINBASE,
|
|
72556
|
-
verification_type: "mfa",
|
|
72557
|
-
verification_status: result.status
|
|
72558
|
-
});
|
|
72559
|
-
transitionTo("mfa");
|
|
72560
|
-
setMfaCode("");
|
|
72561
|
-
setMfaError(false);
|
|
72562
|
-
} else if (result.status === "completed") {
|
|
72563
|
-
trackTransferStarted();
|
|
72564
|
-
setConfirmResult(result);
|
|
72565
|
-
transitionTo("success");
|
|
72566
|
-
onTransferSuccess?.(result);
|
|
72567
|
-
} else {
|
|
72568
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72569
|
-
transitionTo("error");
|
|
72570
|
-
onTransferError?.({
|
|
72571
|
-
message: result.message || t.errors.transferFailed,
|
|
72572
|
-
code: result.status
|
|
72573
|
-
});
|
|
72574
|
-
}
|
|
72654
|
+
applyConfirmResult(result);
|
|
72575
72655
|
} catch (err) {
|
|
72576
72656
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
72577
72657
|
setErrorMessage(message);
|
|
@@ -72728,6 +72808,9 @@ function CoinbaseConnect({
|
|
|
72728
72808
|
setShowTransferDetails(false);
|
|
72729
72809
|
transitionTo("enter_amount");
|
|
72730
72810
|
break;
|
|
72811
|
+
case "mfa_enrollment":
|
|
72812
|
+
transitionTo("transfer_confirm");
|
|
72813
|
+
break;
|
|
72731
72814
|
case "mfa":
|
|
72732
72815
|
transitionTo("transfer_confirm");
|
|
72733
72816
|
break;
|
|
@@ -74284,6 +74367,55 @@ function CoinbaseConnect({
|
|
|
74284
74367
|
] })
|
|
74285
74368
|
] });
|
|
74286
74369
|
}
|
|
74370
|
+
if (view === "mfa_enrollment") {
|
|
74371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74372
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
74373
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74374
|
+
"div",
|
|
74375
|
+
{
|
|
74376
|
+
className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
|
|
74377
|
+
style: viewTransitionStyle,
|
|
74378
|
+
children: [
|
|
74379
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74380
|
+
DepositErrorState,
|
|
74381
|
+
{
|
|
74382
|
+
title: t.transfer.mfaEnrollmentTitle,
|
|
74383
|
+
message: t.transfer.mfaEnrollmentMessage
|
|
74384
|
+
}
|
|
74385
|
+
),
|
|
74386
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74387
|
+
"a",
|
|
74388
|
+
{
|
|
74389
|
+
href: "https://www.coinbase.com/settings/security",
|
|
74390
|
+
target: "_blank",
|
|
74391
|
+
rel: "noopener noreferrer",
|
|
74392
|
+
className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
|
|
74393
|
+
style: { color: colors2.primary, fontFamily: fonts.medium },
|
|
74394
|
+
children: [
|
|
74395
|
+
t.transfer.mfaEnrollmentSettingsLink,
|
|
74396
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
|
|
74397
|
+
]
|
|
74398
|
+
}
|
|
74399
|
+
),
|
|
74400
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74401
|
+
"button",
|
|
74402
|
+
{
|
|
74403
|
+
onClick: handleConfirmTransfer,
|
|
74404
|
+
disabled: isLoading,
|
|
74405
|
+
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",
|
|
74406
|
+
style: {
|
|
74407
|
+
backgroundColor: colors2.primary,
|
|
74408
|
+
color: "#fff",
|
|
74409
|
+
fontFamily: fonts.medium
|
|
74410
|
+
},
|
|
74411
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
|
|
74412
|
+
}
|
|
74413
|
+
)
|
|
74414
|
+
]
|
|
74415
|
+
}
|
|
74416
|
+
)
|
|
74417
|
+
] });
|
|
74418
|
+
}
|
|
74287
74419
|
if (view === "mfa") {
|
|
74288
74420
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74289
74421
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -74567,7 +74699,7 @@ function useExchanges({
|
|
|
74567
74699
|
publishableKey,
|
|
74568
74700
|
enabled = true
|
|
74569
74701
|
}) {
|
|
74570
|
-
const { data: exchanges = [], isLoading } = (0,
|
|
74702
|
+
const { data: exchanges = [], isLoading } = (0, import_react_query13.useQuery)({
|
|
74571
74703
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
74572
74704
|
queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
|
|
74573
74705
|
enabled,
|
|
@@ -74585,7 +74717,7 @@ function usePublicIncident({
|
|
|
74585
74717
|
data: incident,
|
|
74586
74718
|
isLoading,
|
|
74587
74719
|
error
|
|
74588
|
-
} = (0,
|
|
74720
|
+
} = (0, import_react_query14.useQuery)({
|
|
74589
74721
|
queryKey: ["unifold", "publicIncident", publishableKey],
|
|
74590
74722
|
queryFn: () => getPublicIncident(publishableKey),
|
|
74591
74723
|
enabled,
|
|
@@ -74600,7 +74732,7 @@ function useWalletPayProviders({
|
|
|
74600
74732
|
publishableKey,
|
|
74601
74733
|
enabled = true
|
|
74602
74734
|
}) {
|
|
74603
|
-
const { data: providers, isLoading } = (0,
|
|
74735
|
+
const { data: providers, isLoading } = (0, import_react_query15.useQuery)({
|
|
74604
74736
|
queryKey: ["unifold", "walletPayProviders", method, publishableKey],
|
|
74605
74737
|
queryFn: () => getWalletPayProviders(method, publishableKey),
|
|
74606
74738
|
enabled,
|
|
@@ -74866,7 +74998,7 @@ function useAddressValidation({
|
|
|
74866
74998
|
refetchOnMount = false
|
|
74867
74999
|
}) {
|
|
74868
75000
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
74869
|
-
const { data, isLoading, error } = (0,
|
|
75001
|
+
const { data, isLoading, error } = (0, import_react_query16.useQuery)({
|
|
74870
75002
|
queryKey: [
|
|
74871
75003
|
"unifold",
|
|
74872
75004
|
"addressValidation",
|
|
@@ -76269,7 +76401,7 @@ function useHypercoreActivation(params) {
|
|
|
76269
76401
|
const recipient = recipientAddress?.trim() ?? "";
|
|
76270
76402
|
const source = sourceAddress?.trim() ?? "";
|
|
76271
76403
|
const hasAddresses = !!recipient && !!source;
|
|
76272
|
-
const { data, isLoading } = (0,
|
|
76404
|
+
const { data, isLoading } = (0, import_react_query17.useQuery)({
|
|
76273
76405
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
76274
76406
|
queryFn: () => checkHypercoreActivation(
|
|
76275
76407
|
{
|
|
@@ -78048,7 +78180,7 @@ function useDepositQuote(params) {
|
|
|
78048
78180
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
78049
78181
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
78050
78182
|
};
|
|
78051
|
-
return (0,
|
|
78183
|
+
return (0, import_react_query18.useQuery)({
|
|
78052
78184
|
queryKey: [
|
|
78053
78185
|
"unifold",
|
|
78054
78186
|
"depositQuote",
|
|
@@ -78078,7 +78210,7 @@ function useExternalWallets({
|
|
|
78078
78210
|
publishableKey,
|
|
78079
78211
|
enabled = true
|
|
78080
78212
|
}) {
|
|
78081
|
-
const { data: wallets = [], isLoading } = (0,
|
|
78213
|
+
const { data: wallets = [], isLoading } = (0, import_react_query19.useQuery)({
|
|
78082
78214
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
78083
78215
|
queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
|
|
78084
78216
|
enabled: enabled && !!publishableKey,
|
|
@@ -80211,7 +80343,11 @@ function WalletConnect({
|
|
|
80211
80343
|
chain: String(token.chain_id),
|
|
80212
80344
|
network: token.network,
|
|
80213
80345
|
token: token.symbol ?? token.token_address,
|
|
80214
|
-
currency: token.currency
|
|
80346
|
+
currency: token.currency,
|
|
80347
|
+
// No execution exists yet — it's created when this send lands on the
|
|
80348
|
+
// wallet. The wallet id is what that execution will carry, so it's
|
|
80349
|
+
// how a send that never completes is matched to what followed.
|
|
80350
|
+
deposit_wallet_id: activeDepositWallet?.id
|
|
80215
80351
|
});
|
|
80216
80352
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
80217
80353
|
setHasSignedTransaction(true);
|
|
@@ -80798,7 +80934,7 @@ function DepositModal({
|
|
|
80798
80934
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
80799
80935
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
80800
80936
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
80801
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
80937
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
80802
80938
|
const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
|
|
80803
80939
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
80804
80940
|
[prefilledAmountUsd]
|
|
@@ -80806,6 +80942,7 @@ function DepositModal({
|
|
|
80806
80942
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
80807
80943
|
const journeyActiveRef = (0, import_react3.useRef)(false);
|
|
80808
80944
|
const journeySessionIdRef = (0, import_react3.useRef)(void 0);
|
|
80945
|
+
const journeyExternalUserIdRef = (0, import_react3.useRef)(void 0);
|
|
80809
80946
|
const externalUserId = userId || void 0;
|
|
80810
80947
|
const emitEvent = (0, import_react3.useCallback)(
|
|
80811
80948
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -80833,6 +80970,9 @@ function DepositModal({
|
|
|
80833
80970
|
method: analyticsMethod(method),
|
|
80834
80971
|
flow_type: "deposit",
|
|
80835
80972
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
80973
|
+
// The one high-cardinality field we do send: the join key from a
|
|
80974
|
+
// funnel session back to the execution row it produced.
|
|
80975
|
+
execution_id: data.executionId ?? execution?.id,
|
|
80836
80976
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
80837
80977
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
80838
80978
|
// the onEvent DirectExecution instead).
|
|
@@ -80860,6 +81000,7 @@ function DepositModal({
|
|
|
80860
81000
|
method: analyticsMethod(method),
|
|
80861
81001
|
flow_type: "deposit",
|
|
80862
81002
|
error_code: error.code,
|
|
81003
|
+
execution_id: execution?.id,
|
|
80863
81004
|
failure_reason: execution?.failureReason ?? void 0,
|
|
80864
81005
|
status: execution?.status,
|
|
80865
81006
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -81288,8 +81429,10 @@ function DepositModal({
|
|
|
81288
81429
|
const beginJourney = (0, import_react3.useCallback)(() => {
|
|
81289
81430
|
journeySessionIdRef.current = startSession();
|
|
81290
81431
|
journeyActiveRef.current = true;
|
|
81432
|
+
journeyExternalUserIdRef.current = userId;
|
|
81433
|
+
setUserId(null);
|
|
81291
81434
|
track("widget_opened", { flow_type: "deposit" });
|
|
81292
|
-
}, [startSession, track]);
|
|
81435
|
+
}, [startSession, track, setUserId, userId]);
|
|
81293
81436
|
const handleClose = () => {
|
|
81294
81437
|
finalizeJourney();
|
|
81295
81438
|
onOpenChange(false);
|
|
@@ -81314,6 +81457,11 @@ function DepositModal({
|
|
|
81314
81457
|
}
|
|
81315
81458
|
beginJourney();
|
|
81316
81459
|
}, [open]);
|
|
81460
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
81461
|
+
if (!open || journeyExternalUserIdRef.current === userId) return;
|
|
81462
|
+
journeyExternalUserIdRef.current = userId;
|
|
81463
|
+
setUserId(null);
|
|
81464
|
+
}, [open, userId, setUserId]);
|
|
81317
81465
|
(0, import_react3.useLayoutEffect)(() => {
|
|
81318
81466
|
if (!open) return;
|
|
81319
81467
|
if (resetViewTimeoutRef.current) {
|
|
@@ -82225,6 +82373,7 @@ function DepositModal({
|
|
|
82225
82373
|
destinationChainType,
|
|
82226
82374
|
destinationChainId,
|
|
82227
82375
|
destinationTokenAddress,
|
|
82376
|
+
contractCalls,
|
|
82228
82377
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
82229
82378
|
view: cashAppView,
|
|
82230
82379
|
onViewChange: setCashAppView,
|
|
@@ -82393,7 +82542,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
82393
82542
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
82394
82543
|
function usePaymentIntent(params) {
|
|
82395
82544
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
82396
|
-
return (0,
|
|
82545
|
+
return (0, import_react_query20.useQuery)({
|
|
82397
82546
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
82398
82547
|
queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
|
|
82399
82548
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
@@ -82560,6 +82709,9 @@ function CheckoutModal({
|
|
|
82560
82709
|
flowCompletedRef.current = true;
|
|
82561
82710
|
track("flow_completed", {
|
|
82562
82711
|
flow_type: "checkout",
|
|
82712
|
+
// Checkout has no direct execution; the intent is what a funnel
|
|
82713
|
+
// session joins back to.
|
|
82714
|
+
payment_intent_id: data.paymentIntentId,
|
|
82563
82715
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
82564
82716
|
});
|
|
82565
82717
|
}
|
|
@@ -82780,7 +82932,7 @@ function CheckoutModal({
|
|
|
82780
82932
|
journeySessionIdRef.current = startSession();
|
|
82781
82933
|
journeyActiveRef.current = true;
|
|
82782
82934
|
flowCompletedRef.current = false;
|
|
82783
|
-
setUserId(null);
|
|
82935
|
+
setUserId(paymentIntentUserId ?? null);
|
|
82784
82936
|
track("widget_opened", { flow_type: "checkout" });
|
|
82785
82937
|
if (resetViewTimeoutRef.current) {
|
|
82786
82938
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -83220,7 +83372,7 @@ function CheckoutModal({
|
|
|
83220
83372
|
) }) });
|
|
83221
83373
|
}
|
|
83222
83374
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
83223
|
-
return (0,
|
|
83375
|
+
return (0, import_react_query21.useQuery)({
|
|
83224
83376
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
83225
83377
|
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
83226
83378
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -83258,7 +83410,7 @@ function useSourceTokenValidation(params) {
|
|
|
83258
83410
|
enabled = true
|
|
83259
83411
|
} = params;
|
|
83260
83412
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
83261
|
-
return (0,
|
|
83413
|
+
return (0, import_react_query22.useQuery)({
|
|
83262
83414
|
queryKey: [
|
|
83263
83415
|
"unifold",
|
|
83264
83416
|
"sourceTokenValidation",
|
|
@@ -83309,7 +83461,7 @@ function useSourceTokenValidation(params) {
|
|
|
83309
83461
|
function useAddressBalance(params) {
|
|
83310
83462
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
83311
83463
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
83312
|
-
return (0,
|
|
83464
|
+
return (0, import_react_query23.useQuery)({
|
|
83313
83465
|
queryKey: [
|
|
83314
83466
|
"unifold",
|
|
83315
83467
|
"addressBalance",
|
|
@@ -83365,7 +83517,7 @@ function useAddressBalance(params) {
|
|
|
83365
83517
|
}
|
|
83366
83518
|
function useExecutions(userId, publishableKey, options2) {
|
|
83367
83519
|
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
83368
|
-
|
|
83520
|
+
const query = (0, import_react_query24.useQuery)({
|
|
83369
83521
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
83370
83522
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
83371
83523
|
enabled: (options2?.enabled ?? true) && !!userId,
|
|
@@ -83374,6 +83526,8 @@ function useExecutions(userId, publishableKey, options2) {
|
|
|
83374
83526
|
gcTime: 1e3 * 60 * 5,
|
|
83375
83527
|
refetchOnWindowFocus: false
|
|
83376
83528
|
});
|
|
83529
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
83530
|
+
return query;
|
|
83377
83531
|
}
|
|
83378
83532
|
var POLL_INTERVAL_MS4 = 2500;
|
|
83379
83533
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -83710,7 +83864,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
83710
83864
|
} = params;
|
|
83711
83865
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
83712
83866
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
83713
|
-
return (0,
|
|
83867
|
+
return (0, import_react_query25.useQuery)({
|
|
83714
83868
|
queryKey: [
|
|
83715
83869
|
"unifold",
|
|
83716
83870
|
"verifyRecipientAddress",
|
|
@@ -83748,9 +83902,8 @@ function useGetDepositAddress(params) {
|
|
|
83748
83902
|
actionType,
|
|
83749
83903
|
enabled = true
|
|
83750
83904
|
} = params;
|
|
83751
|
-
const { setUserId } = useAnalytics();
|
|
83752
83905
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
83753
|
-
const query = (0,
|
|
83906
|
+
const query = (0, import_react_query26.useQuery)({
|
|
83754
83907
|
queryKey: [
|
|
83755
83908
|
"unifold",
|
|
83756
83909
|
"getDepositAddress",
|
|
@@ -83780,11 +83933,7 @@ function useGetDepositAddress(params) {
|
|
|
83780
83933
|
refetchOnWindowFocus: false,
|
|
83781
83934
|
retry: 1
|
|
83782
83935
|
});
|
|
83783
|
-
(
|
|
83784
|
-
if (query.data?.user_id) {
|
|
83785
|
-
setUserId(query.data.user_id);
|
|
83786
|
-
}
|
|
83787
|
-
}, [query.data?.user_id, setUserId]);
|
|
83936
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
83788
83937
|
return query;
|
|
83789
83938
|
}
|
|
83790
83939
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -84734,9 +84883,9 @@ function WithdrawConfirmingView({
|
|
|
84734
84883
|
const { colors: colors2, fonts, components } = useTheme();
|
|
84735
84884
|
const { t: strings } = useI18n();
|
|
84736
84885
|
const t = strings.withdrawModal.details;
|
|
84737
|
-
const [showButton, setShowButton] = (0,
|
|
84886
|
+
const [showButton, setShowButton] = (0, import_react46.useState)(false);
|
|
84738
84887
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
84739
|
-
(0,
|
|
84888
|
+
(0, import_react46.useEffect)(() => {
|
|
84740
84889
|
if (latestExecution) return;
|
|
84741
84890
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
84742
84891
|
return () => clearTimeout(timer);
|
|
@@ -84905,12 +85054,16 @@ function WithdrawModal({
|
|
|
84905
85054
|
);
|
|
84906
85055
|
const journeyActiveRef = (0, import_react42.useRef)(false);
|
|
84907
85056
|
const journeySessionIdRef = (0, import_react42.useRef)(void 0);
|
|
85057
|
+
const journeyExternalUserIdRef = (0, import_react42.useRef)(void 0);
|
|
84908
85058
|
const onWithdrawSuccessFor = (0, import_react42.useCallback)(
|
|
84909
85059
|
(data) => {
|
|
84910
85060
|
const execution = data.execution?.data.object;
|
|
84911
85061
|
track("flow_completed", {
|
|
84912
85062
|
flow_type: "withdraw",
|
|
84913
85063
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
85064
|
+
// The one high-cardinality field we do send: the join key from a
|
|
85065
|
+
// funnel session back to the execution row it produced.
|
|
85066
|
+
execution_id: data.executionId ?? execution?.id,
|
|
84914
85067
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
84915
85068
|
status: execution?.status,
|
|
84916
85069
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -84931,6 +85084,7 @@ function WithdrawModal({
|
|
|
84931
85084
|
track("flow_failed", {
|
|
84932
85085
|
flow_type: "withdraw",
|
|
84933
85086
|
error_code: error.code,
|
|
85087
|
+
execution_id: execution?.id,
|
|
84934
85088
|
failure_reason: execution?.failureReason ?? void 0,
|
|
84935
85089
|
status: execution?.status,
|
|
84936
85090
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -85004,6 +85158,7 @@ function WithdrawModal({
|
|
|
85004
85158
|
) ?? null : null;
|
|
85005
85159
|
const [view, setView] = (0, import_react42.useState)("form");
|
|
85006
85160
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react42.useState)();
|
|
85161
|
+
const withdrawDepositWalletIdRef = (0, import_react42.useRef)(void 0);
|
|
85007
85162
|
const [selectedExecution, setSelectedExecution] = (0, import_react42.useState)(null);
|
|
85008
85163
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react42.useState)(null);
|
|
85009
85164
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -85041,6 +85196,7 @@ function WithdrawModal({
|
|
|
85041
85196
|
if (!depositWallet) {
|
|
85042
85197
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
85043
85198
|
}
|
|
85199
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
85044
85200
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
85045
85201
|
return depositWallet;
|
|
85046
85202
|
},
|
|
@@ -85060,7 +85216,12 @@ function WithdrawModal({
|
|
|
85060
85216
|
currency: tokenData?.currency,
|
|
85061
85217
|
amount: txInfo.amount,
|
|
85062
85218
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
85063
|
-
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
|
|
85219
|
+
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
|
|
85220
|
+
// The execution doesn't exist yet — it's created when the user's send
|
|
85221
|
+
// lands on the withdraw deposit wallet, and carries this id. So a
|
|
85222
|
+
// withdrawal confirmed but never completed still joins to whatever
|
|
85223
|
+
// did (or didn't) follow on that wallet.
|
|
85224
|
+
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
85064
85225
|
});
|
|
85065
85226
|
emitEvent({
|
|
85066
85227
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -85094,8 +85255,10 @@ function WithdrawModal({
|
|
|
85094
85255
|
const beginJourney = (0, import_react42.useCallback)(() => {
|
|
85095
85256
|
journeySessionIdRef.current = startSession();
|
|
85096
85257
|
journeyActiveRef.current = true;
|
|
85258
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85259
|
+
setUserId(null);
|
|
85097
85260
|
track("widget_opened", { flow_type: "withdraw" });
|
|
85098
|
-
}, [startSession, track]);
|
|
85261
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
85099
85262
|
const handleClose = (0, import_react42.useCallback)(() => {
|
|
85100
85263
|
finalizeJourney();
|
|
85101
85264
|
onOpenChange(false);
|
|
@@ -85104,6 +85267,7 @@ function WithdrawModal({
|
|
|
85104
85267
|
setView("form");
|
|
85105
85268
|
setSelectedExecution(null);
|
|
85106
85269
|
setSubmittedTxInfo(null);
|
|
85270
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85107
85271
|
setWithdrawDepositWalletId(void 0);
|
|
85108
85272
|
resetViewTimeoutRef.current = null;
|
|
85109
85273
|
}, 200);
|
|
@@ -85121,8 +85285,14 @@ function WithdrawModal({
|
|
|
85121
85285
|
setView("form");
|
|
85122
85286
|
setSelectedExecution(null);
|
|
85123
85287
|
setSubmittedTxInfo(null);
|
|
85288
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85124
85289
|
setWithdrawDepositWalletId(void 0);
|
|
85125
85290
|
}, [open]);
|
|
85291
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
85292
|
+
if (!open || journeyExternalUserIdRef.current === externalUserId) return;
|
|
85293
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85294
|
+
setUserId(null);
|
|
85295
|
+
}, [open, externalUserId, setUserId]);
|
|
85126
85296
|
(0, import_react42.useEffect)(
|
|
85127
85297
|
() => () => {
|
|
85128
85298
|
if (journeyActiveRef.current) {
|
|
@@ -85808,9 +85978,9 @@ function useUnifold2() {
|
|
|
85808
85978
|
}
|
|
85809
85979
|
|
|
85810
85980
|
// src/unifold.tsx
|
|
85811
|
-
var UnifoldBridge = (0,
|
|
85981
|
+
var UnifoldBridge = (0, import_react48.forwardRef)((_, ref) => {
|
|
85812
85982
|
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
85813
|
-
(0,
|
|
85983
|
+
(0, import_react48.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
85814
85984
|
beginDeposit,
|
|
85815
85985
|
closeDeposit,
|
|
85816
85986
|
beginWithdraw,
|
|
@@ -85819,7 +85989,7 @@ var UnifoldBridge = (0, import_react49.forwardRef)((_, ref) => {
|
|
|
85819
85989
|
return null;
|
|
85820
85990
|
});
|
|
85821
85991
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
85822
|
-
var RenderErrorBoundary = class extends
|
|
85992
|
+
var RenderErrorBoundary = class extends import_react48.Component {
|
|
85823
85993
|
constructor() {
|
|
85824
85994
|
super(...arguments);
|
|
85825
85995
|
this.state = { hasError: false };
|
|
@@ -85891,13 +86061,13 @@ function createUnifold(publishableKey, config) {
|
|
|
85891
86061
|
};
|
|
85892
86062
|
try {
|
|
85893
86063
|
root.render(
|
|
85894
|
-
|
|
86064
|
+
import_react48.default.createElement(
|
|
85895
86065
|
RenderErrorBoundary,
|
|
85896
86066
|
{ onError: handleRenderError },
|
|
85897
|
-
|
|
86067
|
+
import_react48.default.createElement(
|
|
85898
86068
|
UnifoldProvider2,
|
|
85899
86069
|
{ publishableKey, config },
|
|
85900
|
-
|
|
86070
|
+
import_react48.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
85901
86071
|
)
|
|
85902
86072
|
)
|
|
85903
86073
|
);
|