@msm-platform/customer-sdk 0.1.1 → 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 CHANGED
@@ -4,6 +4,30 @@ All notable changes to `@msm-platform/customer-sdk`. The format follows [Keep a
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.3.0] - 2026-11-16
8
+
9
+ ### Added
10
+
11
+ - The businesses `getPublicBusiness` and `listPublicBusinesses` return `cover`, `description` and `brandColor`, each null when the business has not set one. `cover` is the same image object as `logo`, `{ url, width, height, small: { url, width, height } }`: a wide image fitting inside 1600×1600 as WebP, with `small` inside 640×640, and its URLs are immutable like the logo's. `description` is plain text of at most 1000 characters, and `brandColor` is a hint for your pages as lower-case `#rrggbb`, not a theme: you decide how to use it and keep your own contrast.
12
+ - Each resource in `listPublicEventTypes`' `resources` has `image`: null, or `{ url, width, height, small: { url, width, height } }`, the resource's photo as WebP fitting inside 1024×1024 with `small` inside 640×640 (the original itself when it is no larger). The URLs are immutable, and a replaced photo's URL keeps working for 48 hours.
13
+
14
+ ### Changed
15
+
16
+ - **Breaking:** the event types `listPublicEventTypes` returns no longer have `imageAssetId`. They have `image` instead: null, or `{ url, width, height, small: { url, width, height } }`, where `url` is the event type's image as WebP, fitting inside 1600×1600, and `small` fits inside 640×640 (the original itself when it is no larger). As with the business logo, the URLs are immutable, and a replaced image's URL keeps working for 48 hours.
17
+ - **Breaking:** the businesses `getPublicBusiness` and `listPublicBusinesses` return no longer have `logoAssetId`. They have `logo` instead: null, or `{ url, width, height, small: { url, width, height } }`, where `url` is the business's logo as WebP, fitting inside 1024×1024, and `small` fits inside 640×640 (the original itself when it is no larger). The URLs are immutable: a new logo has a new URL, so they can be cached for as long as you like, and a replaced logo's URL keeps working for 48 hours.
18
+ - **Breaking:** customers sign in by phone first. `POST /web/identity/initiateRegistration` and `POST /web/identity/registerCustomer` are removed (404); use `initiateLogin` for every phone, which now sends a code whether or not the phone has an account. `customerLogin` answers 200 either `{ result: "session", sessionId, sessionToken, expiresAt }`, today's session with `result` added, or `{ result: "registrationRequired", registrationTicket, nameRequired, registrationExpiresAt }` when the phone has no customer yet; check `result` before reading the session. The new `POST /web/identity/completeRegistration` takes `{ registrationTicket, name? }` and returns the session. Send `name` when `nameRequired` is true: without it the engine answers 422 `NameRequired` and the ticket stays usable for a retry with the name. A name sent when it isn't needed is ignored, and the person keeps theirs. The ticket is used once, with your client, within 10 minutes; a spent, expired or other client's ticket is 401 `NotAuthenticated`.
19
+ - A business can now set opening hours. Once it does, `GET /web/businesses/{businessId}/availability` offers no time slot outside them and `POST /web/businesses/{businessId}/reservations` answers 422 `NotATimeSlot` for one; a business without opening hours is unchanged, and no field changes.
20
+
21
+ ## [0.2.0] - 2026-11-15
22
+
23
+ ### Changed
24
+
25
+ - **Breaking:** `initiateLogin` and `initiateRegistration` on `/web/identity/*` require `botCheckToken`, the Turnstile token the customer's browser got from your website's widget, and `clientIp`, the customer's IPv4 or IPv6 address as your trusted proxy reports it; without them the engine answers 400 `ValidationFailed`. The engine now checks the token with the Turnstile widget MSM owns for your website and limits code requests per address, so either can answer 403 `BotCheckFailed`, 429 `TooManyAttempts` with `Retry-After`, or 503 `BotCheckUnavailable` or `LimiterUnavailable` with `Retry-After`; no code is sent then.
26
+
27
+ ### Added
28
+
29
+ - The engine limits each application client to its own request rate, 3000 requests a minute by default, counted for your server's HTTP Basic calls and your customers' sessions together. Over it any operation answers 429 `RateLimited` with `Retry-After` in seconds (1 to 60, the rest of the minute); wait that long before retrying. `RateLimited`'s description in the contract now names this limit beside the load balancer's per-IP one.
30
+
7
31
  ## [0.1.1] - 2026-11-13
8
32
 
9
33
  ### Added
package/README.md CHANGED
@@ -20,7 +20,7 @@ const msm = createCustomerClient({
20
20
  });
21
21
  ```
22
22
 
23
- **Proxy mode** is for a browser or any code that must not hold the secret. Give it only a base URL and, if needed, a custom `fetch`, and put a proxy on your server in front of the engine that adds the credentials. MSM's customer portal works this way through its BFF.
23
+ **Proxy mode** is for a browser or any code that must not hold the secret. Give it only a base URL and, if needed, a custom `fetch`, and put a proxy on your server in front of the engine that adds the credentials. MSM's customer screens (`@msm-platform/customer-react`) work this way, behind their server half on the partner's server.
24
24
 
25
25
  ```ts
26
26
  const msm = createCustomerClient({ baseUrl: "/msm", fetch: myFetch });
@@ -33,12 +33,26 @@ A customer signs in with a code sent by SMS. The session token is yours to store
33
33
  ```ts
34
34
  import { sessionHeaders } from "@msm-platform/customer-sdk";
35
35
 
36
+ // The Turnstile token the screens' widget gave the customer's browser, and the
37
+ // customer's address as your own trusted proxy reports it.
36
38
  const { data: started } = await msm.POST("/web/identity/initiateLogin", {
37
- body: { phone: "+3545550004" },
39
+ body: { phone: "+3545550004", botCheckToken, clientIp },
38
40
  });
39
- const { data: session } = await msm.POST("/web/identity/customerLogin", {
41
+ const { data: login } = await msm.POST("/web/identity/customerLogin", {
40
42
  body: { challenge: started!.challenge, code: "123456" },
41
43
  });
44
+ // A phone with no customer yet gets a registration ticket instead of a session.
45
+ const session =
46
+ login!.result === "session"
47
+ ? login!
48
+ : (
49
+ await msm.POST("/web/identity/completeRegistration", {
50
+ body: {
51
+ registrationTicket: login!.registrationTicket,
52
+ ...(login!.nameRequired && { name: "Kata" }),
53
+ },
54
+ })
55
+ ).data;
42
56
 
43
57
  const headers = sessionHeaders(session!.sessionToken);
44
58
  const { data: reservation } = await msm.POST(
@@ -51,7 +65,7 @@ const { data: booking } = await msm.POST(
51
65
  );
52
66
  ```
53
67
 
54
- A new customer registers the same way with `POST /web/identity/initiateRegistration` (`{ phone, name }`) and `POST /web/identity/registerCustomer`. `POST /web/identity/logout` with `{ sessionToken }` ends a session of your client. Sign-in, registration and logout are on `/web` and need your client's credentials, so call them from server mode or through your proxy; `/api` is not for website clients. A reservation holds the seat or slot for a few minutes; confirming it makes the booking.
68
+ The engine sends a code only after checking `botCheckToken` with the Turnstile widget MSM owns for your website (403 `BotCheckFailed`, or 503 `BotCheckUnavailable` when it cannot) and counting the request against `clientIp` (by default 5 code requests per address per 10 minutes, then 429 `TooManyAttempts` with `Retry-After`; 503 `LimiterUnavailable` when it cannot count). Never take `clientIp` from a header the customer can set, such as the leftmost `X-Forwarded-For` entry. Every phone gets a code, so the answer never tells whether it has an account. With the right code, `customerLogin` answers `{ result: "session", sessionId, sessionToken, expiresAt }` for a customer, or `{ result: "registrationRequired", registrationTicket, nameRequired, registrationExpiresAt }` when the phone has no customer yet. Then `POST /web/identity/completeRegistration` with `{ registrationTicket, name? }` returns the session. Send `name` when `nameRequired` is true: without it the engine answers 422 `NameRequired` and the ticket stays usable for a retry with the name. A name sent when it isn't needed is ignored, and the person keeps theirs. The ticket is used once, with your client, within 10 minutes; otherwise it is 401 `NotAuthenticated`, as a wrong code is. `POST /web/identity/logout` with `{ sessionToken }` ends a session of your client. Sign-in, registration and logout are on `/web` and need your client's credentials, so call them from server mode or through your proxy; `/api` is not for website clients. A reservation holds the seat or slot for a few minutes; confirming it makes the booking.
55
69
 
56
70
  The same session reads the customer's own details, bookings and passes with every business of your partner, and ends all their sessions with your client:
57
71
 
@@ -95,7 +109,7 @@ The SDK never retries a request: a 401 throws, and the next call sends the same
95
109
 
96
110
  ## Next.js server example
97
111
 
98
- [`examples/customer-nextjs`](../../examples/customer-nextjs) in the repository is a Next.js App Router server that does all of the above with server actions: phone and code sign-in with the session in an HttpOnly cookie, the business's availability, and booking (reserve, then confirm). The SDK and the secret live only in server code (`lib/msm.ts`):
112
+ [`examples/customer-nextjs`](../../examples/customer-nextjs) in the repository is a Next.js App Router site, the partner starter. It serves MSM's customer screens for sign-in and the customer's account, and its own pages use the SDK in server mode with the session the screens signed in (read from their encrypted HttpOnly cookie): the business's availability, and booking (reserve, then confirm) with server actions. The SDK and the secret live only in server code (`lib/msm.ts`):
99
113
 
100
114
  ```ts
101
115
  // lib/msm.ts, imported only by server components and server actions
@@ -135,7 +135,7 @@ export interface paths {
135
135
  patch?: never;
136
136
  trace?: never;
137
137
  };
138
- "/web/identity/customerLogin": {
138
+ "/web/identity/completeRegistration": {
139
139
  parameters: {
140
140
  query?: never;
141
141
  header?: never;
@@ -144,15 +144,15 @@ export interface paths {
144
144
  };
145
145
  get?: never;
146
146
  put?: never;
147
- /** Redeem a sign-in code for a customer session */
148
- post: operations["identityCustomerLogin"];
147
+ /** Spend a registration ticket for a new customer's session, with their name when it is needed */
148
+ post: operations["identityCompleteRegistration"];
149
149
  delete?: never;
150
150
  options?: never;
151
151
  head?: never;
152
152
  patch?: never;
153
153
  trace?: never;
154
154
  };
155
- "/web/identity/initiateLogin": {
155
+ "/web/identity/customerLogin": {
156
156
  parameters: {
157
157
  query?: never;
158
158
  header?: never;
@@ -161,15 +161,15 @@ export interface paths {
161
161
  };
162
162
  get?: never;
163
163
  put?: never;
164
- /** Send a sign-in code to a customer's phone */
165
- post: operations["identityInitiateLogin"];
164
+ /** Redeem a sign-in code for a customer session, or a registration ticket when the phone has no customer */
165
+ post: operations["identityCustomerLogin"];
166
166
  delete?: never;
167
167
  options?: never;
168
168
  head?: never;
169
169
  patch?: never;
170
170
  trace?: never;
171
171
  };
172
- "/web/identity/initiateRegistration": {
172
+ "/web/identity/initiateLogin": {
173
173
  parameters: {
174
174
  query?: never;
175
175
  header?: never;
@@ -178,8 +178,8 @@ export interface paths {
178
178
  };
179
179
  get?: never;
180
180
  put?: never;
181
- /** Send a registration code to a new customer's phone */
182
- post: operations["identityInitiateRegistration"];
181
+ /** Send a sign-in code to a customer's phone */
182
+ post: operations["identityInitiateLogin"];
183
183
  delete?: never;
184
184
  options?: never;
185
185
  head?: never;
@@ -203,23 +203,6 @@ export interface paths {
203
203
  patch?: never;
204
204
  trace?: never;
205
205
  };
206
- "/web/identity/registerCustomer": {
207
- parameters: {
208
- query?: never;
209
- header?: never;
210
- path?: never;
211
- cookie?: never;
212
- };
213
- get?: never;
214
- put?: never;
215
- /** Redeem a registration code for a new customer's session */
216
- post: operations["identityRegisterCustomer"];
217
- delete?: never;
218
- options?: never;
219
- head?: never;
220
- patch?: never;
221
- trace?: never;
222
- };
223
206
  "/web/me": {
224
207
  parameters: {
225
208
  query?: never;
@@ -335,14 +318,38 @@ export interface operations {
335
318
  "application/json": {
336
319
  items: {
337
320
  address: string | null;
321
+ brandColor: string | null;
322
+ cover: {
323
+ height: number;
324
+ small: {
325
+ height: number;
326
+ /** Format: uri */
327
+ url: string;
328
+ width: number;
329
+ };
330
+ /** Format: uri */
331
+ url: string;
332
+ width: number;
333
+ } | null;
334
+ description: string | null;
338
335
  displayName: string;
339
336
  /** Format: email */
340
337
  email: string | null;
341
338
  /** Format: uuid */
342
339
  id: string;
343
340
  latitude: number | null;
344
- /** Format: uuid */
345
- logoAssetId: string | null;
341
+ logo: {
342
+ height: number;
343
+ small: {
344
+ height: number;
345
+ /** Format: uri */
346
+ url: string;
347
+ width: number;
348
+ };
349
+ /** Format: uri */
350
+ url: string;
351
+ width: number;
352
+ } | null;
346
353
  longitude: number | null;
347
354
  phone: string | null;
348
355
  timezone: string;
@@ -378,7 +385,7 @@ export interface operations {
378
385
  };
379
386
  };
380
387
  };
381
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
388
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
382
389
  429: {
383
390
  headers: {
384
391
  /** @description Seconds to wait before sending the request again */
@@ -425,14 +432,38 @@ export interface operations {
425
432
  content: {
426
433
  "application/json": {
427
434
  address: string | null;
435
+ brandColor: string | null;
436
+ cover: {
437
+ height: number;
438
+ small: {
439
+ height: number;
440
+ /** Format: uri */
441
+ url: string;
442
+ width: number;
443
+ };
444
+ /** Format: uri */
445
+ url: string;
446
+ width: number;
447
+ } | null;
448
+ description: string | null;
428
449
  displayName: string;
429
450
  /** Format: email */
430
451
  email: string | null;
431
452
  /** Format: uuid */
432
453
  id: string;
433
454
  latitude: number | null;
434
- /** Format: uuid */
435
- logoAssetId: string | null;
455
+ logo: {
456
+ height: number;
457
+ small: {
458
+ height: number;
459
+ /** Format: uri */
460
+ url: string;
461
+ width: number;
462
+ };
463
+ /** Format: uri */
464
+ url: string;
465
+ width: number;
466
+ } | null;
436
467
  longitude: number | null;
437
468
  phone: string | null;
438
469
  timezone: string;
@@ -490,7 +521,7 @@ export interface operations {
490
521
  };
491
522
  };
492
523
  };
493
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
524
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
494
525
  429: {
495
526
  headers: {
496
527
  /** @description Seconds to wait before sending the request again */
@@ -632,7 +663,7 @@ export interface operations {
632
663
  };
633
664
  };
634
665
  };
635
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
666
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
636
667
  429: {
637
668
  headers: {
638
669
  /** @description Seconds to wait before sending the request again */
@@ -782,7 +813,7 @@ export interface operations {
782
813
  };
783
814
  };
784
815
  };
785
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
816
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
786
817
  429: {
787
818
  headers: {
788
819
  /** @description Seconds to wait before sending the request again */
@@ -929,7 +960,7 @@ export interface operations {
929
960
  };
930
961
  };
931
962
  };
932
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
963
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
933
964
  415: {
934
965
  headers: {
935
966
  [name: string]: unknown;
@@ -953,7 +984,7 @@ export interface operations {
953
984
  };
954
985
  };
955
986
  };
956
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
987
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
957
988
  429: {
958
989
  headers: {
959
990
  /** @description Seconds to wait before sending the request again */
@@ -1008,8 +1039,18 @@ export interface operations {
1008
1039
  durationMinutes: number;
1009
1040
  /** Format: uuid */
1010
1041
  id: string;
1011
- /** Format: uuid */
1012
- imageAssetId: string | null;
1042
+ image: {
1043
+ height: number;
1044
+ small: {
1045
+ height: number;
1046
+ /** Format: uri */
1047
+ url: string;
1048
+ width: number;
1049
+ };
1050
+ /** Format: uri */
1051
+ url: string;
1052
+ width: number;
1053
+ } | null;
1013
1054
  requiresAccess: boolean;
1014
1055
  resources: {
1015
1056
  /** @description The resource's own description, null without one */
@@ -1017,6 +1058,19 @@ export interface operations {
1017
1058
  displayName: string;
1018
1059
  /** Format: uuid */
1019
1060
  id: string;
1061
+ /** @description The resource's photo (MVP-226), null without one */
1062
+ image: {
1063
+ height: number;
1064
+ small: {
1065
+ height: number;
1066
+ /** Format: uri */
1067
+ url: string;
1068
+ width: number;
1069
+ };
1070
+ /** Format: uri */
1071
+ url: string;
1072
+ width: number;
1073
+ } | null;
1020
1074
  }[];
1021
1075
  timeSlotBooking: boolean;
1022
1076
  }[];
@@ -1074,7 +1128,7 @@ export interface operations {
1074
1128
  };
1075
1129
  };
1076
1130
  };
1077
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
1131
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
1078
1132
  429: {
1079
1133
  headers: {
1080
1134
  /** @description Seconds to wait before sending the request again */
@@ -1239,7 +1293,7 @@ export interface operations {
1239
1293
  };
1240
1294
  };
1241
1295
  };
1242
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
1296
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
1243
1297
  415: {
1244
1298
  headers: {
1245
1299
  [name: string]: unknown;
@@ -1267,7 +1321,7 @@ export interface operations {
1267
1321
  };
1268
1322
  };
1269
1323
  };
1270
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
1324
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
1271
1325
  429: {
1272
1326
  headers: {
1273
1327
  /** @description Seconds to wait before sending the request again */
@@ -1426,7 +1480,7 @@ export interface operations {
1426
1480
  };
1427
1481
  };
1428
1482
  };
1429
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
1483
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
1430
1484
  415: {
1431
1485
  headers: {
1432
1486
  [name: string]: unknown;
@@ -1454,7 +1508,7 @@ export interface operations {
1454
1508
  };
1455
1509
  };
1456
1510
  };
1457
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
1511
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
1458
1512
  429: {
1459
1513
  headers: {
1460
1514
  /** @description Seconds to wait before sending the request again */
@@ -1482,7 +1536,7 @@ export interface operations {
1482
1536
  };
1483
1537
  };
1484
1538
  };
1485
- identityCustomerLogin: {
1539
+ identityCompleteRegistration: {
1486
1540
  parameters: {
1487
1541
  query?: never;
1488
1542
  header?: never;
@@ -1492,9 +1546,8 @@ export interface operations {
1492
1546
  requestBody: {
1493
1547
  content: {
1494
1548
  "application/json": {
1495
- /** Format: uuid */
1496
- challenge: string;
1497
- code: string;
1549
+ name?: string;
1550
+ registrationTicket: string;
1498
1551
  };
1499
1552
  };
1500
1553
  };
@@ -1568,7 +1621,7 @@ export interface operations {
1568
1621
  };
1569
1622
  };
1570
1623
  };
1571
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
1624
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
1572
1625
  415: {
1573
1626
  headers: {
1574
1627
  [name: string]: unknown;
@@ -1580,7 +1633,19 @@ export interface operations {
1580
1633
  };
1581
1634
  };
1582
1635
  };
1583
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
1636
+ /** @description - `NameRequired`: A new customer's registration needs their name; the ticket can be sent again with it */
1637
+ 422: {
1638
+ headers: {
1639
+ [name: string]: unknown;
1640
+ };
1641
+ content: {
1642
+ "application/json": components["schemas"]["ErrorResponse"] & {
1643
+ /** @enum {string} */
1644
+ code: "NameRequired";
1645
+ };
1646
+ };
1647
+ };
1648
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
1584
1649
  429: {
1585
1650
  headers: {
1586
1651
  /** @description Seconds to wait before sending the request again */
@@ -1608,7 +1673,7 @@ export interface operations {
1608
1673
  };
1609
1674
  };
1610
1675
  };
1611
- identityInitiateLogin: {
1676
+ identityCustomerLogin: {
1612
1677
  parameters: {
1613
1678
  query?: never;
1614
1679
  header?: never;
@@ -1618,7 +1683,9 @@ export interface operations {
1618
1683
  requestBody: {
1619
1684
  content: {
1620
1685
  "application/json": {
1621
- phone: string;
1686
+ /** Format: uuid */
1687
+ challenge: string;
1688
+ code: string;
1622
1689
  };
1623
1690
  };
1624
1691
  };
@@ -1630,10 +1697,22 @@ export interface operations {
1630
1697
  };
1631
1698
  content: {
1632
1699
  "application/json": {
1633
- /** Format: uuid */
1634
- challenge: string;
1635
1700
  /** Format: date-time */
1636
1701
  expiresAt: string;
1702
+ /** @enum {string} */
1703
+ result: "session";
1704
+ /** Format: uuid */
1705
+ sessionId: string;
1706
+ sessionToken: string;
1707
+ } | {
1708
+ /** @description Whether completeRegistration needs the customer's name: false when the phone already has a person */
1709
+ nameRequired: boolean;
1710
+ /** Format: date-time */
1711
+ registrationExpiresAt: string;
1712
+ /** @description Single use, for this client and phone; send it to completeRegistration */
1713
+ registrationTicket: string;
1714
+ /** @enum {string} */
1715
+ result: "registrationRequired";
1637
1716
  };
1638
1717
  };
1639
1718
  };
@@ -1691,7 +1770,7 @@ export interface operations {
1691
1770
  };
1692
1771
  };
1693
1772
  };
1694
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
1773
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
1695
1774
  415: {
1696
1775
  headers: {
1697
1776
  [name: string]: unknown;
@@ -1703,22 +1782,7 @@ export interface operations {
1703
1782
  };
1704
1783
  };
1705
1784
  };
1706
- /** @description - `PhoneDestinationNotAllowed`: SMS is not sent to this phone number's country */
1707
- 422: {
1708
- headers: {
1709
- [name: string]: unknown;
1710
- };
1711
- content: {
1712
- "application/json": components["schemas"]["ErrorResponse"] & {
1713
- /** @enum {string} */
1714
- code: "PhoneDestinationNotAllowed";
1715
- };
1716
- };
1717
- };
1718
- /**
1719
- * @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds
1720
- * - `TooManyChallenges`: Too many sign-in codes were sent to this number; retry after `Retry-After` seconds
1721
- */
1785
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
1722
1786
  429: {
1723
1787
  headers: {
1724
1788
  /** @description Seconds to wait before sending the request again */
@@ -1728,7 +1792,7 @@ export interface operations {
1728
1792
  content: {
1729
1793
  "application/json": components["schemas"]["ErrorResponse"] & {
1730
1794
  /** @enum {string} */
1731
- code: "RateLimited" | "TooManyChallenges";
1795
+ code: "RateLimited";
1732
1796
  };
1733
1797
  };
1734
1798
  };
@@ -1744,26 +1808,9 @@ export interface operations {
1744
1808
  };
1745
1809
  };
1746
1810
  };
1747
- /**
1748
- * @description - `SmsBudgetExhausted`: The client's hourly SMS budget is used up; retry after `Retry-After` seconds
1749
- * - `SmsDeliveryUnavailable`: The SMS could not be confirmed as sent; retry after `Retry-After` seconds
1750
- */
1751
- 503: {
1752
- headers: {
1753
- /** @description Seconds to wait before sending the request again */
1754
- "Retry-After"?: number;
1755
- [name: string]: unknown;
1756
- };
1757
- content: {
1758
- "application/json": components["schemas"]["ErrorResponse"] & {
1759
- /** @enum {string} */
1760
- code: "SmsBudgetExhausted" | "SmsDeliveryUnavailable";
1761
- };
1762
- };
1763
- };
1764
1811
  };
1765
1812
  };
1766
- identityInitiateRegistration: {
1813
+ identityInitiateLogin: {
1767
1814
  parameters: {
1768
1815
  query?: never;
1769
1816
  header?: never;
@@ -1773,7 +1820,10 @@ export interface operations {
1773
1820
  requestBody: {
1774
1821
  content: {
1775
1822
  "application/json": {
1776
- name: string;
1823
+ /** @description The Turnstile token the visitor's browser received from the application's widget */
1824
+ botCheckToken: string;
1825
+ /** @description The visitor's IP address, as the application's own trusted proxy reports it */
1826
+ clientIp: string;
1777
1827
  phone: string;
1778
1828
  };
1779
1829
  };
@@ -1823,7 +1873,10 @@ export interface operations {
1823
1873
  };
1824
1874
  };
1825
1875
  };
1826
- /** @description - `NotAuthorized`: The actor is not permitted to perform this operation */
1876
+ /**
1877
+ * @description - `BotCheckFailed`: The visitor's bot-check token did not pass the calling application's Turnstile widget
1878
+ * - `NotAuthorized`: The actor is not permitted to perform this operation
1879
+ */
1827
1880
  403: {
1828
1881
  headers: {
1829
1882
  [name: string]: unknown;
@@ -1831,7 +1884,7 @@ export interface operations {
1831
1884
  content: {
1832
1885
  "application/json": components["schemas"]["ErrorResponse"] & {
1833
1886
  /** @enum {string} */
1834
- code: "NotAuthorized";
1887
+ code: "BotCheckFailed" | "NotAuthorized";
1835
1888
  };
1836
1889
  };
1837
1890
  };
@@ -1847,7 +1900,7 @@ export interface operations {
1847
1900
  };
1848
1901
  };
1849
1902
  };
1850
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
1903
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
1851
1904
  415: {
1852
1905
  headers: {
1853
1906
  [name: string]: unknown;
@@ -1872,7 +1925,8 @@ export interface operations {
1872
1925
  };
1873
1926
  };
1874
1927
  /**
1875
- * @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds
1928
+ * @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds
1929
+ * - `TooManyAttempts`: Too many sign-in codes were requested from this address; retry after `Retry-After` seconds
1876
1930
  * - `TooManyChallenges`: Too many sign-in codes were sent to this number; retry after `Retry-After` seconds
1877
1931
  */
1878
1932
  429: {
@@ -1884,7 +1938,7 @@ export interface operations {
1884
1938
  content: {
1885
1939
  "application/json": components["schemas"]["ErrorResponse"] & {
1886
1940
  /** @enum {string} */
1887
- code: "RateLimited" | "TooManyChallenges";
1941
+ code: "RateLimited" | "TooManyAttempts" | "TooManyChallenges";
1888
1942
  };
1889
1943
  };
1890
1944
  };
@@ -1901,7 +1955,9 @@ export interface operations {
1901
1955
  };
1902
1956
  };
1903
1957
  /**
1904
- * @description - `SmsBudgetExhausted`: The client's hourly SMS budget is used up; retry after `Retry-After` seconds
1958
+ * @description - `BotCheckUnavailable`: The bot check could not be made: Turnstile did not answer in time, or the calling application has no widget secret; retry after `Retry-After` seconds
1959
+ * - `LimiterUnavailable`: The per-address sign-in limit could not be counted; retry after `Retry-After` seconds
1960
+ * - `SmsBudgetExhausted`: The client's hourly SMS budget is used up; retry after `Retry-After` seconds
1905
1961
  * - `SmsDeliveryUnavailable`: The SMS could not be confirmed as sent; retry after `Retry-After` seconds
1906
1962
  */
1907
1963
  503: {
@@ -1913,7 +1969,7 @@ export interface operations {
1913
1969
  content: {
1914
1970
  "application/json": components["schemas"]["ErrorResponse"] & {
1915
1971
  /** @enum {string} */
1916
- code: "SmsBudgetExhausted" | "SmsDeliveryUnavailable";
1972
+ code: "BotCheckUnavailable" | "LimiterUnavailable" | "SmsBudgetExhausted" | "SmsDeliveryUnavailable";
1917
1973
  };
1918
1974
  };
1919
1975
  };
@@ -2000,145 +2056,7 @@ export interface operations {
2000
2056
  };
2001
2057
  };
2002
2058
  };
2003
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
2004
- 415: {
2005
- headers: {
2006
- [name: string]: unknown;
2007
- };
2008
- content: {
2009
- "application/json": components["schemas"]["ErrorResponse"] & {
2010
- /** @enum {string} */
2011
- code: "UnsupportedMediaType";
2012
- };
2013
- };
2014
- };
2015
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2016
- 429: {
2017
- headers: {
2018
- /** @description Seconds to wait before sending the request again */
2019
- "Retry-After"?: number;
2020
- [name: string]: unknown;
2021
- };
2022
- content: {
2023
- "application/json": components["schemas"]["ErrorResponse"] & {
2024
- /** @enum {string} */
2025
- code: "RateLimited";
2026
- };
2027
- };
2028
- };
2029
- /** @description - `InternalError`: The engine failed unexpectedly */
2030
- 500: {
2031
- headers: {
2032
- [name: string]: unknown;
2033
- };
2034
- content: {
2035
- "application/json": components["schemas"]["ErrorResponse"] & {
2036
- /** @enum {string} */
2037
- code: "InternalError";
2038
- };
2039
- };
2040
- };
2041
- };
2042
- };
2043
- identityRegisterCustomer: {
2044
- parameters: {
2045
- query?: never;
2046
- header?: never;
2047
- path?: never;
2048
- cookie?: never;
2049
- };
2050
- requestBody: {
2051
- content: {
2052
- "application/json": {
2053
- /** Format: uuid */
2054
- challenge: string;
2055
- code: string;
2056
- };
2057
- };
2058
- };
2059
- responses: {
2060
- /** @description OK */
2061
- 200: {
2062
- headers: {
2063
- [name: string]: unknown;
2064
- };
2065
- content: {
2066
- "application/json": {
2067
- /** Format: date-time */
2068
- expiresAt: string;
2069
- /** Format: uuid */
2070
- sessionId: string;
2071
- sessionToken: string;
2072
- };
2073
- };
2074
- };
2075
- /**
2076
- * @description - `MalformedBody`: The JSON body cannot be parsed
2077
- * - `ValidationFailed`: The path, query or body does not match the operation's schema; `issues` lists each problem with its path
2078
- */
2079
- 400: {
2080
- headers: {
2081
- [name: string]: unknown;
2082
- };
2083
- content: {
2084
- "application/json": components["schemas"]["ValidationErrorResponse"] & {
2085
- /** @enum {string} */
2086
- code: "MalformedBody" | "ValidationFailed";
2087
- };
2088
- };
2089
- };
2090
- /**
2091
- * @description - `NotAuthenticated`: The credentials are missing, invalid or expired, or do not fit this surface
2092
- * - `SessionExpired`: The session has expired or its client's session policy ended it; sign in again
2093
- */
2094
- 401: {
2095
- headers: {
2096
- [name: string]: unknown;
2097
- };
2098
- content: {
2099
- "application/json": components["schemas"]["ErrorResponse"] & {
2100
- /** @enum {string} */
2101
- code: "NotAuthenticated" | "SessionExpired";
2102
- };
2103
- };
2104
- };
2105
- /** @description - `NotAuthorized`: The actor is not permitted to perform this operation */
2106
- 403: {
2107
- headers: {
2108
- [name: string]: unknown;
2109
- };
2110
- content: {
2111
- "application/json": components["schemas"]["ErrorResponse"] & {
2112
- /** @enum {string} */
2113
- code: "NotAuthorized";
2114
- };
2115
- };
2116
- };
2117
- /** @description - `ActorUnavailable`: A live registered actor is required */
2118
- 409: {
2119
- headers: {
2120
- [name: string]: unknown;
2121
- };
2122
- content: {
2123
- "application/json": components["schemas"]["ErrorResponse"] & {
2124
- /** @enum {string} */
2125
- code: "ActorUnavailable";
2126
- };
2127
- };
2128
- };
2129
- /** @description - `BodyTooLarge`: The body is larger than the engine accepts */
2130
- 413: {
2131
- headers: {
2132
- [name: string]: unknown;
2133
- };
2134
- content: {
2135
- "application/json": components["schemas"]["ErrorResponse"] & {
2136
- /** @enum {string} */
2137
- code: "BodyTooLarge";
2138
- };
2139
- };
2140
- };
2141
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
2059
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
2142
2060
  415: {
2143
2061
  headers: {
2144
2062
  [name: string]: unknown;
@@ -2150,7 +2068,7 @@ export interface operations {
2150
2068
  };
2151
2069
  };
2152
2070
  };
2153
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2071
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
2154
2072
  429: {
2155
2073
  headers: {
2156
2074
  /** @description Seconds to wait before sending the request again */
@@ -2230,7 +2148,7 @@ export interface operations {
2230
2148
  };
2231
2149
  };
2232
2150
  };
2233
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2151
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
2234
2152
  429: {
2235
2153
  headers: {
2236
2154
  /** @description Seconds to wait before sending the request again */
@@ -2343,7 +2261,7 @@ export interface operations {
2343
2261
  };
2344
2262
  };
2345
2263
  };
2346
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
2264
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
2347
2265
  415: {
2348
2266
  headers: {
2349
2267
  [name: string]: unknown;
@@ -2355,7 +2273,7 @@ export interface operations {
2355
2273
  };
2356
2274
  };
2357
2275
  };
2358
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2276
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
2359
2277
  429: {
2360
2278
  headers: {
2361
2279
  /** @description Seconds to wait before sending the request again */
@@ -2494,7 +2412,7 @@ export interface operations {
2494
2412
  };
2495
2413
  };
2496
2414
  };
2497
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2415
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
2498
2416
  429: {
2499
2417
  headers: {
2500
2418
  /** @description Seconds to wait before sending the request again */
@@ -2581,7 +2499,7 @@ export interface operations {
2581
2499
  };
2582
2500
  };
2583
2501
  };
2584
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2502
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
2585
2503
  429: {
2586
2504
  headers: {
2587
2505
  /** @description Seconds to wait before sending the request again */
@@ -2681,7 +2599,7 @@ export interface operations {
2681
2599
  };
2682
2600
  };
2683
2601
  };
2684
- /** @description - `UnsupportedMediaType`: The body's content type is not `application/json` */
2602
+ /** @description - `UnsupportedMediaType`: The body's content type is not one the operation accepts: `application/json`, or the image types an image upload lists */
2685
2603
  415: {
2686
2604
  headers: {
2687
2605
  [name: string]: unknown;
@@ -2693,7 +2611,7 @@ export interface operations {
2693
2611
  };
2694
2612
  };
2695
2613
  };
2696
- /** @description - `RateLimited`: The load balancer's rate limit refused the request; retry after `Retry-After` seconds */
2614
+ /** @description - `RateLimited`: A rate limit refused the request: the load balancer's per IP, or the engine's per application client; retry after `Retry-After` seconds */
2697
2615
  429: {
2698
2616
  headers: {
2699
2617
  /** @description Seconds to wait before sending the request again */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msm-platform/customer-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Typed server-side client for MSM's customer API (/web)",
5
5
  "license": "MIT",
6
6
  "repository": {