@unifold/ui-web 0.1.78 → 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 +50 -82
- package/dist/index.mjs +50 -82
- 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
|
}
|
|
@@ -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);
|
|
@@ -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,19 +41750,19 @@ 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
|
|
41765
|
+
var import_react_query26 = __toESM(require_modern2(), 1);
|
|
41786
41766
|
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
41787
41767
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
41788
41768
|
var import_react46 = __toESM(require_react(), 1);
|
|
@@ -47913,7 +47893,7 @@ function generateKSUID2() {
|
|
|
47913
47893
|
function generatePrefixedKSUID2(prefix) {
|
|
47914
47894
|
return `${prefix}_${generateKSUID2()}`;
|
|
47915
47895
|
}
|
|
47916
|
-
var PACKAGE_VERSION = "0.1.
|
|
47896
|
+
var PACKAGE_VERSION = "0.1.79";
|
|
47917
47897
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
47918
47898
|
var DEFAULT_DEDUP_MS = 500;
|
|
47919
47899
|
var SESSION_PREFIX = "asess";
|
|
@@ -62997,16 +62977,6 @@ function PayWithExchange({
|
|
|
62997
62977
|
}
|
|
62998
62978
|
);
|
|
62999
62979
|
}
|
|
63000
|
-
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
63001
|
-
return (0, import_react_query10.useQuery)({
|
|
63002
|
-
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
63003
|
-
queryFn: () => getCashAppLimits(currency, publishableKey),
|
|
63004
|
-
enabled: !!publishableKey,
|
|
63005
|
-
staleTime: 2 * 60 * 6e4,
|
|
63006
|
-
gcTime: 4 * 60 * 6e4,
|
|
63007
|
-
retry: 2
|
|
63008
|
-
});
|
|
63009
|
-
}
|
|
63010
62980
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
63011
62981
|
var FALLBACK_MIN_USD = 5;
|
|
63012
62982
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
@@ -63042,9 +63012,11 @@ function PayWithCashApp({
|
|
|
63042
63012
|
const b = parseInt(bg.slice(4, 6), 16);
|
|
63043
63013
|
return (r2 * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
63044
63014
|
})();
|
|
63045
|
-
const { data:
|
|
63046
|
-
|
|
63047
|
-
|
|
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);
|
|
63048
63020
|
const [amount, setAmount] = (0, import_react24.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
63049
63021
|
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
63050
63022
|
const [session, setSession] = (0, import_react24.useState)(null);
|
|
@@ -63099,6 +63071,8 @@ function PayWithCashApp({
|
|
|
63099
63071
|
setError(strings.depositModal.cashAppErrors.missingFields);
|
|
63100
63072
|
return;
|
|
63101
63073
|
}
|
|
63074
|
+
const amountNum2 = parseFloat(amount);
|
|
63075
|
+
if (isNaN(amountNum2) || amountNum2 < minUsd) return;
|
|
63102
63076
|
setLoading(true);
|
|
63103
63077
|
setError(null);
|
|
63104
63078
|
try {
|
|
@@ -63147,6 +63121,7 @@ function PayWithCashApp({
|
|
|
63147
63121
|
}
|
|
63148
63122
|
}, [
|
|
63149
63123
|
amount,
|
|
63124
|
+
minUsd,
|
|
63150
63125
|
userId,
|
|
63151
63126
|
publishableKey,
|
|
63152
63127
|
recipientAddress,
|
|
@@ -63250,8 +63225,7 @@ function PayWithCashApp({
|
|
|
63250
63225
|
const amountNum = parseFloat(amount);
|
|
63251
63226
|
const hasInput = !isNaN(amountNum) && amountNum > 0;
|
|
63252
63227
|
const belowMin = hasInput && amountNum < minUsd;
|
|
63253
|
-
const
|
|
63254
|
-
const isValidAmount = hasInput && !belowMin && !aboveMax;
|
|
63228
|
+
const isValidAmount = hasInput && !belowMin;
|
|
63255
63229
|
if (view === "amount") {
|
|
63256
63230
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63257
63231
|
"div",
|
|
@@ -63280,7 +63254,7 @@ function PayWithCashApp({
|
|
|
63280
63254
|
}
|
|
63281
63255
|
}
|
|
63282
63256
|
) }) }),
|
|
63283
|
-
/* @__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) => {
|
|
63284
63258
|
const isSelected = parseFloat(amount) === quickAmount;
|
|
63285
63259
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63286
63260
|
"button",
|
|
@@ -63306,23 +63280,17 @@ function PayWithCashApp({
|
|
|
63306
63280
|
quickAmount
|
|
63307
63281
|
);
|
|
63308
63282
|
}) }),
|
|
63309
|
-
|
|
63283
|
+
!limitsLoading && minUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63310
63284
|
"div",
|
|
63311
63285
|
{
|
|
63312
|
-
className: "uf-text-
|
|
63313
|
-
style: { color: colors2.
|
|
63314
|
-
children: interpolate(strings.common.
|
|
63315
|
-
|
|
63316
|
-
) : amount && maxUsd !== null && amountNum > maxUsd && !error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63317
|
-
"div",
|
|
63318
|
-
{
|
|
63319
|
-
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
63320
|
-
style: { color: colors2.error, fontFamily: fonts.regular },
|
|
63321
|
-
children: interpolate(strings.common.maximumAmount, {
|
|
63322
|
-
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)}`
|
|
63323
63290
|
})
|
|
63324
63291
|
}
|
|
63325
|
-
)
|
|
63292
|
+
),
|
|
63293
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63326
63294
|
"div",
|
|
63327
63295
|
{
|
|
63328
63296
|
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
@@ -63331,7 +63299,7 @@ function PayWithCashApp({
|
|
|
63331
63299
|
}
|
|
63332
63300
|
) : null
|
|
63333
63301
|
] }),
|
|
63334
|
-
/* @__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)(
|
|
63335
63303
|
"button",
|
|
63336
63304
|
{
|
|
63337
63305
|
onClick: handleCreateSession,
|
|
@@ -63552,7 +63520,7 @@ function useBankTransferProviders({
|
|
|
63552
63520
|
countryCode
|
|
63553
63521
|
}) {
|
|
63554
63522
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
63555
|
-
const { data: providers, isLoading } = (0,
|
|
63523
|
+
const { data: providers, isLoading } = (0, import_react_query10.useQuery)({
|
|
63556
63524
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
63557
63525
|
queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
|
|
63558
63526
|
enabled,
|
|
@@ -71906,7 +71874,7 @@ function useProjectConfig({
|
|
|
71906
71874
|
data: projectConfig,
|
|
71907
71875
|
isLoading,
|
|
71908
71876
|
error
|
|
71909
|
-
} = (0,
|
|
71877
|
+
} = (0, import_react_query11.useQuery)({
|
|
71910
71878
|
// Country is part of the key so a region change refetches the region-aware
|
|
71911
71879
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
71912
71880
|
// sharing the base cache entry.
|
|
@@ -71916,7 +71884,7 @@ function useProjectConfig({
|
|
|
71916
71884
|
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
71917
71885
|
// config refetches after the country resolves, so unrelated config-driven
|
|
71918
71886
|
// UI doesn't flash back to defaults.
|
|
71919
|
-
placeholderData:
|
|
71887
|
+
placeholderData: import_react_query11.keepPreviousData,
|
|
71920
71888
|
staleTime: 1e3 * 60 * 30,
|
|
71921
71889
|
refetchOnMount: true,
|
|
71922
71890
|
refetchOnWindowFocus: true
|
|
@@ -71928,7 +71896,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
71928
71896
|
publishableKey,
|
|
71929
71897
|
enabled = true
|
|
71930
71898
|
}) {
|
|
71931
|
-
return (0,
|
|
71899
|
+
return (0, import_react_query12.useQuery)({
|
|
71932
71900
|
queryKey: [
|
|
71933
71901
|
"unifold",
|
|
71934
71902
|
"integrationTransferDefaultToken",
|
|
@@ -74731,7 +74699,7 @@ function useExchanges({
|
|
|
74731
74699
|
publishableKey,
|
|
74732
74700
|
enabled = true
|
|
74733
74701
|
}) {
|
|
74734
|
-
const { data: exchanges = [], isLoading } = (0,
|
|
74702
|
+
const { data: exchanges = [], isLoading } = (0, import_react_query13.useQuery)({
|
|
74735
74703
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
74736
74704
|
queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
|
|
74737
74705
|
enabled,
|
|
@@ -74749,7 +74717,7 @@ function usePublicIncident({
|
|
|
74749
74717
|
data: incident,
|
|
74750
74718
|
isLoading,
|
|
74751
74719
|
error
|
|
74752
|
-
} = (0,
|
|
74720
|
+
} = (0, import_react_query14.useQuery)({
|
|
74753
74721
|
queryKey: ["unifold", "publicIncident", publishableKey],
|
|
74754
74722
|
queryFn: () => getPublicIncident(publishableKey),
|
|
74755
74723
|
enabled,
|
|
@@ -74764,7 +74732,7 @@ function useWalletPayProviders({
|
|
|
74764
74732
|
publishableKey,
|
|
74765
74733
|
enabled = true
|
|
74766
74734
|
}) {
|
|
74767
|
-
const { data: providers, isLoading } = (0,
|
|
74735
|
+
const { data: providers, isLoading } = (0, import_react_query15.useQuery)({
|
|
74768
74736
|
queryKey: ["unifold", "walletPayProviders", method, publishableKey],
|
|
74769
74737
|
queryFn: () => getWalletPayProviders(method, publishableKey),
|
|
74770
74738
|
enabled,
|
|
@@ -75030,7 +74998,7 @@ function useAddressValidation({
|
|
|
75030
74998
|
refetchOnMount = false
|
|
75031
74999
|
}) {
|
|
75032
75000
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
75033
|
-
const { data, isLoading, error } = (0,
|
|
75001
|
+
const { data, isLoading, error } = (0, import_react_query16.useQuery)({
|
|
75034
75002
|
queryKey: [
|
|
75035
75003
|
"unifold",
|
|
75036
75004
|
"addressValidation",
|
|
@@ -76433,7 +76401,7 @@ function useHypercoreActivation(params) {
|
|
|
76433
76401
|
const recipient = recipientAddress?.trim() ?? "";
|
|
76434
76402
|
const source = sourceAddress?.trim() ?? "";
|
|
76435
76403
|
const hasAddresses = !!recipient && !!source;
|
|
76436
|
-
const { data, isLoading } = (0,
|
|
76404
|
+
const { data, isLoading } = (0, import_react_query17.useQuery)({
|
|
76437
76405
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
76438
76406
|
queryFn: () => checkHypercoreActivation(
|
|
76439
76407
|
{
|
|
@@ -78212,7 +78180,7 @@ function useDepositQuote(params) {
|
|
|
78212
78180
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
78213
78181
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
78214
78182
|
};
|
|
78215
|
-
return (0,
|
|
78183
|
+
return (0, import_react_query18.useQuery)({
|
|
78216
78184
|
queryKey: [
|
|
78217
78185
|
"unifold",
|
|
78218
78186
|
"depositQuote",
|
|
@@ -78242,7 +78210,7 @@ function useExternalWallets({
|
|
|
78242
78210
|
publishableKey,
|
|
78243
78211
|
enabled = true
|
|
78244
78212
|
}) {
|
|
78245
|
-
const { data: wallets = [], isLoading } = (0,
|
|
78213
|
+
const { data: wallets = [], isLoading } = (0, import_react_query19.useQuery)({
|
|
78246
78214
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
78247
78215
|
queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
|
|
78248
78216
|
enabled: enabled && !!publishableKey,
|
|
@@ -82574,7 +82542,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
82574
82542
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
82575
82543
|
function usePaymentIntent(params) {
|
|
82576
82544
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
82577
|
-
return (0,
|
|
82545
|
+
return (0, import_react_query20.useQuery)({
|
|
82578
82546
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
82579
82547
|
queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
|
|
82580
82548
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
@@ -83404,7 +83372,7 @@ function CheckoutModal({
|
|
|
83404
83372
|
) }) });
|
|
83405
83373
|
}
|
|
83406
83374
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
83407
|
-
return (0,
|
|
83375
|
+
return (0, import_react_query21.useQuery)({
|
|
83408
83376
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
83409
83377
|
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
83410
83378
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -83442,7 +83410,7 @@ function useSourceTokenValidation(params) {
|
|
|
83442
83410
|
enabled = true
|
|
83443
83411
|
} = params;
|
|
83444
83412
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
83445
|
-
return (0,
|
|
83413
|
+
return (0, import_react_query22.useQuery)({
|
|
83446
83414
|
queryKey: [
|
|
83447
83415
|
"unifold",
|
|
83448
83416
|
"sourceTokenValidation",
|
|
@@ -83493,7 +83461,7 @@ function useSourceTokenValidation(params) {
|
|
|
83493
83461
|
function useAddressBalance(params) {
|
|
83494
83462
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
83495
83463
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
83496
|
-
return (0,
|
|
83464
|
+
return (0, import_react_query23.useQuery)({
|
|
83497
83465
|
queryKey: [
|
|
83498
83466
|
"unifold",
|
|
83499
83467
|
"addressBalance",
|
|
@@ -83549,7 +83517,7 @@ function useAddressBalance(params) {
|
|
|
83549
83517
|
}
|
|
83550
83518
|
function useExecutions(userId, publishableKey, options2) {
|
|
83551
83519
|
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
83552
|
-
const query = (0,
|
|
83520
|
+
const query = (0, import_react_query24.useQuery)({
|
|
83553
83521
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
83554
83522
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
83555
83523
|
enabled: (options2?.enabled ?? true) && !!userId,
|
|
@@ -83896,7 +83864,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
83896
83864
|
} = params;
|
|
83897
83865
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
83898
83866
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
83899
|
-
return (0,
|
|
83867
|
+
return (0, import_react_query25.useQuery)({
|
|
83900
83868
|
queryKey: [
|
|
83901
83869
|
"unifold",
|
|
83902
83870
|
"verifyRecipientAddress",
|
|
@@ -83935,7 +83903,7 @@ function useGetDepositAddress(params) {
|
|
|
83935
83903
|
enabled = true
|
|
83936
83904
|
} = params;
|
|
83937
83905
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
83938
|
-
const query = (0,
|
|
83906
|
+
const query = (0, import_react_query26.useQuery)({
|
|
83939
83907
|
queryKey: [
|
|
83940
83908
|
"unifold",
|
|
83941
83909
|
"getDepositAddress",
|
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
|
}
|
|
@@ -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);
|
|
@@ -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,19 +41737,19 @@ 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
|
|
41752
|
+
var import_react_query26 = __toESM(require_modern2(), 1);
|
|
41773
41753
|
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
41774
41754
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
41775
41755
|
var import_react46 = __toESM(require_react(), 1);
|
|
@@ -47900,7 +47880,7 @@ function generateKSUID2() {
|
|
|
47900
47880
|
function generatePrefixedKSUID2(prefix) {
|
|
47901
47881
|
return `${prefix}_${generateKSUID2()}`;
|
|
47902
47882
|
}
|
|
47903
|
-
var PACKAGE_VERSION = "0.1.
|
|
47883
|
+
var PACKAGE_VERSION = "0.1.79";
|
|
47904
47884
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
47905
47885
|
var DEFAULT_DEDUP_MS = 500;
|
|
47906
47886
|
var SESSION_PREFIX = "asess";
|
|
@@ -62984,16 +62964,6 @@ function PayWithExchange({
|
|
|
62984
62964
|
}
|
|
62985
62965
|
);
|
|
62986
62966
|
}
|
|
62987
|
-
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
62988
|
-
return (0, import_react_query10.useQuery)({
|
|
62989
|
-
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
62990
|
-
queryFn: () => getCashAppLimits(currency, publishableKey),
|
|
62991
|
-
enabled: !!publishableKey,
|
|
62992
|
-
staleTime: 2 * 60 * 6e4,
|
|
62993
|
-
gcTime: 4 * 60 * 6e4,
|
|
62994
|
-
retry: 2
|
|
62995
|
-
});
|
|
62996
|
-
}
|
|
62997
62967
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
62998
62968
|
var FALLBACK_MIN_USD = 5;
|
|
62999
62969
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
@@ -63029,9 +62999,11 @@ function PayWithCashApp({
|
|
|
63029
62999
|
const b = parseInt(bg.slice(4, 6), 16);
|
|
63030
63000
|
return (r2 * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
63031
63001
|
})();
|
|
63032
|
-
const { data:
|
|
63033
|
-
|
|
63034
|
-
|
|
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);
|
|
63035
63007
|
const [amount, setAmount] = (0, import_react24.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
63036
63008
|
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
63037
63009
|
const [session, setSession] = (0, import_react24.useState)(null);
|
|
@@ -63086,6 +63058,8 @@ function PayWithCashApp({
|
|
|
63086
63058
|
setError(strings.depositModal.cashAppErrors.missingFields);
|
|
63087
63059
|
return;
|
|
63088
63060
|
}
|
|
63061
|
+
const amountNum2 = parseFloat(amount);
|
|
63062
|
+
if (isNaN(amountNum2) || amountNum2 < minUsd) return;
|
|
63089
63063
|
setLoading(true);
|
|
63090
63064
|
setError(null);
|
|
63091
63065
|
try {
|
|
@@ -63134,6 +63108,7 @@ function PayWithCashApp({
|
|
|
63134
63108
|
}
|
|
63135
63109
|
}, [
|
|
63136
63110
|
amount,
|
|
63111
|
+
minUsd,
|
|
63137
63112
|
userId,
|
|
63138
63113
|
publishableKey,
|
|
63139
63114
|
recipientAddress,
|
|
@@ -63237,8 +63212,7 @@ function PayWithCashApp({
|
|
|
63237
63212
|
const amountNum = parseFloat(amount);
|
|
63238
63213
|
const hasInput = !isNaN(amountNum) && amountNum > 0;
|
|
63239
63214
|
const belowMin = hasInput && amountNum < minUsd;
|
|
63240
|
-
const
|
|
63241
|
-
const isValidAmount = hasInput && !belowMin && !aboveMax;
|
|
63215
|
+
const isValidAmount = hasInput && !belowMin;
|
|
63242
63216
|
if (view === "amount") {
|
|
63243
63217
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63244
63218
|
"div",
|
|
@@ -63267,7 +63241,7 @@ function PayWithCashApp({
|
|
|
63267
63241
|
}
|
|
63268
63242
|
}
|
|
63269
63243
|
) }) }),
|
|
63270
|
-
/* @__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) => {
|
|
63271
63245
|
const isSelected = parseFloat(amount) === quickAmount;
|
|
63272
63246
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
63273
63247
|
"button",
|
|
@@ -63293,23 +63267,17 @@ function PayWithCashApp({
|
|
|
63293
63267
|
quickAmount
|
|
63294
63268
|
);
|
|
63295
63269
|
}) }),
|
|
63296
|
-
|
|
63270
|
+
!limitsLoading && minUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63297
63271
|
"div",
|
|
63298
63272
|
{
|
|
63299
|
-
className: "uf-text-
|
|
63300
|
-
style: { color: colors2.
|
|
63301
|
-
children: interpolate(strings.common.
|
|
63302
|
-
|
|
63303
|
-
) : amount && maxUsd !== null && amountNum > maxUsd && !error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63304
|
-
"div",
|
|
63305
|
-
{
|
|
63306
|
-
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
63307
|
-
style: { color: colors2.error, fontFamily: fonts.regular },
|
|
63308
|
-
children: interpolate(strings.common.maximumAmount, {
|
|
63309
|
-
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)}`
|
|
63310
63277
|
})
|
|
63311
63278
|
}
|
|
63312
|
-
)
|
|
63279
|
+
),
|
|
63280
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
63313
63281
|
"div",
|
|
63314
63282
|
{
|
|
63315
63283
|
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
@@ -63318,7 +63286,7 @@ function PayWithCashApp({
|
|
|
63318
63286
|
}
|
|
63319
63287
|
) : null
|
|
63320
63288
|
] }),
|
|
63321
|
-
/* @__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)(
|
|
63322
63290
|
"button",
|
|
63323
63291
|
{
|
|
63324
63292
|
onClick: handleCreateSession,
|
|
@@ -63539,7 +63507,7 @@ function useBankTransferProviders({
|
|
|
63539
63507
|
countryCode
|
|
63540
63508
|
}) {
|
|
63541
63509
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
63542
|
-
const { data: providers, isLoading } = (0,
|
|
63510
|
+
const { data: providers, isLoading } = (0, import_react_query10.useQuery)({
|
|
63543
63511
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
63544
63512
|
queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
|
|
63545
63513
|
enabled,
|
|
@@ -71893,7 +71861,7 @@ function useProjectConfig({
|
|
|
71893
71861
|
data: projectConfig,
|
|
71894
71862
|
isLoading,
|
|
71895
71863
|
error
|
|
71896
|
-
} = (0,
|
|
71864
|
+
} = (0, import_react_query11.useQuery)({
|
|
71897
71865
|
// Country is part of the key so a region change refetches the region-aware
|
|
71898
71866
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
71899
71867
|
// sharing the base cache entry.
|
|
@@ -71903,7 +71871,7 @@ function useProjectConfig({
|
|
|
71903
71871
|
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
71904
71872
|
// config refetches after the country resolves, so unrelated config-driven
|
|
71905
71873
|
// UI doesn't flash back to defaults.
|
|
71906
|
-
placeholderData:
|
|
71874
|
+
placeholderData: import_react_query11.keepPreviousData,
|
|
71907
71875
|
staleTime: 1e3 * 60 * 30,
|
|
71908
71876
|
refetchOnMount: true,
|
|
71909
71877
|
refetchOnWindowFocus: true
|
|
@@ -71915,7 +71883,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
71915
71883
|
publishableKey,
|
|
71916
71884
|
enabled = true
|
|
71917
71885
|
}) {
|
|
71918
|
-
return (0,
|
|
71886
|
+
return (0, import_react_query12.useQuery)({
|
|
71919
71887
|
queryKey: [
|
|
71920
71888
|
"unifold",
|
|
71921
71889
|
"integrationTransferDefaultToken",
|
|
@@ -74718,7 +74686,7 @@ function useExchanges({
|
|
|
74718
74686
|
publishableKey,
|
|
74719
74687
|
enabled = true
|
|
74720
74688
|
}) {
|
|
74721
|
-
const { data: exchanges = [], isLoading } = (0,
|
|
74689
|
+
const { data: exchanges = [], isLoading } = (0, import_react_query13.useQuery)({
|
|
74722
74690
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
74723
74691
|
queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
|
|
74724
74692
|
enabled,
|
|
@@ -74736,7 +74704,7 @@ function usePublicIncident({
|
|
|
74736
74704
|
data: incident,
|
|
74737
74705
|
isLoading,
|
|
74738
74706
|
error
|
|
74739
|
-
} = (0,
|
|
74707
|
+
} = (0, import_react_query14.useQuery)({
|
|
74740
74708
|
queryKey: ["unifold", "publicIncident", publishableKey],
|
|
74741
74709
|
queryFn: () => getPublicIncident(publishableKey),
|
|
74742
74710
|
enabled,
|
|
@@ -74751,7 +74719,7 @@ function useWalletPayProviders({
|
|
|
74751
74719
|
publishableKey,
|
|
74752
74720
|
enabled = true
|
|
74753
74721
|
}) {
|
|
74754
|
-
const { data: providers, isLoading } = (0,
|
|
74722
|
+
const { data: providers, isLoading } = (0, import_react_query15.useQuery)({
|
|
74755
74723
|
queryKey: ["unifold", "walletPayProviders", method, publishableKey],
|
|
74756
74724
|
queryFn: () => getWalletPayProviders(method, publishableKey),
|
|
74757
74725
|
enabled,
|
|
@@ -75017,7 +74985,7 @@ function useAddressValidation({
|
|
|
75017
74985
|
refetchOnMount = false
|
|
75018
74986
|
}) {
|
|
75019
74987
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
75020
|
-
const { data, isLoading, error } = (0,
|
|
74988
|
+
const { data, isLoading, error } = (0, import_react_query16.useQuery)({
|
|
75021
74989
|
queryKey: [
|
|
75022
74990
|
"unifold",
|
|
75023
74991
|
"addressValidation",
|
|
@@ -76420,7 +76388,7 @@ function useHypercoreActivation(params) {
|
|
|
76420
76388
|
const recipient = recipientAddress?.trim() ?? "";
|
|
76421
76389
|
const source = sourceAddress?.trim() ?? "";
|
|
76422
76390
|
const hasAddresses = !!recipient && !!source;
|
|
76423
|
-
const { data, isLoading } = (0,
|
|
76391
|
+
const { data, isLoading } = (0, import_react_query17.useQuery)({
|
|
76424
76392
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
76425
76393
|
queryFn: () => checkHypercoreActivation(
|
|
76426
76394
|
{
|
|
@@ -78199,7 +78167,7 @@ function useDepositQuote(params) {
|
|
|
78199
78167
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
78200
78168
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
78201
78169
|
};
|
|
78202
|
-
return (0,
|
|
78170
|
+
return (0, import_react_query18.useQuery)({
|
|
78203
78171
|
queryKey: [
|
|
78204
78172
|
"unifold",
|
|
78205
78173
|
"depositQuote",
|
|
@@ -78229,7 +78197,7 @@ function useExternalWallets({
|
|
|
78229
78197
|
publishableKey,
|
|
78230
78198
|
enabled = true
|
|
78231
78199
|
}) {
|
|
78232
|
-
const { data: wallets = [], isLoading } = (0,
|
|
78200
|
+
const { data: wallets = [], isLoading } = (0, import_react_query19.useQuery)({
|
|
78233
78201
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
78234
78202
|
queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
|
|
78235
78203
|
enabled: enabled && !!publishableKey,
|
|
@@ -82561,7 +82529,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
82561
82529
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
82562
82530
|
function usePaymentIntent(params) {
|
|
82563
82531
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
82564
|
-
return (0,
|
|
82532
|
+
return (0, import_react_query20.useQuery)({
|
|
82565
82533
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
82566
82534
|
queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
|
|
82567
82535
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
@@ -83391,7 +83359,7 @@ function CheckoutModal({
|
|
|
83391
83359
|
) }) });
|
|
83392
83360
|
}
|
|
83393
83361
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
83394
|
-
return (0,
|
|
83362
|
+
return (0, import_react_query21.useQuery)({
|
|
83395
83363
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
83396
83364
|
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
83397
83365
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -83429,7 +83397,7 @@ function useSourceTokenValidation(params) {
|
|
|
83429
83397
|
enabled = true
|
|
83430
83398
|
} = params;
|
|
83431
83399
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
83432
|
-
return (0,
|
|
83400
|
+
return (0, import_react_query22.useQuery)({
|
|
83433
83401
|
queryKey: [
|
|
83434
83402
|
"unifold",
|
|
83435
83403
|
"sourceTokenValidation",
|
|
@@ -83480,7 +83448,7 @@ function useSourceTokenValidation(params) {
|
|
|
83480
83448
|
function useAddressBalance(params) {
|
|
83481
83449
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
83482
83450
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
83483
|
-
return (0,
|
|
83451
|
+
return (0, import_react_query23.useQuery)({
|
|
83484
83452
|
queryKey: [
|
|
83485
83453
|
"unifold",
|
|
83486
83454
|
"addressBalance",
|
|
@@ -83536,7 +83504,7 @@ function useAddressBalance(params) {
|
|
|
83536
83504
|
}
|
|
83537
83505
|
function useExecutions(userId, publishableKey, options2) {
|
|
83538
83506
|
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
83539
|
-
const query = (0,
|
|
83507
|
+
const query = (0, import_react_query24.useQuery)({
|
|
83540
83508
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
83541
83509
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
83542
83510
|
enabled: (options2?.enabled ?? true) && !!userId,
|
|
@@ -83883,7 +83851,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
83883
83851
|
} = params;
|
|
83884
83852
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
83885
83853
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
83886
|
-
return (0,
|
|
83854
|
+
return (0, import_react_query25.useQuery)({
|
|
83887
83855
|
queryKey: [
|
|
83888
83856
|
"unifold",
|
|
83889
83857
|
"verifyRecipientAddress",
|
|
@@ -83922,7 +83890,7 @@ function useGetDepositAddress(params) {
|
|
|
83922
83890
|
enabled = true
|
|
83923
83891
|
} = params;
|
|
83924
83892
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
83925
|
-
const query = (0,
|
|
83893
|
+
const query = (0, import_react_query26.useQuery)({
|
|
83926
83894
|
queryKey: [
|
|
83927
83895
|
"unifold",
|
|
83928
83896
|
"getDepositAddress",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.79",
|
|
4
4
|
"description": "Unifold UI Web - Framework-agnostic deposit widget",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"prettier": "^3.2.5",
|
|
45
45
|
"tsup": "^8.0.0",
|
|
46
46
|
"typescript": "^5.0.0",
|
|
47
|
-
"@unifold/
|
|
48
|
-
"@unifold/react
|
|
49
|
-
"@unifold/
|
|
50
|
-
"@unifold/
|
|
47
|
+
"@unifold/core": "0.1.79",
|
|
48
|
+
"@unifold/connect-react": "0.1.79",
|
|
49
|
+
"@unifold/ui-react": "0.1.79",
|
|
50
|
+
"@unifold/react-provider": "0.1.79"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"unifold",
|