@curless/hotel-storefront 0.85.0 → 0.86.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.
Files changed (207) hide show
  1. package/dist/server.d.ts +1 -1
  2. package/dist/server.js +1 -1
  3. package/dist/tools/accept-terms.d.ts +4 -0
  4. package/dist/tools/accept-terms.d.ts.map +1 -0
  5. package/dist/tools/accept-terms.js +26 -0
  6. package/dist/tools/accept-terms.js.map +1 -0
  7. package/dist/tools/add-booking-addon.d.ts +4 -0
  8. package/dist/tools/add-booking-addon.d.ts.map +1 -0
  9. package/dist/tools/add-booking-addon.js +44 -0
  10. package/dist/tools/add-booking-addon.js.map +1 -0
  11. package/dist/tools/add-to-trip.d.ts +4 -0
  12. package/dist/tools/add-to-trip.d.ts.map +1 -0
  13. package/dist/tools/add-to-trip.js +49 -0
  14. package/dist/tools/add-to-trip.js.map +1 -0
  15. package/dist/tools/all-tools.d.ts +1342 -0
  16. package/dist/tools/all-tools.d.ts.map +1 -0
  17. package/dist/tools/all-tools.js +954 -0
  18. package/dist/tools/all-tools.js.map +1 -0
  19. package/dist/tools/answer.d.ts +3 -0
  20. package/dist/tools/answer.d.ts.map +1 -0
  21. package/dist/tools/answer.js +104 -0
  22. package/dist/tools/answer.js.map +1 -0
  23. package/dist/tools/args.d.ts +149 -0
  24. package/dist/tools/args.d.ts.map +1 -0
  25. package/dist/tools/args.js +176 -0
  26. package/dist/tools/args.js.map +1 -0
  27. package/dist/tools/base-output-schemas.d.ts +3 -0
  28. package/dist/tools/base-output-schemas.d.ts.map +1 -0
  29. package/dist/tools/base-output-schemas.js +380 -0
  30. package/dist/tools/base-output-schemas.js.map +1 -0
  31. package/dist/tools/book-picked.d.ts +4 -0
  32. package/dist/tools/book-picked.d.ts.map +1 -0
  33. package/dist/tools/book-picked.js +14 -0
  34. package/dist/tools/book-picked.js.map +1 -0
  35. package/dist/tools/booking-answer.d.ts +24 -0
  36. package/dist/tools/booking-answer.d.ts.map +1 -0
  37. package/dist/tools/booking-answer.js +485 -0
  38. package/dist/tools/booking-answer.js.map +1 -0
  39. package/dist/tools/buy-shop-item.d.ts +4 -0
  40. package/dist/tools/buy-shop-item.d.ts.map +1 -0
  41. package/dist/tools/buy-shop-item.js +45 -0
  42. package/dist/tools/buy-shop-item.js.map +1 -0
  43. package/dist/tools/call.d.ts +11 -0
  44. package/dist/tools/call.d.ts.map +1 -0
  45. package/dist/tools/call.js +2 -0
  46. package/dist/tools/call.js.map +1 -0
  47. package/dist/tools/cancel-facts.d.ts +281 -0
  48. package/dist/tools/cancel-facts.d.ts.map +1 -0
  49. package/dist/tools/cancel-facts.js +309 -0
  50. package/dist/tools/cancel-facts.js.map +1 -0
  51. package/dist/tools/cancel.d.ts +4 -0
  52. package/dist/tools/cancel.d.ts.map +1 -0
  53. package/dist/tools/cancel.js +364 -0
  54. package/dist/tools/cancel.js.map +1 -0
  55. package/dist/tools/card-addons.d.ts +4 -0
  56. package/dist/tools/card-addons.d.ts.map +1 -0
  57. package/dist/tools/card-addons.js +76 -0
  58. package/dist/tools/card-addons.js.map +1 -0
  59. package/dist/tools/change-booking.d.ts +4 -0
  60. package/dist/tools/change-booking.d.ts.map +1 -0
  61. package/dist/tools/change-booking.js +145 -0
  62. package/dist/tools/change-booking.js.map +1 -0
  63. package/dist/tools/clear-trip.d.ts +4 -0
  64. package/dist/tools/clear-trip.d.ts.map +1 -0
  65. package/dist/tools/clear-trip.js +10 -0
  66. package/dist/tools/clear-trip.js.map +1 -0
  67. package/dist/tools/compare.d.ts +4 -0
  68. package/dist/tools/compare.d.ts.map +1 -0
  69. package/dist/tools/compare.js +114 -0
  70. package/dist/tools/compare.js.map +1 -0
  71. package/dist/tools/current-trip.d.ts +70 -0
  72. package/dist/tools/current-trip.d.ts.map +1 -0
  73. package/dist/tools/current-trip.js +261 -0
  74. package/dist/tools/current-trip.js.map +1 -0
  75. package/dist/tools/deps.d.ts +229 -0
  76. package/dist/tools/deps.d.ts.map +1 -0
  77. package/dist/tools/deps.js +2 -0
  78. package/dist/tools/deps.js.map +1 -0
  79. package/dist/tools/follow-ups.d.ts +120 -0
  80. package/dist/tools/follow-ups.d.ts.map +1 -0
  81. package/dist/tools/follow-ups.js +369 -0
  82. package/dist/tools/follow-ups.js.map +1 -0
  83. package/dist/tools/forget-preferences.d.ts +4 -0
  84. package/dist/tools/forget-preferences.d.ts.map +1 -0
  85. package/dist/tools/forget-preferences.js +24 -0
  86. package/dist/tools/forget-preferences.js.map +1 -0
  87. package/dist/tools/get-hotel.d.ts +4 -0
  88. package/dist/tools/get-hotel.d.ts.map +1 -0
  89. package/dist/tools/get-hotel.js +324 -0
  90. package/dist/tools/get-hotel.js.map +1 -0
  91. package/dist/tools/hotel-choices.d.ts +132 -0
  92. package/dist/tools/hotel-choices.d.ts.map +1 -0
  93. package/dist/tools/hotel-choices.js +558 -0
  94. package/dist/tools/hotel-choices.js.map +1 -0
  95. package/dist/tools/itinerary.d.ts +4 -0
  96. package/dist/tools/itinerary.d.ts.map +1 -0
  97. package/dist/tools/itinerary.js +148 -0
  98. package/dist/tools/itinerary.js.map +1 -0
  99. package/dist/tools/list-booking-addons.d.ts +4 -0
  100. package/dist/tools/list-booking-addons.d.ts.map +1 -0
  101. package/dist/tools/list-booking-addons.js +21 -0
  102. package/dist/tools/list-booking-addons.js.map +1 -0
  103. package/dist/tools/list-bookings.d.ts +4 -0
  104. package/dist/tools/list-bookings.d.ts.map +1 -0
  105. package/dist/tools/list-bookings.js +119 -0
  106. package/dist/tools/list-bookings.js.map +1 -0
  107. package/dist/tools/list-extras.d.ts +4 -0
  108. package/dist/tools/list-extras.d.ts.map +1 -0
  109. package/dist/tools/list-extras.js +90 -0
  110. package/dist/tools/list-extras.js.map +1 -0
  111. package/dist/tools/list-hotels.d.ts +4 -0
  112. package/dist/tools/list-hotels.d.ts.map +1 -0
  113. package/dist/tools/list-hotels.js +891 -0
  114. package/dist/tools/list-hotels.js.map +1 -0
  115. package/dist/tools/list-shop-items.d.ts +4 -0
  116. package/dist/tools/list-shop-items.d.ts.map +1 -0
  117. package/dist/tools/list-shop-items.js +34 -0
  118. package/dist/tools/list-shop-items.js.map +1 -0
  119. package/dist/tools/list-shop-orders.d.ts +4 -0
  120. package/dist/tools/list-shop-orders.d.ts.map +1 -0
  121. package/dist/tools/list-shop-orders.js +22 -0
  122. package/dist/tools/list-shop-orders.js.map +1 -0
  123. package/dist/tools/look-up.d.ts +4 -0
  124. package/dist/tools/look-up.d.ts.map +1 -0
  125. package/dist/tools/look-up.js +170 -0
  126. package/dist/tools/look-up.js.map +1 -0
  127. package/dist/tools/output-schemas.d.ts +645 -0
  128. package/dist/tools/output-schemas.d.ts.map +1 -0
  129. package/dist/tools/output-schemas.js +503 -0
  130. package/dist/tools/output-schemas.js.map +1 -0
  131. package/dist/tools/paid-lines.d.ts +718 -0
  132. package/dist/tools/paid-lines.d.ts.map +1 -0
  133. package/dist/tools/paid-lines.js +359 -0
  134. package/dist/tools/paid-lines.js.map +1 -0
  135. package/dist/tools/pay-with-union-pay.d.ts +4 -0
  136. package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
  137. package/dist/tools/pay-with-union-pay.js +112 -0
  138. package/dist/tools/pay-with-union-pay.js.map +1 -0
  139. package/dist/tools/payment-words.d.ts +269 -0
  140. package/dist/tools/payment-words.d.ts.map +1 -0
  141. package/dist/tools/payment-words.js +365 -0
  142. package/dist/tools/payment-words.js.map +1 -0
  143. package/dist/tools/pick-room.d.ts +4 -0
  144. package/dist/tools/pick-room.d.ts.map +1 -0
  145. package/dist/tools/pick-room.js +23 -0
  146. package/dist/tools/pick-room.js.map +1 -0
  147. package/dist/tools/policies.d.ts +4 -0
  148. package/dist/tools/policies.d.ts.map +1 -0
  149. package/dist/tools/policies.js +74 -0
  150. package/dist/tools/policies.js.map +1 -0
  151. package/dist/tools/pricing.d.ts +55 -0
  152. package/dist/tools/pricing.d.ts.map +1 -0
  153. package/dist/tools/pricing.js +260 -0
  154. package/dist/tools/pricing.js.map +1 -0
  155. package/dist/tools/put-room-line.d.ts +12 -0
  156. package/dist/tools/put-room-line.d.ts.map +1 -0
  157. package/dist/tools/put-room-line.js +314 -0
  158. package/dist/tools/put-room-line.js.map +1 -0
  159. package/dist/tools/quote-card.d.ts +234 -0
  160. package/dist/tools/quote-card.d.ts.map +1 -0
  161. package/dist/tools/quote-card.js +375 -0
  162. package/dist/tools/quote-card.js.map +1 -0
  163. package/dist/tools/refund-booking.d.ts +4 -0
  164. package/dist/tools/refund-booking.d.ts.map +1 -0
  165. package/dist/tools/refund-booking.js +112 -0
  166. package/dist/tools/refund-booking.js.map +1 -0
  167. package/dist/tools/request-booking.d.ts +4 -0
  168. package/dist/tools/request-booking.d.ts.map +1 -0
  169. package/dist/tools/request-booking.js +5 -0
  170. package/dist/tools/request-booking.js.map +1 -0
  171. package/dist/tools/request-words.d.ts +238 -0
  172. package/dist/tools/request-words.d.ts.map +1 -0
  173. package/dist/tools/request-words.js +487 -0
  174. package/dist/tools/request-words.js.map +1 -0
  175. package/dist/tools/room-choices.d.ts +64 -0
  176. package/dist/tools/room-choices.d.ts.map +1 -0
  177. package/dist/tools/room-choices.js +348 -0
  178. package/dist/tools/room-choices.js.map +1 -0
  179. package/dist/tools/session-notes.d.ts +164 -0
  180. package/dist/tools/session-notes.d.ts.map +1 -0
  181. package/dist/tools/session-notes.js +412 -0
  182. package/dist/tools/session-notes.js.map +1 -0
  183. package/dist/tools/sign-in.d.ts +4 -0
  184. package/dist/tools/sign-in.d.ts.map +1 -0
  185. package/dist/tools/sign-in.js +72 -0
  186. package/dist/tools/sign-in.js.map +1 -0
  187. package/dist/tools/sign-out.d.ts +4 -0
  188. package/dist/tools/sign-out.d.ts.map +1 -0
  189. package/dist/tools/sign-out.js +13 -0
  190. package/dist/tools/sign-out.js.map +1 -0
  191. package/dist/tools/terms-answer.d.ts +114 -0
  192. package/dist/tools/terms-answer.d.ts.map +1 -0
  193. package/dist/tools/terms-answer.js +475 -0
  194. package/dist/tools/terms-answer.js.map +1 -0
  195. package/dist/tools/tool-set.d.ts +1474 -0
  196. package/dist/tools/tool-set.d.ts.map +1 -0
  197. package/dist/tools/tool-set.js +497 -0
  198. package/dist/tools/tool-set.js.map +1 -0
  199. package/dist/tools/view-trip.d.ts +4 -0
  200. package/dist/tools/view-trip.d.ts.map +1 -0
  201. package/dist/tools/view-trip.js +7 -0
  202. package/dist/tools/view-trip.js.map +1 -0
  203. package/dist/tools.d.ts +13 -2089
  204. package/dist/tools.d.ts.map +1 -1
  205. package/dist/tools.js +11 -10685
  206. package/dist/tools.js.map +1 -1
  207. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ import type { Booking, DateOption, HotelDetail, HotelFacts, Room, Stay, TermsToAgree } from '../types.js';
2
+ import type { ToolContext, ToolDeps } from './deps.js';
3
+ /**
4
+ * The card's copy of the terms to agree to, beside the answer (`_meta`).
5
+ *
6
+ * ⚠️ THE TERMS' REF AND FULL TEXT ARE THE CARD'S, NEVER THE MODEL'S (总线程's
7
+ * review of 0.63.0, binding): a group's terms are text a stranger wrote, and a
8
+ * model that reads them can be talked into acting on them (prompt injection).
9
+ * The model gets facts and the sentence `termsSaid`; the card gets this, in
10
+ * `_meta` - and only a client that said it draws cards (`ToolContext.drawsCards`):
11
+ * some hosts hand `_meta` to their model.
12
+ */
13
+ export declare const TERMS_META_KEY = "curless/terms";
14
+ /**
15
+ * The photographs of each room type the card's gallery opens, beside the answer (`_meta`):
16
+ * `{ [hotelId]: { [roomTypeId]: string[] } }`, the cover first, once a type (never once a
17
+ * rate) and only for a type with more than one. ⚠️ NEVER IN WHAT THE MODEL READS (robin
18
+ * 11-19, 总线程): a Huazhu hotel has up to 84 room photographs, the model needs no address of
19
+ * them - and only to a client that said it draws cards, as some hosts hand `_meta` to their
20
+ * model. The card puts a list back as the room's `images` (card.ts `withKept`).
21
+ */
22
+ export declare const ROOM_PHOTOS_META_KEY = "curless/room-photos";
23
+ /**
24
+ * The hotel's own photographs for the page's strip (0.77.1), beside the answer (`_meta`):
25
+ * `{ [hotelId]: { photos: string[], kinds: string[] } }` - the lead photograph (the one the
26
+ * page shows above the name) first, then cover, outside, facilities, surroundings, meeting
27
+ * rooms; `kinds[i]` is what `photos[i]` shows (`HotelPhotoKind`), for the card to name under
28
+ * it. At most 30, always two or more. ⚠️ NEVER IN WHAT THE MODEL READS, and only to a client
29
+ * that said it draws cards (as `ROOM_PHOTOS_META_KEY`).
30
+ */
31
+ export declare const HOTEL_PHOTOS_META_KEY = "curless/hotel-photos";
32
+ /**
33
+ * Where the hotel is, for the card's 「在地图中打开」 (0.77.1): `{ [hotelId]: { lat, lng } }`, the
34
+ * supplier's own coordinates (Huazhu: China's GCJ-02). The card makes the map link itself. Beside
35
+ * the answer, card clients only, never in what the model reads.
36
+ */
37
+ export declare const HOTEL_GEO_META_KEY = "curless/hotel-geo";
38
+ /** What the hotel page tells the model of the hotel itself - the same fields, as words (`HotelFacts`). */
39
+ export declare const hotelFactsText: (f: HotelFacts | undefined) => string;
40
+ /** The longest stretch of a group's refund terms put in the answer. */
41
+ export declare const TERMS_TEXT_MAX = 2000;
42
+ /**
43
+ * Terms a group sent back, for the GUEST to agree to - as the structure and as
44
+ * words, in the two kinds of host.
45
+ *
46
+ * ⚠️ THE MODEL CANNOT AGREE FOR THE GUEST, and no tool parameter means "agreed":
47
+ * the card's button (`acceptTerms`, the card's own tool) or the one-time page
48
+ * is the only way, and the words say so first. The text and the structure say
49
+ * the same (`termsSaid`) - the model reads the structure. Neither carries the
50
+ * terms' `ref` or their text: see `TERMS_META_KEY`.
51
+ */
52
+ /**
53
+ * Whether a link to our pages is handed out with the words of a Lax account cookie (0.84.0): a client
54
+ * that said it draws no card, on a deployment with `account.cookieSameSite: "Lax"` - see
55
+ * `ToolDeps.accountCookieLax`. A card host's words, and every word of the root deployment, as before.
56
+ */
57
+ export declare const inBrowserWords: (deps: ToolDeps, ctx: ToolContext) => boolean;
58
+ export declare const termsAnswer: (deps: ToolDeps, ctx: ToolContext, key: string, terms: TermsToAgree[]) => {
59
+ structured: Record<string, unknown>;
60
+ text: string;
61
+ meta?: Record<string, unknown>;
62
+ };
63
+ /**
64
+ * ⚠️ THE BOOKINGS, THE LATEST ORDERED FIRST (0.84.5, `data.bookingsByTime`; robin 11-26: 「我的预订没有排序,应该最近订的在最上面」;
65
+ * 0.84.4 had them in parts by state, which he did not see as an order): the card's own order, in words - ONE list,
66
+ * the booking made last on top, each line headed with when it was made (UTC, to the minute) and carrying its state
67
+ * and hotel (and its Chinese name) as ever, with one line of how many are in each state. A guest asking for one
68
+ * hotel's booking is answered from these lines. A booking whose time is not known or not to be trusted (none, not a
69
+ * date, before 2020, more than a day ahead of now) is listed after the others, the later check-in first, and says
70
+ * "booking time not known" - never a time we made up. "Stayed" is a check-out before today in UTC - a day out at
71
+ * most at either end of the world.
72
+ */
73
+ export declare const bookingsInTime: (list: Booking[], line: (b: Booking) => string, now: number) => string;
74
+ export declare const bookingLine: (deps: ToolDeps, b: Booking, noCards?: boolean) => string;
75
+ /**
76
+ * The window of nearby arrival dates, plus the one sentence worth saying about
77
+ * it in prose.
78
+ *
79
+ * ⚠️ THE SENTENCE IS SAID ONCE, OR NOT AT ALL. The window's prices belong to the
80
+ * card - the date picker puts each under its day (the hotel page's own strip of
81
+ * them was taken away, robin 2026-10-22); repeating them in text costs the
82
+ * model's context and tells it nothing it can act on. What prose is good
83
+ * for is the single fact a picture hides: that a date the guest did not ask
84
+ * about is cheaper, or - when the asked-for nights are gone - that a date
85
+ * nearby is free at all.
86
+ *
87
+ * ⚠️ AND IT NAMES THE DATE. "The one before" or "the third day" is meaningless
88
+ * the moment the card reflows or the guest is reading on a phone; a date is the
89
+ * same fact wherever it is read.
90
+ */
91
+ export declare const dateFlex: (dates: DateOption[], stay: Stay) => {
92
+ structured: Record<string, unknown>;
93
+ text: string;
94
+ };
95
+ /**
96
+ * The room types a guest can no longer book on these nights - for the card to
97
+ * say so, and not leave them out (r10 #10: a type the guest saw earlier
98
+ * vanished from the list, and the heading counted one fewer, without a word).
99
+ *
100
+ * ⚠️ AN ADDITIVE FIELD, NEVER THE TEXT. What the assistant is told is the rooms
101
+ * that can be booked, as before; this is only what the card draws, muted, at
102
+ * the end of the list. A type is listed when
103
+ * - the backend sends it with none left (`HotelDetail.soldOut`, or a room with
104
+ * `roomsLeft: 0`), or
105
+ * - it has some left, but fewer than the rooms asked for (`left`): a guest who
106
+ * asked for two rooms and was shown no type with one left was not told why.
107
+ * Not a type that sleeps fewer than the party (the backend never sends it), and
108
+ * not a type any of whose rates can be booked. One entry a type, with the facts
109
+ * the card says of a room and no price.
110
+ */
111
+ export declare const soldOutTypesOf: (detail: HotelDetail, enough: Room[], wanted: number) => Record<string, unknown>[];
112
+ /** A code that opens no booking here: where orders are the account's, no email would have opened it. */
113
+ export declare const noBookingLike: (deps: ToolDeps) => string;
114
+ //# sourceMappingURL=terms-answer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terms-answer.d.ts","sourceRoot":"","sources":["../../src/tools/terms-answer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAmBvD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAC5D;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD,0GAA0G;AAC1G,eAAO,MAAM,cAAc,GAAI,GAAG,UAAU,GAAG,SAAS,KAAG,MAS1D,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,cAAc,OAAQ,CAAC;AAEpC;;;;;;;;;GASG;AACH;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,QAAQ,EAAE,KAAK,WAAW,KAAG,OACV,CAAC;AAEzD,eAAO,MAAM,WAAW,GACtB,MAAM,QAAQ,EACd,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,OAAO,YAAY,EAAE,KACpB;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAkKrF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,OAAO,EAAE,EACf,MAAM,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,EAC5B,KAAK,MAAM,KACV,MA6CF,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,QAAQ,EAAE,GAAG,OAAO,EAAE,UAAU,OAAO,KAAG,MA+C3E,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,GACnB,OAAO,UAAU,EAAE,EACnB,MAAM,IAAI,KACT;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAiErD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,WAAW,EACnB,QAAQ,IAAI,EAAE,EACd,QAAQ,MAAM,KACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EA4BzB,CAAC;AAEF,wGAAwG;AACxG,eAAO,MAAM,aAAa,GAAI,MAAM,QAAQ,KAAG,MAGoE,CAAC"}
@@ -0,0 +1,475 @@
1
+ import { GUEST_ALONE, OPENS_SIGNED_IN } from '../account/page-words.js';
2
+ import { FULL_CAPABILITIES } from '../backend.js';
3
+ import { nights as nightsBetween } from '../dates.js';
4
+ import { stayWords } from '../hourly.js';
5
+ import { formatMoney, money } from '../money.js';
6
+ import { holderOf } from './cancel-facts.js';
7
+ import { differsSaid, shownPriceSaid } from './paid-lines.js';
8
+ import { LINK_CLOSED_WORDS, bookingNotes, clockWords, heldRoomsWords, hostOf, notSentStatus, payByWords, paymentWords, termsHeldWords, unconfirmedSaid, } from './payment-words.js';
9
+ import { couponName, withZh } from './quote-card.js';
10
+ import { bare } from './request-words.js';
11
+ import { listAnd } from './session-notes.js';
12
+ import { ordersByAccount } from './tool-set.js';
13
+ /**
14
+ * The card's copy of the terms to agree to, beside the answer (`_meta`).
15
+ *
16
+ * ⚠️ THE TERMS' REF AND FULL TEXT ARE THE CARD'S, NEVER THE MODEL'S (总线程's
17
+ * review of 0.63.0, binding): a group's terms are text a stranger wrote, and a
18
+ * model that reads them can be talked into acting on them (prompt injection).
19
+ * The model gets facts and the sentence `termsSaid`; the card gets this, in
20
+ * `_meta` - and only a client that said it draws cards (`ToolContext.drawsCards`):
21
+ * some hosts hand `_meta` to their model.
22
+ */
23
+ export const TERMS_META_KEY = 'curless/terms';
24
+ /**
25
+ * The photographs of each room type the card's gallery opens, beside the answer (`_meta`):
26
+ * `{ [hotelId]: { [roomTypeId]: string[] } }`, the cover first, once a type (never once a
27
+ * rate) and only for a type with more than one. ⚠️ NEVER IN WHAT THE MODEL READS (robin
28
+ * 11-19, 总线程): a Huazhu hotel has up to 84 room photographs, the model needs no address of
29
+ * them - and only to a client that said it draws cards, as some hosts hand `_meta` to their
30
+ * model. The card puts a list back as the room's `images` (card.ts `withKept`).
31
+ */
32
+ export const ROOM_PHOTOS_META_KEY = 'curless/room-photos';
33
+ /**
34
+ * The hotel's own photographs for the page's strip (0.77.1), beside the answer (`_meta`):
35
+ * `{ [hotelId]: { photos: string[], kinds: string[] } }` - the lead photograph (the one the
36
+ * page shows above the name) first, then cover, outside, facilities, surroundings, meeting
37
+ * rooms; `kinds[i]` is what `photos[i]` shows (`HotelPhotoKind`), for the card to name under
38
+ * it. At most 30, always two or more. ⚠️ NEVER IN WHAT THE MODEL READS, and only to a client
39
+ * that said it draws cards (as `ROOM_PHOTOS_META_KEY`).
40
+ */
41
+ export const HOTEL_PHOTOS_META_KEY = 'curless/hotel-photos';
42
+ /**
43
+ * Where the hotel is, for the card's 「在地图中打开」 (0.77.1): `{ [hotelId]: { lat, lng } }`, the
44
+ * supplier's own coordinates (Huazhu: China's GCJ-02). The card makes the map link itself. Beside
45
+ * the answer, card clients only, never in what the model reads.
46
+ */
47
+ export const HOTEL_GEO_META_KEY = 'curless/hotel-geo';
48
+ /** What the hotel page tells the model of the hotel itself - the same fields, as words (`HotelFacts`). */
49
+ export const hotelFactsText = (f) => {
50
+ if (!f)
51
+ return '';
52
+ const parts = [
53
+ f.phone ? `phone ${f.phone.zh} (from abroad ${f.phone.en})` : '',
54
+ f.openedYear ? `opened ${f.openedYear}` : '',
55
+ f.renovatedYear ? `renovated ${f.renovatedYear}` : '',
56
+ f.roomCount ? `${f.roomCount} rooms in all` : '',
57
+ ].filter(Boolean);
58
+ return parts.length ? `About the hotel: ${parts.join(', ')}.` : '';
59
+ };
60
+ /** The longest stretch of a group's refund terms put in the answer. */
61
+ export const TERMS_TEXT_MAX = 2_000;
62
+ /**
63
+ * Terms a group sent back, for the GUEST to agree to - as the structure and as
64
+ * words, in the two kinds of host.
65
+ *
66
+ * ⚠️ THE MODEL CANNOT AGREE FOR THE GUEST, and no tool parameter means "agreed":
67
+ * the card's button (`acceptTerms`, the card's own tool) or the one-time page
68
+ * is the only way, and the words say so first. The text and the structure say
69
+ * the same (`termsSaid`) - the model reads the structure. Neither carries the
70
+ * terms' `ref` or their text: see `TERMS_META_KEY`.
71
+ */
72
+ /**
73
+ * Whether a link to our pages is handed out with the words of a Lax account cookie (0.84.0): a client
74
+ * that said it draws no card, on a deployment with `account.cookieSameSite: "Lax"` - see
75
+ * `ToolDeps.accountCookieLax`. A card host's words, and every word of the root deployment, as before.
76
+ */
77
+ export const inBrowserWords = (deps, ctx) => deps.accountCookieLax === true && ctx.noCards === true;
78
+ export const termsAnswer = (deps, ctx, key, terms) => {
79
+ const t = deps.tools;
80
+ // A client that draws no card, or that never said it does, is given the page.
81
+ const onPage = !!ctx.noCards || !ctx.drawsCards;
82
+ const groupOf = (x) => withZh(x.groupName, x.groupNames, ctx.noCards);
83
+ const namesOf = (xs) => [...new Set(xs.map(groupOf))];
84
+ // Terms the group asked for when the booking was sent (`askedByGroup`, 0.67.0, questions
85
+ // #66): nothing is ordered, and the booking is sent once more when the guest has agreed.
86
+ const asked = terms.filter((x) => x.askedByGroup === 'terms' && !x.changed);
87
+ // …or to confirm the booking itself (`askedByGroup: 'confirm'`, questions #68).
88
+ // 0.67.1: with the order's `bookingId` the order EXISTS and its payment page is held -
89
+ // never "nothing has been ordered" of those.
90
+ const confirmOrder = terms.filter((x) => x.askedByGroup === 'confirm' && !x.changed && !!x.bookingId);
91
+ const confirm = terms.filter((x) => x.askedByGroup === 'confirm' && !x.changed && !x.bookingId);
92
+ const before = terms.filter((x) => !x.changed && !x.askedByGroup);
93
+ const changed = terms.filter((x) => x.changed);
94
+ const where = onPage
95
+ ? inBrowserWords(deps, ctx)
96
+ ? 'on the one-time page linked below, in their own browser, signed in to their account there'
97
+ : "on the one-time page linked below, which opens only in the browser signed in to the guest's account"
98
+ : `on the card, with its ${terms.every((x) => x.askedByGroup === 'confirm') ? 'Confirm' : 'Agree'} button`;
99
+ // ⚠️ EVERY BOOKING STARTS WITH ITS TERMS (Otaless 0.66.0, 8 booking/create, docs/
100
+ // otaless-hotels.md §15): nothing is ordered before the guest agrees - but terms the
101
+ // group answered an ORDER with (`changed`, 总线程 11-11, D) come after it was made:
102
+ // never "nothing is ordered" of those, and never "cancelling is free before paying".
103
+ const confirmCodes = confirmOrder.map((x) => x.confirmationCode ?? x.bookingId).filter(Boolean);
104
+ const codes = changed.map((x) => x.confirmationCode ?? x.bookingId).filter(Boolean);
105
+ // ⚠️ "THE GROUP MAY HAVE TERMS OF ITS OWN" IS NOT SAID OF THESE (0.67.0): the group has
106
+ // just asked for its own, and they are the ones below - the sentence would contradict it.
107
+ const all = namesOf(terms.filter((x) => !x.askedByGroup));
108
+ const termsSaid = [
109
+ before.length
110
+ ? // The facts, not a line to read out (robin 11-16 through 总线程, 0.72.3).
111
+ `Not booked yet, nothing ordered: the guest agrees to its cancellation terms themselves, ${where} - then it is booked.`
112
+ : '',
113
+ confirmOrder.length
114
+ ? `Not paid yet, and no payment page: ${listAnd(namesOf(confirmOrder))} made the order${confirmCodes.length ? ` (${confirmCodes.join(', ')})` : ''} and asks the guest to confirm what is below first. The guest confirms it themselves, ${where}; once they have, the payment page is given; if they have not confirmed by the time below, the order is cancelled.`
115
+ : '',
116
+ confirm.length
117
+ ? `Not booked yet: ${listAnd(namesOf(confirm))} asked, when the booking was sent, for the guest to confirm it first - what it asks to confirm is below; nothing has been ordered. The guest confirms it themselves, ${where}; once they have, the booking is sent again.`
118
+ : '',
119
+ // ⚠️ THE FACTS, NOT THE STORY (robin 11-16 through 总线程): "<group> asked, when the
120
+ // booking was sent, for…" was read out to the guest as it stood - the card no longer says
121
+ // it either. Not booked, nothing ordered, whose terms, who agrees and where, what then.
122
+ asked.length
123
+ ? `Not booked yet, nothing ordered: ${asked.length > 1 ? `${listAnd(namesOf(asked))} each have` : `${listAnd(namesOf(asked))} has`} terms of ${asked.length > 1 ? 'their' : 'its'} own, which the guest agrees to themselves, ${where} - then it is booked.`
124
+ : '',
125
+ changed.length
126
+ ? `Not paid yet, and no payment page: ${listAnd(namesOf(changed))} answered the order${codes.length ? ` (${codes.join(', ')})` : ''} with cancellation terms that are not the ones the guest saw before. The guest reads the new terms and decides, ${where}: if they agree, the payment page is given; if they have not agreed by the time below, the order is cancelled.`
127
+ : '',
128
+ // ⚠️ ALWAYS, UNTIL QUESTIONS #61 (3) IS ANSWERED (总线程 11-11, A).
129
+ all.length
130
+ ? `${listAnd(all)} may also have terms of ${all.length > 1 ? 'their' : 'its'} own when the booking is made, which are not shown here.`
131
+ : '',
132
+ 'You cannot agree for them, and do not ask them to say they agree in the chat.',
133
+ ]
134
+ .filter(Boolean)
135
+ .join(' ');
136
+ const entries = terms.map((x) => {
137
+ const link = onPage ? deps.termsLink?.(key, x.ref) : undefined;
138
+ return {
139
+ entry: {
140
+ group: x.group,
141
+ groupName: x.groupName,
142
+ ...(x.groupNames ? { groupNames: x.groupNames } : {}),
143
+ hotelId: x.hotelId,
144
+ hotelName: x.hotelName,
145
+ ...(x.hotelNames ? { hotelNames: x.hotelNames } : {}),
146
+ roomName: x.roomName,
147
+ stay: x.stay,
148
+ rooms: x.rooms,
149
+ total: formatMoney(x.total),
150
+ totalMoney: x.total,
151
+ // What the payment may be taken in, as the backend gave it (0.84.2, P1-4).
152
+ ...(x.payAs ? { payAs: formatMoney(x.payAs) } : {}),
153
+ // ⚠️ THE MOMENT ONLY (0.63.0 screenshots): the card writes it in the viewer's own
154
+ // language and time zone. "10:05 UTC, 10 Nov" here was drawn as is in a
155
+ // Chinese card - and it is not the hotel's clock anyway (no zone is sent).
156
+ until: x.until,
157
+ // Where the terms are from, and what is said beside them (0.66.0): none for the
158
+ // room said in our words, the group's own at booking always, an order's changed.
159
+ source: x.source ?? 'room',
160
+ // Not of terms the group has just asked for (0.67.0): they are its own terms.
161
+ ...(x.askedByGroup ? { askedByGroup: x.askedByGroup } : { more: true }),
162
+ ...(x.changed ? { changed: true } : {}),
163
+ ...((x.changed || (x.askedByGroup === 'confirm' && x.bookingId)) &&
164
+ (x.confirmationCode ?? x.bookingId)
165
+ ? { confirmationCode: x.confirmationCode ?? x.bookingId }
166
+ : {}),
167
+ ...(link ? { link } : {}),
168
+ },
169
+ link,
170
+ x,
171
+ };
172
+ });
173
+ const blocks = entries.map(({ link, x }) => {
174
+ const until = clockWords(x.until) ?? x.until;
175
+ const heldOrder = x.askedByGroup === 'confirm' && !x.changed && !!x.bookingId;
176
+ const code = x.changed || heldOrder ? (x.confirmationCode ?? x.bookingId) : undefined;
177
+ return [
178
+ `${withZh(x.hotelName, x.hotelNames, ctx.noCards)} · ${x.roomName} · ${stayWords(x.stay)} · ${x.rooms} ${x.rooms === 1 ? 'room' : 'rooms'} · ${formatMoney(x.total)} · ${x.groupName}${code ? ` · order ${code}` : ''}`,
179
+ x.source === 'none' ? `${x.groupName} gave no cancellation terms for this room.` : '',
180
+ // ⚠️ SAID BEFORE THE GUEST AGREES (0.84.2, the 11-25 code audit's P1-4; 总线程 11-25): the
181
+ // group's page may ask its own USD figure for this price - as the backend gave it.
182
+ x.payAs
183
+ ? `${x.groupName}'s payment page may ask ${formatMoney(x.payAs)} for it - ${x.groupName}'s own figure in ${x.payAs.currency} for this price, not converted here; tell the guest before they agree.`
184
+ : '',
185
+ x.changed
186
+ ? `They can be agreed to until ${until}; not agreed by then, the order is cancelled.`
187
+ : heldOrder
188
+ ? `It can be confirmed until ${until}; not confirmed by then, the order is cancelled.`
189
+ : x.askedByGroup === 'confirm'
190
+ ? `It can be confirmed until ${until}.`
191
+ : `They can be agreed to until ${until}.`,
192
+ onPage
193
+ ? link
194
+ ? inBrowserWords(deps, ctx)
195
+ ? `Give the guest this one-time link to read the terms and agree on ${deps.vocab.brand}'s page - it works once, until ${clockWords(link.expiresAt) ?? link.expiresAt}: ${link.url}. ${OPENS_SIGNED_IN} ${GUEST_ALONE} When they say they are done, call ${t.listBookings} to see the booking and its payment page.`
196
+ : `Give the guest this one-time link to read the terms and agree on ${deps.vocab.brand}'s page - it opens only in the browser signed in to their ${deps.vocab.brand} account, works once, until ${clockWords(link.expiresAt) ?? link.expiresAt}: ${link.url}. When they say they are done, call ${t.listBookings} to see the booking and its payment page.`
197
+ : x.changed
198
+ ? 'These terms can only be agreed to on a client that shows the card.'
199
+ : heldOrder
200
+ ? 'This can only be confirmed on a client that shows the card.'
201
+ : x.askedByGroup === 'confirm'
202
+ ? 'This can only be confirmed on a client that shows the card; nothing was ordered.'
203
+ : 'These terms can only be agreed to on a client that shows the card; nothing was ordered.'
204
+ : '',
205
+ ]
206
+ .filter(Boolean)
207
+ .join('\n');
208
+ });
209
+ return {
210
+ structured: { terms: entries.map((e) => e.entry), termsSaid },
211
+ text: [termsSaid, ...blocks].filter(Boolean).join('\n\n'),
212
+ ...((ctx.drawsCards && !ctx.noCards) || ctx.termsMeta
213
+ ? {
214
+ meta: {
215
+ [TERMS_META_KEY]: {
216
+ terms: terms.map((x) => ({
217
+ ref: x.ref,
218
+ group: x.group,
219
+ groupName: x.groupName,
220
+ ...(x.groupNames ? { groupNames: x.groupNames } : {}),
221
+ hotelId: x.hotelId,
222
+ hotelName: x.hotelName,
223
+ ...(x.hotelNames ? { hotelNames: x.hotelNames } : {}),
224
+ roomName: x.roomName,
225
+ stay: x.stay,
226
+ rooms: x.rooms,
227
+ total: formatMoney(x.total),
228
+ totalMoney: x.total,
229
+ ...(x.payAs ? { payAs: formatMoney(x.payAs) } : {}),
230
+ text: x.text,
231
+ until: x.until,
232
+ })),
233
+ },
234
+ },
235
+ }
236
+ : {}),
237
+ };
238
+ };
239
+ /**
240
+ * ⚠️ THE BOOKINGS, THE LATEST ORDERED FIRST (0.84.5, `data.bookingsByTime`; robin 11-26: 「我的预订没有排序,应该最近订的在最上面」;
241
+ * 0.84.4 had them in parts by state, which he did not see as an order): the card's own order, in words - ONE list,
242
+ * the booking made last on top, each line headed with when it was made (UTC, to the minute) and carrying its state
243
+ * and hotel (and its Chinese name) as ever, with one line of how many are in each state. A guest asking for one
244
+ * hotel's booking is answered from these lines. A booking whose time is not known or not to be trusted (none, not a
245
+ * date, before 2020, more than a day ahead of now) is listed after the others, the later check-in first, and says
246
+ * "booking time not known" - never a time we made up. "Stayed" is a check-out before today in UTC - a day out at
247
+ * most at either end of the world.
248
+ */
249
+ export const bookingsInTime = (list, line, now) => {
250
+ const today = new Date(now).toISOString().slice(0, 10);
251
+ const kind = (b) => b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed'
252
+ ? 'off'
253
+ : b.stay?.checkOut && b.stay.checkOut < today
254
+ ? 'past'
255
+ : b.status === 'awaiting-payment'
256
+ ? 'pay'
257
+ : 'up';
258
+ const madeAt = (b) => {
259
+ const t = typeof b.createdAt === 'string' ? Date.parse(b.createdAt) : Number.NaN;
260
+ return Number.isFinite(t) && t >= Date.UTC(2020, 0, 1) && t <= now + 86_400_000
261
+ ? t
262
+ : Number.NaN;
263
+ };
264
+ const ci = (b) => String(b.stay?.checkIn ?? '');
265
+ const sorted = [...list].sort((a, b) => {
266
+ const ta = madeAt(a);
267
+ const tb = madeAt(b);
268
+ if (Number.isNaN(ta) !== Number.isNaN(tb))
269
+ return Number.isNaN(ta) ? 1 : -1;
270
+ if (!Number.isNaN(ta) && ta !== tb)
271
+ return tb - ta;
272
+ return Number.isNaN(ta) ? ci(b).localeCompare(ci(a)) : 0;
273
+ });
274
+ const words = {
275
+ pay: 'to pay',
276
+ up: 'upcoming',
277
+ past: 'stayed',
278
+ off: 'cancelled, expired or not made',
279
+ };
280
+ const counts = ['pay', 'up', 'past', 'off']
281
+ .map((k) => [k, list.filter((b) => kind(b) === k).length])
282
+ .filter(([, n]) => n > 0)
283
+ .map(([k, n]) => `${n} ${words[k]}`)
284
+ .join(', ');
285
+ const when = (b) => {
286
+ const t = madeAt(b);
287
+ return Number.isNaN(t)
288
+ ? 'booking time not known'
289
+ : `booked ${new Date(t).toISOString().slice(0, 16).replace('T', ' ')} UTC`;
290
+ };
291
+ return [
292
+ `Bookings, latest booked first (${list.length}: ${counts}):`,
293
+ ...sorted.map((b) => `[${when(b)}] ${line(b)}`),
294
+ ].join('\n');
295
+ };
296
+ export const bookingLine = (deps, b, noCards) => {
297
+ const kinds = b.requests?.kinds ?? [];
298
+ const held = noCards ? heldRoomsWords(b) : '';
299
+ const notSent = holderOf(deps, b.supplier).notReal;
300
+ return [
301
+ `${b.confirmationCode}${b.orderNumber ? ` (order number ${b.orderNumber})` : ''} · ${withZh(b.hotelName, b.hotelNames, noCards)} · ${stayWords(b.stay, b.hourly)} · ${notSentStatus(deps, b) ??
302
+ unconfirmedSaid(deps, b) ??
303
+ // ⚠️ SAID AS WHAT IT IS - see BookingStatus. Neither booked nor failed.
304
+ (b.status === 'unconfirmed'
305
+ ? 'unconfirmed: whether it was made is not known yet, and a person is confirming it'
306
+ : b.status)}`,
307
+ held ? ` · ${held}` : '',
308
+ kinds.length ? ` · asked for ${kinds.map(bare).join(', ')}` : '',
309
+ b.quote.coupon
310
+ ? ` · coupon ${couponName(b.quote.coupon)} −${formatMoney(b.quote.coupon.off)}${b.couponReturned === true
311
+ ? ' (given back)'
312
+ : b.couponReturned === false
313
+ ? b.couponNotReturnedBecause === 'fee'
314
+ ? notSent
315
+ ? ' (not given back - under the terms the cancellation costs a fee)'
316
+ : ' (not given back - the cancellation was charged a fee)'
317
+ : ' (ran out - not given back)'
318
+ : ''}`
319
+ : '',
320
+ b.payment
321
+ ? // ⚠️ THE PAGE BY ITS HOST, NOT "THE CARD PAGE" (0.63.0 transcript): beside a
322
+ // host the old words read "to be paid on the card page - pay on <host>", and a
323
+ // client with no card reads "card page" as the booking card's.
324
+ b.payment.status === 'awaiting' && b.payment.url
325
+ ? ` · to be paid on ${hostOf(b.payment.url) ?? 'its payment page'}${payByWords(b.payment) ? ` by ${payByWords(b.payment)}` : ''}: ${b.payment.url}`
326
+ : b.payment.status === 'awaiting' &&
327
+ b.payment.method === 'card' &&
328
+ deps.backend.otalessBooking
329
+ ? ` · ${b.termsChanged || b.confirmAsked ? termsHeldWords(deps, b) : LINK_CLOSED_WORDS}`
330
+ : ` · ${paymentWords(b)}${shownPriceSaid(b.payment, holderOf(deps, b.supplier).name, b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed').replace(/^ /, ' - ')}`
331
+ : // ⚠️ CONFIRMED WITH NO PAGE, ITS PAYMENT NOT KNOWN (Otaless 0.84.2, P0-1).
332
+ b.paymentUnknown
333
+ ? ` · ${b.status === 'cancelled' ? 'cancelled - whether it had been charged is still not known; a person here follows it up' : 'whether it has been charged (to a wallet or card at the group) is being checked - nothing to pay here now'}`
334
+ : '',
335
+ bookingNotes(deps, b) ? ` · ${bookingNotes(deps, b)}` : '',
336
+ // 0.84.2 (总线程's re-review): what is not as chosen.
337
+ differsSaid(deps, b) ? ` · ${differsSaid(deps, b)}` : '',
338
+ ].join('');
339
+ };
340
+ /**
341
+ * The window of nearby arrival dates, plus the one sentence worth saying about
342
+ * it in prose.
343
+ *
344
+ * ⚠️ THE SENTENCE IS SAID ONCE, OR NOT AT ALL. The window's prices belong to the
345
+ * card - the date picker puts each under its day (the hotel page's own strip of
346
+ * them was taken away, robin 2026-10-22); repeating them in text costs the
347
+ * model's context and tells it nothing it can act on. What prose is good
348
+ * for is the single fact a picture hides: that a date the guest did not ask
349
+ * about is cheaper, or - when the asked-for nights are gone - that a date
350
+ * nearby is free at all.
351
+ *
352
+ * ⚠️ AND IT NAMES THE DATE. "The one before" or "the third day" is meaningless
353
+ * the moment the card reflows or the guest is reading on a phone; a date is the
354
+ * same fact wherever it is read.
355
+ */
356
+ export const dateFlex = (dates, stay) => {
357
+ const chosen = dates.find((d) => d.chosen);
358
+ const others = dates.filter((d) => !d.chosen && d.from);
359
+ // One date is not a window. A window with no prices on it IS still an answer,
360
+ // and the one that matters most: a guest told "no type here has three left"
361
+ // wants to know whether another night would do, and seven days reading Full
362
+ // say no in a way a missing window does not.
363
+ if (dates.length < 2)
364
+ return { structured: {}, text: '' };
365
+ const nightCount = nightsBetween(stay.checkIn, stay.checkOut);
366
+ const sameNights = `the same ${nightCount} ${nightCount === 1 ? 'night' : 'nights'}`;
367
+ // Cheapest first; among equals the one closest to the dates that were asked
368
+ // about, because moving four days to save nothing is not an offer either.
369
+ const shift = (d) => Math.abs(Date.parse(d.checkIn) - Date.parse(stay.checkIn));
370
+ const best = others
371
+ .slice()
372
+ .sort((a, b) => (a.from?.minor ?? 0) - (b.from?.minor ?? 0) || shift(a) - shift(b))[0];
373
+ // ⚠️ THE MARK IS EARNED AGAINST THE GUEST'S OWN DATES, not against the rest
374
+ // of the window. Whatever is lowest is always lowest; badging it would put a
375
+ // bargain flag on the dates the guest already chose, or on a date four days
376
+ // away that saves nothing.
377
+ //
378
+ // ⚠️ AND EVERY DATE THAT TIES IS MARKED. Three weekdays at one rate is the
379
+ // normal shape of a hotel week; marking only the closest of them would say
380
+ // the other two are worse, which is a claim about prices that are equal.
381
+ const beats = best?.from && chosen?.from && best.from.minor < chosen.from.minor ? best : undefined;
382
+ const beatsBy = beats?.from?.minor;
383
+ // The cheapest of the window - the chosen date too - when two or more are
384
+ // priced in one currency; ties all marked. `best` stays what it was: a date
385
+ // that beats the guest's own.
386
+ const priced = dates.filter((d) => d.from);
387
+ const lowest = priced.length >= 2 && new Set(priced.map((d) => d.from?.currency)).size === 1
388
+ ? Math.min(...priced.map((d) => d.from?.minor ?? Number.POSITIVE_INFINITY))
389
+ : undefined;
390
+ const structured = {
391
+ dates: dates.map((d) => ({
392
+ checkIn: d.checkIn,
393
+ checkOut: d.checkOut,
394
+ // "Sold out" only when it is (D2, robin 2026-10-30): a day with rooms
395
+ // that cannot be booked here says why instead.
396
+ ...(d.from
397
+ ? { from: formatMoney(d.from) }
398
+ : !d.why || d.why === 'sold-out'
399
+ ? { soldOut: true }
400
+ : { noRoomsCode: d.why }),
401
+ ...(d.chosen ? { chosen: true } : {}),
402
+ // The chosen date cannot match: `beatsBy` is a price strictly below it.
403
+ ...(beatsBy !== undefined && d.from?.minor === beatsBy ? { best: true } : {}),
404
+ ...(lowest !== undefined && d.from?.minor === lowest ? { lowest: true } : {}),
405
+ })),
406
+ };
407
+ if (!best?.from)
408
+ return { structured, text: '' };
409
+ if (!chosen?.from) {
410
+ return {
411
+ structured,
412
+ text: `${best.checkIn} is free for ${sameNights}, from ${formatMoney(best.from)}.`,
413
+ };
414
+ }
415
+ if (!beats?.from)
416
+ return { structured, text: '' };
417
+ const saved = money(chosen.from.minor - beats.from.minor, chosen.from.currency);
418
+ return {
419
+ structured,
420
+ text: `Arriving ${beats.checkIn} instead is ${formatMoney(saved)} less for ${sameNights}.`,
421
+ };
422
+ };
423
+ /**
424
+ * The room types a guest can no longer book on these nights - for the card to
425
+ * say so, and not leave them out (r10 #10: a type the guest saw earlier
426
+ * vanished from the list, and the heading counted one fewer, without a word).
427
+ *
428
+ * ⚠️ AN ADDITIVE FIELD, NEVER THE TEXT. What the assistant is told is the rooms
429
+ * that can be booked, as before; this is only what the card draws, muted, at
430
+ * the end of the list. A type is listed when
431
+ * - the backend sends it with none left (`HotelDetail.soldOut`, or a room with
432
+ * `roomsLeft: 0`), or
433
+ * - it has some left, but fewer than the rooms asked for (`left`): a guest who
434
+ * asked for two rooms and was shown no type with one left was not told why.
435
+ * Not a type that sleeps fewer than the party (the backend never sends it), and
436
+ * not a type any of whose rates can be booked. One entry a type, with the facts
437
+ * the card says of a room and no price.
438
+ */
439
+ export const soldOutTypesOf = (detail, enough, wanted) => {
440
+ const key = (r) => r.roomType?.id ?? r.id;
441
+ const open = new Set(enough.map(key));
442
+ const types = new Map();
443
+ for (const r of [...(detail.rooms ?? []), ...(detail.soldOut ?? [])]) {
444
+ if (r.hourly || open.has(key(r)) || r.roomsLeft >= wanted)
445
+ continue;
446
+ const seen = types.get(key(r));
447
+ if (seen)
448
+ seen.left = Math.max(seen.left, r.roomsLeft);
449
+ else
450
+ types.set(key(r), { room: r, left: r.roomsLeft });
451
+ }
452
+ return [...types.entries()].map(([id, { room: r, left }]) => ({
453
+ id,
454
+ name: r.roomType?.name ?? r.name,
455
+ ...((r.roomType?.names ?? r.names) ? { names: r.roomType?.names ?? r.names } : {}),
456
+ sleeps: r.sleeps,
457
+ ...(r.maxChildren ? { maxChildren: r.maxChildren } : {}),
458
+ ...(r.sizeSqm ? { sizeSqm: r.sizeSqm } : {}),
459
+ ...(r.beds ? { beds: r.beds } : {}),
460
+ ...(r.bedTypes ? { bedTypes: r.bedTypes } : {}),
461
+ ...(r.view ? { view: r.view } : {}),
462
+ ...(r.window ? { window: r.window } : {}),
463
+ ...(r.floor ? { floor: r.floor } : {}),
464
+ ...(r.wifi ? { wifi: true } : {}),
465
+ ...(r.extraBed ? { extraBed: true } : {}),
466
+ ...(r.imageUrl ? { imageUrl: r.imageUrl } : {}),
467
+ // Some left, but not as many as were asked for.
468
+ ...(left > 0 ? { left } : {}),
469
+ }));
470
+ };
471
+ /** A code that opens no booking here: where orders are the account's, no email would have opened it. */
472
+ export const noBookingLike = (deps) => ordersByAccount(deps.backend.capabilities ?? FULL_CAPABILITIES)
473
+ ? 'No booking here matches that code. Only bookings made here by this account are known.'
474
+ : 'No booking here matches that code. A booking made in another conversation needs the email it was made with.';
475
+ //# sourceMappingURL=terms-answer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terms-answer.js","sourceRoot":"","sources":["../../src/tools/terms-answer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAUjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,MAAM,EACN,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;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