@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.mjs
CHANGED
|
@@ -38849,12 +38849,12 @@ var require_useQuery = __commonJS({
|
|
|
38849
38849
|
var __toCommonJS = (mod) => __copyProps3(__defProp4({}, "__esModule", { value: true }), mod);
|
|
38850
38850
|
var useQuery_exports = {};
|
|
38851
38851
|
__export(useQuery_exports, {
|
|
38852
|
-
useQuery: () =>
|
|
38852
|
+
useQuery: () => useQuery26
|
|
38853
38853
|
});
|
|
38854
38854
|
module.exports = __toCommonJS(useQuery_exports);
|
|
38855
38855
|
var import_query_core = require_modern();
|
|
38856
38856
|
var import_useBaseQuery = require_useBaseQuery();
|
|
38857
|
-
function
|
|
38857
|
+
function useQuery26(options2, queryClient) {
|
|
38858
38858
|
return (0, import_useBaseQuery.useBaseQuery)(options2, import_query_core.QueryObserver, queryClient);
|
|
38859
38859
|
}
|
|
38860
38860
|
}
|
|
@@ -39598,7 +39598,7 @@ var require_modern2 = __commonJS({
|
|
|
39598
39598
|
});
|
|
39599
39599
|
|
|
39600
39600
|
// src/unifold.tsx
|
|
39601
|
-
var
|
|
39601
|
+
var import_react48 = __toESM(require_react());
|
|
39602
39602
|
var import_client = __toESM(require_client());
|
|
39603
39603
|
|
|
39604
39604
|
// ../connect-react/dist/index.mjs
|
|
@@ -39756,7 +39756,7 @@ function generateKSUID() {
|
|
|
39756
39756
|
function generatePrefixedKSUID(prefix) {
|
|
39757
39757
|
return `${prefix}_${generateKSUID()}`;
|
|
39758
39758
|
}
|
|
39759
|
-
var SDK_VERSION = true ? "0.1.
|
|
39759
|
+
var SDK_VERSION = true ? "0.1.79" : "0.0.0-dev";
|
|
39760
39760
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
39761
39761
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
39762
39762
|
function detectRuntime() {
|
|
@@ -40899,25 +40899,6 @@ async function buildHypercoreTransaction(request, publishableKey) {
|
|
|
40899
40899
|
}
|
|
40900
40900
|
return response.json();
|
|
40901
40901
|
}
|
|
40902
|
-
async function getCashAppLimits(currency = "usd", publishableKey) {
|
|
40903
|
-
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
40904
|
-
validatePublishableKey(pk);
|
|
40905
|
-
const response = await apiFetch(
|
|
40906
|
-
`${API_BASE_URL}/v1/public/onramps/cashapp/limits?currency=${encodeURIComponent(currency)}`,
|
|
40907
|
-
{
|
|
40908
|
-
method: "GET",
|
|
40909
|
-
headers: {
|
|
40910
|
-
accept: "application/json",
|
|
40911
|
-
"x-publishable-key": pk
|
|
40912
|
-
}
|
|
40913
|
-
}
|
|
40914
|
-
);
|
|
40915
|
-
if (!response.ok) {
|
|
40916
|
-
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
40917
|
-
throw new Error(`Failed to get Cash App limits: ${error.message || response.statusText}`);
|
|
40918
|
-
}
|
|
40919
|
-
return response.json();
|
|
40920
|
-
}
|
|
40921
40902
|
async function createCashAppSession(request, publishableKey) {
|
|
40922
40903
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
40923
40904
|
validatePublishableKey(pk);
|
|
@@ -41582,8 +41563,8 @@ var OnrampSessionEventType = ((OnrampSessionEventType2) => {
|
|
|
41582
41563
|
})(OnrampSessionEventType || {});
|
|
41583
41564
|
|
|
41584
41565
|
// ../connect-react/dist/index.mjs
|
|
41585
|
-
var import_react8 = __toESM(require_react(), 1);
|
|
41586
41566
|
var import_react_query3 = __toESM(require_modern2(), 1);
|
|
41567
|
+
var import_react8 = __toESM(require_react(), 1);
|
|
41587
41568
|
var React52 = __toESM(require_react(), 1);
|
|
41588
41569
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
41589
41570
|
var import_react9 = __toESM(require_react(), 1);
|
|
@@ -41624,10 +41605,9 @@ var import_react23 = __toESM(require_react(), 1);
|
|
|
41624
41605
|
var import_react_query9 = __toESM(require_modern2(), 1);
|
|
41625
41606
|
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
41626
41607
|
var import_react24 = __toESM(require_react(), 1);
|
|
41627
|
-
var import_react_query10 = __toESM(require_modern2(), 1);
|
|
41628
41608
|
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
41629
41609
|
var import_react25 = __toESM(require_react(), 1);
|
|
41630
|
-
var
|
|
41610
|
+
var import_react_query10 = __toESM(require_modern2(), 1);
|
|
41631
41611
|
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
41632
41612
|
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
41633
41613
|
var React92 = __toESM(require_react(), 1);
|
|
@@ -41689,14 +41669,14 @@ var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
|
41689
41669
|
var import_react27 = __toESM(require_react(), 1);
|
|
41690
41670
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
41691
41671
|
var import_react28 = __toESM(require_react(), 1);
|
|
41672
|
+
var import_react_query11 = __toESM(require_modern2(), 1);
|
|
41692
41673
|
var import_react_query12 = __toESM(require_modern2(), 1);
|
|
41693
|
-
var import_react_query13 = __toESM(require_modern2(), 1);
|
|
41694
41674
|
var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
|
|
41675
|
+
var import_react_query13 = __toESM(require_modern2(), 1);
|
|
41695
41676
|
var import_react_query14 = __toESM(require_modern2(), 1);
|
|
41696
41677
|
var import_react_query15 = __toESM(require_modern2(), 1);
|
|
41697
|
-
var import_react_query16 = __toESM(require_modern2(), 1);
|
|
41698
41678
|
var import_react29 = __toESM(require_react(), 1);
|
|
41699
|
-
var
|
|
41679
|
+
var import_react_query16 = __toESM(require_modern2(), 1);
|
|
41700
41680
|
var import_react30 = __toESM(require_react(), 1);
|
|
41701
41681
|
var import_react31 = __toESM(require_react(), 1);
|
|
41702
41682
|
var React362 = __toESM(require_react(), 1);
|
|
@@ -41723,7 +41703,7 @@ var React30 = __toESM(require_react(), 1);
|
|
|
41723
41703
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
41724
41704
|
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
|
|
41725
41705
|
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
41726
|
-
var
|
|
41706
|
+
var import_react_query17 = __toESM(require_modern2(), 1);
|
|
41727
41707
|
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
|
|
41728
41708
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
41729
41709
|
var import_react36 = __toESM(require_react(), 1);
|
|
@@ -41741,8 +41721,8 @@ var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
|
41741
41721
|
var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
|
|
41742
41722
|
var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
|
|
41743
41723
|
var React39 = __toESM(require_react(), 1);
|
|
41724
|
+
var import_react_query18 = __toESM(require_modern2(), 1);
|
|
41744
41725
|
var import_react_query19 = __toESM(require_modern2(), 1);
|
|
41745
|
-
var import_react_query20 = __toESM(require_modern2(), 1);
|
|
41746
41726
|
var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
|
|
41747
41727
|
var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
|
|
41748
41728
|
var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -41757,26 +41737,25 @@ var React41 = __toESM(require_react(), 1);
|
|
|
41757
41737
|
var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
|
|
41758
41738
|
var import_react40 = __toESM(require_react(), 1);
|
|
41759
41739
|
var import_react41 = __toESM(require_react(), 1);
|
|
41760
|
-
var
|
|
41740
|
+
var import_react_query20 = __toESM(require_modern2(), 1);
|
|
41761
41741
|
var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
|
|
41762
41742
|
var import_react42 = __toESM(require_react(), 1);
|
|
41743
|
+
var import_react_query21 = __toESM(require_modern2(), 1);
|
|
41763
41744
|
var import_react_query22 = __toESM(require_modern2(), 1);
|
|
41764
41745
|
var import_react_query23 = __toESM(require_modern2(), 1);
|
|
41765
41746
|
var import_react_query24 = __toESM(require_modern2(), 1);
|
|
41766
|
-
var import_react_query25 = __toESM(require_modern2(), 1);
|
|
41767
41747
|
var import_react43 = __toESM(require_react(), 1);
|
|
41768
41748
|
var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
|
|
41769
41749
|
var import_react44 = __toESM(require_react(), 1);
|
|
41770
|
-
var
|
|
41750
|
+
var import_react_query25 = __toESM(require_modern2(), 1);
|
|
41771
41751
|
var import_react45 = __toESM(require_react(), 1);
|
|
41772
|
-
var
|
|
41773
|
-
var import_react_query27 = __toESM(require_modern2(), 1);
|
|
41752
|
+
var import_react_query26 = __toESM(require_modern2(), 1);
|
|
41774
41753
|
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
41775
41754
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
41776
|
-
var
|
|
41755
|
+
var import_react46 = __toESM(require_react(), 1);
|
|
41777
41756
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
41778
41757
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
41779
|
-
var
|
|
41758
|
+
var import_react47 = __toESM(require_react(), 1);
|
|
41780
41759
|
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
41781
41760
|
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
41782
41761
|
var __create2 = Object.create;
|
|
@@ -47901,7 +47880,7 @@ function generateKSUID2() {
|
|
|
47901
47880
|
function generatePrefixedKSUID2(prefix) {
|
|
47902
47881
|
return `${prefix}_${generateKSUID2()}`;
|
|
47903
47882
|
}
|
|
47904
|
-
var PACKAGE_VERSION = "0.1.
|
|
47883
|
+
var PACKAGE_VERSION = "0.1.79";
|
|
47905
47884
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
47906
47885
|
var DEFAULT_DEDUP_MS = 500;
|
|
47907
47886
|
var SESSION_PREFIX = "asess";
|
|
@@ -47991,8 +47970,12 @@ var EventTracker = class {
|
|
|
47991
47970
|
}
|
|
47992
47971
|
/**
|
|
47993
47972
|
* Associate subsequent events with an internal Unifold user.id
|
|
47994
|
-
* (`user_<ksuid>`). Pass `null` to clear.
|
|
47995
|
-
*
|
|
47973
|
+
* (`user_<ksuid>`). Pass `null` to clear.
|
|
47974
|
+
*
|
|
47975
|
+
* The tracker is shared across flows and outlives any one journey, so a
|
|
47976
|
+
* journey stamps its own user at the start — with the id if it already
|
|
47977
|
+
* knows one, `null` if it doesn't — rather than inheriting whatever the
|
|
47978
|
+
* previous journey left here.
|
|
47996
47979
|
*/
|
|
47997
47980
|
setUserId(userId) {
|
|
47998
47981
|
this.userId = userId || void 0;
|
|
@@ -48003,8 +47986,8 @@ var EventTracker = class {
|
|
|
48003
47986
|
* {@link EventTracker.endSession} carries it.
|
|
48004
47987
|
*
|
|
48005
47988
|
* Does not touch `userId`: the internal `user_<ksuid>` is attached separately
|
|
48006
|
-
* via {@link EventTracker.setUserId}
|
|
48007
|
-
*
|
|
47989
|
+
* via {@link EventTracker.setUserId}, and persists until the host replaces
|
|
47990
|
+
* it — which the SDK's modals do on every journey start.
|
|
48008
47991
|
*/
|
|
48009
47992
|
startSession() {
|
|
48010
47993
|
this.sessionId = generatePrefixedKSUID2(SESSION_PREFIX);
|
|
@@ -54349,6 +54332,9 @@ var en_default = {
|
|
|
54349
54332
|
transactionBreakdown: "Transaction breakdown",
|
|
54350
54333
|
networkFee: "Network fee",
|
|
54351
54334
|
confirmOrder: "Confirm Order",
|
|
54335
|
+
mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
|
|
54336
|
+
mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
|
|
54337
|
+
mfaEnrollmentSettingsLink: "Open Coinbase security settings",
|
|
54352
54338
|
termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
|
|
54353
54339
|
termsNoticeLink: "terms",
|
|
54354
54340
|
termsNoticeSuffix: "."
|
|
@@ -54479,7 +54465,12 @@ var en_default = {
|
|
|
54479
54465
|
prefix: "By continuing, you agree to Coinbase's ",
|
|
54480
54466
|
separator: ", ",
|
|
54481
54467
|
lastSeparator: ", and ",
|
|
54482
|
-
suffix: ".
|
|
54468
|
+
suffix: ".",
|
|
54469
|
+
agreements: {
|
|
54470
|
+
guest_checkout_terms: "Terms of Service",
|
|
54471
|
+
user_agreement: "User Agreement",
|
|
54472
|
+
privacy_policy: "Privacy Policy"
|
|
54473
|
+
}
|
|
54483
54474
|
},
|
|
54484
54475
|
errors: {
|
|
54485
54476
|
rateLimited: "Too many attempts. Please wait a few minutes and try again.",
|
|
@@ -55138,6 +55129,9 @@ var zh_default = {
|
|
|
55138
55129
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
|
|
55139
55130
|
networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
|
|
55140
55131
|
confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
|
|
55132
|
+
mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
|
|
55133
|
+
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",
|
|
55134
|
+
mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
|
|
55141
55135
|
termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
|
|
55142
55136
|
termsNoticeLink: "\u6761\u6B3E",
|
|
55143
55137
|
termsNoticeSuffix: "\u3002"
|
|
@@ -55268,7 +55262,12 @@ var zh_default = {
|
|
|
55268
55262
|
prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
55269
55263
|
separator: "\u3001",
|
|
55270
55264
|
lastSeparator: "\u548C",
|
|
55271
|
-
suffix: "\
|
|
55265
|
+
suffix: "\u3002",
|
|
55266
|
+
agreements: {
|
|
55267
|
+
guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
|
|
55268
|
+
user_agreement: "\u7528\u6237\u534F\u8BAE",
|
|
55269
|
+
privacy_policy: "\u9690\u79C1\u653F\u7B56"
|
|
55270
|
+
}
|
|
55272
55271
|
},
|
|
55273
55272
|
errors: {
|
|
55274
55273
|
rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
|
|
@@ -55927,6 +55926,9 @@ var zh_TW_default = {
|
|
|
55927
55926
|
transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
|
|
55928
55927
|
networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
|
|
55929
55928
|
confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
|
|
55929
|
+
mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
|
|
55930
|
+
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",
|
|
55931
|
+
mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
|
|
55930
55932
|
termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
|
|
55931
55933
|
termsNoticeLink: "\u689D\u6B3E",
|
|
55932
55934
|
termsNoticeSuffix: "\u3002"
|
|
@@ -56057,7 +56059,12 @@ var zh_TW_default = {
|
|
|
56057
56059
|
prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
|
|
56058
56060
|
separator: "\u3001",
|
|
56059
56061
|
lastSeparator: "\u548C",
|
|
56060
|
-
suffix: "\
|
|
56062
|
+
suffix: "\u3002",
|
|
56063
|
+
agreements: {
|
|
56064
|
+
guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
|
|
56065
|
+
user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
|
|
56066
|
+
privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
|
|
56067
|
+
}
|
|
56061
56068
|
},
|
|
56062
56069
|
errors: {
|
|
56063
56070
|
rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
|
|
@@ -56972,6 +56979,13 @@ function useAnalytics() {
|
|
|
56972
56979
|
);
|
|
56973
56980
|
return { track, startSession, endSession, getSessionId, setUserId, subscribe };
|
|
56974
56981
|
}
|
|
56982
|
+
function useStampInternalUserId({ internalUserId }) {
|
|
56983
|
+
const { setUserId } = useAnalytics();
|
|
56984
|
+
(0, import_react8.useEffect)(() => {
|
|
56985
|
+
if (!internalUserId) return;
|
|
56986
|
+
setUserId(internalUserId);
|
|
56987
|
+
}, [internalUserId, setUserId]);
|
|
56988
|
+
}
|
|
56975
56989
|
function useDepositAddress(params) {
|
|
56976
56990
|
const {
|
|
56977
56991
|
userId,
|
|
@@ -56984,7 +56998,6 @@ function useDepositAddress(params) {
|
|
|
56984
56998
|
contractCalls,
|
|
56985
56999
|
enabled = true
|
|
56986
57000
|
} = params;
|
|
56987
|
-
const { setUserId } = useAnalytics();
|
|
56988
57001
|
const query = (0, import_react_query3.useQuery)({
|
|
56989
57002
|
queryKey: [
|
|
56990
57003
|
"unifold",
|
|
@@ -57027,11 +57040,7 @@ function useDepositAddress(params) {
|
|
|
57027
57040
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
|
|
57028
57041
|
// 1s, 2s, 4s (max 10s)
|
|
57029
57042
|
});
|
|
57030
|
-
(
|
|
57031
|
-
if (query.data?.user_id) {
|
|
57032
|
-
setUserId(query.data.user_id);
|
|
57033
|
-
}
|
|
57034
|
-
}, [query.data?.user_id, setUserId]);
|
|
57043
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
57035
57044
|
return query;
|
|
57036
57045
|
}
|
|
57037
57046
|
function useDebounce(value, delay) {
|
|
@@ -59254,7 +59263,11 @@ function BuyWithCard({
|
|
|
59254
59263
|
method: "card",
|
|
59255
59264
|
flow_type: "deposit",
|
|
59256
59265
|
provider: selectedProvider.service_provider,
|
|
59257
|
-
amount_usd: amount
|
|
59266
|
+
amount_usd: amount,
|
|
59267
|
+
// The execution only exists once the provider's payout lands on this
|
|
59268
|
+
// wallet, and it carries this id — so it's the join key for a purchase
|
|
59269
|
+
// that starts here and never reaches flow_completed.
|
|
59270
|
+
deposit_wallet_id: depositWalletId
|
|
59258
59271
|
});
|
|
59259
59272
|
onEvent?.({
|
|
59260
59273
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -60691,6 +60704,8 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60691
60704
|
const [limitUpgradeError, setLimitUpgradeError] = (0, import_react16.useState)(null);
|
|
60692
60705
|
const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react16.useState)(false);
|
|
60693
60706
|
const upgradeFlowAbortRef = (0, import_react16.useRef)(null);
|
|
60707
|
+
const applyLimitRoutingRef = (0, import_react16.useRef)(() => {
|
|
60708
|
+
});
|
|
60694
60709
|
const [amount, setAmount] = (0, import_react16.useState)(amountUsd ?? "");
|
|
60695
60710
|
const [preparedOrder, setPreparedOrder] = (0, import_react16.useState)(null);
|
|
60696
60711
|
const sessionAbortRef = (0, import_react16.useRef)(null);
|
|
@@ -60825,6 +60840,14 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60825
60840
|
},
|
|
60826
60841
|
[email, normalizedPhone, userId]
|
|
60827
60842
|
);
|
|
60843
|
+
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60844
|
+
userId,
|
|
60845
|
+
publishableKey,
|
|
60846
|
+
normalizedPhone,
|
|
60847
|
+
userEmail,
|
|
60848
|
+
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60849
|
+
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60850
|
+
});
|
|
60828
60851
|
const createSessionAndSendOtp = (0, import_react16.useCallback)(async () => {
|
|
60829
60852
|
setView("submitting_session");
|
|
60830
60853
|
setErrorMessage("");
|
|
@@ -60834,7 +60857,12 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60834
60857
|
email,
|
|
60835
60858
|
phone: normalizedPhone,
|
|
60836
60859
|
terms_accepted: true,
|
|
60837
|
-
|
|
60860
|
+
// TODO: when the API honors `false`, this will trigger email OTP.
|
|
60861
|
+
// Today `false` still skips email (we don't verify it) and JWT ev
|
|
60862
|
+
// is null. Don't send `true` — that was a fake attest.
|
|
60863
|
+
email_already_verified: false
|
|
60864
|
+
// Coinbase stays Redis-only + JWT until bank-transfer identity
|
|
60865
|
+
// is live. Do not persist from this path yet.
|
|
60838
60866
|
},
|
|
60839
60867
|
publishableKey
|
|
60840
60868
|
);
|
|
@@ -60844,6 +60872,34 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60844
60872
|
}
|
|
60845
60873
|
setClientSecret(session.client_secret);
|
|
60846
60874
|
storeWalletPaySession();
|
|
60875
|
+
if (session.status === "verified") {
|
|
60876
|
+
const tokenRes = await exchangeOnrampVerificationToken(
|
|
60877
|
+
session.id,
|
|
60878
|
+
session.client_secret,
|
|
60879
|
+
publishableKey
|
|
60880
|
+
);
|
|
60881
|
+
setOnrampToken(tokenRes);
|
|
60882
|
+
storeWalletPaySession({
|
|
60883
|
+
emailVerifiedAt: session.email.verified_at,
|
|
60884
|
+
phoneVerifiedAt: session.phone.verified_at,
|
|
60885
|
+
onrampToken: tokenRes.token,
|
|
60886
|
+
onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
|
|
60887
|
+
});
|
|
60888
|
+
if (amountUsd) setAmount(amountUsd);
|
|
60889
|
+
try {
|
|
60890
|
+
const result = await refetchWalletPayLimits();
|
|
60891
|
+
if (result.data) {
|
|
60892
|
+
const nextView = getViewForLimitStatus(result.data);
|
|
60893
|
+
if (nextView) {
|
|
60894
|
+
applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
|
|
60895
|
+
return;
|
|
60896
|
+
}
|
|
60897
|
+
}
|
|
60898
|
+
} catch {
|
|
60899
|
+
}
|
|
60900
|
+
setView("amount");
|
|
60901
|
+
return;
|
|
60902
|
+
}
|
|
60847
60903
|
await sendOnrampVerificationOtp(session.id, "phone", session.client_secret, publishableKey);
|
|
60848
60904
|
setResendCooldown(30);
|
|
60849
60905
|
setView("phone_otp");
|
|
@@ -60852,19 +60908,19 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60852
60908
|
setErrorMessage(prettifyVerificationError(raw));
|
|
60853
60909
|
setView("phone_input");
|
|
60854
60910
|
}
|
|
60855
|
-
}, [
|
|
60911
|
+
}, [
|
|
60912
|
+
email,
|
|
60913
|
+
normalizedPhone,
|
|
60914
|
+
publishableKey,
|
|
60915
|
+
storeWalletPaySession,
|
|
60916
|
+
userId,
|
|
60917
|
+
amountUsd,
|
|
60918
|
+
refetchWalletPayLimits
|
|
60919
|
+
]);
|
|
60856
60920
|
const clearUpgradeFields = (0, import_react16.useCallback)(() => {
|
|
60857
60921
|
setSsnLast4("");
|
|
60858
60922
|
setDobInput("");
|
|
60859
60923
|
}, []);
|
|
60860
|
-
const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
|
|
60861
|
-
userId,
|
|
60862
|
-
publishableKey,
|
|
60863
|
-
normalizedPhone,
|
|
60864
|
-
userEmail,
|
|
60865
|
-
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
60866
|
-
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
60867
|
-
});
|
|
60868
60924
|
const pollLimitUpgradeStatus = (0, import_react16.useCallback)(
|
|
60869
60925
|
async (signal) => {
|
|
60870
60926
|
const POLL_INTERVAL_MS5 = 1500;
|
|
@@ -60975,6 +61031,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
60975
61031
|
},
|
|
60976
61032
|
[startUpgradePolling]
|
|
60977
61033
|
);
|
|
61034
|
+
applyLimitRoutingRef.current = applyLimitRouting;
|
|
60978
61035
|
const hasInitializedRef = (0, import_react16.useRef)(false);
|
|
60979
61036
|
(0, import_react16.useEffect)(() => {
|
|
60980
61037
|
if (hasInitializedRef.current) return;
|
|
@@ -61204,7 +61261,10 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61204
61261
|
track("flow_started", {
|
|
61205
61262
|
method,
|
|
61206
61263
|
flow_type: "deposit",
|
|
61207
|
-
amount_usd: walletPayAmountUsd
|
|
61264
|
+
amount_usd: walletPayAmountUsd,
|
|
61265
|
+
// No execution yet — one appears when the payout lands on this
|
|
61266
|
+
// wallet, carrying the same id.
|
|
61267
|
+
deposit_wallet_id: depositWalletId
|
|
61208
61268
|
});
|
|
61209
61269
|
onEvent?.({
|
|
61210
61270
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -61254,6 +61314,7 @@ var BuyWithWalletPay = React82.forwardRef(
|
|
|
61254
61314
|
defaultTokenLoading,
|
|
61255
61315
|
defaultTokenError,
|
|
61256
61316
|
depositWallet?.address,
|
|
61317
|
+
depositWalletId,
|
|
61257
61318
|
userEmail,
|
|
61258
61319
|
publishableKey,
|
|
61259
61320
|
onEvent,
|
|
@@ -62228,7 +62289,7 @@ var FALLBACK_AGREEMENTS = [
|
|
|
62228
62289
|
{
|
|
62229
62290
|
key: "guest_checkout_terms",
|
|
62230
62291
|
name: "Guest Checkout Terms of Service",
|
|
62231
|
-
url: "https://www.coinbase.com/legal/
|
|
62292
|
+
url: "https://www.coinbase.com/legal/guest-checkout/us"
|
|
62232
62293
|
},
|
|
62233
62294
|
{
|
|
62234
62295
|
key: "user_agreement",
|
|
@@ -62248,22 +62309,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62248
62309
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62249
62310
|
"div",
|
|
62250
62311
|
{
|
|
62251
|
-
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
|
|
62312
|
+
className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
|
|
62252
62313
|
"aria-hidden": true,
|
|
62253
62314
|
"aria-busy": "true",
|
|
62254
62315
|
children: [
|
|
62255
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62256
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62257
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2
|
|
62316
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
|
|
62317
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
|
|
62318
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
|
|
62258
62319
|
]
|
|
62259
62320
|
}
|
|
62260
62321
|
);
|
|
62261
62322
|
}
|
|
62262
62323
|
const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
|
|
62324
|
+
const shortLabels = t.agreements;
|
|
62325
|
+
const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
|
|
62263
62326
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
62264
62327
|
"p",
|
|
62265
62328
|
{
|
|
62266
|
-
className: "uf-text-[
|
|
62329
|
+
className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
|
|
62267
62330
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
62268
62331
|
children: [
|
|
62269
62332
|
t.prefix,
|
|
@@ -62274,12 +62337,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
62274
62337
|
href: a.url,
|
|
62275
62338
|
target: "_blank",
|
|
62276
62339
|
rel: "noopener noreferrer",
|
|
62277
|
-
className: "uf-underline",
|
|
62278
|
-
style: { color:
|
|
62279
|
-
children: a.name
|
|
62340
|
+
className: "uf-no-underline",
|
|
62341
|
+
style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
|
|
62342
|
+
children: shortLabels[a.key] ?? a.name
|
|
62280
62343
|
}
|
|
62281
62344
|
),
|
|
62282
|
-
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ?
|
|
62345
|
+
idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
|
|
62283
62346
|
] }, a.key)),
|
|
62284
62347
|
t.suffix
|
|
62285
62348
|
]
|
|
@@ -62901,16 +62964,6 @@ function PayWithExchange({
|
|
|
62901
62964
|
}
|
|
62902
62965
|
);
|
|
62903
62966
|
}
|
|
62904
|
-
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
62905
|
-
return (0, import_react_query10.useQuery)({
|
|
62906
|
-
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
62907
|
-
queryFn: () => getCashAppLimits(currency, publishableKey),
|
|
62908
|
-
enabled: !!publishableKey,
|
|
62909
|
-
staleTime: 2 * 60 * 6e4,
|
|
62910
|
-
gcTime: 4 * 60 * 6e4,
|
|
62911
|
-
retry: 2
|
|
62912
|
-
});
|
|
62913
|
-
}
|
|
62914
62967
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
62915
62968
|
var FALLBACK_MIN_USD = 5;
|
|
62916
62969
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
@@ -62922,6 +62975,7 @@ function PayWithCashApp({
|
|
|
62922
62975
|
destinationChainType,
|
|
62923
62976
|
destinationChainId,
|
|
62924
62977
|
destinationTokenAddress,
|
|
62978
|
+
contractCalls,
|
|
62925
62979
|
cashAppIconUrl,
|
|
62926
62980
|
view: controlledView,
|
|
62927
62981
|
onViewChange,
|
|
@@ -62945,9 +62999,11 @@ function PayWithCashApp({
|
|
|
62945
62999
|
const b = parseInt(bg.slice(4, 6), 16);
|
|
62946
63000
|
return (r2 * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
62947
63001
|
})();
|
|
62948
|
-
const { data:
|
|
62949
|
-
|
|
62950
|
-
|
|
63002
|
+
const { data: fiatCurrencies, isLoading: limitsLoading } = useFiatCurrencies({
|
|
63003
|
+
publishableKey
|
|
63004
|
+
});
|
|
63005
|
+
const minUsd = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === "usd")?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
63006
|
+
const quickAmounts = SUGGESTED_AMOUNTS.filter((value) => value >= minUsd);
|
|
62951
63007
|
const [amount, setAmount] = (0, import_react24.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
62952
63008
|
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
62953
63009
|
const [session, setSession] = (0, import_react24.useState)(null);
|
|
@@ -63002,6 +63058,8 @@ function PayWithCashApp({
|
|
|
63002
63058
|
setError(strings.depositModal.cashAppErrors.missingFields);
|
|
63003
63059
|
return;
|
|
63004
63060
|
}
|
|
63061
|
+
const amountNum2 = parseFloat(amount);
|
|
63062
|
+
if (isNaN(amountNum2) || amountNum2 < minUsd) return;
|
|
63005
63063
|
setLoading(true);
|
|
63006
63064
|
setError(null);
|
|
63007
63065
|
try {
|
|
@@ -63014,7 +63072,8 @@ function PayWithCashApp({
|
|
|
63014
63072
|
destination_token_address: destinationTokenAddress,
|
|
63015
63073
|
recipient_address: recipientAddress,
|
|
63016
63074
|
source_amount: amount,
|
|
63017
|
-
external_id: externalId
|
|
63075
|
+
external_id: externalId,
|
|
63076
|
+
...contractCalls?.length ? { contract_calls: contractCalls } : {}
|
|
63018
63077
|
},
|
|
63019
63078
|
publishableKey
|
|
63020
63079
|
);
|
|
@@ -63027,7 +63086,10 @@ function PayWithCashApp({
|
|
|
63027
63086
|
track("flow_started", {
|
|
63028
63087
|
method: "cashapp",
|
|
63029
63088
|
flow_type: "deposit",
|
|
63030
|
-
amount_usd: amount
|
|
63089
|
+
amount_usd: amount,
|
|
63090
|
+
// No execution yet — one appears when the payout lands on this
|
|
63091
|
+
// wallet, carrying the same id.
|
|
63092
|
+
deposit_wallet_id: depositWalletId
|
|
63031
63093
|
});
|
|
63032
63094
|
onEvent?.({
|
|
63033
63095
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -63046,12 +63108,15 @@ function PayWithCashApp({
|
|
|
63046
63108
|
}
|
|
63047
63109
|
}, [
|
|
63048
63110
|
amount,
|
|
63111
|
+
minUsd,
|
|
63049
63112
|
userId,
|
|
63050
63113
|
publishableKey,
|
|
63051
63114
|
recipientAddress,
|
|
63052
63115
|
destinationChainType,
|
|
63053
63116
|
destinationChainId,
|
|
63054
63117
|
destinationTokenAddress,
|
|
63118
|
+
contractCalls,
|
|
63119
|
+
depositWalletId,
|
|
63055
63120
|
onEvent,
|
|
63056
63121
|
onDepositError,
|
|
63057
63122
|
track,
|
|
@@ -63147,8 +63212,7 @@ function PayWithCashApp({
|
|
|
63147
63212
|
const amountNum = parseFloat(amount);
|
|
63148
63213
|
const hasInput = !isNaN(amountNum) && amountNum > 0;
|
|
63149
63214
|
const belowMin = hasInput && amountNum < minUsd;
|
|
63150
|
-
const
|
|
63151
|
-
const isValidAmount = hasInput && !belowMin && !aboveMax;
|
|
63215
|
+
const isValidAmount = hasInput && !belowMin;
|
|
63152
63216
|
if (view === "amount") {
|
|
63153
63217
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63154
63218
|
"div",
|
|
@@ -63177,7 +63241,7 @@ function PayWithCashApp({
|
|
|
63177
63241
|
}
|
|
63178
63242
|
}
|
|
63179
63243
|
) }) }),
|
|
63180
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children:
|
|
63244
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children: quickAmounts.map((quickAmount) => {
|
|
63181
63245
|
const isSelected = parseFloat(amount) === quickAmount;
|
|
63182
63246
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63183
63247
|
"button",
|
|
@@ -63203,23 +63267,17 @@ function PayWithCashApp({
|
|
|
63203
63267
|
quickAmount
|
|
63204
63268
|
);
|
|
63205
63269
|
}) }),
|
|
63206
|
-
|
|
63270
|
+
!limitsLoading && minUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63207
63271
|
"div",
|
|
63208
63272
|
{
|
|
63209
|
-
className: "uf-text-
|
|
63210
|
-
style: { color: colors2.
|
|
63211
|
-
children: interpolate(strings.common.
|
|
63212
|
-
|
|
63213
|
-
) : amount && maxUsd !== null && amountNum > maxUsd && !error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63214
|
-
"div",
|
|
63215
|
-
{
|
|
63216
|
-
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
63217
|
-
style: { color: colors2.error, fontFamily: fonts.regular },
|
|
63218
|
-
children: interpolate(strings.common.maximumAmount, {
|
|
63219
|
-
amount: `$${maxUsd.toLocaleString()}`
|
|
63273
|
+
className: "uf-text-center uf-text-xs uf-mt-4",
|
|
63274
|
+
style: { color: colors2.warning, fontFamily: fonts.regular },
|
|
63275
|
+
children: interpolate(strings.common.minimumDeposit, {
|
|
63276
|
+
amount: `$${minUsd.toFixed(2)}`
|
|
63220
63277
|
})
|
|
63221
63278
|
}
|
|
63222
|
-
)
|
|
63279
|
+
),
|
|
63280
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63223
63281
|
"div",
|
|
63224
63282
|
{
|
|
63225
63283
|
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
@@ -63228,7 +63286,7 @@ function PayWithCashApp({
|
|
|
63228
63286
|
}
|
|
63229
63287
|
) : null
|
|
63230
63288
|
] }),
|
|
63231
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-px-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63289
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-px-1 uf-mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63232
63290
|
"button",
|
|
63233
63291
|
{
|
|
63234
63292
|
onClick: handleCreateSession,
|
|
@@ -63449,7 +63507,7 @@ function useBankTransferProviders({
|
|
|
63449
63507
|
countryCode
|
|
63450
63508
|
}) {
|
|
63451
63509
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
63452
|
-
const { data: providers, isLoading } = (0,
|
|
63510
|
+
const { data: providers, isLoading } = (0, import_react_query10.useQuery)({
|
|
63453
63511
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
63454
63512
|
queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
|
|
63455
63513
|
enabled,
|
|
@@ -63653,7 +63711,10 @@ function BankTransfer({
|
|
|
63653
63711
|
method: "bank_transfer",
|
|
63654
63712
|
flow_type: "deposit",
|
|
63655
63713
|
provider: request.service_provider,
|
|
63656
|
-
amount_usd: request.source_amount
|
|
63714
|
+
amount_usd: request.source_amount,
|
|
63715
|
+
// No execution yet — one appears when the provider's payout lands on
|
|
63716
|
+
// this wallet, carrying the same id.
|
|
63717
|
+
deposit_wallet_id: pollingWalletId
|
|
63657
63718
|
});
|
|
63658
63719
|
onEvent?.({
|
|
63659
63720
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -69734,7 +69795,11 @@ function PayWithStripeLink({
|
|
|
69734
69795
|
if (checkoutResult.successful) {
|
|
69735
69796
|
handledTerminalSessionRef.current = null;
|
|
69736
69797
|
executionReconciledSessionRef.current = null;
|
|
69737
|
-
track("flow_started", {
|
|
69798
|
+
track("flow_started", {
|
|
69799
|
+
method: "stripe_link",
|
|
69800
|
+
flow_type: "deposit",
|
|
69801
|
+
deposit_wallet_id: depositWalletId
|
|
69802
|
+
});
|
|
69738
69803
|
setConfirmedSessionId(activeSessionId);
|
|
69739
69804
|
setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
|
|
69740
69805
|
if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
|
|
@@ -71231,7 +71296,14 @@ function PayWithStripeLink({
|
|
|
71231
71296
|
]
|
|
71232
71297
|
}
|
|
71233
71298
|
),
|
|
71234
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71299
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
71300
|
+
"div",
|
|
71301
|
+
{
|
|
71302
|
+
ref: authMountRef,
|
|
71303
|
+
className: "uf-w-full uf-min-h-[200px]",
|
|
71304
|
+
style: { colorScheme: "only light" }
|
|
71305
|
+
}
|
|
71306
|
+
)
|
|
71235
71307
|
]
|
|
71236
71308
|
}
|
|
71237
71309
|
);
|
|
@@ -71789,7 +71861,7 @@ function useProjectConfig({
|
|
|
71789
71861
|
data: projectConfig,
|
|
71790
71862
|
isLoading,
|
|
71791
71863
|
error
|
|
71792
|
-
} = (0,
|
|
71864
|
+
} = (0, import_react_query11.useQuery)({
|
|
71793
71865
|
// Country is part of the key so a region change refetches the region-aware
|
|
71794
71866
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
71795
71867
|
// sharing the base cache entry.
|
|
@@ -71799,7 +71871,7 @@ function useProjectConfig({
|
|
|
71799
71871
|
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
71800
71872
|
// config refetches after the country resolves, so unrelated config-driven
|
|
71801
71873
|
// UI doesn't flash back to defaults.
|
|
71802
|
-
placeholderData:
|
|
71874
|
+
placeholderData: import_react_query11.keepPreviousData,
|
|
71803
71875
|
staleTime: 1e3 * 60 * 30,
|
|
71804
71876
|
refetchOnMount: true,
|
|
71805
71877
|
refetchOnWindowFocus: true
|
|
@@ -71811,7 +71883,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
71811
71883
|
publishableKey,
|
|
71812
71884
|
enabled = true
|
|
71813
71885
|
}) {
|
|
71814
|
-
return (0,
|
|
71886
|
+
return (0, import_react_query12.useQuery)({
|
|
71815
71887
|
queryKey: [
|
|
71816
71888
|
"unifold",
|
|
71817
71889
|
"integrationTransferDefaultToken",
|
|
@@ -72494,6 +72566,9 @@ function CoinbaseConnect({
|
|
|
72494
72566
|
flow_type: "deposit",
|
|
72495
72567
|
method: "exchange_connect",
|
|
72496
72568
|
provider: IntegrationProvider.COINBASE,
|
|
72569
|
+
// No execution yet — one appears when the exchange's transfer lands on
|
|
72570
|
+
// this wallet, carrying the same id.
|
|
72571
|
+
deposit_wallet_id: transferDepositWalletId,
|
|
72497
72572
|
amount_usd: sendAmount || void 0,
|
|
72498
72573
|
currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
|
|
72499
72574
|
chain: sourceChain?.chain_id,
|
|
@@ -72501,6 +72576,34 @@ function CoinbaseConnect({
|
|
|
72501
72576
|
network: sourceChain?.network
|
|
72502
72577
|
});
|
|
72503
72578
|
};
|
|
72579
|
+
const applyConfirmResult = (result) => {
|
|
72580
|
+
if (result.status === "mfa_required") {
|
|
72581
|
+
track("verification_started", {
|
|
72582
|
+
flow_type: "deposit",
|
|
72583
|
+
method: "exchange_connect",
|
|
72584
|
+
provider: IntegrationProvider.COINBASE,
|
|
72585
|
+
verification_type: "mfa",
|
|
72586
|
+
verification_status: result.status
|
|
72587
|
+
});
|
|
72588
|
+
transitionTo("mfa");
|
|
72589
|
+
setMfaCode("");
|
|
72590
|
+
setMfaError(false);
|
|
72591
|
+
} else if (result.status === "mfa_enrollment_required") {
|
|
72592
|
+
transitionTo("mfa_enrollment");
|
|
72593
|
+
} else if (result.status === "completed") {
|
|
72594
|
+
trackTransferStarted();
|
|
72595
|
+
setConfirmResult(result);
|
|
72596
|
+
transitionTo("success");
|
|
72597
|
+
onTransferSuccess?.(result);
|
|
72598
|
+
} else {
|
|
72599
|
+
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72600
|
+
transitionTo("error");
|
|
72601
|
+
onTransferError?.({
|
|
72602
|
+
message: result.message || t.errors.transferFailed,
|
|
72603
|
+
code: result.status
|
|
72604
|
+
});
|
|
72605
|
+
}
|
|
72606
|
+
};
|
|
72504
72607
|
const handleConfirmTransfer = async () => {
|
|
72505
72608
|
if (!transferIntent || !accessToken) return;
|
|
72506
72609
|
setIsLoading(true);
|
|
@@ -72535,30 +72638,7 @@ function CoinbaseConnect({
|
|
|
72535
72638
|
});
|
|
72536
72639
|
throw err;
|
|
72537
72640
|
});
|
|
72538
|
-
|
|
72539
|
-
track("verification_started", {
|
|
72540
|
-
flow_type: "deposit",
|
|
72541
|
-
method: "exchange_connect",
|
|
72542
|
-
provider: IntegrationProvider.COINBASE,
|
|
72543
|
-
verification_type: "mfa",
|
|
72544
|
-
verification_status: result.status
|
|
72545
|
-
});
|
|
72546
|
-
transitionTo("mfa");
|
|
72547
|
-
setMfaCode("");
|
|
72548
|
-
setMfaError(false);
|
|
72549
|
-
} else if (result.status === "completed") {
|
|
72550
|
-
trackTransferStarted();
|
|
72551
|
-
setConfirmResult(result);
|
|
72552
|
-
transitionTo("success");
|
|
72553
|
-
onTransferSuccess?.(result);
|
|
72554
|
-
} else {
|
|
72555
|
-
setErrorMessage(result.message || t.errors.transferFailed);
|
|
72556
|
-
transitionTo("error");
|
|
72557
|
-
onTransferError?.({
|
|
72558
|
-
message: result.message || t.errors.transferFailed,
|
|
72559
|
-
code: result.status
|
|
72560
|
-
});
|
|
72561
|
-
}
|
|
72641
|
+
applyConfirmResult(result);
|
|
72562
72642
|
} catch (err) {
|
|
72563
72643
|
const message = err instanceof Error ? err.message : t.errors.transferFailed;
|
|
72564
72644
|
setErrorMessage(message);
|
|
@@ -72715,6 +72795,9 @@ function CoinbaseConnect({
|
|
|
72715
72795
|
setShowTransferDetails(false);
|
|
72716
72796
|
transitionTo("enter_amount");
|
|
72717
72797
|
break;
|
|
72798
|
+
case "mfa_enrollment":
|
|
72799
|
+
transitionTo("transfer_confirm");
|
|
72800
|
+
break;
|
|
72718
72801
|
case "mfa":
|
|
72719
72802
|
transitionTo("transfer_confirm");
|
|
72720
72803
|
break;
|
|
@@ -74271,6 +74354,55 @@ function CoinbaseConnect({
|
|
|
74271
74354
|
] })
|
|
74272
74355
|
] });
|
|
74273
74356
|
}
|
|
74357
|
+
if (view === "mfa_enrollment") {
|
|
74358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74359
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
74360
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74361
|
+
"div",
|
|
74362
|
+
{
|
|
74363
|
+
className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
|
|
74364
|
+
style: viewTransitionStyle,
|
|
74365
|
+
children: [
|
|
74366
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74367
|
+
DepositErrorState,
|
|
74368
|
+
{
|
|
74369
|
+
title: t.transfer.mfaEnrollmentTitle,
|
|
74370
|
+
message: t.transfer.mfaEnrollmentMessage
|
|
74371
|
+
}
|
|
74372
|
+
),
|
|
74373
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
74374
|
+
"a",
|
|
74375
|
+
{
|
|
74376
|
+
href: "https://www.coinbase.com/settings/security",
|
|
74377
|
+
target: "_blank",
|
|
74378
|
+
rel: "noopener noreferrer",
|
|
74379
|
+
className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
|
|
74380
|
+
style: { color: colors2.primary, fontFamily: fonts.medium },
|
|
74381
|
+
children: [
|
|
74382
|
+
t.transfer.mfaEnrollmentSettingsLink,
|
|
74383
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
|
|
74384
|
+
]
|
|
74385
|
+
}
|
|
74386
|
+
),
|
|
74387
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
74388
|
+
"button",
|
|
74389
|
+
{
|
|
74390
|
+
onClick: handleConfirmTransfer,
|
|
74391
|
+
disabled: isLoading,
|
|
74392
|
+
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",
|
|
74393
|
+
style: {
|
|
74394
|
+
backgroundColor: colors2.primary,
|
|
74395
|
+
color: "#fff",
|
|
74396
|
+
fontFamily: fonts.medium
|
|
74397
|
+
},
|
|
74398
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
|
|
74399
|
+
}
|
|
74400
|
+
)
|
|
74401
|
+
]
|
|
74402
|
+
}
|
|
74403
|
+
)
|
|
74404
|
+
] });
|
|
74405
|
+
}
|
|
74274
74406
|
if (view === "mfa") {
|
|
74275
74407
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
74276
74408
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
|
|
@@ -74554,7 +74686,7 @@ function useExchanges({
|
|
|
74554
74686
|
publishableKey,
|
|
74555
74687
|
enabled = true
|
|
74556
74688
|
}) {
|
|
74557
|
-
const { data: exchanges = [], isLoading } = (0,
|
|
74689
|
+
const { data: exchanges = [], isLoading } = (0, import_react_query13.useQuery)({
|
|
74558
74690
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
74559
74691
|
queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
|
|
74560
74692
|
enabled,
|
|
@@ -74572,7 +74704,7 @@ function usePublicIncident({
|
|
|
74572
74704
|
data: incident,
|
|
74573
74705
|
isLoading,
|
|
74574
74706
|
error
|
|
74575
|
-
} = (0,
|
|
74707
|
+
} = (0, import_react_query14.useQuery)({
|
|
74576
74708
|
queryKey: ["unifold", "publicIncident", publishableKey],
|
|
74577
74709
|
queryFn: () => getPublicIncident(publishableKey),
|
|
74578
74710
|
enabled,
|
|
@@ -74587,7 +74719,7 @@ function useWalletPayProviders({
|
|
|
74587
74719
|
publishableKey,
|
|
74588
74720
|
enabled = true
|
|
74589
74721
|
}) {
|
|
74590
|
-
const { data: providers, isLoading } = (0,
|
|
74722
|
+
const { data: providers, isLoading } = (0, import_react_query15.useQuery)({
|
|
74591
74723
|
queryKey: ["unifold", "walletPayProviders", method, publishableKey],
|
|
74592
74724
|
queryFn: () => getWalletPayProviders(method, publishableKey),
|
|
74593
74725
|
enabled,
|
|
@@ -74853,7 +74985,7 @@ function useAddressValidation({
|
|
|
74853
74985
|
refetchOnMount = false
|
|
74854
74986
|
}) {
|
|
74855
74987
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
74856
|
-
const { data, isLoading, error } = (0,
|
|
74988
|
+
const { data, isLoading, error } = (0, import_react_query16.useQuery)({
|
|
74857
74989
|
queryKey: [
|
|
74858
74990
|
"unifold",
|
|
74859
74991
|
"addressValidation",
|
|
@@ -76256,7 +76388,7 @@ function useHypercoreActivation(params) {
|
|
|
76256
76388
|
const recipient = recipientAddress?.trim() ?? "";
|
|
76257
76389
|
const source = sourceAddress?.trim() ?? "";
|
|
76258
76390
|
const hasAddresses = !!recipient && !!source;
|
|
76259
|
-
const { data, isLoading } = (0,
|
|
76391
|
+
const { data, isLoading } = (0, import_react_query17.useQuery)({
|
|
76260
76392
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
76261
76393
|
queryFn: () => checkHypercoreActivation(
|
|
76262
76394
|
{
|
|
@@ -78035,7 +78167,7 @@ function useDepositQuote(params) {
|
|
|
78035
78167
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
78036
78168
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
78037
78169
|
};
|
|
78038
|
-
return (0,
|
|
78170
|
+
return (0, import_react_query18.useQuery)({
|
|
78039
78171
|
queryKey: [
|
|
78040
78172
|
"unifold",
|
|
78041
78173
|
"depositQuote",
|
|
@@ -78065,7 +78197,7 @@ function useExternalWallets({
|
|
|
78065
78197
|
publishableKey,
|
|
78066
78198
|
enabled = true
|
|
78067
78199
|
}) {
|
|
78068
|
-
const { data: wallets = [], isLoading } = (0,
|
|
78200
|
+
const { data: wallets = [], isLoading } = (0, import_react_query19.useQuery)({
|
|
78069
78201
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
78070
78202
|
queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
|
|
78071
78203
|
enabled: enabled && !!publishableKey,
|
|
@@ -80198,7 +80330,11 @@ function WalletConnect({
|
|
|
80198
80330
|
chain: String(token.chain_id),
|
|
80199
80331
|
network: token.network,
|
|
80200
80332
|
token: token.symbol ?? token.token_address,
|
|
80201
|
-
currency: token.currency
|
|
80333
|
+
currency: token.currency,
|
|
80334
|
+
// No execution exists yet — it's created when this send lands on the
|
|
80335
|
+
// wallet. The wallet id is what that execution will carry, so it's
|
|
80336
|
+
// how a send that never completes is matched to what followed.
|
|
80337
|
+
deposit_wallet_id: activeDepositWallet?.id
|
|
80202
80338
|
});
|
|
80203
80339
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
80204
80340
|
setHasSignedTransaction(true);
|
|
@@ -80785,7 +80921,7 @@ function DepositModal({
|
|
|
80785
80921
|
const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
|
|
80786
80922
|
const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
|
|
80787
80923
|
const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
|
|
80788
|
-
const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
|
|
80924
|
+
const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
|
|
80789
80925
|
const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
|
|
80790
80926
|
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
80791
80927
|
[prefilledAmountUsd]
|
|
@@ -80793,6 +80929,7 @@ function DepositModal({
|
|
|
80793
80929
|
const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
|
|
80794
80930
|
const journeyActiveRef = (0, import_react3.useRef)(false);
|
|
80795
80931
|
const journeySessionIdRef = (0, import_react3.useRef)(void 0);
|
|
80932
|
+
const journeyExternalUserIdRef = (0, import_react3.useRef)(void 0);
|
|
80796
80933
|
const externalUserId = userId || void 0;
|
|
80797
80934
|
const emitEvent = (0, import_react3.useCallback)(
|
|
80798
80935
|
(event) => onEvent?.({ ...event, externalUserId }),
|
|
@@ -80820,6 +80957,9 @@ function DepositModal({
|
|
|
80820
80957
|
method: analyticsMethod(method),
|
|
80821
80958
|
flow_type: "deposit",
|
|
80822
80959
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
80960
|
+
// The one high-cardinality field we do send: the join key from a
|
|
80961
|
+
// funnel session back to the execution row it produced.
|
|
80962
|
+
execution_id: data.executionId ?? execution?.id,
|
|
80823
80963
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns
|
|
80824
80964
|
// (precise/opaque fields like base units, addresses, tx hashes live in
|
|
80825
80965
|
// the onEvent DirectExecution instead).
|
|
@@ -80847,6 +80987,7 @@ function DepositModal({
|
|
|
80847
80987
|
method: analyticsMethod(method),
|
|
80848
80988
|
flow_type: "deposit",
|
|
80849
80989
|
error_code: error.code,
|
|
80990
|
+
execution_id: execution?.id,
|
|
80850
80991
|
failure_reason: execution?.failureReason ?? void 0,
|
|
80851
80992
|
status: execution?.status,
|
|
80852
80993
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -81275,8 +81416,10 @@ function DepositModal({
|
|
|
81275
81416
|
const beginJourney = (0, import_react3.useCallback)(() => {
|
|
81276
81417
|
journeySessionIdRef.current = startSession();
|
|
81277
81418
|
journeyActiveRef.current = true;
|
|
81419
|
+
journeyExternalUserIdRef.current = userId;
|
|
81420
|
+
setUserId(null);
|
|
81278
81421
|
track("widget_opened", { flow_type: "deposit" });
|
|
81279
|
-
}, [startSession, track]);
|
|
81422
|
+
}, [startSession, track, setUserId, userId]);
|
|
81280
81423
|
const handleClose = () => {
|
|
81281
81424
|
finalizeJourney();
|
|
81282
81425
|
onOpenChange(false);
|
|
@@ -81301,6 +81444,11 @@ function DepositModal({
|
|
|
81301
81444
|
}
|
|
81302
81445
|
beginJourney();
|
|
81303
81446
|
}, [open]);
|
|
81447
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
81448
|
+
if (!open || journeyExternalUserIdRef.current === userId) return;
|
|
81449
|
+
journeyExternalUserIdRef.current = userId;
|
|
81450
|
+
setUserId(null);
|
|
81451
|
+
}, [open, userId, setUserId]);
|
|
81304
81452
|
(0, import_react3.useLayoutEffect)(() => {
|
|
81305
81453
|
if (!open) return;
|
|
81306
81454
|
if (resetViewTimeoutRef.current) {
|
|
@@ -82212,6 +82360,7 @@ function DepositModal({
|
|
|
82212
82360
|
destinationChainType,
|
|
82213
82361
|
destinationChainId,
|
|
82214
82362
|
destinationTokenAddress,
|
|
82363
|
+
contractCalls,
|
|
82215
82364
|
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
82216
82365
|
view: cashAppView,
|
|
82217
82366
|
onViewChange: setCashAppView,
|
|
@@ -82380,7 +82529,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
82380
82529
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
82381
82530
|
function usePaymentIntent(params) {
|
|
82382
82531
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
82383
|
-
return (0,
|
|
82532
|
+
return (0, import_react_query20.useQuery)({
|
|
82384
82533
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
82385
82534
|
queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
|
|
82386
82535
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
@@ -82547,6 +82696,9 @@ function CheckoutModal({
|
|
|
82547
82696
|
flowCompletedRef.current = true;
|
|
82548
82697
|
track("flow_completed", {
|
|
82549
82698
|
flow_type: "checkout",
|
|
82699
|
+
// Checkout has no direct execution; the intent is what a funnel
|
|
82700
|
+
// session joins back to.
|
|
82701
|
+
payment_intent_id: data.paymentIntentId,
|
|
82550
82702
|
...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
|
|
82551
82703
|
});
|
|
82552
82704
|
}
|
|
@@ -82767,7 +82919,7 @@ function CheckoutModal({
|
|
|
82767
82919
|
journeySessionIdRef.current = startSession();
|
|
82768
82920
|
journeyActiveRef.current = true;
|
|
82769
82921
|
flowCompletedRef.current = false;
|
|
82770
|
-
setUserId(null);
|
|
82922
|
+
setUserId(paymentIntentUserId ?? null);
|
|
82771
82923
|
track("widget_opened", { flow_type: "checkout" });
|
|
82772
82924
|
if (resetViewTimeoutRef.current) {
|
|
82773
82925
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -83207,7 +83359,7 @@ function CheckoutModal({
|
|
|
83207
83359
|
) }) });
|
|
83208
83360
|
}
|
|
83209
83361
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
83210
|
-
return (0,
|
|
83362
|
+
return (0, import_react_query21.useQuery)({
|
|
83211
83363
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
83212
83364
|
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
83213
83365
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -83245,7 +83397,7 @@ function useSourceTokenValidation(params) {
|
|
|
83245
83397
|
enabled = true
|
|
83246
83398
|
} = params;
|
|
83247
83399
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
83248
|
-
return (0,
|
|
83400
|
+
return (0, import_react_query22.useQuery)({
|
|
83249
83401
|
queryKey: [
|
|
83250
83402
|
"unifold",
|
|
83251
83403
|
"sourceTokenValidation",
|
|
@@ -83296,7 +83448,7 @@ function useSourceTokenValidation(params) {
|
|
|
83296
83448
|
function useAddressBalance(params) {
|
|
83297
83449
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
83298
83450
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
83299
|
-
return (0,
|
|
83451
|
+
return (0, import_react_query23.useQuery)({
|
|
83300
83452
|
queryKey: [
|
|
83301
83453
|
"unifold",
|
|
83302
83454
|
"addressBalance",
|
|
@@ -83352,7 +83504,7 @@ function useAddressBalance(params) {
|
|
|
83352
83504
|
}
|
|
83353
83505
|
function useExecutions(userId, publishableKey, options2) {
|
|
83354
83506
|
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
83355
|
-
|
|
83507
|
+
const query = (0, import_react_query24.useQuery)({
|
|
83356
83508
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
83357
83509
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
83358
83510
|
enabled: (options2?.enabled ?? true) && !!userId,
|
|
@@ -83361,6 +83513,8 @@ function useExecutions(userId, publishableKey, options2) {
|
|
|
83361
83513
|
gcTime: 1e3 * 60 * 5,
|
|
83362
83514
|
refetchOnWindowFocus: false
|
|
83363
83515
|
});
|
|
83516
|
+
useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
|
|
83517
|
+
return query;
|
|
83364
83518
|
}
|
|
83365
83519
|
var POLL_INTERVAL_MS4 = 2500;
|
|
83366
83520
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
@@ -83697,7 +83851,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
83697
83851
|
} = params;
|
|
83698
83852
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
83699
83853
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
83700
|
-
return (0,
|
|
83854
|
+
return (0, import_react_query25.useQuery)({
|
|
83701
83855
|
queryKey: [
|
|
83702
83856
|
"unifold",
|
|
83703
83857
|
"verifyRecipientAddress",
|
|
@@ -83735,9 +83889,8 @@ function useGetDepositAddress(params) {
|
|
|
83735
83889
|
actionType,
|
|
83736
83890
|
enabled = true
|
|
83737
83891
|
} = params;
|
|
83738
|
-
const { setUserId } = useAnalytics();
|
|
83739
83892
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
83740
|
-
const query = (0,
|
|
83893
|
+
const query = (0, import_react_query26.useQuery)({
|
|
83741
83894
|
queryKey: [
|
|
83742
83895
|
"unifold",
|
|
83743
83896
|
"getDepositAddress",
|
|
@@ -83767,11 +83920,7 @@ function useGetDepositAddress(params) {
|
|
|
83767
83920
|
refetchOnWindowFocus: false,
|
|
83768
83921
|
retry: 1
|
|
83769
83922
|
});
|
|
83770
|
-
(
|
|
83771
|
-
if (query.data?.user_id) {
|
|
83772
|
-
setUserId(query.data.user_id);
|
|
83773
|
-
}
|
|
83774
|
-
}, [query.data?.user_id, setUserId]);
|
|
83923
|
+
useStampInternalUserId({ internalUserId: query.data?.user_id });
|
|
83775
83924
|
return query;
|
|
83776
83925
|
}
|
|
83777
83926
|
var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
|
|
@@ -84721,9 +84870,9 @@ function WithdrawConfirmingView({
|
|
|
84721
84870
|
const { colors: colors2, fonts, components } = useTheme();
|
|
84722
84871
|
const { t: strings } = useI18n();
|
|
84723
84872
|
const t = strings.withdrawModal.details;
|
|
84724
|
-
const [showButton, setShowButton] = (0,
|
|
84873
|
+
const [showButton, setShowButton] = (0, import_react46.useState)(false);
|
|
84725
84874
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
84726
|
-
(0,
|
|
84875
|
+
(0, import_react46.useEffect)(() => {
|
|
84727
84876
|
if (latestExecution) return;
|
|
84728
84877
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
84729
84878
|
return () => clearTimeout(timer);
|
|
@@ -84892,12 +85041,16 @@ function WithdrawModal({
|
|
|
84892
85041
|
);
|
|
84893
85042
|
const journeyActiveRef = (0, import_react42.useRef)(false);
|
|
84894
85043
|
const journeySessionIdRef = (0, import_react42.useRef)(void 0);
|
|
85044
|
+
const journeyExternalUserIdRef = (0, import_react42.useRef)(void 0);
|
|
84895
85045
|
const onWithdrawSuccessFor = (0, import_react42.useCallback)(
|
|
84896
85046
|
(data) => {
|
|
84897
85047
|
const execution = data.execution?.data.object;
|
|
84898
85048
|
track("flow_completed", {
|
|
84899
85049
|
flow_type: "withdraw",
|
|
84900
85050
|
amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
|
|
85051
|
+
// The one high-cardinality field we do send: the join key from a
|
|
85052
|
+
// funnel session back to the execution row it produced.
|
|
85053
|
+
execution_id: data.executionId ?? execution?.id,
|
|
84901
85054
|
// Flat, low-cardinality execution dimensions for PostHog breakdowns.
|
|
84902
85055
|
status: execution?.status,
|
|
84903
85056
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -84918,6 +85071,7 @@ function WithdrawModal({
|
|
|
84918
85071
|
track("flow_failed", {
|
|
84919
85072
|
flow_type: "withdraw",
|
|
84920
85073
|
error_code: error.code,
|
|
85074
|
+
execution_id: execution?.id,
|
|
84921
85075
|
failure_reason: execution?.failureReason ?? void 0,
|
|
84922
85076
|
status: execution?.status,
|
|
84923
85077
|
source_chain_type: execution?.sourceChainType,
|
|
@@ -84991,6 +85145,7 @@ function WithdrawModal({
|
|
|
84991
85145
|
) ?? null : null;
|
|
84992
85146
|
const [view, setView] = (0, import_react42.useState)("form");
|
|
84993
85147
|
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react42.useState)();
|
|
85148
|
+
const withdrawDepositWalletIdRef = (0, import_react42.useRef)(void 0);
|
|
84994
85149
|
const [selectedExecution, setSelectedExecution] = (0, import_react42.useState)(null);
|
|
84995
85150
|
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react42.useState)(null);
|
|
84996
85151
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
@@ -85028,6 +85183,7 @@ function WithdrawModal({
|
|
|
85028
85183
|
if (!depositWallet) {
|
|
85029
85184
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
85030
85185
|
}
|
|
85186
|
+
withdrawDepositWalletIdRef.current = depositWallet.id;
|
|
85031
85187
|
setWithdrawDepositWalletId(depositWallet.id);
|
|
85032
85188
|
return depositWallet;
|
|
85033
85189
|
},
|
|
@@ -85047,7 +85203,12 @@ function WithdrawModal({
|
|
|
85047
85203
|
currency: tokenData?.currency,
|
|
85048
85204
|
amount: txInfo.amount,
|
|
85049
85205
|
amount_base_unit: txInfo.amountBaseUnit,
|
|
85050
|
-
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
|
|
85206
|
+
...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
|
|
85207
|
+
// The execution doesn't exist yet — it's created when the user's send
|
|
85208
|
+
// lands on the withdraw deposit wallet, and carries this id. So a
|
|
85209
|
+
// withdrawal confirmed but never completed still joins to whatever
|
|
85210
|
+
// did (or didn't) follow on that wallet.
|
|
85211
|
+
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
85051
85212
|
});
|
|
85052
85213
|
emitEvent({
|
|
85053
85214
|
id: generatePrefixedKSUID("sevt"),
|
|
@@ -85081,8 +85242,10 @@ function WithdrawModal({
|
|
|
85081
85242
|
const beginJourney = (0, import_react42.useCallback)(() => {
|
|
85082
85243
|
journeySessionIdRef.current = startSession();
|
|
85083
85244
|
journeyActiveRef.current = true;
|
|
85245
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85246
|
+
setUserId(null);
|
|
85084
85247
|
track("widget_opened", { flow_type: "withdraw" });
|
|
85085
|
-
}, [startSession, track]);
|
|
85248
|
+
}, [startSession, track, setUserId, externalUserId]);
|
|
85086
85249
|
const handleClose = (0, import_react42.useCallback)(() => {
|
|
85087
85250
|
finalizeJourney();
|
|
85088
85251
|
onOpenChange(false);
|
|
@@ -85091,6 +85254,7 @@ function WithdrawModal({
|
|
|
85091
85254
|
setView("form");
|
|
85092
85255
|
setSelectedExecution(null);
|
|
85093
85256
|
setSubmittedTxInfo(null);
|
|
85257
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85094
85258
|
setWithdrawDepositWalletId(void 0);
|
|
85095
85259
|
resetViewTimeoutRef.current = null;
|
|
85096
85260
|
}, 200);
|
|
@@ -85108,8 +85272,14 @@ function WithdrawModal({
|
|
|
85108
85272
|
setView("form");
|
|
85109
85273
|
setSelectedExecution(null);
|
|
85110
85274
|
setSubmittedTxInfo(null);
|
|
85275
|
+
withdrawDepositWalletIdRef.current = void 0;
|
|
85111
85276
|
setWithdrawDepositWalletId(void 0);
|
|
85112
85277
|
}, [open]);
|
|
85278
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
85279
|
+
if (!open || journeyExternalUserIdRef.current === externalUserId) return;
|
|
85280
|
+
journeyExternalUserIdRef.current = externalUserId;
|
|
85281
|
+
setUserId(null);
|
|
85282
|
+
}, [open, externalUserId, setUserId]);
|
|
85113
85283
|
(0, import_react42.useEffect)(
|
|
85114
85284
|
() => () => {
|
|
85115
85285
|
if (journeyActiveRef.current) {
|
|
@@ -85795,9 +85965,9 @@ function useUnifold2() {
|
|
|
85795
85965
|
}
|
|
85796
85966
|
|
|
85797
85967
|
// src/unifold.tsx
|
|
85798
|
-
var UnifoldBridge = (0,
|
|
85968
|
+
var UnifoldBridge = (0, import_react48.forwardRef)((_, ref) => {
|
|
85799
85969
|
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
85800
|
-
(0,
|
|
85970
|
+
(0, import_react48.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
85801
85971
|
beginDeposit,
|
|
85802
85972
|
closeDeposit,
|
|
85803
85973
|
beginWithdraw,
|
|
@@ -85806,7 +85976,7 @@ var UnifoldBridge = (0, import_react49.forwardRef)((_, ref) => {
|
|
|
85806
85976
|
return null;
|
|
85807
85977
|
});
|
|
85808
85978
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
85809
|
-
var RenderErrorBoundary = class extends
|
|
85979
|
+
var RenderErrorBoundary = class extends import_react48.Component {
|
|
85810
85980
|
constructor() {
|
|
85811
85981
|
super(...arguments);
|
|
85812
85982
|
this.state = { hasError: false };
|
|
@@ -85878,13 +86048,13 @@ function createUnifold(publishableKey, config) {
|
|
|
85878
86048
|
};
|
|
85879
86049
|
try {
|
|
85880
86050
|
root.render(
|
|
85881
|
-
|
|
86051
|
+
import_react48.default.createElement(
|
|
85882
86052
|
RenderErrorBoundary,
|
|
85883
86053
|
{ onError: handleRenderError },
|
|
85884
|
-
|
|
86054
|
+
import_react48.default.createElement(
|
|
85885
86055
|
UnifoldProvider2,
|
|
85886
86056
|
{ publishableKey, config },
|
|
85887
|
-
|
|
86057
|
+
import_react48.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
85888
86058
|
)
|
|
85889
86059
|
)
|
|
85890
86060
|
);
|