@openrails/billing-ui 0.233.2 → 0.235.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +18 -14
  3. package/dist/account/account-billing.d.ts +6 -3
  4. package/dist/account/change-card-dialog.d.ts +5 -2
  5. package/dist/account/payment-methods-panel.d.ts +6 -3
  6. package/dist/client/client.d.ts +33 -17
  7. package/dist/client/errors.d.ts +1 -4
  8. package/dist/client/generated/error-codes.d.ts +1 -1
  9. package/dist/client/generated/routes.d.ts +150 -147
  10. package/dist/client/generated/wire.d.ts +204 -49
  11. package/dist/client/index.d.ts +2 -2
  12. package/dist/client/types.d.ts +131 -42
  13. package/dist/{client-DXUPzA8C.js → client-BpzCZes3.js} +93 -51
  14. package/dist/client-BpzCZes3.js.map +1 -0
  15. package/dist/client.js +1 -1
  16. package/dist/{config-BQELtBh4.js → config-qLcHvK0Q.js} +13 -13
  17. package/dist/config-qLcHvK0Q.js.map +1 -0
  18. package/dist/i18n/context.d.ts +1 -1
  19. package/dist/i18n/messages.d.ts +1 -1
  20. package/dist/index.js +184 -177
  21. package/dist/index.js.map +1 -1
  22. package/dist/locales/de.js +5 -4
  23. package/dist/locales/de.js.map +1 -1
  24. package/dist/locales/en.d.ts +5 -4
  25. package/dist/locales/en.js +5 -4
  26. package/dist/locales/en.js.map +1 -1
  27. package/dist/locales/es.js +5 -4
  28. package/dist/locales/es.js.map +1 -1
  29. package/dist/locales/ja.js +5 -4
  30. package/dist/locales/ja.js.map +1 -1
  31. package/dist/locales/ko.js +5 -4
  32. package/dist/locales/ko.js.map +1 -1
  33. package/dist/locales/zh.js +5 -4
  34. package/dist/locales/zh.js.map +1 -1
  35. package/dist/react/context.d.ts +6 -5
  36. package/dist/react/hooks.d.ts +10 -10
  37. package/dist/react.js +1 -1
  38. package/dist/styles.css +1 -1
  39. package/package.json +2 -2
  40. package/dist/client-DXUPzA8C.js.map +0 -1
  41. package/dist/config-BQELtBh4.js.map +0 -1
@@ -43,6 +43,7 @@ export declare const priceSchema: z.ZodObject<{
43
43
  id: z.ZodString;
44
44
  key: z.ZodString;
45
45
  revision: z.ZodOptional<z.ZodNumber>;
46
+ version: z.ZodOptional<z.ZodNumber>;
46
47
  product_id: z.ZodString;
47
48
  archived: z.ZodBoolean;
48
49
  unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
@@ -109,13 +110,30 @@ export declare const nextActionSchema: z.ZodObject<{
109
110
  transactions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
110
111
  }, z.core.$strip>;
111
112
  export type NextAction = z.infer<typeof nextActionSchema>;
113
+ /**
114
+ * A declined renewal being collected. `retries_left` and `final_retry_at`
115
+ * follow the merchant's dunning policy; both are null when the provider runs
116
+ * the retries. While `waiting_for_new_card`, nothing is charged until the card
117
+ * is replaced, and the subscription ends at `final_retry_at`.
118
+ */
119
+ export declare const subscriptionDunningSchema: z.ZodObject<{
120
+ attempts: z.ZodNumber;
121
+ retries_left: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
122
+ next_retry_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ final_retry_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
+ waiting_for_new_card: z.ZodBoolean;
125
+ last_failure_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ }, z.core.$strip>;
127
+ export type SubscriptionDunning = z.infer<typeof subscriptionDunningSchema>;
112
128
  export declare const subscriptionSchema: z.ZodObject<{
113
129
  id: z.ZodString;
114
130
  status: z.ZodString;
115
131
  rail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
132
  product_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
133
  price_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
118
135
  psp_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ collection_policy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
137
  payment_method_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
138
  started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
139
  ended_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -131,12 +149,19 @@ export declare const subscriptionSchema: z.ZodObject<{
131
149
  starts_at: z.ZodString;
132
150
  ends_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
151
  }, z.core.$strip>>>;
134
- grace_ends_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
- next_retry_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
+ dunning: z.ZodOptional<z.ZodNullable<z.ZodObject<{
153
+ attempts: z.ZodNumber;
154
+ retries_left: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
155
+ next_retry_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
156
+ final_retry_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
157
+ waiting_for_new_card: z.ZodBoolean;
158
+ last_failure_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
159
+ }, z.core.$strip>>>;
136
160
  price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
137
161
  id: z.ZodString;
138
162
  key: z.ZodString;
139
163
  revision: z.ZodOptional<z.ZodNumber>;
164
+ version: z.ZodOptional<z.ZodNumber>;
140
165
  product_id: z.ZodString;
141
166
  archived: z.ZodBoolean;
142
167
  unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
@@ -166,38 +191,45 @@ export declare const subscriptionSchema: z.ZodObject<{
166
191
  tier_group: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
192
  tier_rank: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
168
193
  }, z.core.$strip>>>;
169
- scheduled_price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
170
- id: z.ZodString;
171
- key: z.ZodString;
172
- revision: z.ZodOptional<z.ZodNumber>;
173
- product_id: z.ZodString;
174
- archived: z.ZodBoolean;
175
- unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
176
- customer_amount: z.ZodOptional<z.ZodNullable<z.ZodObject<{
177
- min_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
178
- max_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
194
+ scheduled_change: z.ZodOptional<z.ZodNullable<z.ZodObject<{
195
+ price_id: z.ZodString;
196
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
197
+ effective_at: z.ZodString;
198
+ source: z.ZodString;
199
+ price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
200
+ id: z.ZodString;
201
+ key: z.ZodString;
202
+ revision: z.ZodOptional<z.ZodNumber>;
203
+ version: z.ZodOptional<z.ZodNumber>;
204
+ product_id: z.ZodString;
205
+ archived: z.ZodBoolean;
206
+ unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
207
+ customer_amount: z.ZodOptional<z.ZodNullable<z.ZodObject<{
208
+ min_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
209
+ max_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
210
+ }, z.core.$strip>>>;
211
+ currency: z.ZodString;
212
+ access_duration_hours: z.ZodNullable<z.ZodNumber>;
213
+ billing_interval_hours: z.ZodNullable<z.ZodNumber>;
214
+ trial_unit_amount: z.ZodNullable<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
215
+ trial_duration_hours: z.ZodNullable<z.ZodNumber>;
216
+ psps: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
217
+ status: z.ZodString;
218
+ ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
219
+ sync_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
220
+ }, z.core.$strip>>>>;
221
+ created_at: z.ZodString;
222
+ updated_at: z.ZodString;
223
+ }, z.core.$strip>>>;
224
+ product: z.ZodOptional<z.ZodNullable<z.ZodObject<{
225
+ id: z.ZodString;
226
+ key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
227
+ revision: z.ZodOptional<z.ZodNumber>;
228
+ display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
230
+ tier_group: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
+ tier_rank: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
179
232
  }, z.core.$strip>>>;
180
- currency: z.ZodString;
181
- access_duration_hours: z.ZodNullable<z.ZodNumber>;
182
- billing_interval_hours: z.ZodNullable<z.ZodNumber>;
183
- trial_unit_amount: z.ZodNullable<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
184
- trial_duration_hours: z.ZodNullable<z.ZodNumber>;
185
- psps: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
186
- status: z.ZodString;
187
- ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
188
- sync_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
189
- }, z.core.$strip>>>>;
190
- created_at: z.ZodString;
191
- updated_at: z.ZodString;
192
- }, z.core.$strip>>>;
193
- scheduled_product: z.ZodOptional<z.ZodNullable<z.ZodObject<{
194
- id: z.ZodString;
195
- key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
- revision: z.ZodOptional<z.ZodNumber>;
197
- display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
198
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
- tier_group: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
- tier_rank: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
201
233
  }, z.core.$strip>>>;
202
234
  card: z.ZodOptional<z.ZodNullable<z.ZodObject<{
203
235
  brand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -274,7 +306,7 @@ export declare const paymentMethodSchema: z.ZodObject<{
274
306
  id: z.ZodString;
275
307
  display_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
308
  }, z.core.$strip>>>>;
277
- collection_currencies: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
309
+ default_currencies: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
278
310
  created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
279
311
  }, z.core.$strip>;
280
312
  export type PaymentMethod = z.infer<typeof paymentMethodSchema>;
@@ -299,6 +331,7 @@ export declare const productSchema: z.ZodObject<{
299
331
  id: z.ZodString;
300
332
  key: z.ZodString;
301
333
  revision: z.ZodOptional<z.ZodNumber>;
334
+ version: z.ZodOptional<z.ZodNumber>;
302
335
  product_id: z.ZodString;
303
336
  archived: z.ZodBoolean;
304
337
  unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
@@ -332,6 +365,7 @@ export declare const productSchema: z.ZodObject<{
332
365
  created_at: string;
333
366
  updated_at: string;
334
367
  revision?: number | undefined;
368
+ version?: number | undefined;
335
369
  customer_amount?: {
336
370
  min_amount: string;
337
371
  max_amount: string;
@@ -355,6 +389,7 @@ export declare const productSchema: z.ZodObject<{
355
389
  created_at: string;
356
390
  updated_at: string;
357
391
  revision?: number | undefined;
392
+ version?: number | undefined;
358
393
  customer_amount?: {
359
394
  min_amount: string;
360
395
  max_amount: string;
@@ -385,6 +420,7 @@ export declare const paymentSchema: z.ZodObject<{
385
420
  id: z.ZodString;
386
421
  key: z.ZodString;
387
422
  revision: z.ZodOptional<z.ZodNumber>;
423
+ version: z.ZodOptional<z.ZodNumber>;
388
424
  product_id: z.ZodString;
389
425
  archived: z.ZodBoolean;
390
426
  unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
@@ -427,6 +463,37 @@ export declare const paymentSchema: z.ZodObject<{
427
463
  }, z.core.$strip>>>;
428
464
  }, z.core.$strip>;
429
465
  export type Payment = z.infer<typeof paymentSchema>;
466
+ /** A customer's money in one currency. */
467
+ export declare const balanceSchema: z.ZodObject<{
468
+ currency: z.ZodString;
469
+ billing_mode: z.ZodString;
470
+ balance_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
471
+ held_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
472
+ available_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
473
+ owed_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
474
+ }, z.core.$strip>;
475
+ export type Balance = z.infer<typeof balanceSchema>;
476
+ /**
477
+ * The signed-in customer's summary (`GET /me`): money per currency, the
478
+ * default card of each currency, and how many notices are unread.
479
+ */
480
+ export declare const accountSchema: z.ZodObject<{
481
+ id: z.ZodString;
482
+ balances: z.ZodArray<z.ZodObject<{
483
+ currency: z.ZodString;
484
+ billing_mode: z.ZodString;
485
+ balance_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
486
+ held_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
487
+ available_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
488
+ owed_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
489
+ }, z.core.$strip>>;
490
+ default_payment_methods: z.ZodArray<z.ZodObject<{
491
+ currency: z.ZodString;
492
+ payment_method_id: z.ZodString;
493
+ }, z.core.$strip>>;
494
+ unread_notifications: z.ZodNumber;
495
+ }, z.core.$strip>;
496
+ export type Account = z.infer<typeof accountSchema>;
430
497
  export declare const invoiceSchema: z.ZodObject<{
431
498
  id: z.ZodString;
432
499
  currency: z.ZodString;
@@ -439,6 +506,7 @@ export declare const invoiceSchema: z.ZodObject<{
439
506
  status: z.ZodString;
440
507
  issued_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
441
508
  due_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
509
+ delinquent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
442
510
  paid_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
443
511
  recovery: z.ZodOptional<z.ZodNullable<z.ZodObject<{
444
512
  last_failure_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -460,9 +528,9 @@ export declare const currencySchema: z.ZodObject<{
460
528
  minor_decimals: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
461
529
  }, z.core.$strip>;
462
530
  export type Currency = z.infer<typeof currencySchema>;
463
- export declare const tierChangePreviewSchema: z.ZodObject<{
464
- action: z.ZodString;
531
+ export declare const subscriptionChangePreviewSchema: z.ZodObject<{
465
532
  price_id: z.ZodString;
533
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
466
534
  rail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
467
535
  currency: z.ZodString;
468
536
  amount_due_now: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
@@ -472,12 +540,12 @@ export declare const tierChangePreviewSchema: z.ZodObject<{
472
540
  is_estimate: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
473
541
  message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
474
542
  }, z.core.$strip>;
475
- export type TierChangePreview = z.infer<typeof tierChangePreviewSchema>;
476
- export declare const tierChangeSchema: z.ZodObject<{
543
+ export type SubscriptionChangePreview = z.infer<typeof subscriptionChangePreviewSchema>;
544
+ export declare const subscriptionChangeSchema: z.ZodObject<{
477
545
  status: z.ZodString;
478
- action: z.ZodOptional<z.ZodNullable<z.ZodString>>;
479
546
  effective: z.ZodOptional<z.ZodNullable<z.ZodString>>;
480
547
  price_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
548
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
481
549
  subscription_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
482
550
  next_action: z.ZodOptional<z.ZodNullable<z.ZodObject<{
483
551
  type: z.ZodString;
@@ -494,7 +562,7 @@ export declare const tierChangeSchema: z.ZodObject<{
494
562
  message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
495
563
  operation_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
496
564
  }, z.core.$strip>;
497
- export type TierChange = z.infer<typeof tierChangeSchema>;
565
+ export type SubscriptionChange = z.infer<typeof subscriptionChangeSchema>;
498
566
  export declare const solanaTokenSchema: z.ZodObject<{
499
567
  symbol: z.ZodString;
500
568
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -657,10 +725,24 @@ export declare const paymentConfigSchema: z.ZodObject<{
657
725
  }, z.core.$strip>>>;
658
726
  }, z.core.$strip>;
659
727
  export type PaymentConfig = z.infer<typeof paymentConfigSchema>;
728
+ /**
729
+ * The challenge to solve when a request answers 403 `captcha_required`: load
730
+ * `script_url`, solve with `site_key` and `action`, and resend the request
731
+ * with the token in the `token_header` header.
732
+ */
733
+ export declare const captchaConfigSchema: z.ZodObject<{
734
+ provider: z.ZodString;
735
+ site_key: z.ZodString;
736
+ script_url: z.ZodString;
737
+ action: z.ZodString;
738
+ token_header: z.ZodString;
739
+ }, z.core.$strip>;
740
+ export type CaptchaConfig = z.infer<typeof captchaConfigSchema>;
660
741
  /**
661
742
  * What a browser needs to know about the deployment and its merchant
662
- * (`GET /config`): the mount's capabilities, the currency registry and the
663
- * merchant's payment setup (null when the request resolves no merchant).
743
+ * (`GET /config`): the mount's capabilities, the currency registry, the
744
+ * merchant's payment setup (null when the request resolves no merchant) and
745
+ * the captcha (null when the deployment challenges nobody).
664
746
  */
665
747
  export declare const publicConfigSchema: z.ZodObject<{
666
748
  capabilities: z.ZodObject<{
@@ -743,6 +825,13 @@ export declare const publicConfigSchema: z.ZodObject<{
743
825
  }[] | null | undefined>>;
744
826
  }, z.core.$strip>>>;
745
827
  }, z.core.$strip>>>;
828
+ captcha: z.ZodOptional<z.ZodNullable<z.ZodObject<{
829
+ provider: z.ZodString;
830
+ site_key: z.ZodString;
831
+ script_url: z.ZodString;
832
+ action: z.ZodString;
833
+ token_header: z.ZodString;
834
+ }, z.core.$strip>>>;
746
835
  }, z.core.$strip>;
747
836
  export type PublicConfig = z.infer<typeof publicConfigSchema>;
748
837
  /** An in-page card setup; `payment_method_id` is set once the card is saved. */
@@ -342,6 +342,7 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
342
342
  id: e.string(),
343
343
  key: e.string(),
344
344
  revision: e.number().int().nonnegative().optional(),
345
+ version: e.number().int().nonnegative().optional(),
345
346
  product_id: e.string(),
346
347
  archived: e.boolean(),
347
348
  unit_amount: P,
@@ -382,13 +383,22 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
382
383
  type: e.string(),
383
384
  redirect_to_url: e.object({ url: e.string().nullish() }).nullish(),
384
385
  transactions: e.array(e.string()).nullish()
386
+ }), _e = e.object({
387
+ attempts: e.number(),
388
+ retries_left: e.number().nullish(),
389
+ next_retry_at: F.nullish(),
390
+ final_retry_at: F.nullish(),
391
+ waiting_for_new_card: e.boolean(),
392
+ last_failure_reason: e.string().nullish()
385
393
  }), W = e.object({
386
394
  id: e.string(),
387
395
  status: L,
388
396
  rail: e.string().nullish(),
389
397
  product_id: e.string().nullish(),
390
398
  price_id: e.string().nullish(),
399
+ quantity: e.number().nullish(),
391
400
  psp_id: e.string().nullish(),
401
+ collection_policy: e.string().nullish(),
392
402
  payment_method_id: e.string().nullish(),
393
403
  started_at: F.nullish(),
394
404
  ended_at: F.nullish(),
@@ -404,18 +414,23 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
404
414
  starts_at: F,
405
415
  ends_at: F.nullish()
406
416
  }).nullish(),
407
- grace_ends_at: F.nullish(),
408
- next_retry_at: F.nullish(),
417
+ dunning: _e.nullish(),
409
418
  price: z.nullish(),
410
419
  product: B.nullish(),
411
- scheduled_price: z.nullish(),
412
- scheduled_product: B.nullish(),
420
+ scheduled_change: e.object({
421
+ price_id: e.string(),
422
+ quantity: e.number().nullish(),
423
+ effective_at: F,
424
+ source: e.string(),
425
+ price: z.nullish(),
426
+ product: B.nullish()
427
+ }).nullish(),
413
428
  card: V.nullish(),
414
429
  recovery: H.nullish(),
415
430
  next_action: U.nullish(),
416
431
  created_at: F.nullish(),
417
432
  updated_at: F.nullish()
418
- }), _e = e.object({
433
+ }), ve = e.object({
419
434
  name: e.string().nullish(),
420
435
  email: e.string().nullish(),
421
436
  phone: e.string().nullish(),
@@ -432,7 +447,7 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
432
447
  rail: e.string().nullish(),
433
448
  psp_id: e.string().nullish(),
434
449
  card: V.nullish(),
435
- billing_details: _e.nullish(),
450
+ billing_details: ve.nullish(),
436
451
  health: e.object({
437
452
  expiry_status: e.string().nullish(),
438
453
  last_charged_at: F.nullish(),
@@ -443,9 +458,9 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
443
458
  id: e.string(),
444
459
  display_name: e.string().nullish()
445
460
  })).nullish(),
446
- collection_currencies: e.array(e.string()).nullish(),
461
+ default_currencies: e.array(e.string()).nullish(),
447
462
  created_at: F.nullish()
448
- }), ve = e.object({
463
+ }), ye = e.object({
449
464
  id: e.string(),
450
465
  key: e.string(),
451
466
  revision: e.number().int().nonnegative().optional(),
@@ -464,7 +479,7 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
464
479
  prices: e.array(z).nullish().transform((e) => e ?? []),
465
480
  created_at: F,
466
481
  updated_at: F
467
- }), ye = e.object({
482
+ }), be = e.object({
468
483
  id: e.string(),
469
484
  kind: e.string(),
470
485
  status: e.string(),
@@ -484,6 +499,21 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
484
499
  message: e.string(),
485
500
  field: e.string().nullish()
486
501
  }).nullish()
502
+ }), xe = e.object({
503
+ currency: e.string(),
504
+ billing_mode: e.string(),
505
+ balance_amount: P,
506
+ held_amount: P,
507
+ available_amount: P,
508
+ owed_amount: P
509
+ }), Se = e.object({
510
+ id: e.string(),
511
+ balances: e.array(xe),
512
+ default_payment_methods: e.array(e.object({
513
+ currency: e.string(),
514
+ payment_method_id: e.string()
515
+ })),
516
+ unread_notifications: e.number()
487
517
  }), K = e.object({
488
518
  id: e.string(),
489
519
  currency: e.string(),
@@ -496,16 +526,17 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
496
526
  status: e.string(),
497
527
  issued_at: F.nullish(),
498
528
  due_at: F.nullish(),
529
+ delinquent: e.boolean().nullish(),
499
530
  paid_at: F.nullish(),
500
531
  recovery: H.nullish(),
501
532
  created_at: F
502
- }), be = e.object({
533
+ }), Ce = e.object({
503
534
  code: e.string(),
504
535
  decimals: e.number(),
505
536
  minor_decimals: e.number().nullish()
506
- }), xe = e.object({
507
- action: e.string(),
537
+ }), we = e.object({
508
538
  price_id: e.string(),
539
+ quantity: e.number().nullish(),
509
540
  rail: e.string().nullish(),
510
541
  currency: e.string(),
511
542
  amount_due_now: P,
@@ -514,11 +545,11 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
514
545
  effective: e.string(),
515
546
  is_estimate: e.boolean().nullish(),
516
547
  message: e.string().nullish()
517
- }), Se = e.object({
548
+ }), Te = e.object({
518
549
  status: e.string(),
519
- action: e.string().nullish(),
520
550
  effective: e.string().nullish(),
521
551
  price_id: e.string().nullish(),
552
+ quantity: e.number().nullish(),
522
553
  subscription_id: e.string().nullish(),
523
554
  next_action: U.nullish(),
524
555
  delayed_start: F.nullish(),
@@ -528,7 +559,7 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
528
559
  next_charge_date: F.nullish(),
529
560
  message: e.string().nullish(),
530
561
  operation_id: e.string().nullish()
531
- }), q = e.string().regex(/^\d+$/, "units must be a uint64 string"), Ce = e.object({
562
+ }), q = e.string().regex(/^\d+$/, "units must be a uint64 string"), Ee = e.object({
532
563
  symbol: e.string(),
533
564
  name: e.string().nullish(),
534
565
  mint: e.string(),
@@ -550,7 +581,7 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
550
581
  units: q,
551
582
  sufficient: e.boolean().nullish()
552
583
  }).nullish()
553
- }), we = e.object({ tokens: e.array(Ce).nullish().transform((e) => e ?? []) }), Te = e.object({
584
+ }), De = e.object({ tokens: e.array(Ee).nullish().transform((e) => e ?? []) }), Oe = e.object({
554
585
  psps: e.array(j).nullish().transform((e) => e ?? []),
555
586
  solana: e.object({
556
587
  network: e.string(),
@@ -565,28 +596,35 @@ var P = e.string().refine(i, "amount must be an int64 string"), F = e.string(),
565
596
  recurring_eligible: e.boolean().nullish()
566
597
  })).nullish().transform((e) => e ?? [])
567
598
  }).nullish()
568
- }), Ee = e.object({
599
+ }), ke = e.object({
600
+ provider: e.string(),
601
+ site_key: e.string(),
602
+ script_url: e.string(),
603
+ action: e.string(),
604
+ token_header: e.string()
605
+ }), Ae = e.object({
569
606
  capabilities: e.object({
570
607
  route_groups: e.record(e.string(), e.boolean()),
571
608
  features: e.record(e.string(), e.boolean())
572
609
  }),
573
- currencies: e.array(be).nullish().transform((e) => e ?? []),
574
- payment: Te.nullish()
610
+ currencies: e.array(Ce).nullish().transform((e) => e ?? []),
611
+ payment: Oe.nullish(),
612
+ captcha: ke.nullish()
575
613
  }), J = e.object({
576
614
  id: e.string(),
577
615
  status: e.string(),
578
616
  client_secret: e.string().nullish(),
579
617
  payment_method_id: e.string().nullish()
580
- }), De = e.object({ client_secret: e.string().nullish() }), Oe = e.object({
618
+ }), je = e.object({ client_secret: e.string().nullish() }), Y = e.object({
581
619
  id: e.string().startsWith("ocs_"),
582
620
  url: e.string().url().nullish(),
583
621
  expires_at: F
584
- }), Y = class extends Error {
622
+ }), X = class extends Error {
585
623
  constructor(e = "The wallet request was declined.") {
586
624
  super(e), this.name = "WalletRejectedError";
587
625
  }
588
- }, ke = 4, Ae = 500, X = (e) => e?.type === "solana_sign_transactions" && !!e.transactions?.length;
589
- async function je(e, t) {
626
+ }, Me = 4, Ne = 500, Pe = (e) => e?.type === "solana_sign_transactions" && !!e.transactions?.length;
627
+ async function Fe(e, t) {
590
628
  let n = "";
591
629
  for (let r of e.transactions ?? []) {
592
630
  try {
@@ -599,9 +637,9 @@ async function je(e, t) {
599
637
  if (!n) throw O("wallet_no_signature", "The wallet returned no signature.");
600
638
  return n;
601
639
  }
602
- var Me = 2e3, Z = 300;
603
- function Ne(e) {
604
- let t = Pe(e.headers.get("Retry-After"));
640
+ var Ie = 2e3, Z = 300;
641
+ function Le(e) {
642
+ let t = Re(e.headers.get("Retry-After"));
605
643
  switch (e.status) {
606
644
  case 429: return t;
607
645
  case 503: return t ?? Z;
@@ -610,7 +648,7 @@ function Ne(e) {
610
648
  default: return null;
611
649
  }
612
650
  }
613
- function Pe(e) {
651
+ function Re(e) {
614
652
  if (!e) return null;
615
653
  if (/^\d+$/.test(e.trim())) return Number(e.trim()) * 1e3;
616
654
  let t = Date.parse(e);
@@ -627,8 +665,8 @@ function Q(e, t) {
627
665
  t?.addEventListener("abort", a, { once: !0 });
628
666
  });
629
667
  }
630
- function Fe(e = {}) {
631
- let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), n = e.fetch ?? ((e, t) => fetch(e, t)), r = Ie({
668
+ function ze(e = {}) {
669
+ let t = (e.baseUrl ?? "/billing/v1").replace(/\/+$/, ""), n = e.fetch ?? ((e, t) => fetch(e, t)), r = Be({
632
670
  ...A,
633
671
  ...e.currencies
634
672
  });
@@ -665,7 +703,7 @@ function Fe(e = {}) {
665
703
  continue;
666
704
  }
667
705
  if (a.ok) return a;
668
- let o = Ne(a);
706
+ let o = Le(a);
669
707
  if (e >= u || o === null || d + o > 2e3) throw await k(a);
670
708
  await a.body?.cancel().catch(() => void 0), d += await Q(o, r.signal);
671
709
  }
@@ -681,10 +719,10 @@ function Fe(e = {}) {
681
719
  if (!o.success) throw O("invalid_response", `${t}: ${o.error.issues[0]?.path.join(".")} ${o.error.issues[0]?.message}`);
682
720
  return o.data;
683
721
  }
684
- let s = (e) => encodeURIComponent(e), c = I(W), l = I(G), u = I(ye), d = I(K), f = (e, t) => ({
722
+ let s = (e) => encodeURIComponent(e), c = I(W), l = I(G), u = I(be), d = I(K), f = (e, t) => ({
685
723
  limit: e.limit ?? t,
686
724
  cursor: e.cursor ?? void 0
687
- }), p = he(ve);
725
+ }), p = he(ye);
688
726
  return {
689
727
  baseUrl: t,
690
728
  listSubscriptions(e = {}) {
@@ -720,18 +758,22 @@ function Fe(e = {}) {
720
758
  body: { payment_method_id: t }
721
759
  });
722
760
  },
723
- previewTierChange(e, t, n) {
724
- return o(xe, `/me/subscriptions/${s(e)}/change-tier/preview`, {
761
+ previewSubscriptionChange(e, t, n) {
762
+ return o(we, `/me/subscriptions/${s(e)}/change/preview`, {
725
763
  method: "POST",
726
- body: { price_id: t },
764
+ body: {
765
+ price_id: t.priceId,
766
+ quantity: t.quantity
767
+ },
727
768
  signal: n
728
769
  });
729
770
  },
730
- changeTier(e, t) {
731
- return o(Se, `/me/subscriptions/${s(e)}/change-tier`, {
771
+ changeSubscription(e, t) {
772
+ return o(Te, `/me/subscriptions/${s(e)}/change`, {
732
773
  method: "POST",
733
774
  body: {
734
775
  price_id: t.priceId,
776
+ quantity: t.quantity,
735
777
  signature: t.signature
736
778
  },
737
779
  headers: { "Idempotency-Key": t.idempotencyKey }
@@ -769,7 +811,7 @@ function Fe(e = {}) {
769
811
  });
770
812
  },
771
813
  getPaymentAuthentication(e) {
772
- return o(De, `/me/payment-operations/${s(e)}/authentication`);
814
+ return o(je, `/me/payment-operations/${s(e)}/authentication`);
773
815
  },
774
816
  async confirmPaymentAuthentication(e) {
775
817
  await a(`/me/payment-operations/${s(e)}/authentication/confirm`, {
@@ -780,13 +822,10 @@ function Fe(e = {}) {
780
822
  async removePaymentMethod(e) {
781
823
  return (await a(`/me/payment-methods/${s(e)}`, { method: "DELETE" })).status === 202 ? "pending" : "removed";
782
824
  },
783
- async setCollectionPaymentMethod(e) {
784
- await a("/me/collection-payment-method", {
825
+ async setDefaultPaymentMethod(e) {
826
+ await a(`/me/default-payment-methods/${s(e.currency.toUpperCase())}`, {
785
827
  method: "PUT",
786
- body: {
787
- currency: e.currency.toUpperCase(),
788
- payment_method_id: e.paymentMethodId
789
- }
828
+ body: { payment_method_id: e.paymentMethodId }
790
829
  });
791
830
  },
792
831
  listPayments(e = {}) {
@@ -804,6 +843,9 @@ function Fe(e = {}) {
804
843
  signal: e.signal
805
844
  });
806
845
  },
846
+ getAccount(e) {
847
+ return o(Se, "/me", { signal: e });
848
+ },
807
849
  getInvoice(e, t) {
808
850
  return o(K, `/me/invoices/${s(e)}`, { signal: t });
809
851
  },
@@ -817,7 +859,7 @@ function Fe(e = {}) {
817
859
  });
818
860
  },
819
861
  createCheckoutSession(e) {
820
- return !e.priceKey == !e.priceId || !!e.priceKey != !!e.productKey ? Promise.reject(O("invalid_request", "Pass priceId, or both productKey and priceKey.")) : o(Oe, "/me/checkout-sessions", {
862
+ return !e.priceKey == !e.priceId || !!e.priceKey != !!e.productKey ? Promise.reject(O("invalid_request", "Pass priceId, or both productKey and priceKey.")) : o(Y, "/me/checkout-sessions", {
821
863
  method: "POST",
822
864
  body: {
823
865
  price_key: e.priceKey,
@@ -861,13 +903,13 @@ function Fe(e = {}) {
861
903
  };
862
904
  },
863
905
  getConfig(e) {
864
- return o(Ee, "/config", {
906
+ return o(Ae, "/config", {
865
907
  signal: e,
866
908
  anonymous: !0
867
909
  });
868
910
  },
869
911
  async listSolanaTokens(e = {}) {
870
- let { tokens: t } = await o(we, "/solana/tokens", {
912
+ let { tokens: t } = await o(De, "/solana/tokens", {
871
913
  query: {
872
914
  price_id: e.priceId,
873
915
  wallet: e.wallet
@@ -879,11 +921,11 @@ function Fe(e = {}) {
879
921
  currencies: r
880
922
  };
881
923
  }
882
- function Ie(e) {
924
+ function Be(e) {
883
925
  return Object.fromEntries(Object.entries(e).map(([e, t]) => [e.toUpperCase(), t]));
884
926
  }
885
- var $ = (e) => e instanceof Y || e instanceof Error && e.name === "WalletRejectedError" || e instanceof E && e.code === "wallet_rejected";
927
+ var $ = (e) => e instanceof X || e instanceof Error && e.name === "WalletRejectedError" || e instanceof E && e.code === "wallet_rejected";
886
928
  //#endregion
887
- export { ne as A, i as B, ie as C, w as D, C as E, h as F, o as I, u as L, _ as M, y as N, g as O, x as P, d as R, k as S, S as T, le as _, Fe as a, re as b, je as c, ce as d, N as f, me as g, j as h, Y as i, T as j, b as k, pe as l, M as m, ke as n, X as o, oe as p, Me as r, $ as s, Ae as t, fe as u, E as v, m as w, O as x, D as y, f as z };
929
+ export { ne as A, i as B, ie as C, w as D, C as E, h as F, o as I, u as L, _ as M, y as N, g as O, x as P, d as R, k as S, S as T, le as _, ze as a, re as b, Fe as c, ce as d, N as f, me as g, j as h, X as i, T as j, b as k, pe as l, M as m, Me as n, Pe as o, oe as p, Ie as r, $ as s, Ne as t, fe as u, E as v, m as w, O as x, D as y, f as z };
888
930
 
889
- //# sourceMappingURL=client-DXUPzA8C.js.map
931
+ //# sourceMappingURL=client-BpzCZes3.js.map