@openrails/billing-ui 0.252.1 → 0.254.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 (72) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +15 -4
  3. package/dist/admin/context.d.ts +4 -4
  4. package/dist/admin/lib/api/endpoints.d.ts +2 -2
  5. package/dist/admin/lib/api/index.d.ts +1 -1
  6. package/dist/admin/lib/api/types.d.ts +1 -1
  7. package/dist/admin/lib/mutations.d.ts +1 -1
  8. package/dist/admin/messages.d.ts +10 -0
  9. package/dist/{admin-catalog-Bsxo2gyS.js → admin-catalog-rrFZd5N8.js} +2 -2
  10. package/dist/{admin-catalog-Bsxo2gyS.js.map → admin-catalog-rrFZd5N8.js.map} +1 -1
  11. package/dist/{admin-detail-DG-YaHhS.js → admin-detail-DAOjLNL9.js} +2 -2
  12. package/dist/admin-detail-DAOjLNL9.js.map +1 -0
  13. package/dist/{admin-orders-8XzHf7b-.js → admin-orders-DMSOum9t.js} +2 -2
  14. package/dist/admin-orders-DMSOum9t.js.map +1 -0
  15. package/dist/{admin-price-detail-ByCmrx_W.js → admin-price-detail-Bwk9PXHP.js} +2 -2
  16. package/dist/{admin-price-detail-ByCmrx_W.js.map → admin-price-detail-Bwk9PXHP.js.map} +1 -1
  17. package/dist/{admin-price-wizard-m7Qjhq6W.js → admin-price-wizard-ByD7j8mB.js} +2 -2
  18. package/dist/admin-price-wizard-ByD7j8mB.js.map +1 -0
  19. package/dist/{admin-settings-BIUgvclv.js → admin-settings-D_8L1Hho.js} +101 -76
  20. package/dist/admin-settings-D_8L1Hho.js.map +1 -0
  21. package/dist/admin-utils-DnVY5fYd.js.map +1 -1
  22. package/dist/admin.js +17 -7
  23. package/dist/admin.js.map +1 -1
  24. package/dist/buy-button.d.ts +4 -1
  25. package/dist/cart.d.ts +4 -1
  26. package/dist/client/generated/error-codes.d.ts +1 -1
  27. package/dist/client/generated/routes.d.ts +4 -4
  28. package/dist/client/generated/wire.d.ts +59 -23
  29. package/dist/client/types.d.ts +13 -7
  30. package/dist/{client-imFR1UCe.js → client-B301IAQD.js} +6 -5
  31. package/dist/client-B301IAQD.js.map +1 -0
  32. package/dist/client.js +1 -1
  33. package/dist/components/platform-card-form.d.ts +10 -0
  34. package/dist/create-card-BEILS1VB-DeyyfyFD.js +140 -0
  35. package/dist/create-card-BEILS1VB-DeyyfyFD.js.map +1 -0
  36. package/dist/create-card-display-Dv5pcpzc-BWB6vzo2.js +166 -0
  37. package/dist/create-card-display-Dv5pcpzc-BWB6vzo2.js.map +1 -0
  38. package/dist/create-copy-button-CAYmfugS-qNapojfj.js +125 -0
  39. package/dist/create-copy-button-CAYmfugS-qNapojfj.js.map +1 -0
  40. package/dist/embedded-payment.d.ts +4 -1
  41. package/dist/fallbacks.d.ts +25 -0
  42. package/dist/{hooks-C9JkHcRt.js → hooks-DARbMTwv.js} +69 -59
  43. package/dist/hooks-DARbMTwv.js.map +1 -0
  44. package/dist/index-rGw83t5v-BE6naeQR.js +1801 -0
  45. package/dist/index-rGw83t5v-BE6naeQR.js.map +1 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.js +1160 -975
  48. package/dist/index.js.map +1 -1
  49. package/dist/locales/de.js +1 -0
  50. package/dist/locales/de.js.map +1 -1
  51. package/dist/locales/en.d.ts +1 -0
  52. package/dist/locales/en.js +1 -0
  53. package/dist/locales/en.js.map +1 -1
  54. package/dist/locales/es.js +1 -0
  55. package/dist/locales/es.js.map +1 -1
  56. package/dist/locales/ja.js +1 -0
  57. package/dist/locales/ja.js.map +1 -1
  58. package/dist/locales/ko.js +1 -0
  59. package/dist/locales/ko.js.map +1 -1
  60. package/dist/locales/zh.js +1 -0
  61. package/dist/locales/zh.js.map +1 -1
  62. package/dist/order-payment.d.ts +8 -1
  63. package/dist/product-list.d.ts +4 -1
  64. package/dist/psp.d.ts +1 -1
  65. package/dist/react.js +1 -1
  66. package/package.json +2 -1
  67. package/dist/admin-detail-DG-YaHhS.js.map +0 -1
  68. package/dist/admin-orders-8XzHf7b-.js.map +0 -1
  69. package/dist/admin-price-wizard-m7Qjhq6W.js.map +0 -1
  70. package/dist/admin-settings-BIUgvclv.js.map +0 -1
  71. package/dist/client-imFR1UCe.js.map +0 -1
  72. package/dist/hooks-C9JkHcRt.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## Fallbacks are a checkout option
4
+
5
+ - Breaking: OpenRails no longer marks or withholds fallback PSPs
6
+ (`OrderPaymentOption.fallback` and `payment_option_withheld` are gone). Each
7
+ option reports `failed_attempts` on the order.
8
+ - `OrderPayment`, `BuyButton`, `ProductList`, `Cart` and `EmbeddedPayment` take
9
+ `fallbacks`, e.g. `{ ccbill: { for: ["mobius"], afterFailures: 2 } }`: the
10
+ PSP stays hidden until none of its `for` PSPs is offered, or they have failed
11
+ `afterFailures` times on the order, then shows under "Card payment isn't
12
+ working?". `EmbeddedPayment` hands it to the framed pay page in the URL
13
+ fragment (`withPaymentFallbacks`; the page reads it with
14
+ `readPaymentFragment`).
15
+
3
16
  ## A price's PSPs are one map
4
17
 
5
18
  - Breaking: `CreatePriceParams.psps` and `UpdatePriceParams.psps` map each PSP
package/README.md CHANGED
@@ -108,6 +108,19 @@ anything.
108
108
  `returnUrl` returns the buyer from a redirect step (Stripe's hosted page); it
109
109
  must be on one of your app's return origins.
110
110
 
111
+ `fallbacks` keeps a PSP back until the PSPs it stands in for are not offered,
112
+ or have failed `afterFailures` times on the order combined (each payment
113
+ option reports its `failed_attempts`); it then shows under "Card payment isn't
114
+ working?". CCBill after Mobius declines twice:
115
+
116
+ ```tsx
117
+ <ProductList products={products} fallbacks={{ ccbill: { for: ["mobius"], afterFailures: 2 } }} {...handlers} />
118
+ ```
119
+
120
+ `BuyButton`, `Cart`, `OrderPayment` and `EmbeddedPayment` take it too.
121
+ `EmbeddedPayment` passes it to the framed pay page in the URL fragment
122
+ (`withPaymentFallbacks(payUrl, fallbacks)` does the same for a hosted pay URL).
123
+
111
124
  For prepaid credits, a fixed pack is another product/price. A
112
125
  `customer_amount` price takes the buyer's `amount`: collect it on your product
113
126
  page, and the purchase charges exactly that:
@@ -144,10 +157,8 @@ customer's browser, which pays it signed in:
144
157
  ```
145
158
 
146
159
  `onSettled` follows a complete order, or one processing on an asynchronous
147
- rail. A subscription line names its subscription once paid. A fallback PSP
148
- the order lists (CCBill once the card PSP has failed or is unavailable) is
149
- offered under "Card payment isn't working?"; a customer back from a PSP's
150
- page before it reported is offered to continue there.
160
+ rail. A subscription line names its subscription once paid. A customer back
161
+ from a PSP's page before it reported is offered to continue there.
151
162
 
152
163
  ## Account billing
153
164
 
@@ -135,7 +135,7 @@ export declare function createAdminServices(options: AdminClientOptions): {
135
135
  id: string;
136
136
  psp: import('../client/generated/wire').UpdatePSPParams;
137
137
  }, unknown>, "mutationKey">;
138
- setCreditLimit: () => import('@tanstack/react-query').WithRequired<import('@tanstack/react-query').UseMutationOptions<import('../client/generated/wire').Customer, Error, {
138
+ setCreditLimit: () => import('@tanstack/react-query').WithRequired<import('@tanstack/react-query').UseMutationOptions<import('../client/generated/wire').CustomerSettingsResult, Error, {
139
139
  customerId: string;
140
140
  currency: string;
141
141
  amount: string;
@@ -572,7 +572,7 @@ export declare function createAdminServices(options: AdminClientOptions): {
572
572
  }, signal?: AbortSignal) => Promise<import('./lib/api/types').PSPRoutingPreview>;
573
573
  getConfig: (signal?: AbortSignal) => Promise<import('../client/generated/wire').PublicConfig>;
574
574
  getAdminAccess: (signal?: AbortSignal) => Promise<import('../client/generated/wire').AdminAccess>;
575
- updateCustomer: (customerId: string, params: import('../client/generated/wire').UpdateCustomerParams) => Promise<import('../client/generated/wire').Customer>;
575
+ updateCustomer: (customerId: string, params: import('../client/generated/wire').UpdateCustomerParams) => Promise<import('../client/generated/wire').CustomerSettingsResult>;
576
576
  listWebhooks: (signal?: AbortSignal) => Promise<import('./lib/api/credit-types').ListPage<import('./lib/api/types').AlertWebhook>>;
577
577
  createWebhook: (body: import('../client/generated/wire').CreateAlertWebhookParams) => Promise<import('./lib/api/types').AlertWebhook>;
578
578
  updateWebhook: (id: string, body: import('../client/generated/wire').UpdateAlertWebhookParams) => Promise<import('./lib/api/types').AlertWebhook>;
@@ -735,7 +735,7 @@ export declare const useAdminServices: () => {
735
735
  id: string;
736
736
  psp: import('../client/generated/wire').UpdatePSPParams;
737
737
  }, unknown>, "mutationKey">;
738
- setCreditLimit: () => import('@tanstack/react-query').WithRequired<import('@tanstack/react-query').UseMutationOptions<import('../client/generated/wire').Customer, Error, {
738
+ setCreditLimit: () => import('@tanstack/react-query').WithRequired<import('@tanstack/react-query').UseMutationOptions<import('../client/generated/wire').CustomerSettingsResult, Error, {
739
739
  customerId: string;
740
740
  currency: string;
741
741
  amount: string;
@@ -1172,7 +1172,7 @@ export declare const useAdminServices: () => {
1172
1172
  }, signal?: AbortSignal) => Promise<import('./lib/api/types').PSPRoutingPreview>;
1173
1173
  getConfig: (signal?: AbortSignal) => Promise<import('../client/generated/wire').PublicConfig>;
1174
1174
  getAdminAccess: (signal?: AbortSignal) => Promise<import('../client/generated/wire').AdminAccess>;
1175
- updateCustomer: (customerId: string, params: import('../client/generated/wire').UpdateCustomerParams) => Promise<import('../client/generated/wire').Customer>;
1175
+ updateCustomer: (customerId: string, params: import('../client/generated/wire').UpdateCustomerParams) => Promise<import('../client/generated/wire').CustomerSettingsResult>;
1176
1176
  listWebhooks: (signal?: AbortSignal) => Promise<import('./lib/api/credit-types').ListPage<import('./lib/api/types').AlertWebhook>>;
1177
1177
  createWebhook: (body: import('../client/generated/wire').CreateAlertWebhookParams) => Promise<import('./lib/api/types').AlertWebhook>;
1178
1178
  updateWebhook: (id: string, body: import('../client/generated/wire').UpdateAlertWebhookParams) => Promise<import('./lib/api/types').AlertWebhook>;
@@ -1,5 +1,5 @@
1
1
  import { AdminClient, CursorEnvelope, PageRequest } from './client';
2
- import { AdminAccess, AlertWebhook, Allowance, CatalogApplicationReceipt, CreateAlertWebhookParams, CreatePSPParams, PSPRefresh, CreatePriceParams, Customer, ListPage, MerchantConfigurationState, Meter, PSP, Payment, PaymentAttempt, PaymentMethod, Price, PriceKeyMovement, Product, PublicConfig, RatePrice, Renewal, UpdateAlertWebhookParams, UpdateCustomerParams, UpdateMerchantConfigurationParams, UpdatePSPParams, UpdatePriceParams, UpdateProductParams } from '../../../client/generated/wire';
2
+ import { AdminAccess, AlertWebhook, Allowance, CatalogApplicationReceipt, CreateAlertWebhookParams, CreatePSPParams, PSPRefresh, CreatePriceParams, Customer, CustomerSettingsResult, ListPage, MerchantConfigurationState, Meter, PSP, Payment, PaymentAttempt, PaymentMethod, Price, PriceKeyMovement, Product, PublicConfig, RatePrice, Renewal, UpdateAlertWebhookParams, UpdateCustomerParams, UpdateMerchantConfigurationParams, UpdatePSPParams, UpdatePriceParams, UpdateProductParams } from '../../../client/generated/wire';
3
3
  import { CustomerEntitlement, Finding, PSPRoutingPreview, RawProductAccessGrant, PriceMigration, PriceMigrationCancel, PriceMigrationPreview, ChangeSubscriptionParams, SubscriptionChange, SubscriptionChangePreview } from './types';
4
4
  export interface ProductGrant {
5
5
  productId: string;
@@ -125,7 +125,7 @@ export declare function createEndpoints(client: AdminClient): {
125
125
  }, signal?: AbortSignal) => Promise<PSPRoutingPreview>;
126
126
  getConfig: (signal?: AbortSignal) => Promise<PublicConfig>;
127
127
  getAdminAccess: (signal?: AbortSignal) => Promise<AdminAccess>;
128
- updateCustomer: (customerId: string, params: UpdateCustomerParams) => Promise<Customer>;
128
+ updateCustomer: (customerId: string, params: UpdateCustomerParams) => Promise<CustomerSettingsResult>;
129
129
  listWebhooks: (signal?: AbortSignal) => Promise<ListPage<AlertWebhook>>;
130
130
  createWebhook: (body: CreateAlertWebhookParams) => Promise<AlertWebhook>;
131
131
  updateWebhook: (id: string, body: UpdateAlertWebhookParams) => Promise<AlertWebhook>;
@@ -80,7 +80,7 @@ export declare function createAdminAPI(client: AdminClient): {
80
80
  }, signal?: AbortSignal) => Promise<import('./types').PSPRoutingPreview>;
81
81
  getConfig: (signal?: AbortSignal) => Promise<import('../../../client/generated/wire').PublicConfig>;
82
82
  getAdminAccess: (signal?: AbortSignal) => Promise<import('../../../client/generated/wire').AdminAccess>;
83
- updateCustomer: (customerId: string, params: import('../../../client/generated/wire').UpdateCustomerParams) => Promise<import('../../../client/generated/wire').Customer>;
83
+ updateCustomer: (customerId: string, params: import('../../../client/generated/wire').UpdateCustomerParams) => Promise<import('../../../client/generated/wire').CustomerSettingsResult>;
84
84
  listWebhooks: (signal?: AbortSignal) => Promise<import('./credit-types').ListPage<import('./types').AlertWebhook>>;
85
85
  createWebhook: (body: import('../../../client/generated/wire').CreateAlertWebhookParams) => Promise<import('./types').AlertWebhook>;
86
86
  updateWebhook: (id: string, body: import('../../../client/generated/wire').UpdateAlertWebhookParams) => Promise<import('./types').AlertWebhook>;
@@ -118,5 +118,5 @@ export interface FindingsGauges {
118
118
  freeloaders: number;
119
119
  duplicate_coverage: number;
120
120
  }
121
- export type { AlertWebhook, MerchantConfigurationState, MerchantSettings, PSP, RailDefinition, } from '../../../client/generated/wire';
121
+ export type { AlertWebhook, MerchantConfigurationState, PSP, RailDefinition, } from '../../../client/generated/wire';
122
122
  export type AlertSeverity = "warning" | "critical";
@@ -102,7 +102,7 @@ export declare function createMutations(client: AdminClient, api: AdminAPI, quer
102
102
  id: string;
103
103
  psp: UpdatePSPParams;
104
104
  }, unknown>, "mutationKey">;
105
- setCreditLimit: () => import('@tanstack/react-query').WithRequired<import('@tanstack/react-query').UseMutationOptions<Customer, Error, {
105
+ setCreditLimit: () => import('@tanstack/react-query').WithRequired<import('@tanstack/react-query').UseMutationOptions<import('../../client/generated/wire').CustomerSettingsResult, Error, {
106
106
  customerId: string;
107
107
  currency: string;
108
108
  amount: string;
@@ -437,6 +437,16 @@ export declare const billingAdminMessages: {
437
437
  readonly "Live: real money": "Live: real money";
438
438
  readonly "Test: the provider's own system, no money moves": "Test: the provider's own system, no money moves";
439
439
  readonly "Sandbox: the provider's separate sandbox": "Sandbox: the provider's separate sandbox";
440
+ readonly "Mainnet: real money": "Mainnet: real money";
441
+ readonly "Devnet: Solana's development network": "Devnet: Solana's development network";
442
+ readonly "Testnet: Solana's test network": "Testnet: Solana's test network";
443
+ readonly Treasury: "Treasury";
444
+ readonly "Gateway ID": "Gateway ID";
445
+ readonly "Client account number": "Client account number";
446
+ readonly "Client subaccount": "Client subaccount";
447
+ readonly Money: "Money";
448
+ readonly "Sandbox: its PSPs move no money": "Sandbox: its PSPs move no money";
449
+ readonly "Live: its PSPs move real money": "Live: its PSPs move real money";
440
450
  readonly "Pick a stored payment method": "Pick a stored payment method";
441
451
  readonly "Pinned to an archived (prior) version": "Pinned to an archived (prior) version";
442
452
  readonly "Points future renewals of this subscription at another of the customer&apos;s stored cards (same rail), or back at their default card for its currency.": "Points future renewals of this subscription at another of the customer&apos;s stored cards (same rail), or back at their default card for its currency.";
@@ -18,7 +18,7 @@ import { n as re, r as ie } from "./admin-dialog-width-BPrgdYlj.js";
18
18
  import { i as V, n as ae, r as oe, t as se } from "./admin-price-format-DM1qORWI.js";
19
19
  import { t as ce } from "./admin-textarea-DK1Fq31x.js";
20
20
  import { r as le, t as ue } from "./admin-card-DGbi6ZHZ.js";
21
- import { t as de } from "./admin-price-wizard-m7Qjhq6W.js";
21
+ import { t as de } from "./admin-price-wizard-ByD7j8mB.js";
22
22
  import * as H from "react";
23
23
  import { useMutation as U, useQuery as W, useQueryClient as G } from "@tanstack/react-query";
24
24
  import { Fragment as fe, jsx as K, jsxs as q } from "react/jsx-runtime";
@@ -1196,4 +1196,4 @@ function $({ label: t, id: n, hint: r, children: i }) {
1196
1196
  //#endregion
1197
1197
  export { ke as CatalogDriftPage, Oe as CatalogPricesPage, De as CatalogProductsPage };
1198
1198
 
1199
- //# sourceMappingURL=admin-catalog-Bsxo2gyS.js.map
1199
+ //# sourceMappingURL=admin-catalog-rrFZd5N8.js.map