@curless/hotel-storefront 0.63.2 → 0.65.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/dist/account/index.d.ts +2 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +1 -0
- package/dist/account/index.js.map +1 -1
- package/dist/account/member-login.d.ts +2 -0
- package/dist/account/member-login.d.ts.map +1 -1
- package/dist/account/member-login.js +1 -0
- package/dist/account/member-login.js.map +1 -1
- package/dist/account/pages.d.ts +37 -8
- package/dist/account/pages.d.ts.map +1 -1
- package/dist/account/pages.js +183 -59
- package/dist/account/pages.js.map +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/choices.d.ts +4 -1
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +9 -6
- package/dist/choices.js.map +1 -1
- package/dist/paid.d.ts.map +1 -1
- package/dist/paid.js +5 -1
- package/dist/paid.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +10 -2
- package/dist/server.js.map +1 -1
- package/dist/tools.js +1 -1
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/account/pages.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ declare const WORDS: {
|
|
|
16
16
|
readonly phoneNote: readonly ["带国家区号", "with country code"];
|
|
17
17
|
readonly passwordHint: readonly ["至少 6 位", "At least 6 characters"];
|
|
18
18
|
readonly showPassword: readonly ["显示密码", "Show password"];
|
|
19
|
-
readonly hidePassword: readonly ["隐藏密码", "Hide password"];
|
|
20
19
|
readonly 'Sign in': readonly ["登录", "Sign in"];
|
|
21
20
|
readonly 'No account yet?': readonly ["还没有账号?", "No account yet?"];
|
|
22
21
|
readonly 'Create one': readonly ["注册", "Create one"];
|
|
@@ -164,17 +163,31 @@ export declare const say: (lang: Lang, key: WordKey, ...values: string[]) => str
|
|
|
164
163
|
* /login?code=… never leaves, and the footer's links say rel="noreferrer".
|
|
165
164
|
*/
|
|
166
165
|
/**
|
|
167
|
-
* ⚠️ THE ONE SCRIPT (robin 11-09, L8: show password
|
|
168
|
-
* data, no server value, no wording - the button's own
|
|
169
|
-
* (written by esc())
|
|
170
|
-
* this same constant, so any other script is still refused. The
|
|
171
|
-
* `hidden` in the HTML and shown only here: with no script the page is as it
|
|
166
|
+
* ⚠️ THE ONE SCRIPT (robin 11-09, L8: show password; an eye in the field since robin
|
|
167
|
+
* 11-10). A fixed string: no user data, no server value, no wording - the button's own
|
|
168
|
+
* data-reveal (the input's id, written by esc()) says which field. The CSP names it by
|
|
169
|
+
* hash, computed from this same constant, so any other script is still refused. The
|
|
170
|
+
* button is `hidden` in the HTML and shown only here: with no script the page is as it
|
|
171
|
+
* was.
|
|
172
|
+
*
|
|
173
|
+
* ⚠️ A TOGGLE SAYS ITS STATE, NOT A NEW NAME. The button's name stays "Show password"
|
|
174
|
+
* and `aria-pressed` says whether it is on (WAI-ARIA's toggle button): a name that also
|
|
175
|
+
* turned to "Hide password" was read out as "Hide password, pressed". The eye is struck
|
|
176
|
+
* through while the password is shown (CSS, on `aria-pressed`).
|
|
177
|
+
*
|
|
178
|
+
* ⚠️ THE KEYBOARD KEEPS ITS PLACE. A pointer's press puts the caret back in the field (a
|
|
179
|
+
* phone's keyboard stays up); a press from the keyboard (`detail` 0 - Enter or Space on
|
|
180
|
+
* the button) leaves focus on the button, so pressing again turns it back.
|
|
172
181
|
*/
|
|
173
|
-
export declare const REVEAL_SCRIPT = "for(const b of document.querySelectorAll('button[data-reveal]')){const i=document.getElementById(b.getAttribute('data-reveal'));if(!i)continue;const set=(on)=>{i.type=on?'text':'password';
|
|
182
|
+
export declare const REVEAL_SCRIPT = "for(const b of document.querySelectorAll('button[data-reveal]')){const i=document.getElementById(b.getAttribute('data-reveal'));if(!i)continue;const set=(on)=>{i.type=on?'text':'password';b.setAttribute('aria-pressed',String(on))};b.hidden=false;b.addEventListener('click',(e)=>{set(i.type==='password');if(e.detail)i.focus()});if(i.form)i.form.addEventListener('submit',()=>set(false))}";
|
|
174
183
|
export declare const REVEAL_SCRIPT_HASH: string;
|
|
175
184
|
/** The one place the CSP is written. */
|
|
176
185
|
export declare const contentSecurityPolicy: () => string;
|
|
177
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* The eye in a password field (hidden until the script runs): an icon button at the
|
|
188
|
+
* field's end, 44×44, named "Show password", `aria-pressed` its state. A <button>, so
|
|
189
|
+
* Tab reaches it after the field and Enter or Space press it.
|
|
190
|
+
*/
|
|
178
191
|
export declare const revealButton: (lang: Lang, inputId: string) => string;
|
|
179
192
|
export declare const PAGE_HEADERS: Record<string, string>;
|
|
180
193
|
/** Who the pages are for: the brand, where its logos and its other pages are. */
|
|
@@ -185,7 +198,23 @@ export type PageBrand = {
|
|
|
185
198
|
logo?: string;
|
|
186
199
|
logoDark?: string;
|
|
187
200
|
operator?: string;
|
|
201
|
+
/**
|
|
202
|
+
* The group's own primary colour (`server.primary`, the card's) - `#rrggbb`, or the
|
|
203
|
+
* page keeps its default. See `brandVars`.
|
|
204
|
+
*/
|
|
205
|
+
color?: string;
|
|
188
206
|
};
|
|
207
|
+
/**
|
|
208
|
+
* The group's colour on its own page, by the card's rules (card.ts `applyPrimary`):
|
|
209
|
+
* the fill is the group's; the words on it are white or the ink, whichever reads; as a
|
|
210
|
+
* link or a focus ring it is the colour where it reaches 4.5:1, the ink where it does
|
|
211
|
+
* not (Shangri-La's gold is 2:1 on white). ⚠️ NEVER A SHADE THE GROUP DID NOT PUBLISH:
|
|
212
|
+
* on a dark page a colour under 3:1 (a navy, a near-black) is not lightened - the
|
|
213
|
+
* button is the page's ink turned over, as the card's is.
|
|
214
|
+
*
|
|
215
|
+
* ⚠️ ONLY `#rrggbb`. This is CSS written into the page: anything else writes nothing.
|
|
216
|
+
*/
|
|
217
|
+
export declare const brandVars: (color: string | undefined) => string;
|
|
189
218
|
export declare const page: (b: PageBrand, { lang, title, body, head, langHref, }: {
|
|
190
219
|
lang: Lang;
|
|
191
220
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/account/pages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAuB/C,kFAAkF;AAClF,QAAA,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/account/pages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAuB/C,kFAAkF;AAClF,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmSmD,CAAC;AAE/D,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,KAAK,CAAC;AAGzC;;;;GAIG;AACH,eAAO,MAAM,GAAG,GAAI,MAAM,IAAI,EAAE,KAAK,OAAO,EAAE,GAAG,QAAQ,MAAM,EAAE,KAAG,MAWjE,CAAC;AAEJ;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,wYAC6W,CAAC;AACxY,eAAO,MAAM,kBAAkB,QAAkF,CAAC;AAElH,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,QAAO,MACyH,CAAC;AAOnK;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,EAAE,SAAS,MAAM,KAAG,MAC8G,CAAC;AAE1K,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MA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AAI,KAAK,MAAM,EAC7B,QAAQ,MAAM,KACb,MAkBF,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GACjB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEN,eAAO,MAAM,aAAa,GAAI,GAAG,SAAS,EAAE,MAAM,IAAI,EAAE,MAAM,MAAM,EAAE,GAAG,SAAS,KAAG,MAiDpF,CAAC"}
|
package/dist/account/pages.js
CHANGED
|
@@ -38,7 +38,6 @@ const WORDS = {
|
|
|
38
38
|
phoneNote: ['带国家区号', 'with country code'],
|
|
39
39
|
passwordHint: ['至少 6 位', 'At least 6 characters'],
|
|
40
40
|
showPassword: ['显示密码', 'Show password'],
|
|
41
|
-
hidePassword: ['隐藏密码', 'Hide password'],
|
|
42
41
|
'Sign in': ['登录', 'Sign in'],
|
|
43
42
|
'No account yet?': ['还没有账号?', 'No account yet?'],
|
|
44
43
|
'Create one': ['注册', 'Create one'],
|
|
@@ -330,18 +329,35 @@ export const say = (lang, key, ...values) => WORDS[key][lang === 'zh' ? 0 : 1].r
|
|
|
330
329
|
* /login?code=… never leaves, and the footer's links say rel="noreferrer".
|
|
331
330
|
*/
|
|
332
331
|
/**
|
|
333
|
-
* ⚠️ THE ONE SCRIPT (robin 11-09, L8: show password
|
|
334
|
-
* data, no server value, no wording - the button's own
|
|
335
|
-
* (written by esc())
|
|
336
|
-
* this same constant, so any other script is still refused. The
|
|
337
|
-
* `hidden` in the HTML and shown only here: with no script the page is as it
|
|
332
|
+
* ⚠️ THE ONE SCRIPT (robin 11-09, L8: show password; an eye in the field since robin
|
|
333
|
+
* 11-10). A fixed string: no user data, no server value, no wording - the button's own
|
|
334
|
+
* data-reveal (the input's id, written by esc()) says which field. The CSP names it by
|
|
335
|
+
* hash, computed from this same constant, so any other script is still refused. The
|
|
336
|
+
* button is `hidden` in the HTML and shown only here: with no script the page is as it
|
|
337
|
+
* was.
|
|
338
|
+
*
|
|
339
|
+
* ⚠️ A TOGGLE SAYS ITS STATE, NOT A NEW NAME. The button's name stays "Show password"
|
|
340
|
+
* and `aria-pressed` says whether it is on (WAI-ARIA's toggle button): a name that also
|
|
341
|
+
* turned to "Hide password" was read out as "Hide password, pressed". The eye is struck
|
|
342
|
+
* through while the password is shown (CSS, on `aria-pressed`).
|
|
343
|
+
*
|
|
344
|
+
* ⚠️ THE KEYBOARD KEEPS ITS PLACE. A pointer's press puts the caret back in the field (a
|
|
345
|
+
* phone's keyboard stays up); a press from the keyboard (`detail` 0 - Enter or Space on
|
|
346
|
+
* the button) leaves focus on the button, so pressing again turns it back.
|
|
338
347
|
*/
|
|
339
|
-
export const REVEAL_SCRIPT = "for(const b of document.querySelectorAll('button[data-reveal]')){const i=document.getElementById(b.getAttribute('data-reveal'));if(!i)continue;const set=(on)=>{i.type=on?'text':'password';
|
|
348
|
+
export const REVEAL_SCRIPT = "for(const b of document.querySelectorAll('button[data-reveal]')){const i=document.getElementById(b.getAttribute('data-reveal'));if(!i)continue;const set=(on)=>{i.type=on?'text':'password';b.setAttribute('aria-pressed',String(on))};b.hidden=false;b.addEventListener('click',(e)=>{set(i.type==='password');if(e.detail)i.focus()});if(i.form)i.form.addEventListener('submit',()=>set(false))}";
|
|
340
349
|
export const REVEAL_SCRIPT_HASH = `sha256-${createHash('sha256').update(REVEAL_SCRIPT, 'utf8').digest('base64')}`;
|
|
341
350
|
/** The one place the CSP is written. */
|
|
342
351
|
export const contentSecurityPolicy = () => `default-src 'none'; style-src 'unsafe-inline'; script-src '${REVEAL_SCRIPT_HASH}'; img-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'`;
|
|
343
|
-
/**
|
|
344
|
-
|
|
352
|
+
/** The two eyes, drawn here - the page loads nothing (CSP `default-src 'none'`). */
|
|
353
|
+
const EYE = '<svg class="eye" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg>';
|
|
354
|
+
const EYE_OFF = '<svg class="eye-off" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M10.7 5.1A10.4 10.4 0 0 1 12 5c6.4 0 10 7 10 7a17.3 17.3 0 0 1-3 4M6.6 6.6C3.7 8.5 2 12 2 12s3.6 7 10 7a9.7 9.7 0 0 0 5.4-1.6"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/><path d="M3 3l18 18"/></svg>';
|
|
355
|
+
/**
|
|
356
|
+
* The eye in a password field (hidden until the script runs): an icon button at the
|
|
357
|
+
* field's end, 44×44, named "Show password", `aria-pressed` its state. A <button>, so
|
|
358
|
+
* Tab reaches it after the field and Enter or Space press it.
|
|
359
|
+
*/
|
|
360
|
+
export const revealButton = (lang, inputId) => `<button class="show" type="button" hidden aria-pressed="false" aria-label="${esc(say(lang, 'showPassword'))}" data-reveal="${esc(inputId)}">${EYE}${EYE_OFF}</button>`;
|
|
345
361
|
export const PAGE_HEADERS = {
|
|
346
362
|
'Content-Security-Policy': contentSecurityPolicy(),
|
|
347
363
|
'X-Frame-Options': 'DENY',
|
|
@@ -352,73 +368,130 @@ export const PAGE_HEADERS = {
|
|
|
352
368
|
};
|
|
353
369
|
// AA everywhere: soft text 7:1, the warning 5.6:1, a field's rim 3:1 (WCAG
|
|
354
370
|
// 1.4.11). Nothing under 14px; every target 44px.
|
|
371
|
+
//
|
|
372
|
+
// ⚠️ THE CARD'S OWN PAGE (direction A, 暖纸, 2026-11-10 prototype). A guest comes
|
|
373
|
+
// here from the card - Shangri-La's gold, Atour's near-black - and landed on a
|
|
374
|
+
// cool grey page with a blue button that was nobody's. The neutrals are the
|
|
375
|
+
// card's warm ones (card.css `--c-*`): soft text 7.2:1 on the page and 7.9:1 on
|
|
376
|
+
// a box, a field's rim 3.8:1; the default accent is the card's default primary
|
|
377
|
+
// (#1D4ED8), and a group that has a colour brings it (`PageBrand.color`,
|
|
378
|
+
// `brandVars`).
|
|
379
|
+
//
|
|
380
|
+
// ⚠️ NO BACKTICK IN THE STYLESHEET, NOT EVEN IN A COMMENT: it is a template literal, and a
|
|
381
|
+
// backtick in a CSS comment ends it (twice on 2026-11-10 - the build said "Property
|
|
382
|
+
// 'card' does not exist on type string"). Name a rule in a comment without quoting it.
|
|
355
383
|
const CSS = `
|
|
356
|
-
:root { --bg: #
|
|
357
|
-
--accent: #
|
|
358
|
-
--accent-soft: #
|
|
384
|
+
:root { --bg: #f7f4ee; --card: #fff; --fg: #1c1917; --soft: #57504a; --line: #ece6dc; --rim: #8a8177;
|
|
385
|
+
--accent: #1d4ed8; --accent-fg: #fff; --link: #1d4ed8; --focus: #1d4ed8; --warn: #7a4f00; --warn-bg: #fdf2dc; --warn-rim: #c58a1b;
|
|
386
|
+
--accent-soft: #edf2fe; --accent-soft-2: #dbe5fd; --accent-edge: #6f8be6; --mark-bg: #f1ece4;
|
|
359
387
|
--bad: #b42318; --bad-bg: #fdecea; --good: #0f6b4b; --good-bg: #e3f5ec; color-scheme: light;
|
|
360
388
|
--cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC" }
|
|
361
|
-
@media (prefers-color-scheme: dark) { :root { --bg: #
|
|
362
|
-
--accent: #7aa2ff; --accent-fg: #0b1636; --link: #9dbaff; --warn: #f6d38f; --warn-bg: #2a2312; --warn-rim: #b88a2e;
|
|
363
|
-
--accent-soft: #1b2744; --accent-soft-2: #22305a; --accent-edge: #4f6db8; --mark-bg: #
|
|
389
|
+
@media (prefers-color-scheme: dark) { :root { --bg: #141312; --card: #1c1b19; --fg: #f4f1eb; --soft: #c6bfb4; --line: #34312c; --rim: #7a746a;
|
|
390
|
+
--accent: #7aa2ff; --accent-fg: #0b1636; --link: #9dbaff; --focus: #9dbaff; --warn: #f6d38f; --warn-bg: #2a2312; --warn-rim: #b88a2e;
|
|
391
|
+
--accent-soft: #1b2744; --accent-soft-2: #22305a; --accent-edge: #4f6db8; --mark-bg: #2a2723;
|
|
364
392
|
--bad: #ff9a90; --bad-bg: #2a1514; --good: #6fd3a2; --good-bg: #0b2a20; color-scheme: dark } }
|
|
365
393
|
* { box-sizing: border-box }
|
|
366
394
|
body { margin: 0; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased;
|
|
367
395
|
font: 16px/1.5 -apple-system, "SF Pro Text", BlinkMacSystemFont, var(--cjk), "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif }
|
|
368
|
-
|
|
369
|
-
|
|
396
|
+
/* ⚠️ ONE SHEET, AS THE CARD IS (robin 11-10: the sign-in and sign-up pages "重新做好看",
|
|
397
|
+
one look with the account and link pages). The page is the card the guest came from,
|
|
398
|
+
again: a white sheet on the warm ground, its corners, its shadow, the group's colour
|
|
399
|
+
in a line along its top (card.css, .card). Nothing inside it is boxed a second time -
|
|
400
|
+
a form is fields on the sheet, the account's parts are under hairlines - but the code
|
|
401
|
+
to check, which is the one thing a guest must stop at. */
|
|
402
|
+
main { max-width: 440px; margin: 24px auto 40px; padding: 22px 20px 8px; background: var(--card);
|
|
403
|
+
border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 20px;
|
|
404
|
+
box-shadow: 0 1px 2px rgb(40 30 16 / 4%), 0 12px 32px -18px rgb(40 30 16 / 22%) }
|
|
405
|
+
@media (max-width: 480px) { main { margin: 12px 12px 28px } }
|
|
406
|
+
@media (prefers-color-scheme: dark) { main { box-shadow: none } }
|
|
407
|
+
.brand { display: flex; align-items: center; min-height: 40px; margin: 0 0 18px }
|
|
370
408
|
.brand img { height: 32px; width: auto; max-width: 200px }
|
|
371
409
|
.brand .wm { font-size: 20px; font-weight: 650; letter-spacing: -0.01em }
|
|
372
410
|
.brand .dark { display: none }
|
|
373
411
|
@media (prefers-color-scheme: dark) { .brand .has-dark { display: none } .brand .dark { display: block } }
|
|
374
|
-
|
|
412
|
+
/* A logo with no dark version, on a dark page: a light plate, the card's way (card.css,
|
|
413
|
+
.head .brand) - Atour's and Shangri-La's marks are drawn for white and were not to be
|
|
414
|
+
seen at all. */
|
|
415
|
+
@media (prefers-color-scheme: dark) { .brand img:not(.has-dark):not(.dark) { padding: 5px 9px; border-radius: 9px; background: #efeae2; box-sizing: content-box } }
|
|
416
|
+
h1 { font-size: 24px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 18px; text-wrap: balance }
|
|
375
417
|
p { margin: 0 0 12px }
|
|
376
|
-
|
|
377
|
-
.
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
.
|
|
384
|
-
.
|
|
385
|
-
|
|
418
|
+
/* A part of the page. No frame: the sheet is the frame. */
|
|
419
|
+
.box { margin: 0 0 20px }
|
|
420
|
+
/* ⚠️ THE CODE TO CHECK IS THE ONE PANEL ON THE SHEET, AND IT IS THE WARNING'S AMBER. It was
|
|
421
|
+
a white box in a blue frame with a yellow box inside it - two alarms in one place
|
|
422
|
+
(review M17) - and the code itself, the thing to look at, in neither colour. Now one
|
|
423
|
+
amber panel: the code, large; a torn line, as the card's ticket has; then what to do
|
|
424
|
+
about it, with the warning's mark. The words are 5.6:1 on it. */
|
|
425
|
+
.code-box { padding: 16px 16px 14px; border: 1px solid color-mix(in srgb, var(--warn-rim) 55%, transparent); border-radius: 14px; background: var(--warn-bg) }
|
|
426
|
+
.code-label { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: var(--warn) }
|
|
427
|
+
.code { font: 650 30px/1.2 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; margin: 2px 0 14px; color: var(--fg); overflow-wrap: anywhere }
|
|
428
|
+
.warn { position: relative; margin: 0; padding: 12px 0 0 30px; border-top: 1px dashed color-mix(in srgb, var(--warn-rim) 70%, transparent);
|
|
429
|
+
color: var(--warn); font-size: 14px; line-height: 1.55; font-weight: 500 }
|
|
430
|
+
.warn::before, .msg.err::before { content: "!"; position: absolute; inset-inline-start: 0; width: 20px; height: 20px; border-radius: 50%;
|
|
431
|
+
font: 700 13px/20px -apple-system, "Segoe UI", Roboto, Arial, sans-serif; text-align: center }
|
|
432
|
+
.warn::before { top: 13px; background: var(--warn); color: var(--warn-bg) }
|
|
433
|
+
/* A refusal: over the button that was pressed, in the error's own colour, with its mark. */
|
|
434
|
+
.msg { border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; font-size: 15px; line-height: 1.5 }
|
|
435
|
+
.msg.err { position: relative; padding-inline-start: 44px; color: var(--bad); background: var(--bad-bg); font-weight: 500 }
|
|
436
|
+
.msg.err::before { inset-inline-start: 14px; top: 13px; background: var(--bad); color: var(--bad-bg) }
|
|
437
|
+
/* The backend's own words for it (0.61.1), under ours, as it wrote them. */
|
|
438
|
+
.msg .said { display: block; margin-top: 4px; font-weight: 400; overflow-wrap: anywhere }
|
|
439
|
+
label.field { display: block; margin: 0 0 16px }
|
|
386
440
|
label.field > span { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px }
|
|
387
441
|
label.field em { font-style: normal; font-weight: 400; color: var(--soft) }
|
|
388
|
-
|
|
442
|
+
label.field em + em::before { content: "· " }
|
|
443
|
+
/* A field: 48px, as tall as the button under it. A long address stays on its line and
|
|
444
|
+
is cut with an ellipsis while it is not being typed in. */
|
|
445
|
+
input { width: 100%; min-height: 48px; padding: 11px 14px; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--rim); border-radius: 12px; text-overflow: ellipsis }
|
|
446
|
+
input:hover { border-color: var(--soft) }
|
|
389
447
|
input::placeholder { color: var(--soft); opacity: 1 }
|
|
390
|
-
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--
|
|
448
|
+
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px }
|
|
391
449
|
button { font: inherit; cursor: pointer }
|
|
392
|
-
.pw { margin: 0 0
|
|
450
|
+
.pw { position: relative; margin: 0 0 16px }
|
|
393
451
|
.pw > label.field { margin: 0 }
|
|
394
|
-
|
|
395
|
-
|
|
452
|
+
/* ⚠️ THE EYE IS IN THE FIELD, AT ITS END (robin 11-10): 44×44 inside the 48px field, two
|
|
453
|
+
pixels from its rim, so the whole of it is a place to press and none of it is outside.
|
|
454
|
+
The field keeps its words clear of it. The eye is struck through while the password is
|
|
455
|
+
shown (aria-pressed), and takes the link's colour. With no script the button is not
|
|
456
|
+
there and the field is whole. */
|
|
457
|
+
.pw input { padding-inline-end: 52px }
|
|
458
|
+
.show { position: absolute; inset-inline-end: 2px; bottom: 2px; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0;
|
|
459
|
+
border: 0; border-radius: 10px; background: transparent; color: var(--soft) }
|
|
396
460
|
.show[hidden] { display: none }
|
|
397
|
-
.
|
|
461
|
+
.show:hover { background: var(--mark-bg); color: var(--fg) }
|
|
462
|
+
.show:focus-visible { outline-offset: -3px }
|
|
463
|
+
.show svg { width: 22px; height: 22px; pointer-events: none }
|
|
464
|
+
.show .eye-off, .show[aria-pressed="true"] .eye { display: none }
|
|
465
|
+
.show[aria-pressed="true"] .eye-off { display: block }
|
|
466
|
+
.show[aria-pressed="true"] { color: var(--link) }
|
|
467
|
+
.primary { display: block; width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 12px;
|
|
398
468
|
background: var(--accent); color: var(--accent-fg); font-weight: 650; text-align: center; text-decoration: none }
|
|
399
|
-
.
|
|
469
|
+
.primary:hover { filter: brightness(0.94) }
|
|
470
|
+
.secondary { display: block; width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--rim); border-radius: 12px;
|
|
400
471
|
background: transparent; color: var(--fg); font-weight: 600; text-align: center; text-decoration: none }
|
|
401
472
|
details.box > summary { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--link); font-weight: 600; cursor: pointer; list-style: none }
|
|
402
473
|
details.box > summary::-webkit-details-marker { display: none }
|
|
403
474
|
details.box > summary::after { content: ""; flex: none; margin-left: auto; width: 9px; height: 9px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg) }
|
|
404
475
|
details.box[open] > summary::after { transform: translateY(2px) rotate(-135deg) }
|
|
405
476
|
details.box[open] > summary { margin: 0 0 12px }
|
|
406
|
-
.note { font-size: 14px; color: var(--soft) }
|
|
407
|
-
.switch { margin: -
|
|
408
|
-
.switch a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: var(--link); font-weight: 600; text-underline-offset: 2px }
|
|
477
|
+
.note { font-size: 14px; line-height: 1.55; color: var(--soft) }
|
|
478
|
+
.switch { margin: -6px 0 14px; text-align: center; font-size: 15px }
|
|
479
|
+
.switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 4px; color: var(--link); font-weight: 600; text-underline-offset: 2px }
|
|
409
480
|
.who { display: flex; align-items: center; gap: 12px; margin: 0 0 4px }
|
|
410
481
|
.av { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 18px }
|
|
411
482
|
.name { font-size: 18px; font-weight: 650; overflow-wrap: anywhere }
|
|
412
483
|
dl.facts { margin: 12px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px }
|
|
413
484
|
dl.facts dt { color: var(--soft); font-size: 15px }
|
|
414
485
|
dl.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere }
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
nav.langs a
|
|
419
|
-
|
|
486
|
+
/* The page's two languages: two words at its foot. A black pill for the one already
|
|
487
|
+
chosen was the heaviest thing on the page. */
|
|
488
|
+
nav.langs { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 20px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line) }
|
|
489
|
+
nav.langs a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; padding: 0;
|
|
490
|
+
color: var(--link); text-decoration: underline; text-underline-offset: 3px; font-size: 14px }
|
|
491
|
+
nav.langs a[aria-current] { color: var(--fg); font-weight: 650; text-decoration: none }
|
|
492
|
+
footer { margin-top: 0; font-size: 14px; color: var(--soft) }
|
|
420
493
|
footer p { margin: 0 }
|
|
421
|
-
footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); margin-right:
|
|
494
|
+
footer a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; color: var(--link); margin-right: 12px; text-underline-offset: 2px }
|
|
422
495
|
h2 { font-size: 16px; margin: 0 0 4px }
|
|
423
496
|
/* ⚠️ THE CARD'S ACCOUNT VIEW, DRAWN AGAIN (0.61.0, robin 11-10: 「卡片和网页内容尽量统一」):
|
|
424
497
|
one box - who, the hotel memberships, the small print - each part under a line; a
|
|
@@ -454,14 +527,62 @@ button.small.quiet { background: transparent; border: 1px solid var(--rim); colo
|
|
|
454
527
|
h1.grp-head { margin: 0 0 20px }
|
|
455
528
|
.grp { display: flex; align-items: center; gap: 12px }
|
|
456
529
|
.gname { font-size: 28px; line-height: 1.2; font-weight: 700; min-width: 0; overflow-wrap: anywhere }
|
|
457
|
-
|
|
458
|
-
|
|
530
|
+
/* ⚠️ A GROUP'S TERMS, AND WHAT IS ASKED OF THE GUEST BY WHEN (0.64.0 暖纸). The terms are
|
|
531
|
+
the group's words, kept in a sunk panel of their own (the card's sunk surface, a
|
|
532
|
+
hairline - not the field's rim, which said "type here"). The time to agree or to pay
|
|
533
|
+
by is the one urgent thing on these pages: the warning's amber, with its clock, the
|
|
534
|
+
card's own way of saying a deadline (the line under its Pay button). The order code is the
|
|
535
|
+
ticket's: set in the code face, as the card's booked page sets it. */
|
|
536
|
+
.terms-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 45vh; overflow: auto; font-size: 15px; line-height: 1.55; margin: 8px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg) }
|
|
537
|
+
.deadline { position: relative; margin: 0 0 14px; padding-inline-start: 26px; color: var(--warn); font-size: 15px; font-weight: 600; line-height: 1.5; text-wrap: pretty }
|
|
538
|
+
.deadline::before { content: ""; position: absolute; inset-inline-start: 0; top: 2px; width: 18px; height: 18px; box-sizing: border-box; border: 2px solid currentColor; border-radius: 50%;
|
|
539
|
+
background: linear-gradient(currentColor, currentColor) 7px 3px / 2px 6px no-repeat, linear-gradient(currentColor, currentColor) 7px 7px / 5px 2px no-repeat }
|
|
540
|
+
.pay-host { margin: 0 0 4px; color: var(--soft); font-size: 15px; overflow-wrap: anywhere }
|
|
541
|
+
.order-code { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--rim); font: 650 17px/1.3 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.06em; color: var(--fg); overflow-wrap: anywhere }
|
|
459
542
|
.btns { display: grid; gap: 10px; margin: 0 0 12px }
|
|
460
543
|
.btns button { width: 100% }
|
|
461
544
|
button.primary, button.secondary { cursor: pointer }
|
|
462
545
|
.ok { color: var(--good); background: var(--good-bg) }
|
|
463
546
|
.gto { display: block; margin: 10px 0 0; font-size: 17px; line-height: 1.45; font-weight: 500; color: var(--soft); overflow-wrap: anywhere }
|
|
464
547
|
`;
|
|
548
|
+
/** "Shangri-La" kept on one line: a hyphen between letters does not break. */
|
|
549
|
+
const hy = (s) => s.replace(/(?<=\p{L})-(?=\p{L})/gu, '‑');
|
|
550
|
+
const lum = (hex) => {
|
|
551
|
+
const [r = 0, g = 0, b = 0] = [1, 3, 5].map((i) => {
|
|
552
|
+
const v = Number.parseInt(hex.slice(i, i + 2), 16) / 255;
|
|
553
|
+
return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
554
|
+
});
|
|
555
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
556
|
+
};
|
|
557
|
+
const contrast = (a, b) => {
|
|
558
|
+
const [hi, lo] = [lum(a), lum(b)].sort((x, y) => y - x);
|
|
559
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* The group's colour on its own page, by the card's rules (card.ts `applyPrimary`):
|
|
563
|
+
* the fill is the group's; the words on it are white or the ink, whichever reads; as a
|
|
564
|
+
* link or a focus ring it is the colour where it reaches 4.5:1, the ink where it does
|
|
565
|
+
* not (Shangri-La's gold is 2:1 on white). ⚠️ NEVER A SHADE THE GROUP DID NOT PUBLISH:
|
|
566
|
+
* on a dark page a colour under 3:1 (a navy, a near-black) is not lightened - the
|
|
567
|
+
* button is the page's ink turned over, as the card's is.
|
|
568
|
+
*
|
|
569
|
+
* ⚠️ ONLY `#rrggbb`. This is CSS written into the page: anything else writes nothing.
|
|
570
|
+
*/
|
|
571
|
+
export const brandVars = (color) => {
|
|
572
|
+
if (!color || !/^#[0-9a-f]{6}$/i.test(color))
|
|
573
|
+
return '';
|
|
574
|
+
const INK = '#1c1917';
|
|
575
|
+
const NIGHT = '#1c1b19';
|
|
576
|
+
const NIGHT_INK = '#f4f1eb';
|
|
577
|
+
const on = contrast(color, '#ffffff') >= contrast(color, INK) ? '#ffffff' : INK;
|
|
578
|
+
const link = contrast(color, '#ffffff') >= 4.5 ? color : INK;
|
|
579
|
+
const seen = contrast(color, NIGHT) >= 3;
|
|
580
|
+
const dark = seen ? color : NIGHT_INK;
|
|
581
|
+
const darkOn = seen ? on : NIGHT;
|
|
582
|
+
const darkLink = contrast(color, NIGHT) >= 4.5 ? color : NIGHT_INK;
|
|
583
|
+
const vars = (accent, fg, ln, page) => `--accent: ${accent}; --accent-fg: ${fg}; --link: ${ln}; --focus: ${ln}; --accent-soft: color-mix(in srgb, ${accent} 10%, ${page}); --accent-soft-2: color-mix(in srgb, ${accent} 18%, ${page}); --accent-edge: color-mix(in srgb, ${ln} 45%, transparent)`;
|
|
584
|
+
return `\n:root { ${vars(color, on, link, '#ffffff')} }\n@media (prefers-color-scheme: dark) { :root { ${vars(dark, darkOn, darkLink, NIGHT)} } }`;
|
|
585
|
+
};
|
|
465
586
|
const LANG_NAMES = { zh: '简体中文', en: 'English' };
|
|
466
587
|
export const page = (b, { lang, title, body, head = '', langHref, }) => {
|
|
467
588
|
const logo = b.logo
|
|
@@ -470,7 +591,7 @@ export const page = (b, { lang, title, body, head = '', langHref, }) => {
|
|
|
470
591
|
return `<!doctype html><html lang="${lang === 'zh' ? 'zh-CN' : 'en'}"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
471
592
|
<meta name="robots" content="noindex, nofollow">${head}
|
|
472
593
|
<title>${esc(title)} · ${esc(b.brand)}</title>
|
|
473
|
-
<style>${CSS}</style>
|
|
594
|
+
<style>${CSS}${brandVars(b.color)}</style>
|
|
474
595
|
<main>
|
|
475
596
|
<div class="brand">${logo}</div>
|
|
476
597
|
${body}
|
|
@@ -540,10 +661,10 @@ export const loginPage = (b, { lang, short, code, csrf, words, error, said, form
|
|
|
540
661
|
<div class="box code-box">
|
|
541
662
|
<div class="code-label" id="codel">${esc(say(lang, 'Sign-in code'))}</div>
|
|
542
663
|
<div class="code" aria-labelledby="codel">${esc(short)}</div>
|
|
543
|
-
<p class="warn" role="note">${esc(say(lang, words ? 'warnWords' : 'warnCard', b.brand))}</p>
|
|
664
|
+
<p class="warn" role="note">${esc(hy(say(lang, words ? 'warnWords' : 'warnCard', b.brand)))}</p>
|
|
544
665
|
</div>
|
|
545
666
|
${up ? register : signIn}
|
|
546
|
-
<p class="note">${esc(say(lang, 'privacyNote', b.brand))}</p>
|
|
667
|
+
<p class="note">${esc(hy(say(lang, 'privacyNote', b.brand)))}</p>
|
|
547
668
|
<script>${REVEAL_SCRIPT}</script>`;
|
|
548
669
|
return page(b, { lang, title, body, langHref: (l) => href(form, l) });
|
|
549
670
|
};
|
|
@@ -555,8 +676,6 @@ export const signedInPage = (b, { lang, name, account }) => page(b, {
|
|
|
555
676
|
<div class="box"><p>${esc(say(lang, 'backToChat'))}</p>
|
|
556
677
|
${account ? `<a class="secondary" href="${esc(b.base)}/account?lang=${lang}">${esc(say(lang, 'View your account'))}</a>` : ''}</div>`,
|
|
557
678
|
});
|
|
558
|
-
/** "Shangri-La" kept on one line: a hyphen between letters does not break. */
|
|
559
|
-
const hy = (s) => s.replace(/(?<=\p{L})-(?=\p{L})/gu, '‑');
|
|
560
679
|
/** The hotel list's mark for a group with no logo (card.ts `initials`): the first letters of its first two words. */
|
|
561
680
|
const initialsOf = (name) => name
|
|
562
681
|
.replace(/[^\p{L}\p{N} ]/gu, ' ')
|
|
@@ -630,15 +749,15 @@ export const memberLoginPage = (b, { lang, short, code, csrf, words, error, valu
|
|
|
630
749
|
<div class="box code-box">
|
|
631
750
|
<div class="code-label" id="codel">${esc(say(lang, 'Sign-in code'))}</div>
|
|
632
751
|
<div class="code" aria-labelledby="codel">${esc(short)}</div>
|
|
633
|
-
<p class="warn" role="note">${esc(say(lang, words ? 'memberWarnWords' : 'memberWarnCard', b.brand))}</p>
|
|
752
|
+
<p class="warn" role="note">${esc(hy(say(lang, words ? 'memberWarnWords' : 'memberWarnCard', b.brand)))}</p>
|
|
634
753
|
</div>
|
|
635
|
-
${error ? `<p class="msg err" role="alert">${esc(error)}</p>` : ''}
|
|
636
754
|
<form class="box" method="post" action="${esc(`${b.base}/login`)}" autocomplete="off">${hidden({ code, csrf, lang, form: 'member' })}
|
|
637
755
|
${field('Membership number', `<input name="number" required maxlength="40" autocomplete="off" spellcheck="false" placeholder="${esc(say(lang, 'memberNumberHint'))}" value="${esc(values.number ?? '')}">`)}
|
|
638
756
|
${field('Surname', `<input name="surname" required maxlength="60" autocomplete="family-name" placeholder="${esc(say(lang, 'surnameHint'))}">`)}
|
|
757
|
+
${refusalOf(error)}
|
|
639
758
|
<button class="primary" type="submit">${esc(say(lang, 'Sign in'))}</button>
|
|
640
759
|
</form>
|
|
641
|
-
<p class="note">${esc(say(lang, 'memberPrivacyNote', b.brand))}</p>`;
|
|
760
|
+
<p class="note">${esc(hy(say(lang, 'memberPrivacyNote', b.brand)))}</p>`;
|
|
642
761
|
return page(b, {
|
|
643
762
|
lang,
|
|
644
763
|
title,
|
|
@@ -668,12 +787,14 @@ export const linkReauthPage = (b, o) => {
|
|
|
668
787
|
const { lang } = o;
|
|
669
788
|
const title = say(lang, o.terms ? 'Booking terms of {0}' : 'Link {0} membership', o.group);
|
|
670
789
|
const field = (label, input) => `<label class="field"><span>${esc(say(lang, label))}</span>${input}</label>`;
|
|
790
|
+
// The refusal over the button that was pressed, on every page with a form (0.64.0).
|
|
791
|
+
const refusal = refusalOf(o.error, o.said);
|
|
671
792
|
const body = `${groupHead(o.group, o.logo, say(lang, 'First, sign in to your {0} account', b.brand))}
|
|
672
793
|
<p>${esc(say(lang, o.terms ? 'termsReauthLine' : 'reauthLine', b.brand, o.group))}</p>
|
|
673
|
-
${refusalOf(o.error, o.said)}
|
|
674
794
|
<form class="box" method="post" action="${esc(o.terms ? `${b.base}/account` : `${b.base}/login`)}" autocomplete="on">${hidden({ ...(o.terms ? { terms: o.code } : { code: o.code }), csrf: o.csrf, lang, form: 'reauth' })}
|
|
675
795
|
${field('Email or user name', '<input name="account" autocomplete="username" required maxlength="120">')}
|
|
676
796
|
<div class="pw">${field('Password', '<input id="pw-re" name="password" type="password" autocomplete="current-password" required maxlength="128">')}${revealButton(lang, 'pw-re')}</div>
|
|
797
|
+
${refusal}
|
|
677
798
|
<button class="primary" type="submit">${esc(say(lang, 'Sign in'))}</button>
|
|
678
799
|
</form>
|
|
679
800
|
<p class="note">${esc(say(lang, 'privacyNote', b.brand))}</p>
|
|
@@ -699,9 +820,12 @@ export const linkGroupPage = (b, o) => {
|
|
|
699
820
|
? say(lang, 'Join {0} and link it to the {1} account {2}', o.group, b.brand, o.accountName)
|
|
700
821
|
: say(lang, 'Link to the {0} account {1}', b.brand, o.accountName);
|
|
701
822
|
const base = { code: o.code, csrf: o.csrf, lang };
|
|
823
|
+
// The refusal over the button that was pressed, on every page with a form (L3).
|
|
824
|
+
const refusal = refusalOf(o.error, o.said);
|
|
702
825
|
const signIn = `<form class="box" method="post" action="${esc(`${b.base}/login`)}" autocomplete="on">${hidden({ ...base, form: 'link' })}
|
|
703
826
|
${field('Email or user name', `<input name="identity" autocomplete="username" required maxlength="120" value="${esc(v.identity ?? '')}">`)}
|
|
704
827
|
<div class="pw">${field('Password', '<input id="pw-link" name="password" type="password" autocomplete="current-password" required maxlength="128">')}${revealButton(lang, 'pw-link')}</div>
|
|
828
|
+
${refusal}
|
|
705
829
|
<button class="primary" type="submit">${esc(say(lang, 'Link membership'))}</button>
|
|
706
830
|
</form>
|
|
707
831
|
<p class="switch">${esc(say(lang, 'No {0} membership yet?', o.group))} <a href="${esc(href('up'))}">${esc(say(lang, 'Join'))}</a></p>`;
|
|
@@ -710,13 +834,13 @@ export const linkGroupPage = (b, o) => {
|
|
|
710
834
|
${field('Email', `<input name="email" type="email" autocomplete="email" required maxlength="254" value="${esc(v.email ?? '')}">`)}
|
|
711
835
|
<div class="pw">${field('Password', `<input id="pw-join" name="password" type="password" autocomplete="new-password" required minlength="6" maxlength="128" placeholder="${esc(say(lang, 'passwordHint'))}">`)}${revealButton(lang, 'pw-join')}</div>
|
|
712
836
|
${field('Phone', `<input name="phone" type="tel" autocomplete="tel" inputmode="tel" maxlength="24" pattern="\\+[\\d\\s\\-\\(\\)\\.]{6,22}" placeholder="${esc(say(lang, 'phoneHint'))}" value="${esc(v.phone ?? '')}">`, true)}
|
|
837
|
+
${refusal}
|
|
713
838
|
<button class="primary" type="submit">${esc(say(lang, 'Join and link'))}</button>
|
|
714
839
|
</form>
|
|
715
840
|
<p class="switch">${esc(say(lang, 'Already a member?'))} <a href="${esc(href('in'))}">${esc(say(lang, 'Link membership'))}</a></p>`;
|
|
716
841
|
const body = `${groupHead(o.group, o.logo, line)}
|
|
717
|
-
${refusalOf(o.error, o.said)}
|
|
718
842
|
${up ? join : signIn}
|
|
719
|
-
<p class="note">${esc(say(lang, 'linkPrivacyNote', b.brand, o.group))}</p>
|
|
843
|
+
<p class="note">${esc(hy(say(lang, 'linkPrivacyNote', b.brand, o.group)))}</p>
|
|
720
844
|
<script>${REVEAL_SCRIPT}</script>`;
|
|
721
845
|
return page(b, { lang, title, body, langHref: (l) => href(o.mode, l) });
|
|
722
846
|
};
|
|
@@ -876,9 +1000,9 @@ export const termsDonePage = (b, lang, code, d) => {
|
|
|
876
1000
|
const by = d.payBy ? clockIn(d.payBy, lang) : d.payByWords;
|
|
877
1001
|
const awaiting = d.paid === 'awaiting';
|
|
878
1002
|
const body = `${groupHead(d.group, d.logo, say(lang, headKey, d.group))}
|
|
879
|
-
<div class="box">${factsList(lang, d.facts)}${d.code ? `<p class="
|
|
1003
|
+
<div class="box">${factsList(lang, d.facts)}${d.code ? `<p class="order-code">${esc(d.code)}</p>` : ''}</div>
|
|
880
1004
|
${awaiting && d.payHost
|
|
881
|
-
? `<div class="box"><p>${esc(say(lang, 'Payment page', d.payHost))}
|
|
1005
|
+
? `<div class="box"><p class="pay-host">${esc(say(lang, 'Payment page', d.payHost))}</p>${by ? `<p class="deadline">${esc(say(lang, 'Pay by {0}', by))}</p>` : ''}${secure
|
|
882
1006
|
? `<a class="primary" href="${esc(secure)}" rel="noreferrer noopener">${esc(say(lang, 'Pay {0} on {1}', d.payAmount ?? d.facts.total ?? '', d.payHost))}</a>`
|
|
883
1007
|
: ''}</div>`
|
|
884
1008
|
: ''}
|