@openrails/billing-ui 0.246.0 → 0.248.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 +14 -0
- package/dist/account/format.d.ts +6 -3
- package/dist/admin/context.d.ts +6 -6
- package/dist/admin/lib/queries.d.ts +3 -3
- package/dist/{admin-detail-7p684Uyc.js → admin-detail-BHe51ma9.js} +4 -2
- package/dist/admin-detail-BHe51ma9.js.map +1 -0
- package/dist/{admin-detail-5aNNvrc0.js → admin-detail-X82kR2f7.js} +7 -3
- package/dist/admin-detail-X82kR2f7.js.map +1 -0
- package/dist/admin.js +2 -2
- package/dist/client/client.d.ts +12 -1
- package/dist/client/generated/routes.d.ts +34 -0
- package/dist/client/generated/wire.d.ts +77 -5
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +32 -35
- package/dist/{client-CfiKK7wX.js → client-DoRYitD3.js} +136 -111
- package/dist/client-DoRYitD3.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-Cz2L8c8F.js → hooks-DCSelDIZ.js} +25 -10
- package/dist/hooks-DCSelDIZ.js.map +1 -0
- package/dist/index.js +31 -23
- package/dist/index.js.map +1 -1
- package/dist/react/hooks.d.ts +3 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/admin-detail-5aNNvrc0.js.map +0 -1
- package/dist/admin-detail-7p684Uyc.js.map +0 -1
- package/dist/client-CfiKK7wX.js.map +0 -1
- package/dist/hooks-Cz2L8c8F.js.map +0 -1
package/dist/client/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CardEntry } from '../lib/card-entry';
|
|
3
|
+
import type * as wire from "./generated/wire";
|
|
3
4
|
export declare const pageSchema: <T extends z.ZodType>(item: T) => z.ZodObject<{
|
|
4
5
|
data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<T>>>, z.ZodTransform<z.core.output<T>[], z.core.output<T>[] | null | undefined>>;
|
|
5
6
|
total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -349,6 +350,30 @@ export declare const orderSchema: z.ZodObject<{
|
|
|
349
350
|
id: z.ZodString;
|
|
350
351
|
customer_id: z.ZodString;
|
|
351
352
|
origin: z.ZodString;
|
|
353
|
+
collection_owner: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
354
|
+
collection_psp_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
355
|
+
provider_bills: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
356
|
+
psp_id: z.ZodString;
|
|
357
|
+
kind: z.ZodString;
|
|
358
|
+
reference: z.ZodString;
|
|
359
|
+
settlement_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
360
|
+
non_cash_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
361
|
+
settled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
362
|
+
}, z.core.$strip>>>>, z.ZodTransform<{
|
|
363
|
+
psp_id: string;
|
|
364
|
+
kind: string;
|
|
365
|
+
reference: string;
|
|
366
|
+
non_cash_amount: string;
|
|
367
|
+
settlement_source?: string | null | undefined;
|
|
368
|
+
settled_at?: string | null | undefined;
|
|
369
|
+
}[], {
|
|
370
|
+
psp_id: string;
|
|
371
|
+
kind: string;
|
|
372
|
+
reference: string;
|
|
373
|
+
non_cash_amount: string;
|
|
374
|
+
settlement_source?: string | null | undefined;
|
|
375
|
+
settled_at?: string | null | undefined;
|
|
376
|
+
}[] | null | undefined>>;
|
|
352
377
|
status: z.ZodString;
|
|
353
378
|
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
354
379
|
currency: z.ZodString;
|
|
@@ -624,44 +649,10 @@ export declare const paymentSchema: z.ZodObject<{
|
|
|
624
649
|
amount_refunded: z.ZodOptional<z.ZodNullable<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>>;
|
|
625
650
|
currency: z.ZodString;
|
|
626
651
|
subscription_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
627
|
-
|
|
652
|
+
order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
628
653
|
channel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
629
654
|
rail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
630
655
|
created_at: z.ZodString;
|
|
631
|
-
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
632
|
-
id: z.ZodString;
|
|
633
|
-
key: z.ZodString;
|
|
634
|
-
revision: z.ZodOptional<z.ZodNumber>;
|
|
635
|
-
version: z.ZodOptional<z.ZodNumber>;
|
|
636
|
-
product_id: z.ZodString;
|
|
637
|
-
archived: z.ZodBoolean;
|
|
638
|
-
unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
639
|
-
customer_amount: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
640
|
-
min_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
641
|
-
max_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
642
|
-
}, z.core.$strip>>>;
|
|
643
|
-
currency: z.ZodString;
|
|
644
|
-
access_duration_hours: z.ZodNullable<z.ZodNumber>;
|
|
645
|
-
billing_interval_hours: z.ZodNullable<z.ZodNumber>;
|
|
646
|
-
trial_unit_amount: z.ZodNullable<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
|
|
647
|
-
trial_duration_hours: z.ZodNullable<z.ZodNumber>;
|
|
648
|
-
psps: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
649
|
-
status: z.ZodString;
|
|
650
|
-
ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
651
|
-
sync_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
652
|
-
}, z.core.$strip>>>>;
|
|
653
|
-
created_at: z.ZodString;
|
|
654
|
-
updated_at: z.ZodString;
|
|
655
|
-
}, z.core.$strip>>>;
|
|
656
|
-
product: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
657
|
-
id: z.ZodString;
|
|
658
|
-
key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
659
|
-
revision: z.ZodOptional<z.ZodNumber>;
|
|
660
|
-
display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
661
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
662
|
-
tier_group: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
663
|
-
tier_rank: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
664
|
-
}, z.core.$strip>>>;
|
|
665
656
|
card: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
666
657
|
brand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
667
658
|
last4: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -675,6 +666,12 @@ export declare const paymentSchema: z.ZodObject<{
|
|
|
675
666
|
}, z.core.$strip>>>;
|
|
676
667
|
}, z.core.$strip>;
|
|
677
668
|
export type Payment = z.infer<typeof paymentSchema>;
|
|
669
|
+
/**
|
|
670
|
+
* An entitlement key the customer holds through a product. `quantity` is the
|
|
671
|
+
* most seats a held per-seat product grants it; null when none is per seat.
|
|
672
|
+
*/
|
|
673
|
+
export declare const customerEntitlementSchema: z.ZodType<wire.CustomerEntitlement>;
|
|
674
|
+
export type CustomerEntitlement = wire.CustomerEntitlement;
|
|
678
675
|
/**
|
|
679
676
|
* A customer's money in one currency, as of `as_of`. `accrued_amount` is what
|
|
680
677
|
* its running charges have charged and the ledger does not hold yet, already
|
|
@@ -186,11 +186,11 @@ 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 E(e, t) {
|
|
190
190
|
let n = x(e);
|
|
191
191
|
return n === null || !C(t) ? null : T(n, t);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function D(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 E(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 re(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,7 +207,7 @@ function ie(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 ie(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
213
|
if (!ne && (a >= w || a <= -w)) return `${i} amount exceeds this browser's exact display range`;
|
|
@@ -224,7 +224,7 @@ function ae(e, t, n, r) {
|
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/client/types.ts
|
|
227
|
-
var
|
|
227
|
+
var O = e.string().refine(S, "amount must be an int64 string"), k = e.string(), ae = (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 D = e.string().refine(S, "amount must be an int64 string"), O = 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: O,
|
|
249
249
|
customer_amount: e.object({
|
|
250
|
-
min_amount:
|
|
251
|
-
max_amount:
|
|
250
|
+
min_amount: O,
|
|
251
|
+
max_amount: O
|
|
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: O.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: k,
|
|
260
|
+
updated_at: k
|
|
261
261
|
}), P = e.object({
|
|
262
262
|
id: e.string(),
|
|
263
263
|
key: e.string().nullish(),
|
|
@@ -285,8 +285,8 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
285
285
|
}), se = 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: k.nullish(),
|
|
289
|
+
final_retry_at: k.nullish(),
|
|
290
290
|
waiting_for_new_card: e.boolean(),
|
|
291
291
|
last_failure_reason: e.string().nullish()
|
|
292
292
|
}), L = e.object({
|
|
@@ -299,19 +299,19 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = 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: k.nullish(),
|
|
303
|
+
ended_at: k.nullish(),
|
|
304
|
+
current_period_starts_at: k.nullish(),
|
|
305
|
+
current_period_ends_at: k.nullish(),
|
|
306
|
+
canceled_at: k.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: k,
|
|
314
|
+
ends_at: k.nullish()
|
|
315
315
|
}).nullish(),
|
|
316
316
|
dunning: se.nullish(),
|
|
317
317
|
price: N.nullish(),
|
|
@@ -319,7 +319,7 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = 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: k,
|
|
323
323
|
source: e.string(),
|
|
324
324
|
price: N.nullish(),
|
|
325
325
|
product: P.nullish()
|
|
@@ -327,8 +327,8 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = 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: k.nullish(),
|
|
331
|
+
updated_at: k.nullish()
|
|
332
332
|
}), R = e.object({
|
|
333
333
|
name: e.string().nullish(),
|
|
334
334
|
email: e.string().nullish(),
|
|
@@ -356,7 +356,7 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = 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: k.nullish(),
|
|
360
360
|
last_charge_outcome: e.string().nullish(),
|
|
361
361
|
active: e.boolean().nullish()
|
|
362
362
|
}).nullish(),
|
|
@@ -365,7 +365,7 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = 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: k.nullish()
|
|
369
369
|
}), B = e.object({
|
|
370
370
|
reason: e.string(),
|
|
371
371
|
message: e.string(),
|
|
@@ -377,8 +377,8 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = 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: O,
|
|
381
|
+
amount: O,
|
|
382
382
|
billing_interval_hours: e.number().nullish(),
|
|
383
383
|
access_duration_hours: e.number().nullish(),
|
|
384
384
|
subscription_id: e.string().nullish(),
|
|
@@ -387,10 +387,20 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
387
387
|
id: e.string(),
|
|
388
388
|
customer_id: e.string(),
|
|
389
389
|
origin: e.string(),
|
|
390
|
+
collection_owner: e.string().nullish(),
|
|
391
|
+
collection_psp_id: e.string().nullish(),
|
|
392
|
+
provider_bills: e.array(e.object({
|
|
393
|
+
psp_id: e.string(),
|
|
394
|
+
kind: e.string(),
|
|
395
|
+
reference: e.string(),
|
|
396
|
+
settlement_source: e.string().nullish(),
|
|
397
|
+
non_cash_amount: O,
|
|
398
|
+
settled_at: k.nullish()
|
|
399
|
+
})).nullish().transform((e) => e ?? []),
|
|
390
400
|
status: e.string(),
|
|
391
401
|
number: e.string().nullish(),
|
|
392
402
|
currency: e.string(),
|
|
393
|
-
total:
|
|
403
|
+
total: O,
|
|
394
404
|
lines: e.array(V),
|
|
395
405
|
payment: e.object({
|
|
396
406
|
status: e.string(),
|
|
@@ -407,36 +417,36 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
407
417
|
checkout: e.object({
|
|
408
418
|
url: e.string().nullish(),
|
|
409
419
|
ui_mode: e.enum(["hosted", "embedded"]).catch("hosted"),
|
|
410
|
-
expires_at:
|
|
420
|
+
expires_at: k,
|
|
411
421
|
success_url: e.string(),
|
|
412
422
|
cancel_url: e.string().nullish(),
|
|
413
423
|
saved_payment_methods: e.boolean()
|
|
414
424
|
}).nullish(),
|
|
415
425
|
renewal: e.object({
|
|
416
426
|
subscription_id: e.string(),
|
|
417
|
-
period_starts_at:
|
|
418
|
-
period_ends_at:
|
|
419
|
-
due_at:
|
|
427
|
+
period_starts_at: k,
|
|
428
|
+
period_ends_at: k,
|
|
429
|
+
due_at: k
|
|
420
430
|
}).nullish(),
|
|
421
431
|
usage: e.object({
|
|
422
|
-
period_starts_at:
|
|
423
|
-
period_ends_at:
|
|
424
|
-
due_at:
|
|
425
|
-
amount_paid:
|
|
426
|
-
amount_due:
|
|
432
|
+
period_starts_at: k,
|
|
433
|
+
period_ends_at: k,
|
|
434
|
+
due_at: k,
|
|
435
|
+
amount_paid: O,
|
|
436
|
+
amount_due: O,
|
|
427
437
|
collection_method: e.string(),
|
|
428
|
-
next_collection_attempt_at:
|
|
438
|
+
next_collection_attempt_at: k.nullish(),
|
|
429
439
|
po_number: e.string().nullish(),
|
|
430
440
|
memo: e.string().nullish(),
|
|
431
441
|
delinquent: e.boolean()
|
|
432
442
|
}).nullish(),
|
|
433
|
-
expires_at:
|
|
434
|
-
completed_at:
|
|
435
|
-
canceled_at:
|
|
436
|
-
expired_at:
|
|
437
|
-
voided_at:
|
|
438
|
-
uncollectible_at:
|
|
439
|
-
created_at:
|
|
443
|
+
expires_at: k.nullish(),
|
|
444
|
+
completed_at: k.nullish(),
|
|
445
|
+
canceled_at: k.nullish(),
|
|
446
|
+
expired_at: k.nullish(),
|
|
447
|
+
voided_at: k.nullish(),
|
|
448
|
+
uncollectible_at: k.nullish(),
|
|
449
|
+
created_at: k
|
|
440
450
|
}), U = e.object({
|
|
441
451
|
code: e.string(),
|
|
442
452
|
message: e.string(),
|
|
@@ -447,19 +457,19 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
447
457
|
product_id: e.string(),
|
|
448
458
|
description: e.string(),
|
|
449
459
|
quantity: e.number().nullish(),
|
|
450
|
-
unit_amount:
|
|
451
|
-
amount:
|
|
460
|
+
unit_amount: O,
|
|
461
|
+
amount: O,
|
|
452
462
|
ownership: e.string(),
|
|
453
463
|
billing_interval_hours: e.number().nullish(),
|
|
454
464
|
access_duration_hours: e.number().nullish(),
|
|
455
465
|
refusal: U.nullish()
|
|
456
466
|
}), G = e.object({
|
|
457
467
|
currency: e.string(),
|
|
458
|
-
total:
|
|
468
|
+
total: O,
|
|
459
469
|
lines: e.array(W),
|
|
460
470
|
payment_options: H.shape.payment_options,
|
|
461
|
-
last_changed_at:
|
|
462
|
-
expires_at:
|
|
471
|
+
last_changed_at: k.nullish(),
|
|
472
|
+
expires_at: k.nullish()
|
|
463
473
|
}), K = e.object({
|
|
464
474
|
id: e.string(),
|
|
465
475
|
key: e.string(),
|
|
@@ -469,7 +479,7 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
469
479
|
entitlements: e.array(e.string()),
|
|
470
480
|
credit_grant: e.object({
|
|
471
481
|
currency: e.string(),
|
|
472
|
-
amount:
|
|
482
|
+
amount: O.nullish(),
|
|
473
483
|
from_payment: e.boolean().optional(),
|
|
474
484
|
expires_after_days: e.number().int().positive().nullish()
|
|
475
485
|
}).nullish(),
|
|
@@ -477,42 +487,44 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
477
487
|
tier_rank: e.number(),
|
|
478
488
|
archived: e.boolean(),
|
|
479
489
|
prices: e.array(N).nullish().transform((e) => e ?? []),
|
|
480
|
-
created_at:
|
|
481
|
-
updated_at:
|
|
490
|
+
created_at: k,
|
|
491
|
+
updated_at: k
|
|
482
492
|
}), ce = e.object({
|
|
483
493
|
id: e.string(),
|
|
484
494
|
kind: e.string(),
|
|
485
495
|
status: e.string(),
|
|
486
|
-
amount:
|
|
487
|
-
amount_refunded:
|
|
496
|
+
amount: O,
|
|
497
|
+
amount_refunded: O.nullish(),
|
|
488
498
|
currency: e.string(),
|
|
489
499
|
subscription_id: e.string().nullish(),
|
|
490
|
-
|
|
500
|
+
order_id: e.string().nullish(),
|
|
491
501
|
channel: e.string().nullish(),
|
|
492
502
|
rail: e.string().nullish(),
|
|
493
|
-
created_at:
|
|
494
|
-
price: N.nullish(),
|
|
495
|
-
product: P.nullish(),
|
|
503
|
+
created_at: k,
|
|
496
504
|
card: F.nullish(),
|
|
497
505
|
failure: e.object({
|
|
498
506
|
reason: e.string(),
|
|
499
507
|
message: e.string(),
|
|
500
508
|
field: e.string().nullish()
|
|
501
509
|
}).nullish()
|
|
510
|
+
}), q = e.object({
|
|
511
|
+
customer_id: e.string(),
|
|
512
|
+
entitlement: e.string(),
|
|
513
|
+
quantity: e.number().int().nullable()
|
|
502
514
|
}), le = e.object({
|
|
503
515
|
currency: e.string(),
|
|
504
516
|
billing_mode: e.string(),
|
|
505
|
-
balance_amount:
|
|
506
|
-
held_amount:
|
|
507
|
-
accrued_amount:
|
|
508
|
-
available_amount:
|
|
509
|
-
owed_amount:
|
|
510
|
-
accrual_rate_per_hour:
|
|
517
|
+
balance_amount: O,
|
|
518
|
+
held_amount: O,
|
|
519
|
+
accrued_amount: O,
|
|
520
|
+
available_amount: O,
|
|
521
|
+
owed_amount: O,
|
|
522
|
+
accrual_rate_per_hour: O,
|
|
511
523
|
as_of: e.string(),
|
|
512
524
|
depletes_at: e.string().nullable()
|
|
513
|
-
}),
|
|
525
|
+
}), J = e.object({
|
|
514
526
|
currency: e.string(),
|
|
515
|
-
amount:
|
|
527
|
+
amount: O,
|
|
516
528
|
runway_hours: e.number().int(),
|
|
517
529
|
source: e.enum([
|
|
518
530
|
"customer",
|
|
@@ -526,19 +538,19 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
526
538
|
currency: e.string(),
|
|
527
539
|
payment_method_id: e.string()
|
|
528
540
|
})),
|
|
529
|
-
low_balance_lines: e.array(
|
|
541
|
+
low_balance_lines: e.array(J)
|
|
530
542
|
}), de = e.object({
|
|
531
543
|
key: e.string(),
|
|
532
544
|
cell: e.string().nullish(),
|
|
533
545
|
event_count: e.number(),
|
|
534
|
-
amount:
|
|
546
|
+
amount: O,
|
|
535
547
|
quantity: e.number().nullish(),
|
|
536
548
|
dimensions: e.record(e.string(), e.number()).nullish()
|
|
537
549
|
}), fe = e.object({
|
|
538
550
|
customer_id: e.string(),
|
|
539
551
|
currency: e.string(),
|
|
540
|
-
from:
|
|
541
|
-
to:
|
|
552
|
+
from: k,
|
|
553
|
+
to: k,
|
|
542
554
|
group_by: e.string(),
|
|
543
555
|
rows: e.array(de),
|
|
544
556
|
next_cursor: e.string().nullish().transform((e) => e ?? null)
|
|
@@ -551,24 +563,24 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
551
563
|
quantity: e.number().nullish(),
|
|
552
564
|
rail: e.string().nullish(),
|
|
553
565
|
currency: e.string(),
|
|
554
|
-
amount_due_now:
|
|
555
|
-
next_charge_amount:
|
|
556
|
-
next_charge_date:
|
|
566
|
+
amount_due_now: O,
|
|
567
|
+
next_charge_amount: O,
|
|
568
|
+
next_charge_date: k.nullish(),
|
|
557
569
|
effective: e.string(),
|
|
558
570
|
is_estimate: e.boolean().nullish(),
|
|
559
571
|
message: e.string().nullish()
|
|
560
|
-
}),
|
|
572
|
+
}), Y = e.object({
|
|
561
573
|
status: e.string(),
|
|
562
574
|
effective: e.string().nullish(),
|
|
563
575
|
price_id: e.string().nullish(),
|
|
564
576
|
quantity: e.number().nullish(),
|
|
565
577
|
subscription_id: e.string().nullish(),
|
|
566
578
|
next_action: I.nullish(),
|
|
567
|
-
delayed_start:
|
|
579
|
+
delayed_start: k.nullish(),
|
|
568
580
|
currency: e.string().nullish(),
|
|
569
|
-
amount_due_now:
|
|
570
|
-
next_charge_amount:
|
|
571
|
-
next_charge_date:
|
|
581
|
+
amount_due_now: O.nullish(),
|
|
582
|
+
next_charge_amount: O.nullish(),
|
|
583
|
+
next_charge_date: k.nullish(),
|
|
572
584
|
message: e.string().nullish()
|
|
573
585
|
}), he = e.object({
|
|
574
586
|
psps: e.array(u).nullish().transform((e) => e ?? []),
|
|
@@ -613,7 +625,7 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
613
625
|
}), be = e.object({
|
|
614
626
|
id: e.string(),
|
|
615
627
|
nonce: e.string(),
|
|
616
|
-
expires_at:
|
|
628
|
+
expires_at: k
|
|
617
629
|
}), xe = e.object({
|
|
618
630
|
id: e.string(),
|
|
619
631
|
merchant_id: e.string(),
|
|
@@ -621,15 +633,15 @@ var D = e.string().refine(S, "amount must be an int64 string"), O = e.string(),
|
|
|
621
633
|
account_id: e.string(),
|
|
622
634
|
method: e.string(),
|
|
623
635
|
status: e.string(),
|
|
624
|
-
linked_at:
|
|
625
|
-
revoked_at:
|
|
636
|
+
linked_at: k,
|
|
637
|
+
revoked_at: k.nullish(),
|
|
626
638
|
revoked_by: e.string().nullish()
|
|
627
|
-
}),
|
|
639
|
+
}), X = class extends Error {
|
|
628
640
|
constructor(e = "The wallet request was declined.") {
|
|
629
641
|
super(e), this.name = "WalletRejectedError";
|
|
630
642
|
}
|
|
631
|
-
}, Se = 4, Ce = 500,
|
|
632
|
-
async function
|
|
643
|
+
}, Se = 4, Ce = 500, we = (e) => e?.type === "solana_sign_transactions" && !!e.transactions?.length;
|
|
644
|
+
async function Te(e, t) {
|
|
633
645
|
let n = "";
|
|
634
646
|
for (let r of e.transactions ?? []) {
|
|
635
647
|
try {
|
|
@@ -642,9 +654,9 @@ async function we(e, t) {
|
|
|
642
654
|
if (!n) throw i("wallet_no_signature", "The wallet returned no signature.");
|
|
643
655
|
return n;
|
|
644
656
|
}
|
|
645
|
-
var
|
|
646
|
-
function
|
|
647
|
-
let t =
|
|
657
|
+
var Ee = 2e3, Z = 300;
|
|
658
|
+
function De(e) {
|
|
659
|
+
let t = Oe(e.headers.get("Retry-After"));
|
|
648
660
|
switch (e.status) {
|
|
649
661
|
case 429: return t;
|
|
650
662
|
case 503: return t ?? Z;
|
|
@@ -653,7 +665,7 @@ function Ee(e) {
|
|
|
653
665
|
default: return null;
|
|
654
666
|
}
|
|
655
667
|
}
|
|
656
|
-
function
|
|
668
|
+
function Oe(e) {
|
|
657
669
|
if (!e) return null;
|
|
658
670
|
if (/^\d+$/.test(e.trim())) return Number(e.trim()) * 1e3;
|
|
659
671
|
let t = Date.parse(e);
|
|
@@ -670,8 +682,8 @@ function Q(e, t) {
|
|
|
670
682
|
t?.addEventListener("abort", a, { once: !0 });
|
|
671
683
|
});
|
|
672
684
|
}
|
|
673
|
-
function
|
|
674
|
-
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), r = e.fetch ?? ((e, t) => fetch(e, t)), o =
|
|
685
|
+
function ke(e = {}) {
|
|
686
|
+
let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), r = e.fetch ?? ((e, t) => fetch(e, t)), o = Ae({
|
|
675
687
|
...s,
|
|
676
688
|
...e.currencies
|
|
677
689
|
});
|
|
@@ -715,7 +727,7 @@ function Oe(e = {}) {
|
|
|
715
727
|
e.getToken.invalidate(o), o = await e.getToken(), i.set("Authorization", `Bearer ${o}`), p = !0, s--;
|
|
716
728
|
continue;
|
|
717
729
|
}
|
|
718
|
-
let m =
|
|
730
|
+
let m = De(l);
|
|
719
731
|
if (s >= d || m === null || f + m > 2e3) throw await a(l);
|
|
720
732
|
await l.body?.cancel().catch(() => void 0), f += await Q(m, n.signal);
|
|
721
733
|
}
|
|
@@ -731,11 +743,11 @@ function Oe(e = {}) {
|
|
|
731
743
|
if (!o.success) throw i("invalid_response", `${t}: ${o.error.issues[0]?.path.join(".")} ${o.error.issues[0]?.message}`);
|
|
732
744
|
return o.data;
|
|
733
745
|
}
|
|
734
|
-
let d = (e) => encodeURIComponent(e), f = A(L), p = A(z), m = A(ce), h = A(H), g = (e, t) => ({
|
|
746
|
+
let d = (e) => encodeURIComponent(e), f = A(L), p = A(z), m = A(ce), h = A(H), g = A(q), _ = (e, t) => ({
|
|
735
747
|
limit: e.limit ?? t,
|
|
736
748
|
cursor: e.cursor ?? void 0
|
|
737
|
-
}),
|
|
738
|
-
async function
|
|
749
|
+
}), v = ae(K);
|
|
750
|
+
async function y(e, t) {
|
|
739
751
|
try {
|
|
740
752
|
return { order: await u(H, e, t) };
|
|
741
753
|
} catch (e) {
|
|
@@ -755,7 +767,7 @@ function Oe(e = {}) {
|
|
|
755
767
|
return u(f, "/me/subscriptions", {
|
|
756
768
|
query: {
|
|
757
769
|
status: e.status ?? "all",
|
|
758
|
-
...
|
|
770
|
+
..._(e, 100)
|
|
759
771
|
},
|
|
760
772
|
signal: e.signal
|
|
761
773
|
});
|
|
@@ -795,13 +807,13 @@ function Oe(e = {}) {
|
|
|
795
807
|
});
|
|
796
808
|
},
|
|
797
809
|
confirmSubscriptionChange(e) {
|
|
798
|
-
return u(
|
|
810
|
+
return u(Y, `/me/subscriptions/${d(e)}/confirm`, {
|
|
799
811
|
method: "POST",
|
|
800
812
|
body: {}
|
|
801
813
|
});
|
|
802
814
|
},
|
|
803
815
|
changeSubscription(e, t) {
|
|
804
|
-
return u(
|
|
816
|
+
return u(Y, `/me/subscriptions/${d(e)}/change`, {
|
|
805
817
|
method: "POST",
|
|
806
818
|
body: {
|
|
807
819
|
price_id: t.priceId,
|
|
@@ -813,7 +825,7 @@ function Oe(e = {}) {
|
|
|
813
825
|
},
|
|
814
826
|
listPaymentMethods(e = {}) {
|
|
815
827
|
return u(p, "/me/payment-methods", {
|
|
816
|
-
query:
|
|
828
|
+
query: _(e, 100),
|
|
817
829
|
signal: e.signal
|
|
818
830
|
});
|
|
819
831
|
},
|
|
@@ -837,7 +849,7 @@ function Oe(e = {}) {
|
|
|
837
849
|
await l("/me/cart", { method: "DELETE" });
|
|
838
850
|
},
|
|
839
851
|
createOrder(e) {
|
|
840
|
-
return
|
|
852
|
+
return y("/me/orders", {
|
|
841
853
|
method: "POST",
|
|
842
854
|
body: {
|
|
843
855
|
...e.cart ? { cart: !0 } : { lines: e.lines ?? [] },
|
|
@@ -849,9 +861,12 @@ function Oe(e = {}) {
|
|
|
849
861
|
});
|
|
850
862
|
},
|
|
851
863
|
listOrders(e = {}) {
|
|
852
|
-
return u(h, "/me/orders", {
|
|
864
|
+
return e.ids?.length ? u(h, "/me/orders", {
|
|
865
|
+
query: { ids: e.ids.join(",") },
|
|
866
|
+
signal: e.signal
|
|
867
|
+
}) : u(h, "/me/orders", {
|
|
853
868
|
query: {
|
|
854
|
-
...
|
|
869
|
+
..._(e, 20),
|
|
855
870
|
origin: e.origin,
|
|
856
871
|
status: e.status,
|
|
857
872
|
subscription_id: e.subscriptionId,
|
|
@@ -864,7 +879,7 @@ function Oe(e = {}) {
|
|
|
864
879
|
return u(H, `/me/orders/${d(e)}`, { signal: t });
|
|
865
880
|
},
|
|
866
881
|
payOrder(e, t) {
|
|
867
|
-
return
|
|
882
|
+
return y(`/me/orders/${d(e)}/pay`, {
|
|
868
883
|
method: "POST",
|
|
869
884
|
body: {
|
|
870
885
|
payment: t.payment,
|
|
@@ -875,7 +890,7 @@ function Oe(e = {}) {
|
|
|
875
890
|
});
|
|
876
891
|
},
|
|
877
892
|
confirmOrder(e, t) {
|
|
878
|
-
return
|
|
893
|
+
return y(`/me/orders/${d(e)}/confirm`, {
|
|
879
894
|
method: "POST",
|
|
880
895
|
body: t?.signature ? { signature: t.signature } : {}
|
|
881
896
|
});
|
|
@@ -898,17 +913,27 @@ function Oe(e = {}) {
|
|
|
898
913
|
listPayments(e = {}) {
|
|
899
914
|
return u(m, "/me/payments", {
|
|
900
915
|
query: {
|
|
901
|
-
...
|
|
916
|
+
..._(e, 20),
|
|
902
917
|
rail: e.rail
|
|
903
918
|
},
|
|
904
919
|
signal: e.signal
|
|
905
920
|
});
|
|
906
921
|
},
|
|
922
|
+
getEntitlements(e = {}) {
|
|
923
|
+
return u(g, "/me/entitlements", {
|
|
924
|
+
query: {
|
|
925
|
+
..._(e, 500),
|
|
926
|
+
at: e.at,
|
|
927
|
+
prefix: e.prefix
|
|
928
|
+
},
|
|
929
|
+
signal: e.signal
|
|
930
|
+
});
|
|
931
|
+
},
|
|
907
932
|
getAccount(e) {
|
|
908
933
|
return u(ue, "/me", { signal: e });
|
|
909
934
|
},
|
|
910
935
|
setLowBalanceLine(e) {
|
|
911
|
-
return u(
|
|
936
|
+
return u(J, `/me/low-balance-lines/${d(e.currency.toUpperCase())}`, {
|
|
912
937
|
method: "PUT",
|
|
913
938
|
body: {
|
|
914
939
|
amount: e.amount,
|
|
@@ -933,7 +958,7 @@ function Oe(e = {}) {
|
|
|
933
958
|
return e.keys.length === 0 ? {
|
|
934
959
|
data: [],
|
|
935
960
|
next_cursor: null
|
|
936
|
-
} : u(
|
|
961
|
+
} : u(v, "/products", {
|
|
937
962
|
query: {
|
|
938
963
|
merchant: e.merchant,
|
|
939
964
|
keys: e.keys
|
|
@@ -969,11 +994,11 @@ function Oe(e = {}) {
|
|
|
969
994
|
currencies: o
|
|
970
995
|
};
|
|
971
996
|
}
|
|
972
|
-
function
|
|
997
|
+
function Ae(e) {
|
|
973
998
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e.toUpperCase(), t]));
|
|
974
999
|
}
|
|
975
|
-
var $ = (e) => e instanceof
|
|
1000
|
+
var $ = (e) => e instanceof X || e instanceof Error && e.name === "WalletRejectedError" || e instanceof t && e.code === "wallet_rejected";
|
|
976
1001
|
//#endregion
|
|
977
|
-
export { t as C, a as D, i as E, o as O, c as S, r as T, p as _,
|
|
1002
|
+
export { t as C, a as D, i as E, o as O, c as S, r as T, p as _, ke as a, u as b, Te as c, D as d, re as f, _ as g, v as h, X as i, te as l, S as m, Se as n, we as o, ie as p, Ee as r, $ as s, Ce as t, E as u, g as v, n as w, l as x, d as y };
|
|
978
1003
|
|
|
979
|
-
//# sourceMappingURL=client-
|
|
1004
|
+
//# sourceMappingURL=client-DoRYitD3.js.map
|