@openrails/billing-ui 0.230.0 → 0.233.2
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/CHANGELOG.md +103 -9
- package/README.md +88 -39
- package/dist/account/account-billing.d.ts +3 -3
- package/dist/account/cancel-dialog.d.ts +2 -2
- package/dist/account/format.d.ts +4 -4
- package/dist/account/payment-methods-panel.d.ts +7 -9
- package/dist/account/section.d.ts +3 -1
- package/dist/checkout-page.d.ts +6 -1
- package/dist/client/client.d.ts +76 -62
- package/dist/client/generated/currencies.d.ts +1 -0
- package/dist/client/generated/error-codes.d.ts +7 -0
- package/dist/client/generated/routes.d.ts +775 -0
- package/dist/client/generated/wire.d.ts +682 -0
- package/dist/client/index.d.ts +3 -3
- package/dist/client/types.d.ts +425 -379
- package/dist/client-DXUPzA8C.js +889 -0
- package/dist/client-DXUPzA8C.js.map +1 -0
- package/dist/client.js +2 -3
- package/dist/components/methods.d.ts +3 -3
- package/dist/config-BQELtBh4.js +341 -0
- package/dist/config-BQELtBh4.js.map +1 -0
- package/dist/frame.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1447 -1539
- package/dist/index.js.map +1 -1
- package/dist/lib/billing.d.ts +14 -0
- package/dist/lib/money.d.ts +1 -0
- package/dist/lib/period.d.ts +0 -2
- package/dist/lib/rail-meta.d.ts +4 -4
- package/dist/locales/de.js +11 -8
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +8 -5
- package/dist/locales/en.js +11 -8
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +11 -8
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +11 -8
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +11 -8
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +11 -8
- package/dist/locales/zh.js.map +1 -1
- package/dist/psp.d.ts +10 -21
- package/dist/react/config.d.ts +34 -0
- package/dist/react/context.d.ts +5 -8
- package/dist/react/hooks.d.ts +20 -14
- package/dist/react/index.d.ts +1 -0
- package/dist/react/provider.d.ts +1 -9
- package/dist/react/remote.d.ts +0 -1
- package/dist/react.js +24 -28
- package/dist/react.js.map +1 -1
- package/dist/save-payment-method.d.ts +1 -1
- package/dist/source.d.ts +0 -9
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +114 -55
- package/docs/payment-form-contract.md +23 -40
- package/package.json +3 -3
- package/dist/client/generated/openrails-routes.d.ts +0 -2
- package/dist/client-DhG2jv34.js +0 -771
- package/dist/client-DhG2jv34.js.map +0 -1
- package/dist/errors-T-PRm3vV.js +0 -54
- package/dist/errors-T-PRm3vV.js.map +0 -1
- package/dist/hooks-DLFF-zx5.js +0 -285
- package/dist/hooks-DLFF-zx5.js.map +0 -1
- package/docs/1055-nmi-host-integration.md +0 -28
|
@@ -0,0 +1,889 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
//#region src/lib/money.ts
|
|
3
|
+
var t = -(1n << 63n), n = (1n << 63n) - 1n;
|
|
4
|
+
function r(e) {
|
|
5
|
+
if (typeof e != "string" || !/^-?\d{1,19}$/.test(e)) return null;
|
|
6
|
+
let r = BigInt(e);
|
|
7
|
+
return r < t || r > n ? null : r;
|
|
8
|
+
}
|
|
9
|
+
function i(e) {
|
|
10
|
+
return r(e) !== null;
|
|
11
|
+
}
|
|
12
|
+
function a(e) {
|
|
13
|
+
return typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= 18;
|
|
14
|
+
}
|
|
15
|
+
function o(...e) {
|
|
16
|
+
let i = 0n;
|
|
17
|
+
for (let t of e) {
|
|
18
|
+
let e = r(t);
|
|
19
|
+
if (e === null) return null;
|
|
20
|
+
i += e;
|
|
21
|
+
}
|
|
22
|
+
return i < t || i > n ? null : i.toString();
|
|
23
|
+
}
|
|
24
|
+
var s = (() => {
|
|
25
|
+
try {
|
|
26
|
+
return new Intl.NumberFormat("en", { useGrouping: !1 }).format("9007199254740993") === "9007199254740993";
|
|
27
|
+
} catch {
|
|
28
|
+
return !1;
|
|
29
|
+
}
|
|
30
|
+
})(), c = 10n ** 15n;
|
|
31
|
+
function l(e, t) {
|
|
32
|
+
let n = e < 0n ? -e : e, r = 10n ** BigInt(t), i = (n % r).toString().padStart(t, "0").replace(/0+$/, "");
|
|
33
|
+
return `${e < 0n ? "-" : ""}${n / r}${i ? `.${i}` : ""}`;
|
|
34
|
+
}
|
|
35
|
+
function u(e, t) {
|
|
36
|
+
let n = r(e);
|
|
37
|
+
return n === null || !a(t) ? null : l(n, t);
|
|
38
|
+
}
|
|
39
|
+
function d(e, r) {
|
|
40
|
+
if (!a(r) || e.length > 40) return null;
|
|
41
|
+
let i = /^(-?)(\d+)(?:\.(\d+))?$/.exec(e);
|
|
42
|
+
if (!i) return null;
|
|
43
|
+
let o = i[3] ?? "";
|
|
44
|
+
if (o.length > r) return null;
|
|
45
|
+
let s = BigInt(i[2]) * 10n ** BigInt(r) + BigInt(o.padEnd(r, "0") || "0"), c = i[1] ? -s : s;
|
|
46
|
+
return c < t || c > n ? null : c.toString();
|
|
47
|
+
}
|
|
48
|
+
function f(e, t, n, i) {
|
|
49
|
+
let o = t.trim().toUpperCase(), u = r(e);
|
|
50
|
+
if (u === null || !a(n)) return `${o} amount exceeds the exact display range`;
|
|
51
|
+
if (!s && (u >= c || u <= -c)) return `${o} amount exceeds this browser's exact display range`;
|
|
52
|
+
let d = l(u, n);
|
|
53
|
+
try {
|
|
54
|
+
return new Intl.NumberFormat(i, {
|
|
55
|
+
style: "currency",
|
|
56
|
+
currency: o,
|
|
57
|
+
maximumFractionDigits: n
|
|
58
|
+
}).format(d);
|
|
59
|
+
} catch {
|
|
60
|
+
return `${d} ${o}`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/types.ts
|
|
65
|
+
var p = (e) => e.nullish().transform((e) => e ?? void 0).optional(), m = e.string().refine(i, "amount must be an int64 decimal string"), h = e.number().refine(a, "unit_decimals must be an integer from 0 to 18"), ee = e.string().url().refine((e) => {
|
|
66
|
+
try {
|
|
67
|
+
let t = new URL(e);
|
|
68
|
+
return t.protocol === "https:" && !t.username && !t.password;
|
|
69
|
+
} catch {
|
|
70
|
+
return !1;
|
|
71
|
+
}
|
|
72
|
+
}, "redirect URL must be HTTPS"), te = e.string().url().refine((e) => {
|
|
73
|
+
try {
|
|
74
|
+
let t = new URL(e);
|
|
75
|
+
return (t.protocol === "https:" || t.protocol === "http:") && !t.username && !t.password;
|
|
76
|
+
} catch {
|
|
77
|
+
return !1;
|
|
78
|
+
}
|
|
79
|
+
}, "return URL must be HTTP(S)"), g = e.enum([
|
|
80
|
+
"created",
|
|
81
|
+
"requires_action",
|
|
82
|
+
"processing",
|
|
83
|
+
"succeeded",
|
|
84
|
+
"failed",
|
|
85
|
+
"blocked",
|
|
86
|
+
"expired",
|
|
87
|
+
"canceled"
|
|
88
|
+
]), _ = e.object({
|
|
89
|
+
reason: e.string(),
|
|
90
|
+
message: e.string(),
|
|
91
|
+
field: e.string().nullish()
|
|
92
|
+
}), v = e.object({
|
|
93
|
+
id: e.string(),
|
|
94
|
+
status: e.string()
|
|
95
|
+
}), y = e.object({
|
|
96
|
+
id: e.string().min(1),
|
|
97
|
+
psp_id: p(e.string()),
|
|
98
|
+
rail: e.string(),
|
|
99
|
+
mode: e.enum(["one_off", "subscription"]),
|
|
100
|
+
driver: e.enum([
|
|
101
|
+
"collect_js",
|
|
102
|
+
"card",
|
|
103
|
+
"stripe_elements",
|
|
104
|
+
"redirect",
|
|
105
|
+
"solana_pay"
|
|
106
|
+
]),
|
|
107
|
+
psp_key: p(e.string()),
|
|
108
|
+
public_config: p(e.record(e.string(), e.string()))
|
|
109
|
+
}), b = e.discriminatedUnion("type", [e.object({
|
|
110
|
+
type: e.literal("redirect_to_url"),
|
|
111
|
+
url: ee
|
|
112
|
+
}), e.object({
|
|
113
|
+
type: e.literal("solana_pay"),
|
|
114
|
+
url: e.string().startsWith("solana:")
|
|
115
|
+
})]), x = e.object({
|
|
116
|
+
id: e.string(),
|
|
117
|
+
option_id: e.string(),
|
|
118
|
+
rail: e.string(),
|
|
119
|
+
card: e.object({
|
|
120
|
+
brand: e.string().nullish(),
|
|
121
|
+
last4: e.string().nullish(),
|
|
122
|
+
exp_month: e.number().nullish(),
|
|
123
|
+
exp_year: e.number().nullish()
|
|
124
|
+
}).nullish()
|
|
125
|
+
}), S = e.object({
|
|
126
|
+
label: e.string(),
|
|
127
|
+
sublabel: p(e.string()),
|
|
128
|
+
amount: m
|
|
129
|
+
}), C = e.object({
|
|
130
|
+
auto_renew: e.boolean(),
|
|
131
|
+
display_name: e.string(),
|
|
132
|
+
unit_amount: m,
|
|
133
|
+
currency: e.string().min(1),
|
|
134
|
+
unit_decimals: h,
|
|
135
|
+
billing_interval_hours: p(e.number()),
|
|
136
|
+
access_duration_hours: p(e.number())
|
|
137
|
+
}), w = e.object({
|
|
138
|
+
id: e.string(),
|
|
139
|
+
status: g,
|
|
140
|
+
merchant: e.object({ display_name: e.string() }),
|
|
141
|
+
plan: C,
|
|
142
|
+
line_items: p(e.array(S)),
|
|
143
|
+
tax: p(m),
|
|
144
|
+
due_today: p(m),
|
|
145
|
+
options: e.array(y),
|
|
146
|
+
saved_methods: p(e.array(x)),
|
|
147
|
+
next_action: b.nullish(),
|
|
148
|
+
payment_id: p(e.string()),
|
|
149
|
+
subscription_id: p(e.string()),
|
|
150
|
+
failure_message: p(e.string()),
|
|
151
|
+
failure: _.nullish(),
|
|
152
|
+
operation: v.nullish(),
|
|
153
|
+
success_url: p(te),
|
|
154
|
+
embed_origin: p(e.string().url()),
|
|
155
|
+
expires_at: p(e.string())
|
|
156
|
+
}), ne = e.object({
|
|
157
|
+
option_id: e.string(),
|
|
158
|
+
payment_token: e.string().optional(),
|
|
159
|
+
payment_method_id: e.string().optional(),
|
|
160
|
+
card: e.object({
|
|
161
|
+
number: e.string(),
|
|
162
|
+
exp_month: e.number(),
|
|
163
|
+
exp_year: e.number(),
|
|
164
|
+
cvc: e.string()
|
|
165
|
+
}).optional(),
|
|
166
|
+
billing_details: e.object({
|
|
167
|
+
name: e.string().optional(),
|
|
168
|
+
email: e.string().optional(),
|
|
169
|
+
phone: e.string().optional(),
|
|
170
|
+
address: e.object({
|
|
171
|
+
line1: e.string().optional(),
|
|
172
|
+
line2: e.string().optional(),
|
|
173
|
+
city: e.string().optional(),
|
|
174
|
+
state: e.string().optional(),
|
|
175
|
+
postal_code: e.string().optional(),
|
|
176
|
+
country: e.string().optional()
|
|
177
|
+
}).optional()
|
|
178
|
+
}).optional(),
|
|
179
|
+
token_symbol: e.string().optional()
|
|
180
|
+
}), T = e.object({
|
|
181
|
+
status: g,
|
|
182
|
+
next_action: b.nullish(),
|
|
183
|
+
operation: v.nullish(),
|
|
184
|
+
payment_id: p(e.string()),
|
|
185
|
+
subscription_id: p(e.string()),
|
|
186
|
+
failure_message: p(e.string()),
|
|
187
|
+
failure: _.nullish()
|
|
188
|
+
}), E = class extends Error {
|
|
189
|
+
status;
|
|
190
|
+
type;
|
|
191
|
+
code;
|
|
192
|
+
param;
|
|
193
|
+
requestId;
|
|
194
|
+
metadata;
|
|
195
|
+
constructor(e, t) {
|
|
196
|
+
super(t.message), this.name = "BillingError", this.status = e, this.type = t.type, this.code = t.code, this.param = t.param, this.requestId = t.request_id, this.metadata = t.metadata ?? {};
|
|
197
|
+
}
|
|
198
|
+
}, D = (e) => e instanceof E, re = (e) => {
|
|
199
|
+
let t = e?.status;
|
|
200
|
+
return typeof t == "number" && t >= 500 && t < 600;
|
|
201
|
+
};
|
|
202
|
+
function O(e, t) {
|
|
203
|
+
return new E(0, {
|
|
204
|
+
type: "local",
|
|
205
|
+
code: e,
|
|
206
|
+
message: t
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
async function k(e) {
|
|
210
|
+
let t;
|
|
211
|
+
try {
|
|
212
|
+
t = await e.json();
|
|
213
|
+
} catch {
|
|
214
|
+
t = void 0;
|
|
215
|
+
}
|
|
216
|
+
let n = t?.error;
|
|
217
|
+
if (n && typeof n == "object") {
|
|
218
|
+
let t = n;
|
|
219
|
+
if (typeof t.code == "string" && t.code) return new E(e.status, {
|
|
220
|
+
type: typeof t.type == "string" ? t.type : "",
|
|
221
|
+
code: t.code,
|
|
222
|
+
message: typeof t.message == "string" ? t.message : t.code,
|
|
223
|
+
request_id: typeof t.request_id == "string" ? t.request_id : e.headers.get("X-Request-ID") ?? void 0,
|
|
224
|
+
param: typeof t.param == "string" ? t.param : void 0,
|
|
225
|
+
metadata: t.metadata && typeof t.metadata == "object" ? t.metadata : void 0
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return new E(e.status, {
|
|
229
|
+
type: e.status >= 500 ? "api_error" : "",
|
|
230
|
+
code: typeof n == "string" && n ? n : e.status >= 500 ? "server_error" : "unknown_error",
|
|
231
|
+
message: `HTTP ${e.status}`
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function ie(e) {
|
|
235
|
+
return e instanceof E ? e : e instanceof TypeError ? O("network_error", e.message) : O("unknown_error", e instanceof Error ? e.message : String(e));
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/client/generated/currencies.ts
|
|
239
|
+
var A = {
|
|
240
|
+
AED: 6,
|
|
241
|
+
AUD: 6,
|
|
242
|
+
BRL: 6,
|
|
243
|
+
CAD: 6,
|
|
244
|
+
CHF: 6,
|
|
245
|
+
CNY: 6,
|
|
246
|
+
CZK: 6,
|
|
247
|
+
DKK: 6,
|
|
248
|
+
EUR: 6,
|
|
249
|
+
GBP: 6,
|
|
250
|
+
HKD: 6,
|
|
251
|
+
ILS: 6,
|
|
252
|
+
INR: 6,
|
|
253
|
+
JPY: 4,
|
|
254
|
+
KRW: 4,
|
|
255
|
+
MXN: 6,
|
|
256
|
+
MYR: 6,
|
|
257
|
+
NOK: 6,
|
|
258
|
+
NZD: 6,
|
|
259
|
+
PHP: 6,
|
|
260
|
+
PLN: 6,
|
|
261
|
+
PYUSD: 6,
|
|
262
|
+
SAR: 6,
|
|
263
|
+
SEK: 6,
|
|
264
|
+
SGD: 6,
|
|
265
|
+
SOL: 9,
|
|
266
|
+
THB: 6,
|
|
267
|
+
TRY: 6,
|
|
268
|
+
USD: 6,
|
|
269
|
+
USD1: 6,
|
|
270
|
+
USDC: 6,
|
|
271
|
+
USDG: 6,
|
|
272
|
+
USDT: 6,
|
|
273
|
+
ZAR: 6
|
|
274
|
+
}, j = e.object({
|
|
275
|
+
psp_id: e.string().min(1),
|
|
276
|
+
key: e.string().min(1),
|
|
277
|
+
rail: e.string(),
|
|
278
|
+
custodian: e.string(),
|
|
279
|
+
display_name: e.string(),
|
|
280
|
+
flow: e.string(),
|
|
281
|
+
config: e.record(e.string(), e.string()).nullish(),
|
|
282
|
+
checkout: e.boolean().nullish(),
|
|
283
|
+
status: e.string().nullish(),
|
|
284
|
+
retry_after: e.number().int().nullish()
|
|
285
|
+
}), ae = /* @__PURE__ */ new Set([
|
|
286
|
+
"collect_js",
|
|
287
|
+
"card",
|
|
288
|
+
"stripe_elements"
|
|
289
|
+
]), M = (e) => ae.has(e.driver), oe = (e) => e.filter((e) => e.checkout !== !1), se = /* @__PURE__ */ new Set([
|
|
290
|
+
"tokenize",
|
|
291
|
+
"card",
|
|
292
|
+
"elements"
|
|
293
|
+
]);
|
|
294
|
+
function ce(e) {
|
|
295
|
+
let t = e.filter((e) => !!e.status && e.custodian === "psp" && se.has(e.flow)).map((e) => e.retry_after ?? 30);
|
|
296
|
+
return t.length > 0 ? Math.min(...t) : null;
|
|
297
|
+
}
|
|
298
|
+
function le(e, t) {
|
|
299
|
+
return [...e].sort((e, t) => (t.created_at ?? "").localeCompare(e.created_at ?? "")).flatMap((e) => {
|
|
300
|
+
let n = t.find((t) => (t.psp_id ?? t.id) === e.psp_id && M(t));
|
|
301
|
+
return !n || e.health?.active === !1 ? [] : [{
|
|
302
|
+
id: e.id,
|
|
303
|
+
option_id: n.id,
|
|
304
|
+
rail: n.rail,
|
|
305
|
+
card: e.card ?? null
|
|
306
|
+
}];
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
var ue = (e) => !!e && !e.startsWith("preview_"), de = (e) => e.rail === "stripe" && !!e.config?.publishable_key?.startsWith("pk_");
|
|
310
|
+
function N(e) {
|
|
311
|
+
return e.custodian !== "psp" || e.status ? null : e.flow === "card" && e.rail === "nmi" ? "card" : e.flow === "tokenize" && ue(e.config?.tokenization_key) && e.config?.tokenization_url ? "collect_js" : de(e) ? "stripe_elements" : null;
|
|
312
|
+
}
|
|
313
|
+
var fe = (e) => N(e) !== null, pe = (e) => N(e) === "stripe_elements";
|
|
314
|
+
function me(e) {
|
|
315
|
+
return {
|
|
316
|
+
psp_id: e.psp_id ?? e.id,
|
|
317
|
+
key: e.psp_key ?? e.rail,
|
|
318
|
+
rail: e.rail,
|
|
319
|
+
custodian: "psp",
|
|
320
|
+
display_name: "",
|
|
321
|
+
flow: e.driver === "stripe_elements" ? "elements" : e.driver === "card" ? "card" : "tokenize",
|
|
322
|
+
config: e.public_config ?? null
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/client/types.ts
|
|
327
|
+
var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(), he = (t) => e.object({
|
|
328
|
+
data: e.array(t).nullish().transform((e) => e ?? []),
|
|
329
|
+
total: e.number().nullish(),
|
|
330
|
+
limit: e.number().nullish(),
|
|
331
|
+
offset: e.number().nullish(),
|
|
332
|
+
has_more: e.boolean().nullish(),
|
|
333
|
+
next_cursor: e.string().nullish()
|
|
334
|
+
}), I = (t) => e.object({
|
|
335
|
+
data: e.array(t).nullish().transform((e) => e ?? []),
|
|
336
|
+
next_cursor: e.string().nullish().transform((e) => e ?? null)
|
|
337
|
+
}), L = e.string(), R = e.object({
|
|
338
|
+
status: e.string(),
|
|
339
|
+
ids: e.record(e.string(), e.string()).nullish(),
|
|
340
|
+
sync_status: e.string().nullish()
|
|
341
|
+
}), z = e.object({
|
|
342
|
+
id: e.string(),
|
|
343
|
+
key: e.string(),
|
|
344
|
+
revision: e.number().int().nonnegative().optional(),
|
|
345
|
+
product_id: e.string(),
|
|
346
|
+
archived: e.boolean(),
|
|
347
|
+
unit_amount: P,
|
|
348
|
+
customer_amount: e.object({
|
|
349
|
+
min_amount: P,
|
|
350
|
+
max_amount: P
|
|
351
|
+
}).nullish(),
|
|
352
|
+
currency: e.string(),
|
|
353
|
+
access_duration_hours: e.number().nullable(),
|
|
354
|
+
billing_interval_hours: e.number().nullable(),
|
|
355
|
+
trial_unit_amount: P.nullable(),
|
|
356
|
+
trial_duration_hours: e.number().nullable(),
|
|
357
|
+
psps: e.record(e.string(), R).nullish(),
|
|
358
|
+
created_at: F,
|
|
359
|
+
updated_at: F
|
|
360
|
+
}), B = e.object({
|
|
361
|
+
id: e.string(),
|
|
362
|
+
key: e.string().nullish(),
|
|
363
|
+
revision: e.number().int().nonnegative().optional(),
|
|
364
|
+
display_name: e.string().nullish(),
|
|
365
|
+
description: e.string().nullish(),
|
|
366
|
+
tier_group: e.string().nullish(),
|
|
367
|
+
tier_rank: e.number().nullish()
|
|
368
|
+
}), V = e.object({
|
|
369
|
+
brand: e.string().nullish(),
|
|
370
|
+
last4: e.string().nullish(),
|
|
371
|
+
exp_month: e.number().nullish(),
|
|
372
|
+
exp_year: e.number().nullish()
|
|
373
|
+
}), ge = e.object({
|
|
374
|
+
id: e.string(),
|
|
375
|
+
status: e.string()
|
|
376
|
+
}), H = e.object({
|
|
377
|
+
last_failure_reason: e.string().nullish(),
|
|
378
|
+
retryable: e.boolean(),
|
|
379
|
+
blocked_reason: e.string().nullish(),
|
|
380
|
+
operation: ge.nullish()
|
|
381
|
+
}), U = e.object({
|
|
382
|
+
type: e.string(),
|
|
383
|
+
redirect_to_url: e.object({ url: e.string().nullish() }).nullish(),
|
|
384
|
+
transactions: e.array(e.string()).nullish()
|
|
385
|
+
}), W = e.object({
|
|
386
|
+
id: e.string(),
|
|
387
|
+
status: L,
|
|
388
|
+
rail: e.string().nullish(),
|
|
389
|
+
product_id: e.string().nullish(),
|
|
390
|
+
price_id: e.string().nullish(),
|
|
391
|
+
psp_id: e.string().nullish(),
|
|
392
|
+
payment_method_id: e.string().nullish(),
|
|
393
|
+
started_at: F.nullish(),
|
|
394
|
+
ended_at: F.nullish(),
|
|
395
|
+
current_period_starts_at: F.nullish(),
|
|
396
|
+
current_period_ends_at: F.nullish(),
|
|
397
|
+
canceled_at: F.nullish(),
|
|
398
|
+
cancel_type: e.string().nullish(),
|
|
399
|
+
resumable: e.boolean().nullish(),
|
|
400
|
+
cancel_scheduled: e.boolean().nullish(),
|
|
401
|
+
cancel_mode: e.string().nullish(),
|
|
402
|
+
cancel_portal_url: e.string().nullish(),
|
|
403
|
+
access: e.object({
|
|
404
|
+
starts_at: F,
|
|
405
|
+
ends_at: F.nullish()
|
|
406
|
+
}).nullish(),
|
|
407
|
+
grace_ends_at: F.nullish(),
|
|
408
|
+
next_retry_at: F.nullish(),
|
|
409
|
+
price: z.nullish(),
|
|
410
|
+
product: B.nullish(),
|
|
411
|
+
scheduled_price: z.nullish(),
|
|
412
|
+
scheduled_product: B.nullish(),
|
|
413
|
+
card: V.nullish(),
|
|
414
|
+
recovery: H.nullish(),
|
|
415
|
+
next_action: U.nullish(),
|
|
416
|
+
created_at: F.nullish(),
|
|
417
|
+
updated_at: F.nullish()
|
|
418
|
+
}), _e = e.object({
|
|
419
|
+
name: e.string().nullish(),
|
|
420
|
+
email: e.string().nullish(),
|
|
421
|
+
phone: e.string().nullish(),
|
|
422
|
+
address: e.object({
|
|
423
|
+
line1: e.string().nullish(),
|
|
424
|
+
line2: e.string().nullish(),
|
|
425
|
+
city: e.string().nullish(),
|
|
426
|
+
state: e.string().nullish(),
|
|
427
|
+
postal_code: e.string().nullish(),
|
|
428
|
+
country: e.string().nullish()
|
|
429
|
+
}).nullish()
|
|
430
|
+
}), G = e.object({
|
|
431
|
+
id: e.string(),
|
|
432
|
+
rail: e.string().nullish(),
|
|
433
|
+
psp_id: e.string().nullish(),
|
|
434
|
+
card: V.nullish(),
|
|
435
|
+
billing_details: _e.nullish(),
|
|
436
|
+
health: e.object({
|
|
437
|
+
expiry_status: e.string().nullish(),
|
|
438
|
+
last_charged_at: F.nullish(),
|
|
439
|
+
last_charge_outcome: e.string().nullish(),
|
|
440
|
+
active: e.boolean().nullish()
|
|
441
|
+
}).nullish(),
|
|
442
|
+
subscriptions: e.array(e.object({
|
|
443
|
+
id: e.string(),
|
|
444
|
+
display_name: e.string().nullish()
|
|
445
|
+
})).nullish(),
|
|
446
|
+
collection_currencies: e.array(e.string()).nullish(),
|
|
447
|
+
created_at: F.nullish()
|
|
448
|
+
}), ve = e.object({
|
|
449
|
+
id: e.string(),
|
|
450
|
+
key: e.string(),
|
|
451
|
+
revision: e.number().int().nonnegative().optional(),
|
|
452
|
+
display_name: e.string(),
|
|
453
|
+
description: e.string(),
|
|
454
|
+
entitlements: e.array(e.string()),
|
|
455
|
+
credit_grant: e.object({
|
|
456
|
+
currency: e.string(),
|
|
457
|
+
amount: P.nullish(),
|
|
458
|
+
from_payment: e.boolean().optional(),
|
|
459
|
+
expires_after_days: e.number().int().positive().nullish()
|
|
460
|
+
}).nullish(),
|
|
461
|
+
tier_group: e.string().nullable(),
|
|
462
|
+
tier_rank: e.number(),
|
|
463
|
+
archived: e.boolean(),
|
|
464
|
+
prices: e.array(z).nullish().transform((e) => e ?? []),
|
|
465
|
+
created_at: F,
|
|
466
|
+
updated_at: F
|
|
467
|
+
}), ye = e.object({
|
|
468
|
+
id: e.string(),
|
|
469
|
+
kind: e.string(),
|
|
470
|
+
status: e.string(),
|
|
471
|
+
amount: P,
|
|
472
|
+
amount_refunded: P.nullish(),
|
|
473
|
+
currency: e.string(),
|
|
474
|
+
subscription_id: e.string().nullish(),
|
|
475
|
+
price_id: e.string().nullish(),
|
|
476
|
+
channel: e.string().nullish(),
|
|
477
|
+
rail: e.string().nullish(),
|
|
478
|
+
created_at: F,
|
|
479
|
+
price: z.nullish(),
|
|
480
|
+
product: B.nullish(),
|
|
481
|
+
card: V.nullish(),
|
|
482
|
+
failure: e.object({
|
|
483
|
+
reason: e.string(),
|
|
484
|
+
message: e.string(),
|
|
485
|
+
field: e.string().nullish()
|
|
486
|
+
}).nullish()
|
|
487
|
+
}), K = e.object({
|
|
488
|
+
id: e.string(),
|
|
489
|
+
currency: e.string(),
|
|
490
|
+
invoice_number: e.string().nullish(),
|
|
491
|
+
period_starts_at: F,
|
|
492
|
+
period_ends_at: F,
|
|
493
|
+
total_amount: P,
|
|
494
|
+
amount_paid: P,
|
|
495
|
+
amount_due: P,
|
|
496
|
+
status: e.string(),
|
|
497
|
+
issued_at: F.nullish(),
|
|
498
|
+
due_at: F.nullish(),
|
|
499
|
+
paid_at: F.nullish(),
|
|
500
|
+
recovery: H.nullish(),
|
|
501
|
+
created_at: F
|
|
502
|
+
}), be = e.object({
|
|
503
|
+
code: e.string(),
|
|
504
|
+
decimals: e.number(),
|
|
505
|
+
minor_decimals: e.number().nullish()
|
|
506
|
+
}), xe = e.object({
|
|
507
|
+
action: e.string(),
|
|
508
|
+
price_id: e.string(),
|
|
509
|
+
rail: e.string().nullish(),
|
|
510
|
+
currency: e.string(),
|
|
511
|
+
amount_due_now: P,
|
|
512
|
+
next_charge_amount: P,
|
|
513
|
+
next_charge_date: F.nullish(),
|
|
514
|
+
effective: e.string(),
|
|
515
|
+
is_estimate: e.boolean().nullish(),
|
|
516
|
+
message: e.string().nullish()
|
|
517
|
+
}), Se = e.object({
|
|
518
|
+
status: e.string(),
|
|
519
|
+
action: e.string().nullish(),
|
|
520
|
+
effective: e.string().nullish(),
|
|
521
|
+
price_id: e.string().nullish(),
|
|
522
|
+
subscription_id: e.string().nullish(),
|
|
523
|
+
next_action: U.nullish(),
|
|
524
|
+
delayed_start: F.nullish(),
|
|
525
|
+
currency: e.string().nullish(),
|
|
526
|
+
amount_due_now: P.nullish(),
|
|
527
|
+
next_charge_amount: P.nullish(),
|
|
528
|
+
next_charge_date: F.nullish(),
|
|
529
|
+
message: e.string().nullish(),
|
|
530
|
+
operation_id: e.string().nullish()
|
|
531
|
+
}), q = e.string().regex(/^\d+$/, "units must be a uint64 string"), Ce = e.object({
|
|
532
|
+
symbol: e.string(),
|
|
533
|
+
name: e.string().nullish(),
|
|
534
|
+
mint: e.string(),
|
|
535
|
+
decimals: e.number(),
|
|
536
|
+
price: e.string().nullish(),
|
|
537
|
+
preferred: e.boolean().nullish(),
|
|
538
|
+
recurring_eligible: e.boolean().nullish(),
|
|
539
|
+
quote: e.object({
|
|
540
|
+
amount: e.string(),
|
|
541
|
+
units: q,
|
|
542
|
+
token_price_usd: e.string().nullish(),
|
|
543
|
+
fx_rate: e.string().nullish(),
|
|
544
|
+
fx_currency: e.string().nullish(),
|
|
545
|
+
quoted_at: F.nullish(),
|
|
546
|
+
expires_at: F.nullish()
|
|
547
|
+
}).nullish(),
|
|
548
|
+
balance: e.object({
|
|
549
|
+
amount: e.string(),
|
|
550
|
+
units: q,
|
|
551
|
+
sufficient: e.boolean().nullish()
|
|
552
|
+
}).nullish()
|
|
553
|
+
}), we = e.object({ tokens: e.array(Ce).nullish().transform((e) => e ?? []) }), Te = e.object({
|
|
554
|
+
psps: e.array(j).nullish().transform((e) => e ?? []),
|
|
555
|
+
solana: e.object({
|
|
556
|
+
network: e.string(),
|
|
557
|
+
chain: e.string(),
|
|
558
|
+
preferred_token: e.string().nullish(),
|
|
559
|
+
tokens: e.array(e.object({
|
|
560
|
+
symbol: e.string(),
|
|
561
|
+
name: e.string().nullish(),
|
|
562
|
+
mint: e.string(),
|
|
563
|
+
decimals: e.number().int(),
|
|
564
|
+
preferred: e.boolean().nullish(),
|
|
565
|
+
recurring_eligible: e.boolean().nullish()
|
|
566
|
+
})).nullish().transform((e) => e ?? [])
|
|
567
|
+
}).nullish()
|
|
568
|
+
}), Ee = e.object({
|
|
569
|
+
capabilities: e.object({
|
|
570
|
+
route_groups: e.record(e.string(), e.boolean()),
|
|
571
|
+
features: e.record(e.string(), e.boolean())
|
|
572
|
+
}),
|
|
573
|
+
currencies: e.array(be).nullish().transform((e) => e ?? []),
|
|
574
|
+
payment: Te.nullish()
|
|
575
|
+
}), J = e.object({
|
|
576
|
+
id: e.string(),
|
|
577
|
+
status: e.string(),
|
|
578
|
+
client_secret: e.string().nullish(),
|
|
579
|
+
payment_method_id: e.string().nullish()
|
|
580
|
+
}), De = e.object({ client_secret: e.string().nullish() }), Oe = e.object({
|
|
581
|
+
id: e.string().startsWith("ocs_"),
|
|
582
|
+
url: e.string().url().nullish(),
|
|
583
|
+
expires_at: F
|
|
584
|
+
}), Y = class extends Error {
|
|
585
|
+
constructor(e = "The wallet request was declined.") {
|
|
586
|
+
super(e), this.name = "WalletRejectedError";
|
|
587
|
+
}
|
|
588
|
+
}, ke = 4, Ae = 500, X = (e) => e?.type === "solana_sign_transactions" && !!e.transactions?.length;
|
|
589
|
+
async function je(e, t) {
|
|
590
|
+
let n = "";
|
|
591
|
+
for (let r of e.transactions ?? []) {
|
|
592
|
+
try {
|
|
593
|
+
n = await t(r);
|
|
594
|
+
} catch (e) {
|
|
595
|
+
throw $(e) ? O("wallet_rejected", "The wallet request was declined.") : e;
|
|
596
|
+
}
|
|
597
|
+
if (!n) throw O("wallet_no_signature", "The wallet returned no signature.");
|
|
598
|
+
}
|
|
599
|
+
if (!n) throw O("wallet_no_signature", "The wallet returned no signature.");
|
|
600
|
+
return n;
|
|
601
|
+
}
|
|
602
|
+
var Me = 2e3, Z = 300;
|
|
603
|
+
function Ne(e) {
|
|
604
|
+
let t = Pe(e.headers.get("Retry-After"));
|
|
605
|
+
switch (e.status) {
|
|
606
|
+
case 429: return t;
|
|
607
|
+
case 503: return t ?? Z;
|
|
608
|
+
case 502:
|
|
609
|
+
case 504: return Z;
|
|
610
|
+
default: return null;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
function Pe(e) {
|
|
614
|
+
if (!e) return null;
|
|
615
|
+
if (/^\d+$/.test(e.trim())) return Number(e.trim()) * 1e3;
|
|
616
|
+
let t = Date.parse(e);
|
|
617
|
+
return Number.isNaN(t) ? null : Math.max(0, t - Date.now());
|
|
618
|
+
}
|
|
619
|
+
function Q(e, t) {
|
|
620
|
+
return new Promise((n, r) => {
|
|
621
|
+
if (t?.aborted) return r(t.reason);
|
|
622
|
+
let i = setTimeout(() => {
|
|
623
|
+
t?.removeEventListener("abort", a), n(e);
|
|
624
|
+
}, e), a = () => {
|
|
625
|
+
clearTimeout(i), r(t?.reason);
|
|
626
|
+
};
|
|
627
|
+
t?.addEventListener("abort", a, { once: !0 });
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function Fe(e = {}) {
|
|
631
|
+
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), n = e.fetch ?? ((e, t) => fetch(e, t)), r = Ie({
|
|
632
|
+
...A,
|
|
633
|
+
...e.currencies
|
|
634
|
+
});
|
|
635
|
+
function i(e, n, r = t) {
|
|
636
|
+
let i = new URLSearchParams();
|
|
637
|
+
for (let [e, t] of Object.entries(n ?? {})) t !== void 0 && t !== "" && i.set(e, String(t));
|
|
638
|
+
let a = i.toString();
|
|
639
|
+
return `${r}${e}${a ? `?${a}` : ""}`;
|
|
640
|
+
}
|
|
641
|
+
async function a(t, r = {}) {
|
|
642
|
+
let a = new Headers({
|
|
643
|
+
Accept: "application/json",
|
|
644
|
+
...r.headers
|
|
645
|
+
});
|
|
646
|
+
r.body !== void 0 && a.set("Content-Type", "application/json");
|
|
647
|
+
let o = r.anonymous ? void 0 : await e.getToken?.();
|
|
648
|
+
o && a.set("Authorization", `Bearer ${o}`);
|
|
649
|
+
let s = e.language?.();
|
|
650
|
+
s && a.set("Accept-Language", s);
|
|
651
|
+
let c = r.method ?? "GET", l = {
|
|
652
|
+
method: c,
|
|
653
|
+
headers: a,
|
|
654
|
+
body: r.body === void 0 ? void 0 : JSON.stringify(r.body),
|
|
655
|
+
signal: r.signal
|
|
656
|
+
}, u = +(c === "GET"), d = 0;
|
|
657
|
+
for (let e = 0;; e++) {
|
|
658
|
+
let a;
|
|
659
|
+
try {
|
|
660
|
+
a = await n(i(t, r.query, r.root), l);
|
|
661
|
+
} catch (t) {
|
|
662
|
+
let n = Z;
|
|
663
|
+
if (e >= u || r.signal?.aborted || !(t instanceof TypeError) || d + n > 2e3) throw t;
|
|
664
|
+
d += await Q(n, r.signal);
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
if (a.ok) return a;
|
|
668
|
+
let o = Ne(a);
|
|
669
|
+
if (e >= u || o === null || d + o > 2e3) throw await k(a);
|
|
670
|
+
await a.body?.cancel().catch(() => void 0), d += await Q(o, r.signal);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
async function o(e, t, n) {
|
|
674
|
+
let r = await a(t, n), i;
|
|
675
|
+
try {
|
|
676
|
+
i = await r.json();
|
|
677
|
+
} catch {
|
|
678
|
+
throw O("invalid_response", `${t}: body is not JSON`);
|
|
679
|
+
}
|
|
680
|
+
let o = e.safeParse(i);
|
|
681
|
+
if (!o.success) throw O("invalid_response", `${t}: ${o.error.issues[0]?.path.join(".")} ${o.error.issues[0]?.message}`);
|
|
682
|
+
return o.data;
|
|
683
|
+
}
|
|
684
|
+
let s = (e) => encodeURIComponent(e), c = I(W), l = I(G), u = I(ye), d = I(K), f = (e, t) => ({
|
|
685
|
+
limit: e.limit ?? t,
|
|
686
|
+
cursor: e.cursor ?? void 0
|
|
687
|
+
}), p = he(ve);
|
|
688
|
+
return {
|
|
689
|
+
baseUrl: t,
|
|
690
|
+
listSubscriptions(e = {}) {
|
|
691
|
+
return o(c, "/me/subscriptions", {
|
|
692
|
+
query: {
|
|
693
|
+
status: e.status ?? "all",
|
|
694
|
+
...f(e, 100)
|
|
695
|
+
},
|
|
696
|
+
signal: e.signal
|
|
697
|
+
});
|
|
698
|
+
},
|
|
699
|
+
getSubscription(e, t) {
|
|
700
|
+
return o(W, `/me/subscriptions/${s(e)}`, { signal: t });
|
|
701
|
+
},
|
|
702
|
+
cancelSubscription(e, t) {
|
|
703
|
+
return o(W, `/me/subscriptions/${s(e)}/cancel`, {
|
|
704
|
+
method: "POST",
|
|
705
|
+
body: {
|
|
706
|
+
reason: t.reason.trim(),
|
|
707
|
+
signature: t.signature
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
},
|
|
711
|
+
resumeSubscription(e) {
|
|
712
|
+
return o(W, `/me/subscriptions/${s(e)}/resume`, {
|
|
713
|
+
method: "POST",
|
|
714
|
+
body: {}
|
|
715
|
+
});
|
|
716
|
+
},
|
|
717
|
+
setSubscriptionPaymentMethod(e, t) {
|
|
718
|
+
return o(W, `/me/subscriptions/${s(e)}/payment-method`, {
|
|
719
|
+
method: "PUT",
|
|
720
|
+
body: { payment_method_id: t }
|
|
721
|
+
});
|
|
722
|
+
},
|
|
723
|
+
previewTierChange(e, t, n) {
|
|
724
|
+
return o(xe, `/me/subscriptions/${s(e)}/change-tier/preview`, {
|
|
725
|
+
method: "POST",
|
|
726
|
+
body: { price_id: t },
|
|
727
|
+
signal: n
|
|
728
|
+
});
|
|
729
|
+
},
|
|
730
|
+
changeTier(e, t) {
|
|
731
|
+
return o(Se, `/me/subscriptions/${s(e)}/change-tier`, {
|
|
732
|
+
method: "POST",
|
|
733
|
+
body: {
|
|
734
|
+
price_id: t.priceId,
|
|
735
|
+
signature: t.signature
|
|
736
|
+
},
|
|
737
|
+
headers: { "Idempotency-Key": t.idempotencyKey }
|
|
738
|
+
});
|
|
739
|
+
},
|
|
740
|
+
listPaymentMethods(e = {}) {
|
|
741
|
+
return o(l, "/me/payment-methods", {
|
|
742
|
+
query: f(e, 100),
|
|
743
|
+
signal: e.signal
|
|
744
|
+
});
|
|
745
|
+
},
|
|
746
|
+
addPaymentMethod(e) {
|
|
747
|
+
return o(G, "/me/payment-methods", {
|
|
748
|
+
method: "POST",
|
|
749
|
+
body: e
|
|
750
|
+
});
|
|
751
|
+
},
|
|
752
|
+
createCardSetup(e) {
|
|
753
|
+
return o(J, "/me/payment-method-setups", {
|
|
754
|
+
method: "POST",
|
|
755
|
+
body: {
|
|
756
|
+
psp_id: e.pspId,
|
|
757
|
+
consent: !0
|
|
758
|
+
},
|
|
759
|
+
headers: { "Idempotency-Key": e.idempotencyKey }
|
|
760
|
+
});
|
|
761
|
+
},
|
|
762
|
+
getCardSetup(e, t) {
|
|
763
|
+
return o(J, `/me/payment-method-setups/${s(e)}`, { signal: t });
|
|
764
|
+
},
|
|
765
|
+
confirmCardSetup(e) {
|
|
766
|
+
return o(J, `/me/payment-method-setups/${s(e)}/confirm`, {
|
|
767
|
+
method: "POST",
|
|
768
|
+
body: {}
|
|
769
|
+
});
|
|
770
|
+
},
|
|
771
|
+
getPaymentAuthentication(e) {
|
|
772
|
+
return o(De, `/me/payment-operations/${s(e)}/authentication`);
|
|
773
|
+
},
|
|
774
|
+
async confirmPaymentAuthentication(e) {
|
|
775
|
+
await a(`/me/payment-operations/${s(e)}/authentication/confirm`, {
|
|
776
|
+
method: "POST",
|
|
777
|
+
body: {}
|
|
778
|
+
});
|
|
779
|
+
},
|
|
780
|
+
async removePaymentMethod(e) {
|
|
781
|
+
return (await a(`/me/payment-methods/${s(e)}`, { method: "DELETE" })).status === 202 ? "pending" : "removed";
|
|
782
|
+
},
|
|
783
|
+
async setCollectionPaymentMethod(e) {
|
|
784
|
+
await a("/me/collection-payment-method", {
|
|
785
|
+
method: "PUT",
|
|
786
|
+
body: {
|
|
787
|
+
currency: e.currency.toUpperCase(),
|
|
788
|
+
payment_method_id: e.paymentMethodId
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
},
|
|
792
|
+
listPayments(e = {}) {
|
|
793
|
+
return o(u, "/me/payments", {
|
|
794
|
+
query: {
|
|
795
|
+
...f(e, 20),
|
|
796
|
+
rail: e.rail
|
|
797
|
+
},
|
|
798
|
+
signal: e.signal
|
|
799
|
+
});
|
|
800
|
+
},
|
|
801
|
+
listInvoices(e = {}) {
|
|
802
|
+
return o(d, "/me/invoices", {
|
|
803
|
+
query: f(e, 20),
|
|
804
|
+
signal: e.signal
|
|
805
|
+
});
|
|
806
|
+
},
|
|
807
|
+
getInvoice(e, t) {
|
|
808
|
+
return o(K, `/me/invoices/${s(e)}`, { signal: t });
|
|
809
|
+
},
|
|
810
|
+
listProducts(e = {}) {
|
|
811
|
+
return o(p, "/catalog/products", {
|
|
812
|
+
query: {
|
|
813
|
+
limit: e.limit ?? 100,
|
|
814
|
+
cursor: e.cursor
|
|
815
|
+
},
|
|
816
|
+
signal: e.signal
|
|
817
|
+
});
|
|
818
|
+
},
|
|
819
|
+
createCheckoutSession(e) {
|
|
820
|
+
return !e.priceKey == !e.priceId || !!e.priceKey != !!e.productKey ? Promise.reject(O("invalid_request", "Pass priceId, or both productKey and priceKey.")) : o(Oe, "/me/checkout-sessions", {
|
|
821
|
+
method: "POST",
|
|
822
|
+
body: {
|
|
823
|
+
price_key: e.priceKey,
|
|
824
|
+
product_key: e.productKey,
|
|
825
|
+
price_id: e.priceId,
|
|
826
|
+
auto_renew: e.autoRenew,
|
|
827
|
+
amount: e.amount,
|
|
828
|
+
success_url: e.successUrl
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
},
|
|
832
|
+
checkoutSource(e, t = {}) {
|
|
833
|
+
let n = `/checkout-sessions/${s(e)}`, r = t.customerBase?.replace(/\/+$/, ""), i = r === void 0 ? { anonymous: !0 } : { root: r };
|
|
834
|
+
return {
|
|
835
|
+
getSession: () => o(w, n, i),
|
|
836
|
+
async pay(e) {
|
|
837
|
+
try {
|
|
838
|
+
return await o(T, `${n}/pay`, {
|
|
839
|
+
...i,
|
|
840
|
+
method: "POST",
|
|
841
|
+
body: e
|
|
842
|
+
});
|
|
843
|
+
} catch (e) {
|
|
844
|
+
if (!D(e)) throw e;
|
|
845
|
+
switch (e.status) {
|
|
846
|
+
case 404:
|
|
847
|
+
case 410: return { status: "expired" };
|
|
848
|
+
case 403: return {
|
|
849
|
+
status: "blocked",
|
|
850
|
+
failure_message: e.message
|
|
851
|
+
};
|
|
852
|
+
case 422:
|
|
853
|
+
case 429: return {
|
|
854
|
+
status: "failed",
|
|
855
|
+
failure_message: e.message
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
throw e;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
},
|
|
863
|
+
getConfig(e) {
|
|
864
|
+
return o(Ee, "/config", {
|
|
865
|
+
signal: e,
|
|
866
|
+
anonymous: !0
|
|
867
|
+
});
|
|
868
|
+
},
|
|
869
|
+
async listSolanaTokens(e = {}) {
|
|
870
|
+
let { tokens: t } = await o(we, "/solana/tokens", {
|
|
871
|
+
query: {
|
|
872
|
+
price_id: e.priceId,
|
|
873
|
+
wallet: e.wallet
|
|
874
|
+
},
|
|
875
|
+
signal: e.signal
|
|
876
|
+
});
|
|
877
|
+
return t;
|
|
878
|
+
},
|
|
879
|
+
currencies: r
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
function Ie(e) {
|
|
883
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e.toUpperCase(), t]));
|
|
884
|
+
}
|
|
885
|
+
var $ = (e) => e instanceof Y || e instanceof Error && e.name === "WalletRejectedError" || e instanceof E && e.code === "wallet_rejected";
|
|
886
|
+
//#endregion
|
|
887
|
+
export { ne as A, i as B, ie as C, w as D, C as E, h as F, o as I, u as L, _ as M, y as N, g as O, x as P, d as R, k as S, S as T, le as _, Fe as a, re as b, je as c, ce as d, N as f, me as g, j as h, Y as i, T as j, b as k, pe as l, M as m, ke as n, X as o, oe as p, Me as r, $ as s, Ae as t, fe as u, E as v, m as w, O as x, D as y, f as z };
|
|
888
|
+
|
|
889
|
+
//# sourceMappingURL=client-DXUPzA8C.js.map
|