@curless/hotel-storefront 0.60.1 → 0.61.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.
@@ -49,7 +49,7 @@ export type AccountToolNames = ReturnType<typeof accountToolNames>;
49
49
  export declare const ACCOUNT_META_KEY = "curless/account";
50
50
  /** Beside a sign-in's answer where a card is drawn: the link and its short code, the card's alone. */
51
51
  export declare const SIGN_IN_META_KEY = "curless/account-sign-in";
52
- /** …and beside a membership link's answer (0.58.0): the same, with the group. */
52
+ /** …and beside a membership link's answer (0.58.0): the link and its group - no code (0.61.0). */
53
53
  export declare const LINK_META_KEY = "curless/account-link";
54
54
  /** The mall is asked at most this often whether a sign-in is still theirs. */
55
55
  export declare const CHECK_EVERY_MS: number;
@@ -104,7 +104,9 @@ export type Account = {
104
104
  /**
105
105
  * What every answer carries for the card's header. `cards`: the session said
106
106
  * it draws cards; `ours`: the call acted on its own conversation, naming no
107
- * trip or its own. Only with both is the user name in it (0.56.1, 0.59.0).
107
+ * trip or its own. The name (nickname, else user name) is in it either way
108
+ * (0.61.0); the masked facts and the hotel memberships only where `cards`, and
109
+ * a membership's masked number only with both.
108
110
  */
109
111
  meta: (key: string, who: {
110
112
  cards: boolean;
@@ -134,6 +136,11 @@ export type AccountOptions = {
134
136
  now?: () => number;
135
137
  logoUrl?: string;
136
138
  logoDarkUrl?: string;
139
+ /**
140
+ * A hotel group's logo, by its code - the address the hotel list uses
141
+ * (`/suppliers/<code>/logo.png?v=…`, server.ts), or none: its initials (0.61.0).
142
+ */
143
+ groupLogo?: (code: string) => string | undefined;
137
144
  operator?: string;
138
145
  log?: (line: string) => void;
139
146
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA4B1C,OAAO,EAEL,KAAK,IAAI,EAMV,MAAM,e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jB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,EAAE,QAAQ,MAAM,KAAG,OAS5D,CAAC;AACF,wEAAwE;AACxE,eAAO,MAAM,QAAQ,GAAU,GAAG,OAAO,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CASjF,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAKrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6B;gBAG/B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,MAAM,EACjB,OAAO,SAAS;IAGnC,OAAO,CAAC,MAAM;IAKd,8FAA8F;IAC9F,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIvC,uEAAuE;IACvE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAMxC,wGAAwG;IACxG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;CAyB/D;AAED,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,QAAc,CAAC;AAqC5C,eAAO,MAAM,WAAW,GAAI,MAAM,cAAc,KAAG,OAokDlD,CAAC"}
@@ -30,7 +30,7 @@ export const accountToolNames = (prefix) => ({
30
30
  export const ACCOUNT_META_KEY = 'curless/account';
31
31
  /** Beside a sign-in's answer where a card is drawn: the link and its short code, the card's alone. */
32
32
  export const SIGN_IN_META_KEY = 'curless/account-sign-in';
33
- /** …and beside a membership link's answer (0.58.0): the same, with the group. */
33
+ /** …and beside a membership link's answer (0.58.0): the link and its group - no code (0.61.0). */
34
34
  export const LINK_META_KEY = 'curless/account-link';
35
35
  /** The mall is asked at most this often whether a sign-in is still theirs. */
36
36
  export const CHECK_EVERY_MS = 5 * 60_000;
@@ -248,6 +248,8 @@ const otaNotThere = (e) => e instanceof OtaMemberError &&
248
248
  const otaWrong = (e) => e instanceof OtaMemberError &&
249
249
  typeof e.code === 'number' &&
250
250
  ((e.code >= 400 && e.code < 500) || e.envelope);
251
+ /** What the backend said for its no, cleaned (said.ts) - undefined when it said nothing. */
252
+ const saidBy = (e) => e instanceof MallError || e instanceof OtaMemberError ? e.said : undefined;
251
253
  /** The mall did not answer - not a no. */
252
254
  const notThere = (e) => e instanceof MallError &&
253
255
  (e.code === 'timeout' ||
@@ -327,6 +329,30 @@ export const makeAccount = (opts) => {
327
329
  const groupName = (m) => m.name || m.code;
328
330
  /** The group's name in a page's language - its Chinese one on a Chinese page, where it has one. */
329
331
  const groupIn = (m, lang) => lang === 'zh' && m.names?.zh ? m.names.zh : groupName(m);
332
+ /**
333
+ * The group as the words say it (0.61.0): where no card is drawn, its Chinese
334
+ * name beside - 「Atour(亚朵)」, as tools.ts `withZh` says a hotel - so the
335
+ * assistant tells a Chinese guest the name they know it by. A card host's words
336
+ * say the plain name: its card says the Chinese.
337
+ */
338
+ const groupSaid = (m, noCards) => {
339
+ const plain = groupName(m);
340
+ const zh = noCards ? m.names?.zh : undefined;
341
+ return zh && zh !== plain && !/\p{Script=Han}/u.test(plain) ? `${plain}(${zh})` : plain;
342
+ };
343
+ /** A group's logo for a page: our own path - the page's CSP takes 'self' alone. */
344
+ const logoPath = (code) => {
345
+ const url = opts.groupLogo?.(code);
346
+ if (!url)
347
+ return undefined;
348
+ try {
349
+ const u = new URL(url);
350
+ return u.origin === new URL(opts.publicUrl).origin ? u.pathname + u.search : undefined;
351
+ }
352
+ catch {
353
+ return undefined;
354
+ }
355
+ };
330
356
  const ota = makeOtaMembers({
331
357
  baseUrl,
332
358
  tenant,
@@ -373,10 +399,13 @@ export const makeAccount = (opts) => {
373
399
  */
374
400
  const membershipRows = (s, forCard, withNumber = forCard) => memberships.map((m) => {
375
401
  const l = s ? liveLink(s, m.code) : undefined;
402
+ // The group's logo, for the card (0.61.0) - the hotel list's address; none, its initials.
403
+ const logoUrl = forCard ? opts.groupLogo?.(m.code) : undefined;
376
404
  return {
377
405
  group: m.code,
378
406
  name: groupName(m),
379
407
  ...(m.names?.zh ? { names: { zh: m.names.zh } } : {}),
408
+ ...(logoUrl ? { logoUrl } : {}),
380
409
  linked: !!l,
381
410
  // The label has the number in it, hidden but for its ends (`maskLabel`):
382
411
  // the model is given the tier alone (总线程 11-09: not even hidden).
@@ -389,16 +418,20 @@ export const makeAccount = (opts) => {
389
418
  join: m.join === true,
390
419
  };
391
420
  });
392
- const membershipsSaid = (s) => {
421
+ const membershipsSaid = (s, noCards) => {
393
422
  if (!linking)
394
423
  return '';
395
424
  const rows = membershipRows(s, false);
396
425
  const linked = rows.filter((r) => r.linked);
426
+ const said = (code) => {
427
+ const m = groupOf(code);
428
+ return m ? groupSaid(m, noCards) : code;
429
+ };
397
430
  return `Hotel memberships linked to this account: ${linked.length
398
- ? linked.map((r) => `${r.name}${r.label ? ` · ${r.label}` : ''}`).join('; ')
431
+ ? linked.map((r) => `${said(r.group)}${r.label ? ` · ${r.label}` : ''}`).join('; ')
399
432
  : 'none'}. Can be linked: ${rows
400
433
  .filter((r) => !r.linked)
401
- .map((r) => `${r.name} (\`${r.group}\`)`)
434
+ .map((r) => `${said(r.group)} (\`${r.group}\`)`)
402
435
  .join(', ') || 'none more'} - ${names.link} gives the guest a one-time page for it.`;
403
436
  };
404
437
  // ── Signing in and out ───────────────────────────────────────────────────
@@ -428,8 +461,11 @@ export const makeAccount = (opts) => {
428
461
  end(was);
429
462
  return was;
430
463
  };
464
+ // The code, and the backend's own words for it where it gave any (0.61.1,
465
+ // questions #55): `refused (500: Password cannot be empty)`. `said` is
466
+ // already clean (said.ts): one line, 120 characters, nothing of ours in it.
431
467
  const codeOf = (e) => e instanceof MallError || e instanceof OtaMemberError
432
- ? String(e.code).slice(0, 16)
468
+ ? `${String(e.code).slice(0, 16)}${e.said ? `: ${e.said}` : ''}`
433
469
  : e instanceof Error
434
470
  ? e.name
435
471
  : 'error';
@@ -521,15 +557,18 @@ export const makeAccount = (opts) => {
521
557
  const NEVER_IN_CHAT = 'never in this chat: do not ask for, or accept, a password, an email or a phone number here, and never write back one the guest typed - not even to say which to change';
522
558
  const minutes = Math.round(requests.ttlMs / 60_000);
523
559
  const accountUrl = `${publicUrl}/account`;
524
- // ⚠️ THE NAME THE ACCOUNT GOES BY, AND NOTHING ELSE (review P2-2): the user
525
- // name signs in - in front of a forwarded link's sender it would let them
526
- // lock the account out with wrong tries - and the real name, the email and
527
- // the phone are the member's. Those are on the account page, in the browser
528
- // that typed the password. No nickname: no name at all.
529
- const shownFor = (s) => s.shown.displayName ? { displayName: s.shown.displayName } : {};
530
- const whoSaid = (s) => s.shown.displayName ? `the ${brand} account of ${s.shown.displayName}` : `${aBrand} account`;
531
- const signedInAnswer = (s, lead) => ({
532
- text: `${lead} Signed in to ${whoSaid(s)}. ${linking ? '' : `${NO_PRICE} `}The guest sees the whole account - its user name, and its email and phone partly hidden - on ${brand}'s account page, ${accountUrl}, in the browser they signed in with, for ${WEB_IDLE_MS / 60_000} minutes after. ${names.signOut} signs them out.${linking ? ` ${membershipsSaid(s)}` : ''}`.trim(),
560
+ // ⚠️ THE NAME THE ACCOUNT GOES BY: ITS NICKNAME, ELSE ITS USER NAME (0.61.0,
561
+ // robin 11-10: 「没昵称是不是应该和网页一样显示用户名」; 总线程 weighed it: the user
562
+ // name stands with the nickname - a trip id lives in its conversation alone,
563
+ // and the per-name limit on wrong tries still holds). The same name on the
564
+ // card, on the page, in the words and in the structured answer. The real name,
565
+ // the email and the phone are never in the words: the email and phone go to a
566
+ // card, masked, in `_meta` (`meta`), and are on the account page.
567
+ const nameOf = (s) => s.shown.displayName || s.shown.userName || '';
568
+ const shownFor = (s) => (nameOf(s) ? { displayName: nameOf(s) } : {});
569
+ const whoSaid = (s) => nameOf(s) ? `the ${brand} account of ${nameOf(s)}` : `${aBrand} account`;
570
+ const signedInAnswer = (s, lead, noCards) => ({
571
+ text: `${lead} Signed in to ${whoSaid(s)}. ${linking ? '' : `${NO_PRICE} `}The guest sees the whole account - its user name, and its email and phone partly hidden - on ${brand}'s account page, ${accountUrl}, in the browser they signed in with, for ${WEB_IDLE_MS / 60_000} minutes after. ${names.signOut} signs them out.${linking ? ` ${membershipsSaid(s, noCards)}` : ''}`.trim(),
533
572
  structured: {
534
573
  view: 'account',
535
574
  brand,
@@ -549,17 +588,18 @@ export const makeAccount = (opts) => {
549
588
  const linkAnswer = async (args, call) => {
550
589
  const { key, noCards } = call;
551
590
  const m = groupOf(args.group);
552
- const listed = memberships.map((x) => `\`${x.code}\` (${groupName(x)})`).join(', ');
591
+ const listed = memberships.map((x) => `\`${x.code}\` (${groupSaid(x, noCards)})`).join(', ');
553
592
  if (!m)
554
593
  return {
555
594
  text: `No such hotel group to link here. The ones that can be linked: ${listed}.`,
556
595
  structured: { view: 'error', brand, code: 'no_such_group' },
557
596
  isError: true,
558
597
  };
598
+ const g = groupSaid(m, noCards);
559
599
  const s = await checked(key);
560
600
  if (!s)
561
601
  return {
562
- text: `Linking a ${groupName(m)} membership needs the guest signed in to ${aBrand} account first: ${names.signIn} gives them a one-time page for that. ${NEVER_IN_CHAT[0]?.toUpperCase()}${NEVER_IN_CHAT.slice(1)}.`,
602
+ text: `Linking a ${g} membership needs the guest signed in to ${aBrand} account first: ${names.signIn} gives them a one-time page for that. ${NEVER_IN_CHAT[0]?.toUpperCase()}${NEVER_IN_CHAT.slice(1)}.`,
563
603
  structured: { view: 'account', brand, signedIn: false, code: 'not_signed_in' },
564
604
  };
565
605
  const mode = args.mode === 'unlink' ? 'unlink' : args.mode === 'join' ? 'up' : 'in';
@@ -568,20 +608,20 @@ export const makeAccount = (opts) => {
568
608
  if (was)
569
609
  log(`[account] ${tag(key)} unlinked a membership`);
570
610
  return {
571
- ...signedInAnswer(s, ''),
611
+ ...signedInAnswer(s, '', noCards),
572
612
  text: was
573
- ? `The ${groupName(m)} membership is unlinked from this ${brand} account: its prices here are the standard ones again.`
574
- : `No ${groupName(m)} membership was linked, so nothing changed.`,
613
+ ? `The ${g} membership is unlinked from this ${brand} account: its prices here are the standard ones again.`
614
+ : `No ${g} membership was linked, so nothing changed.`,
575
615
  };
576
616
  }
577
617
  if (liveLink(s, m.code))
578
618
  return {
579
- ...signedInAnswer(s, ''),
580
- text: `A ${groupName(m)} membership is already linked to this ${brand} account. To use another, unlink it first.`,
619
+ ...signedInAnswer(s, '', noCards),
620
+ text: `A ${g} membership is already linked to this ${brand} account. To use another, unlink it first.`,
581
621
  };
582
622
  if ((mode === 'up' && m.join !== true) || (mode === 'in' && m.signIn === false))
583
623
  return {
584
- text: `A ${groupName(m)} membership cannot be ${mode === 'up' ? 'made' : 'linked'} here.`,
624
+ text: `A ${g} membership cannot be ${mode === 'up' ? 'made' : 'linked'} here.`,
585
625
  structured: { view: 'error', brand, code: 'not_offered' },
586
626
  isError: true,
587
627
  };
@@ -622,25 +662,24 @@ export const makeAccount = (opts) => {
622
662
  const url = `${publicUrl}/login?code=${made.code}${mode === 'up' ? '&view=register' : ''}`;
623
663
  const expiresAt = new Date(made.expiresAt).toISOString();
624
664
  log(`[account] a membership link for ${tag(key)}${noCards ? ' in words' : ''}`);
625
- const what = mode === 'up'
626
- ? `join ${groupName(m)} and link the new membership`
627
- : `link their ${groupName(m)} membership`;
628
- const typed = `the ${groupName(m)} email (or user name) and password are typed on that page, never in this chat: do not ask for, or accept, them here, and never write back one the guest typed`;
665
+ const what = mode === 'up' ? `join ${g} and link the new membership` : `link their ${g} membership`;
666
+ const typed = `the ${g} email (or user name) and password are typed on that page, never in this chat: do not ask for, or accept, them here, and never write back one the guest typed`;
667
+ // ⚠️ NO CODE (0.61.0) - see the top of this file: the page is the account's own browser's.
668
+ const where = `The page opens only in the browser they signed in to ${brand} with; anywhere else it first asks them to sign in to that same ${brand} account again.`;
629
669
  if (noCards)
630
670
  return {
631
- text: `A one-time page is ready for the guest to ${what} to their ${brand} account: ${url} - ${typed}. The page opens in the browser they signed in to ${brand} with, or asks them to sign in to ${brand} again first. It shows the code ${made.short}: tell the guest it must match the code you give them here, and to close the page if it does not. The link works once, for ${minutes} minutes. When they say they are done, ${names.view} shows what is linked.`,
671
+ text: `A one-time page is ready for the guest to ${what} to their ${brand} account: ${url} - ${typed}. ${where} The link works once, for ${minutes} minutes. When they say they are done, ${names.view} shows what is linked.`,
632
672
  structured: {
633
673
  view: 'account-link',
634
674
  brand,
635
675
  group: m.code,
636
676
  url,
637
- shortCode: made.short,
638
677
  expiresAt,
639
678
  expiresInSeconds: Math.round(linkRequests.ttlMs / 1000),
640
679
  },
641
680
  };
642
681
  return {
643
- text: `A one-time page is ready for the guest to ${what} to their ${brand} account, opened from the card: ${typed}. The card shows a code the page shows too; the link works once, for ${minutes} minutes.`,
682
+ text: `A one-time page is ready for the guest to ${what} to their ${brand} account, opened from the card: ${typed}. ${where} The link works once, for ${minutes} minutes.`,
644
683
  structured: {
645
684
  view: 'account-link',
646
685
  brand,
@@ -648,7 +687,7 @@ export const makeAccount = (opts) => {
648
687
  expiresAt,
649
688
  expiresInSeconds: Math.round(linkRequests.ttlMs / 1000),
650
689
  },
651
- meta: { [LINK_META_KEY]: { url, shortCode: made.short, expiresAt, group: m.code } },
690
+ meta: { [LINK_META_KEY]: { url, expiresAt, group: m.code } },
652
691
  };
653
692
  };
654
693
  const handle = async (name, args, call) => {
@@ -675,7 +714,7 @@ export const makeAccount = (opts) => {
675
714
  if (name === names.view) {
676
715
  const s = await checked(key);
677
716
  if (s)
678
- return signedInAnswer(s, '');
717
+ return signedInAnswer(s, '', noCards);
679
718
  const waiting = requests.openFor(key);
680
719
  // ⚠️ THE ASSISTANT, WHERE A CARD IS DRAWN, IS NOT TOLD "NOBODY" (0.56.1,
681
720
  // robin 11-06): claude.ai sent one conversation's calls by several
@@ -724,7 +763,7 @@ export const makeAccount = (opts) => {
724
763
  const s = await checked(key);
725
764
  if (s)
726
765
  return {
727
- ...signedInAnswer(s, ''),
766
+ ...signedInAnswer(s, '', noCards),
728
767
  text: `Already signed in to ${whoSaid(s)}: there is nothing to open. To use another account, ${names.signOut} first. ${NO_PRICE}`,
729
768
  };
730
769
  if (counters.links.count(key) >= ACCOUNT_LIMITS.linksPerConversation) {
@@ -825,7 +864,7 @@ export const makeAccount = (opts) => {
825
864
  name: names.view,
826
865
  // ⚠️ ONLY WHEN ASKED (robin 11-06, claude.ai): the assistant called it on its
827
866
  // own 40 ms after a list, and ended its list with "I can't see your sign-in".
828
- description: `Whether the guest is signed in to their ${brand} account in this conversation, and the name the account goes by - only when the guest asks about their account or whether they are signed in; never on your own, and not alongside a search. Its user name and contact details are not given: they are on ${brand}'s account page.`,
867
+ description: `Whether the guest is signed in to their ${brand} account in this conversation, and the name the account goes by (its nickname, or its user name where it has none) - only when the guest asks about their account or whether they are signed in; never on your own, and not alongside a search. Its contact details are not given: they are on ${brand}'s account page.`,
829
868
  annotations: {
830
869
  title: `My ${brand} account`,
831
870
  readOnlyHint: true,
@@ -853,7 +892,7 @@ export const makeAccount = (opts) => {
853
892
  name: names.link,
854
893
  // ⚠️ NOTHING ABOUT THE GUEST IS ASKED FOR HERE - the group's email and
855
894
  // password are typed on our page, never in the chat.
856
- description: `Links one hotel group's loyalty membership to the guest's ${brand} account - or joins that group and links the new membership, or unlinks it - on ${brand}'s own web page: answers with a one-time link and a short code the page shows too. Needs the guest signed in to ${brand}. Takes no personal details. Groups: ${memberships.map((m) => `\`${m.code}\` (${groupName(m)})`).join(', ')}.`,
895
+ description: `Links one hotel group's loyalty membership to the guest's ${brand} account - or joins that group and links the new membership, or unlinks it - on ${brand}'s own web page: answers with a one-time link, which opens in the browser the guest signed in to ${brand} with. Needs the guest signed in to ${brand}. Takes no personal details. Groups: ${memberships.map((m) => `\`${m.code}\` (${groupName(m)})`).join(', ')}.`,
857
896
  annotations: {
858
897
  title: 'Link a hotel membership',
859
898
  readOnlyHint: false,
@@ -947,7 +986,6 @@ export const makeAccount = (opts) => {
947
986
  group: STR,
948
987
  signedIn: { type: 'boolean' },
949
988
  url: STR,
950
- shortCode: STR,
951
989
  expiresAt: STR,
952
990
  expiresInSeconds: { type: 'number' },
953
991
  account: { type: 'object' },
@@ -1082,6 +1120,10 @@ export const makeAccount = (opts) => {
1082
1120
  // here. A link opened anywhere else - forwarded, or made by someone holding
1083
1121
  // the conversation's trip id - links nothing: a membership could otherwise
1084
1122
  // be put on somebody else's account, or somebody else's taken onto ours.
1123
+ // That is the whole of its guard: the pages show no code to compare (0.61.0,
1124
+ // 总线程 11-10) - another account's cookie is asked to sign in again
1125
+ // (`ownerOf` wants the same conversation AND the same sign-in), and signing in
1126
+ // again as another account is refused (`reauth_other`).
1085
1127
  const linkState = (r) => {
1086
1128
  const st = linkRequests.state(r, false);
1087
1129
  if (st !== 'open')
@@ -1095,33 +1137,33 @@ export const makeAccount = (opts) => {
1095
1137
  ? { id: at.id, s: at.s }
1096
1138
  : null;
1097
1139
  };
1098
- const accountNameOf = (s) => s.shown.displayName || s.shown.userName || '';
1099
- const groupPage = (c, code, r, s, lang, mode, error, values) => {
1140
+ const groupPage = (c, code, r, s, lang, mode, error, values, said) => {
1100
1141
  const m = groupOf(r.link?.group);
1101
1142
  return send(c, 200, linkGroupPage(brandPage, {
1102
1143
  lang,
1103
- short: r.short,
1104
1144
  code,
1105
1145
  csrf: linkCsrf(r),
1106
- words: r.words,
1107
- // The group as the page's reader knows it: 「亚朵」 on a Chinese page (0.60.1).
1146
+ // The group as the page's reader knows it: 「亚朵」 on a Chinese page (0.60.1),
1147
+ // over its logo (0.61.0).
1108
1148
  group: m ? groupIn(m, lang) : String(r.link?.group),
1109
- accountName: accountNameOf(s),
1149
+ ...(m && logoPath(m.code) ? { logo: logoPath(m.code) } : {}),
1150
+ accountName: nameOf(s),
1110
1151
  mode: mode === 'up' && m?.join === true ? 'up' : 'in',
1111
1152
  ...(error ? { error: say(lang, error, m ? groupIn(m, lang) : brand) } : {}),
1153
+ ...(error && said ? { said } : {}),
1112
1154
  ...(values ? { values } : {}),
1113
1155
  }));
1114
1156
  };
1115
- const reauthPage = (c, code, r, lang, error) => {
1157
+ const reauthPage = (c, code, r, lang, error, said) => {
1116
1158
  const m = groupOf(r.link?.group);
1117
1159
  return send(c, 200, linkReauthPage(brandPage, {
1118
1160
  lang,
1119
- short: r.short,
1120
1161
  code,
1121
1162
  csrf: linkCsrf(r),
1122
- words: r.words,
1123
- group: m ? groupName(m) : String(r.link?.group),
1163
+ group: m ? groupIn(m, lang) : String(r.link?.group),
1164
+ ...(m && logoPath(m.code) ? { logo: logoPath(m.code) } : {}),
1124
1165
  ...(error ? { error: say(lang, error, brand) } : {}),
1166
+ ...(error && said ? { said } : {}),
1125
1167
  }));
1126
1168
  };
1127
1169
  const linkGet = (c, code, r) => {
@@ -1188,7 +1230,10 @@ export const makeAccount = (opts) => {
1188
1230
  linkRequests.reopen(r);
1189
1231
  triedOutcome = notThere(e) ? 'unknown' : 'failed';
1190
1232
  log(`[account] a re-sign-in for a membership link of ${tag(r.key)} refused (${codeOf(e)})`);
1191
- return reauthPage(c, code, r, lang, notThere(e) ? 'busy' : 'sign_in_failed');
1233
+ const said = saidBy(e);
1234
+ return said
1235
+ ? reauthPage(c, code, r, lang, 'sign_in_refused', said)
1236
+ : reauthPage(c, code, r, lang, notThere(e) ? 'busy' : 'sign_in_failed');
1192
1237
  }
1193
1238
  finally {
1194
1239
  nameFailures.leave(named, triedOutcome);
@@ -1221,7 +1266,7 @@ export const makeAccount = (opts) => {
1221
1266
  phone: formStr(body.phone, LIMITS.mobile).trim(),
1222
1267
  }
1223
1268
  : { identity: formStr(body.identity, 120).trim() };
1224
- const again = (error, as = up ? 'up' : 'in', kept = values) => groupPage(c, code, r, owner.s, lang, as, error, kept);
1269
+ const again = (error, as = up ? 'up' : 'in', kept = values, said) => groupPage(c, code, r, owner.s, lang, as, error, kept, said);
1225
1270
  const phone = (values.phone ?? '').replace(/[\s().-]/g, '');
1226
1271
  if (up) {
1227
1272
  if (!values.name || !values.email || !password)
@@ -1269,6 +1314,9 @@ export const makeAccount = (opts) => {
1269
1314
  linkRequests.reopen(r);
1270
1315
  outcome = otaNotThere(e) ? 'unknown' : 'failed';
1271
1316
  log(`[account] a membership for ${tag(r.key)} refused (${codeOf(e)})`);
1317
+ const said = saidBy(e);
1318
+ if (said)
1319
+ return again('join_refused', 'up', values, said);
1272
1320
  return again(otaNotThere(e) ? 'link_busy' : 'join_failed');
1273
1321
  }
1274
1322
  }
@@ -1285,8 +1333,11 @@ export const makeAccount = (opts) => {
1285
1333
  linkRequests.reopen(r);
1286
1334
  outcome = otaNotThere(e) ? 'unknown' : 'failed';
1287
1335
  log(`[account] a membership link for ${tag(r.key)} refused (${codeOf(e)})`);
1336
+ const said = saidBy(e);
1288
1337
  if (up)
1289
- return again('joined_not_linked', 'in', { identity: values.email ?? '' });
1338
+ return again('joined_not_linked', 'in', { identity: values.email ?? '' }, said);
1339
+ if (said)
1340
+ return again('link_refused', 'in', values, said);
1290
1341
  return again(otaNotThere(e) ? 'link_busy' : otaWrong(e) ? 'link_failed' : 'link_unconfirmed');
1291
1342
  }
1292
1343
  outcome = 'ok';
@@ -1310,7 +1361,7 @@ export const makeAccount = (opts) => {
1310
1361
  log(`[account] ${tag(r.key)} linked a ${m.code} membership${up ? ' it made' : ''}`);
1311
1362
  return send(c, 200, linkedPage(brandPage, {
1312
1363
  lang,
1313
- group: groupName(m),
1364
+ group: groupIn(m, lang),
1314
1365
  ...(link.label ? { label: link.label } : {}),
1315
1366
  }));
1316
1367
  }
@@ -1378,7 +1429,7 @@ export const makeAccount = (opts) => {
1378
1429
  }
1379
1430
  : { account: formStr(body.account, LIMITS.account).trim() };
1380
1431
  const password = formStr(body.password, LIMITS.password);
1381
- const again = (error, as = up ? 'up' : 'in', kept = values) => send(c, 200, loginPage(brandPage, {
1432
+ const again = (error, as = up ? 'up' : 'in', kept = values, said) => send(c, 200, loginPage(brandPage, {
1382
1433
  lang,
1383
1434
  short: r.short,
1384
1435
  code,
@@ -1387,6 +1438,7 @@ export const makeAccount = (opts) => {
1387
1438
  form: as,
1388
1439
  values: kept,
1389
1440
  error: errorOf(lang, error),
1441
+ ...(said ? { said } : {}),
1390
1442
  }));
1391
1443
  // What the form itself can tell, without asking the mall.
1392
1444
  const mobile = (values.mobile ?? '').replace(/[\s().-]/g, '');
@@ -1444,6 +1496,9 @@ export const makeAccount = (opts) => {
1444
1496
  requests.reopen(r);
1445
1497
  outcome = notThere(e) ? 'unknown' : 'failed';
1446
1498
  log(`[account] an account for ${tag(r.key)} refused (${codeOf(e)})`);
1499
+ const said = saidBy(e);
1500
+ if (said)
1501
+ return again('register_refused', 'up', values, said);
1447
1502
  return again(notThere(e) ? 'busy' : 'register_failed');
1448
1503
  }
1449
1504
  outcome = 'ok';
@@ -1453,7 +1508,7 @@ export const makeAccount = (opts) => {
1453
1508
  catch (e) {
1454
1509
  requests.reopen(r);
1455
1510
  log(`[account] an account was made for ${tag(r.key)}; signing in refused (${codeOf(e)})`);
1456
- return again('registered_not_signed_in', 'in', { account: values.userName ?? '' });
1511
+ return again('registered_not_signed_in', 'in', { account: values.userName ?? '' }, saidBy(e));
1457
1512
  }
1458
1513
  }
1459
1514
  else {
@@ -1465,8 +1520,16 @@ export const makeAccount = (opts) => {
1465
1520
  requests.reopen(r);
1466
1521
  outcome = notThere(e) ? 'unknown' : 'failed';
1467
1522
  log(`[account] a sign-in for ${tag(r.key)} refused (${codeOf(e)})`);
1468
- // ⚠️ OUR WORDS, NOT THE MALL'S (Nexva's review P3): theirs told a taken
1469
- // user name from a wrong password - a way to probe for accounts.
1523
+ // ⚠️ THE MALL'S OWN WORDS, UNDER A LINE OF OURS THAT GUESSES NOTHING
1524
+ // (0.61.1, robin: 供应方原文照原样显示; questions #55 - every no is their
1525
+ // 500, and our guess 「用户名或密码不对」 was as likely wrong). Nexva's
1526
+ // review P3 kept them off the page because they can tell a taken user name
1527
+ // from a wrong password; what still bounds that probe is the per-name
1528
+ // count above and the sign-ins-per-minute for everyone. No words from
1529
+ // them (a timeout, no answer, a fault with nothing said): ours, as before.
1530
+ const said = saidBy(e);
1531
+ if (said)
1532
+ return again('sign_in_refused', 'in', values, said);
1470
1533
  return again(notThere(e) ? 'busy' : 'sign_in_failed');
1471
1534
  }
1472
1535
  finally {
@@ -1498,7 +1561,7 @@ export const makeAccount = (opts) => {
1498
1561
  log(`[account] ${up ? 'an account was made and signed in' : 'signed in'} for ${tag(r.key)}`);
1499
1562
  return send(c, 200, signedInPage(brandPage, {
1500
1563
  lang,
1501
- name: s.shown.displayName || s.shown.userName || '',
1564
+ name: nameOf(s),
1502
1565
  account: !!id,
1503
1566
  }));
1504
1567
  });
@@ -1518,7 +1581,25 @@ export const makeAccount = (opts) => {
1518
1581
  lang,
1519
1582
  shown: at.s.shown,
1520
1583
  csrf: at.ws.csrf,
1521
- ...(linking ? { memberships: membershipRows(at.s, true) } : {}),
1584
+ // The card's rows, in the page's language and with each group's logo (0.61.0).
1585
+ ...(linking
1586
+ ? {
1587
+ memberships: membershipRows(at.s, true).map((row) => {
1588
+ const m = groupOf(row.group);
1589
+ const logo = logoPath(row.group);
1590
+ return {
1591
+ group: row.group,
1592
+ name: m ? groupIn(m, lang) : row.name,
1593
+ ...(logo ? { logo } : {}),
1594
+ linked: row.linked,
1595
+ ...(row.label ? { label: row.label } : {}),
1596
+ ...(row.numberMasked ? { numberMasked: row.numberMasked } : {}),
1597
+ signIn: row.signIn,
1598
+ join: row.join,
1599
+ };
1600
+ }),
1601
+ }
1602
+ : {}),
1522
1603
  }));
1523
1604
  });
1524
1605
  app.post('/account', form, async (c) => {
@@ -1587,25 +1668,27 @@ export const makeAccount = (opts) => {
1587
1668
  handle,
1588
1669
  meta: (key, { cards, ours }) => {
1589
1670
  const s = store.get(key);
1590
- // ⚠️ THE USER NAME ON THE CARD ONLY (robin 11-06: 「登录完,我们卡片不显示
1591
- // 用户名之类的吗」; 总线程 0.56.1): where a card is drawn its name is the
1592
- // nickname, else the user name; where none is - and a client may hand
1593
- // `_meta` to its model - the nickname or nothing, as every answer the
1594
- // model reads (review P2-2).
1595
- //
1596
- // ⚠️ AND ONLY TO ITS OWN CONVERSATION (0.59.0, review C2). A call that names
1597
- // another conversation's trip is the card's - or risk A's attacker, with
1598
- // the trip id and a client that says it draws cards, which the server
1599
- // cannot tell from the card. The user name signs in: handed to them, with
1600
- // the per-name limit, it locks the member out. Such a call is given the
1601
- // nickname at most - what the card's own account answer says anyway - and
1602
- // no `name` at all where there is none; the card keeps the name its
1603
- // conversation's answers gave it (card.ts `readAccountMeta`).
1604
- const name = !s
1605
- ? undefined
1606
- : cards && ours
1607
- ? s.shown.displayName || s.shown.userName || ''
1608
- : s.shown.displayName || undefined;
1671
+ // ⚠️ THE NAME IT GOES BY - THE NICKNAME, ELSE THE USER NAME - TO EVERY CALL
1672
+ // (0.61.0, robin 11-10; 总线程 weighed it): the words say the same name (`nameOf`),
1673
+ // and the card in claude.ai, whose calls name the conversation's trip (ours=false),
1674
+ // showed 「已登录」 for want of it. Before, a call naming a trip had the nickname at
1675
+ // most (0.59.0, review C2: the user name, with the per-name limit, could lock the
1676
+ // member out); 总线程 11-10: a trip id lives in its conversation alone, the user
1677
+ // name stands with the nickname, and the per-name limit still holds.
1678
+ const name = s ? nameOf(s) || undefined : undefined;
1679
+ // ⚠️ THE ACCOUNT'S FACTS, FOR A CARD ALONE (0.61.0, robin 11-10: the card's account
1680
+ // view is the web page's): the user name, and the email and phone MASKED as the page
1681
+ // masks them (store.ts `shownOf`) - never whole, never the real name, never in the
1682
+ // words. Only to a session that draws cards: `_meta` may reach the model of one
1683
+ // that does not. Whichever conversation the call names, as the hotel memberships'
1684
+ // rows are - in claude.ai the card's calls all name the trip.
1685
+ const facts = s && cards
1686
+ ? {
1687
+ ...(s.shown.userName ? { userName: s.shown.userName } : {}),
1688
+ ...(s.shown.email ? { email: s.shown.email } : {}),
1689
+ ...(s.shown.mobile ? { mobile: s.shown.mobile } : {}),
1690
+ }
1691
+ : undefined;
1609
1692
  return {
1610
1693
  [ACCOUNT_META_KEY]: {
1611
1694
  from: opts.from,
@@ -1615,6 +1698,7 @@ export const makeAccount = (opts) => {
1615
1698
  : { signIn: names.signIn, view: names.view, signOut: names.signOut, card: names.card },
1616
1699
  signedIn: !!s,
1617
1700
  ...(name !== undefined ? { name } : {}),
1701
+ ...(facts && Object.keys(facts).length ? { facts } : {}),
1618
1702
  // The hotel memberships, one row a group: to a session that draws cards,
1619
1703
  // whichever conversation the call names (0.59.1, 总线程 11-09). In claude.ai
1620
1704
  // the card's own calls name the conversation's trip (`ours` is false) and