@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/dist/server.js
CHANGED
|
@@ -7,8 +7,9 @@ function a(e) {
|
|
|
7
7
|
for (let e of t) if (r.encode(e).length < 32) throw Error("customer-react/server: each session key must be at least 32 bytes, such as `openssl rand -base64 32`.");
|
|
8
8
|
return t;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var o = "__Host-msm_customer_registration";
|
|
11
|
+
function s(e, t, n) {
|
|
12
|
+
let a, o = () => a ??= Promise.all(e.map(async (e) => {
|
|
12
13
|
let t = await crypto.subtle.importKey("raw", r.encode(e), "HKDF", !1, ["deriveKey"]);
|
|
13
14
|
return crypto.subtle.deriveKey({
|
|
14
15
|
name: "HKDF",
|
|
@@ -19,62 +20,74 @@ function o(e) {
|
|
|
19
20
|
name: "AES-GCM",
|
|
20
21
|
length: 256
|
|
21
22
|
}, !1, ["encrypt", "decrypt"]);
|
|
22
|
-
})),
|
|
23
|
+
})), s = r.encode(t);
|
|
23
24
|
return {
|
|
24
25
|
async seal(e) {
|
|
25
|
-
let [t] = await
|
|
26
|
+
let [t] = await o(), a = crypto.getRandomValues(new Uint8Array(i)), c = await crypto.subtle.encrypt({
|
|
26
27
|
name: "AES-GCM",
|
|
27
|
-
iv:
|
|
28
|
-
additionalData:
|
|
29
|
-
}, t, r.encode(JSON.stringify(
|
|
30
|
-
|
|
31
|
-
sessionToken: e.sessionToken,
|
|
32
|
-
expiresAt: e.expiresAt
|
|
33
|
-
}))), c = new Uint8Array(i + s.byteLength);
|
|
34
|
-
return c.set(n), c.set(new Uint8Array(s), i), l(c);
|
|
28
|
+
iv: a,
|
|
29
|
+
additionalData: s
|
|
30
|
+
}, t, r.encode(JSON.stringify(n(e)))), l = new Uint8Array(i + c.byteLength);
|
|
31
|
+
return l.set(a), l.set(new Uint8Array(c), i), m(l);
|
|
35
32
|
},
|
|
36
33
|
async open(e) {
|
|
37
|
-
let t = e ?
|
|
34
|
+
let t = e ? h(e) : null;
|
|
38
35
|
if (!t || t.length <= i) return null;
|
|
39
|
-
let
|
|
40
|
-
for (let e of await
|
|
36
|
+
let r = t.subarray(0, i), a = t.subarray(i);
|
|
37
|
+
for (let e of await o()) {
|
|
41
38
|
let t;
|
|
42
39
|
try {
|
|
43
40
|
t = await crypto.subtle.decrypt({
|
|
44
41
|
name: "AES-GCM",
|
|
45
|
-
iv:
|
|
46
|
-
additionalData:
|
|
47
|
-
}, e,
|
|
42
|
+
iv: r,
|
|
43
|
+
additionalData: s
|
|
44
|
+
}, e, a);
|
|
48
45
|
} catch {
|
|
49
46
|
continue;
|
|
50
47
|
}
|
|
51
|
-
let i =
|
|
48
|
+
let i = d(new TextDecoder().decode(t), n);
|
|
52
49
|
return i && Date.parse(i.expiresAt) > Date.now() ? i : null;
|
|
53
50
|
}
|
|
54
51
|
return null;
|
|
55
52
|
}
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
|
-
function s(e, t) {
|
|
59
|
-
return o(a(t.sessionKeys)).open(e);
|
|
60
|
-
}
|
|
61
55
|
function c(e) {
|
|
62
|
-
|
|
63
|
-
let t = JSON.parse(e);
|
|
64
|
-
if (typeof t.sessionId == "string" && typeof t.sessionToken == "string" && typeof t.expiresAt == "string") return {
|
|
65
|
-
sessionId: t.sessionId,
|
|
66
|
-
sessionToken: t.sessionToken,
|
|
67
|
-
expiresAt: t.expiresAt
|
|
68
|
-
};
|
|
69
|
-
} catch {}
|
|
70
|
-
return null;
|
|
56
|
+
return s(e, n, f);
|
|
71
57
|
}
|
|
72
58
|
function l(e) {
|
|
59
|
+
return s(e, o, p);
|
|
60
|
+
}
|
|
61
|
+
function u(e, t) {
|
|
62
|
+
return c(a(t.sessionKeys)).open(e);
|
|
63
|
+
}
|
|
64
|
+
function d(e, t) {
|
|
65
|
+
try {
|
|
66
|
+
let n = JSON.parse(e);
|
|
67
|
+
return typeof n == "object" && n ? t(n) : null;
|
|
68
|
+
} catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function f(e) {
|
|
73
|
+
return typeof e.sessionId == "string" && typeof e.sessionToken == "string" && typeof e.expiresAt == "string" ? {
|
|
74
|
+
sessionId: e.sessionId,
|
|
75
|
+
sessionToken: e.sessionToken,
|
|
76
|
+
expiresAt: e.expiresAt
|
|
77
|
+
} : null;
|
|
78
|
+
}
|
|
79
|
+
function p(e) {
|
|
80
|
+
return typeof e.registrationTicket == "string" && typeof e.expiresAt == "string" ? {
|
|
81
|
+
registrationTicket: e.registrationTicket,
|
|
82
|
+
expiresAt: e.expiresAt
|
|
83
|
+
} : null;
|
|
84
|
+
}
|
|
85
|
+
function m(e) {
|
|
73
86
|
let t = "";
|
|
74
87
|
for (let n of e) t += String.fromCharCode(n);
|
|
75
88
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
76
89
|
}
|
|
77
|
-
function
|
|
90
|
+
function h(e) {
|
|
78
91
|
if (!/^[A-Za-z0-9_-]+$/.test(e)) return null;
|
|
79
92
|
try {
|
|
80
93
|
let t = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
|
|
@@ -84,18 +97,18 @@ function u(e) {
|
|
|
84
97
|
}
|
|
85
98
|
}
|
|
86
99
|
// src/server/index.ts
|
|
87
|
-
var
|
|
100
|
+
var g = 1e4, _ = 3e4, v = 1048576, y = /* @__PURE__ */ new Set([
|
|
88
101
|
"GET",
|
|
89
102
|
"HEAD",
|
|
90
103
|
"POST",
|
|
91
104
|
"PUT",
|
|
92
105
|
"PATCH",
|
|
93
106
|
"DELETE"
|
|
94
|
-
]),
|
|
107
|
+
]), b = [
|
|
95
108
|
"accept",
|
|
96
109
|
"content-type",
|
|
97
110
|
"accept-language"
|
|
98
|
-
],
|
|
111
|
+
], x = "Path=/; HttpOnly; Secure; SameSite=Lax", S = class extends Error {
|
|
99
112
|
status;
|
|
100
113
|
code;
|
|
101
114
|
retryAfterSeconds;
|
|
@@ -103,72 +116,87 @@ var d = 1e4, f = 3e4, p = 1048576, m = /* @__PURE__ */ new Set([
|
|
|
103
116
|
super(n), this.status = e, this.code = t, this.retryAfterSeconds = r;
|
|
104
117
|
}
|
|
105
118
|
};
|
|
106
|
-
function
|
|
119
|
+
function C(r) {
|
|
107
120
|
if (typeof r.clientIp != "function") throw Error("customer-react/server: clientIp is required.");
|
|
108
121
|
let i = r.basePath.replace(/\/$/, "");
|
|
109
122
|
if (!i.startsWith("/") || i.startsWith("//")) throw Error("customer-react/server: basePath must be a path, such as /msm.");
|
|
110
|
-
let s =
|
|
123
|
+
let s = a(r.sessionKeys), u = c(s), d = l(s), f = t({
|
|
111
124
|
baseUrl: r.engineUrl,
|
|
112
125
|
clientId: r.clientId,
|
|
113
126
|
clientSecret: r.clientSecret,
|
|
114
127
|
...r.fetch && { fetch: r.fetch }
|
|
115
|
-
}),
|
|
116
|
-
async function
|
|
128
|
+
}), p = () => AbortSignal.timeout(g), m = `${n}=; ${x}; Max-Age=0`, h = `${o}=; ${x}; Max-Age=0`;
|
|
129
|
+
async function v(e) {
|
|
117
130
|
let t = new URL(e.url);
|
|
118
|
-
if (t.pathname !== i && !t.pathname.startsWith(`${i}/`)) throw new
|
|
131
|
+
if (t.pathname !== i && !t.pathname.startsWith(`${i}/`)) throw new S(404, "NotFound", "Not found.");
|
|
119
132
|
let r = t.pathname.slice(i.length);
|
|
120
|
-
if (e.headers.get("x-msm-bff") !== "1") throw new
|
|
121
|
-
let a = await
|
|
122
|
-
if (r.startsWith("/engine/")) return
|
|
123
|
-
let
|
|
124
|
-
if (
|
|
125
|
-
let t = await
|
|
126
|
-
return
|
|
127
|
-
body: {
|
|
128
|
-
phone: t.phone,
|
|
129
|
-
...n
|
|
130
|
-
},
|
|
131
|
-
signal: l()
|
|
132
|
-
}).then(b));
|
|
133
|
-
}
|
|
134
|
-
if (o === "POST /auth/register/initiate") {
|
|
135
|
-
let t = await T(e, [
|
|
136
|
-
"phone",
|
|
137
|
-
"name",
|
|
138
|
-
"botCheckToken"
|
|
139
|
-
]), n = await v(e, t);
|
|
140
|
-
return x(200, await c.POST("/web/identity/initiateRegistration", {
|
|
133
|
+
if (e.headers.get("x-msm-bff") !== "1") throw new S(403, "BffHeaderRequired", "Missing X-MSM-BFF header.");
|
|
134
|
+
let a = await u.open(O(e, n));
|
|
135
|
+
if (r.startsWith("/engine/")) return N(e, t, r, a);
|
|
136
|
+
let s = `${e.method} ${r}`;
|
|
137
|
+
if (s === "POST /auth/initiate") {
|
|
138
|
+
let t = await j(e, ["phone", "botCheckToken"]), n = await M(e, t);
|
|
139
|
+
return E(200, await f.POST("/web/identity/initiateLogin", {
|
|
141
140
|
body: {
|
|
142
141
|
phone: t.phone,
|
|
143
|
-
name: t.name,
|
|
144
142
|
...n
|
|
145
143
|
},
|
|
146
|
-
signal:
|
|
147
|
-
}).then(
|
|
144
|
+
signal: p()
|
|
145
|
+
}).then(T));
|
|
148
146
|
}
|
|
149
|
-
if (
|
|
150
|
-
let { challenge: t, code:
|
|
147
|
+
if (s === "POST /auth/login") {
|
|
148
|
+
let { challenge: t, code: n } = await j(e, ["challenge", "code"]), r = await f.POST("/web/identity/customerLogin", {
|
|
151
149
|
body: {
|
|
152
150
|
challenge: t,
|
|
153
|
-
code:
|
|
151
|
+
code: n
|
|
154
152
|
},
|
|
155
|
-
signal:
|
|
156
|
-
}).then(
|
|
157
|
-
|
|
158
|
-
let
|
|
159
|
-
return
|
|
153
|
+
signal: p()
|
|
154
|
+
}).then(T);
|
|
155
|
+
if (r.result === "session") return C(a, r);
|
|
156
|
+
let { registrationTicket: i } = r;
|
|
157
|
+
return r.nameRequired ? E(200, { result: "nameRequired" }, { "set-cookie": `${o}=${await d.seal({
|
|
158
|
+
registrationTicket: i,
|
|
159
|
+
expiresAt: r.registrationExpiresAt
|
|
160
|
+
})}; ${x}; Max-Age=${D(r.registrationExpiresAt)}` }) : C(a, await A({ registrationTicket: i }));
|
|
160
161
|
}
|
|
161
|
-
if (
|
|
162
|
-
|
|
162
|
+
if (s === "POST /auth/register") {
|
|
163
|
+
let t = await d.open(O(e, o));
|
|
164
|
+
if (!t) return E(401, {
|
|
165
|
+
code: "NotAuthenticated",
|
|
166
|
+
message: "No registration is pending."
|
|
167
|
+
}, { "set-cookie": h });
|
|
168
|
+
let { name: n } = await j(e, ["name"]);
|
|
169
|
+
return C(a, await A({
|
|
170
|
+
registrationTicket: t.registrationTicket,
|
|
171
|
+
name: n
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
if (s === "GET /auth/session") return a ? E(200, { sessionKey: a.sessionId }) : F();
|
|
175
|
+
if (s === "POST /auth/logout") return a && await P(a), new Response(null, {
|
|
163
176
|
status: 204,
|
|
164
|
-
headers:
|
|
165
|
-
"set-cookie"
|
|
166
|
-
"
|
|
167
|
-
|
|
177
|
+
headers: [
|
|
178
|
+
["set-cookie", m],
|
|
179
|
+
["set-cookie", h],
|
|
180
|
+
["cache-control", "no-store"]
|
|
181
|
+
]
|
|
168
182
|
});
|
|
169
|
-
throw new
|
|
183
|
+
throw new S(404, "NotFound", "Not found.");
|
|
184
|
+
}
|
|
185
|
+
async function C(e, t) {
|
|
186
|
+
e && await P(e);
|
|
187
|
+
let r = await u.seal(t);
|
|
188
|
+
return E(200, {
|
|
189
|
+
result: "session",
|
|
190
|
+
sessionKey: t.sessionId
|
|
191
|
+
}, [["set-cookie", `${n}=${r}; ${x}; Max-Age=${D(t.expiresAt)}`], ["set-cookie", h]]);
|
|
170
192
|
}
|
|
171
|
-
|
|
193
|
+
function A(e) {
|
|
194
|
+
return f.POST("/web/identity/completeRegistration", {
|
|
195
|
+
body: e,
|
|
196
|
+
signal: p()
|
|
197
|
+
}).then(T);
|
|
198
|
+
}
|
|
199
|
+
async function M(e, t) {
|
|
172
200
|
let n;
|
|
173
201
|
try {
|
|
174
202
|
n = await r.clientIp(e);
|
|
@@ -176,86 +204,86 @@ function v(r) {
|
|
|
176
204
|
n = null;
|
|
177
205
|
}
|
|
178
206
|
let i = n?.trim().replace(/^\[|\]$/g, "").replace(/%.*$/, "");
|
|
179
|
-
if (!i) throw new
|
|
207
|
+
if (!i) throw new S(503, "ClientIpUnavailable", "The client's address is unknown.");
|
|
180
208
|
return {
|
|
181
209
|
botCheckToken: t.botCheckToken,
|
|
182
210
|
clientIp: i
|
|
183
211
|
};
|
|
184
212
|
}
|
|
185
|
-
async function
|
|
213
|
+
async function N(t, n, r, i) {
|
|
186
214
|
let a = r.slice(7);
|
|
187
|
-
if (!
|
|
215
|
+
if (!w(a) || !y.has(t.method)) throw new S(404, "NotFound", "Not found.");
|
|
188
216
|
let o = new Headers();
|
|
189
|
-
for (let e of
|
|
217
|
+
for (let e of b) {
|
|
190
218
|
let n = t.headers.get(e);
|
|
191
219
|
n && o.set(e, n);
|
|
192
220
|
}
|
|
193
221
|
i && o.set("x-session-token", i.sessionToken);
|
|
194
|
-
let s = t.method !== "GET" && t.method !== "HEAD" ? await
|
|
222
|
+
let s = t.method !== "GET" && t.method !== "HEAD" ? await k(t) : void 0, c;
|
|
195
223
|
try {
|
|
196
|
-
|
|
224
|
+
c = (await f.request(t.method.toLowerCase(), `${a}${n.search}`, {
|
|
197
225
|
headers: o,
|
|
198
226
|
...s && s.byteLength > 0 && { body: s },
|
|
199
227
|
bodySerializer: (e) => e,
|
|
200
228
|
parseAs: "stream",
|
|
201
229
|
redirect: "manual",
|
|
202
|
-
signal: AbortSignal.timeout(
|
|
230
|
+
signal: AbortSignal.timeout(_)
|
|
203
231
|
})).response;
|
|
204
232
|
} catch (t) {
|
|
205
233
|
if (!(t instanceof e)) throw t;
|
|
206
|
-
|
|
234
|
+
c = t.response;
|
|
207
235
|
}
|
|
208
|
-
let
|
|
236
|
+
let l = c.status === 401 || c.ok && t.method === "DELETE" && a === "/web/me/sessions" && i !== null, u = new Headers({ "cache-control": "no-store" });
|
|
209
237
|
for (let e of ["content-type", "retry-after"]) {
|
|
210
|
-
let t =
|
|
211
|
-
t &&
|
|
238
|
+
let t = c.headers.get(e);
|
|
239
|
+
t && u.set(e, t);
|
|
212
240
|
}
|
|
213
|
-
|
|
214
|
-
let
|
|
241
|
+
l && u.set("set-cookie", m);
|
|
242
|
+
let d = t.method === "HEAD" || [
|
|
215
243
|
204,
|
|
216
244
|
205,
|
|
217
245
|
304
|
|
218
|
-
].includes(
|
|
219
|
-
return new Response(
|
|
220
|
-
status:
|
|
221
|
-
headers:
|
|
246
|
+
].includes(c.status);
|
|
247
|
+
return new Response(d ? null : await c.arrayBuffer(), {
|
|
248
|
+
status: c.status,
|
|
249
|
+
headers: u
|
|
222
250
|
});
|
|
223
251
|
}
|
|
224
|
-
async function
|
|
225
|
-
await
|
|
252
|
+
async function P(e) {
|
|
253
|
+
await f.POST("/web/identity/logout", {
|
|
226
254
|
body: { sessionToken: e.sessionToken },
|
|
227
|
-
signal:
|
|
255
|
+
signal: p()
|
|
228
256
|
}).catch(() => {});
|
|
229
257
|
}
|
|
230
|
-
function
|
|
231
|
-
return
|
|
258
|
+
function F() {
|
|
259
|
+
return E(401, {
|
|
232
260
|
code: "NotAuthenticated",
|
|
233
261
|
message: "Sign in again."
|
|
234
|
-
}, { "set-cookie":
|
|
262
|
+
}, { "set-cookie": m });
|
|
235
263
|
}
|
|
236
264
|
return async function(t) {
|
|
237
265
|
try {
|
|
238
|
-
return await
|
|
266
|
+
return await v(t);
|
|
239
267
|
} catch (t) {
|
|
240
|
-
if (t instanceof
|
|
268
|
+
if (t instanceof S) return E(t.status, {
|
|
241
269
|
code: t.code,
|
|
242
270
|
message: t.message
|
|
243
271
|
}, t.retryAfterSeconds ? { "retry-after": String(t.retryAfterSeconds) } : {});
|
|
244
272
|
if (t instanceof e && (t.status >= 400 && t.status < 500 || t.status === 503 && t.code)) {
|
|
245
|
-
let e = t.response.headers.get("retry-after");
|
|
246
|
-
return
|
|
273
|
+
let e = new Headers(), n = t.response.headers.get("retry-after");
|
|
274
|
+
return n && e.set("retry-after", n), t.status === 401 && e.set("set-cookie", h), E(t.status, {
|
|
247
275
|
code: t.code ?? "EngineRejected",
|
|
248
276
|
message: t.message
|
|
249
|
-
}, e
|
|
277
|
+
}, e);
|
|
250
278
|
}
|
|
251
|
-
return
|
|
279
|
+
return E(502, {
|
|
252
280
|
code: "EngineUnavailable",
|
|
253
281
|
message: "The engine could not complete the request."
|
|
254
282
|
});
|
|
255
283
|
}
|
|
256
284
|
};
|
|
257
285
|
}
|
|
258
|
-
function
|
|
286
|
+
function w(e) {
|
|
259
287
|
if (/%2f|%5c|\/\//i.test(e)) return !1;
|
|
260
288
|
let t;
|
|
261
289
|
try {
|
|
@@ -265,51 +293,49 @@ function y(e) {
|
|
|
265
293
|
}
|
|
266
294
|
return !/(^|\/)\.\.?(\/|$)|\\/.test(t) && /^\/web\//.test(t) && !/^\/web\/identity(\/|$)/i.test(t);
|
|
267
295
|
}
|
|
268
|
-
var
|
|
296
|
+
var T = ({ data: e }) => {
|
|
269
297
|
if (e === void 0) throw Error("Engine returned no body.");
|
|
270
298
|
return e;
|
|
271
299
|
};
|
|
272
|
-
function
|
|
273
|
-
|
|
300
|
+
function E(e, t, n = {}) {
|
|
301
|
+
let r = new Headers(n);
|
|
302
|
+
return r.set("content-type", "application/json"), r.set("cache-control", "no-store"), new Response(JSON.stringify(t), {
|
|
274
303
|
status: e,
|
|
275
|
-
headers:
|
|
276
|
-
"content-type": "application/json",
|
|
277
|
-
"cache-control": "no-store",
|
|
278
|
-
...n
|
|
279
|
-
}
|
|
304
|
+
headers: r
|
|
280
305
|
});
|
|
281
306
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
307
|
+
var D = (e) => Math.max(0, Math.floor((Date.parse(e) - Date.now()) / 1e3));
|
|
308
|
+
function O(e, t) {
|
|
309
|
+
for (let n of e.headers.get("cookie")?.split(";") ?? []) {
|
|
310
|
+
let e = n.indexOf("=");
|
|
311
|
+
if (e > 0 && n.slice(0, e).trim() === t) return n.slice(e + 1).trim() || void 0;
|
|
286
312
|
}
|
|
287
313
|
}
|
|
288
|
-
async function
|
|
289
|
-
if (Number(e.headers.get("content-length")) >
|
|
314
|
+
async function k(e) {
|
|
315
|
+
if (Number(e.headers.get("content-length")) > v) throw A();
|
|
290
316
|
if (!e.body) return /* @__PURE__ */ new Uint8Array();
|
|
291
317
|
let t = e.body.getReader(), n = [], r = 0;
|
|
292
318
|
for (;;) {
|
|
293
319
|
let { done: e, value: i } = await t.read();
|
|
294
320
|
if (e) break;
|
|
295
|
-
if (r += i.byteLength, r >
|
|
321
|
+
if (r += i.byteLength, r > v) throw await t.cancel().catch(() => {}), A();
|
|
296
322
|
n.push(i);
|
|
297
323
|
}
|
|
298
324
|
let i = new Uint8Array(r), a = 0;
|
|
299
325
|
for (let e of n) i.set(e, a), a += e.byteLength;
|
|
300
326
|
return i;
|
|
301
327
|
}
|
|
302
|
-
var
|
|
303
|
-
async function
|
|
328
|
+
var A = () => new S(413, "PayloadTooLarge", "Request body is too large.");
|
|
329
|
+
async function j(e, t) {
|
|
304
330
|
let n;
|
|
305
331
|
try {
|
|
306
|
-
n = JSON.parse(new TextDecoder().decode(await
|
|
332
|
+
n = JSON.parse(new TextDecoder().decode(await k(e)));
|
|
307
333
|
} catch (e) {
|
|
308
|
-
if (e instanceof
|
|
334
|
+
if (e instanceof S) throw e;
|
|
309
335
|
n = void 0;
|
|
310
336
|
}
|
|
311
337
|
let r = typeof n == "object" && n;
|
|
312
|
-
if (!r || t.some((e) => typeof r[e] != "string")) throw new
|
|
338
|
+
if (!r || t.some((e) => typeof r[e] != "string")) throw new S(400, "InvalidRequest", `Expected ${t.join(", ")}.`);
|
|
313
339
|
return r;
|
|
314
340
|
}
|
|
315
|
-
export {
|
|
341
|
+
export { C as createCustomerHandler, n as customerSessionCookie, u as readCustomerSession };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** undefined while checking, null when signed out, else the session's ID. */
|
|
2
|
+
export type SessionState = string | null | undefined;
|
|
3
|
+
/** Sets the session every component on `basePath` shows. */
|
|
4
|
+
export declare function setSession(basePath: string, value: string | null): void;
|
|
5
|
+
/**
|
|
6
|
+
* The shared session on `basePath`, checked with the server half when the
|
|
7
|
+
* first component mounts. `onChange` hears each sign-in and sign-out after
|
|
8
|
+
* that first answer, including a session the server half ended.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useSession(basePath: string, onChange: ((signedIn: boolean) => void) | undefined): SessionState;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CustomerBotCheck, CustomerBrand } from "./client";
|
|
2
|
+
export interface MsmSignInProps {
|
|
3
|
+
/** Where the server half is mounted, as for MsmCustomer. */
|
|
4
|
+
basePath: string;
|
|
5
|
+
/** The host's name and logo above the form. */
|
|
6
|
+
brand?: CustomerBrand;
|
|
7
|
+
/** The bot check before a code is sent, as for MsmCustomer. */
|
|
8
|
+
botCheck: CustomerBotCheck;
|
|
9
|
+
/**
|
|
10
|
+
* Called once the customer is signed in, whether they signed in or
|
|
11
|
+
* registered, and at once when they already were.
|
|
12
|
+
*/
|
|
13
|
+
onSignedIn?: () => void;
|
|
14
|
+
/** Offers a Cancel button that calls this. */
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Called when the customer signs in or out after the first session check,
|
|
18
|
+
* here or in another of the package's components on the same `basePath`.
|
|
19
|
+
*/
|
|
20
|
+
onSessionChange?: (signedIn: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Phone sign-in and registration on their own, for a host's modal. It
|
|
24
|
+
* never navigates: the host closes it on `onSignedIn` or `onCancel`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function MsmSignIn(props: MsmSignInProps): import("react").JSX.Element;
|
package/dist/sign-in.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type CustomerBotCheck, type CustomerBrand } from "./client";
|
|
3
3
|
import { type MessageKey } from "./i18n";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* One phone-first form through the server half's auth routes: the customer
|
|
6
|
+
* never chooses between signing in and registering.
|
|
7
|
+
*/
|
|
5
8
|
export declare function SignIn(props: {
|
|
6
9
|
basePath: string;
|
|
7
10
|
brand: CustomerBrand | undefined;
|
|
@@ -9,6 +12,10 @@ export declare function SignIn(props: {
|
|
|
9
12
|
botCheck: CustomerBotCheck | undefined;
|
|
10
13
|
notice: MessageKey | undefined;
|
|
11
14
|
onSignedIn: (sessionKey: string) => void;
|
|
15
|
+
/** Offers a Cancel button that calls this. */
|
|
16
|
+
onCancel?: (() => void) | undefined;
|
|
17
|
+
/** Moves focus to the first field on mount, as in a host's dialog. */
|
|
18
|
+
autoFocus?: boolean;
|
|
12
19
|
/** What the customer is signing in for, such as the time they chose. */
|
|
13
20
|
children?: ReactNode;
|
|
14
21
|
}): import("react").JSX.Element;
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.msm-phone{grid-template-columns:minmax(0,1fr);gap:4px;min-width:0;display:grid}.msm-phone .msm-phone-row{gap:8px;display:flex}.msm-phone .msm-phone-row button.msm-phone-country{border:1px solid var(--msm-border,#c9d1c8);background:var(--msm-surface,#fff);min-width:48px;min-height:48px;color:var(--msm-text,#202e2b);font:inherit;cursor:pointer;border-radius:6px;flex-shrink:0;align-items:center;gap:6px;padding:0 12px;font-size:16px;font-weight:400;display:flex}.msm-phone .msm-phone-row button.msm-phone-country:after{content:"▾";color:var(--msm-muted,#66736c);font-size:12px}.msm-phone .msm-phone-row input.msm-phone-number{border:1px solid var(--msm-border,#c9d1c8);background:var(--msm-surface,#fff);min-width:0;min-height:48px;color:var(--msm-text,#202e2b);font:inherit;border-radius:6px;flex:1;padding:0 12px;font-size:16px;font-weight:400}.msm-phone .msm-phone-row input.msm-phone-number[aria-invalid=true]{border-color:var(--msm-danger,#9b2c2c)}.msm-phone p.msm-phone-problem{color:var(--msm-danger,#9b2c2c);margin:0;font-size:14px;font-weight:400}:is(.msm-phone,.msm-select) .msm-picker-dialog{background:var(--msm-surface,#fff);width:min(440px,100vw - 32px);max-width:none;height:min(640px,100dvh - 64px);max-height:none;color:var(--msm-text,#202e2b);border:0;border-radius:12px;padding:0;font:16px/1.4 system-ui,sans-serif;box-shadow:0 16px 48px #202e2b40}:is(.msm-phone,.msm-select) .msm-picker-dialog[open]{flex-direction:column;display:flex}:is(.msm-phone,.msm-select) .msm-picker-dialog::backdrop{background:#202e2b73}:is(.msm-phone,.msm-select) .msm-picker-head{justify-content:space-between;align-items:center;padding:8px 8px 8px 20px;display:flex}:is(.msm-phone,.msm-select) .msm-picker-head h2{letter-spacing:0;margin:0;font-size:18px;font-weight:600}:is(.msm-phone,.msm-select) .msm-picker-head button{min-width:48px;min-height:48px;color:var(--msm-accent,#235b4b);font:inherit;cursor:pointer;background:0 0;border:0;padding:0 12px;font-weight:600}:is(.msm-phone,.msm-select) .msm-picker-dialog input.msm-picker-search{border:1px solid var(--msm-border,#c9d1c8);min-height:48px;color:var(--msm-text,#202e2b);font:inherit;border-radius:6px;margin:0 16px 8px;padding:0 12px}:is(.msm-phone,.msm-select) .msm-picker-dialog ul{overscroll-behavior:contain;border-top:1px solid var(--msm-divider,#dce2db);flex:1;margin:0;padding:0 0 8px;list-style:none;overflow-y:auto}:is(.msm-phone,.msm-select) .msm-picker-dialog li button{width:100%;min-height:48px;color:var(--msm-text,#202e2b);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:0;align-items:center;gap:12px;padding:0 20px;display:flex}:is(.msm-phone,.msm-select) .msm-picker-dialog li button:hover,:is(.msm-phone,.msm-select) .msm-picker-dialog li button.msm-picker-first{background:var(--msm-highlight,#e5ece5)}:is(.msm-phone,.msm-select) .msm-picker-dialog li button[aria-current=true]{color:var(--msm-accent,#235b4b);font-weight:600}:is(.msm-phone,.msm-select) .msm-picker-dialog li button:focus-visible{outline-offset:-3px}:is(.msm-phone,.msm-select) .msm-picker-dialog .msm-picker-label{overflow-wrap:anywhere;flex:1;min-width:0}:is(.msm-phone,.msm-select) .msm-picker-dialog .msm-picker-hint{color:var(--msm-muted,#66736c);font-variant-numeric:tabular-nums;white-space:nowrap}:is(.msm-phone,.msm-select) .msm-picker-dialog .msm-picker-empty{color:var(--msm-muted,#66736c);margin:0;padding:16px 20px}.msm-select{grid-template-columns:minmax(0,1fr);gap:4px;min-width:0;display:grid}.msm-select button.msm-select-value{border:1px solid var(--msm-border,#c9d1c8);background:var(--msm-surface,#fff);min-height:48px;color:var(--msm-text,#202e2b);font:inherit;text-align:left;cursor:pointer;border-radius:6px;justify-self:stretch;align-items:center;gap:8px;padding:8px 12px;font-size:16px;font-weight:400;display:flex}.msm-select button.msm-select-value:after{content:"▾";color:var(--msm-muted,#66736c);margin-left:auto;font-size:12px}.msm-select .msm-select-text{overflow-wrap:anywhere;min-width:0}@media (width<=600px){:is(.msm-phone,.msm-select) .msm-picker-dialog{border-radius:0;width:100%;height:100%;margin:0}}.msm-customer{--cp-accent:var(--msm-customer-accent,#235b4b);--cp-accent-text:var(--msm-customer-accent-text,#fff);--cp-ink:var(--msm-customer-text,#202e2b);--cp-muted:var(--msm-customer-muted,#66736c);--cp-control-line:var(--msm-customer-border,#c9d1c8);--cp-line:var(--msm-customer-border,#dce2db);--cp-bg:var(--msm-customer-background,#f6f7f4);--cp-surface:var(--msm-customer-surface,#fff);--cp-radius:var(--msm-customer-radius,6px);--cp-card-radius:calc(var(--cp-radius) * 4 / 3);--msm-accent:var(--cp-accent);--msm-text:var(--cp-ink);--msm-muted:var(--cp-muted);--msm-border:var(--cp-control-line);--msm-divider:var(--cp-line);--msm-surface:var(--cp-surface);box-sizing:border-box;background:var(--cp-bg);color:var(--cp-ink);font-size:15px;line-height:1.6;font-family:var(--msm-customer-font,inherit)}.msm-customer *{box-sizing:border-box}.msm-customer .cp-status{place-items:center;margin:0;padding:24px;display:grid}.msm-customer button{min-height:44px;font:inherit;border-radius:var(--cp-radius);background:var(--cp-accent);color:var(--cp-accent-text);cursor:pointer;border:0;padding:10px 14px;font-weight:600}.msm-customer button:disabled{opacity:.55;cursor:default}.msm-customer button.cp-secondary{background:var(--cp-surface);color:var(--cp-ink);border:1px solid var(--cp-control-line)}.msm-customer button.cp-link{color:var(--cp-accent);background:0 0;padding:10px 0;text-decoration:underline}.msm-customer input{min-height:44px;font:inherit;border:1px solid var(--cp-control-line);border-radius:var(--cp-radius);background:var(--cp-surface);color:var(--cp-ink);width:100%;padding:10px 12px;font-size:16px;font-weight:400}.msm-customer input:focus,.msm-customer button:focus-visible{outline:2px solid var(--cp-accent);outline-offset:1px}.msm-customer label{gap:6px;font-size:13px;font-weight:600;display:grid}.msm-customer [role=alert]{color:#a3271f;margin:0}.cp-notice{border-radius:var(--cp-radius);color:var(--cp-ink);background:#eef3ee;margin:0;padding:10px 12px}.cp-brand{letter-spacing:-.5px;align-items:center;gap:10px;font-size:20px;font-weight:750;display:flex}.cp-brand img{max-width:120px;max-height:36px}.cp-sign-in{place-items:center;display:grid}.cp-sign-in form{background:var(--cp-surface);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);gap:14px;width:min(400px,100%);margin:16px 0;padding:32px 24px;display:grid}.cp-sign-in h1{margin:8px 0 0;font-size:22px;font-weight:600}.cp-sign-in p{color:var(--cp-muted);margin:0}.cp-shell{max-width:640px;padding:env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));margin:0 auto}.cp-header{justify-content:space-between;align-items:center;padding:12px 0;display:flex}.cp-nav{background:var(--cp-surface);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);grid-template-columns:repeat(4,1fr);gap:4px;padding:4px;display:grid}.msm-customer .cp-nav button{white-space:nowrap;color:var(--cp-ink);background:0 0;padding:6px 2px;line-height:1.2}.msm-customer .cp-nav button[aria-current=page]{background:var(--cp-accent);color:var(--cp-accent-text)}.cp-main{padding-top:8px}.cp-screen{gap:12px;display:grid}.cp-screen h1{margin:12px 0 0;font-size:22px;font-weight:600}.msm-customer fieldset{min-width:0;margin:0}.cp-tabs{border:0;gap:8px;padding:0;display:flex}.msm-customer .cp-tabs button{background:var(--cp-surface);color:var(--cp-ink);border:1px solid var(--cp-control-line);flex:1}.msm-customer .cp-tabs button[aria-pressed=true]{border-color:var(--cp-accent);box-shadow:inset 0 0 0 1px var(--cp-accent)}.cp-list{gap:12px;margin:0;padding:0;list-style:none;display:grid}.cp-card{background:var(--cp-surface);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);gap:6px;padding:16px;display:grid}.cp-card p{margin:0}.cp-card-head{justify-content:space-between;align-items:start;gap:8px;display:flex}.cp-card h2{margin:0;font-size:17px;font-weight:600}.cp-badge{color:var(--cp-muted);background:#eef0ec;border-radius:999px;flex:none;padding:2px 8px;font-size:12px;font-weight:600}.cp-hint,.cp-empty{color:var(--cp-muted);margin:0;font-size:14px}.cp-credits{font-weight:600}.cp-confirm{border-radius:var(--cp-radius);background:#faf6ec;border:1px solid #eadfbf;gap:8px;padding:12px;display:grid}.cp-confirm legend{float:left;width:100%;padding:0;font-weight:600}.cp-warning{color:#7a4b00}.cp-actions{grid-template-columns:1fr 1fr;gap:8px;display:grid}.cp-actions>:only-child{grid-column:1/-1}.cp-form{gap:12px}.cp-form dl{grid-template-columns:max-content 1fr;gap:4px 16px;margin:0;display:grid}.cp-form dt{font-size:13px;font-weight:600}.cp-form dd{overflow-wrap:anywhere;margin:0}.cp-error{gap:8px;display:grid}.cp-business{gap:10px}.msm-customer .cp-business button{justify-self:start}.msm-customer button.cp-back{justify-self:start;min-height:0;padding:4px 0}.cp-business-head p{margin:0}.cp-chips{border:0;flex-wrap:wrap;gap:8px;padding:0;display:flex}.msm-customer .cp-chips button{background:var(--cp-surface);min-height:36px;color:var(--cp-ink);border:1px solid var(--cp-control-line);border-radius:999px;padding:6px 12px;font-weight:500}.msm-customer .cp-chips button[aria-pressed=true]{background:var(--cp-accent);color:var(--cp-accent-text);border-color:var(--cp-accent)}.cp-type h2{margin:0;font-size:17px;font-weight:600}.cp-type p{margin:0}.cp-week{text-align:center;border:0;grid-template-columns:44px 1fr 44px;align-items:center;gap:8px;padding:0;font-weight:600;display:grid}.msm-customer .cp-week button{padding:0;font-size:20px}.cp-day{gap:8px;display:grid}.cp-day h2{color:var(--cp-muted);margin:8px 0 0;font-size:15px;font-weight:600}.cp-candidate{grid-template-columns:auto 1fr auto;align-items:center;gap:4px 14px}.cp-time{font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:650}.cp-candidate-body{min-width:0}.cp-candidate h3{margin:0;font-size:16px;font-weight:600}@media (width<=479px){.msm-customer .cp-nav button{font-size:14px}.cp-candidate{grid-template-columns:1fr auto}.cp-time{grid-column:1/-1}}.cp-summary{border-radius:var(--cp-radius);border:1px solid var(--cp-line);background:var(--cp-surface);gap:2px;padding:12px 14px;display:grid}.cp-summary h2{margin:0;font-size:17px;font-weight:600}.cp-summary p{color:var(--cp-ink);margin:0}.cp-summary p.cp-hint{color:var(--cp-muted)}@media (width<=359px){.msm-customer .cp-nav button{white-space:normal}}
|
|
1
|
+
.msm-phone{grid-template-columns:minmax(0,1fr);gap:4px;min-width:0;display:grid}.msm-phone .msm-phone-row{gap:8px;display:flex}.msm-phone .msm-phone-row button.msm-phone-country{border:1px solid var(--msm-border,#c9d1c8);background:var(--msm-surface,#fff);min-width:48px;min-height:48px;color:var(--msm-text,#202e2b);font:inherit;cursor:pointer;border-radius:6px;flex-shrink:0;align-items:center;gap:6px;padding:0 12px;font-size:16px;font-weight:400;display:flex}.msm-phone .msm-phone-row button.msm-phone-country:after{content:"▾";color:var(--msm-muted,#66736c);font-size:12px}.msm-phone .msm-phone-row input.msm-phone-number{border:1px solid var(--msm-border,#c9d1c8);background:var(--msm-surface,#fff);min-width:0;min-height:48px;color:var(--msm-text,#202e2b);font:inherit;border-radius:6px;flex:1;padding:0 12px;font-size:16px;font-weight:400}.msm-phone .msm-phone-row input.msm-phone-number[aria-invalid=true]{border-color:var(--msm-danger,#9b2c2c)}.msm-phone p.msm-phone-problem{color:var(--msm-danger,#9b2c2c);margin:0;font-size:14px;font-weight:400}:is(.msm-phone,.msm-select) .msm-picker-dialog{background:var(--msm-surface,#fff);width:min(440px,100vw - 32px);max-width:none;height:min(640px,100dvh - 64px);max-height:none;color:var(--msm-text,#202e2b);border:0;border-radius:12px;padding:0;font:16px/1.4 system-ui,sans-serif;box-shadow:0 16px 48px #202e2b40}:is(.msm-phone,.msm-select) .msm-picker-dialog[open]{flex-direction:column;display:flex}:is(.msm-phone,.msm-select) .msm-picker-dialog::backdrop{background:#202e2b73}:is(.msm-phone,.msm-select) .msm-picker-head{justify-content:space-between;align-items:center;padding:8px 8px 8px 20px;display:flex}:is(.msm-phone,.msm-select) .msm-picker-head h2{letter-spacing:0;margin:0;font-size:18px;font-weight:600}:is(.msm-phone,.msm-select) .msm-picker-head button{min-width:48px;min-height:48px;color:var(--msm-accent,#235b4b);font:inherit;cursor:pointer;background:0 0;border:0;padding:0 12px;font-weight:600}:is(.msm-phone,.msm-select) .msm-picker-dialog input.msm-picker-search{border:1px solid var(--msm-border,#c9d1c8);min-height:48px;color:var(--msm-text,#202e2b);font:inherit;border-radius:6px;margin:0 16px 8px;padding:0 12px}:is(.msm-phone,.msm-select) .msm-picker-dialog ul{overscroll-behavior:contain;border-top:1px solid var(--msm-divider,#dce2db);flex:1;margin:0;padding:0 0 8px;list-style:none;overflow-y:auto}:is(.msm-phone,.msm-select) .msm-picker-dialog li button{width:100%;min-height:48px;color:var(--msm-text,#202e2b);font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:0;align-items:center;gap:12px;padding:0 20px;display:flex}:is(.msm-phone,.msm-select) .msm-picker-dialog li button:hover,:is(.msm-phone,.msm-select) .msm-picker-dialog li button.msm-picker-first{background:var(--msm-highlight,#e5ece5)}:is(.msm-phone,.msm-select) .msm-picker-dialog li button[aria-current=true]{color:var(--msm-accent,#235b4b);font-weight:600}:is(.msm-phone,.msm-select) .msm-picker-dialog li button:focus-visible{outline-offset:-3px}:is(.msm-phone,.msm-select) .msm-picker-dialog .msm-picker-label{overflow-wrap:anywhere;flex:1;min-width:0}:is(.msm-phone,.msm-select) .msm-picker-dialog .msm-picker-hint{color:var(--msm-muted,#66736c);font-variant-numeric:tabular-nums;white-space:nowrap}:is(.msm-phone,.msm-select) .msm-picker-dialog .msm-picker-empty{color:var(--msm-muted,#66736c);margin:0;padding:16px 20px}.msm-select{grid-template-columns:minmax(0,1fr);gap:4px;min-width:0;display:grid}.msm-select button.msm-select-value{border:1px solid var(--msm-border,#c9d1c8);background:var(--msm-surface,#fff);min-height:48px;color:var(--msm-text,#202e2b);font:inherit;text-align:left;cursor:pointer;border-radius:6px;justify-self:stretch;align-items:center;gap:8px;padding:8px 12px;font-size:16px;font-weight:400;display:flex}.msm-select button.msm-select-value:after{content:"▾";color:var(--msm-muted,#66736c);margin-left:auto;font-size:12px}.msm-select .msm-select-text{overflow-wrap:anywhere;min-width:0}@media (width<=600px){:is(.msm-phone,.msm-select) .msm-picker-dialog{border-radius:0;width:100%;height:100%;margin:0}}.msm-customer{--cp-accent:var(--msm-customer-accent,#235b4b);--cp-accent-text:var(--msm-customer-accent-text,#fff);--cp-ink:var(--msm-customer-text,#202e2b);--cp-muted:var(--msm-customer-muted,#66736c);--cp-control-line:var(--msm-customer-border,#c9d1c8);--cp-line:var(--msm-customer-border,#dce2db);--cp-bg:var(--msm-customer-background,#f6f7f4);--cp-surface:var(--msm-customer-surface,#fff);--cp-radius:var(--msm-customer-radius,6px);--cp-card-radius:calc(var(--cp-radius) * 4 / 3);--msm-accent:var(--cp-accent);--msm-text:var(--cp-ink);--msm-muted:var(--cp-muted);--msm-border:var(--cp-control-line);--msm-divider:var(--cp-line);--msm-surface:var(--cp-surface);box-sizing:border-box;background:var(--cp-bg);color:var(--cp-ink);font-size:15px;line-height:1.6;font-family:var(--msm-customer-font,inherit)}.msm-customer *{box-sizing:border-box}.msm-customer .cp-status{place-items:center;margin:0;padding:24px;display:grid}.msm-customer button{min-height:44px;font:inherit;border-radius:var(--cp-radius);background:var(--cp-accent);color:var(--cp-accent-text);cursor:pointer;border:0;padding:10px 14px;font-weight:600}.msm-customer button:disabled{opacity:.55;cursor:default}.msm-customer button.cp-secondary{background:var(--cp-surface);color:var(--cp-ink);border:1px solid var(--cp-control-line)}.msm-customer button.cp-link{color:var(--cp-accent);background:0 0;padding:10px 0;text-decoration:underline}.msm-customer input{min-height:44px;font:inherit;border:1px solid var(--cp-control-line);border-radius:var(--cp-radius);background:var(--cp-surface);color:var(--cp-ink);width:100%;padding:10px 12px;font-size:16px;font-weight:400}.msm-customer input:focus,.msm-customer button:focus-visible{outline:2px solid var(--cp-accent);outline-offset:1px}.msm-customer label{gap:6px;font-size:13px;font-weight:600;display:grid}.msm-customer [role=alert]{color:#a3271f;margin:0}.cp-notice{border-radius:var(--cp-radius);color:var(--cp-ink);background:#eef3ee;margin:0;padding:10px 12px}.cp-brand{letter-spacing:-.5px;align-items:center;gap:10px;font-size:20px;font-weight:750;display:flex}.cp-brand img{max-width:120px;max-height:36px}.cp-sign-in{place-items:center;display:grid}.cp-sign-in form{background:var(--cp-surface);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);gap:14px;width:min(400px,100%);margin:16px 0;padding:32px 24px;display:grid}.cp-sign-in h1{margin:8px 0 0;font-size:22px;font-weight:600}.cp-sign-in p{color:var(--cp-muted);margin:0}.cp-shell{max-width:640px;padding:env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));margin:0 auto}.cp-header{justify-content:space-between;align-items:center;padding:12px 0;display:flex}.cp-nav{background:var(--cp-surface);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);grid-auto-columns:1fr;grid-auto-flow:column;gap:4px;padding:4px;display:grid}.msm-customer .cp-nav button{white-space:nowrap;color:var(--cp-ink);background:0 0;padding:6px 2px;line-height:1.2}.msm-customer .cp-nav button[aria-current=page]{background:var(--cp-accent);color:var(--cp-accent-text)}.cp-main{padding-top:8px}.cp-screen{gap:12px;display:grid}.cp-screen h1{margin:12px 0 0;font-size:22px;font-weight:600}.msm-customer fieldset{min-width:0;margin:0}.cp-tabs{border:0;gap:8px;padding:0;display:flex}.msm-customer .cp-tabs button{background:var(--cp-surface);color:var(--cp-ink);border:1px solid var(--cp-control-line);flex:1}.msm-customer .cp-tabs button[aria-pressed=true]{border-color:var(--cp-accent);box-shadow:inset 0 0 0 1px var(--cp-accent)}.cp-list{gap:12px;margin:0;padding:0;list-style:none;display:grid}.cp-card{background:var(--cp-surface);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);gap:6px;padding:16px;display:grid}.cp-card p{margin:0}.cp-card-head{justify-content:space-between;align-items:start;gap:8px;display:flex}.cp-card h2{margin:0;font-size:17px;font-weight:600}.cp-badge{color:var(--cp-muted);background:#eef0ec;border-radius:999px;flex:none;padding:2px 8px;font-size:12px;font-weight:600}.cp-hint,.cp-empty{color:var(--cp-muted);margin:0;font-size:14px}.cp-credits{font-weight:600}.cp-confirm{border-radius:var(--cp-radius);background:#faf6ec;border:1px solid #eadfbf;gap:8px;padding:12px;display:grid}.cp-confirm legend{float:left;width:100%;padding:0;font-weight:600}.cp-warning{color:#7a4b00}.cp-actions{grid-template-columns:1fr 1fr;gap:8px;display:grid}.cp-actions>:only-child{grid-column:1/-1}.cp-form{gap:12px}.cp-form dl{grid-template-columns:max-content 1fr;gap:4px 16px;margin:0;display:grid}.cp-form dt{font-size:13px;font-weight:600}.cp-form dd{overflow-wrap:anywhere;margin:0}.cp-error{gap:8px;display:grid}.cp-business{gap:10px}.msm-customer .cp-business button{justify-self:start}.msm-customer button.cp-back{justify-self:start;min-height:0;padding:4px 0}.cp-business-head{align-items:center;gap:14px;display:flex}.cp-business-head>div{min-width:0}.cp-business-head p{margin:0}.cp-logo{object-fit:contain;object-position:left center;flex:none;width:auto;max-width:40%;height:48px}.cp-card .cp-logo{justify-self:start;max-width:100%;height:40px}.cp-detail-image{object-fit:cover;border-radius:var(--cp-card-radius);width:100%;height:auto;max-height:320px;margin-bottom:10px;display:block}.cp-thumb{object-fit:cover;border-radius:var(--cp-radius);width:72px;height:72px}.cp-chips{border:0;flex-wrap:wrap;gap:8px;padding:0;display:flex}.cp-chips legend{color:var(--cp-muted);margin-bottom:6px;padding:0;font-size:14px}.msm-customer .cp-chips button{background:var(--cp-surface);min-height:36px;color:var(--cp-ink);border:1px solid var(--cp-control-line);border-radius:999px;padding:6px 12px;font-weight:500}.msm-customer .cp-chips button[aria-pressed=true]{background:var(--cp-accent);color:var(--cp-accent-text);border-color:var(--cp-accent)}.cp-type h2{margin:0;font-size:17px;font-weight:600}.cp-type p{margin:0}.cp-week{text-align:center;border:0;grid-template-columns:44px 1fr 44px;align-items:center;gap:8px;padding:0;font-weight:600;display:grid}.msm-customer .cp-week button{padding:0;font-size:20px}.cp-day{gap:8px;display:grid}.cp-day h2{color:var(--cp-muted);margin:8px 0 0;font-size:15px;font-weight:600}.cp-candidate{grid-template-columns:auto 1fr auto;align-items:center;gap:4px 14px}.cp-time{font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:650}.cp-candidate-body{min-width:0}.cp-candidate h3{margin:0;font-size:16px;font-weight:600}@media (width<=479px){.msm-customer .cp-nav button{font-size:14px}.cp-candidate{grid-template-columns:1fr auto}.cp-time{grid-column:1/-1}}.cp-summary{border-radius:var(--cp-radius);border:1px solid var(--cp-line);background:var(--cp-surface);gap:2px;padding:12px 14px;display:grid}.cp-summary h2{margin:0;font-size:17px;font-weight:600}.cp-summary p{color:var(--cp-ink);margin:0}.cp-summary p.cp-hint{color:var(--cp-muted)}@media (width<=359px){.msm-customer .cp-nav button{white-space:normal}}.cp-flow-head{justify-content:flex-end;padding-top:12px;display:flex}.msm-customer button.cp-option{text-align:left;background:var(--cp-surface);width:100%;color:var(--cp-ink);border:1px solid var(--cp-line);border-radius:var(--cp-card-radius);gap:4px;padding:14px 16px;display:grid}.msm-customer button.cp-option:hover{border-color:var(--cp-accent)}.cp-option:has(>.cp-thumb){grid-template-columns:72px 1fr;column-gap:14px}.cp-option>.cp-thumb{grid-area:1/1/span 3}.cp-option:has(>.cp-thumb)>:not(.cp-thumb){grid-column:2}.cp-option strong{font-weight:600}.cp-option span{color:var(--cp-muted);font-weight:400}
|
|
2
2
|
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msm-platform/customer-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MSM's customer screens for React, and their server half for a partner's server",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@msm-platform/customer-sdk": "^0.
|
|
34
|
+
"@msm-platform/customer-sdk": "^0.3.0",
|
|
35
35
|
"libphonenumber-js": "^1.13.15"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|