@msm-platform/customer-react 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +51 -27
- package/dist/account.d.ts +28 -0
- package/dist/booking-flow.d.ts +61 -0
- package/dist/booking.d.ts +5 -1
- package/dist/client.d.ts +2 -0
- package/dist/context.d.ts +5 -0
- package/dist/i18n.d.ts +13 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1119 -619
- package/dist/layout.d.ts +8 -0
- package/dist/portal.d.ts +26 -0
- package/dist/screens/business.d.ts +71 -2
- package/dist/server/index.d.ts +8 -29
- package/dist/server.js +125 -252
- package/dist/session.d.ts +10 -0
- package/dist/sign-in-standalone.d.ts +26 -0
- package/dist/sign-in.d.ts +4 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/server/limits.d.ts +0 -44
- package/dist/server/turnstile.d.ts +0 -22
package/dist/server.js
CHANGED
|
@@ -1,138 +1,64 @@
|
|
|
1
1
|
import { CustomerApiError as e, createCustomerClient as t } from "@msm-platform/customer-sdk";
|
|
2
|
-
// src/server/limits.ts
|
|
3
|
-
var n = "\nlocal count = redis.call('INCR', KEYS[1])\nif count == 1 then redis.call('PEXPIRE', KEYS[1], ARGV[1]) end\nlocal ttl = redis.call('PTTL', KEYS[1])\nif ttl < 0 then\n redis.call('PEXPIRE', KEYS[1], ARGV[1])\n ttl = tonumber(ARGV[1])\nend\nreturn {count, ttl}\n";
|
|
4
|
-
function r(e) {
|
|
5
|
-
return { async hit(t, r) {
|
|
6
|
-
let i = await e.eval(n, {
|
|
7
|
-
keys: [t],
|
|
8
|
-
arguments: [String(Math.max(1, Math.ceil(r)))]
|
|
9
|
-
});
|
|
10
|
-
if (!Array.isArray(i) || i.length !== 2) throw Error("Unexpected limiter reply from Redis.");
|
|
11
|
-
return {
|
|
12
|
-
count: Number(i[0]),
|
|
13
|
-
resetMs: Number(i[1])
|
|
14
|
-
};
|
|
15
|
-
} };
|
|
16
|
-
}
|
|
17
|
-
function i() {
|
|
18
|
-
let e = /* @__PURE__ */ new Map();
|
|
19
|
-
return { async hit(t, n) {
|
|
20
|
-
let r = Date.now();
|
|
21
|
-
if (e.size > 1e4) for (let [t, n] of e) n.resetAt <= r && e.delete(t);
|
|
22
|
-
let i = e.get(t);
|
|
23
|
-
return (!i || i.resetAt <= r) && (i = {
|
|
24
|
-
count: 0,
|
|
25
|
-
resetAt: r + n
|
|
26
|
-
}, e.set(t, i)), i.count++, {
|
|
27
|
-
count: i.count,
|
|
28
|
-
resetMs: i.resetAt - r
|
|
29
|
-
};
|
|
30
|
-
} };
|
|
31
|
-
}
|
|
32
|
-
function a(e) {
|
|
33
|
-
let t = e.trim().replace(/[ ()-]/g, "");
|
|
34
|
-
return /^\+[1-9]\d{6,14}$/.test(t) ? t : null;
|
|
35
|
-
}
|
|
36
|
-
function o(e) {
|
|
37
|
-
let t = e.trim().replace(/^\[|\]$/g, "").replace(/%.*$/, "");
|
|
38
|
-
if (s(t)) return t;
|
|
39
|
-
let n = c(t);
|
|
40
|
-
if (!n) return null;
|
|
41
|
-
if (n.slice(0, 5).every((e) => e === 0) && n[5] === 65535) {
|
|
42
|
-
let e = n[6] ?? 0, t = n[7] ?? 0;
|
|
43
|
-
return [
|
|
44
|
-
e >> 8,
|
|
45
|
-
e & 255,
|
|
46
|
-
t >> 8,
|
|
47
|
-
t & 255
|
|
48
|
-
].join(".");
|
|
49
|
-
}
|
|
50
|
-
return `${n.slice(0, 4).map((e) => e.toString(16)).join(":")}::/64`;
|
|
51
|
-
}
|
|
52
|
-
function s(e) {
|
|
53
|
-
let t = e.split(".");
|
|
54
|
-
return t.length === 4 && t.every((e) => /^\d{1,3}$/.test(e) && Number(e) <= 255);
|
|
55
|
-
}
|
|
56
|
-
function c(e) {
|
|
57
|
-
if (!e.includes(":")) return null;
|
|
58
|
-
let t = e, n = /^(.*:)(\d+\.\d+\.\d+\.\d+)$/.exec(t);
|
|
59
|
-
if (n) {
|
|
60
|
-
let [, e = "", r = ""] = n;
|
|
61
|
-
if (!s(r)) return null;
|
|
62
|
-
let [i = 0, a = 0, o = 0, c = 0] = r.split(".").map(Number);
|
|
63
|
-
t = `${e}${(i << 8 | a).toString(16)}:${(o << 8 | c).toString(16)}`;
|
|
64
|
-
}
|
|
65
|
-
let r = t.split("::");
|
|
66
|
-
if (r.length > 2) return null;
|
|
67
|
-
let i = (e) => e ? e.split(":") : [], a = i(r[0]), o = i(r[1]), c = 8 - a.length - o.length;
|
|
68
|
-
if (r.length === 1 ? c !== 0 : c < 1) return null;
|
|
69
|
-
let l = [
|
|
70
|
-
...a,
|
|
71
|
-
...Array(r.length === 2 ? c : 0).fill("0"),
|
|
72
|
-
...o
|
|
73
|
-
];
|
|
74
|
-
return l.every((e) => /^[0-9a-f]{1,4}$/i.test(e)) ? l.map((e) => Number.parseInt(e, 16)) : null;
|
|
75
|
-
}
|
|
76
2
|
// src/server/session.ts
|
|
77
|
-
var
|
|
78
|
-
function
|
|
3
|
+
var n = "__Host-msm_customer_session", r = new TextEncoder(), i = 12;
|
|
4
|
+
function a(e) {
|
|
79
5
|
let t = (typeof e == "string" ? [e] : [...e]).map((e) => e.trim());
|
|
80
6
|
if (t.length === 0) throw Error("customer-react/server: sessionKeys needs at least one key.");
|
|
81
|
-
for (let e of t) if (
|
|
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`.");
|
|
82
8
|
return t;
|
|
83
9
|
}
|
|
84
|
-
function
|
|
85
|
-
let t,
|
|
86
|
-
let t = await crypto.subtle.importKey("raw",
|
|
10
|
+
function o(e) {
|
|
11
|
+
let t, a = () => t ??= Promise.all(e.map(async (e) => {
|
|
12
|
+
let t = await crypto.subtle.importKey("raw", r.encode(e), "HKDF", !1, ["deriveKey"]);
|
|
87
13
|
return crypto.subtle.deriveKey({
|
|
88
14
|
name: "HKDF",
|
|
89
15
|
hash: "SHA-256",
|
|
90
16
|
salt: /* @__PURE__ */ new Uint8Array(),
|
|
91
|
-
info:
|
|
17
|
+
info: r.encode("msm customer session v1")
|
|
92
18
|
}, t, {
|
|
93
19
|
name: "AES-GCM",
|
|
94
20
|
length: 256
|
|
95
21
|
}, !1, ["encrypt", "decrypt"]);
|
|
96
|
-
})),
|
|
22
|
+
})), o = r.encode(n);
|
|
97
23
|
return {
|
|
98
24
|
async seal(e) {
|
|
99
|
-
let [t] = await
|
|
25
|
+
let [t] = await a(), n = crypto.getRandomValues(new Uint8Array(i)), s = await crypto.subtle.encrypt({
|
|
100
26
|
name: "AES-GCM",
|
|
101
|
-
iv:
|
|
102
|
-
additionalData:
|
|
103
|
-
}, t,
|
|
27
|
+
iv: n,
|
|
28
|
+
additionalData: o
|
|
29
|
+
}, t, r.encode(JSON.stringify({
|
|
104
30
|
sessionId: e.sessionId,
|
|
105
31
|
sessionToken: e.sessionToken,
|
|
106
32
|
expiresAt: e.expiresAt
|
|
107
|
-
}))),
|
|
108
|
-
return
|
|
33
|
+
}))), c = new Uint8Array(i + s.byteLength);
|
|
34
|
+
return c.set(n), c.set(new Uint8Array(s), i), l(c);
|
|
109
35
|
},
|
|
110
36
|
async open(e) {
|
|
111
|
-
let t = e ?
|
|
112
|
-
if (!t || t.length <=
|
|
113
|
-
let
|
|
114
|
-
for (let e of await
|
|
37
|
+
let t = e ? u(e) : null;
|
|
38
|
+
if (!t || t.length <= i) return null;
|
|
39
|
+
let n = t.subarray(0, i), r = t.subarray(i);
|
|
40
|
+
for (let e of await a()) {
|
|
115
41
|
let t;
|
|
116
42
|
try {
|
|
117
43
|
t = await crypto.subtle.decrypt({
|
|
118
44
|
name: "AES-GCM",
|
|
119
|
-
iv:
|
|
120
|
-
additionalData:
|
|
121
|
-
}, e,
|
|
45
|
+
iv: n,
|
|
46
|
+
additionalData: o
|
|
47
|
+
}, e, r);
|
|
122
48
|
} catch {
|
|
123
49
|
continue;
|
|
124
50
|
}
|
|
125
|
-
let
|
|
126
|
-
return
|
|
51
|
+
let i = c(new TextDecoder().decode(t));
|
|
52
|
+
return i && Date.parse(i.expiresAt) > Date.now() ? i : null;
|
|
127
53
|
}
|
|
128
54
|
return null;
|
|
129
55
|
}
|
|
130
56
|
};
|
|
131
57
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
58
|
+
function s(e, t) {
|
|
59
|
+
return o(a(t.sessionKeys)).open(e);
|
|
134
60
|
}
|
|
135
|
-
function
|
|
61
|
+
function c(e) {
|
|
136
62
|
try {
|
|
137
63
|
let t = JSON.parse(e);
|
|
138
64
|
if (typeof t.sessionId == "string" && typeof t.sessionToken == "string" && typeof t.expiresAt == "string") return {
|
|
@@ -143,12 +69,12 @@ function h(e) {
|
|
|
143
69
|
} catch {}
|
|
144
70
|
return null;
|
|
145
71
|
}
|
|
146
|
-
function
|
|
72
|
+
function l(e) {
|
|
147
73
|
let t = "";
|
|
148
74
|
for (let n of e) t += String.fromCharCode(n);
|
|
149
75
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
150
76
|
}
|
|
151
|
-
function
|
|
77
|
+
function u(e) {
|
|
152
78
|
if (!/^[A-Za-z0-9_-]+$/.test(e)) return null;
|
|
153
79
|
try {
|
|
154
80
|
let t = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
|
|
@@ -157,47 +83,19 @@ function _(e) {
|
|
|
157
83
|
return null;
|
|
158
84
|
}
|
|
159
85
|
}
|
|
160
|
-
// src/server/turnstile.ts
|
|
161
|
-
var v = "https://challenges.cloudflare.com/turnstile/v0/siteverify";
|
|
162
|
-
function y(e) {
|
|
163
|
-
if (!e.secretKey?.trim()) throw Error("customer-react/server: turnstile needs its secretKey.");
|
|
164
|
-
let t = e.fetch ?? globalThis.fetch;
|
|
165
|
-
return async (n, { ip: r }) => {
|
|
166
|
-
let i = new URLSearchParams({
|
|
167
|
-
secret: e.secretKey,
|
|
168
|
-
response: n,
|
|
169
|
-
remoteip: r
|
|
170
|
-
}), a = await t(v, {
|
|
171
|
-
method: "POST",
|
|
172
|
-
body: i,
|
|
173
|
-
signal: AbortSignal.timeout(e.timeoutMs ?? 5e3)
|
|
174
|
-
});
|
|
175
|
-
if (!a.ok) throw Error(`Turnstile siteverify answered ${a.status}.`);
|
|
176
|
-
return (await a.json()).success === !0;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
86
|
// src/server/index.ts
|
|
180
|
-
var
|
|
181
|
-
phone: {
|
|
182
|
-
max: 5,
|
|
183
|
-
windowMs: 9e5
|
|
184
|
-
},
|
|
185
|
-
ip: {
|
|
186
|
-
max: 5,
|
|
187
|
-
windowMs: 6e5
|
|
188
|
-
}
|
|
189
|
-
}, x = 1e3, S = 1e4, C = 3e4, w = 1048576, T = /* @__PURE__ */ new Set([
|
|
87
|
+
var d = 1e4, f = 3e4, p = 1048576, m = /* @__PURE__ */ new Set([
|
|
190
88
|
"GET",
|
|
191
89
|
"HEAD",
|
|
192
90
|
"POST",
|
|
193
91
|
"PUT",
|
|
194
92
|
"PATCH",
|
|
195
93
|
"DELETE"
|
|
196
|
-
]),
|
|
94
|
+
]), h = [
|
|
197
95
|
"accept",
|
|
198
96
|
"content-type",
|
|
199
97
|
"accept-language"
|
|
200
|
-
],
|
|
98
|
+
], g = "Path=/; HttpOnly; Secure; SameSite=Lax", _ = class extends Error {
|
|
201
99
|
status;
|
|
202
100
|
code;
|
|
203
101
|
retryAfterSeconds;
|
|
@@ -205,180 +103,159 @@ var b = {
|
|
|
205
103
|
super(n), this.status = e, this.code = t, this.retryAfterSeconds = r;
|
|
206
104
|
}
|
|
207
105
|
};
|
|
208
|
-
function
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
if (
|
|
212
|
-
let r =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
clientId: n.clientId,
|
|
220
|
-
clientSecret: n.clientSecret,
|
|
221
|
-
...n.fetch && { fetch: n.fetch }
|
|
222
|
-
}), h = () => AbortSignal.timeout(S), g = `${l}=; ${D}; Max-Age=0`;
|
|
223
|
-
async function _(e) {
|
|
106
|
+
function v(r) {
|
|
107
|
+
if (typeof r.clientIp != "function") throw Error("customer-react/server: clientIp is required.");
|
|
108
|
+
let i = r.basePath.replace(/\/$/, "");
|
|
109
|
+
if (!i.startsWith("/") || i.startsWith("//")) throw Error("customer-react/server: basePath must be a path, such as /msm.");
|
|
110
|
+
let s = o(a(r.sessionKeys)), c = t({
|
|
111
|
+
baseUrl: r.engineUrl,
|
|
112
|
+
clientId: r.clientId,
|
|
113
|
+
clientSecret: r.clientSecret,
|
|
114
|
+
...r.fetch && { fetch: r.fetch }
|
|
115
|
+
}), l = () => AbortSignal.timeout(d), u = `${n}=; ${g}; Max-Age=0`;
|
|
116
|
+
async function p(e) {
|
|
224
117
|
let t = new URL(e.url);
|
|
225
|
-
if (t.pathname !==
|
|
226
|
-
let
|
|
227
|
-
if (e.headers.get("x-msm-bff") !== "1") throw new
|
|
228
|
-
let a = await
|
|
229
|
-
if (
|
|
230
|
-
let o = `${e.method} ${
|
|
118
|
+
if (t.pathname !== i && !t.pathname.startsWith(`${i}/`)) throw new _(404, "NotFound", "Not found.");
|
|
119
|
+
let r = t.pathname.slice(i.length);
|
|
120
|
+
if (e.headers.get("x-msm-bff") !== "1") throw new _(403, "BffHeaderRequired", "Missing X-MSM-BFF header.");
|
|
121
|
+
let a = await s.open(S(e));
|
|
122
|
+
if (r.startsWith("/engine/")) return w(e, t, r, a);
|
|
123
|
+
let o = `${e.method} ${r}`;
|
|
231
124
|
if (o === "POST /auth/initiate") {
|
|
232
|
-
let t = await
|
|
233
|
-
return
|
|
234
|
-
body: {
|
|
235
|
-
|
|
236
|
-
|
|
125
|
+
let t = await T(e, ["phone", "botCheckToken"]), n = await v(e, t);
|
|
126
|
+
return x(200, await c.POST("/web/identity/initiateLogin", {
|
|
127
|
+
body: {
|
|
128
|
+
phone: t.phone,
|
|
129
|
+
...n
|
|
130
|
+
},
|
|
131
|
+
signal: l()
|
|
132
|
+
}).then(b));
|
|
237
133
|
}
|
|
238
134
|
if (o === "POST /auth/register/initiate") {
|
|
239
|
-
let t = await
|
|
240
|
-
|
|
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", {
|
|
241
141
|
body: {
|
|
242
|
-
phone:
|
|
243
|
-
name: t.name
|
|
142
|
+
phone: t.phone,
|
|
143
|
+
name: t.name,
|
|
144
|
+
...n
|
|
244
145
|
},
|
|
245
|
-
signal:
|
|
246
|
-
}).then(
|
|
146
|
+
signal: l()
|
|
147
|
+
}).then(b));
|
|
247
148
|
}
|
|
248
149
|
if (o === "POST /auth/login" || o === "POST /auth/register") {
|
|
249
|
-
let { challenge: t, code:
|
|
150
|
+
let { challenge: t, code: i } = await T(e, ["challenge", "code"]), o = await c.POST(r === "/auth/login" ? "/web/identity/customerLogin" : "/web/identity/registerCustomer", {
|
|
250
151
|
body: {
|
|
251
152
|
challenge: t,
|
|
252
|
-
code:
|
|
153
|
+
code: i
|
|
253
154
|
},
|
|
254
|
-
signal:
|
|
255
|
-
}).then(
|
|
256
|
-
a && await
|
|
257
|
-
let
|
|
258
|
-
return
|
|
155
|
+
signal: l()
|
|
156
|
+
}).then(b);
|
|
157
|
+
a && await E(a);
|
|
158
|
+
let u = Math.floor((Date.parse(o.expiresAt) - Date.now()) / 1e3), d = await s.seal(o);
|
|
159
|
+
return x(200, { sessionKey: o.sessionId }, { "set-cookie": `${n}=${d}; ${g}; Max-Age=${Math.max(0, u)}` });
|
|
259
160
|
}
|
|
260
|
-
if (o === "GET /auth/session") return a ?
|
|
261
|
-
if (o === "POST /auth/logout") return a && await
|
|
161
|
+
if (o === "GET /auth/session") return a ? x(200, { sessionKey: a.sessionId }) : D();
|
|
162
|
+
if (o === "POST /auth/logout") return a && await E(a), new Response(null, {
|
|
262
163
|
status: 204,
|
|
263
164
|
headers: {
|
|
264
|
-
"set-cookie":
|
|
165
|
+
"set-cookie": u,
|
|
265
166
|
"cache-control": "no-store"
|
|
266
167
|
}
|
|
267
168
|
});
|
|
268
|
-
throw new
|
|
169
|
+
throw new _(404, "NotFound", "Not found.");
|
|
269
170
|
}
|
|
270
171
|
async function v(e, t) {
|
|
271
|
-
let
|
|
272
|
-
if (!r) throw new O(400, "InvalidRequest", "Expected a phone number with its country code, such as +3545551234.");
|
|
273
|
-
let i;
|
|
274
|
-
try {
|
|
275
|
-
let t = await n.clientIp(e);
|
|
276
|
-
i = t ? o(t) : null;
|
|
277
|
-
} catch {
|
|
278
|
-
i = null;
|
|
279
|
-
}
|
|
280
|
-
if (!i) throw new O(503, "ClientIpUnavailable", "The client's address is unknown.");
|
|
281
|
-
let s = t.botCheckToken;
|
|
282
|
-
if (typeof s != "string" || !s) throw new O(403, "BotCheckFailed", "The bot check did not pass.");
|
|
283
|
-
let l;
|
|
172
|
+
let n;
|
|
284
173
|
try {
|
|
285
|
-
|
|
286
|
-
ip: i,
|
|
287
|
-
request: e
|
|
288
|
-
});
|
|
289
|
-
} catch {
|
|
290
|
-
throw new O(503, "BotCheckUnavailable", "The bot check is unavailable. Try again shortly.");
|
|
291
|
-
}
|
|
292
|
-
if (!l) throw new O(403, "BotCheckFailed", "The bot check did not pass.");
|
|
293
|
-
return await y(`ip:${await L(i)}`, u.ip), await y(`phone:${await L(r)}`, u.phone), r;
|
|
294
|
-
}
|
|
295
|
-
async function y(e, { max: t, windowMs: n }) {
|
|
296
|
-
let r, i;
|
|
297
|
-
try {
|
|
298
|
-
if (i = await Promise.race([s.hit(`${d}${e}`, n), new Promise((e, t) => {
|
|
299
|
-
r = setTimeout(() => t(/* @__PURE__ */ Error("Limiter timed out.")), x);
|
|
300
|
-
})]), !Number.isFinite(i?.count)) throw Error("Bad limiter reply.");
|
|
174
|
+
n = await r.clientIp(e);
|
|
301
175
|
} catch {
|
|
302
|
-
|
|
303
|
-
} finally {
|
|
304
|
-
clearTimeout(r);
|
|
176
|
+
n = null;
|
|
305
177
|
}
|
|
306
|
-
|
|
178
|
+
let i = n?.trim().replace(/^\[|\]$/g, "").replace(/%.*$/, "");
|
|
179
|
+
if (!i) throw new _(503, "ClientIpUnavailable", "The client's address is unknown.");
|
|
180
|
+
return {
|
|
181
|
+
botCheckToken: t.botCheckToken,
|
|
182
|
+
clientIp: i
|
|
183
|
+
};
|
|
307
184
|
}
|
|
308
185
|
async function w(t, n, r, i) {
|
|
309
186
|
let a = r.slice(7);
|
|
310
|
-
if (!
|
|
187
|
+
if (!y(a) || !m.has(t.method)) throw new _(404, "NotFound", "Not found.");
|
|
311
188
|
let o = new Headers();
|
|
312
|
-
for (let e of
|
|
189
|
+
for (let e of h) {
|
|
313
190
|
let n = t.headers.get(e);
|
|
314
191
|
n && o.set(e, n);
|
|
315
192
|
}
|
|
316
193
|
i && o.set("x-session-token", i.sessionToken);
|
|
317
|
-
let s = t.method !== "GET" && t.method !== "HEAD" ? await
|
|
194
|
+
let s = t.method !== "GET" && t.method !== "HEAD" ? await C(t) : void 0, l;
|
|
318
195
|
try {
|
|
319
|
-
|
|
196
|
+
l = (await c.request(t.method.toLowerCase(), `${a}${n.search}`, {
|
|
320
197
|
headers: o,
|
|
321
198
|
...s && s.byteLength > 0 && { body: s },
|
|
322
199
|
bodySerializer: (e) => e,
|
|
323
200
|
parseAs: "stream",
|
|
324
201
|
redirect: "manual",
|
|
325
|
-
signal: AbortSignal.timeout(
|
|
202
|
+
signal: AbortSignal.timeout(f)
|
|
326
203
|
})).response;
|
|
327
204
|
} catch (t) {
|
|
328
205
|
if (!(t instanceof e)) throw t;
|
|
329
|
-
|
|
206
|
+
l = t.response;
|
|
330
207
|
}
|
|
331
|
-
let
|
|
208
|
+
let d = l.status === 401 || l.ok && t.method === "DELETE" && a === "/web/me/sessions" && i !== null, p = new Headers({ "cache-control": "no-store" });
|
|
332
209
|
for (let e of ["content-type", "retry-after"]) {
|
|
333
|
-
let t =
|
|
334
|
-
t &&
|
|
210
|
+
let t = l.headers.get(e);
|
|
211
|
+
t && p.set(e, t);
|
|
335
212
|
}
|
|
336
|
-
|
|
337
|
-
let
|
|
213
|
+
d && p.set("set-cookie", u);
|
|
214
|
+
let g = t.method === "HEAD" || [
|
|
338
215
|
204,
|
|
339
216
|
205,
|
|
340
217
|
304
|
|
341
|
-
].includes(
|
|
342
|
-
return new Response(
|
|
343
|
-
status:
|
|
344
|
-
headers:
|
|
218
|
+
].includes(l.status);
|
|
219
|
+
return new Response(g ? null : await l.arrayBuffer(), {
|
|
220
|
+
status: l.status,
|
|
221
|
+
headers: p
|
|
345
222
|
});
|
|
346
223
|
}
|
|
347
|
-
async function
|
|
348
|
-
await
|
|
224
|
+
async function E(e) {
|
|
225
|
+
await c.POST("/web/identity/logout", {
|
|
349
226
|
body: { sessionToken: e.sessionToken },
|
|
350
|
-
signal:
|
|
227
|
+
signal: l()
|
|
351
228
|
}).catch(() => {});
|
|
352
229
|
}
|
|
353
|
-
function
|
|
354
|
-
return
|
|
230
|
+
function D() {
|
|
231
|
+
return x(401, {
|
|
355
232
|
code: "NotAuthenticated",
|
|
356
233
|
message: "Sign in again."
|
|
357
|
-
}, { "set-cookie":
|
|
234
|
+
}, { "set-cookie": u });
|
|
358
235
|
}
|
|
359
236
|
return async function(t) {
|
|
360
237
|
try {
|
|
361
|
-
return await
|
|
238
|
+
return await p(t);
|
|
362
239
|
} catch (t) {
|
|
363
|
-
if (t instanceof
|
|
240
|
+
if (t instanceof _) return x(t.status, {
|
|
364
241
|
code: t.code,
|
|
365
242
|
message: t.message
|
|
366
243
|
}, t.retryAfterSeconds ? { "retry-after": String(t.retryAfterSeconds) } : {});
|
|
367
244
|
if (t instanceof e && (t.status >= 400 && t.status < 500 || t.status === 503 && t.code)) {
|
|
368
245
|
let e = t.response.headers.get("retry-after");
|
|
369
|
-
return
|
|
246
|
+
return x(t.status, {
|
|
370
247
|
code: t.code ?? "EngineRejected",
|
|
371
248
|
message: t.message
|
|
372
249
|
}, e ? { "retry-after": e } : {});
|
|
373
250
|
}
|
|
374
|
-
return
|
|
251
|
+
return x(502, {
|
|
375
252
|
code: "EngineUnavailable",
|
|
376
253
|
message: "The engine could not complete the request."
|
|
377
254
|
});
|
|
378
255
|
}
|
|
379
256
|
};
|
|
380
257
|
}
|
|
381
|
-
function
|
|
258
|
+
function y(e) {
|
|
382
259
|
if (/%2f|%5c|\/\//i.test(e)) return !1;
|
|
383
260
|
let t;
|
|
384
261
|
try {
|
|
@@ -388,11 +265,11 @@ function A(e) {
|
|
|
388
265
|
}
|
|
389
266
|
return !/(^|\/)\.\.?(\/|$)|\\/.test(t) && /^\/web\//.test(t) && !/^\/web\/identity(\/|$)/i.test(t);
|
|
390
267
|
}
|
|
391
|
-
var
|
|
268
|
+
var b = ({ data: e }) => {
|
|
392
269
|
if (e === void 0) throw Error("Engine returned no body.");
|
|
393
270
|
return e;
|
|
394
271
|
};
|
|
395
|
-
function
|
|
272
|
+
function x(e, t, n = {}) {
|
|
396
273
|
return new Response(JSON.stringify(t), {
|
|
397
274
|
status: e,
|
|
398
275
|
headers: {
|
|
@@ -402,41 +279,37 @@ function M(e, t, n = {}) {
|
|
|
402
279
|
}
|
|
403
280
|
});
|
|
404
281
|
}
|
|
405
|
-
function
|
|
282
|
+
function S(e) {
|
|
406
283
|
for (let t of e.headers.get("cookie")?.split(";") ?? []) {
|
|
407
284
|
let e = t.indexOf("=");
|
|
408
285
|
if (e > 0 && t.slice(0, e).trim() === "__Host-msm_customer_session") return t.slice(e + 1).trim() || void 0;
|
|
409
286
|
}
|
|
410
287
|
}
|
|
411
|
-
async function
|
|
412
|
-
if (Number(e.headers.get("content-length")) >
|
|
288
|
+
async function C(e) {
|
|
289
|
+
if (Number(e.headers.get("content-length")) > p) throw w();
|
|
413
290
|
if (!e.body) return /* @__PURE__ */ new Uint8Array();
|
|
414
291
|
let t = e.body.getReader(), n = [], r = 0;
|
|
415
292
|
for (;;) {
|
|
416
293
|
let { done: e, value: i } = await t.read();
|
|
417
294
|
if (e) break;
|
|
418
|
-
if (r += i.byteLength, r >
|
|
295
|
+
if (r += i.byteLength, r > p) throw await t.cancel().catch(() => {}), w();
|
|
419
296
|
n.push(i);
|
|
420
297
|
}
|
|
421
298
|
let i = new Uint8Array(r), a = 0;
|
|
422
299
|
for (let e of n) i.set(e, a), a += e.byteLength;
|
|
423
300
|
return i;
|
|
424
301
|
}
|
|
425
|
-
var
|
|
426
|
-
async function
|
|
302
|
+
var w = () => new _(413, "PayloadTooLarge", "Request body is too large.");
|
|
303
|
+
async function T(e, t) {
|
|
427
304
|
let n;
|
|
428
305
|
try {
|
|
429
|
-
n = JSON.parse(new TextDecoder().decode(await
|
|
306
|
+
n = JSON.parse(new TextDecoder().decode(await C(e)));
|
|
430
307
|
} catch (e) {
|
|
431
|
-
if (e instanceof
|
|
308
|
+
if (e instanceof _) throw e;
|
|
432
309
|
n = void 0;
|
|
433
310
|
}
|
|
434
311
|
let r = typeof n == "object" && n;
|
|
435
|
-
if (!r || t.some((e) => typeof r[e] != "string")) throw new
|
|
312
|
+
if (!r || t.some((e) => typeof r[e] != "string")) throw new _(400, "InvalidRequest", `Expected ${t.join(", ")}.`);
|
|
436
313
|
return r;
|
|
437
314
|
}
|
|
438
|
-
|
|
439
|
-
let t = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
|
|
440
|
-
return Array.from(new Uint8Array(t), (e) => e.toString(16).padStart(2, "0")).join("");
|
|
441
|
-
}
|
|
442
|
-
export { k as createCustomerHandler, l as customerSessionCookie, i as memoryLimiterStore, m as readCustomerSession, r as redisLimiterStore, y as turnstile };
|
|
315
|
+
export { v as createCustomerHandler, n as customerSessionCookie, s 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
|
@@ -9,6 +9,10 @@ export declare function SignIn(props: {
|
|
|
9
9
|
botCheck: CustomerBotCheck | undefined;
|
|
10
10
|
notice: MessageKey | undefined;
|
|
11
11
|
onSignedIn: (sessionKey: string) => void;
|
|
12
|
+
/** Offers a Cancel button that calls this. */
|
|
13
|
+
onCancel?: (() => void) | undefined;
|
|
14
|
+
/** Moves focus to the first field on mount, as in a host's dialog. */
|
|
15
|
+
autoFocus?: boolean;
|
|
12
16
|
/** What the customer is signing in for, such as the time they chose. */
|
|
13
17
|
children?: ReactNode;
|
|
14
18
|
}): 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 p{margin:0}.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 strong{font-weight:600}.cp-option span{color:var(--cp-muted);font-weight:400}
|
|
2
2
|
/*$vite$:1*/
|