@openrails/billing-ui 0.235.0 → 0.236.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 +103 -0
- package/README.md +103 -73
- package/dist/account/account-billing.d.ts +1 -3
- package/dist/account/payment-methods-panel.d.ts +1 -3
- package/dist/buy-button.d.ts +35 -0
- package/dist/cart.d.ts +18 -0
- package/dist/checkout.d.ts +1 -3
- package/dist/client/checkout.d.ts +28 -0
- package/dist/client/client.d.ts +71 -47
- package/dist/client/errors.d.ts +4 -0
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +117 -88
- package/dist/client/generated/wire.d.ts +88 -66
- package/dist/client/index.d.ts +2 -2
- package/dist/client/types.d.ts +230 -17
- package/dist/{client-BpzCZes3.js → client-BuvolBPT.js} +477 -316
- package/dist/client-BuvolBPT.js.map +1 -0
- package/dist/client.js +2 -2
- package/dist/components/stripe-card.d.ts +8 -2
- package/dist/components/stripe-wallets.d.ts +12 -0
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/frame.d.ts +5 -5
- package/dist/hooks-2d-XjpuI.js +526 -0
- package/dist/hooks-2d-XjpuI.js.map +1 -0
- package/dist/i18n/context.d.ts +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +1966 -1655
- package/dist/index.js.map +1 -1
- package/dist/lib/money.d.ts +1 -0
- package/dist/lib/offer-label.d.ts +4 -0
- package/dist/locales/de.js +20 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +20 -0
- package/dist/locales/en.js +20 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +20 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +11 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +11 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +11 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/offers.d.ts +33 -0
- package/dist/order-checkout.d.ts +30 -0
- package/dist/react/hooks.d.ts +8 -7
- package/dist/react/index.d.ts +1 -1
- package/dist/react/provider.d.ts +24 -2
- package/dist/react.js +2 -33
- package/dist/save-payment-method.d.ts +0 -6
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +16 -16
- package/docs/payment-form-contract.md +6 -6
- package/package.json +1 -1
- package/dist/client-BpzCZes3.js.map +0 -1
- package/dist/config-qLcHvK0Q.js +0 -341
- package/dist/config-qLcHvK0Q.js.map +0 -1
- package/dist/provider.d.ts +0 -18
- package/dist/react.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CheckoutAppearance } from './appearance';
|
|
2
|
+
import { BillingClient } from './client/client';
|
|
3
|
+
import { Order } from './client/types';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export interface OrderCheckoutProps {
|
|
6
|
+
orderId: string;
|
|
7
|
+
/** The client to pay through; default: the provider's. */
|
|
8
|
+
client?: BillingClient;
|
|
9
|
+
/** Where a redirect PSP will return to; card PSPs need none. */
|
|
10
|
+
returnUrl?: string;
|
|
11
|
+
/** Offer the customer's saved cards (GET /me/payment-methods). Default true. */
|
|
12
|
+
savedPaymentMethods?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Offer a PSP whose card entry is server. Default true; orders take
|
|
15
|
+
* tokens only, so such a PSP is offered for saved cards alone.
|
|
16
|
+
*/
|
|
17
|
+
serverCardEntry?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Offer Apple Pay and Google Pay through a Stripe PSP's Express Checkout
|
|
20
|
+
* Element. The page's host must be a payment-method domain registered on
|
|
21
|
+
* that Stripe account. Default false.
|
|
22
|
+
*/
|
|
23
|
+
wallets?: boolean;
|
|
24
|
+
/** Once the order is complete, or processing on an asynchronous rail. */
|
|
25
|
+
onSettled?: (order: Order) => void;
|
|
26
|
+
appearance?: CheckoutAppearance;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Pays one order. Requires `BillingProvider`. */
|
|
30
|
+
export declare function OrderCheckout({ orderId, client: given, returnUrl, savedPaymentMethods, serverCardEntry, wallets, onSettled, appearance, className, }: OrderCheckoutProps): React.JSX.Element;
|
package/dist/react/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SendSolanaTransaction, SubscriptionChangeInput } from '../client/client';
|
|
1
|
+
import { ProductListOptions, SendSolanaTransaction, SubscriptionChangeInput } from '../client/client';
|
|
2
2
|
import { BillingError } from '../client/errors';
|
|
3
3
|
import { NewCard, Payment, PaymentMethod, Product, Subscription, SubscriptionChange } from '../client/types';
|
|
4
4
|
export type ActionResult = Promise<BillingError | null>;
|
|
@@ -39,16 +39,17 @@ export interface SubscriptionsState {
|
|
|
39
39
|
export declare function useSubscriptions(options?: SubscriptionsOptions): SubscriptionsState;
|
|
40
40
|
export interface ProductsState {
|
|
41
41
|
products: Product[] | null;
|
|
42
|
-
/** The cursor of the next page; null on the last. */
|
|
43
|
-
nextCursor: string | null;
|
|
44
42
|
loading: boolean;
|
|
45
43
|
error: BillingError | null;
|
|
46
44
|
refetch: () => void;
|
|
47
45
|
}
|
|
48
|
-
/** The
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/** The product keys to look up: `ProductListOptions`. */
|
|
47
|
+
export type ProductsOptions = Pick<ProductListOptions, "keys">;
|
|
48
|
+
/**
|
|
49
|
+
* The products on sale named by `keys`, each with its active prices: a
|
|
50
|
+
* public catalog lookup.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useProducts({ keys }: ProductsOptions): ProductsState;
|
|
52
53
|
export type PaymentMethodAction = "remove" | "default";
|
|
53
54
|
export interface PaymentMethodsState {
|
|
54
55
|
methods: PaymentMethod[] | null;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { BillingProvider, type BillingProviderProps } from './provider';
|
|
2
2
|
export { useBillingClient, useBillingRefresh, useOptionalBillingContext, type BillingChange, type BillingContextValue, } from './context';
|
|
3
3
|
export { useConfig, useCurrencyScales, type ConfigState, type ConfigStore, } from './config';
|
|
4
|
-
export { usePaymentMethods, usePayments, useProducts, useSubscriptions, type ActionResult, type PaymentMethodAction, type PaymentMethodsState, type PaymentsOptions, type PaymentsState, type ProductsState, type SubscriptionAction, type SubscriptionsOptions, type SubscriptionsState, } from './hooks';
|
|
4
|
+
export { usePaymentMethods, usePayments, useProducts, useSubscriptions, type ActionResult, type PaymentMethodAction, type PaymentMethodsState, type PaymentsOptions, type PaymentsState, type ProductsOptions, type ProductsState, type SubscriptionAction, type SubscriptionsOptions, type SubscriptionsState, } from './hooks';
|
package/dist/react/provider.d.ts
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { CheckoutAppearance } from '../appearance';
|
|
2
3
|
import { BillingClient } from '../client/client';
|
|
4
|
+
import { BillingUiMessageBundle, BillingUiTranslate } from '../i18n/messages';
|
|
5
|
+
import { Navigate } from '../scope-context';
|
|
3
6
|
import { BillingChange } from './context';
|
|
4
7
|
export interface BillingProviderProps {
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The customer's client: hooks and the account panels read it, and a
|
|
10
|
+
* checkout saves a new card to the customer first. Leave it out where no
|
|
11
|
+
* customer is signed in, such as the shared payment page.
|
|
12
|
+
*/
|
|
13
|
+
client?: BillingClient;
|
|
6
14
|
/** Fires after each successful mutation: the host's cache-invalidation hook. */
|
|
7
15
|
onChange?: (change: BillingChange) => void;
|
|
16
|
+
appearance?: CheckoutAppearance;
|
|
17
|
+
/** Locale bundle(s) layered over English; later entries win. */
|
|
18
|
+
messages?: BillingUiMessageBundle | readonly BillingUiMessageBundle[];
|
|
19
|
+
/** Host translation hook, consulted before the bundles. */
|
|
20
|
+
t?: BillingUiTranslate;
|
|
21
|
+
/** BCP 47 tag for dates, money and plurals; defaults to the browser's. */
|
|
22
|
+
locale?: string;
|
|
23
|
+
/** Host router for in-app links (e.g. the plans page). */
|
|
24
|
+
navigate?: Navigate;
|
|
8
25
|
children?: ReactNode;
|
|
9
26
|
}
|
|
10
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The one billing-ui provider: the client, and the appearance and words of
|
|
29
|
+
* the styled components. Renders no DOM; surfaces create their own styling
|
|
30
|
+
* roots, and no stylesheet loads until a styled component is imported.
|
|
31
|
+
*/
|
|
32
|
+
export declare function BillingProvider({ client, onChange, appearance, messages, t, locale, navigate, children, }: BillingProviderProps): import("react").JSX.Element;
|
package/dist/react.js
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n,
|
|
2
|
-
|
|
3
|
-
import { jsx as g } from "react/jsx-runtime";
|
|
4
|
-
//#region src/react/provider.tsx
|
|
5
|
-
function _({ client: e, onChange: n, children: r }) {
|
|
6
|
-
let [i, a] = h(0), o = m(n);
|
|
7
|
-
f(() => {
|
|
8
|
-
o.current = n;
|
|
9
|
-
});
|
|
10
|
-
let s = d((e) => {
|
|
11
|
-
a((e) => e + 1), o.current?.(e);
|
|
12
|
-
}, []), c = d(() => a((e) => e + 1), []), l = p(() => u(e), [e]), _ = p(() => ({
|
|
13
|
-
client: e,
|
|
14
|
-
version: i,
|
|
15
|
-
notify: s,
|
|
16
|
-
refresh: c,
|
|
17
|
-
config: l
|
|
18
|
-
}), [
|
|
19
|
-
e,
|
|
20
|
-
i,
|
|
21
|
-
s,
|
|
22
|
-
c,
|
|
23
|
-
l
|
|
24
|
-
]);
|
|
25
|
-
return /* @__PURE__ */ g(t.Provider, {
|
|
26
|
-
value: _,
|
|
27
|
-
children: r
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { _ as BillingProvider, a as useBillingClient, n as useBillingRefresh, o as useConfig, c as useCurrencyScales, r as useOptionalBillingContext, i as usePaymentMethods, e as usePayments, s as useProducts, l as useSubscriptions };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=react.js.map
|
|
1
|
+
import { a as e, c as t, d as n, i as r, n as i, o as a, r as o, s, t as c, u as l } from "./hooks-2d-XjpuI.js";
|
|
2
|
+
export { e as BillingProvider, t as useBillingClient, l as useBillingRefresh, a as useConfig, s as useCurrencyScales, n as useOptionalBillingContext, c as usePaymentMethods, i as usePayments, o as useProducts, r as useSubscriptions };
|
|
@@ -5,12 +5,6 @@ export interface SavePaymentMethodProps {
|
|
|
5
5
|
/** The PSP to save the card with, from OpenRails's payment config. */
|
|
6
6
|
psp: PspConfig;
|
|
7
7
|
onSaved: (paymentMethodId: string) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Where the provider returns after an off-page verification (3-D Secure),
|
|
10
|
-
* given the setup id to confirm with `client.confirmCardSetup`. Default:
|
|
11
|
-
* the current page with `?setup_id=`.
|
|
12
|
-
*/
|
|
13
|
-
returnURL?: (setupId: string) => string;
|
|
14
8
|
/** Billing country to preselect; default: the browser locale's region. */
|
|
15
9
|
defaultCountry?: string;
|
|
16
10
|
submitLabel?: string;
|