@msm-platform/customer-react 0.3.0 → 0.4.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 +62 -12
- 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 +4 -0
- package/dist/context.d.ts +5 -0
- package/dist/i18n.d.ts +19 -7
- package/dist/image.d.ts +14 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1196 -636
- package/dist/layout.d.ts +8 -0
- package/dist/portal.d.ts +26 -0
- package/dist/screens/business.d.ts +125 -2
- package/dist/server/index.d.ts +10 -6
- package/dist/server/session.d.ts +19 -5
- package/dist/server.js +157 -131
- package/dist/session.d.ts +10 -0
- package/dist/sign-in-standalone.d.ts +26 -0
- package/dist/sign-in.d.ts +8 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
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.4.0] - 2026-11-16
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- The screens show images: the business's logo on the businesses list and the head of a business, an event type's image on its card in `MsmBooking`'s first step and above its times (the original, with a `srcset` and `sizes` so a narrow screen loads the smaller one), and a resource's photo on its card where the customer chooses who. Cards and thumbnails load the `small` rendition. Every image is a plain `<img>` with `width`, `height`, `loading="lazy"` and alt text, so the layout does not shift, and without an image the screens look as before. **Allow MSM's media host in your Content Security Policy:** the images load from it, so a site whose own `img-src` is restricted shows broken images until you add that origin (`img-src 'self' <media origin>`); read the host from configuration, and add it to `images.remotePatterns` if you show the images through `next/image`. The README's Images section also says how long a replaced or retired image is served. It needs the engine release with images and `@msm-platform/customer-sdk` 0.3.0.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **Breaking:** sign-in is phone first. The screens ask for the phone, then the code, then a name only when the customer is new, in one form with no register mode and no "Create an account" link, in `MsmCustomer`, `MsmBooking` and `MsmSignIn`; their props are unchanged, and `onSignedIn` fires for a sign-in and a registration alike. A wrong or expired code says only "That code is incorrect or has expired." The server half's routes change for a partner that calls them directly: `POST auth/register/initiate` is removed (404); `POST auth/login` `{challenge, code}` answers `{result: "session", sessionKey}` or `{result: "nameRequired"}` instead of `{sessionKey}`, and signs a known person without a customer account straight in; `POST auth/register` takes only `{name}` and answers `{result: "session", sessionKey}`, or 401 `NotAuthenticated` without a pending registration. The engine's registration ticket is kept in a second encrypted HttpOnly cookie, `__Host-msm_customer_registration`, under your `sessionKeys`, and never reaches the browser. It needs the engine release with phone-first sign-in and `@msm-platform/customer-sdk` 0.3.0.
|
|
16
|
+
|
|
17
|
+
## [0.3.1] - 2026-11-15
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `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.
|
|
22
|
+
|
|
7
23
|
## [0.3.0] - 2026-11-15
|
|
8
24
|
|
|
9
25
|
### Changed
|
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 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
|
|
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-first sign-in (a new customer gives their name after the code), 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
|
|
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
|
|
|
@@ -39,12 +39,60 @@ The browser holds no credentials: the server half adds the client's and keeps th
|
|
|
39
39
|
|
|
40
40
|
### Booking
|
|
41
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
|
|
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 first, giving their name after the code when they are new, 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
43
|
|
|
44
|
-
Before sending a code, sign-in
|
|
44
|
+
Before sending a code, sign-in shows Cloudflare Turnstile and sends 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.
|
|
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 with the time kept, and gives their name too when they are new, 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
|
+
The phone-first sign-in form on its own: phone, code, and a name only when the customer is new. `onSignedIn()` is called once the customer is signed in, whether they already had an account or just registered, and at once when they already were; `onCancel` adds a Cancel button. It never navigates: close your modal on either.
|
|
84
|
+
|
|
85
|
+
## Images
|
|
86
|
+
|
|
87
|
+
The screens show the business's logo (the businesses list and the head of a business), an event type's image (its card in `MsmBooking`'s first step, and above its times) and a resource's photo (its card where the customer chooses who). A card or thumbnail loads the `small` rendition; an event type's details offer both renditions as a `srcset` with `sizes`, so a narrow screen does not fetch the original. Every image is a plain `<img>` with its `width` and `height`, `loading="lazy"` and `alt` text, so the layout does not shift as it loads; a business, event type or resource without an image looks as it did before.
|
|
88
|
+
|
|
89
|
+
**Allow MSM's media host in your Content Security Policy.** The images load from MSM's media domain, not from your site, so a partner whose own policy restricts `img-src` sees broken images until it adds that origin: `img-src 'self' <media origin>`. MSM hands over the media host, such as `https://media.dev.xn--stafrnirmguleikar-vrb22a.is` in dev, with your client credentials; it differs per environment, so read it from configuration (the starter's `MSM_MEDIA_URL`) rather than writing it in code. If you show the images through `next/image` on your own pages, the same origin goes in `images.remotePatterns`. The screens themselves use `<img>`, not `next/image`. [`examples/customer-nextjs`](https://github.com/Sveittur/msm-platform/tree/main/examples/customer-nextjs) shows both, from `MSM_MEDIA_URL`.
|
|
90
|
+
|
|
91
|
+
**How long an image lives.** An image's URL never changes; a replaced image gets a new URL.
|
|
92
|
+
- A replaced image's old URL keeps working for 48 hours, so a page you cached with the old URL must revalidate within that time.
|
|
93
|
+
- MSM's media domain stops serving a retired image at most 48 hours plus one day after it is replaced or its owner is deleted: the 48 hours are above, and the edge's own copy lasts at most one day more.
|
|
94
|
+
- Copies downstream of MSM are outside MSM's control: those held by browsers, and by your own image optimizer such as `next/image`'s cache, last as long as you and the visitor's browser keep them. A partner that must remove an image sooner purges its own cache.
|
|
95
|
+
|
|
48
96
|
## Theming
|
|
49
97
|
|
|
50
98
|
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.
|
|
@@ -111,19 +159,21 @@ MSM owns your website's Cloudflare Turnstile widget and keeps its secret: the en
|
|
|
111
159
|
|
|
112
160
|
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.
|
|
113
161
|
|
|
114
|
-
| Route
|
|
115
|
-
|
|
|
116
|
-
| `POST auth/initiate` `{phone, botCheckToken}`
|
|
117
|
-
| `POST auth/
|
|
118
|
-
| `POST auth/
|
|
119
|
-
| `GET auth/session`
|
|
120
|
-
| `POST auth/logout`
|
|
121
|
-
| `/engine/web/*`
|
|
162
|
+
| Route | Behaviour |
|
|
163
|
+
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
164
|
+
| `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`. |
|
|
165
|
+
| `POST auth/login` `{challenge, code}` | Redeems the code exactly once, never retried. A customer is signed in: it sets the session cookie and returns `{result: "session", sessionKey}`, `sessionKey` being the session's ID. A phone the engine asks to register is signed in the same way when the engine needs no name, such as staff without a customer account: the handler completes the registration at once. Otherwise it returns `{result: "nameRequired"}` and keeps the engine's registration ticket in its own encrypted cookie (see [Sessions](#sessions)); the current session stays until a new one is issued. A wrong or expired code passes the engine's 401 through and drops any pending registration. |
|
|
166
|
+
| `POST auth/register` `{name}` | Completes the pending registration with the name and the ticket from its cookie, then sets the session cookie, drops the ticket and returns `{result: "session", sessionKey}`. Without a pending registration it answers 401 `NotAuthenticated` and calls nothing. The engine checks the name: 422 `NameRequired` and 400 `ValidationFailed` pass through and keep the ticket for a retry. Any 401 from the engine (a spent or expired ticket) drops it. |
|
|
167
|
+
| `GET auth/session` | `{sessionKey}`, or 401. |
|
|
168
|
+
| `POST auth/logout` | Revokes the session at the engine and clears both cookies. |
|
|
169
|
+
| `/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. |
|
|
122
170
|
|
|
123
171
|
### Sessions
|
|
124
172
|
|
|
125
173
|
The session lives in no store: the cookie `__Host-msm_customer_session` (HttpOnly, Secure, Path=/, SameSite=Lax, expiring at the session's maximum age) holds `{sessionId, sessionToken, expiresAt}` encrypted with AES-256-GCM. The browser holds only that ciphertext; no response body carries the token. SameSite=Lax, rather than Strict, lets a customer arriving from an SMS link render as signed in on the server.
|
|
126
174
|
|
|
175
|
+
A pending registration lives the same way: the cookie `__Host-msm_customer_registration`, with the same attributes and expiring with the engine's ticket (10 minutes), holds `{registrationTicket, expiresAt}` encrypted with the same keys. Each cookie's name is authenticated with its value, so neither opens as the other. The browser learns only that a name is needed; no response body carries the ticket.
|
|
176
|
+
|
|
127
177
|
`readCustomerSession(cookieValue, { sessionKeys })` reads the signed-in customer's session in the partner's own server code, such as a page that books through the customer SDK with `sessionHeaders(session.sessionToken)`, so the partner's pages and the screens share one sign-in. It returns null for a missing, undecryptable or expired cookie. It does not ask the engine, so a session revoked elsewhere reads as signed in until the engine answers 401; a caller that needs certainty calls the engine.
|
|
128
178
|
|
|
129
179
|
## Development
|
|
@@ -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,10 @@ 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
|
+
/** An uploaded image: the original and its smaller `small` rendition. */
|
|
15
|
+
export type CustomerImage = NonNullable<Business["logo"]>;
|
|
16
|
+
/** A confirmed booking, as the confirm route returns it. */
|
|
17
|
+
export type CustomerBooking = Ok<paths["/web/businesses/{businessId}/reservations/{reservationId}/confirm"]["post"]>;
|
|
14
18
|
export type MyDetails = Ok<paths["/web/me"]["get"]>;
|
|
15
19
|
export type EventType = Ok<paths["/web/businesses/{businessId}/event-types"]["get"]>["items"][number];
|
|
16
20
|
/** 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
|
@@ -4,6 +4,7 @@ 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 "image.logo": "{name} logo";
|
|
7
8
|
readonly "nav.label": "Booking and my account";
|
|
8
9
|
readonly "nav.book": "Book";
|
|
9
10
|
readonly "nav.signIn": "Sign in";
|
|
@@ -13,11 +14,8 @@ declare const en: {
|
|
|
13
14
|
readonly "nav.signOut": "Sign out";
|
|
14
15
|
readonly "signIn.heading": "Sign in";
|
|
15
16
|
readonly "signIn.intro": "We'll text a one-time code to your phone.";
|
|
16
|
-
readonly "
|
|
17
|
-
readonly "register.heading": "Create an account";
|
|
18
|
-
readonly "register.intro": "Enter your name and phone. We'll text you a code.";
|
|
17
|
+
readonly "register.intro": "One more step: what's your name?";
|
|
19
18
|
readonly "register.name": "Your name";
|
|
20
|
-
readonly "register.toSignIn": "Already have an account? Sign in";
|
|
21
19
|
readonly "signIn.phone": "Phone number";
|
|
22
20
|
readonly "signIn.codeSent": "Enter the code we sent to {phone}.";
|
|
23
21
|
readonly "signIn.code": "Verification code";
|
|
@@ -26,13 +24,15 @@ declare const en: {
|
|
|
26
24
|
readonly "register.submit": "Create account";
|
|
27
25
|
readonly "signIn.wait": "Please wait…";
|
|
28
26
|
readonly "signIn.differentNumber": "Use a different number";
|
|
27
|
+
readonly "signIn.cancel": "Cancel";
|
|
29
28
|
readonly "signIn.error.tooMany": "Too many codes requested. Try again in about {wait}.";
|
|
30
29
|
readonly "signIn.error.tooManyLater": "Too many codes requested. Try again later.";
|
|
31
30
|
readonly "signIn.error.paused": "Sign-in codes are paused for now. Try again in about {wait}.";
|
|
32
31
|
readonly "signIn.error.pausedLater": "Sign-in codes are paused for now. Try again later.";
|
|
33
32
|
readonly "signIn.error.destination": "This number can't receive sign-in codes.";
|
|
34
|
-
readonly "signIn.error.badCode": "That code is incorrect or has expired
|
|
35
|
-
readonly "register.error.
|
|
33
|
+
readonly "signIn.error.badCode": "That code is incorrect or has expired.";
|
|
34
|
+
readonly "register.error.expired": "That took too long. Request a new code.";
|
|
35
|
+
readonly "register.error.name": "Check your name and try again.";
|
|
36
36
|
readonly "signIn.error.invalid": "Check the phone number and try again.";
|
|
37
37
|
readonly "signIn.error.refused": "This number can't sign in here.";
|
|
38
38
|
readonly "signIn.error.unreachable": "The sign-in service is unreachable. Try again shortly.";
|
|
@@ -79,6 +79,8 @@ declare const en: {
|
|
|
79
79
|
readonly "business.notFound": "This business isn't taking bookings here.";
|
|
80
80
|
readonly "business.types": "Services";
|
|
81
81
|
readonly "business.allTypes": "Everything";
|
|
82
|
+
readonly "business.resources": "With";
|
|
83
|
+
readonly "business.anyResource": "Anyone";
|
|
82
84
|
readonly "business.typeMissing": "This service can't be booked here.";
|
|
83
85
|
readonly "business.minutes": "{minutes} min";
|
|
84
86
|
readonly "business.week": "Which week";
|
|
@@ -93,7 +95,7 @@ declare const en: {
|
|
|
93
95
|
readonly "business.with": "With {resource}";
|
|
94
96
|
readonly "business.book": "Book";
|
|
95
97
|
readonly "book.heading": "Your booking";
|
|
96
|
-
readonly "book.signInFirst": "Sign in
|
|
98
|
+
readonly "book.signInFirst": "Sign in with your phone to book this time.";
|
|
97
99
|
readonly "book.back": "Choose another time";
|
|
98
100
|
readonly "book.reserving": "Holding this time for you…";
|
|
99
101
|
readonly "book.heldUntil": "We're holding this time for you until {time}.";
|
|
@@ -101,6 +103,16 @@ declare const en: {
|
|
|
101
103
|
readonly "book.confirming": "Confirming…";
|
|
102
104
|
readonly "book.booked": "You're booked.";
|
|
103
105
|
readonly "book.toBookings": "See all my bookings";
|
|
106
|
+
readonly "book.done": "Done";
|
|
107
|
+
readonly "book.close": "Close";
|
|
108
|
+
readonly "book.chooseType": "What would you like to book?";
|
|
109
|
+
readonly "book.noTypes": "There is nothing to book here yet.";
|
|
110
|
+
readonly "book.seeAll": "See all times";
|
|
111
|
+
readonly "book.chooseResource": "Who would you like to book with?";
|
|
112
|
+
readonly "book.anyResource": "Anyone";
|
|
113
|
+
readonly "book.anyResourceHint": "The first free times with anyone who offers it";
|
|
114
|
+
readonly "book.toTypes": "Back to services";
|
|
115
|
+
readonly "book.otherResource": "Choose someone else";
|
|
104
116
|
readonly "book.reserveAgain": "Hold this time again";
|
|
105
117
|
readonly "book.full": "This class is full now. Choose another time.";
|
|
106
118
|
readonly "book.slotTaken": "Someone has just taken this time. Choose another.";
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CustomerImage } from "./client";
|
|
2
|
+
/**
|
|
3
|
+
* An uploaded image, or nothing when there is none. `width` and `height`
|
|
4
|
+
* are always set, so the browser reserves the space before the file loads.
|
|
5
|
+
* A card or thumbnail uses the `small` rendition alone; `full` is for a
|
|
6
|
+
* details view, where the browser picks the original or `small` by the
|
|
7
|
+
* width the image will have (`sizes` matches `.cp-detail-image`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function Img(props: {
|
|
10
|
+
image: CustomerImage | null | undefined;
|
|
11
|
+
alt: string;
|
|
12
|
+
size: "small" | "full";
|
|
13
|
+
className: string;
|
|
14
|
+
}): import("react").JSX.Element | null;
|
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,
|