@pontive/pontkit-core 1.45.0 → 1.47.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/catalog.json +1 -1
- package/dist/core/messages.d.ts +2 -0
- package/dist/custom-elements.json +858 -759
- package/dist/index.mjs +2254 -2091
- package/dist/index.mjs.map +1 -1
- package/dist/kit/checkout/checkout.d.ts +6 -1
- package/dist/kit/checkout/tax-id.d.ts +25 -0
- package/dist/kit/provider/account-billing.d.ts +22 -15
- package/package.json +1 -1
|
@@ -26,6 +26,8 @@ export type CheckoutPhase = "loading" | "choose" | "review" | "confirming" | "do
|
|
|
26
26
|
export declare const CHECKOUT_RETURN_PARAM = "pont_checkout_session";
|
|
27
27
|
declare const ADDRESS_FIELDS: readonly ["country", "line1", "line2", "city", "postal_code", "state"];
|
|
28
28
|
type AddressField = (typeof ADDRESS_FIELDS)[number];
|
|
29
|
+
/** A field that can show an error: the address's, and the tax id's type. */
|
|
30
|
+
type CheckedField = AddressField | "tax_type";
|
|
29
31
|
/**
|
|
30
32
|
* # `<pont-checkout>`: buy a package inside the client's product (billing-svc docs/m17-design.md, Part 3)
|
|
31
33
|
*
|
|
@@ -76,7 +78,8 @@ export declare class Checkout extends HostElement {
|
|
|
76
78
|
protected frequency: string;
|
|
77
79
|
protected address: BillingAddress;
|
|
78
80
|
protected taxId: string;
|
|
79
|
-
protected
|
|
81
|
+
protected taxIdType: string;
|
|
82
|
+
protected fieldErrors: Partial<Record<CheckedField, string>>;
|
|
80
83
|
protected preview: CheckoutPreview | null;
|
|
81
84
|
protected busy: boolean;
|
|
82
85
|
protected actionError: string | null;
|
|
@@ -133,6 +136,8 @@ export declare class Checkout extends HostElement {
|
|
|
133
136
|
private renderPrice;
|
|
134
137
|
private renderChoose;
|
|
135
138
|
private renderInput;
|
|
139
|
+
/** The tax id: its type from the provider's list, then its value (32-billing-overview.md, Customer tax_ids). */
|
|
140
|
+
private renderTaxId;
|
|
136
141
|
private renderAddress;
|
|
137
142
|
private renderReview;
|
|
138
143
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # The tax id a checkout collects (pontive-spec 32-billing-overview.md, Customer, `tax_ids`)
|
|
3
|
+
*
|
|
4
|
+
* billing-svc writes the confirm's `tax_id` to the Customer's `tax_ids`, so it needs both `type`
|
|
5
|
+
* and `value` (billing-svc 1.7.0, M17). The spec defines no type for a country, so the end customer
|
|
6
|
+
* picks one, and a type is required once a value is entered.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The types offered: the provider's list, which the spec defers to. This is Stripe's, as
|
|
10
|
+
* billing-svc 1.7.0 pins it (stripe-go v86), without `unknown`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TAX_ID_TYPES: readonly ["ad_nrt", "ae_trn", "al_tin", "am_tin", "ao_tin", "ar_cuit", "au_abn", "au_arn", "aw_tin", "az_tin", "ba_tin", "bb_tin", "bd_bin", "bf_ifu", "bg_uic", "bh_vat", "bj_ifu", "bo_tin", "br_cnpj", "br_cpf", "bs_tin", "by_tin", "ca_bn", "ca_gst_hst", "ca_pst_bc", "ca_pst_mb", "ca_pst_sk", "ca_qst", "cd_nif", "ch_uid", "ch_vat", "cl_tin", "cm_niu", "cn_tin", "co_nit", "cr_tin", "cv_nif", "de_stn", "do_rcn", "ec_ruc", "eg_tin", "es_cif", "et_tin", "eu_oss_vat", "eu_vat", "fo_vat", "gb_vat", "ge_vat", "gi_tin", "gn_nif", "hk_br", "hr_oib", "hu_tin", "ic_nif", "id_npwp", "il_vat", "in_gst", "is_vat", "it_cf", "jp_cn", "jp_rn", "jp_trn", "ke_pin", "kg_tin", "kh_tin", "kr_brn", "kz_bin", "la_tin", "li_uid", "li_vat", "lk_vat", "ma_vat", "md_vat", "me_pib", "mk_vat", "mr_nif", "mx_rfc", "my_frp", "my_itn", "my_sst", "ng_tin", "no_vat", "no_voec", "np_pan", "nz_gst", "om_vat", "pe_ruc", "ph_tin", "pl_nip", "py_ruc", "ro_tin", "rs_pib", "ru_inn", "ru_kpp", "sa_vat", "sg_gst", "sg_uen", "si_tin", "sn_ninea", "sr_fin", "sv_nit", "th_vat", "tj_tin", "tr_tin", "tw_vat", "tz_vat", "ua_vat", "ug_tin", "us_ein", "uy_ruc", "uz_tin", "uz_vat", "ve_rif", "vn_tin", "za_vat", "zm_tin", "zw_tin"];
|
|
13
|
+
/** How a type reads in the select: `eu_vat` is `EU VAT`. */
|
|
14
|
+
export declare function taxIdTypeLabel(type: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* What the end customer entered, as confirm and preview send it: nothing without a value,
|
|
17
|
+
* `{ type, value }` with both, and `missingType` when a value has no type.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkoutTaxId(type: string, value: string): {
|
|
20
|
+
tax_id?: {
|
|
21
|
+
type: string;
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
missingType: boolean;
|
|
25
|
+
};
|
|
@@ -8,10 +8,9 @@ import { Page } from './account-client';
|
|
|
8
8
|
* 41-embedded-organization-management.md §5.1), drawn before each request, like member management.
|
|
9
9
|
*
|
|
10
10
|
* **This file is the only place the HTTP shapes live**: the paths, the query and body each call
|
|
11
|
-
* sends, and how each answer is read.
|
|
12
|
-
* `docs/m17-design.md`)
|
|
13
|
-
*
|
|
14
|
-
* the types below.
|
|
11
|
+
* sends, and how each answer is read. They match billing-svc 1.7.0, the routes as built for M17
|
|
12
|
+
* (billing-svc `docs/m17-design.md`). If the routes change, change this file and its test; the
|
|
13
|
+
* elements read only the types below.
|
|
15
14
|
*
|
|
16
15
|
* Wire conventions, as management-api's billing routes already answer (`core/billing/protorest`):
|
|
17
16
|
* one object is sent bare with its `object`; a list is `{ object: "list", data, pagination }`;
|
|
@@ -47,7 +46,7 @@ export interface BillingAccount {
|
|
|
47
46
|
status?: string;
|
|
48
47
|
default_payment_method?: BillingPaymentMethodSummary | null;
|
|
49
48
|
/**
|
|
50
|
-
* What the caller may do here (R9)
|
|
49
|
+
* What the caller may do here (R9): `permissions: { read, pay }`, after the keys
|
|
51
50
|
* `sys:billing:read` and `sys:billing:pay`. Missing: both true, and billing-svc still decides.
|
|
52
51
|
*/
|
|
53
52
|
permissions: {
|
|
@@ -56,7 +55,7 @@ export interface BillingAccount {
|
|
|
56
55
|
};
|
|
57
56
|
/** A suspended organization the caller (its owner) may recover: only the recovery actions (P79). */
|
|
58
57
|
recovery: boolean;
|
|
59
|
-
/**
|
|
58
|
+
/** The keys for Stripe.js, `null` when the instance has no payment connection. */
|
|
60
59
|
keys: PaymentKeys | null;
|
|
61
60
|
}
|
|
62
61
|
export interface BillingPaymentMethodSummary {
|
|
@@ -86,7 +85,7 @@ export interface BillingPackageOption {
|
|
|
86
85
|
} | null;
|
|
87
86
|
/** The frequencies offered (`monthly`, `quarterly`, `annual`). */
|
|
88
87
|
billing_frequencies: string[];
|
|
89
|
-
/**
|
|
88
|
+
/** The price of one period at each frequency, `{ billing_frequency, amount }` (P65). */
|
|
90
89
|
prices: {
|
|
91
90
|
billing_frequency: string;
|
|
92
91
|
amount: BillingMoney;
|
|
@@ -105,7 +104,7 @@ export interface CheckoutSession {
|
|
|
105
104
|
success_url?: string;
|
|
106
105
|
cancel_url?: string;
|
|
107
106
|
packages: BillingPackageOption[];
|
|
108
|
-
/**
|
|
107
|
+
/** The keys for Stripe.js, so the payment form shows before confirm (deferred intent). */
|
|
109
108
|
keys: PaymentKeys | null;
|
|
110
109
|
}
|
|
111
110
|
/** What the end customer chose, sent to preview and confirm (pontive-spec 35, API Surface). */
|
|
@@ -113,9 +112,13 @@ export interface CheckoutChoice {
|
|
|
113
112
|
package_id: string;
|
|
114
113
|
billing_frequency: string;
|
|
115
114
|
billing_address?: BillingAddress;
|
|
116
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* `{ type, value }`, the shape of a Customer's tax ids, which confirm writes it to (pontive-spec 32,
|
|
117
|
+
* Customer `tax_ids`). Both are required, as in billing-svc 1.7.0 (M17); the types are
|
|
118
|
+
* `TAX_ID_TYPES` (`../checkout/tax-id.ts`).
|
|
119
|
+
*/
|
|
117
120
|
tax_id?: {
|
|
118
|
-
type
|
|
121
|
+
type: string;
|
|
119
122
|
value: string;
|
|
120
123
|
};
|
|
121
124
|
}
|
|
@@ -144,7 +147,7 @@ export interface PaymentStart {
|
|
|
144
147
|
client_secret?: string;
|
|
145
148
|
intent_type?: "payment" | "setup";
|
|
146
149
|
decline_message?: string;
|
|
147
|
-
/**
|
|
150
|
+
/** The keys, when the answer needs Stripe.js. */
|
|
148
151
|
keys?: PaymentKeys | null;
|
|
149
152
|
}
|
|
150
153
|
export interface BillingInvoiceLine {
|
|
@@ -171,7 +174,11 @@ export interface BillingInvoice {
|
|
|
171
174
|
total?: BillingMoney;
|
|
172
175
|
amount_due?: BillingMoney;
|
|
173
176
|
amount_remaining?: BillingMoney;
|
|
174
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* `amount_remaining` in the provider's integer units, as on the hosted invoice. The `/me` routes
|
|
179
|
+
* of billing-svc 1.7.0 do not send it, so the kit uses the ISO 4217 minor units of
|
|
180
|
+
* `amount_remaining`.
|
|
181
|
+
*/
|
|
175
182
|
amount_provider_units?: number;
|
|
176
183
|
hosted_url?: string;
|
|
177
184
|
}
|
|
@@ -200,7 +207,7 @@ export interface BillingContract {
|
|
|
200
207
|
id: string;
|
|
201
208
|
status: string;
|
|
202
209
|
currency?: string;
|
|
203
|
-
/**
|
|
210
|
+
/** `name` beside the reference, for the portal to show. */
|
|
204
211
|
package?: {
|
|
205
212
|
id?: string;
|
|
206
213
|
key?: string;
|
|
@@ -230,12 +237,12 @@ export interface BillingContract {
|
|
|
230
237
|
subscriptions: BillingSubscription[];
|
|
231
238
|
access?: string;
|
|
232
239
|
/**
|
|
233
|
-
*
|
|
240
|
+
* The packages and frequencies the end customer may change to (public, self-service
|
|
234
241
|
* `change`, allowed for `initiated_by: customer`), shaped as a checkout session's packages.
|
|
235
242
|
* `GET /v1/packages/public` is not in M17, so the portal has no other way to list them.
|
|
236
243
|
*/
|
|
237
244
|
change_options: BillingPackageOption[];
|
|
238
|
-
/**
|
|
245
|
+
/** The package's self-service flags; missing means "offer it and let billing-svc decide". */
|
|
239
246
|
self_service?: {
|
|
240
247
|
change?: boolean;
|
|
241
248
|
cancel?: boolean;
|