@msm-platform/customer-react 0.2.0 → 0.3.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.
- package/CHANGELOG.md +12 -0
- package/README.md +51 -27
- package/dist/account.d.ts +28 -0
- package/dist/booking-flow.d.ts +61 -0
- package/dist/booking.d.ts +5 -1
- package/dist/client.d.ts +2 -0
- package/dist/context.d.ts +5 -0
- package/dist/i18n.d.ts +13 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1119 -619
- package/dist/layout.d.ts +8 -0
- package/dist/portal.d.ts +26 -0
- package/dist/screens/business.d.ts +71 -2
- package/dist/server/index.d.ts +8 -29
- package/dist/server.js +125 -252
- package/dist/session.d.ts +10 -0
- package/dist/sign-in-standalone.d.ts +26 -0
- package/dist/sign-in.d.ts +4 -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,18 @@ All notable changes to `@msm-platform/customer-react`. The format follows [Keep
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.3.1] - 2026-11-15
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `MsmBooking`, `MsmAccount` and `MsmSignIn`, for your own pages and the modals or overlays you draw around them. `MsmBooking` books at one business with no tabs: the customer chooses an event type, then who provides it when two or more resources can (or anyone), then a time, or See all times to filter every time by event type and resource. A signed-out customer signs in or registers inside it and keeps the time they chose; `onBooked` gets the booking once it is confirmed, `onClose` adds a Close button to every step, and `businessId`, `eventTypeId`, `resourceId`, `all` and `time` with `onChange` let you keep the step in your URL. `MsmAccount` shows Bookings, Passes and My details, with sign-in in place when signed out. `MsmSignIn` is sign-in and registration with `onSignedIn` and `onCancel`, and never navigates. Components on the same `basePath` share one sign-in, each tells you of a sign-in or sign-out with `onSessionChange`, and each moves focus to its first field when it mounts. `MsmCustomer` is unchanged.
|
|
12
|
+
|
|
13
|
+
## [0.3.0] - 2026-11-15
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **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.
|
|
18
|
+
|
|
7
19
|
## [0.2.0] - 2026-11-14
|
|
8
20
|
|
|
9
21
|
### Added
|
package/README.md
CHANGED
|
@@ -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
|
|
13
|
+
What the changelog treats as breaking to rename or remove: the exports of `.` and `./server` and the stylesheet `./style.css`; the props below of `MsmCustomer`, `MsmBooking`, `MsmAccount` and `MsmSignIn`, 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
|
|
|
@@ -45,6 +45,43 @@ Before sending a code, sign-in and registration show Cloudflare Turnstile and se
|
|
|
45
45
|
|
|
46
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).
|
|
47
47
|
|
|
48
|
+
## Components for your own pages
|
|
49
|
+
|
|
50
|
+
Besides `MsmCustomer`, three components show one part of the screens on your own pages, such as in a modal or overlay your site draws: the package ships no dialog, focus trap or scroll lock. Each takes `basePath`, `brand` and `botCheck` as `MsmCustomer` does, renders its own `.msm-customer` root, and moves focus to its first field when it mounts. Components on the same `basePath` share one sign-in: signing in or out in one shows in all of them, and each optional `onSessionChange(signedIn)` hears every sign-in and sign-out after the first session check, including a session the server half ended, so your header can refresh.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import {
|
|
54
|
+
MsmAccount,
|
|
55
|
+
MsmBooking,
|
|
56
|
+
MsmSignIn,
|
|
57
|
+
} from "@msm-platform/customer-react";
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `MsmBooking`
|
|
61
|
+
|
|
62
|
+
The booking flow for one business, in steps: the customer chooses an event type; then who provides it, with Anyone first, when two or more resources can; then a time. The first step also offers See all times, every time at the business filtered by event type and by resource. A signed-out customer signs in or registers with the time kept, then holds, confirms and sees the booking with its cancel step. It has no tabs and never leaves the business.
|
|
63
|
+
|
|
64
|
+
| Prop | Meaning |
|
|
65
|
+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `businessId` | The business. |
|
|
67
|
+
| `eventTypeId` | Optional: opens past the first step on this event type, or filters See all times by it. |
|
|
68
|
+
| `resourceId` | Optional: a resource that provides the event type, or `"any"` for anyone; with `all`, filters every time by it. |
|
|
69
|
+
| `all` | Optional `true`: See all times. |
|
|
70
|
+
| `time` | Optional `MsmBookingTime`, `{ startsAt, eventTypeId, eventId?, resourceId? }`: opens on that time. A time that can no longer be booked shows the step it was in with a note. |
|
|
71
|
+
| `onChange` | Called with `MsmBookingSelection`, `{ businessId, eventTypeId?, resourceId?, all?, time? }`, at every step and every step back. Pass it to keep the selection in your URL and feed it back as props; leave it out and the component keeps the selection itself. |
|
|
72
|
+
| `onBooked` | Called once with the booking, `CustomerBooking`, when the customer confirms it. |
|
|
73
|
+
| `onClose` | Adds a Close button to every step, and Done to the booked step, that call it. |
|
|
74
|
+
|
|
75
|
+
A hold cannot be read back, so mounting `MsmBooking` again on a `time` holds that time again.
|
|
76
|
+
|
|
77
|
+
### `MsmAccount`
|
|
78
|
+
|
|
79
|
+
Bookings, Passes and My details, with no Book tab, and sign-in in place when signed out. `screen` (`bookings`, the default, `passes` or `details`) and `onNavigate` follow `MsmCustomer`'s rule: leave both out and it switches tabs itself.
|
|
80
|
+
|
|
81
|
+
### `MsmSignIn`
|
|
82
|
+
|
|
83
|
+
Sign-in and registration on their own. `onSignedIn()` is called once the customer is signed in, whether they signed in or registered, and at once when they already were; `onCancel` adds a Cancel button. It never navigates: close your modal on either.
|
|
84
|
+
|
|
48
85
|
## Theming
|
|
49
86
|
|
|
50
87
|
Styles are scoped under `.msm-customer` with no global reset, in the one stylesheet above, which includes the phone input's. The screens take the height of their content, so they sit inside the partner's page. A partner themes them with these CSS custom properties on `.msm-customer` or an ancestor. They are public API: renaming one is a breaking change.
|
|
@@ -77,14 +114,7 @@ A Fetch API handler, `Request` in and `Response` out, for the routes the screens
|
|
|
77
114
|
|
|
78
115
|
```ts
|
|
79
116
|
// app/msm/[...path]/route.ts
|
|
80
|
-
import {
|
|
81
|
-
createCustomerHandler,
|
|
82
|
-
redisLimiterStore,
|
|
83
|
-
turnstile,
|
|
84
|
-
} from "@msm-platform/customer-react/server";
|
|
85
|
-
import { createClient } from "redis";
|
|
86
|
-
|
|
87
|
-
const redis = await createClient({ url: process.env.REDIS_URL }).connect();
|
|
117
|
+
import { createCustomerHandler } from "@msm-platform/customer-react/server";
|
|
88
118
|
|
|
89
119
|
const handler = createCustomerHandler({
|
|
90
120
|
basePath: "/msm",
|
|
@@ -92,8 +122,6 @@ const handler = createCustomerHandler({
|
|
|
92
122
|
clientId: process.env.MSM_CLIENT_ID!,
|
|
93
123
|
clientSecret: process.env.MSM_CLIENT_SECRET!,
|
|
94
124
|
sessionKeys: process.env.MSM_SESSION_KEYS!.split(","),
|
|
95
|
-
limiter: redisLimiterStore(redis),
|
|
96
|
-
botCheck: turnstile({ secretKey: process.env.TURNSTILE_SECRET_KEY! }),
|
|
97
125
|
clientIp: (request) => yourTrustedClientIp(request),
|
|
98
126
|
});
|
|
99
127
|
export {
|
|
@@ -110,11 +138,9 @@ export {
|
|
|
110
138
|
| `basePath` | Where the route is mounted; the screens' `basePath`. |
|
|
111
139
|
| `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. |
|
|
112
140
|
| `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. |
|
|
113
|
-
| `
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
| `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. |
|
|
117
|
-
| `limiterPrefix` | The limiter's key prefix, default `msm:customer:limit:`, for a Redis shared with other apps. |
|
|
141
|
+
| `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. |
|
|
142
|
+
|
|
143
|
+
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.
|
|
118
144
|
|
|
119
145
|
**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.
|
|
120
146
|
|
|
@@ -122,16 +148,14 @@ export {
|
|
|
122
148
|
|
|
123
149
|
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.
|
|
124
150
|
|
|
125
|
-
| Route | Behaviour
|
|
126
|
-
| ------------------------------------------------------------ |
|
|
127
|
-
| `POST auth/initiate` `{phone, botCheckToken}` |
|
|
128
|
-
| `POST auth/register/initiate` `{phone, name, botCheckToken}` |
|
|
129
|
-
| `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.
|
|
130
|
-
| `GET auth/session` | `{sessionKey}`, or 401.
|
|
131
|
-
| `POST auth/logout` | Revokes the session at the engine and clears the cookie.
|
|
132
|
-
| `/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.
|
|
133
|
-
|
|
134
|
-
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.
|
|
151
|
+
| Route | Behaviour |
|
|
152
|
+
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
153
|
+
| `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`. |
|
|
154
|
+
| `POST auth/register/initiate` `{phone, name, botCheckToken}` | Asks for a registration code the same way, against the same counts. |
|
|
155
|
+
| `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. |
|
|
156
|
+
| `GET auth/session` | `{sessionKey}`, or 401. |
|
|
157
|
+
| `POST auth/logout` | Revokes the session at the engine and clears the cookie. |
|
|
158
|
+
| `/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. |
|
|
135
159
|
|
|
136
160
|
### Sessions
|
|
137
161
|
|
|
@@ -143,6 +167,6 @@ The session lives in no store: the cookie `__Host-msm_customer_session` (HttpOnl
|
|
|
143
167
|
|
|
144
168
|
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.
|
|
145
169
|
|
|
146
|
-
Tests: `pnpm exec vitest run packages/customer-react` from the root.
|
|
170
|
+
Tests: `pnpm exec vitest run packages/customer-react` from the root.
|
|
147
171
|
|
|
148
172
|
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,28 @@
|
|
|
1
|
+
import type { CustomerBotCheck, CustomerBrand } from "./client";
|
|
2
|
+
/** One of the account's screens. */
|
|
3
|
+
export type MsmAccountScreen = "bookings" | "passes" | "details";
|
|
4
|
+
export interface MsmAccountProps {
|
|
5
|
+
/** Where the server half is mounted, as for MsmCustomer. */
|
|
6
|
+
basePath: string;
|
|
7
|
+
/** The host's name and logo for the header and sign-in. */
|
|
8
|
+
brand?: CustomerBrand;
|
|
9
|
+
/** The bot check before a code is sent, as for MsmCustomer. */
|
|
10
|
+
botCheck: CustomerBotCheck;
|
|
11
|
+
/**
|
|
12
|
+
* `bookings` (the default), `passes` or `details`. Leave both this and
|
|
13
|
+
* `onNavigate` out to let the package switch screens itself; pass both to
|
|
14
|
+
* drive it from the host's router or URL.
|
|
15
|
+
*/
|
|
16
|
+
screen?: MsmAccountScreen;
|
|
17
|
+
onNavigate?: (screen: MsmAccountScreen) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Called when the customer signs in or out after the first session check,
|
|
20
|
+
* here or in another of the package's components on the same `basePath`.
|
|
21
|
+
*/
|
|
22
|
+
onSessionChange?: (signedIn: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The customer's account: bookings, passes and details, with no booking
|
|
26
|
+
* tab. Signed out, it shows sign-in in place, then the account.
|
|
27
|
+
*/
|
|
28
|
+
export declare function MsmAccount(props: MsmAccountProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { CustomerBooking, CustomerBotCheck, CustomerBrand } from "./client";
|
|
2
|
+
export type { CustomerBooking } from "./client";
|
|
3
|
+
/**
|
|
4
|
+
* A time to book, as the host can keep it in its URL: a seat in a scheduled
|
|
5
|
+
* event (`eventId`), or an open time slot of an event type at `startsAt`,
|
|
6
|
+
* with one resource when the customer chose one.
|
|
7
|
+
*/
|
|
8
|
+
export interface MsmBookingTime {
|
|
9
|
+
startsAt: string;
|
|
10
|
+
eventTypeId: string;
|
|
11
|
+
eventId?: string;
|
|
12
|
+
resourceId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What MsmBooking shows. Without `all`, the steps: an event type to choose,
|
|
16
|
+
* then a resource when two or more provide it, then its times. With `all`,
|
|
17
|
+
* every time at the business, filtered by `eventTypeId` and `resourceId`.
|
|
18
|
+
* A `time` shows that time, to sign in for, hold and confirm.
|
|
19
|
+
*/
|
|
20
|
+
export interface MsmBookingSelection {
|
|
21
|
+
businessId: string;
|
|
22
|
+
eventTypeId?: string;
|
|
23
|
+
/** A resource's ID, or `"any"` once the customer chose anyone. */
|
|
24
|
+
resourceId?: string;
|
|
25
|
+
/** Every time, with filters, after See all times. */
|
|
26
|
+
all?: boolean;
|
|
27
|
+
time?: MsmBookingTime;
|
|
28
|
+
}
|
|
29
|
+
export interface MsmBookingProps extends MsmBookingSelection {
|
|
30
|
+
/** Where the server half is mounted, as for MsmCustomer. */
|
|
31
|
+
basePath: string;
|
|
32
|
+
/** The host's name and logo above sign-in. */
|
|
33
|
+
brand?: CustomerBrand;
|
|
34
|
+
/** The bot check before a code is sent, as for MsmCustomer. */
|
|
35
|
+
botCheck: CustomerBotCheck;
|
|
36
|
+
/**
|
|
37
|
+
* Called with the new selection at every step: an event type, a
|
|
38
|
+
* resource, See all times and its filters, a time, or a step back. Pass
|
|
39
|
+
* it to drive the selection's props from the host's URL; leave it out and
|
|
40
|
+
* the package keeps the selection itself, starting from those props.
|
|
41
|
+
*/
|
|
42
|
+
onChange?: (selection: MsmBookingSelection) => void;
|
|
43
|
+
/** Called once with the booking when the customer confirms it. */
|
|
44
|
+
onBooked?: (booking: CustomerBooking) => void;
|
|
45
|
+
/** Offers a Close button on every step that calls this. */
|
|
46
|
+
onClose?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called when the customer signs in or out after the first session check,
|
|
49
|
+
* here or in another of the package's components on the same `basePath`.
|
|
50
|
+
*/
|
|
51
|
+
onSessionChange?: (signedIn: boolean) => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The booking flow for one business, for a host's overlay: choose an event
|
|
55
|
+
* type, then who provides it when two or more can (or anyone), then a time,
|
|
56
|
+
* or See all times to filter every time by event type and resource. A
|
|
57
|
+
* signed-out customer signs in or registers with the time kept, then holds,
|
|
58
|
+
* confirms and sees the booking. It has no tabs and never leaves the
|
|
59
|
+
* business.
|
|
60
|
+
*/
|
|
61
|
+
export declare function MsmBooking(props: MsmBookingProps): import("react").JSX.Element;
|
package/dist/booking.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Business, Candidate } from "./client";
|
|
1
|
+
import type { Business, Candidate, CustomerBooking } from "./client";
|
|
2
2
|
/** The candidate a customer chose to book, kept through sign-in. */
|
|
3
3
|
export interface Choice {
|
|
4
4
|
business: Business;
|
|
@@ -16,4 +16,8 @@ export declare function ChoiceSummary({ choice }: {
|
|
|
16
16
|
export declare function Booking(props: {
|
|
17
17
|
choice: Choice;
|
|
18
18
|
onBack: () => void;
|
|
19
|
+
/** Called once with the booking when it is confirmed. */
|
|
20
|
+
onBooked?: ((booking: CustomerBooking) => void) | undefined;
|
|
21
|
+
/** Without account navigation, the booked step's way out. */
|
|
22
|
+
onDone?: (() => void) | undefined;
|
|
19
23
|
}): import("react").JSX.Element;
|
package/dist/client.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ type Ok<Operation> = Operation extends {
|
|
|
11
11
|
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
|
+
/** A confirmed booking, as the confirm route returns it. */
|
|
15
|
+
export type CustomerBooking = Ok<paths["/web/businesses/{businessId}/reservations/{reservationId}/confirm"]["post"]>;
|
|
14
16
|
export type MyDetails = Ok<paths["/web/me"]["get"]>;
|
|
15
17
|
export type EventType = Ok<paths["/web/businesses/{businessId}/event-types"]["get"]>["items"][number];
|
|
16
18
|
/** One booking candidate: a seat in a scheduled event or an open time slot. */
|
package/dist/context.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export interface Portal {
|
|
|
17
17
|
businessesStatus: "loading" | "ready" | "failed";
|
|
18
18
|
reloadBusinesses: () => void;
|
|
19
19
|
navigate: (screen: CustomerScreen) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the screens lead to the business list and the account, as in
|
|
22
|
+
* MsmCustomer; MsmBooking stays on its one business.
|
|
23
|
+
*/
|
|
24
|
+
accountNavigation: boolean;
|
|
20
25
|
/** Ends the session on the server and returns to sign-in with this notice. */
|
|
21
26
|
signOut: (notice?: MessageKey) => Promise<void>;
|
|
22
27
|
}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ declare const en: {
|
|
|
26
26
|
readonly "register.submit": "Create account";
|
|
27
27
|
readonly "signIn.wait": "Please wait…";
|
|
28
28
|
readonly "signIn.differentNumber": "Use a different number";
|
|
29
|
+
readonly "signIn.cancel": "Cancel";
|
|
29
30
|
readonly "signIn.error.tooMany": "Too many codes requested. Try again in about {wait}.";
|
|
30
31
|
readonly "signIn.error.tooManyLater": "Too many codes requested. Try again later.";
|
|
31
32
|
readonly "signIn.error.paused": "Sign-in codes are paused for now. Try again in about {wait}.";
|
|
@@ -79,6 +80,8 @@ declare const en: {
|
|
|
79
80
|
readonly "business.notFound": "This business isn't taking bookings here.";
|
|
80
81
|
readonly "business.types": "Services";
|
|
81
82
|
readonly "business.allTypes": "Everything";
|
|
83
|
+
readonly "business.resources": "With";
|
|
84
|
+
readonly "business.anyResource": "Anyone";
|
|
82
85
|
readonly "business.typeMissing": "This service can't be booked here.";
|
|
83
86
|
readonly "business.minutes": "{minutes} min";
|
|
84
87
|
readonly "business.week": "Which week";
|
|
@@ -101,6 +104,16 @@ declare const en: {
|
|
|
101
104
|
readonly "book.confirming": "Confirming…";
|
|
102
105
|
readonly "book.booked": "You're booked.";
|
|
103
106
|
readonly "book.toBookings": "See all my bookings";
|
|
107
|
+
readonly "book.done": "Done";
|
|
108
|
+
readonly "book.close": "Close";
|
|
109
|
+
readonly "book.chooseType": "What would you like to book?";
|
|
110
|
+
readonly "book.noTypes": "There is nothing to book here yet.";
|
|
111
|
+
readonly "book.seeAll": "See all times";
|
|
112
|
+
readonly "book.chooseResource": "Who would you like to book with?";
|
|
113
|
+
readonly "book.anyResource": "Anyone";
|
|
114
|
+
readonly "book.anyResourceHint": "The first free times with anyone who offers it";
|
|
115
|
+
readonly "book.toTypes": "Back to services";
|
|
116
|
+
readonly "book.otherResource": "Choose someone else";
|
|
104
117
|
readonly "book.reserveAgain": "Hold this time again";
|
|
105
118
|
readonly "book.full": "This class is full now. Choose another time.";
|
|
106
119
|
readonly "book.slotTaken": "Someone has just taken this time. Choose another.";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { CustomerBotCheck, CustomerBrand } from "./client";
|
|
3
|
+
import type { CustomerScreen } from "./context";
|
|
4
|
+
export { MsmAccount, type MsmAccountProps, type MsmAccountScreen, } from "./account";
|
|
5
|
+
export { type CustomerBooking, MsmBooking, type MsmBookingProps, type MsmBookingSelection, type MsmBookingTime, } from "./booking-flow";
|
|
4
6
|
export { cancellationState } from "./cancellation";
|
|
5
7
|
export type { CustomerBotCheck, CustomerBrand } from "./client";
|
|
6
8
|
export type { CustomerScreen } from "./context";
|
|
7
9
|
export { formatDate, formatDateTime, formatNumber, locale, type MessageKey, type Messages, t, } from "./i18n";
|
|
10
|
+
export { MsmSignIn, type MsmSignInProps } from "./sign-in-standalone";
|
|
8
11
|
export interface MsmCustomerProps {
|
|
9
12
|
/**
|
|
10
13
|
* Where the server half (`@msm-platform/customer-react/server`) is mounted,
|