@curless/hotel-storefront 0.84.8 → 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.
- package/dist/config.d.ts +35 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/huazhu/ari-sync.d.ts +93 -6
- package/dist/huazhu/ari-sync.d.ts.map +1 -1
- package/dist/huazhu/ari-sync.js +303 -28
- package/dist/huazhu/ari-sync.js.map +1 -1
- package/dist/huazhu/backend.d.ts +9 -0
- package/dist/huazhu/backend.d.ts.map +1 -1
- package/dist/huazhu/backend.js +62 -22
- package/dist/huazhu/backend.js.map +1 -1
- package/dist/huazhu/catalog.d.ts +58 -1
- package/dist/huazhu/catalog.d.ts.map +1 -1
- package/dist/huazhu/catalog.js +318 -15
- package/dist/huazhu/catalog.js.map +1 -1
- package/dist/huazhu/live-asks.d.ts +63 -0
- package/dist/huazhu/live-asks.d.ts.map +1 -0
- package/dist/huazhu/live-asks.js +127 -0
- package/dist/huazhu/live-asks.js.map +1 -0
- package/dist/huazhu/make.d.ts.map +1 -1
- package/dist/huazhu/make.js +50 -4
- package/dist/huazhu/make.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tools/accept-terms.d.ts +4 -0
- package/dist/tools/accept-terms.d.ts.map +1 -0
- package/dist/tools/accept-terms.js +26 -0
- package/dist/tools/accept-terms.js.map +1 -0
- package/dist/tools/add-booking-addon.d.ts +4 -0
- package/dist/tools/add-booking-addon.d.ts.map +1 -0
- package/dist/tools/add-booking-addon.js +44 -0
- package/dist/tools/add-booking-addon.js.map +1 -0
- package/dist/tools/add-to-trip.d.ts +4 -0
- package/dist/tools/add-to-trip.d.ts.map +1 -0
- package/dist/tools/add-to-trip.js +49 -0
- package/dist/tools/add-to-trip.js.map +1 -0
- package/dist/tools/all-tools.d.ts +1342 -0
- package/dist/tools/all-tools.d.ts.map +1 -0
- package/dist/tools/all-tools.js +954 -0
- package/dist/tools/all-tools.js.map +1 -0
- package/dist/tools/answer.d.ts +3 -0
- package/dist/tools/answer.d.ts.map +1 -0
- package/dist/tools/answer.js +104 -0
- package/dist/tools/answer.js.map +1 -0
- package/dist/tools/args.d.ts +149 -0
- package/dist/tools/args.d.ts.map +1 -0
- package/dist/tools/args.js +176 -0
- package/dist/tools/args.js.map +1 -0
- package/dist/tools/base-output-schemas.d.ts +3 -0
- package/dist/tools/base-output-schemas.d.ts.map +1 -0
- package/dist/tools/base-output-schemas.js +380 -0
- package/dist/tools/base-output-schemas.js.map +1 -0
- package/dist/tools/book-picked.d.ts +4 -0
- package/dist/tools/book-picked.d.ts.map +1 -0
- package/dist/tools/book-picked.js +14 -0
- package/dist/tools/book-picked.js.map +1 -0
- package/dist/tools/booking-answer.d.ts +24 -0
- package/dist/tools/booking-answer.d.ts.map +1 -0
- package/dist/tools/booking-answer.js +485 -0
- package/dist/tools/booking-answer.js.map +1 -0
- package/dist/tools/buy-shop-item.d.ts +4 -0
- package/dist/tools/buy-shop-item.d.ts.map +1 -0
- package/dist/tools/buy-shop-item.js +45 -0
- package/dist/tools/buy-shop-item.js.map +1 -0
- package/dist/tools/call.d.ts +11 -0
- package/dist/tools/call.d.ts.map +1 -0
- package/dist/tools/call.js +2 -0
- package/dist/tools/call.js.map +1 -0
- package/dist/tools/cancel-facts.d.ts +281 -0
- package/dist/tools/cancel-facts.d.ts.map +1 -0
- package/dist/tools/cancel-facts.js +309 -0
- package/dist/tools/cancel-facts.js.map +1 -0
- package/dist/tools/cancel.d.ts +4 -0
- package/dist/tools/cancel.d.ts.map +1 -0
- package/dist/tools/cancel.js +364 -0
- package/dist/tools/cancel.js.map +1 -0
- package/dist/tools/card-addons.d.ts +4 -0
- package/dist/tools/card-addons.d.ts.map +1 -0
- package/dist/tools/card-addons.js +76 -0
- package/dist/tools/card-addons.js.map +1 -0
- package/dist/tools/change-booking.d.ts +4 -0
- package/dist/tools/change-booking.d.ts.map +1 -0
- package/dist/tools/change-booking.js +145 -0
- package/dist/tools/change-booking.js.map +1 -0
- package/dist/tools/clear-trip.d.ts +4 -0
- package/dist/tools/clear-trip.d.ts.map +1 -0
- package/dist/tools/clear-trip.js +10 -0
- package/dist/tools/clear-trip.js.map +1 -0
- package/dist/tools/compare.d.ts +4 -0
- package/dist/tools/compare.d.ts.map +1 -0
- package/dist/tools/compare.js +114 -0
- package/dist/tools/compare.js.map +1 -0
- package/dist/tools/current-trip.d.ts +70 -0
- package/dist/tools/current-trip.d.ts.map +1 -0
- package/dist/tools/current-trip.js +261 -0
- package/dist/tools/current-trip.js.map +1 -0
- package/dist/tools/deps.d.ts +229 -0
- package/dist/tools/deps.d.ts.map +1 -0
- package/dist/tools/deps.js +2 -0
- package/dist/tools/deps.js.map +1 -0
- package/dist/tools/follow-ups.d.ts +120 -0
- package/dist/tools/follow-ups.d.ts.map +1 -0
- package/dist/tools/follow-ups.js +369 -0
- package/dist/tools/follow-ups.js.map +1 -0
- package/dist/tools/forget-preferences.d.ts +4 -0
- package/dist/tools/forget-preferences.d.ts.map +1 -0
- package/dist/tools/forget-preferences.js +24 -0
- package/dist/tools/forget-preferences.js.map +1 -0
- package/dist/tools/get-hotel.d.ts +4 -0
- package/dist/tools/get-hotel.d.ts.map +1 -0
- package/dist/tools/get-hotel.js +324 -0
- package/dist/tools/get-hotel.js.map +1 -0
- package/dist/tools/hotel-choices.d.ts +132 -0
- package/dist/tools/hotel-choices.d.ts.map +1 -0
- package/dist/tools/hotel-choices.js +558 -0
- package/dist/tools/hotel-choices.js.map +1 -0
- package/dist/tools/itinerary.d.ts +4 -0
- package/dist/tools/itinerary.d.ts.map +1 -0
- package/dist/tools/itinerary.js +148 -0
- package/dist/tools/itinerary.js.map +1 -0
- package/dist/tools/list-booking-addons.d.ts +4 -0
- package/dist/tools/list-booking-addons.d.ts.map +1 -0
- package/dist/tools/list-booking-addons.js +21 -0
- package/dist/tools/list-booking-addons.js.map +1 -0
- package/dist/tools/list-bookings.d.ts +4 -0
- package/dist/tools/list-bookings.d.ts.map +1 -0
- package/dist/tools/list-bookings.js +119 -0
- package/dist/tools/list-bookings.js.map +1 -0
- package/dist/tools/list-extras.d.ts +4 -0
- package/dist/tools/list-extras.d.ts.map +1 -0
- package/dist/tools/list-extras.js +90 -0
- package/dist/tools/list-extras.js.map +1 -0
- package/dist/tools/list-hotels.d.ts +4 -0
- package/dist/tools/list-hotels.d.ts.map +1 -0
- package/dist/tools/list-hotels.js +891 -0
- package/dist/tools/list-hotels.js.map +1 -0
- package/dist/tools/list-shop-items.d.ts +4 -0
- package/dist/tools/list-shop-items.d.ts.map +1 -0
- package/dist/tools/list-shop-items.js +34 -0
- package/dist/tools/list-shop-items.js.map +1 -0
- package/dist/tools/list-shop-orders.d.ts +4 -0
- package/dist/tools/list-shop-orders.d.ts.map +1 -0
- package/dist/tools/list-shop-orders.js +22 -0
- package/dist/tools/list-shop-orders.js.map +1 -0
- package/dist/tools/look-up.d.ts +4 -0
- package/dist/tools/look-up.d.ts.map +1 -0
- package/dist/tools/look-up.js +170 -0
- package/dist/tools/look-up.js.map +1 -0
- package/dist/tools/output-schemas.d.ts +645 -0
- package/dist/tools/output-schemas.d.ts.map +1 -0
- package/dist/tools/output-schemas.js +503 -0
- package/dist/tools/output-schemas.js.map +1 -0
- package/dist/tools/paid-lines.d.ts +718 -0
- package/dist/tools/paid-lines.d.ts.map +1 -0
- package/dist/tools/paid-lines.js +359 -0
- package/dist/tools/paid-lines.js.map +1 -0
- package/dist/tools/pay-with-union-pay.d.ts +4 -0
- package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
- package/dist/tools/pay-with-union-pay.js +112 -0
- package/dist/tools/pay-with-union-pay.js.map +1 -0
- package/dist/tools/payment-words.d.ts +269 -0
- package/dist/tools/payment-words.d.ts.map +1 -0
- package/dist/tools/payment-words.js +365 -0
- package/dist/tools/payment-words.js.map +1 -0
- package/dist/tools/pick-room.d.ts +4 -0
- package/dist/tools/pick-room.d.ts.map +1 -0
- package/dist/tools/pick-room.js +23 -0
- package/dist/tools/pick-room.js.map +1 -0
- package/dist/tools/policies.d.ts +4 -0
- package/dist/tools/policies.d.ts.map +1 -0
- package/dist/tools/policies.js +74 -0
- package/dist/tools/policies.js.map +1 -0
- package/dist/tools/pricing.d.ts +55 -0
- package/dist/tools/pricing.d.ts.map +1 -0
- package/dist/tools/pricing.js +260 -0
- package/dist/tools/pricing.js.map +1 -0
- package/dist/tools/put-room-line.d.ts +12 -0
- package/dist/tools/put-room-line.d.ts.map +1 -0
- package/dist/tools/put-room-line.js +314 -0
- package/dist/tools/put-room-line.js.map +1 -0
- package/dist/tools/quote-card.d.ts +234 -0
- package/dist/tools/quote-card.d.ts.map +1 -0
- package/dist/tools/quote-card.js +375 -0
- package/dist/tools/quote-card.js.map +1 -0
- package/dist/tools/refund-booking.d.ts +4 -0
- package/dist/tools/refund-booking.d.ts.map +1 -0
- package/dist/tools/refund-booking.js +112 -0
- package/dist/tools/refund-booking.js.map +1 -0
- package/dist/tools/request-booking.d.ts +4 -0
- package/dist/tools/request-booking.d.ts.map +1 -0
- package/dist/tools/request-booking.js +5 -0
- package/dist/tools/request-booking.js.map +1 -0
- package/dist/tools/request-words.d.ts +238 -0
- package/dist/tools/request-words.d.ts.map +1 -0
- package/dist/tools/request-words.js +487 -0
- package/dist/tools/request-words.js.map +1 -0
- package/dist/tools/room-choices.d.ts +64 -0
- package/dist/tools/room-choices.d.ts.map +1 -0
- package/dist/tools/room-choices.js +348 -0
- package/dist/tools/room-choices.js.map +1 -0
- package/dist/tools/session-notes.d.ts +164 -0
- package/dist/tools/session-notes.d.ts.map +1 -0
- package/dist/tools/session-notes.js +412 -0
- package/dist/tools/session-notes.js.map +1 -0
- package/dist/tools/sign-in.d.ts +4 -0
- package/dist/tools/sign-in.d.ts.map +1 -0
- package/dist/tools/sign-in.js +72 -0
- package/dist/tools/sign-in.js.map +1 -0
- package/dist/tools/sign-out.d.ts +4 -0
- package/dist/tools/sign-out.d.ts.map +1 -0
- package/dist/tools/sign-out.js +13 -0
- package/dist/tools/sign-out.js.map +1 -0
- package/dist/tools/terms-answer.d.ts +114 -0
- package/dist/tools/terms-answer.d.ts.map +1 -0
- package/dist/tools/terms-answer.js +475 -0
- package/dist/tools/terms-answer.js.map +1 -0
- package/dist/tools/tool-set.d.ts +1474 -0
- package/dist/tools/tool-set.d.ts.map +1 -0
- package/dist/tools/tool-set.js +497 -0
- package/dist/tools/tool-set.js.map +1 -0
- package/dist/tools/view-trip.d.ts +4 -0
- package/dist/tools/view-trip.d.ts.map +1 -0
- package/dist/tools/view-trip.js +7 -0
- package/dist/tools/view-trip.js.map +1 -0
- package/dist/tools.d.ts +13 -2089
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +11 -10685
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { clockOf, minutesOf, startProblem, windowWords } from '../hourly.js';
|
|
2
|
+
import { formatMoney, multiplyMoney } from '../money.js';
|
|
3
|
+
import { namedExactly, roomTypeNamed } from '../names.js';
|
|
4
|
+
import { MAX_ROOMS_PER_LINE, clampCount } from '../trip.js';
|
|
5
|
+
import { asStay, str, unset } from './args.js';
|
|
6
|
+
import { currentTrip } from './current-trip.js';
|
|
7
|
+
import { common } from './paid-lines.js';
|
|
8
|
+
import { couponOf } from './pricing.js';
|
|
9
|
+
import { withZh } from './quote-card.js';
|
|
10
|
+
import { groupNameOf, guestsOf, priceWords, waysOnWords, wholeStayWords } from './request-words.js';
|
|
11
|
+
import { identity } from './session-notes.js';
|
|
12
|
+
/**
|
|
13
|
+
* A room line, validated and priced against the hotel's calendar and put into
|
|
14
|
+
* one slot of the trip store - THE ONE ROOM-LINE CODE, for `add_to_trip` (`store`
|
|
15
|
+
* the trip's own key) and for the card's pick (`pick_room`, `store` its
|
|
16
|
+
* `pickedKey`). `key` is the conversation's trip key and keeps everything else:
|
|
17
|
+
* the member the price is worked out for, and every answer's `common`.
|
|
18
|
+
*/
|
|
19
|
+
export const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
|
|
20
|
+
const hotelId = detail.hotel.id;
|
|
21
|
+
const roomRef = str(args.room);
|
|
22
|
+
if (!roomRef) {
|
|
23
|
+
return {
|
|
24
|
+
structured: { view: 'error', ...common(deps, key), error: 'no-room-named' },
|
|
25
|
+
text: `Say which room type, or which add-on. ${t.getHotel} with the dates lists the room types.`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// A room by the hour: today, from the start the guest gave - checked here,
|
|
29
|
+
// against the starts the room takes, and never moved to fit (总线程,
|
|
30
|
+
// 2026-10-12).
|
|
31
|
+
const who = identity(deps, ctx, key);
|
|
32
|
+
const startTime = str(args.startTime);
|
|
33
|
+
// ⚠️ TAKING A ROOM OUT NEEDS NO ROOM FOR SALE. The lookups below are of
|
|
34
|
+
// what is for sale, so a room that had gone since it went into the trip -
|
|
35
|
+
// the stay a booking could not make - could not be taken out of it
|
|
36
|
+
// (2026-10-14). Nor could a room by the hour once its window had passed:
|
|
37
|
+
// the start was checked against today's window first, and every line of a
|
|
38
|
+
// trip must be removable (2026-10-27 audit, F6). The line in the trip is the
|
|
39
|
+
// one asked about - by its nights, or a room by the hour by its start.
|
|
40
|
+
if (args.rooms !== undefined && clampCount(args.rooms, MAX_ROOMS_PER_LINE) === 0) {
|
|
41
|
+
const asked = asStay(args);
|
|
42
|
+
const start = startTime ? minutesOf(startTime) : undefined;
|
|
43
|
+
const held = deps.trips
|
|
44
|
+
.read(store)
|
|
45
|
+
.find((l) => l.kind === 'room' &&
|
|
46
|
+
l.hotelId === hotelId &&
|
|
47
|
+
l.roomId === roomRef &&
|
|
48
|
+
(l.hourly
|
|
49
|
+
? start !== undefined &&
|
|
50
|
+
minutesOf(l.hourly.start) === start &&
|
|
51
|
+
(!asked || l.stay.checkIn === asked.checkIn)
|
|
52
|
+
: !!asked && l.stay.checkIn === asked.checkIn && l.stay.checkOut === asked.checkOut));
|
|
53
|
+
if (held) {
|
|
54
|
+
deps.trips.set(store, unset(held));
|
|
55
|
+
return currentTrip(deps, key, who, store, couponOf(deps, args), ctx);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// ⚠️ LISTED, NOT BOOKED HERE (robin, 2026-10-30): a rate paid in advance
|
|
59
|
+
// where this deployment takes no payment goes in no trip and no pick. The
|
|
60
|
+
// press on its Reserve - or the assistant asking for it - is answered with
|
|
61
|
+
// what is true and what is left: nothing booked, nothing charged; the rates
|
|
62
|
+
// here paid at the hotel, a press each; other dates; or the group itself.
|
|
63
|
+
// Never a review that fails at Book, after the guest typed their name.
|
|
64
|
+
// ONE ANSWER FOR A ROOM BY THE NIGHT AND A ROOM BY THE HOUR (2026-11-03
|
|
65
|
+
// review, C6): the hourly branch put such a room in the trip before this was
|
|
66
|
+
// asked, and the guest met the refusal at "Book".
|
|
67
|
+
const prepaidNotHere = (room, bookable, stay, when, wanted = 1) => {
|
|
68
|
+
const group = groupNameOf(deps, hotelId);
|
|
69
|
+
// ⚠️ "PAID AT THE HOTEL" ONLY OF RATES THAT ARE (0.77.5): beside them, a hotel may have rates
|
|
70
|
+
// paid in advance that are booked here without payment (`Room.paymentNotConnected`) - said
|
|
71
|
+
// as those, never listed as paid at the hotel, and left off the card's list of them.
|
|
72
|
+
const unpaid = bookable
|
|
73
|
+
.filter((r) => r.paymentNotConnected)
|
|
74
|
+
.sort((a, b) => a.stayTotal.minor - b.stayTotal.minor);
|
|
75
|
+
const open = bookable.filter((r) => r.payment !== 'prepaid');
|
|
76
|
+
// ⚠️ WITH THEIR PRICES, CHEAPEST FIRST, AND THE WAYS ON SAID (总线程 11-09,
|
|
77
|
+
// Manus on Huazhu): the names alone and "the other ways on" last, and the
|
|
78
|
+
// model told the guest only that the room could not be booked here.
|
|
79
|
+
const priced = [...open].sort((a, b) => a.stayTotal.minor - b.stayTotal.minor);
|
|
80
|
+
const price = (r) => r.hourly
|
|
81
|
+
? priceWords(r, true)
|
|
82
|
+
: r.stayTotalUnquoted
|
|
83
|
+
? `${formatMoney(r.nightly)} a night, ${wholeStayWords(r)}`
|
|
84
|
+
: wanted > 1
|
|
85
|
+
? `${formatMoney(multiplyMoney(r.stayTotal, wanted))} for ${wanted} rooms, for the stay incl. taxes and fees`
|
|
86
|
+
: `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
87
|
+
const named = (rs) => rs
|
|
88
|
+
.map((r) => `${withZh(r.name, r.roomType ? r.roomType.names : r.names, true)} (\`${r.id}\`) - ${price(r)}`)
|
|
89
|
+
.join('; ');
|
|
90
|
+
const said = [
|
|
91
|
+
unpaid.length
|
|
92
|
+
? `Nothing was booked or charged: ${room.name} is paid in advance, and here a rate paid in advance is booked only while it is free to cancel for at least another hour - this one is not.`
|
|
93
|
+
: `Nothing was booked or charged: ${room.name} is paid in advance, and a stay paid in advance cannot be booked here yet - only rates paid at the hotel can be.`,
|
|
94
|
+
priced.length
|
|
95
|
+
? `Paid at the hotel at ${detail.hotel.name} ${when}, cheapest first: ${named(priced)}.`
|
|
96
|
+
: `No rate at ${detail.hotel.name} ${when} is paid at the hotel.`,
|
|
97
|
+
unpaid.length
|
|
98
|
+
? `Paid in advance and booked here with nothing charged (payment is not connected here yet) at ${detail.hotel.name} ${when}, cheapest first: ${named(unpaid)}.`
|
|
99
|
+
: '',
|
|
100
|
+
`Tell the guest that nothing was booked, and ${waysOnWords(group, priced.length || unpaid.length
|
|
101
|
+
? `the rates ${priced.length ? 'paid at the hotel' : 'booked here with nothing charged'}${priced.length && unpaid.length ? ' and those booked here with nothing charged' : ''} above, by name and price - one of them is booked here as any other room`
|
|
102
|
+
: undefined)}`,
|
|
103
|
+
]
|
|
104
|
+
.filter(Boolean)
|
|
105
|
+
.join(' ');
|
|
106
|
+
return {
|
|
107
|
+
structured: {
|
|
108
|
+
view: 'error',
|
|
109
|
+
...common(deps, key),
|
|
110
|
+
error: 'prepaid-not-here',
|
|
111
|
+
room: { id: room.id, name: room.name, ...(room.names ? { names: room.names } : {}) },
|
|
112
|
+
rooms: open.map((r) => ({
|
|
113
|
+
id: r.id,
|
|
114
|
+
name: r.name,
|
|
115
|
+
...(r.names ? { names: r.names } : {}),
|
|
116
|
+
})),
|
|
117
|
+
hotel: {
|
|
118
|
+
id: detail.hotel.id,
|
|
119
|
+
name: detail.hotel.name,
|
|
120
|
+
...(detail.hotel.names ? { names: detail.hotel.names } : {}),
|
|
121
|
+
},
|
|
122
|
+
stay,
|
|
123
|
+
group,
|
|
124
|
+
said,
|
|
125
|
+
},
|
|
126
|
+
text: said,
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const today = (startTime || !asStay(args)
|
|
130
|
+
? deps.backend.hourlyRooms?.(hotelId, guestsOf(args), who)
|
|
131
|
+
: undefined);
|
|
132
|
+
const byTheHour = async () => {
|
|
133
|
+
const sold = ((await today)?.rooms ?? []).filter((r) => r.hourly);
|
|
134
|
+
return sold.find((r) => r.id === roomRef) ?? namedExactly(sold, roomRef);
|
|
135
|
+
};
|
|
136
|
+
if (startTime && deps.backend.hourlyRooms) {
|
|
137
|
+
const hourlyRoom = await byTheHour();
|
|
138
|
+
if (!hourlyRoom?.hourly) {
|
|
139
|
+
const sold = ((await today)?.rooms ?? []).filter((r) => r.hourly);
|
|
140
|
+
return {
|
|
141
|
+
structured: {
|
|
142
|
+
view: 'error',
|
|
143
|
+
...common(deps, key),
|
|
144
|
+
error: 'no-such-room',
|
|
145
|
+
query: roomRef,
|
|
146
|
+
rooms: sold.map((r) => ({
|
|
147
|
+
id: r.id,
|
|
148
|
+
name: r.name,
|
|
149
|
+
...(r.names ? { names: r.names } : {}),
|
|
150
|
+
})),
|
|
151
|
+
},
|
|
152
|
+
text: sold.length
|
|
153
|
+
? `${detail.hotel.name} has no room by the hour by that name today. It has: ${sold.map((r) => `${r.name} (\`${r.id}\`, ${windowWords(r.hourly)})`).join('; ')}. Call again with the id.`
|
|
154
|
+
: ((await today)?.noRooms ?? `${detail.hotel.name} has no rooms by the hour today.`),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (hourlyRoom.notSoldHere) {
|
|
158
|
+
const wantedHere = Math.max(1, clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE));
|
|
159
|
+
const open = ((await today)?.rooms ?? []).filter((r) => r.hourly && !r.notSoldHere && r.roomsLeft >= wantedHere);
|
|
160
|
+
return prepaidNotHere(hourlyRoom, open, {
|
|
161
|
+
checkIn: hourlyRoom.hourly.date,
|
|
162
|
+
checkOut: hourlyRoom.hourly.date,
|
|
163
|
+
guests: guestsOf(args),
|
|
164
|
+
}, 'by the hour today', wantedHere);
|
|
165
|
+
}
|
|
166
|
+
const bad = startProblem(hourlyRoom.hourly, startTime);
|
|
167
|
+
if (bad) {
|
|
168
|
+
return {
|
|
169
|
+
structured: {
|
|
170
|
+
view: 'error',
|
|
171
|
+
...common(deps, key),
|
|
172
|
+
error: 'start-time',
|
|
173
|
+
query: startTime,
|
|
174
|
+
// The starts it does take. Not `hourly`: that is the flag above.
|
|
175
|
+
window: hourlyRoom.hourly,
|
|
176
|
+
},
|
|
177
|
+
text: bad,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
deps.trips.set(store, {
|
|
181
|
+
kind: 'room',
|
|
182
|
+
hotelId,
|
|
183
|
+
roomId: hourlyRoom.id,
|
|
184
|
+
stay: {
|
|
185
|
+
checkIn: hourlyRoom.hourly.date,
|
|
186
|
+
checkOut: hourlyRoom.hourly.date,
|
|
187
|
+
guests: guestsOf(args),
|
|
188
|
+
},
|
|
189
|
+
rooms: clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE),
|
|
190
|
+
hourly: {
|
|
191
|
+
start: clockOf(minutesOf(startTime)),
|
|
192
|
+
hours: hourlyRoom.hourly.hours,
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
return currentTrip(deps, key, who, store, couponOf(deps, args), ctx);
|
|
196
|
+
}
|
|
197
|
+
const stay = asStay(args);
|
|
198
|
+
// ⚠️ NO DATES, NO LINE. Guessing "tonight" or "this weekend" here is how a
|
|
199
|
+
// connector books someone the wrong nights, and the guest finds out at the
|
|
200
|
+
// desk. The trip stays as it was and the answer asks.
|
|
201
|
+
if (!stay) {
|
|
202
|
+
const hourlyRoom = await byTheHour();
|
|
203
|
+
return {
|
|
204
|
+
structured: {
|
|
205
|
+
view: 'needs-dates',
|
|
206
|
+
...common(deps, key),
|
|
207
|
+
hotel: detail.hotel,
|
|
208
|
+
room: roomRef,
|
|
209
|
+
...(hourlyRoom?.hourly ? { window: hourlyRoom.hourly } : {}),
|
|
210
|
+
},
|
|
211
|
+
text: hourlyRoom?.hourly
|
|
212
|
+
? `That is a room by the hour, sold for today: it takes \`startTime\` - ${windowWords(hourlyRoom.hourly)}.`
|
|
213
|
+
: 'Which nights? A room needs a check-in and a check-out date before it can go into the trip.',
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
// The backend owns the calendar - it knows each hotel's own timezone, and a
|
|
217
|
+
// second opinion computed from this process's clock would disagree with it
|
|
218
|
+
// for eight hours a day.
|
|
219
|
+
const dated = await deps.backend.getHotel(hotelId, stay, identity(deps, ctx, key));
|
|
220
|
+
if (!dated?.rooms) {
|
|
221
|
+
return {
|
|
222
|
+
structured: {
|
|
223
|
+
view: 'needs-dates',
|
|
224
|
+
...common(deps, key),
|
|
225
|
+
hotel: detail.hotel,
|
|
226
|
+
room: roomRef,
|
|
227
|
+
why: dated?.noRooms,
|
|
228
|
+
...(dated?.noRoomsCode ? { whyCode: dated.noRoomsCode } : {}),
|
|
229
|
+
...(dated?.noRoomsArgs ? { whyArgs: dated.noRoomsArgs } : {}),
|
|
230
|
+
},
|
|
231
|
+
text: dated?.noRooms ?? 'Those nights cannot be booked here.',
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
// ⚠️ BY THE ID, THE OFFER'S WHOLE NAME, OR A ROOM TYPE'S BARE NAME - in
|
|
235
|
+
// that order, and in any language the name has: a guest who read
|
|
236
|
+
// 「豪华大床房 · 双早 · 不可取消」 on the card says that, and it is the same offer
|
|
237
|
+
// as "Deluxe King Room · Breakfast for 2 · Non-refundable". Never a part of
|
|
238
|
+
// a name. A type's bare name ("Deluxe King Room") used to be no room at all
|
|
239
|
+
// when the type has several rates, and a model that planned a trip by the
|
|
240
|
+
// type's name was answered "no such room" three times over (the owner,
|
|
241
|
+
// 2026-10-26, Atour). It now takes the type's CHEAPEST rate that sleeps the
|
|
242
|
+
// stay's guests and has rooms left - and the answer says which rate that
|
|
243
|
+
// was and that there are others, so the guest is told what they got. Two
|
|
244
|
+
// types answering to one name, or none, is still no room.
|
|
245
|
+
const wanted = Math.max(1, clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE));
|
|
246
|
+
let room = dated.rooms.find((r) => r.id === roomRef) ?? namedExactly(dated.rooms, roomRef);
|
|
247
|
+
let took = '';
|
|
248
|
+
const type = room ? undefined : roomTypeNamed(dated.rooms, roomRef);
|
|
249
|
+
if (type) {
|
|
250
|
+
const fitting = type.rooms.filter((r) => r.sleeps >= stay.guests && r.roomsLeft >= wanted);
|
|
251
|
+
// A rate booked here before one only shown (`notSoldHere`), where the type has both.
|
|
252
|
+
const sold = fitting.filter((r) => !r.notSoldHere);
|
|
253
|
+
const fits = sold.length ? sold : fitting;
|
|
254
|
+
const [first, ...rest] = fits;
|
|
255
|
+
const cheapest = first
|
|
256
|
+
? rest.reduce((a, b) => (b.stayTotal.minor < a.stayTotal.minor ? b : a), first)
|
|
257
|
+
: undefined;
|
|
258
|
+
if (cheapest) {
|
|
259
|
+
room = cheapest;
|
|
260
|
+
const others = fits.filter((r) => r !== cheapest);
|
|
261
|
+
took = `Took ${cheapest.name} (\`${cheapest.id}\`) - ${others.length
|
|
262
|
+
? `the lowest of ${type.name}'s ${fits.length} rates for these nights; the others: ${others.map((r) => `${r.name} (\`${r.id}\`)`).join(', ')}.`
|
|
263
|
+
: `${type.name}'s only rate for these nights.`}`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (!room) {
|
|
267
|
+
const han = /\p{Script=Han}/u.test(roomRef);
|
|
268
|
+
return {
|
|
269
|
+
structured: {
|
|
270
|
+
view: 'error',
|
|
271
|
+
...common(deps, key),
|
|
272
|
+
error: 'no-such-room',
|
|
273
|
+
query: roomRef,
|
|
274
|
+
rooms: dated.rooms.map((r) => ({
|
|
275
|
+
id: r.id,
|
|
276
|
+
name: r.name,
|
|
277
|
+
...(r.names ? { names: r.names } : {}),
|
|
278
|
+
})),
|
|
279
|
+
// The hotel and the nights, so the card can take the guest straight
|
|
280
|
+
// back to its rooms rather than to the start (round-2 jury).
|
|
281
|
+
hotel: {
|
|
282
|
+
id: detail.hotel.id,
|
|
283
|
+
name: detail.hotel.name,
|
|
284
|
+
// The card says the hotel in the guest's language (「没能放进行程:…」).
|
|
285
|
+
...(detail.hotel.names ? { names: detail.hotel.names } : {}),
|
|
286
|
+
},
|
|
287
|
+
stay,
|
|
288
|
+
},
|
|
289
|
+
// ⚠️ EVERY OFFER WITH ITS ID: the model that was told "no such room" by
|
|
290
|
+
// a list of names it had just tried to match by name tried again by name.
|
|
291
|
+
// The ids are what it can say, and it says them once.
|
|
292
|
+
text: `${type ? `${detail.hotel.name} has no ${type.name} that sleeps ${stay.guests} and has ${wanted === 1 ? 'a room' : `${wanted} rooms`} left for those nights.` : `${detail.hotel.name} has no room type by that name for those nights.`} It has: ${dated.rooms.map((r) => `${r.name} (${han && r.names?.zh ? `${r.names.zh}, ` : ''}\`${r.id}\`)`).join(', ')}. Call again with the id.`,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
// Listed, not booked here - see `prepaidNotHere`.
|
|
296
|
+
if (room.notSoldHere) {
|
|
297
|
+
const open = dated.rooms.filter((r) => !r.notSoldHere && r.sleeps >= stay.guests && r.roomsLeft >= wanted);
|
|
298
|
+
return prepaidNotHere(room, open, stay, 'for those nights', wanted);
|
|
299
|
+
}
|
|
300
|
+
deps.trips.set(store, {
|
|
301
|
+
kind: 'room',
|
|
302
|
+
hotelId,
|
|
303
|
+
roomId: room.id,
|
|
304
|
+
stay,
|
|
305
|
+
rooms: clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE),
|
|
306
|
+
});
|
|
307
|
+
const now = await currentTrip(deps, key, identity(deps, ctx, key), store, couponOf(deps, args), ctx);
|
|
308
|
+
// Which rate was taken, in the structure too and in the same words - see
|
|
309
|
+
// the itinerary's `nudges` (2026-10-27 audit, F11).
|
|
310
|
+
return took
|
|
311
|
+
? { ...now, structured: { ...now.structured, took }, text: `${took}\n${now.text}` }
|
|
312
|
+
: now;
|
|
313
|
+
};
|
|
314
|
+
//# sourceMappingURL=put-room-line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"put-room-line.js","sourceRoot":"","sources":["../../src/tools/put-room-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;;GAMG;AACH,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AI,CAAC,KAAK,IAAI,CAAC,EAAE,kBAAkB,CAAC;KACvD,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,MAAM,WAAW,CAC3B,IAAI,EACJ,GAAG,EACH,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EACxB,KAAK,EACL,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,EACpB,GAAG,CACJ,CAAC;IACF,yEAAyE;IACzE,oDAAoD;IACpD,OAAO,IAAI;QACT,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,UAAU,EAAE,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,KAAK,GAAG,CAAC,IAAI,EAAE,EAAE;QACnF,CAAC,CAAC,GAAG,CAAC;AACV,CAAC,CAAC"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { CouponKeptWhy, HeldCoupon, Member, Money, Names, Quote, Room } from '../types.js';
|
|
2
|
+
import type { Lang, ToolAnswer, ToolDeps } from './deps.js';
|
|
3
|
+
/**
|
|
4
|
+
* The language the CARD speaks to this guest - its own buttons, labels and
|
|
5
|
+
* dates. What the server writes for the model stays English.
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ PER TRIP, NOT ONLY PER BRAND (总线程, 2026-10-12): today it is the
|
|
8
|
+
* deployment's (Huazhu's single store is Chinese), and a guest's own choice -
|
|
9
|
+
* as the market's \`set_language\` keeps one per buyer - is meant to come in
|
|
10
|
+
* HERE, by \`key\`, without the card or the schema changing.
|
|
11
|
+
*/
|
|
12
|
+
export declare const langOf: (deps: ToolDeps, _key?: string) => Lang | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* When a room stops being free to cancel, the way a guest reads it: the
|
|
15
|
+
* hotel's own clock when the backend knows it, else the instant in UTC - never
|
|
16
|
+
* the date alone (see `atHotelTime`).
|
|
17
|
+
*/
|
|
18
|
+
/** A rate whose own name already says it cannot be refunded - see T10 where a booking is said. */
|
|
19
|
+
export declare const SAYS_NON_REFUNDABLE: RegExp;
|
|
20
|
+
export declare const freeUntilText: (r: {
|
|
21
|
+
freeCancellationUntil?: string;
|
|
22
|
+
freeCancellationLocal?: string;
|
|
23
|
+
}) => string;
|
|
24
|
+
/**
|
|
25
|
+
* A name as the words to a client that draws no card say it: the plain name,
|
|
26
|
+
* then the group's own Chinese name in () where it has one the plain name is
|
|
27
|
+
* not.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ THE GROUP'S NAME, NOT THE MODEL'S (2026-11-02 audit, P1-1). The Chinese
|
|
30
|
+
* names were only in the structure, and a model that is handed the text alone
|
|
31
|
+
* told a Chinese guest 「浦东凯里酒店」 for 上海浦东嘉里大酒店 - a name nobody
|
|
32
|
+
* can find the hotel by. A card host is told the plain name as ever: its card
|
|
33
|
+
* says the Chinese.
|
|
34
|
+
*/
|
|
35
|
+
export declare const withZh: (name: string, names: Names | undefined, noCards: boolean | undefined) => string;
|
|
36
|
+
/**
|
|
37
|
+
* What a signed-in member's prices are, said once at the top of a hotel's
|
|
38
|
+
* rooms - with the cheapest one's public and member figures, so "member rate"
|
|
39
|
+
* is a number the guest can check (10-30: the rooms were at the member rate
|
|
40
|
+
* and nothing told the model so).
|
|
41
|
+
*/
|
|
42
|
+
export declare const memberRatesOf: (rooms: Room[], roomsWanted: number) => {
|
|
43
|
+
programme: string;
|
|
44
|
+
tier: string;
|
|
45
|
+
discount: number;
|
|
46
|
+
said: string;
|
|
47
|
+
} | undefined;
|
|
48
|
+
/** A held coupon for the card: its amounts as text, like every amount the card is given. */
|
|
49
|
+
export declare const couponForCard: (c: HeldCoupon & {
|
|
50
|
+
off?: Money;
|
|
51
|
+
spend?: Money;
|
|
52
|
+
}) => {
|
|
53
|
+
spend?: string | Money | undefined;
|
|
54
|
+
off?: string | Money | undefined;
|
|
55
|
+
minSpend?: string | Money | undefined;
|
|
56
|
+
maxOff?: string | Money | undefined;
|
|
57
|
+
amountOff?: string | Money | undefined;
|
|
58
|
+
id: string;
|
|
59
|
+
kind: import("../types.js").CouponKind;
|
|
60
|
+
name: string;
|
|
61
|
+
names?: Names;
|
|
62
|
+
percentOff?: number;
|
|
63
|
+
brands?: {
|
|
64
|
+
name: string;
|
|
65
|
+
names?: Names;
|
|
66
|
+
}[];
|
|
67
|
+
hotels?: {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
names?: Names;
|
|
71
|
+
}[];
|
|
72
|
+
validFrom: string;
|
|
73
|
+
validUntil: string;
|
|
74
|
+
state: "usable" | "used" | "expired" | "not-yet";
|
|
75
|
+
usedOn?: {
|
|
76
|
+
code?: string;
|
|
77
|
+
stands: boolean;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/** One line of a trip, flattened for the card. Prices are strings: the card never does arithmetic. */
|
|
81
|
+
export declare const quoteForCard: (quote: Quote, groupOf?: (hotelId: string) => string | undefined) => {
|
|
82
|
+
dropped?: import("../types.js").DroppedLine[] | undefined;
|
|
83
|
+
stay?: import("../types.js").Stay | undefined;
|
|
84
|
+
coupons?: {
|
|
85
|
+
spend?: string | Money | undefined;
|
|
86
|
+
off?: string | Money | undefined;
|
|
87
|
+
minSpend?: string | Money | undefined;
|
|
88
|
+
maxOff?: string | Money | undefined;
|
|
89
|
+
amountOff?: string | Money | undefined;
|
|
90
|
+
id: string;
|
|
91
|
+
kind: import("../types.js").CouponKind;
|
|
92
|
+
name: string;
|
|
93
|
+
names?: Names;
|
|
94
|
+
percentOff?: number;
|
|
95
|
+
brands?: {
|
|
96
|
+
name: string;
|
|
97
|
+
names?: Names;
|
|
98
|
+
}[];
|
|
99
|
+
hotels?: {
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
names?: Names;
|
|
103
|
+
}[];
|
|
104
|
+
validFrom: string;
|
|
105
|
+
validUntil: string;
|
|
106
|
+
state: "usable" | "used" | "expired" | "not-yet";
|
|
107
|
+
usedOn?: {
|
|
108
|
+
code?: string;
|
|
109
|
+
stands: boolean;
|
|
110
|
+
};
|
|
111
|
+
}[] | undefined;
|
|
112
|
+
couponRefused?: {
|
|
113
|
+
spend?: string | Money | undefined;
|
|
114
|
+
minSpend?: string | Money | undefined;
|
|
115
|
+
id: string;
|
|
116
|
+
name?: string;
|
|
117
|
+
names?: Names;
|
|
118
|
+
code: import("../types.js").CouponRefusal;
|
|
119
|
+
why: string;
|
|
120
|
+
} | undefined;
|
|
121
|
+
coupon?: {
|
|
122
|
+
off: string;
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
names?: Names;
|
|
126
|
+
kind: import("../types.js").CouponKind;
|
|
127
|
+
hotelId: string;
|
|
128
|
+
hotelName: string;
|
|
129
|
+
hotelNames?: Names;
|
|
130
|
+
checkIn: string;
|
|
131
|
+
checkOut: string;
|
|
132
|
+
validUntil: string;
|
|
133
|
+
} | undefined;
|
|
134
|
+
memberSaving?: {
|
|
135
|
+
memberTotal: string;
|
|
136
|
+
roomSaved?: string | undefined;
|
|
137
|
+
saved: string;
|
|
138
|
+
publicTotal: string;
|
|
139
|
+
publicSubtotal: string;
|
|
140
|
+
programme: string;
|
|
141
|
+
tier: string;
|
|
142
|
+
points: number;
|
|
143
|
+
} | undefined;
|
|
144
|
+
lines: {
|
|
145
|
+
day: string | undefined;
|
|
146
|
+
paymentNotConnected?: boolean | undefined;
|
|
147
|
+
payment?: "at-hotel" | "prepaid" | undefined;
|
|
148
|
+
freeCancellationLocalIso?: string | undefined;
|
|
149
|
+
freeCancellationLocal?: string | undefined;
|
|
150
|
+
freeCancellationUntil: string | undefined;
|
|
151
|
+
terms?: string | undefined;
|
|
152
|
+
refundable: boolean | undefined;
|
|
153
|
+
totalWithTaxes?: string | undefined;
|
|
154
|
+
total: string;
|
|
155
|
+
publicUnit?: string | undefined;
|
|
156
|
+
roomCharges?: string | undefined;
|
|
157
|
+
unit: string;
|
|
158
|
+
ordered?: number | undefined;
|
|
159
|
+
quantity: number | undefined;
|
|
160
|
+
hourly?: import("../types.js").HourlyStay | undefined;
|
|
161
|
+
stay: import("../types.js").Stay | undefined;
|
|
162
|
+
nights: number | undefined;
|
|
163
|
+
rate?: {
|
|
164
|
+
name: string;
|
|
165
|
+
kind?: import("../types.js").RateKind;
|
|
166
|
+
} | undefined;
|
|
167
|
+
meal?: import("../types.js").MealPlan | undefined;
|
|
168
|
+
window?: import("../types.js").WindowKind | undefined;
|
|
169
|
+
bedTypes?: import("../types.js").BedType[] | undefined;
|
|
170
|
+
detail: string | undefined;
|
|
171
|
+
titleNames?: Partial<Record<import("../types.js").NameLang, string>> | undefined;
|
|
172
|
+
roomRef: string | undefined;
|
|
173
|
+
extraRef: string | undefined;
|
|
174
|
+
title: string;
|
|
175
|
+
hotelNames?: Partial<Record<import("../types.js").NameLang, string>> | undefined;
|
|
176
|
+
hotelName: string;
|
|
177
|
+
supplier?: string | undefined;
|
|
178
|
+
kind: "room" | "extra";
|
|
179
|
+
hotelId: string;
|
|
180
|
+
}[];
|
|
181
|
+
subtotal: string;
|
|
182
|
+
taxesAndFees: string;
|
|
183
|
+
total: string;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* A coupon's name as a guest of either language reads it: the programme's
|
|
187
|
+
* Chinese beside its English - "满500减50 (¥50 off a stay of ¥500)".
|
|
188
|
+
*/
|
|
189
|
+
export declare const couponName: (c: {
|
|
190
|
+
name: string;
|
|
191
|
+
names?: Names;
|
|
192
|
+
}) => string;
|
|
193
|
+
/** "A, B or C". */
|
|
194
|
+
export declare const listOrWords: (xs: string[]) => string;
|
|
195
|
+
/** What a held coupon is - what it takes off, where, until when - and where it stands. */
|
|
196
|
+
export declare const couponTerms: (c: HeldCoupon, brand: string) => string;
|
|
197
|
+
/**
|
|
198
|
+
* What cancelling does to the coupon a booking used - and why.
|
|
199
|
+
*
|
|
200
|
+
* ⚠️ BACK ONLY FOR A FREE CANCELLATION IN THE COUPON'S DATES (robin,
|
|
201
|
+
* 2026-11-03, C10). A cancellation that charges a fee counts the coupon as
|
|
202
|
+
* used: it already took money off a stay that is being paid for. The reason is
|
|
203
|
+
* said in the words (`fee` / `expired`) and as the same code in the structure
|
|
204
|
+
* (`notReturnedBecause`), so a host that draws no card has it too. `fee` is the
|
|
205
|
+
* charge as text, for the sentence.
|
|
206
|
+
*/
|
|
207
|
+
export declare const couponBackWords: (c: {
|
|
208
|
+
name: string;
|
|
209
|
+
names?: Names;
|
|
210
|
+
validUntil: string;
|
|
211
|
+
returned: boolean;
|
|
212
|
+
notReturnedBecause?: CouponKeptWhy;
|
|
213
|
+
}, fee?: string,
|
|
214
|
+
/** Said after the cancellation, not before it. */
|
|
215
|
+
done?: boolean,
|
|
216
|
+
/**
|
|
217
|
+
* The booking was never sent to its group: nothing is charged, and the fee is the
|
|
218
|
+
* terms' - "this cancellation was charged a fee" beside "nothing is charged" said
|
|
219
|
+
* money was taken (0.55.7, 总线程 11-05; the card says it the same way).
|
|
220
|
+
*/
|
|
221
|
+
notSent?: boolean) => string;
|
|
222
|
+
/** Beside a member sign-in's answer where a card is drawn: the link and its short code, the card's alone. */
|
|
223
|
+
export declare const MEMBER_SIGN_IN_META_KEY = "curless/member-sign-in";
|
|
224
|
+
export declare const MEMBER_NEVER_IN_CHAT = "Never in this chat: do not ask for, or accept, a membership number or a surname here, and never write back one the guest typed - not even to say which to change.";
|
|
225
|
+
/**
|
|
226
|
+
* A signed-in member, as the model reads it (0.58.0): signed in, the tier and
|
|
227
|
+
* what it takes off, the points and the coupons - what pricing and booking
|
|
228
|
+
* need. ⚠️ NOT THE NAME OR THE NUMBER: those are the card's, beside the answer
|
|
229
|
+
* (server.ts `memberApart`) - the model is told who is signed in by what the
|
|
230
|
+
* membership does, not who it is.
|
|
231
|
+
*/
|
|
232
|
+
export declare const memberAnswer: (deps: ToolDeps, key: string, member: Member, lead: string) => ToolAnswer;
|
|
233
|
+
export declare const tripText: (quote: Quote, noCards?: boolean) => string;
|
|
234
|
+
//# sourceMappingURL=quote-card.d.ts.map
|
|
@@ -0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