@openrails/billing-ui 0.255.0 → 0.256.1

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 (55) hide show
  1. package/README.md +6 -5
  2. package/dist/account/cancel-dialog.d.ts +2 -2
  3. package/dist/account/subscriptions-panel.d.ts +1 -2
  4. package/dist/admin/lib/api/types.d.ts +1 -1
  5. package/dist/admin/messages.d.ts +8 -8
  6. package/dist/admin/pages/catalog/price-format.d.ts +3 -1
  7. package/dist/admin/pages/catalog/psp-links.d.ts +1 -1
  8. package/dist/{admin-catalog-rrFZd5N8.js → admin-catalog-C0QRANp7.js} +8 -11
  9. package/dist/{admin-catalog-rrFZd5N8.js.map → admin-catalog-C0QRANp7.js.map} +1 -1
  10. package/dist/{admin-detail-Cq59e14B.js → admin-detail-qetSqVDt.js} +2 -2
  11. package/dist/{admin-detail-Cq59e14B.js.map → admin-detail-qetSqVDt.js.map} +1 -1
  12. package/dist/{admin-price-detail-Bwk9PXHP.js → admin-price-detail-C9CJwLeM.js} +101 -128
  13. package/dist/admin-price-detail-C9CJwLeM.js.map +1 -0
  14. package/dist/{admin-price-format-DM1qORWI.js → admin-price-format-BVUpDoSC.js} +5 -1
  15. package/dist/admin-price-format-BVUpDoSC.js.map +1 -0
  16. package/dist/{admin-price-wizard-ByD7j8mB.js → admin-price-wizard-DAkDGWkH.js} +123 -124
  17. package/dist/admin-price-wizard-DAkDGWkH.js.map +1 -0
  18. package/dist/{admin-settings-D_8L1Hho.js → admin-settings-_0T6mLFx.js} +1 -5
  19. package/dist/admin-settings-_0T6mLFx.js.map +1 -0
  20. package/dist/admin.css +1 -1
  21. package/dist/admin.js +14 -14
  22. package/dist/admin.js.map +1 -1
  23. package/dist/client/client.d.ts +4 -4
  24. package/dist/client/generated/error-codes.d.ts +1 -1
  25. package/dist/client/generated/routes.d.ts +30 -13
  26. package/dist/client/generated/wire.d.ts +62 -23
  27. package/dist/client/types.d.ts +119 -20
  28. package/dist/{client-B301IAQD.js → client-Bs2YY-PV.js} +19 -3
  29. package/dist/client-Bs2YY-PV.js.map +1 -0
  30. package/dist/client.js +1 -1
  31. package/dist/{hooks-DARbMTwv.js → hooks-CCA-6uEa.js} +134 -123
  32. package/dist/{hooks-DARbMTwv.js.map → hooks-CCA-6uEa.js.map} +1 -1
  33. package/dist/index.js +729 -716
  34. package/dist/index.js.map +1 -1
  35. package/dist/locales/de.js +1 -0
  36. package/dist/locales/de.js.map +1 -1
  37. package/dist/locales/en.d.ts +1 -0
  38. package/dist/locales/en.js +1 -0
  39. package/dist/locales/en.js.map +1 -1
  40. package/dist/locales/es.js +1 -0
  41. package/dist/locales/es.js.map +1 -1
  42. package/dist/locales/ja.js +1 -0
  43. package/dist/locales/ja.js.map +1 -1
  44. package/dist/locales/ko.js +1 -0
  45. package/dist/locales/ko.js.map +1 -1
  46. package/dist/locales/zh.js +1 -0
  47. package/dist/locales/zh.js.map +1 -1
  48. package/dist/react/hooks.d.ts +3 -4
  49. package/dist/react.js +1 -1
  50. package/package.json +1 -1
  51. package/dist/admin-price-detail-Bwk9PXHP.js.map +0 -1
  52. package/dist/admin-price-format-DM1qORWI.js.map +0 -1
  53. package/dist/admin-price-wizard-ByD7j8mB.js.map +0 -1
  54. package/dist/admin-settings-D_8L1Hho.js.map +0 -1
  55. package/dist/client-B301IAQD.js.map +0 -1
package/README.md CHANGED
@@ -183,7 +183,7 @@ const billing = createBillingClient({ baseUrl: "/billing/v1", fetch: auth.authFe
183
183
  <AccountBilling
184
184
  plansHref="/plans"
185
185
  defaultCurrency="USD" // offers "Make default"
186
- sendSolanaTransaction={(tx) => wallet.signAndSend(tx)} // signs a Solana cancel
186
+ sendSolanaTransaction={(tx) => wallet.signAndSend(tx)} // optional on-chain cancellation
187
187
  />
188
188
  </BillingProvider>
189
189
  ```
@@ -276,10 +276,11 @@ const change = await billing.changeSubscription(sub.id, {
276
276
  `next_action`. Solana's is `solana_sign_transactions`:
277
277
  `signWalletAction(change.next_action, send)` signs and sends its
278
278
  transactions and returns the signature; repeat `changeSubscription` with the same
279
- key and `signature`. `cancelSubscription(id, { reason, signature? })` works
280
- the same way: its answer is the subscription, unchanged and carrying
281
- `next_action` until the signed cancel lands. The hooks run this when given
282
- `sendTransaction`.
279
+ key and `signature`. `cancelSubscription(id, { reason })` cancels at
280
+ period end without a wallet. Set `revokeOnChain: true` to also request an
281
+ optional wallet step; local cancellation has already taken effect. The
282
+ cancel hook signs this additional step when passed `sendTransaction` and
283
+ `revokeOnChain: true`.
283
284
 
284
285
  ## Provider-neutral flows
285
286
 
@@ -7,12 +7,12 @@ export interface CancelSubscriptionDialogProps {
7
7
  onOpenChange: (open: boolean) => void;
8
8
  /** Subscription display name. */
9
9
  name: string;
10
- /** On-chain (Solana) cancel: the wallet signs after the reason. */
10
+ /** Offers an optional on-chain cancellation when a wallet is available. */
11
11
  onChain?: boolean;
12
12
  /** In-flight stage, when cancelling. */
13
13
  pending?: SubscriptionAction;
14
14
  /** Resolves null on success; the dialog then closes. */
15
- onConfirm: (reason: string) => Promise<BillingError | null>;
15
+ onConfirm: (reason: string, revokeOnChain: boolean) => Promise<BillingError | null>;
16
16
  appearance?: BillingAppearance;
17
17
  }
18
18
  export declare function CancelSubscriptionDialog({ open, onOpenChange, name, onChain, pending, onConfirm, appearance, }: CancelSubscriptionDialogProps): React.JSX.Element;
@@ -5,8 +5,7 @@ import { SubscriptionsOptions } from '../react/hooks';
5
5
  import * as React from "react";
6
6
  export interface SubscriptionsPanelProps extends SubscriptionsOptions {
7
7
  /**
8
- * Wallet for Solana-rail subscriptions. Without it their cancel action is
9
- * hidden.
8
+ * Wallet for an optional on-chain cancellation of Solana subscriptions.
10
9
  */
11
10
  sendSolanaTransaction?: SendSolanaTransaction;
12
11
  /** Empty-state link to the host's plans page (uses `navigate` if set). */
@@ -68,7 +68,7 @@ export type AdminSubscription = RawSubscription;
68
68
  export type { ChangeSubscriptionParams, SubscriptionChange, SubscriptionChangePreview, } from '../../../client/generated/wire';
69
69
  export type UsageAggregation = "sum" | "count" | "max" | "min" | "unique_count" | "latest";
70
70
  export type UsagePriceModel = "per_unit" | "tiered" | "package";
71
- export type PSPRoutingSkip = "unknown_selector" | "ambiguous_selector" | "not_armed" | "credentials_missing" | "link_missing" | "mode_unsupported" | "posture_disarmed" | "service_unavailable" | "resolve_failed";
71
+ export type PSPRoutingSkip = "unknown_selector" | "ambiguous_selector" | "not_armed" | "credentials_missing" | "link_missing" | "not_sold_via" | "not_a_charge_psp" | "provider_price" | "mode_unsupported" | "posture_disarmed" | "service_unavailable" | "resolve_failed";
72
72
  export interface PSPRoutingCandidate {
73
73
  psp: string;
74
74
  rail: Rail;
@@ -1,5 +1,13 @@
1
1
  /** English message keys. Override individual entries with BillingAdmin.messages. */
2
2
  export declare const billingAdminMessages: {
3
+ readonly "Sold by OpenRails": "Sold by OpenRails";
4
+ readonly "OpenRails bills this price through your card vault and charge PSPs, and on Solana. Provider catalogs are not synchronized. Hosted one-time Stripe payments use inline checkout objects.": "OpenRails bills this price through your card vault and charge PSPs, and on Solana. Provider catalogs are not synchronized. Hosted one-time Stripe payments use inline checkout objects.";
5
+ readonly "Sold via: ": "Sold via: ";
6
+ readonly "every method you have": "every method you have";
7
+ readonly "Solana plan ": "Solana plan ";
8
+ readonly "Owned by its provider": "Owned by its provider";
9
+ readonly "The provider owns and runs this price; OpenRails read its terms and never writes it. Verify asks the provider what it holds now, and changes nothing.": "The provider owns and runs this price; OpenRails read its terms and never writes it. Verify asks the provider what it holds now, and changes nothing.";
10
+ readonly "'s price": "'s price";
3
11
  readonly " Edit widget": " Edit widget";
4
12
  readonly " Price": " Price";
5
13
  readonly " Product": " Product";
@@ -375,7 +383,6 @@ export declare const billingAdminMessages: {
375
383
  readonly "Notes ": "Notes ";
376
384
  readonly "Nothing here can be fixed automatically. You can only note why you are leaving it.": "Nothing here can be fixed automatically. You can only note why you are leaving it.";
377
385
  readonly "Nothing in this range. Pick a wider range.": "Nothing in this range. Pick a wider range.";
378
- readonly "Nothing is claimed about the providers' copies until you press Verify.": "Nothing is claimed about the providers' copies until you press Verify.";
379
386
  readonly "Nothing needs attention right now.": "Nothing needs attention right now.";
380
387
  readonly "Notice period": "Notice period";
381
388
  readonly "Notice period (days)": "Notice period (days)";
@@ -419,7 +426,6 @@ export declare const billingAdminMessages: {
419
426
  readonly "Payment method": "Payment method";
420
427
  readonly "Payment methods": "Payment methods";
421
428
  readonly "Payment not found.": "Payment not found.";
422
- readonly "Payment providers": "Payment providers";
423
429
  readonly "Payment rail": "Payment rail";
424
430
  readonly "Payment reference": "Payment reference";
425
431
  readonly "Payment terms (days)": "Payment terms (days)";
@@ -444,9 +450,6 @@ export declare const billingAdminMessages: {
444
450
  readonly "Gateway ID": "Gateway ID";
445
451
  readonly "Client account number": "Client account number";
446
452
  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";
450
453
  readonly "Pick a stored payment method": "Pick a stored payment method";
451
454
  readonly "Pinned to an archived (prior) version": "Pinned to an archived (prior) version";
452
455
  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.";
@@ -543,7 +546,6 @@ export declare const billingAdminMessages: {
543
546
  readonly "Select product": "Select product";
544
547
  readonly "Send alerts to Discord, Slack, or your own endpoint.": "Send alerts to Discord, Slack, or your own endpoint.";
545
548
  readonly "Send email alerts to this address.": "Send email alerts to this address.";
546
- readonly Sent: "Sent";
547
549
  readonly "Set how much notice customers receive before a price increase.": "Set how much notice customers receive before a price increase.";
548
550
  readonly "Set the price that charges every customer's usage as it is recorded. Money is entered in major currency units.": "Set the price that charges every customer's usage as it is recorded. Money is entered in major currency units.";
549
551
  readonly Settings: "Settings";
@@ -591,7 +593,6 @@ export declare const billingAdminMessages: {
591
593
  readonly "This billing page does not exist.": "This billing page does not exist.";
592
594
  readonly "This is a price": "This is a price";
593
595
  readonly "This meter uses an aggregation that the billing engine cannot rate.": "This meter uses an aggregation that the billing engine cannot rate.";
594
- readonly "This price has not been sent to any provider, so nobody can be charged for it yet.": "This price has not been sent to any provider, so nobody can be charged for it yet.";
595
596
  readonly Tier: "Tier";
596
597
  readonly "Tier group": "Tier group";
597
598
  readonly "Tier mode": "Tier mode";
@@ -636,7 +637,6 @@ export declare const billingAdminMessages: {
636
637
  readonly Webhooks: "Webhooks";
637
638
  readonly "What the customer asked for": "What the customer asked for";
638
639
  readonly "Which provider would take the money if someone bought this right now, and why the others were passed over. This asks the same question a real purchase asks, without starting one.": "Which provider would take the money if someone bought this right now, and why the others were passed over. This asks the same question a real purchase asks, without starting one.";
639
- readonly "Which providers this price has been sent to, and whether their copy still matches yours. Publishing the catalog is what sends it; this page only reports. Verify asks each provider what it currently holds, and changes nothing.": "Which providers this price has been sent to, and whether their copy still matches yours. Publishing the catalog is what sends it; this page only reports. Verify asks each provider what it currently holds, and changes nothing.";
640
640
  readonly Why: "Why";
641
641
  readonly "Why it was granted": "Why it was granted";
642
642
  readonly "Widget menu": "Widget menu";
@@ -1,3 +1,5 @@
1
1
  import { Price } from '../../../client/generated/wire';
2
- export declare function priceIntervalLabel(price: Pick<Price, "billing_interval_hours" | "access_duration_hours">): string;
2
+ export declare function priceIntervalLabel(price: Pick<Price, "billing_interval_hours" | "access_duration_hours"> & {
3
+ billing_interval_months?: number | null;
4
+ }): string;
3
5
  export declare function priceAmountLabel(price: Pick<Price, "unit_amount" | "currency" | "customer_amount">): string;
@@ -1,5 +1,5 @@
1
1
  import { Price } from '../../../client/generated/wire';
2
- export declare function PSPLinksCard({ price, verifying, verified, onVerify, }: {
2
+ export declare function PriceOwnerCard({ price, verifying, verified, onVerify, }: {
3
3
  price: Price;
4
4
  verifying: boolean;
5
5
  verified: boolean;
@@ -15,10 +15,10 @@ import { a as N, i as P, n as F, o as I, r as L, s as R, t as z } from "./admin-
15
15
  import { t as B } from "./admin-label-BzJpr3lg.js";
16
16
  import { t as ne } from "./admin-switch-S4g_ppaU.js";
17
17
  import { n as re, r as ie } from "./admin-dialog-width-BPrgdYlj.js";
18
- import { i as V, n as ae, r as oe, t as se } from "./admin-price-format-DM1qORWI.js";
18
+ import { i as V, n as ae, r as oe, t as se } from "./admin-price-format-BVUpDoSC.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-ByD7j8mB.js";
21
+ import { t as de } from "./admin-price-wizard-DAkDGWkH.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";
@@ -850,15 +850,12 @@ function Fe({ price: e, product: t }) {
850
850
  /* @__PURE__ */ K(k, { children: ae(e) }),
851
851
  /* @__PURE__ */ K(k, { children: /* @__PURE__ */ K("span", {
852
852
  className: "flex flex-wrap gap-1",
853
- children: Object.entries(e.psps ?? {}).map(([e, t]) => /* @__PURE__ */ q(M, {
853
+ children: e.provider ? /* @__PURE__ */ q(M, {
854
854
  variant: "secondary",
855
- className: t.status === "linked" ? "" : "bg-held-surface text-held",
856
- title: t.message || void 0,
857
- children: [
858
- e,
859
- ": ",
860
- t.status
861
- ]
855
+ children: [e.provider.psp, /* @__PURE__ */ K(i, { id: "'s price" })]
856
+ }) : (e.sell_via ?? []).map((e) => /* @__PURE__ */ K(M, {
857
+ variant: "secondary",
858
+ children: e
862
859
  }, e))
863
860
  }) }),
864
861
  /* @__PURE__ */ K(k, { children: e.archived ? /* @__PURE__ */ K(M, {
@@ -1196,4 +1193,4 @@ function $({ label: t, id: n, hint: r, children: i }) {
1196
1193
  //#endregion
1197
1194
  export { ke as CatalogDriftPage, Oe as CatalogPricesPage, De as CatalogProductsPage };
1198
1195
 
1199
- //# sourceMappingURL=admin-catalog-rrFZd5N8.js.map
1196
+ //# sourceMappingURL=admin-catalog-C0QRANp7.js.map