@openrails/billing-ui 0.235.0 → 0.236.0
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 -0
- package/README.md +103 -73
- package/dist/account/account-billing.d.ts +1 -3
- package/dist/account/payment-methods-panel.d.ts +1 -3
- package/dist/buy-button.d.ts +35 -0
- package/dist/cart.d.ts +18 -0
- package/dist/checkout.d.ts +1 -3
- package/dist/client/checkout.d.ts +28 -0
- package/dist/client/client.d.ts +71 -47
- package/dist/client/errors.d.ts +4 -0
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +117 -88
- package/dist/client/generated/wire.d.ts +88 -66
- package/dist/client/index.d.ts +2 -2
- package/dist/client/types.d.ts +230 -17
- package/dist/{client-BpzCZes3.js → client-BuvolBPT.js} +477 -316
- package/dist/client-BuvolBPT.js.map +1 -0
- package/dist/client.js +2 -2
- package/dist/components/stripe-card.d.ts +8 -2
- package/dist/components/stripe-wallets.d.ts +12 -0
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/frame.d.ts +5 -5
- package/dist/hooks-2d-XjpuI.js +526 -0
- package/dist/hooks-2d-XjpuI.js.map +1 -0
- package/dist/i18n/context.d.ts +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +1966 -1655
- package/dist/index.js.map +1 -1
- package/dist/lib/money.d.ts +1 -0
- package/dist/lib/offer-label.d.ts +4 -0
- package/dist/locales/de.js +20 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +20 -0
- package/dist/locales/en.js +20 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +20 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +11 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +11 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +11 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/offers.d.ts +33 -0
- package/dist/order-checkout.d.ts +30 -0
- package/dist/react/hooks.d.ts +8 -7
- package/dist/react/index.d.ts +1 -1
- package/dist/react/provider.d.ts +24 -2
- package/dist/react.js +2 -33
- package/dist/save-payment-method.d.ts +0 -6
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +16 -16
- package/docs/payment-form-contract.md +6 -6
- package/package.json +1 -1
- package/dist/client-BpzCZes3.js.map +0 -1
- package/dist/config-qLcHvK0Q.js +0 -341
- package/dist/config-qLcHvK0Q.js.map +0 -1
- package/dist/provider.d.ts +0 -18
- package/dist/react.js.map +0 -1
|
@@ -1,68 +1,87 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
//#region src/
|
|
3
|
-
var t =
|
|
2
|
+
//#region src/client/checkout.ts
|
|
3
|
+
var t = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function n(e, n) {
|
|
5
|
+
t.set(e, n);
|
|
6
|
+
}
|
|
4
7
|
function r(e) {
|
|
8
|
+
let n = t.get(e);
|
|
9
|
+
if (!n) throw Error("billing-ui: the client must come from createBillingClient");
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/lib/money.ts
|
|
14
|
+
var i = -(1n << 63n), a = (1n << 63n) - 1n;
|
|
15
|
+
function o(e) {
|
|
5
16
|
if (typeof e != "string" || !/^-?\d{1,19}$/.test(e)) return null;
|
|
6
|
-
let
|
|
7
|
-
return
|
|
17
|
+
let t = BigInt(e);
|
|
18
|
+
return t < i || t > a ? null : t;
|
|
8
19
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
20
|
+
function s(e) {
|
|
21
|
+
return o(e) !== null;
|
|
11
22
|
}
|
|
12
|
-
function
|
|
23
|
+
function c(e) {
|
|
13
24
|
return typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= 18;
|
|
14
25
|
}
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
for (let
|
|
18
|
-
let e =
|
|
26
|
+
function l(...e) {
|
|
27
|
+
let t = 0n;
|
|
28
|
+
for (let n of e) {
|
|
29
|
+
let e = o(n);
|
|
19
30
|
if (e === null) return null;
|
|
20
|
-
|
|
31
|
+
t += e;
|
|
21
32
|
}
|
|
22
|
-
return
|
|
33
|
+
return t < i || t > a ? null : t.toString();
|
|
23
34
|
}
|
|
24
|
-
var
|
|
35
|
+
var u = (() => {
|
|
25
36
|
try {
|
|
26
37
|
return new Intl.NumberFormat("en", { useGrouping: !1 }).format("9007199254740993") === "9007199254740993";
|
|
27
38
|
} catch {
|
|
28
39
|
return !1;
|
|
29
40
|
}
|
|
30
|
-
})(),
|
|
31
|
-
function
|
|
41
|
+
})(), d = 10n ** 15n;
|
|
42
|
+
function f(e, t) {
|
|
32
43
|
let n = e < 0n ? -e : e, r = 10n ** BigInt(t), i = (n % r).toString().padStart(t, "0").replace(/0+$/, "");
|
|
33
44
|
return `${e < 0n ? "-" : ""}${n / r}${i ? `.${i}` : ""}`;
|
|
34
45
|
}
|
|
35
|
-
function
|
|
36
|
-
let n =
|
|
37
|
-
return n === null || !
|
|
46
|
+
function p(e, t) {
|
|
47
|
+
let n = o(e);
|
|
48
|
+
return n === null || !c(t) ? null : f(n, t);
|
|
38
49
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return c < t || c > n ? null : c.toString();
|
|
50
|
+
function m(e, t, n) {
|
|
51
|
+
let r = o(e);
|
|
52
|
+
if (r === null || !c(t) || !c(n) || n > t) return null;
|
|
53
|
+
let i = 10n ** BigInt(t - n);
|
|
54
|
+
if (r % i !== 0n) return null;
|
|
55
|
+
let a = r / i;
|
|
56
|
+
return a > BigInt(2 ** 53 - 1) || a < -BigInt(2 ** 53 - 1) ? null : Number(a);
|
|
47
57
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!
|
|
52
|
-
let
|
|
58
|
+
function h(e, t) {
|
|
59
|
+
if (!c(t) || e.length > 40) return null;
|
|
60
|
+
let n = /^(-?)(\d+)(?:\.(\d+))?$/.exec(e);
|
|
61
|
+
if (!n) return null;
|
|
62
|
+
let r = n[3] ?? "";
|
|
63
|
+
if (r.length > t) return null;
|
|
64
|
+
let o = BigInt(n[2]) * 10n ** BigInt(t) + BigInt(r.padEnd(t, "0") || "0"), s = n[1] ? -o : o;
|
|
65
|
+
return s < i || s > a ? null : s.toString();
|
|
66
|
+
}
|
|
67
|
+
function g(e, t, n, r) {
|
|
68
|
+
let i = t.trim().toUpperCase(), a = o(e);
|
|
69
|
+
if (a === null || !c(n)) return `${i} amount exceeds the exact display range`;
|
|
70
|
+
if (!u && (a >= d || a <= -d)) return `${i} amount exceeds this browser's exact display range`;
|
|
71
|
+
let s = f(a, n);
|
|
53
72
|
try {
|
|
54
|
-
return new Intl.NumberFormat(
|
|
73
|
+
return new Intl.NumberFormat(r, {
|
|
55
74
|
style: "currency",
|
|
56
|
-
currency:
|
|
75
|
+
currency: i,
|
|
57
76
|
maximumFractionDigits: n
|
|
58
|
-
}).format(
|
|
77
|
+
}).format(s);
|
|
59
78
|
} catch {
|
|
60
|
-
return `${
|
|
79
|
+
return `${s} ${i}`;
|
|
61
80
|
}
|
|
62
81
|
}
|
|
63
82
|
//#endregion
|
|
64
83
|
//#region src/types.ts
|
|
65
|
-
var
|
|
84
|
+
var _ = (e) => e.nullish().transform((e) => e ?? void 0).optional(), v = e.string().refine(s, "amount must be an int64 decimal string"), y = e.number().refine(c, "unit_decimals must be an integer from 0 to 18"), ee = e.string().url().refine((e) => {
|
|
66
85
|
try {
|
|
67
86
|
let t = new URL(e);
|
|
68
87
|
return t.protocol === "https:" && !t.username && !t.password;
|
|
@@ -76,7 +95,7 @@ var p = (e) => e.nullish().transform((e) => e ?? void 0).optional(), m = e.strin
|
|
|
76
95
|
} catch {
|
|
77
96
|
return !1;
|
|
78
97
|
}
|
|
79
|
-
}, "return URL must be HTTP(S)"),
|
|
98
|
+
}, "return URL must be HTTP(S)"), b = e.enum([
|
|
80
99
|
"created",
|
|
81
100
|
"requires_action",
|
|
82
101
|
"processing",
|
|
@@ -85,16 +104,16 @@ var p = (e) => e.nullish().transform((e) => e ?? void 0).optional(), m = e.strin
|
|
|
85
104
|
"blocked",
|
|
86
105
|
"expired",
|
|
87
106
|
"canceled"
|
|
88
|
-
]),
|
|
107
|
+
]), x = e.object({
|
|
89
108
|
reason: e.string(),
|
|
90
109
|
message: e.string(),
|
|
91
110
|
field: e.string().nullish()
|
|
92
|
-
}),
|
|
111
|
+
}), S = e.object({
|
|
93
112
|
id: e.string(),
|
|
94
113
|
status: e.string()
|
|
95
|
-
}),
|
|
114
|
+
}), C = e.object({
|
|
96
115
|
id: e.string().min(1),
|
|
97
|
-
psp_id:
|
|
116
|
+
psp_id: _(e.string()),
|
|
98
117
|
rail: e.string(),
|
|
99
118
|
mode: e.enum(["one_off", "subscription"]),
|
|
100
119
|
driver: e.enum([
|
|
@@ -104,15 +123,15 @@ var p = (e) => e.nullish().transform((e) => e ?? void 0).optional(), m = e.strin
|
|
|
104
123
|
"redirect",
|
|
105
124
|
"solana_pay"
|
|
106
125
|
]),
|
|
107
|
-
psp_key:
|
|
108
|
-
public_config:
|
|
109
|
-
}),
|
|
126
|
+
psp_key: _(e.string()),
|
|
127
|
+
public_config: _(e.record(e.string(), e.string()))
|
|
128
|
+
}), w = e.discriminatedUnion("type", [e.object({
|
|
110
129
|
type: e.literal("redirect_to_url"),
|
|
111
130
|
url: ee
|
|
112
131
|
}), e.object({
|
|
113
132
|
type: e.literal("solana_pay"),
|
|
114
133
|
url: e.string().startsWith("solana:")
|
|
115
|
-
})]),
|
|
134
|
+
})]), T = e.object({
|
|
116
135
|
id: e.string(),
|
|
117
136
|
option_id: e.string(),
|
|
118
137
|
rail: e.string(),
|
|
@@ -122,37 +141,37 @@ var p = (e) => e.nullish().transform((e) => e ?? void 0).optional(), m = e.strin
|
|
|
122
141
|
exp_month: e.number().nullish(),
|
|
123
142
|
exp_year: e.number().nullish()
|
|
124
143
|
}).nullish()
|
|
125
|
-
}),
|
|
144
|
+
}), E = e.object({
|
|
126
145
|
label: e.string(),
|
|
127
|
-
sublabel:
|
|
128
|
-
amount:
|
|
129
|
-
}),
|
|
146
|
+
sublabel: _(e.string()),
|
|
147
|
+
amount: v
|
|
148
|
+
}), D = e.object({
|
|
130
149
|
auto_renew: e.boolean(),
|
|
131
150
|
display_name: e.string(),
|
|
132
|
-
unit_amount:
|
|
151
|
+
unit_amount: v,
|
|
133
152
|
currency: e.string().min(1),
|
|
134
|
-
unit_decimals:
|
|
135
|
-
billing_interval_hours:
|
|
136
|
-
access_duration_hours:
|
|
137
|
-
}),
|
|
153
|
+
unit_decimals: y,
|
|
154
|
+
billing_interval_hours: _(e.number()),
|
|
155
|
+
access_duration_hours: _(e.number())
|
|
156
|
+
}), O = e.object({
|
|
138
157
|
id: e.string(),
|
|
139
|
-
status:
|
|
158
|
+
status: b,
|
|
140
159
|
merchant: e.object({ display_name: e.string() }),
|
|
141
|
-
plan:
|
|
142
|
-
line_items:
|
|
143
|
-
tax:
|
|
144
|
-
due_today:
|
|
145
|
-
options: e.array(
|
|
146
|
-
saved_methods:
|
|
147
|
-
next_action:
|
|
148
|
-
payment_id:
|
|
149
|
-
subscription_id:
|
|
150
|
-
failure_message:
|
|
151
|
-
failure:
|
|
152
|
-
operation:
|
|
153
|
-
success_url:
|
|
154
|
-
embed_origin:
|
|
155
|
-
expires_at:
|
|
160
|
+
plan: D,
|
|
161
|
+
line_items: _(e.array(E)),
|
|
162
|
+
tax: _(v),
|
|
163
|
+
due_today: _(v),
|
|
164
|
+
options: e.array(C),
|
|
165
|
+
saved_methods: _(e.array(T)),
|
|
166
|
+
next_action: w.nullish(),
|
|
167
|
+
payment_id: _(e.string()),
|
|
168
|
+
subscription_id: _(e.string()),
|
|
169
|
+
failure_message: _(e.string()),
|
|
170
|
+
failure: x.nullish(),
|
|
171
|
+
operation: S.nullish(),
|
|
172
|
+
success_url: _(te),
|
|
173
|
+
embed_origin: _(e.string().url()),
|
|
174
|
+
expires_at: _(e.string())
|
|
156
175
|
}), ne = e.object({
|
|
157
176
|
option_id: e.string(),
|
|
158
177
|
payment_token: e.string().optional(),
|
|
@@ -177,36 +196,37 @@ var p = (e) => e.nullish().transform((e) => e ?? void 0).optional(), m = e.strin
|
|
|
177
196
|
}).optional()
|
|
178
197
|
}).optional(),
|
|
179
198
|
token_symbol: e.string().optional()
|
|
180
|
-
}),
|
|
181
|
-
status:
|
|
182
|
-
next_action:
|
|
183
|
-
operation:
|
|
184
|
-
payment_id:
|
|
185
|
-
subscription_id:
|
|
186
|
-
failure_message:
|
|
187
|
-
failure:
|
|
188
|
-
}),
|
|
199
|
+
}), k = e.object({
|
|
200
|
+
status: b,
|
|
201
|
+
next_action: w.nullish(),
|
|
202
|
+
operation: S.nullish(),
|
|
203
|
+
payment_id: _(e.string()),
|
|
204
|
+
subscription_id: _(e.string()),
|
|
205
|
+
failure_message: _(e.string()),
|
|
206
|
+
failure: x.nullish()
|
|
207
|
+
}), A = class extends Error {
|
|
189
208
|
status;
|
|
190
209
|
type;
|
|
191
210
|
code;
|
|
192
211
|
param;
|
|
193
212
|
requestId;
|
|
194
213
|
metadata;
|
|
214
|
+
order;
|
|
195
215
|
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 ?? {};
|
|
216
|
+
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 ?? {}, this.order = t.order;
|
|
197
217
|
}
|
|
198
|
-
},
|
|
218
|
+
}, j = (e) => e instanceof A, re = (e) => {
|
|
199
219
|
let t = e?.status;
|
|
200
220
|
return typeof t == "number" && t >= 500 && t < 600;
|
|
201
221
|
};
|
|
202
|
-
function
|
|
203
|
-
return new
|
|
222
|
+
function M(e, t) {
|
|
223
|
+
return new A(0, {
|
|
204
224
|
type: "local",
|
|
205
225
|
code: e,
|
|
206
226
|
message: t
|
|
207
227
|
});
|
|
208
228
|
}
|
|
209
|
-
async function
|
|
229
|
+
async function N(e) {
|
|
210
230
|
let t;
|
|
211
231
|
try {
|
|
212
232
|
t = await e.json();
|
|
@@ -216,27 +236,28 @@ async function k(e) {
|
|
|
216
236
|
let n = t?.error;
|
|
217
237
|
if (n && typeof n == "object") {
|
|
218
238
|
let t = n;
|
|
219
|
-
if (typeof t.code == "string" && t.code) return new
|
|
239
|
+
if (typeof t.code == "string" && t.code) return new A(e.status, {
|
|
220
240
|
type: typeof t.type == "string" ? t.type : "",
|
|
221
241
|
code: t.code,
|
|
222
242
|
message: typeof t.message == "string" ? t.message : t.code,
|
|
223
243
|
request_id: typeof t.request_id == "string" ? t.request_id : e.headers.get("X-Request-ID") ?? void 0,
|
|
224
244
|
param: typeof t.param == "string" ? t.param : void 0,
|
|
225
|
-
metadata: t.metadata && typeof t.metadata == "object" ? t.metadata : void 0
|
|
245
|
+
metadata: t.metadata && typeof t.metadata == "object" ? t.metadata : void 0,
|
|
246
|
+
order: t.order
|
|
226
247
|
});
|
|
227
248
|
}
|
|
228
|
-
return new
|
|
249
|
+
return new A(e.status, {
|
|
229
250
|
type: e.status >= 500 ? "api_error" : "",
|
|
230
251
|
code: typeof n == "string" && n ? n : e.status >= 500 ? "server_error" : "unknown_error",
|
|
231
252
|
message: `HTTP ${e.status}`
|
|
232
253
|
});
|
|
233
254
|
}
|
|
234
255
|
function ie(e) {
|
|
235
|
-
return e instanceof
|
|
256
|
+
return e instanceof A ? e : e instanceof TypeError ? M("network_error", e.message) : M("unknown_error", e instanceof Error ? e.message : String(e));
|
|
236
257
|
}
|
|
237
258
|
//#endregion
|
|
238
259
|
//#region src/client/generated/currencies.ts
|
|
239
|
-
var
|
|
260
|
+
var ae = {
|
|
240
261
|
AED: 6,
|
|
241
262
|
AUD: 6,
|
|
242
263
|
BRL: 6,
|
|
@@ -271,7 +292,7 @@ var A = {
|
|
|
271
292
|
USDG: 6,
|
|
272
293
|
USDT: 6,
|
|
273
294
|
ZAR: 6
|
|
274
|
-
},
|
|
295
|
+
}, P = e.object({
|
|
275
296
|
psp_id: e.string().min(1),
|
|
276
297
|
key: e.string().min(1),
|
|
277
298
|
rail: e.string(),
|
|
@@ -282,22 +303,22 @@ var A = {
|
|
|
282
303
|
checkout: e.boolean().nullish(),
|
|
283
304
|
status: e.string().nullish(),
|
|
284
305
|
retry_after: e.number().int().nullish()
|
|
285
|
-
}),
|
|
306
|
+
}), oe = /* @__PURE__ */ new Set([
|
|
286
307
|
"collect_js",
|
|
287
308
|
"card",
|
|
288
309
|
"stripe_elements"
|
|
289
|
-
]),
|
|
310
|
+
]), F = (e) => oe.has(e.driver), se = (e) => e.filter((e) => e.checkout !== !1), ce = /* @__PURE__ */ new Set([
|
|
290
311
|
"tokenize",
|
|
291
312
|
"card",
|
|
292
313
|
"elements"
|
|
293
314
|
]);
|
|
294
|
-
function
|
|
295
|
-
let t = e.filter((e) => !!e.status && e.custodian === "psp" &&
|
|
315
|
+
function le(e) {
|
|
316
|
+
let t = e.filter((e) => !!e.status && e.custodian === "psp" && ce.has(e.flow)).map((e) => e.retry_after ?? 30);
|
|
296
317
|
return t.length > 0 ? Math.min(...t) : null;
|
|
297
318
|
}
|
|
298
|
-
function
|
|
319
|
+
function ue(e, t) {
|
|
299
320
|
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 &&
|
|
321
|
+
let n = t.find((t) => (t.psp_id ?? t.id) === e.psp_id && F(t));
|
|
301
322
|
return !n || e.health?.active === !1 ? [] : [{
|
|
302
323
|
id: e.id,
|
|
303
324
|
option_id: n.id,
|
|
@@ -306,12 +327,12 @@ function le(e, t) {
|
|
|
306
327
|
}];
|
|
307
328
|
});
|
|
308
329
|
}
|
|
309
|
-
var
|
|
310
|
-
function
|
|
311
|
-
return e.custodian !== "psp" || e.status ? null : e.flow === "card" && e.rail === "nmi" ? "card" : e.flow === "tokenize" &&
|
|
330
|
+
var de = (e) => !!e && !e.startsWith("preview_"), fe = (e) => e.rail === "stripe" && !!e.config?.publishable_key?.startsWith("pk_");
|
|
331
|
+
function I(e) {
|
|
332
|
+
return e.custodian !== "psp" || e.status ? null : e.flow === "card" && e.rail === "nmi" ? "card" : e.flow === "tokenize" && de(e.config?.tokenization_key) && e.config?.tokenization_url ? "collect_js" : fe(e) ? "stripe_elements" : null;
|
|
312
333
|
}
|
|
313
|
-
var
|
|
314
|
-
function
|
|
334
|
+
var pe = (e) => I(e) !== null, me = (e) => I(e) === "stripe_elements";
|
|
335
|
+
function he(e) {
|
|
315
336
|
return {
|
|
316
337
|
psp_id: e.psp_id ?? e.id,
|
|
317
338
|
key: e.psp_key ?? e.rail,
|
|
@@ -324,41 +345,41 @@ function me(e) {
|
|
|
324
345
|
}
|
|
325
346
|
//#endregion
|
|
326
347
|
//#region src/client/types.ts
|
|
327
|
-
var
|
|
348
|
+
var L = e.string().refine(s, "amount must be an int64 string"), R = e.string(), ge = (t) => e.object({
|
|
328
349
|
data: e.array(t).nullish().transform((e) => e ?? []),
|
|
329
350
|
total: e.number().nullish(),
|
|
330
351
|
limit: e.number().nullish(),
|
|
331
352
|
offset: e.number().nullish(),
|
|
332
353
|
has_more: e.boolean().nullish(),
|
|
333
354
|
next_cursor: e.string().nullish()
|
|
334
|
-
}),
|
|
355
|
+
}), z = (t) => e.object({
|
|
335
356
|
data: e.array(t).nullish().transform((e) => e ?? []),
|
|
336
357
|
next_cursor: e.string().nullish().transform((e) => e ?? null)
|
|
337
|
-
}),
|
|
358
|
+
}), _e = e.string(), ve = e.object({
|
|
338
359
|
status: e.string(),
|
|
339
360
|
ids: e.record(e.string(), e.string()).nullish(),
|
|
340
361
|
sync_status: e.string().nullish()
|
|
341
|
-
}),
|
|
362
|
+
}), B = e.object({
|
|
342
363
|
id: e.string(),
|
|
343
364
|
key: e.string(),
|
|
344
365
|
revision: e.number().int().nonnegative().optional(),
|
|
345
366
|
version: e.number().int().nonnegative().optional(),
|
|
346
367
|
product_id: e.string(),
|
|
347
368
|
archived: e.boolean(),
|
|
348
|
-
unit_amount:
|
|
369
|
+
unit_amount: L,
|
|
349
370
|
customer_amount: e.object({
|
|
350
|
-
min_amount:
|
|
351
|
-
max_amount:
|
|
371
|
+
min_amount: L,
|
|
372
|
+
max_amount: L
|
|
352
373
|
}).nullish(),
|
|
353
374
|
currency: e.string(),
|
|
354
375
|
access_duration_hours: e.number().nullable(),
|
|
355
376
|
billing_interval_hours: e.number().nullable(),
|
|
356
|
-
trial_unit_amount:
|
|
377
|
+
trial_unit_amount: L.nullable(),
|
|
357
378
|
trial_duration_hours: e.number().nullable(),
|
|
358
|
-
psps: e.record(e.string(),
|
|
359
|
-
created_at:
|
|
360
|
-
updated_at:
|
|
361
|
-
}),
|
|
379
|
+
psps: e.record(e.string(), ve).nullish(),
|
|
380
|
+
created_at: R,
|
|
381
|
+
updated_at: R
|
|
382
|
+
}), V = e.object({
|
|
362
383
|
id: e.string(),
|
|
363
384
|
key: e.string().nullish(),
|
|
364
385
|
revision: e.number().int().nonnegative().optional(),
|
|
@@ -366,33 +387,34 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
366
387
|
description: e.string().nullish(),
|
|
367
388
|
tier_group: e.string().nullish(),
|
|
368
389
|
tier_rank: e.number().nullish()
|
|
369
|
-
}),
|
|
390
|
+
}), H = e.object({
|
|
370
391
|
brand: e.string().nullish(),
|
|
371
392
|
last4: e.string().nullish(),
|
|
372
393
|
exp_month: e.number().nullish(),
|
|
373
394
|
exp_year: e.number().nullish()
|
|
374
|
-
}),
|
|
395
|
+
}), ye = e.object({
|
|
375
396
|
id: e.string(),
|
|
376
397
|
status: e.string()
|
|
377
|
-
}),
|
|
398
|
+
}), U = e.object({
|
|
378
399
|
last_failure_reason: e.string().nullish(),
|
|
379
400
|
retryable: e.boolean(),
|
|
380
401
|
blocked_reason: e.string().nullish(),
|
|
381
|
-
operation:
|
|
382
|
-
|
|
402
|
+
operation: ye.nullish(),
|
|
403
|
+
order_id: e.string().nullish()
|
|
404
|
+
}), W = e.object({
|
|
383
405
|
type: e.string(),
|
|
384
406
|
redirect_to_url: e.object({ url: e.string().nullish() }).nullish(),
|
|
385
407
|
transactions: e.array(e.string()).nullish()
|
|
386
|
-
}),
|
|
408
|
+
}), be = e.object({
|
|
387
409
|
attempts: e.number(),
|
|
388
410
|
retries_left: e.number().nullish(),
|
|
389
|
-
next_retry_at:
|
|
390
|
-
final_retry_at:
|
|
411
|
+
next_retry_at: R.nullish(),
|
|
412
|
+
final_retry_at: R.nullish(),
|
|
391
413
|
waiting_for_new_card: e.boolean(),
|
|
392
414
|
last_failure_reason: e.string().nullish()
|
|
393
|
-
}),
|
|
415
|
+
}), G = e.object({
|
|
394
416
|
id: e.string(),
|
|
395
|
-
status:
|
|
417
|
+
status: _e,
|
|
396
418
|
rail: e.string().nullish(),
|
|
397
419
|
product_id: e.string().nullish(),
|
|
398
420
|
price_id: e.string().nullish(),
|
|
@@ -400,37 +422,37 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
400
422
|
psp_id: e.string().nullish(),
|
|
401
423
|
collection_policy: e.string().nullish(),
|
|
402
424
|
payment_method_id: e.string().nullish(),
|
|
403
|
-
started_at:
|
|
404
|
-
ended_at:
|
|
405
|
-
current_period_starts_at:
|
|
406
|
-
current_period_ends_at:
|
|
407
|
-
canceled_at:
|
|
425
|
+
started_at: R.nullish(),
|
|
426
|
+
ended_at: R.nullish(),
|
|
427
|
+
current_period_starts_at: R.nullish(),
|
|
428
|
+
current_period_ends_at: R.nullish(),
|
|
429
|
+
canceled_at: R.nullish(),
|
|
408
430
|
cancel_type: e.string().nullish(),
|
|
409
431
|
resumable: e.boolean().nullish(),
|
|
410
432
|
cancel_scheduled: e.boolean().nullish(),
|
|
411
433
|
cancel_mode: e.string().nullish(),
|
|
412
434
|
cancel_portal_url: e.string().nullish(),
|
|
413
435
|
access: e.object({
|
|
414
|
-
starts_at:
|
|
415
|
-
ends_at:
|
|
436
|
+
starts_at: R,
|
|
437
|
+
ends_at: R.nullish()
|
|
416
438
|
}).nullish(),
|
|
417
|
-
dunning:
|
|
418
|
-
price:
|
|
419
|
-
product:
|
|
439
|
+
dunning: be.nullish(),
|
|
440
|
+
price: B.nullish(),
|
|
441
|
+
product: V.nullish(),
|
|
420
442
|
scheduled_change: e.object({
|
|
421
443
|
price_id: e.string(),
|
|
422
444
|
quantity: e.number().nullish(),
|
|
423
|
-
effective_at:
|
|
445
|
+
effective_at: R,
|
|
424
446
|
source: e.string(),
|
|
425
|
-
price:
|
|
426
|
-
product:
|
|
447
|
+
price: B.nullish(),
|
|
448
|
+
product: V.nullish()
|
|
427
449
|
}).nullish(),
|
|
428
|
-
card:
|
|
429
|
-
recovery:
|
|
430
|
-
next_action:
|
|
431
|
-
created_at:
|
|
432
|
-
updated_at:
|
|
433
|
-
}),
|
|
450
|
+
card: H.nullish(),
|
|
451
|
+
recovery: U.nullish(),
|
|
452
|
+
next_action: W.nullish(),
|
|
453
|
+
created_at: R.nullish(),
|
|
454
|
+
updated_at: R.nullish()
|
|
455
|
+
}), xe = e.object({
|
|
434
456
|
name: e.string().nullish(),
|
|
435
457
|
email: e.string().nullish(),
|
|
436
458
|
phone: e.string().nullish(),
|
|
@@ -442,15 +464,22 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
442
464
|
postal_code: e.string().nullish(),
|
|
443
465
|
country: e.string().nullish()
|
|
444
466
|
}).nullish()
|
|
445
|
-
}),
|
|
467
|
+
}), K = e.object({
|
|
446
468
|
id: e.string(),
|
|
469
|
+
status: e.string().nullish(),
|
|
470
|
+
next_action: e.object({
|
|
471
|
+
type: e.string(),
|
|
472
|
+
psp_id: e.string().nullish(),
|
|
473
|
+
payload: e.record(e.string(), e.string()).nullish()
|
|
474
|
+
}).nullish(),
|
|
447
475
|
rail: e.string().nullish(),
|
|
448
476
|
psp_id: e.string().nullish(),
|
|
449
|
-
card:
|
|
450
|
-
billing_details:
|
|
477
|
+
card: H.nullish(),
|
|
478
|
+
billing_details: xe.nullish(),
|
|
479
|
+
reusable: e.boolean().nullish(),
|
|
451
480
|
health: e.object({
|
|
452
481
|
expiry_status: e.string().nullish(),
|
|
453
|
-
last_charged_at:
|
|
482
|
+
last_charged_at: R.nullish(),
|
|
454
483
|
last_charge_outcome: e.string().nullish(),
|
|
455
484
|
active: e.boolean().nullish()
|
|
456
485
|
}).nullish(),
|
|
@@ -459,8 +488,92 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
459
488
|
display_name: e.string().nullish()
|
|
460
489
|
})).nullish(),
|
|
461
490
|
default_currencies: e.array(e.string()).nullish(),
|
|
462
|
-
created_at:
|
|
463
|
-
}),
|
|
491
|
+
created_at: R.nullish()
|
|
492
|
+
}), Se = e.object({
|
|
493
|
+
reason: e.string(),
|
|
494
|
+
message: e.string(),
|
|
495
|
+
field: e.string().nullish()
|
|
496
|
+
}), Ce = e.object({
|
|
497
|
+
type: e.string(),
|
|
498
|
+
url: e.string().nullish(),
|
|
499
|
+
psp_id: e.string().nullish(),
|
|
500
|
+
transactions: e.array(e.string()).nullish(),
|
|
501
|
+
payload: e.record(e.string(), e.string()).nullish()
|
|
502
|
+
}), we = e.object({
|
|
503
|
+
id: e.string(),
|
|
504
|
+
price_id: e.string(),
|
|
505
|
+
product_id: e.string(),
|
|
506
|
+
description: e.string(),
|
|
507
|
+
quantity: e.number().nullish(),
|
|
508
|
+
unit_amount: L,
|
|
509
|
+
amount: L,
|
|
510
|
+
billing_interval_hours: e.number().nullish(),
|
|
511
|
+
access_duration_hours: e.number().nullish(),
|
|
512
|
+
subscription_id: e.string().nullish(),
|
|
513
|
+
product_access_id: e.string().nullish()
|
|
514
|
+
}), q = e.object({
|
|
515
|
+
id: e.string(),
|
|
516
|
+
customer_id: e.string(),
|
|
517
|
+
origin: e.string(),
|
|
518
|
+
status: e.string(),
|
|
519
|
+
number: e.string().nullish(),
|
|
520
|
+
currency: e.string(),
|
|
521
|
+
total: L,
|
|
522
|
+
lines: e.array(we),
|
|
523
|
+
payment: e.object({
|
|
524
|
+
status: e.string(),
|
|
525
|
+
next_action: Ce.nullish(),
|
|
526
|
+
last_payment_error: Se.nullish(),
|
|
527
|
+
payment_method_id: e.string().nullish(),
|
|
528
|
+
payment_id: e.string().nullish()
|
|
529
|
+
}),
|
|
530
|
+
payment_options: e.array(e.object({
|
|
531
|
+
psp_id: e.string(),
|
|
532
|
+
rail: e.string(),
|
|
533
|
+
accepts: e.array(e.string())
|
|
534
|
+
})).nullish().transform((e) => e ?? []),
|
|
535
|
+
checkout: e.object({
|
|
536
|
+
url: e.string().nullish(),
|
|
537
|
+
success_url: e.string(),
|
|
538
|
+
cancel_url: e.string().nullish(),
|
|
539
|
+
saved_payment_methods: e.boolean()
|
|
540
|
+
}).nullish(),
|
|
541
|
+
renewal: e.object({
|
|
542
|
+
subscription_id: e.string(),
|
|
543
|
+
period_starts_at: R,
|
|
544
|
+
period_ends_at: R,
|
|
545
|
+
due_at: R
|
|
546
|
+
}).nullish(),
|
|
547
|
+
expires_at: R.nullish(),
|
|
548
|
+
completed_at: R.nullish(),
|
|
549
|
+
canceled_at: R.nullish(),
|
|
550
|
+
expired_at: R.nullish(),
|
|
551
|
+
voided_at: R.nullish(),
|
|
552
|
+
created_at: R
|
|
553
|
+
}), Te = e.object({
|
|
554
|
+
code: e.string(),
|
|
555
|
+
message: e.string(),
|
|
556
|
+
owned_by: e.string().nullish(),
|
|
557
|
+
hint: e.string().nullish()
|
|
558
|
+
}), Ee = e.object({
|
|
559
|
+
price_id: e.string(),
|
|
560
|
+
product_id: e.string(),
|
|
561
|
+
description: e.string(),
|
|
562
|
+
quantity: e.number().nullish(),
|
|
563
|
+
unit_amount: L,
|
|
564
|
+
amount: L,
|
|
565
|
+
ownership: e.string(),
|
|
566
|
+
billing_interval_hours: e.number().nullish(),
|
|
567
|
+
access_duration_hours: e.number().nullish(),
|
|
568
|
+
refusal: Te.nullish()
|
|
569
|
+
}), J = e.object({
|
|
570
|
+
currency: e.string(),
|
|
571
|
+
total: L,
|
|
572
|
+
lines: e.array(Ee),
|
|
573
|
+
payment_options: q.shape.payment_options,
|
|
574
|
+
last_changed_at: R.nullish(),
|
|
575
|
+
expires_at: R.nullish()
|
|
576
|
+
}), De = e.object({
|
|
464
577
|
id: e.string(),
|
|
465
578
|
key: e.string(),
|
|
466
579
|
revision: e.number().int().nonnegative().optional(),
|
|
@@ -469,97 +582,97 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
469
582
|
entitlements: e.array(e.string()),
|
|
470
583
|
credit_grant: e.object({
|
|
471
584
|
currency: e.string(),
|
|
472
|
-
amount:
|
|
585
|
+
amount: L.nullish(),
|
|
473
586
|
from_payment: e.boolean().optional(),
|
|
474
587
|
expires_after_days: e.number().int().positive().nullish()
|
|
475
588
|
}).nullish(),
|
|
476
589
|
tier_group: e.string().nullable(),
|
|
477
590
|
tier_rank: e.number(),
|
|
478
591
|
archived: e.boolean(),
|
|
479
|
-
prices: e.array(
|
|
480
|
-
created_at:
|
|
481
|
-
updated_at:
|
|
482
|
-
}),
|
|
592
|
+
prices: e.array(B).nullish().transform((e) => e ?? []),
|
|
593
|
+
created_at: R,
|
|
594
|
+
updated_at: R
|
|
595
|
+
}), Oe = e.object({
|
|
483
596
|
id: e.string(),
|
|
484
597
|
kind: e.string(),
|
|
485
598
|
status: e.string(),
|
|
486
|
-
amount:
|
|
487
|
-
amount_refunded:
|
|
599
|
+
amount: L,
|
|
600
|
+
amount_refunded: L.nullish(),
|
|
488
601
|
currency: e.string(),
|
|
489
602
|
subscription_id: e.string().nullish(),
|
|
490
603
|
price_id: e.string().nullish(),
|
|
491
604
|
channel: e.string().nullish(),
|
|
492
605
|
rail: e.string().nullish(),
|
|
493
|
-
created_at:
|
|
494
|
-
price:
|
|
495
|
-
product:
|
|
496
|
-
card:
|
|
606
|
+
created_at: R,
|
|
607
|
+
price: B.nullish(),
|
|
608
|
+
product: V.nullish(),
|
|
609
|
+
card: H.nullish(),
|
|
497
610
|
failure: e.object({
|
|
498
611
|
reason: e.string(),
|
|
499
612
|
message: e.string(),
|
|
500
613
|
field: e.string().nullish()
|
|
501
614
|
}).nullish()
|
|
502
|
-
}),
|
|
615
|
+
}), ke = e.object({
|
|
503
616
|
currency: e.string(),
|
|
504
617
|
billing_mode: e.string(),
|
|
505
|
-
balance_amount:
|
|
506
|
-
held_amount:
|
|
507
|
-
available_amount:
|
|
508
|
-
owed_amount:
|
|
509
|
-
}),
|
|
618
|
+
balance_amount: L,
|
|
619
|
+
held_amount: L,
|
|
620
|
+
available_amount: L,
|
|
621
|
+
owed_amount: L
|
|
622
|
+
}), Ae = e.object({
|
|
510
623
|
id: e.string(),
|
|
511
|
-
balances: e.array(
|
|
624
|
+
balances: e.array(ke),
|
|
512
625
|
default_payment_methods: e.array(e.object({
|
|
513
626
|
currency: e.string(),
|
|
514
627
|
payment_method_id: e.string()
|
|
515
628
|
})),
|
|
516
629
|
unread_notifications: e.number()
|
|
517
|
-
}),
|
|
630
|
+
}), Y = e.object({
|
|
518
631
|
id: e.string(),
|
|
519
632
|
currency: e.string(),
|
|
520
633
|
invoice_number: e.string().nullish(),
|
|
521
|
-
period_starts_at:
|
|
522
|
-
period_ends_at:
|
|
523
|
-
total_amount:
|
|
524
|
-
amount_paid:
|
|
525
|
-
amount_due:
|
|
634
|
+
period_starts_at: R,
|
|
635
|
+
period_ends_at: R,
|
|
636
|
+
total_amount: L,
|
|
637
|
+
amount_paid: L,
|
|
638
|
+
amount_due: L,
|
|
526
639
|
status: e.string(),
|
|
527
|
-
issued_at:
|
|
528
|
-
due_at:
|
|
640
|
+
issued_at: R.nullish(),
|
|
641
|
+
due_at: R.nullish(),
|
|
529
642
|
delinquent: e.boolean().nullish(),
|
|
530
|
-
paid_at:
|
|
531
|
-
recovery:
|
|
532
|
-
created_at:
|
|
533
|
-
}),
|
|
643
|
+
paid_at: R.nullish(),
|
|
644
|
+
recovery: U.nullish(),
|
|
645
|
+
created_at: R
|
|
646
|
+
}), je = e.object({
|
|
534
647
|
code: e.string(),
|
|
535
648
|
decimals: e.number(),
|
|
536
649
|
minor_decimals: e.number().nullish()
|
|
537
|
-
}),
|
|
650
|
+
}), Me = e.object({
|
|
538
651
|
price_id: e.string(),
|
|
539
652
|
quantity: e.number().nullish(),
|
|
540
653
|
rail: e.string().nullish(),
|
|
541
654
|
currency: e.string(),
|
|
542
|
-
amount_due_now:
|
|
543
|
-
next_charge_amount:
|
|
544
|
-
next_charge_date:
|
|
655
|
+
amount_due_now: L,
|
|
656
|
+
next_charge_amount: L,
|
|
657
|
+
next_charge_date: R.nullish(),
|
|
545
658
|
effective: e.string(),
|
|
546
659
|
is_estimate: e.boolean().nullish(),
|
|
547
660
|
message: e.string().nullish()
|
|
548
|
-
}),
|
|
661
|
+
}), Ne = e.object({
|
|
549
662
|
status: e.string(),
|
|
550
663
|
effective: e.string().nullish(),
|
|
551
664
|
price_id: e.string().nullish(),
|
|
552
665
|
quantity: e.number().nullish(),
|
|
553
666
|
subscription_id: e.string().nullish(),
|
|
554
|
-
next_action:
|
|
555
|
-
delayed_start:
|
|
667
|
+
next_action: W.nullish(),
|
|
668
|
+
delayed_start: R.nullish(),
|
|
556
669
|
currency: e.string().nullish(),
|
|
557
|
-
amount_due_now:
|
|
558
|
-
next_charge_amount:
|
|
559
|
-
next_charge_date:
|
|
670
|
+
amount_due_now: L.nullish(),
|
|
671
|
+
next_charge_amount: L.nullish(),
|
|
672
|
+
next_charge_date: R.nullish(),
|
|
560
673
|
message: e.string().nullish(),
|
|
561
674
|
operation_id: e.string().nullish()
|
|
562
|
-
}),
|
|
675
|
+
}), X = e.string().regex(/^\d+$/, "units must be a uint64 string"), Pe = e.object({
|
|
563
676
|
symbol: e.string(),
|
|
564
677
|
name: e.string().nullish(),
|
|
565
678
|
mint: e.string(),
|
|
@@ -569,20 +682,20 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
569
682
|
recurring_eligible: e.boolean().nullish(),
|
|
570
683
|
quote: e.object({
|
|
571
684
|
amount: e.string(),
|
|
572
|
-
units:
|
|
685
|
+
units: X,
|
|
573
686
|
token_price_usd: e.string().nullish(),
|
|
574
687
|
fx_rate: e.string().nullish(),
|
|
575
688
|
fx_currency: e.string().nullish(),
|
|
576
|
-
quoted_at:
|
|
577
|
-
expires_at:
|
|
689
|
+
quoted_at: R.nullish(),
|
|
690
|
+
expires_at: R.nullish()
|
|
578
691
|
}).nullish(),
|
|
579
692
|
balance: e.object({
|
|
580
693
|
amount: e.string(),
|
|
581
|
-
units:
|
|
694
|
+
units: X,
|
|
582
695
|
sufficient: e.boolean().nullish()
|
|
583
696
|
}).nullish()
|
|
584
|
-
}),
|
|
585
|
-
psps: e.array(
|
|
697
|
+
}), Fe = e.object({ tokens: e.array(Pe).nullish().transform((e) => e ?? []) }), Ie = e.object({
|
|
698
|
+
psps: e.array(P).nullish().transform((e) => e ?? []),
|
|
586
699
|
solana: e.object({
|
|
587
700
|
network: e.string(),
|
|
588
701
|
chain: e.string(),
|
|
@@ -596,65 +709,65 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
|
|
|
596
709
|
recurring_eligible: e.boolean().nullish()
|
|
597
710
|
})).nullish().transform((e) => e ?? [])
|
|
598
711
|
}).nullish()
|
|
599
|
-
}),
|
|
712
|
+
}), Le = e.object({
|
|
600
713
|
provider: e.string(),
|
|
601
714
|
site_key: e.string(),
|
|
602
715
|
script_url: e.string(),
|
|
603
716
|
action: e.string(),
|
|
604
717
|
token_header: e.string()
|
|
605
|
-
}),
|
|
718
|
+
}), Re = e.object({
|
|
719
|
+
display_name: e.string(),
|
|
720
|
+
logo_url: e.string().nullish(),
|
|
721
|
+
support_url: e.string().nullish()
|
|
722
|
+
}), ze = e.object({
|
|
606
723
|
capabilities: e.object({
|
|
607
724
|
route_groups: e.record(e.string(), e.boolean()),
|
|
608
725
|
features: e.record(e.string(), e.boolean())
|
|
609
726
|
}),
|
|
610
|
-
currencies: e.array(
|
|
611
|
-
payment:
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
status: e.string(),
|
|
616
|
-
client_secret: e.string().nullish(),
|
|
617
|
-
payment_method_id: e.string().nullish()
|
|
618
|
-
}), je = e.object({ client_secret: e.string().nullish() }), Y = e.object({
|
|
727
|
+
currencies: e.array(je).nullish().transform((e) => e ?? []),
|
|
728
|
+
payment: Ie.nullish(),
|
|
729
|
+
merchant: Re.nullish(),
|
|
730
|
+
captcha: Le.nullish()
|
|
731
|
+
}), Be = e.object({ client_secret: e.string().nullish() }), Ve = e.object({
|
|
619
732
|
id: e.string().startsWith("ocs_"),
|
|
620
733
|
url: e.string().url().nullish(),
|
|
621
|
-
expires_at:
|
|
622
|
-
}),
|
|
734
|
+
expires_at: R
|
|
735
|
+
}), Z = class extends Error {
|
|
623
736
|
constructor(e = "The wallet request was declined.") {
|
|
624
737
|
super(e), this.name = "WalletRejectedError";
|
|
625
738
|
}
|
|
626
|
-
},
|
|
627
|
-
async function
|
|
739
|
+
}, He = 4, Ue = 500, We = (e) => e?.type === "solana_sign_transactions" && !!e.transactions?.length;
|
|
740
|
+
async function Ge(e, t) {
|
|
628
741
|
let n = "";
|
|
629
742
|
for (let r of e.transactions ?? []) {
|
|
630
743
|
try {
|
|
631
744
|
n = await t(r);
|
|
632
745
|
} catch (e) {
|
|
633
|
-
throw
|
|
746
|
+
throw Ze(e) ? M("wallet_rejected", "The wallet request was declined.") : e;
|
|
634
747
|
}
|
|
635
|
-
if (!n) throw
|
|
748
|
+
if (!n) throw M("wallet_no_signature", "The wallet returned no signature.");
|
|
636
749
|
}
|
|
637
|
-
if (!n) throw
|
|
750
|
+
if (!n) throw M("wallet_no_signature", "The wallet returned no signature.");
|
|
638
751
|
return n;
|
|
639
752
|
}
|
|
640
|
-
var
|
|
641
|
-
function
|
|
642
|
-
let t =
|
|
753
|
+
var Ke = 2e3, Q = 300;
|
|
754
|
+
function qe(e) {
|
|
755
|
+
let t = Je(e.headers.get("Retry-After"));
|
|
643
756
|
switch (e.status) {
|
|
644
757
|
case 429: return t;
|
|
645
|
-
case 503: return t ??
|
|
758
|
+
case 503: return t ?? Q;
|
|
646
759
|
case 502:
|
|
647
|
-
case 504: return
|
|
760
|
+
case 504: return Q;
|
|
648
761
|
default: return null;
|
|
649
762
|
}
|
|
650
763
|
}
|
|
651
|
-
function
|
|
764
|
+
function Je(e) {
|
|
652
765
|
if (!e) return null;
|
|
653
766
|
if (/^\d+$/.test(e.trim())) return Number(e.trim()) * 1e3;
|
|
654
767
|
let t = Date.parse(e);
|
|
655
768
|
return Number.isNaN(t) ? null : Math.max(0, t - Date.now());
|
|
656
769
|
}
|
|
657
|
-
function
|
|
770
|
+
function $(e, t) {
|
|
658
771
|
return new Promise((n, r) => {
|
|
659
772
|
if (t?.aborted) return r(t.reason);
|
|
660
773
|
let i = setTimeout(() => {
|
|
@@ -665,80 +778,95 @@ function Q(e, t) {
|
|
|
665
778
|
t?.addEventListener("abort", a, { once: !0 });
|
|
666
779
|
});
|
|
667
780
|
}
|
|
668
|
-
function
|
|
669
|
-
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""),
|
|
670
|
-
...
|
|
781
|
+
function Ye(e = {}) {
|
|
782
|
+
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), r = e.fetch ?? ((e, t) => fetch(e, t)), i = Xe({
|
|
783
|
+
...ae,
|
|
671
784
|
...e.currencies
|
|
672
785
|
});
|
|
673
|
-
function
|
|
786
|
+
function a(e, n, r = t) {
|
|
674
787
|
let i = new URLSearchParams();
|
|
675
|
-
for (let [e, t] of Object.entries(n ?? {})) t
|
|
788
|
+
for (let [e, t] of Object.entries(n ?? {})) if (Array.isArray(t)) for (let n of t) i.append(e, n);
|
|
789
|
+
else t !== void 0 && t !== "" && i.set(e, String(t));
|
|
676
790
|
let a = i.toString();
|
|
677
791
|
return `${r}${e}${a ? `?${a}` : ""}`;
|
|
678
792
|
}
|
|
679
|
-
async function
|
|
680
|
-
let
|
|
793
|
+
async function o(t, n = {}) {
|
|
794
|
+
let i = new Headers({
|
|
681
795
|
Accept: "application/json",
|
|
682
|
-
...
|
|
796
|
+
...n.headers
|
|
683
797
|
});
|
|
684
|
-
|
|
685
|
-
let o =
|
|
686
|
-
o &&
|
|
798
|
+
n.body !== void 0 && i.set("Content-Type", "application/json");
|
|
799
|
+
let o = n.anonymous ? void 0 : await e.getToken?.();
|
|
800
|
+
o && i.set("Authorization", `Bearer ${o}`);
|
|
687
801
|
let s = e.language?.();
|
|
688
|
-
s &&
|
|
689
|
-
let c =
|
|
802
|
+
s && i.set("Accept-Language", s);
|
|
803
|
+
let c = n.method ?? "GET", l = {
|
|
690
804
|
method: c,
|
|
691
|
-
headers:
|
|
692
|
-
body:
|
|
693
|
-
signal:
|
|
805
|
+
headers: i,
|
|
806
|
+
body: n.body === void 0 ? void 0 : JSON.stringify(n.body),
|
|
807
|
+
signal: n.signal
|
|
694
808
|
}, u = +(c === "GET"), d = 0;
|
|
695
809
|
for (let e = 0;; e++) {
|
|
696
|
-
let
|
|
810
|
+
let i;
|
|
697
811
|
try {
|
|
698
|
-
|
|
812
|
+
i = await r(a(t, n.query, n.root), l);
|
|
699
813
|
} catch (t) {
|
|
700
|
-
let
|
|
701
|
-
if (e >= u ||
|
|
702
|
-
d += await
|
|
814
|
+
let r = Q;
|
|
815
|
+
if (e >= u || n.signal?.aborted || !(t instanceof TypeError) || d + r > 2e3) throw t;
|
|
816
|
+
d += await $(r, n.signal);
|
|
703
817
|
continue;
|
|
704
818
|
}
|
|
705
|
-
if (
|
|
706
|
-
let o =
|
|
707
|
-
if (e >= u || o === null || d + o > 2e3) throw await
|
|
708
|
-
await
|
|
819
|
+
if (i.ok) return i;
|
|
820
|
+
let o = qe(i);
|
|
821
|
+
if (e >= u || o === null || d + o > 2e3) throw await N(i);
|
|
822
|
+
await i.body?.cancel().catch(() => void 0), d += await $(o, n.signal);
|
|
709
823
|
}
|
|
710
824
|
}
|
|
711
|
-
async function
|
|
712
|
-
let r = await
|
|
825
|
+
async function s(e, t, n) {
|
|
826
|
+
let r = await o(t, n), i;
|
|
713
827
|
try {
|
|
714
828
|
i = await r.json();
|
|
715
829
|
} catch {
|
|
716
|
-
throw
|
|
830
|
+
throw M("invalid_response", `${t}: body is not JSON`);
|
|
717
831
|
}
|
|
718
|
-
let
|
|
719
|
-
if (!
|
|
720
|
-
return
|
|
832
|
+
let a = e.safeParse(i);
|
|
833
|
+
if (!a.success) throw M("invalid_response", `${t}: ${a.error.issues[0]?.path.join(".")} ${a.error.issues[0]?.message}`);
|
|
834
|
+
return a.data;
|
|
721
835
|
}
|
|
722
|
-
let
|
|
836
|
+
let c = (e) => encodeURIComponent(e), l = z(G), u = z(K), d = z(Oe), f = z(Y), p = (e, t) => ({
|
|
723
837
|
limit: e.limit ?? t,
|
|
724
838
|
cursor: e.cursor ?? void 0
|
|
725
|
-
}),
|
|
726
|
-
|
|
839
|
+
}), m = ge(De);
|
|
840
|
+
async function h(e, t) {
|
|
841
|
+
try {
|
|
842
|
+
return { order: await s(q, e, t) };
|
|
843
|
+
} catch (e) {
|
|
844
|
+
if (j(e) && e.status === 402 && e.order) {
|
|
845
|
+
let t = q.safeParse(e.order);
|
|
846
|
+
if (t.success) return {
|
|
847
|
+
order: t.data,
|
|
848
|
+
error: e
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
throw e;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
let g = {
|
|
727
855
|
baseUrl: t,
|
|
728
856
|
listSubscriptions(e = {}) {
|
|
729
|
-
return
|
|
857
|
+
return s(l, "/me/subscriptions", {
|
|
730
858
|
query: {
|
|
731
859
|
status: e.status ?? "all",
|
|
732
|
-
...
|
|
860
|
+
...p(e, 100)
|
|
733
861
|
},
|
|
734
862
|
signal: e.signal
|
|
735
863
|
});
|
|
736
864
|
},
|
|
737
865
|
getSubscription(e, t) {
|
|
738
|
-
return
|
|
866
|
+
return s(G, `/me/subscriptions/${c(e)}`, { signal: t });
|
|
739
867
|
},
|
|
740
868
|
cancelSubscription(e, t) {
|
|
741
|
-
return
|
|
869
|
+
return s(G, `/me/subscriptions/${c(e)}/cancel`, {
|
|
742
870
|
method: "POST",
|
|
743
871
|
body: {
|
|
744
872
|
reason: t.reason.trim(),
|
|
@@ -747,19 +875,19 @@ function ze(e = {}) {
|
|
|
747
875
|
});
|
|
748
876
|
},
|
|
749
877
|
resumeSubscription(e) {
|
|
750
|
-
return
|
|
878
|
+
return s(G, `/me/subscriptions/${c(e)}/resume`, {
|
|
751
879
|
method: "POST",
|
|
752
880
|
body: {}
|
|
753
881
|
});
|
|
754
882
|
},
|
|
755
883
|
setSubscriptionPaymentMethod(e, t) {
|
|
756
|
-
return
|
|
884
|
+
return s(G, `/me/subscriptions/${c(e)}/payment-method`, {
|
|
757
885
|
method: "PUT",
|
|
758
886
|
body: { payment_method_id: t }
|
|
759
887
|
});
|
|
760
888
|
},
|
|
761
889
|
previewSubscriptionChange(e, t, n) {
|
|
762
|
-
return
|
|
890
|
+
return s(Me, `/me/subscriptions/${c(e)}/change/preview`, {
|
|
763
891
|
method: "POST",
|
|
764
892
|
body: {
|
|
765
893
|
price_id: t.priceId,
|
|
@@ -769,7 +897,7 @@ function ze(e = {}) {
|
|
|
769
897
|
});
|
|
770
898
|
},
|
|
771
899
|
changeSubscription(e, t) {
|
|
772
|
-
return
|
|
900
|
+
return s(Ne, `/me/subscriptions/${c(e)}/change`, {
|
|
773
901
|
method: "POST",
|
|
774
902
|
body: {
|
|
775
903
|
price_id: t.priceId,
|
|
@@ -780,86 +908,136 @@ function ze(e = {}) {
|
|
|
780
908
|
});
|
|
781
909
|
},
|
|
782
910
|
listPaymentMethods(e = {}) {
|
|
783
|
-
return
|
|
784
|
-
query:
|
|
911
|
+
return s(u, "/me/payment-methods", {
|
|
912
|
+
query: p(e, 100),
|
|
785
913
|
signal: e.signal
|
|
786
914
|
});
|
|
787
915
|
},
|
|
788
916
|
addPaymentMethod(e) {
|
|
789
|
-
return
|
|
917
|
+
return s(K, "/me/payment-methods", {
|
|
790
918
|
method: "POST",
|
|
791
919
|
body: e
|
|
792
920
|
});
|
|
793
921
|
},
|
|
794
|
-
|
|
795
|
-
return
|
|
922
|
+
getCart(e) {
|
|
923
|
+
return s(J, "/me/cart", { signal: e });
|
|
924
|
+
},
|
|
925
|
+
setCartLine(e, t = {}) {
|
|
926
|
+
return s(J, `/me/cart/lines/${c(e)}`, {
|
|
927
|
+
method: "PUT",
|
|
928
|
+
body: t
|
|
929
|
+
});
|
|
930
|
+
},
|
|
931
|
+
async clearCart() {
|
|
932
|
+
await o("/me/cart", { method: "DELETE" });
|
|
933
|
+
},
|
|
934
|
+
createOrder(e) {
|
|
935
|
+
return h("/me/orders", {
|
|
796
936
|
method: "POST",
|
|
797
937
|
body: {
|
|
798
|
-
|
|
799
|
-
|
|
938
|
+
...e.cart ? { cart: !0 } : { lines: e.lines ?? [] },
|
|
939
|
+
...e.expectedTotal === void 0 ? {} : { expected_total: e.expectedTotal },
|
|
940
|
+
...e.payment === void 0 ? {} : { payment: e.payment },
|
|
941
|
+
...e.reusable === void 0 ? {} : { reusable: e.reusable }
|
|
800
942
|
},
|
|
801
943
|
headers: { "Idempotency-Key": e.idempotencyKey }
|
|
802
944
|
});
|
|
803
945
|
},
|
|
804
|
-
|
|
805
|
-
return
|
|
946
|
+
getOrder(e, t) {
|
|
947
|
+
return s(q, `/me/orders/${c(e)}`, { signal: t });
|
|
948
|
+
},
|
|
949
|
+
payOrder(e, t) {
|
|
950
|
+
return h(`/me/orders/${c(e)}/pay`, {
|
|
951
|
+
method: "POST",
|
|
952
|
+
body: {
|
|
953
|
+
payment: t.payment,
|
|
954
|
+
expected_total: t.expectedTotal,
|
|
955
|
+
...t.reusable === void 0 ? {} : { reusable: t.reusable }
|
|
956
|
+
},
|
|
957
|
+
headers: { "Idempotency-Key": t.idempotencyKey }
|
|
958
|
+
});
|
|
959
|
+
},
|
|
960
|
+
confirmOrder(e) {
|
|
961
|
+
return h(`/me/orders/${c(e)}/confirm`, {
|
|
962
|
+
method: "POST",
|
|
963
|
+
body: {}
|
|
964
|
+
});
|
|
806
965
|
},
|
|
807
|
-
|
|
808
|
-
return
|
|
966
|
+
confirmPaymentMethod(e) {
|
|
967
|
+
return s(K, `/me/payment-methods/${c(e)}/confirm`, {
|
|
809
968
|
method: "POST",
|
|
810
969
|
body: {}
|
|
811
970
|
});
|
|
812
971
|
},
|
|
813
972
|
getPaymentAuthentication(e) {
|
|
814
|
-
return
|
|
973
|
+
return s(Be, `/me/payment-operations/${c(e)}/authentication`);
|
|
815
974
|
},
|
|
816
975
|
async confirmPaymentAuthentication(e) {
|
|
817
|
-
await
|
|
976
|
+
await o(`/me/payment-operations/${c(e)}/authentication/confirm`, {
|
|
818
977
|
method: "POST",
|
|
819
978
|
body: {}
|
|
820
979
|
});
|
|
821
980
|
},
|
|
822
981
|
async removePaymentMethod(e) {
|
|
823
|
-
return (await
|
|
982
|
+
return (await o(`/me/payment-methods/${c(e)}`, { method: "DELETE" })).status === 202 ? "pending" : "removed";
|
|
824
983
|
},
|
|
825
984
|
async setDefaultPaymentMethod(e) {
|
|
826
|
-
await
|
|
985
|
+
await o(`/me/default-payment-methods/${c(e.currency.toUpperCase())}`, {
|
|
827
986
|
method: "PUT",
|
|
828
987
|
body: { payment_method_id: e.paymentMethodId }
|
|
829
988
|
});
|
|
830
989
|
},
|
|
831
990
|
listPayments(e = {}) {
|
|
832
|
-
return
|
|
991
|
+
return s(d, "/me/payments", {
|
|
833
992
|
query: {
|
|
834
|
-
...
|
|
993
|
+
...p(e, 20),
|
|
835
994
|
rail: e.rail
|
|
836
995
|
},
|
|
837
996
|
signal: e.signal
|
|
838
997
|
});
|
|
839
998
|
},
|
|
840
999
|
listInvoices(e = {}) {
|
|
841
|
-
return
|
|
842
|
-
query:
|
|
1000
|
+
return s(f, "/me/invoices", {
|
|
1001
|
+
query: p(e, 20),
|
|
843
1002
|
signal: e.signal
|
|
844
1003
|
});
|
|
845
1004
|
},
|
|
846
1005
|
getAccount(e) {
|
|
847
|
-
return
|
|
1006
|
+
return s(Ae, "/me", { signal: e });
|
|
848
1007
|
},
|
|
849
1008
|
getInvoice(e, t) {
|
|
850
|
-
return
|
|
1009
|
+
return s(Y, `/me/invoices/${c(e)}`, { signal: t });
|
|
1010
|
+
},
|
|
1011
|
+
async listProducts(e) {
|
|
1012
|
+
return e.keys.length === 0 ? {
|
|
1013
|
+
data: [],
|
|
1014
|
+
next_cursor: null
|
|
1015
|
+
} : s(m, "/catalog/products", {
|
|
1016
|
+
query: { keys: e.keys },
|
|
1017
|
+
signal: e.signal
|
|
1018
|
+
});
|
|
1019
|
+
},
|
|
1020
|
+
getConfig(e) {
|
|
1021
|
+
return s(ze, "/config", {
|
|
1022
|
+
signal: e,
|
|
1023
|
+
anonymous: !0
|
|
1024
|
+
});
|
|
851
1025
|
},
|
|
852
|
-
|
|
853
|
-
|
|
1026
|
+
async listSolanaTokens(e = {}) {
|
|
1027
|
+
let { tokens: t } = await s(Fe, "/solana/tokens", {
|
|
854
1028
|
query: {
|
|
855
|
-
|
|
856
|
-
|
|
1029
|
+
price_id: e.priceId,
|
|
1030
|
+
wallet: e.wallet
|
|
857
1031
|
},
|
|
858
1032
|
signal: e.signal
|
|
859
1033
|
});
|
|
1034
|
+
return t;
|
|
860
1035
|
},
|
|
1036
|
+
currencies: i
|
|
1037
|
+
};
|
|
1038
|
+
return n(g, {
|
|
861
1039
|
createCheckoutSession(e) {
|
|
862
|
-
return !e.priceKey == !e.priceId || !!e.priceKey != !!e.productKey ? Promise.reject(
|
|
1040
|
+
return !e.priceKey == !e.priceId || !!e.priceKey != !!e.productKey ? Promise.reject(M("invalid_request", "Pass priceId, or both productKey and priceKey.")) : s(Ve, "/me/checkout-sessions", {
|
|
863
1041
|
method: "POST",
|
|
864
1042
|
body: {
|
|
865
1043
|
price_key: e.priceKey,
|
|
@@ -872,18 +1050,18 @@ function ze(e = {}) {
|
|
|
872
1050
|
});
|
|
873
1051
|
},
|
|
874
1052
|
checkoutSource(e, t = {}) {
|
|
875
|
-
let n = `/checkout-sessions/${
|
|
1053
|
+
let n = `/checkout-sessions/${c(e)}`, r = t.customerBase?.replace(/\/+$/, ""), i = r === void 0 ? { anonymous: !0 } : { root: r };
|
|
876
1054
|
return {
|
|
877
|
-
getSession: () =>
|
|
1055
|
+
getSession: () => s(O, n, i),
|
|
878
1056
|
async pay(e) {
|
|
879
1057
|
try {
|
|
880
|
-
return await
|
|
1058
|
+
return await s(k, `${n}/pay`, {
|
|
881
1059
|
...i,
|
|
882
1060
|
method: "POST",
|
|
883
1061
|
body: e
|
|
884
1062
|
});
|
|
885
1063
|
} catch (e) {
|
|
886
|
-
if (!
|
|
1064
|
+
if (!j(e)) throw e;
|
|
887
1065
|
switch (e.status) {
|
|
888
1066
|
case 404:
|
|
889
1067
|
case 410: return { status: "expired" };
|
|
@@ -901,31 +1079,14 @@ function ze(e = {}) {
|
|
|
901
1079
|
}
|
|
902
1080
|
}
|
|
903
1081
|
};
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
return o(Ae, "/config", {
|
|
907
|
-
signal: e,
|
|
908
|
-
anonymous: !0
|
|
909
|
-
});
|
|
910
|
-
},
|
|
911
|
-
async listSolanaTokens(e = {}) {
|
|
912
|
-
let { tokens: t } = await o(De, "/solana/tokens", {
|
|
913
|
-
query: {
|
|
914
|
-
price_id: e.priceId,
|
|
915
|
-
wallet: e.wallet
|
|
916
|
-
},
|
|
917
|
-
signal: e.signal
|
|
918
|
-
});
|
|
919
|
-
return t;
|
|
920
|
-
},
|
|
921
|
-
currencies: r
|
|
922
|
-
};
|
|
1082
|
+
}
|
|
1083
|
+
}), g;
|
|
923
1084
|
}
|
|
924
|
-
function
|
|
1085
|
+
function Xe(e) {
|
|
925
1086
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e.toUpperCase(), t]));
|
|
926
1087
|
}
|
|
927
|
-
var
|
|
1088
|
+
var Ze = (e) => e instanceof Z || e instanceof Error && e.name === "WalletRejectedError" || e instanceof A && e.code === "wallet_rejected";
|
|
928
1089
|
//#endregion
|
|
929
|
-
export { ne as A,
|
|
1090
|
+
export { ne as A, g as B, ie as C, O as D, D as E, y as F, r as H, l as I, p as L, x as M, C as N, b as O, T as P, m as R, N as S, E as T, s as V, ue as _, Ye as a, re as b, Ge as c, le as d, I as f, he as g, P as h, Z as i, k as j, w as k, me as l, F as m, He as n, We as o, se as p, Ke as r, Ze as s, Ue as t, pe as u, A as v, v as w, M as x, j as y, h as z };
|
|
930
1091
|
|
|
931
|
-
//# sourceMappingURL=client-
|
|
1092
|
+
//# sourceMappingURL=client-BuvolBPT.js.map
|