@meterbox/react 0.1.20 → 0.1.21
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/README.md +10 -10
- package/package.json +2 -2
- package/src/i18n.js +5 -5
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ what happens past them (billed, stopped until next month, or an upgrade), and
|
|
|
80
80
|
every model's input and output rates per 1M tokens, tier ladders included.
|
|
81
81
|
|
|
82
82
|
A plan lists its included credits first ("1,500 Bits a month", in the tenant's credit unit), then
|
|
83
|
-
its `bullet_details`, which `GET /v1/plans`, the pricing snapshot and the customer portal's plans
|
|
83
|
+
its `bullet_details`, which `GET /v1/plans`, the pricing snapshot, and the customer portal's plans
|
|
84
84
|
all carry: each feature by its name on the plan, else by its label with its description behind an
|
|
85
85
|
info icon, by its description when it has no label, and by its id only when it has neither. Without them, it
|
|
86
86
|
lists its `bullets`, else its `features` (`[{ id, name }]`) by name, else by id. A
|
|
@@ -106,10 +106,10 @@ resolved URL for your own calls.
|
|
|
106
106
|
### Branding: `<BrandingProvider branding>`
|
|
107
107
|
|
|
108
108
|
Every component styles itself from `--mbx-*` CSS variables (`--mbx-accent`,
|
|
109
|
-
`--mbx-text`, `--mbx-card`, `--mbx-border`, `--mbx-font`, `--mbx-radius
|
|
109
|
+
`--mbx-text`, `--mbx-card`, `--mbx-border`, `--mbx-font`, `--mbx-radius`, and the
|
|
110
110
|
button variables), with Meterbox's defaults as fallbacks. Wrap them in
|
|
111
111
|
`<BrandingProvider branding={branding}>` to apply your branding from
|
|
112
|
-
Settings → Branding (`GET /v1/settings/branding`): logo, colors, font and
|
|
112
|
+
Settings → Branding (`GET /v1/settings/branding`): logo, colors, font, and
|
|
113
113
|
button style. `<PricingTable publishableKey>` applies it from the
|
|
114
114
|
pricing snapshot by itself, and any component's surroundings can set the
|
|
115
115
|
variables in CSS. `useBranding()` reads the values (e.g. the logo), and
|
|
@@ -120,14 +120,14 @@ match.
|
|
|
120
120
|
|
|
121
121
|
Wrap the components in `<LocaleProvider locale="fr">` to show them in your
|
|
122
122
|
customer's language (the ones the customer portal uses: the pricing table,
|
|
123
|
-
plan change and preview, credits, invoices and billing details): English (the default), Spanish (`es`), French (`fr`) and
|
|
123
|
+
plan change and preview, credits, invoices, and billing details): English (the default), Spanish (`es`), French (`fr`), and
|
|
124
124
|
German (`de`) are built in, picked by the locale's language (`fr-CA` uses
|
|
125
125
|
French). Dates and amounts are formatted for the locale. `messages` overrides
|
|
126
126
|
any string by its key (`{ "cancel.button": "End my plan" }`), or translates
|
|
127
127
|
them all for another language; anything it leaves out stays in English. The
|
|
128
128
|
keys and English text are in [`src/i18n.js`](./src/i18n.js). Plan names,
|
|
129
|
-
features and offers are shown as you entered them. `useI18n()` gives your own
|
|
130
|
-
elements the same `t(key, vars)`, `date(iso)
|
|
129
|
+
features, and offers are shown as you entered them. `useI18n()` gives your own
|
|
130
|
+
elements the same `t(key, vars)`, `date(iso)`, and `money(amount, currency)`.
|
|
131
131
|
|
|
132
132
|
### `<BillingDetailsButton customerId customerToken returnUrl? label? onSession? onError? />`
|
|
133
133
|
|
|
@@ -135,7 +135,7 @@ Sends the customer to Stripe's own Billing Portal to update their payment
|
|
|
135
135
|
method and billing details (address, tax IDs, email, name, phone) and see
|
|
136
136
|
their invoices, so payment details never pass through your app or Meterbox.
|
|
137
137
|
POSTs to `/v1/customer-portal/:id/billing-details` and redirects; Stripe
|
|
138
|
-
sends them back to `returnUrl` (default: the current page).
|
|
138
|
+
sends them back to `returnUrl` (default: the current page). Canceling and
|
|
139
139
|
plan changes aren't offered there: they stay in Meterbox's own flows. It
|
|
140
140
|
works once the customer has a Stripe account and the tenant has enabled
|
|
141
141
|
`checkout_via_meterbox`, which `GET /v1/customer-portal/:id/me` reports as
|
|
@@ -167,7 +167,7 @@ gets each body it fetches itself.
|
|
|
167
167
|
### `<PlanChangeCard preview? scheduledChange? allowSchedule? | customerId customerToken planId planVersion? fetch? onConfirm? onCancelScheduled? onChanged? />`
|
|
168
168
|
|
|
169
169
|
Composes `<SubscriptionPreview>` with the actions it doesn't have: actually
|
|
170
|
-
applying or scheduling the change, and
|
|
170
|
+
applying or scheduling the change, and canceling a pending scheduled one.
|
|
171
171
|
Change now and Schedule each ask first (which plan, when, and what's billed
|
|
172
172
|
for it and when, as the preview says) and act only on "Yes, change it".
|
|
173
173
|
Two modes:
|
|
@@ -214,9 +214,9 @@ Inline SVG line + area chart of credit balance over time, fed by
|
|
|
214
214
|
|
|
215
215
|
### `<InvoiceHistory invoices? | customerId customerToken />`
|
|
216
216
|
|
|
217
|
-
The invoices the customer received, newest first: date, number, status and
|
|
217
|
+
The invoices the customer received, newest first: date, number, status, and
|
|
218
218
|
amount, with a link to download each Stripe invoice's PDF and to its hosted
|
|
219
|
-
page (
|
|
219
|
+
page (labeled "Pay" while it's due). Self-fetches
|
|
220
220
|
`GET /v1/customer-portal/:id/invoices` with the customer token.
|
|
221
221
|
|
|
222
222
|
### `<UsageChart series valueKey? height? label? />`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meterbox/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Embeddable React components for Meterbox: pricing tables, subscription preview, credit balance and usage charts. Presentational by default, with data fetched by your backend via @meterbox/node.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://meterbox.ai",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@meterbox/node": "0.1.
|
|
24
|
+
"@meterbox/node": "0.1.6"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=17",
|
package/src/i18n.js
CHANGED
|
@@ -35,8 +35,8 @@ const en = {
|
|
|
35
35
|
"status.trialing": "trialing",
|
|
36
36
|
"status.past_due": "past due",
|
|
37
37
|
"status.incomplete": "incomplete",
|
|
38
|
-
"status.cancelling": "
|
|
39
|
-
"status.cancelled": "
|
|
38
|
+
"status.cancelling": "canceling",
|
|
39
|
+
"status.cancelled": "canceled",
|
|
40
40
|
|
|
41
41
|
"plans.loading": "Loading plans…",
|
|
42
42
|
"plans.error": "Could not load plans.",
|
|
@@ -45,8 +45,8 @@ const en = {
|
|
|
45
45
|
"plans.noFixedPrice": "{plan} has no fixed price. Get in touch to move to it.",
|
|
46
46
|
|
|
47
47
|
"cancel.button": "Cancel subscription",
|
|
48
|
-
"cancel.why": "Why are you
|
|
49
|
-
"cancel.reasonLabel": "Reason for
|
|
48
|
+
"cancel.why": "Why are you canceling?",
|
|
49
|
+
"cancel.reasonLabel": "Reason for canceling",
|
|
50
50
|
"cancel.reason.too_expensive": "It's too expensive",
|
|
51
51
|
"cancel.reason.missing_features": "It's missing features I need",
|
|
52
52
|
"cancel.reason.switched_to_competitor": "I'm switching to another product",
|
|
@@ -105,7 +105,7 @@ const en = {
|
|
|
105
105
|
"planChange.changed": "Plan changed.",
|
|
106
106
|
"planChange.changedTo": "Plan changed to {plan}.",
|
|
107
107
|
"planChange.failed": "Plan change failed.",
|
|
108
|
-
"planChange.scheduledCancelled": "Scheduled change
|
|
108
|
+
"planChange.scheduledCancelled": "Scheduled change canceled.",
|
|
109
109
|
"planChange.cancelFailed": "Cancel failed.",
|
|
110
110
|
"planChange.pending": "Scheduled change to {plan} on {date}.",
|
|
111
111
|
"planChange.cancel": "Cancel",
|