@msm-platform/customer-react 0.1.0 → 0.3.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 +16 -0
- package/README.md +25 -34
- package/dist/booking.d.ts +19 -0
- package/dist/client.d.ts +3 -0
- package/dist/context.d.ts +12 -2
- package/dist/i18n.d.ts +44 -1
- package/dist/index.d.ts +11 -7
- package/dist/index.js +797 -281
- package/dist/layout.d.ts +8 -1
- package/dist/screens/bookings.d.ts +5 -0
- package/dist/screens/business.d.ts +11 -0
- package/dist/screens/businesses.d.ts +2 -0
- package/dist/server/index.d.ts +8 -29
- package/dist/server.js +125 -252
- package/dist/sign-in.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/server/limits.d.ts +0 -44
- package/dist/server/turnstile.d.ts +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to `@msm-platform/customer-react`. The format follows [Keep
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.3.0] - 2026-11-15
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Breaking:** the engine checks the bot check and limits code requests now, so the server half only forwards the screens' `botCheckToken` and `clientIp(request)` to it. `createCustomerHandler` no longer takes `limiter`, `botCheck`, `limits` or `limiterPrefix`, and `redisLimiterStore`, `memoryLimiterStore`, `turnstile`, `LimiterStore`, `RedisEvalClient` and `BotCheckVerifier` are removed: delete them from your options and imports. Your server needs no Redis and no Turnstile secret; MSM keeps the widget's secret and hands over its site key for the screens' `botCheck` prop. `clientIp` stays required, and a code request without an address still answers 503 `ClientIpUnavailable`. The engine's refusals reach the screens unchanged: 403 `BotCheckFailed`, 429 `TooManyAttempts` with `Retry-After`, 503 `BotCheckUnavailable` or `LimiterUnavailable`. A code request without `botCheckToken` is now 400 `InvalidRequest` instead of 403, and the phone's format is checked by the engine (400 `ValidationFailed`) instead of before the call. It needs the engine release that checks the token: an older engine refuses the forwarded fields with 400.
|
|
12
|
+
|
|
13
|
+
## [0.2.0] - 2026-11-14
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Booking screens: the partner's businesses, a business with its event types and a week of its availability (classes with the seats left and open time slots in one list, in the business's timezone), then hold, sign-in or registration when needed (the chosen time is kept and held straight after), confirm, and the booking with the same cancel step as the bookings screen. Refusals (a full class, a taken slot, the limit of 5 unconfirmed holds, a lapsed hold, a time no longer bookable, missing access) are shown in the screens' own words. Link straight to a business or one of its services with `screen={{ businessId }}` or `screen={{ businessId, eventTypeId }}`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **Breaking:** the screens open on booking. Without `screen` and `onNavigate`, the first screen is now `businesses`, the partner's businesses, instead of `bookings`; and `CustomerScreen` widens with `"businesses"`, `{ businessId }` and `{ businessId, eventTypeId }`, so a host whose `onNavigate` or `switch` covers only `bookings`, `passes` and `details` needs the new values. Pass `screen="bookings"` to keep opening on bookings.
|
|
22
|
+
|
|
7
23
|
## [0.1.0] - 2026-11-13
|
|
8
24
|
|
|
9
25
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MSM customer screens (`@msm-platform/customer-react`)
|
|
2
2
|
|
|
3
|
-
MSM's customer screens as a React library, and their server half for the partner's own server. The screens cover phone sign-in and registration, bookings with cancellation, memberships and passes, and details (only the name is editable), with sign out and sign out everywhere. React and React DOM are peers; it does not use React Router. [`examples/customer-nextjs`](https://github.com/Sveittur/msm-platform/tree/main/examples/customer-nextjs) is the starter that mounts both halves, and the screens' dev host in this repository.
|
|
3
|
+
MSM's customer screens as a React library, and their server half for the partner's own server. The screens cover booking (the partner's businesses, a business's event types and a week of its availability, then hold, sign in if needed, confirm and cancel), phone sign-in and registration, bookings with cancellation, memberships and passes, and details (only the name is editable), with sign out and sign out everywhere. React and React DOM are peers; it does not use React Router. [`examples/customer-nextjs`](https://github.com/Sveittur/msm-platform/tree/main/examples/customer-nextjs) is the starter that mounts both halves, and the screens' dev host in this repository.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install @msm-platform/customer-react
|
|
@@ -10,7 +10,7 @@ It depends on `@msm-platform/customer-sdk`, which the server half calls the engi
|
|
|
10
10
|
|
|
11
11
|
## Public API
|
|
12
12
|
|
|
13
|
-
What the changelog treats as breaking to rename or remove: the exports of `.` and `./server` and the stylesheet `./style.css`; the props below, including `brand: {name, logo}
|
|
13
|
+
What the changelog treats as breaking to rename or remove: the exports of `.` and `./server` and the stylesheet `./style.css`; the props below, including `brand: {name, logo}`, `botCheck: {provider: "turnstile", siteKey}` and the `screen` values `businesses`, `{businessId}`, `{businessId, eventTypeId}`, `bookings`, `passes` and `details` (a new value is additive; renaming or removing one, or changing the default `businesses`, is breaking); the nine `--msm-customer-*` properties ([Theming](#theming)); the server half's options and routes, including the `botCheckToken` field; and `readCustomerSession`. Another bot-check provider would be an additive member of `botCheck`'s union; renaming `"turnstile"` or `botCheckToken` is breaking. The server half's `clientIp` is required in every environment, and `createCustomerHandler` throws without it.
|
|
14
14
|
|
|
15
15
|
## The screens
|
|
16
16
|
|
|
@@ -28,15 +28,19 @@ import { MsmCustomer } from "@msm-platform/customer-react";
|
|
|
28
28
|
/>;
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
| Prop | Meaning
|
|
32
|
-
| ---------------------- |
|
|
33
|
-
| `basePath` | Where the server half is mounted, such as `/msm`. The screens call only `${basePath}/auth/*` and `${basePath}/engine/web/*`, with `X-MSM-BFF: 1`.
|
|
34
|
-
| `brand` | Optional `{name, logo}` for the header and sign-in. Loading it is the host's job. Colours come from CSS ([Theming](#theming)).
|
|
35
|
-
| `botCheck` | Required: `{ provider: "turnstile", siteKey }`, the partner's Cloudflare Turnstile site key. A plain object, so a server component can pass it.
|
|
36
|
-
| `screen`, `onNavigate` | `bookings`, `passes` or `details`. Leave both out and the package switches screens itself; pass both to drive it from the host's URL or router.
|
|
31
|
+
| Prop | Meaning |
|
|
32
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `basePath` | Where the server half is mounted, such as `/msm`. The screens call only `${basePath}/auth/*` and `${basePath}/engine/web/*`, with `X-MSM-BFF: 1`. |
|
|
34
|
+
| `brand` | Optional `{name, logo}` for the header and sign-in. Loading it is the host's job. Colours come from CSS ([Theming](#theming)). |
|
|
35
|
+
| `botCheck` | Required: `{ provider: "turnstile", siteKey }`, the partner's Cloudflare Turnstile site key. A plain object, so a server component can pass it. |
|
|
36
|
+
| `screen`, `onNavigate` | `businesses` (the default), `{ businessId }`, `{ businessId, eventTypeId }`, `bookings`, `passes` or `details`. Leave both out and the package switches screens itself; pass both to drive it from the host's URL or router, which also lets the partner's own pages link straight to a business or one of its event types. |
|
|
37
37
|
|
|
38
38
|
The browser holds no credentials: the server half adds the client's and keeps the session in an encrypted HttpOnly cookie.
|
|
39
39
|
|
|
40
|
+
### Booking
|
|
41
|
+
|
|
42
|
+
Browsing needs no session: the business list, a business and its availability are public reads. Availability shows a week at a time from today in the business's timezone, events with the seats left and open time slots in one list, narrowed to one event type when the screen names one. Choosing a time holds it; a customer who is signed out signs in or registers first, and the time they chose is held straight after. The hold lasts 10 minutes, the engine's hold, and confirming turns it into a booking, shown with the same cancel step and late-cancellation wording as the bookings screen. The engine's refusals are shown in the screens' own words, picked by their code: a full event, a taken slot, the limit of 5 unconfirmed holds, a hold that lapsed before confirming (with an offer to hold it again), a time that can no longer be booked, and an event type that needs a membership or pass. Payment is not part of booking yet.
|
|
43
|
+
|
|
40
44
|
Before sending a code, sign-in and registration show Cloudflare Turnstile and send its token as `botCheckToken`. The widget's script (`https://challenges.cloudflare.com/turnstile/v0/api.js`) loads only in the phone step, so a Content Security Policy needs `https://challenges.cloudflare.com` in `script-src` and `frame-src`. Without a `botCheck` prop, sign-in says it isn't set up and sends nothing. In development, Cloudflare's test site key `1x00000000000000000000AA` always passes.
|
|
41
45
|
|
|
42
46
|
The built entry starts with `"use client"`, so a Next.js server component can import it; it touches no browser globals at import and renders on the server (as "Loading…" until mounted).
|
|
@@ -73,14 +77,7 @@ A Fetch API handler, `Request` in and `Response` out, for the routes the screens
|
|
|
73
77
|
|
|
74
78
|
```ts
|
|
75
79
|
// app/msm/[...path]/route.ts
|
|
76
|
-
import {
|
|
77
|
-
createCustomerHandler,
|
|
78
|
-
redisLimiterStore,
|
|
79
|
-
turnstile,
|
|
80
|
-
} from "@msm-platform/customer-react/server";
|
|
81
|
-
import { createClient } from "redis";
|
|
82
|
-
|
|
83
|
-
const redis = await createClient({ url: process.env.REDIS_URL }).connect();
|
|
80
|
+
import { createCustomerHandler } from "@msm-platform/customer-react/server";
|
|
84
81
|
|
|
85
82
|
const handler = createCustomerHandler({
|
|
86
83
|
basePath: "/msm",
|
|
@@ -88,8 +85,6 @@ const handler = createCustomerHandler({
|
|
|
88
85
|
clientId: process.env.MSM_CLIENT_ID!,
|
|
89
86
|
clientSecret: process.env.MSM_CLIENT_SECRET!,
|
|
90
87
|
sessionKeys: process.env.MSM_SESSION_KEYS!.split(","),
|
|
91
|
-
limiter: redisLimiterStore(redis),
|
|
92
|
-
botCheck: turnstile({ secretKey: process.env.TURNSTILE_SECRET_KEY! }),
|
|
93
88
|
clientIp: (request) => yourTrustedClientIp(request),
|
|
94
89
|
});
|
|
95
90
|
export {
|
|
@@ -106,11 +101,9 @@ export {
|
|
|
106
101
|
| `basePath` | Where the route is mounted; the screens' `basePath`. |
|
|
107
102
|
| `engineUrl`, `clientId`, `clientSecret` | The engine and the partner's website application client. It calls the engine through `@msm-platform/customer-sdk` in server mode, so the secret never leaves this server. |
|
|
108
103
|
| `sessionKeys` | One key or a list, each at least 32 bytes (`openssl rand -base64 32`). The first encrypts the cookie and every one decrypts, so to rotate put the new key first and keep the old one until its cookies expire. |
|
|
109
|
-
| `
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
| `limits` | Code requests per phone (default 5 per 15 minutes) and per IP (default 5 per 10 minutes), counted together for sign-in and registration. |
|
|
113
|
-
| `limiterPrefix` | The limiter's key prefix, default `msm:customer:limit:`, for a Redis shared with other apps. |
|
|
104
|
+
| `clientIp` | Required. The visitor's address, from what your platform guarantees; the engine limits code requests by it. Return null when unknown, which refuses code requests. |
|
|
105
|
+
|
|
106
|
+
MSM owns your website's Cloudflare Turnstile widget and keeps its secret: the engine verifies the screens' token with it and limits code requests per address and per phone, so this server needs no Redis and no Turnstile secret. MSM hands over the widget's site key, which is public, with the client credentials.
|
|
114
107
|
|
|
115
108
|
**Never trust a header the client can set for `clientIp`.** The leftmost `X-Forwarded-For` entry is whatever the client sent, so anyone could pick a fresh address for every request. Use your platform's own client address, or the entry your trusted proxy appends, counted from the right.
|
|
116
109
|
|
|
@@ -118,16 +111,14 @@ export {
|
|
|
118
111
|
|
|
119
112
|
Every route needs the `X-MSM-BFF: 1` header the screens send. Browsers send a custom header cross-origin only after a CORS preflight, which the handler never approves, so another site cannot call these routes with the customer's cookie.
|
|
120
113
|
|
|
121
|
-
| Route | Behaviour
|
|
122
|
-
| ------------------------------------------------------------ |
|
|
123
|
-
| `POST auth/initiate` `{phone, botCheckToken}` |
|
|
124
|
-
| `POST auth/register/initiate` `{phone, name, botCheckToken}` |
|
|
125
|
-
| `POST auth/login`, `POST auth/register` `{challenge, code}` | Redeems the code exactly once, never retried, and sets the session cookie. Returns `{sessionKey}`, the session's ID.
|
|
126
|
-
| `GET auth/session` | `{sessionKey}`, or 401.
|
|
127
|
-
| `POST auth/logout` | Revokes the session at the engine and clears the cookie.
|
|
128
|
-
| `/engine/web/*` | Proxied to the engine's `/web`, except `/web/identity/*`, with the client's credentials and the cookie's session. Only `Accept`, `Content-Type` and `Accept-Language` pass from the browser. A 401, or a successful `DELETE /engine/web/me/sessions` (sign out everywhere), clears the cookie.
|
|
129
|
-
|
|
130
|
-
Limiter keys hold SHA-256 hashes of the phone (as E.164) and the address (IPv4 as is, IPv6 by its /64), never the values themselves.
|
|
114
|
+
| Route | Behaviour |
|
|
115
|
+
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `POST auth/initiate` `{phone, botCheckToken}` | Asks the engine for a sign-in code with the token and `clientIp(request)`; without an address it refuses with 503 `ClientIpUnavailable` and calls nothing. The engine checks the token (403 `BotCheckFailed`, or 503 `BotCheckUnavailable` when it cannot), then counts the address (429 `TooManyAttempts` with `Retry-After`, or 503 `LimiterUnavailable`) and the phone; its refusals pass through with their status, code and `Retry-After`. |
|
|
117
|
+
| `POST auth/register/initiate` `{phone, name, botCheckToken}` | Asks for a registration code the same way, against the same counts. |
|
|
118
|
+
| `POST auth/login`, `POST auth/register` `{challenge, code}` | Redeems the code exactly once, never retried, and sets the session cookie. Returns `{sessionKey}`, the session's ID. |
|
|
119
|
+
| `GET auth/session` | `{sessionKey}`, or 401. |
|
|
120
|
+
| `POST auth/logout` | Revokes the session at the engine and clears the cookie. |
|
|
121
|
+
| `/engine/web/*` | Proxied to the engine's `/web`, except `/web/identity/*`, with the client's credentials and the cookie's session. Only `Accept`, `Content-Type` and `Accept-Language` pass from the browser. A 401, or a successful `DELETE /engine/web/me/sessions` (sign out everywhere), clears the cookie. |
|
|
131
122
|
|
|
132
123
|
### Sessions
|
|
133
124
|
|
|
@@ -139,6 +130,6 @@ The session lives in no store: the cookie `__Host-msm_customer_session` (HttpOnl
|
|
|
139
130
|
|
|
140
131
|
Every string comes from the typed catalog in `src/i18n.ts` (`t(key)`); a new locale is a `Messages` object, which TypeScript makes supply every key. Dates and times use `Intl` in `en-GB` and the business's timezone from `GET /web/businesses`, or the browser's for a business that list does not include.
|
|
141
132
|
|
|
142
|
-
Tests: `pnpm exec vitest run packages/customer-react` from the root.
|
|
133
|
+
Tests: `pnpm exec vitest run packages/customer-react` from the root.
|
|
143
134
|
|
|
144
135
|
The build bundles the private `@msm-platform/ui` (the phone input) into `dist/index.js` and its styles into `dist/style.css`; `ui` is a devDependency and the packed manifest has none. `pnpm test:packages` installs the packed package outside the workspace beside only the customer SDK and React. Releases follow the repository's [release runbook](https://github.com/Sveittur/msm-platform/blob/main/docs/runbooks/customer-react.md), and every release's changes are in [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Business, Candidate } from "./client";
|
|
2
|
+
/** The candidate a customer chose to book, kept through sign-in. */
|
|
3
|
+
export interface Choice {
|
|
4
|
+
business: Business;
|
|
5
|
+
candidate: Candidate;
|
|
6
|
+
}
|
|
7
|
+
/** What the customer is booking: what, where, when and with whom. */
|
|
8
|
+
export declare function ChoiceSummary({ choice }: {
|
|
9
|
+
choice: Choice;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Books the chosen candidate for the signed-in customer: holds it at once,
|
|
13
|
+
* confirms it on the customer's word, then shows the booking with the same
|
|
14
|
+
* cancel step as the bookings screen. Refusals are in the package's words.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Booking(props: {
|
|
17
|
+
choice: Choice;
|
|
18
|
+
onBack: () => void;
|
|
19
|
+
}): import("react").JSX.Element;
|
package/dist/client.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export type OwnBooking = Ok<paths["/web/me/bookings"]["get"]>["items"][number];
|
|
|
12
12
|
export type Membership = Ok<paths["/web/me/memberships"]["get"]>[number];
|
|
13
13
|
export type Business = Ok<paths["/web/businesses"]["get"]>["items"][number];
|
|
14
14
|
export type MyDetails = Ok<paths["/web/me"]["get"]>;
|
|
15
|
+
export type EventType = Ok<paths["/web/businesses/{businessId}/event-types"]["get"]>["items"][number];
|
|
16
|
+
/** One booking candidate: a seat in a scheduled event or an open time slot. */
|
|
17
|
+
export type Candidate = Ok<paths["/web/businesses/{businessId}/availability"]["get"]>["items"][number];
|
|
15
18
|
/** The host's name and logo, which the host loads and passes in. */
|
|
16
19
|
export interface CustomerBrand {
|
|
17
20
|
name: string;
|
package/dist/context.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type { CustomerClient } from "@msm-platform/customer-sdk";
|
|
2
2
|
import type { Business } from "./client";
|
|
3
3
|
import type { MessageKey } from "./i18n";
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The screen to show: the partner's businesses, one business (optionally
|
|
6
|
+
* narrowed to one event type), or one of the customer's account screens.
|
|
7
|
+
*/
|
|
8
|
+
export type CustomerScreen = "businesses" | "bookings" | "passes" | "details" | {
|
|
9
|
+
businessId: string;
|
|
10
|
+
eventTypeId?: string;
|
|
11
|
+
};
|
|
6
12
|
export interface Portal {
|
|
7
13
|
client: CustomerClient;
|
|
8
14
|
/** The partner's public businesses by ID; a business missing here is not public. */
|
|
9
15
|
businesses: Map<string, Business>;
|
|
16
|
+
/** Whether `businesses` is complete, still loading or failed to load. */
|
|
17
|
+
businessesStatus: "loading" | "ready" | "failed";
|
|
18
|
+
reloadBusinesses: () => void;
|
|
19
|
+
navigate: (screen: CustomerScreen) => void;
|
|
10
20
|
/** Ends the session on the server and returns to sign-in with this notice. */
|
|
11
21
|
signOut: (notice?: MessageKey) => Promise<void>;
|
|
12
22
|
}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ declare const en: {
|
|
|
4
4
|
readonly "app.retry": "Try again";
|
|
5
5
|
readonly "app.signedOut": "You were signed out because your session ended. Sign in again.";
|
|
6
6
|
readonly "app.signedOutEverywhere": "You were signed out on every device.";
|
|
7
|
-
readonly "nav.label": "
|
|
7
|
+
readonly "nav.label": "Booking and my account";
|
|
8
|
+
readonly "nav.book": "Book";
|
|
9
|
+
readonly "nav.signIn": "Sign in";
|
|
8
10
|
readonly "nav.bookings": "Bookings";
|
|
9
11
|
readonly "nav.passes": "Passes";
|
|
10
12
|
readonly "nav.details": "My details";
|
|
@@ -69,6 +71,45 @@ declare const en: {
|
|
|
69
71
|
readonly "bookings.doneLate": "Your booking is cancelled. It counts as a late cancellation.";
|
|
70
72
|
readonly "bookings.cancelFailed": "The booking could not be cancelled. Try again.";
|
|
71
73
|
readonly "bookings.gone": "This booking no longer exists.";
|
|
74
|
+
readonly "businesses.heading": "Book";
|
|
75
|
+
readonly "businesses.intro": "Choose where you'd like to book.";
|
|
76
|
+
readonly "businesses.empty": "No businesses take bookings here yet.";
|
|
77
|
+
readonly "businesses.open": "See times";
|
|
78
|
+
readonly "business.all": "All businesses";
|
|
79
|
+
readonly "business.notFound": "This business isn't taking bookings here.";
|
|
80
|
+
readonly "business.types": "Services";
|
|
81
|
+
readonly "business.allTypes": "Everything";
|
|
82
|
+
readonly "business.typeMissing": "This service can't be booked here.";
|
|
83
|
+
readonly "business.minutes": "{minutes} min";
|
|
84
|
+
readonly "business.week": "Which week";
|
|
85
|
+
readonly "business.previousWeek": "Previous week";
|
|
86
|
+
readonly "business.nextWeek": "Next week";
|
|
87
|
+
readonly "business.weekOf": "{from} – {to}";
|
|
88
|
+
readonly "business.empty": "Nothing is open in these days.";
|
|
89
|
+
readonly "business.seatsLeft.one": "{count} seat left";
|
|
90
|
+
readonly "business.seatsLeft.other": "{count} seats left";
|
|
91
|
+
readonly "business.full": "Full";
|
|
92
|
+
readonly "business.openTime": "Open time";
|
|
93
|
+
readonly "business.with": "With {resource}";
|
|
94
|
+
readonly "business.book": "Book";
|
|
95
|
+
readonly "book.heading": "Your booking";
|
|
96
|
+
readonly "book.signInFirst": "Sign in or create an account to book this time.";
|
|
97
|
+
readonly "book.back": "Choose another time";
|
|
98
|
+
readonly "book.reserving": "Holding this time for you…";
|
|
99
|
+
readonly "book.heldUntil": "We're holding this time for you until {time}.";
|
|
100
|
+
readonly "book.confirm": "Confirm booking";
|
|
101
|
+
readonly "book.confirming": "Confirming…";
|
|
102
|
+
readonly "book.booked": "You're booked.";
|
|
103
|
+
readonly "book.toBookings": "See all my bookings";
|
|
104
|
+
readonly "book.reserveAgain": "Hold this time again";
|
|
105
|
+
readonly "book.full": "This class is full now. Choose another time.";
|
|
106
|
+
readonly "book.slotTaken": "Someone has just taken this time. Choose another.";
|
|
107
|
+
readonly "book.limit": "You already hold the most unconfirmed bookings allowed. Confirm one, or wait a few minutes for an unconfirmed one to lapse, then try again.";
|
|
108
|
+
readonly "book.expired": "We held this time for as long as we could, and it has lapsed. Hold it again if it's still free.";
|
|
109
|
+
readonly "book.notAllowed": "Booking this needs a membership or pass that covers it. Ask the business.";
|
|
110
|
+
readonly "book.unavailable": "This time can no longer be booked. Choose another.";
|
|
111
|
+
readonly "book.refused": "This business can't take your booking. Contact them.";
|
|
112
|
+
readonly "book.failed": "The booking could not be made. Try again.";
|
|
72
113
|
readonly "passes.heading": "Memberships and passes";
|
|
73
114
|
readonly "passes.empty": "You have no memberships or passes.";
|
|
74
115
|
readonly "passes.unlimited": "Unlimited";
|
|
@@ -110,6 +151,8 @@ export declare function formatNumber(value: number): string;
|
|
|
110
151
|
export declare function formatDateTime(iso: string, timeZone?: string): string;
|
|
111
152
|
export declare function formatTime(iso: string, timeZone?: string): string;
|
|
112
153
|
export declare function formatDate(iso: string, timeZone?: string): string;
|
|
154
|
+
/** A day as a heading, such as "Tuesday 1 December", in `timeZone`. */
|
|
155
|
+
export declare function formatDay(iso: string, timeZone?: string): string;
|
|
113
156
|
/** A start and end, with the end's date left out when both fall on one day. */
|
|
114
157
|
export declare function formatRange(start: string, end: string, timeZone?: string): string;
|
|
115
158
|
/** Seconds under a minute, minutes under an hour, hours beyond that. */
|
package/dist/index.d.ts
CHANGED
|
@@ -20,17 +20,21 @@ export interface MsmCustomerProps {
|
|
|
20
20
|
*/
|
|
21
21
|
botCheck: CustomerBotCheck;
|
|
22
22
|
/**
|
|
23
|
-
* The screen to show
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* The screen to show: `businesses` (the default), a business as
|
|
24
|
+
* `{ businessId }` or one of its event types as `{ businessId, eventTypeId }`,
|
|
25
|
+
* or `bookings`, `passes` or `details`. Leave both this and `onNavigate`
|
|
26
|
+
* out to let the package switch screens itself; pass both to drive it from
|
|
27
|
+
* the host's router or URL.
|
|
26
28
|
*/
|
|
27
29
|
screen?: CustomerScreen;
|
|
28
30
|
onNavigate?: (screen: CustomerScreen) => void;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
|
-
* MSM's customer screens:
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* MSM's customer screens: the partner's businesses with their times to
|
|
34
|
+
* book, phone sign-in and registration when a booking or account screen
|
|
35
|
+
* needs it, then the customer's bookings, passes and details. The server
|
|
36
|
+
* half keeps the session in an encrypted HttpOnly cookie; the browser holds
|
|
37
|
+
* no credentials. Nothing here runs before mount, so it renders on a server
|
|
38
|
+
* and imports without a browser.
|
|
35
39
|
*/
|
|
36
40
|
export declare function MsmCustomer(props: MsmCustomerProps): import("react").JSX.Element;
|