@openrails/billing-ui 0.238.0 → 0.240.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 +22 -0
- package/README.md +5 -1
- package/dist/client/client.d.ts +18 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +30 -2
- package/dist/client/generated/wire.d.ts +24 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/types.d.ts +32 -1
- package/dist/{client-Bi_lP_M0.js → client-DgIsTx7x.js} +146 -120
- package/dist/client-DgIsTx7x.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-Bk80rNv8.js → hooks-DivfikJv.js} +2 -2
- package/dist/{hooks-Bk80rNv8.js.map → hooks-DivfikJv.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/client-Bi_lP_M0.js.map +0 -1
|
@@ -166,7 +166,7 @@ function S(e) {
|
|
|
166
166
|
function C(e) {
|
|
167
167
|
return typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= 18;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function te(...e) {
|
|
170
170
|
let t = 0n;
|
|
171
171
|
for (let n of e) {
|
|
172
172
|
let e = x(n);
|
|
@@ -175,22 +175,22 @@ function w(...e) {
|
|
|
175
175
|
}
|
|
176
176
|
return t < y || t > b ? null : t.toString();
|
|
177
177
|
}
|
|
178
|
-
var
|
|
178
|
+
var ne = (() => {
|
|
179
179
|
try {
|
|
180
180
|
return new Intl.NumberFormat("en", { useGrouping: !1 }).format("9007199254740993") === "9007199254740993";
|
|
181
181
|
} catch {
|
|
182
182
|
return !1;
|
|
183
183
|
}
|
|
184
|
-
})(),
|
|
185
|
-
function
|
|
184
|
+
})(), w = 10n ** 15n;
|
|
185
|
+
function T(e, t) {
|
|
186
186
|
let n = e < 0n ? -e : e, r = 10n ** BigInt(t), i = (n % r).toString().padStart(t, "0").replace(/0+$/, "");
|
|
187
187
|
return `${e < 0n ? "-" : ""}${n / r}${i ? `.${i}` : ""}`;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function re(e, t) {
|
|
190
190
|
let n = x(e);
|
|
191
|
-
return n === null || !C(t) ? null :
|
|
191
|
+
return n === null || !C(t) ? null : T(n, t);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function E(e, t, n) {
|
|
194
194
|
let r = x(e);
|
|
195
195
|
if (r === null || !C(t) || !C(n) || n > t) return null;
|
|
196
196
|
let i = 10n ** BigInt(t - n);
|
|
@@ -198,7 +198,7 @@ function re(e, t, n) {
|
|
|
198
198
|
let a = r / i;
|
|
199
199
|
return a > BigInt(2 ** 53 - 1) || a < -BigInt(2 ** 53 - 1) ? null : Number(a);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function ie(e, t) {
|
|
202
202
|
if (!C(t) || e.length > 40) return null;
|
|
203
203
|
let n = /^(-?)(\d+)(?:\.(\d+))?$/.exec(e);
|
|
204
204
|
if (!n) return null;
|
|
@@ -207,11 +207,11 @@ function D(e, t) {
|
|
|
207
207
|
let i = BigInt(n[2]) * 10n ** BigInt(t) + BigInt(r.padEnd(t, "0") || "0"), a = n[1] ? -i : i;
|
|
208
208
|
return a < y || a > b ? null : a.toString();
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function ae(e, t, n, r) {
|
|
211
211
|
let i = t.trim().toUpperCase(), a = x(e);
|
|
212
212
|
if (a === null || !C(n)) return `${i} amount exceeds the exact display range`;
|
|
213
|
-
if (!
|
|
214
|
-
let o =
|
|
213
|
+
if (!ne && (a >= w || a <= -w)) return `${i} amount exceeds this browser's exact display range`;
|
|
214
|
+
let o = T(a, n);
|
|
215
215
|
try {
|
|
216
216
|
return new Intl.NumberFormat(r, {
|
|
217
217
|
style: "currency",
|
|
@@ -224,7 +224,7 @@ function ie(e, t, n, r) {
|
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/client/types.ts
|
|
227
|
-
var
|
|
227
|
+
var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(), k = (t) => e.object({
|
|
228
228
|
data: e.array(t).nullish().transform((e) => e ?? []),
|
|
229
229
|
total: e.number().nullish(),
|
|
230
230
|
limit: e.number().nullish(),
|
|
@@ -245,19 +245,19 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
245
245
|
version: e.number().int().nonnegative().optional(),
|
|
246
246
|
product_id: e.string(),
|
|
247
247
|
archived: e.boolean(),
|
|
248
|
-
unit_amount:
|
|
248
|
+
unit_amount: D,
|
|
249
249
|
customer_amount: e.object({
|
|
250
|
-
min_amount:
|
|
251
|
-
max_amount:
|
|
250
|
+
min_amount: D,
|
|
251
|
+
max_amount: D
|
|
252
252
|
}).nullish(),
|
|
253
253
|
currency: e.string(),
|
|
254
254
|
access_duration_hours: e.number().nullable(),
|
|
255
255
|
billing_interval_hours: e.number().nullable(),
|
|
256
|
-
trial_unit_amount:
|
|
256
|
+
trial_unit_amount: D.nullable(),
|
|
257
257
|
trial_duration_hours: e.number().nullable(),
|
|
258
258
|
psps: e.record(e.string(), M).nullish(),
|
|
259
|
-
created_at:
|
|
260
|
-
updated_at:
|
|
259
|
+
created_at: O,
|
|
260
|
+
updated_at: O
|
|
261
261
|
}), P = e.object({
|
|
262
262
|
id: e.string(),
|
|
263
263
|
key: e.string().nullish(),
|
|
@@ -285,8 +285,8 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
285
285
|
}), L = e.object({
|
|
286
286
|
attempts: e.number(),
|
|
287
287
|
retries_left: e.number().nullish(),
|
|
288
|
-
next_retry_at:
|
|
289
|
-
final_retry_at:
|
|
288
|
+
next_retry_at: O.nullish(),
|
|
289
|
+
final_retry_at: O.nullish(),
|
|
290
290
|
waiting_for_new_card: e.boolean(),
|
|
291
291
|
last_failure_reason: e.string().nullish()
|
|
292
292
|
}), R = e.object({
|
|
@@ -299,19 +299,19 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
299
299
|
psp_id: e.string().nullish(),
|
|
300
300
|
collection_policy: e.string().nullish(),
|
|
301
301
|
payment_method_id: e.string().nullish(),
|
|
302
|
-
started_at:
|
|
303
|
-
ended_at:
|
|
304
|
-
current_period_starts_at:
|
|
305
|
-
current_period_ends_at:
|
|
306
|
-
canceled_at:
|
|
302
|
+
started_at: O.nullish(),
|
|
303
|
+
ended_at: O.nullish(),
|
|
304
|
+
current_period_starts_at: O.nullish(),
|
|
305
|
+
current_period_ends_at: O.nullish(),
|
|
306
|
+
canceled_at: O.nullish(),
|
|
307
307
|
cancel_type: e.string().nullish(),
|
|
308
308
|
resumable: e.boolean().nullish(),
|
|
309
309
|
cancel_scheduled: e.boolean().nullish(),
|
|
310
310
|
cancel_mode: e.string().nullish(),
|
|
311
311
|
cancel_portal_url: e.string().nullish(),
|
|
312
312
|
access: e.object({
|
|
313
|
-
starts_at:
|
|
314
|
-
ends_at:
|
|
313
|
+
starts_at: O,
|
|
314
|
+
ends_at: O.nullish()
|
|
315
315
|
}).nullish(),
|
|
316
316
|
dunning: L.nullish(),
|
|
317
317
|
price: N.nullish(),
|
|
@@ -319,7 +319,7 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
319
319
|
scheduled_change: e.object({
|
|
320
320
|
price_id: e.string(),
|
|
321
321
|
quantity: e.number().nullish(),
|
|
322
|
-
effective_at:
|
|
322
|
+
effective_at: O,
|
|
323
323
|
source: e.string(),
|
|
324
324
|
price: N.nullish(),
|
|
325
325
|
product: P.nullish()
|
|
@@ -327,8 +327,8 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
327
327
|
card: F.nullish(),
|
|
328
328
|
recovery: oe.nullish(),
|
|
329
329
|
next_action: I.nullish(),
|
|
330
|
-
created_at:
|
|
331
|
-
updated_at:
|
|
330
|
+
created_at: O.nullish(),
|
|
331
|
+
updated_at: O.nullish()
|
|
332
332
|
}), z = e.object({
|
|
333
333
|
name: e.string().nullish(),
|
|
334
334
|
email: e.string().nullish(),
|
|
@@ -356,7 +356,7 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
356
356
|
reusable: e.boolean().nullish(),
|
|
357
357
|
health: e.object({
|
|
358
358
|
expiry_status: e.string().nullish(),
|
|
359
|
-
last_charged_at:
|
|
359
|
+
last_charged_at: O.nullish(),
|
|
360
360
|
last_charge_outcome: e.string().nullish(),
|
|
361
361
|
active: e.boolean().nullish()
|
|
362
362
|
}).nullish(),
|
|
@@ -365,7 +365,7 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
365
365
|
display_name: e.string().nullish()
|
|
366
366
|
})).nullish(),
|
|
367
367
|
default_currencies: e.array(e.string()).nullish(),
|
|
368
|
-
created_at:
|
|
368
|
+
created_at: O.nullish()
|
|
369
369
|
}), V = e.object({
|
|
370
370
|
reason: e.string(),
|
|
371
371
|
message: e.string(),
|
|
@@ -377,8 +377,8 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
377
377
|
source: e.string().nullish(),
|
|
378
378
|
description: e.string(),
|
|
379
379
|
quantity: e.number().nullish(),
|
|
380
|
-
unit_amount:
|
|
381
|
-
amount:
|
|
380
|
+
unit_amount: D,
|
|
381
|
+
amount: D,
|
|
382
382
|
billing_interval_hours: e.number().nullish(),
|
|
383
383
|
access_duration_hours: e.number().nullish(),
|
|
384
384
|
subscription_id: e.string().nullish(),
|
|
@@ -390,7 +390,7 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
390
390
|
status: e.string(),
|
|
391
391
|
number: e.string().nullish(),
|
|
392
392
|
currency: e.string(),
|
|
393
|
-
total:
|
|
393
|
+
total: D,
|
|
394
394
|
lines: e.array(H),
|
|
395
395
|
payment: e.object({
|
|
396
396
|
status: e.string(),
|
|
@@ -407,36 +407,36 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
407
407
|
checkout: e.object({
|
|
408
408
|
url: e.string().nullish(),
|
|
409
409
|
ui_mode: e.enum(["hosted", "embedded"]).catch("hosted"),
|
|
410
|
-
expires_at:
|
|
410
|
+
expires_at: O,
|
|
411
411
|
success_url: e.string(),
|
|
412
412
|
cancel_url: e.string().nullish(),
|
|
413
413
|
saved_payment_methods: e.boolean()
|
|
414
414
|
}).nullish(),
|
|
415
415
|
renewal: e.object({
|
|
416
416
|
subscription_id: e.string(),
|
|
417
|
-
period_starts_at:
|
|
418
|
-
period_ends_at:
|
|
419
|
-
due_at:
|
|
417
|
+
period_starts_at: O,
|
|
418
|
+
period_ends_at: O,
|
|
419
|
+
due_at: O
|
|
420
420
|
}).nullish(),
|
|
421
421
|
usage: e.object({
|
|
422
|
-
period_starts_at:
|
|
423
|
-
period_ends_at:
|
|
424
|
-
due_at:
|
|
425
|
-
amount_paid:
|
|
426
|
-
amount_due:
|
|
422
|
+
period_starts_at: O,
|
|
423
|
+
period_ends_at: O,
|
|
424
|
+
due_at: O,
|
|
425
|
+
amount_paid: D,
|
|
426
|
+
amount_due: D,
|
|
427
427
|
collection_method: e.string(),
|
|
428
|
-
next_collection_attempt_at:
|
|
428
|
+
next_collection_attempt_at: O.nullish(),
|
|
429
429
|
po_number: e.string().nullish(),
|
|
430
430
|
memo: e.string().nullish(),
|
|
431
431
|
delinquent: e.boolean()
|
|
432
432
|
}).nullish(),
|
|
433
|
-
expires_at:
|
|
434
|
-
completed_at:
|
|
435
|
-
canceled_at:
|
|
436
|
-
expired_at:
|
|
437
|
-
voided_at:
|
|
438
|
-
uncollectible_at:
|
|
439
|
-
created_at:
|
|
433
|
+
expires_at: O.nullish(),
|
|
434
|
+
completed_at: O.nullish(),
|
|
435
|
+
canceled_at: O.nullish(),
|
|
436
|
+
expired_at: O.nullish(),
|
|
437
|
+
voided_at: O.nullish(),
|
|
438
|
+
uncollectible_at: O.nullish(),
|
|
439
|
+
created_at: O
|
|
440
440
|
}), W = e.object({
|
|
441
441
|
code: e.string(),
|
|
442
442
|
message: e.string(),
|
|
@@ -447,19 +447,19 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
447
447
|
product_id: e.string(),
|
|
448
448
|
description: e.string(),
|
|
449
449
|
quantity: e.number().nullish(),
|
|
450
|
-
unit_amount:
|
|
451
|
-
amount:
|
|
450
|
+
unit_amount: D,
|
|
451
|
+
amount: D,
|
|
452
452
|
ownership: e.string(),
|
|
453
453
|
billing_interval_hours: e.number().nullish(),
|
|
454
454
|
access_duration_hours: e.number().nullish(),
|
|
455
455
|
refusal: W.nullish()
|
|
456
456
|
}), K = e.object({
|
|
457
457
|
currency: e.string(),
|
|
458
|
-
total:
|
|
458
|
+
total: D,
|
|
459
459
|
lines: e.array(G),
|
|
460
460
|
payment_options: U.shape.payment_options,
|
|
461
|
-
last_changed_at:
|
|
462
|
-
expires_at:
|
|
461
|
+
last_changed_at: O.nullish(),
|
|
462
|
+
expires_at: O.nullish()
|
|
463
463
|
}), q = e.object({
|
|
464
464
|
id: e.string(),
|
|
465
465
|
key: e.string(),
|
|
@@ -469,7 +469,7 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
469
469
|
entitlements: e.array(e.string()),
|
|
470
470
|
credit_grant: e.object({
|
|
471
471
|
currency: e.string(),
|
|
472
|
-
amount:
|
|
472
|
+
amount: D.nullish(),
|
|
473
473
|
from_payment: e.boolean().optional(),
|
|
474
474
|
expires_after_days: e.number().int().positive().nullish()
|
|
475
475
|
}).nullish(),
|
|
@@ -477,20 +477,20 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
477
477
|
tier_rank: e.number(),
|
|
478
478
|
archived: e.boolean(),
|
|
479
479
|
prices: e.array(N).nullish().transform((e) => e ?? []),
|
|
480
|
-
created_at:
|
|
481
|
-
updated_at:
|
|
480
|
+
created_at: O,
|
|
481
|
+
updated_at: O
|
|
482
482
|
}), se = e.object({
|
|
483
483
|
id: e.string(),
|
|
484
484
|
kind: e.string(),
|
|
485
485
|
status: e.string(),
|
|
486
|
-
amount:
|
|
487
|
-
amount_refunded:
|
|
486
|
+
amount: D,
|
|
487
|
+
amount_refunded: D.nullish(),
|
|
488
488
|
currency: e.string(),
|
|
489
489
|
subscription_id: e.string().nullish(),
|
|
490
490
|
price_id: e.string().nullish(),
|
|
491
491
|
channel: e.string().nullish(),
|
|
492
492
|
rail: e.string().nullish(),
|
|
493
|
-
created_at:
|
|
493
|
+
created_at: O,
|
|
494
494
|
price: N.nullish(),
|
|
495
495
|
product: P.nullish(),
|
|
496
496
|
card: F.nullish(),
|
|
@@ -499,54 +499,67 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
499
499
|
message: e.string(),
|
|
500
500
|
field: e.string().nullish()
|
|
501
501
|
}).nullish()
|
|
502
|
-
}),
|
|
502
|
+
}), ce = e.object({
|
|
503
503
|
currency: e.string(),
|
|
504
504
|
billing_mode: e.string(),
|
|
505
|
-
balance_amount:
|
|
506
|
-
held_amount:
|
|
507
|
-
accrued_amount:
|
|
508
|
-
available_amount:
|
|
509
|
-
owed_amount:
|
|
510
|
-
accrual_rate_per_hour:
|
|
505
|
+
balance_amount: D,
|
|
506
|
+
held_amount: D,
|
|
507
|
+
accrued_amount: D,
|
|
508
|
+
available_amount: D,
|
|
509
|
+
owed_amount: D,
|
|
510
|
+
accrual_rate_per_hour: D,
|
|
511
511
|
as_of: e.string(),
|
|
512
512
|
depletes_at: e.string().nullable()
|
|
513
|
-
}),
|
|
513
|
+
}), le = e.object({
|
|
514
514
|
id: e.string(),
|
|
515
|
-
balances: e.array(
|
|
515
|
+
balances: e.array(ce),
|
|
516
516
|
default_payment_methods: e.array(e.object({
|
|
517
517
|
currency: e.string(),
|
|
518
518
|
payment_method_id: e.string()
|
|
519
519
|
})),
|
|
520
520
|
unread_notifications: e.number()
|
|
521
|
-
}),
|
|
521
|
+
}), ue = e.object({
|
|
522
|
+
key: e.string(),
|
|
523
|
+
event_count: e.number(),
|
|
524
|
+
amount: D,
|
|
525
|
+
dimensions: e.record(e.string(), e.number()).nullish()
|
|
526
|
+
}), de = e.object({
|
|
527
|
+
customer_id: e.string(),
|
|
528
|
+
currency: e.string(),
|
|
529
|
+
from: O,
|
|
530
|
+
to: O,
|
|
531
|
+
group_by: e.string(),
|
|
532
|
+
rows: e.array(ue),
|
|
533
|
+
next_cursor: e.string().nullish().transform((e) => e ?? null)
|
|
534
|
+
}), fe = e.object({
|
|
522
535
|
code: e.string(),
|
|
523
536
|
decimals: e.number(),
|
|
524
537
|
minor_decimals: e.number().nullish()
|
|
525
|
-
}),
|
|
538
|
+
}), pe = e.object({
|
|
526
539
|
price_id: e.string(),
|
|
527
540
|
quantity: e.number().nullish(),
|
|
528
541
|
rail: e.string().nullish(),
|
|
529
542
|
currency: e.string(),
|
|
530
|
-
amount_due_now:
|
|
531
|
-
next_charge_amount:
|
|
532
|
-
next_charge_date:
|
|
543
|
+
amount_due_now: D,
|
|
544
|
+
next_charge_amount: D,
|
|
545
|
+
next_charge_date: O.nullish(),
|
|
533
546
|
effective: e.string(),
|
|
534
547
|
is_estimate: e.boolean().nullish(),
|
|
535
548
|
message: e.string().nullish()
|
|
536
|
-
}),
|
|
549
|
+
}), J = e.object({
|
|
537
550
|
status: e.string(),
|
|
538
551
|
effective: e.string().nullish(),
|
|
539
552
|
price_id: e.string().nullish(),
|
|
540
553
|
quantity: e.number().nullish(),
|
|
541
554
|
subscription_id: e.string().nullish(),
|
|
542
555
|
next_action: I.nullish(),
|
|
543
|
-
delayed_start:
|
|
556
|
+
delayed_start: O.nullish(),
|
|
544
557
|
currency: e.string().nullish(),
|
|
545
|
-
amount_due_now:
|
|
546
|
-
next_charge_amount:
|
|
547
|
-
next_charge_date:
|
|
558
|
+
amount_due_now: D.nullish(),
|
|
559
|
+
next_charge_amount: D.nullish(),
|
|
560
|
+
next_charge_date: O.nullish(),
|
|
548
561
|
message: e.string().nullish()
|
|
549
|
-
}),
|
|
562
|
+
}), me = e.object({
|
|
550
563
|
psps: e.array(u).nullish().transform((e) => e ?? []),
|
|
551
564
|
solana: e.object({
|
|
552
565
|
network: e.string(),
|
|
@@ -561,51 +574,51 @@ var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(),
|
|
|
561
574
|
recurring_eligible: e.boolean().nullish()
|
|
562
575
|
})).nullish().transform((e) => e ?? [])
|
|
563
576
|
}).nullish()
|
|
564
|
-
}),
|
|
577
|
+
}), he = e.object({
|
|
565
578
|
provider: e.string(),
|
|
566
579
|
site_key: e.string(),
|
|
567
580
|
script_url: e.string(),
|
|
568
581
|
action: e.string(),
|
|
569
582
|
token_header: e.string()
|
|
570
|
-
}),
|
|
583
|
+
}), ge = e.object({
|
|
571
584
|
display_name: e.string(),
|
|
572
585
|
logo_url: e.string().nullish(),
|
|
573
586
|
support_url: e.string().nullish(),
|
|
574
587
|
embed_origins: e.array(e.string()).nullish().transform((e) => e ?? [])
|
|
575
|
-
}),
|
|
588
|
+
}), _e = e.object({
|
|
576
589
|
capabilities: e.object({
|
|
577
590
|
route_groups: e.record(e.string(), e.boolean()),
|
|
578
591
|
features: e.record(e.string(), e.boolean())
|
|
579
592
|
}),
|
|
580
|
-
currencies: e.array(
|
|
581
|
-
captcha:
|
|
593
|
+
currencies: e.array(fe).nullish().transform((e) => e ?? []),
|
|
594
|
+
captcha: he.nullish(),
|
|
582
595
|
network: e.object({
|
|
583
596
|
issuer: e.string(),
|
|
584
597
|
client_id: e.string()
|
|
585
598
|
}).nullish()
|
|
586
|
-
}),
|
|
587
|
-
payment:
|
|
588
|
-
merchant:
|
|
589
|
-
}),
|
|
599
|
+
}), ve = e.object({
|
|
600
|
+
payment: me,
|
|
601
|
+
merchant: ge
|
|
602
|
+
}), ye = e.object({
|
|
590
603
|
id: e.string(),
|
|
591
604
|
nonce: e.string(),
|
|
592
|
-
expires_at:
|
|
593
|
-
}),
|
|
605
|
+
expires_at: O
|
|
606
|
+
}), be = e.object({
|
|
594
607
|
id: e.string(),
|
|
595
608
|
merchant_id: e.string(),
|
|
596
609
|
customer_id: e.string(),
|
|
597
610
|
account_id: e.string(),
|
|
598
611
|
method: e.string(),
|
|
599
612
|
status: e.string(),
|
|
600
|
-
linked_at:
|
|
601
|
-
revoked_at:
|
|
613
|
+
linked_at: O,
|
|
614
|
+
revoked_at: O.nullish(),
|
|
602
615
|
revoked_by: e.string().nullish()
|
|
603
|
-
}),
|
|
616
|
+
}), Y = class extends Error {
|
|
604
617
|
constructor(e = "The wallet request was declined.") {
|
|
605
618
|
super(e), this.name = "WalletRejectedError";
|
|
606
619
|
}
|
|
607
|
-
},
|
|
608
|
-
async function
|
|
620
|
+
}, xe = 4, Se = 500, Ce = (e) => e?.type === "solana_sign_transactions" && !!e.transactions?.length;
|
|
621
|
+
async function X(e, t) {
|
|
609
622
|
let n = "";
|
|
610
623
|
for (let r of e.transactions ?? []) {
|
|
611
624
|
try {
|
|
@@ -618,9 +631,9 @@ async function xe(e, t) {
|
|
|
618
631
|
if (!n) throw i("wallet_no_signature", "The wallet returned no signature.");
|
|
619
632
|
return n;
|
|
620
633
|
}
|
|
621
|
-
var
|
|
622
|
-
function
|
|
623
|
-
let t =
|
|
634
|
+
var we = 2e3, Z = 300;
|
|
635
|
+
function Te(e) {
|
|
636
|
+
let t = Ee(e.headers.get("Retry-After"));
|
|
624
637
|
switch (e.status) {
|
|
625
638
|
case 429: return t;
|
|
626
639
|
case 503: return t ?? Z;
|
|
@@ -629,7 +642,7 @@ function Ce(e) {
|
|
|
629
642
|
default: return null;
|
|
630
643
|
}
|
|
631
644
|
}
|
|
632
|
-
function
|
|
645
|
+
function Ee(e) {
|
|
633
646
|
if (!e) return null;
|
|
634
647
|
if (/^\d+$/.test(e.trim())) return Number(e.trim()) * 1e3;
|
|
635
648
|
let t = Date.parse(e);
|
|
@@ -646,8 +659,8 @@ function Q(e, t) {
|
|
|
646
659
|
t?.addEventListener("abort", a, { once: !0 });
|
|
647
660
|
});
|
|
648
661
|
}
|
|
649
|
-
function
|
|
650
|
-
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), r = e.fetch ?? ((e, t) => fetch(e, t)), o =
|
|
662
|
+
function De(e = {}) {
|
|
663
|
+
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), r = e.fetch ?? ((e, t) => fetch(e, t)), o = Oe({
|
|
651
664
|
...s,
|
|
652
665
|
...e.currencies
|
|
653
666
|
});
|
|
@@ -691,7 +704,7 @@ function Te(e = {}) {
|
|
|
691
704
|
e.getToken.invalidate(o), o = await e.getToken(), i.set("Authorization", `Bearer ${o}`), p = !0, s--;
|
|
692
705
|
continue;
|
|
693
706
|
}
|
|
694
|
-
let m =
|
|
707
|
+
let m = Te(l);
|
|
695
708
|
if (s >= d || m === null || f + m > 2e3) throw await a(l);
|
|
696
709
|
await l.body?.cancel().catch(() => void 0), f += await Q(m, n.signal);
|
|
697
710
|
}
|
|
@@ -710,7 +723,7 @@ function Te(e = {}) {
|
|
|
710
723
|
let d = (e) => encodeURIComponent(e), f = A(R), p = A(B), m = A(se), h = A(U), g = (e, t) => ({
|
|
711
724
|
limit: e.limit ?? t,
|
|
712
725
|
cursor: e.cursor ?? void 0
|
|
713
|
-
}), _ =
|
|
726
|
+
}), _ = k(q);
|
|
714
727
|
async function v(e, t) {
|
|
715
728
|
try {
|
|
716
729
|
return { order: await u(U, e, t) };
|
|
@@ -761,7 +774,7 @@ function Te(e = {}) {
|
|
|
761
774
|
});
|
|
762
775
|
},
|
|
763
776
|
previewSubscriptionChange(e, t, n) {
|
|
764
|
-
return u(
|
|
777
|
+
return u(pe, `/me/subscriptions/${d(e)}/change/preview`, {
|
|
765
778
|
method: "POST",
|
|
766
779
|
body: {
|
|
767
780
|
price_id: t.priceId,
|
|
@@ -771,13 +784,13 @@ function Te(e = {}) {
|
|
|
771
784
|
});
|
|
772
785
|
},
|
|
773
786
|
confirmSubscriptionChange(e) {
|
|
774
|
-
return u(
|
|
787
|
+
return u(J, `/me/subscriptions/${d(e)}/confirm`, {
|
|
775
788
|
method: "POST",
|
|
776
789
|
body: {}
|
|
777
790
|
});
|
|
778
791
|
},
|
|
779
792
|
changeSubscription(e, t) {
|
|
780
|
-
return u(
|
|
793
|
+
return u(J, `/me/subscriptions/${d(e)}/change`, {
|
|
781
794
|
method: "POST",
|
|
782
795
|
body: {
|
|
783
796
|
price_id: t.priceId,
|
|
@@ -880,13 +893,26 @@ function Te(e = {}) {
|
|
|
880
893
|
});
|
|
881
894
|
},
|
|
882
895
|
getAccount(e) {
|
|
883
|
-
return u(
|
|
896
|
+
return u(le, "/me", { signal: e });
|
|
897
|
+
},
|
|
898
|
+
getUsage(e) {
|
|
899
|
+
return u(de, "/me/usage", {
|
|
900
|
+
query: {
|
|
901
|
+
currency: e.currency,
|
|
902
|
+
group_by: e.groupBy,
|
|
903
|
+
from: e.from,
|
|
904
|
+
to: e.to,
|
|
905
|
+
limit: e.limit,
|
|
906
|
+
cursor: e.cursor ?? void 0
|
|
907
|
+
},
|
|
908
|
+
signal: e.signal
|
|
909
|
+
});
|
|
884
910
|
},
|
|
885
911
|
async listProducts(e) {
|
|
886
912
|
return e.keys.length === 0 ? {
|
|
887
913
|
data: [],
|
|
888
914
|
next_cursor: null
|
|
889
|
-
} : u(_, "/
|
|
915
|
+
} : u(_, "/products", {
|
|
890
916
|
query: {
|
|
891
917
|
merchant: e.merchant,
|
|
892
918
|
keys: e.keys
|
|
@@ -896,13 +922,13 @@ function Te(e = {}) {
|
|
|
896
922
|
});
|
|
897
923
|
},
|
|
898
924
|
createNetworkLinkChallenge() {
|
|
899
|
-
return u(
|
|
925
|
+
return u(ye, "/me/network-link/challenges", {
|
|
900
926
|
method: "POST",
|
|
901
927
|
body: {}
|
|
902
928
|
});
|
|
903
929
|
},
|
|
904
930
|
createNetworkLink(e) {
|
|
905
|
-
return u(
|
|
931
|
+
return u(be, "/me/network-link", {
|
|
906
932
|
method: "POST",
|
|
907
933
|
body: {
|
|
908
934
|
challenge_id: e.challengeId,
|
|
@@ -911,22 +937,22 @@ function Te(e = {}) {
|
|
|
911
937
|
});
|
|
912
938
|
},
|
|
913
939
|
getConfig(e) {
|
|
914
|
-
return u(
|
|
940
|
+
return u(_e, "/config", {
|
|
915
941
|
signal: e,
|
|
916
942
|
public: !0
|
|
917
943
|
});
|
|
918
944
|
},
|
|
919
945
|
getCustomerConfig(e) {
|
|
920
|
-
return u(
|
|
946
|
+
return u(ve, "/me/config", { signal: e });
|
|
921
947
|
},
|
|
922
948
|
currencies: o
|
|
923
949
|
};
|
|
924
950
|
}
|
|
925
|
-
function
|
|
951
|
+
function Oe(e) {
|
|
926
952
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e.toUpperCase(), t]));
|
|
927
953
|
}
|
|
928
|
-
var $ = (e) => e instanceof
|
|
954
|
+
var $ = (e) => e instanceof Y || e instanceof Error && e.name === "WalletRejectedError" || e instanceof t && e.code === "wallet_rejected";
|
|
929
955
|
//#endregion
|
|
930
|
-
export { t as C, a as D, i as E, o as O, c as S, r as T, p as _,
|
|
956
|
+
export { t as C, a as D, i as E, o as O, c as S, r as T, p as _, De as a, u as b, X as c, E as d, ie as f, _ as g, v as h, Y as i, te as l, S as m, xe as n, Ce as o, ae as p, we as r, $ as s, Se as t, re as u, g as v, n as w, l as x, d as y };
|
|
931
957
|
|
|
932
|
-
//# sourceMappingURL=client-
|
|
958
|
+
//# sourceMappingURL=client-DgIsTx7x.js.map
|