@curless/hotel-storefront 0.77.4 → 0.77.6
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/backend.d.ts +20 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +10 -0
- package/dist/backend.js.map +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/config.d.ts +21 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/huazhu/backend.d.ts +30 -2
- package/dist/huazhu/backend.d.ts.map +1 -1
- package/dist/huazhu/backend.js +224 -56
- package/dist/huazhu/backend.js.map +1 -1
- package/dist/huazhu/catalog.d.ts +12 -0
- package/dist/huazhu/catalog.d.ts.map +1 -1
- package/dist/huazhu/catalog.js +32 -0
- package/dist/huazhu/catalog.js.map +1 -1
- package/dist/huazhu/make.d.ts.map +1 -1
- package/dist/huazhu/make.js +41 -2
- package/dist/huazhu/make.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +2 -2
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +8 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +130 -18
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { aboutLines } from './about.js';
|
|
2
|
-
import { DEFAULT_PAGE, FULL_CAPABILITIES, LASTING_REQUESTS, MAX_PAGE, REQUEST_KINDS, REQUEST_NOTE_MAX, guestTooLong, maskedEmail, notPricedForNoAnswer, unansweredBy, unitWords, wholeEmail, } from './backend.js';
|
|
2
|
+
import { DEFAULT_PAGE, FULL_CAPABILITIES, LASTING_REQUESTS, MAX_PAGE, REQUEST_KINDS, REQUEST_NOTE_MAX, guestTooLong, maskedEmail, notPricedForNoAnswer, unansweredBy, unitWords, unpaidBookingNote, wholeEmail, } from './backend.js';
|
|
3
3
|
import { PAY_WORDS, allOrEach, choiceBlock, payOf, paymentOf, saysOwn, sentenceOf, setsApart, sharedBy, spreadOf, } from './choices.js';
|
|
4
4
|
import { usedOnWords } from './coupon-words.js';
|
|
5
5
|
import { MAX_GUESTS, addDays, dateOptions, dayWords, isDay, nights as nightsBetween, stayDayWords, toDay, weekendOf, weekendWords, } from './dates.js';
|
|
@@ -432,7 +432,7 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
432
432
|
: `none of it is sent to ${v.brand} or holds a real room`}. ${caps.prepaid
|
|
433
433
|
? 'A rate marked paid in advance is booked on its own, and not at once: the answer gives a card page where no real money moves and the time it is paid by, and the stay is booked once it is paid - no card is collected here. Every other rate is paid by nobody.'
|
|
434
434
|
: 'No payment is taken and no card is collected.'} All of the trip is booked or none of it. Preferences - a bed type, a floor, a late arrival - ride along on the booking as requests.`
|
|
435
|
-
: `Books the trip's rooms with ${v.brand} for a named guest: each stay becomes the hotel's own reservation, with its own confirmation code, paid at the hotel. No payment is taken here and no card is collected. All of the trip is booked or none of it. Only rates paid at the hotel can be booked here. Preferences - a bed type, a floor, a late arrival - ride along on the booking as requests the desk tries to meet.`,
|
|
435
|
+
: `Books the trip's rooms with ${v.brand} for a named guest: each stay becomes the hotel's own reservation, with its own confirmation code, paid at the hotel. No payment is taken here and no card is collected. All of the trip is booked or none of it. ${caps.unpaidBooking ? `Rates paid at the hotel can be booked here. ${unpaidBookingNote(v.brand, caps.unpaidBooking.hotels)}` : 'Only rates paid at the hotel can be booked here.'} Preferences - a bed type, a floor, a late arrival - ride along on the booking as requests the desk tries to meet.`,
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
438
|
// The card's own step books the same way, and the same is true of it (总线程 11-18,
|
|
@@ -445,7 +445,9 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
445
445
|
!v.demo)
|
|
446
446
|
out = {
|
|
447
447
|
...out,
|
|
448
|
-
description:
|
|
448
|
+
description: caps.unpaidBooking
|
|
449
|
+
? `${out.description} Rates paid at the hotel can be booked here. ${unpaidBookingNote(v.brand, caps.unpaidBooking.hotels)}`
|
|
450
|
+
: `${out.description} Only rates paid at the hotel can be booked here.`,
|
|
449
451
|
};
|
|
450
452
|
}
|
|
451
453
|
// ⚠️ ORDERS ARE THE ACCOUNT'S (0.75.0, T5/T6; OpenAI: only the data that is needed).
|
|
@@ -2451,7 +2453,13 @@ const madeForCard = (deps, b) => {
|
|
|
2451
2453
|
const { confirmationCode: _unconfirmed, ...rest } = card;
|
|
2452
2454
|
return { ...rest, pending: true };
|
|
2453
2455
|
};
|
|
2454
|
-
const bookedLine = (deps, b) => [
|
|
2456
|
+
const bookedLine = (deps, b) => [
|
|
2457
|
+
unconfirmedSaid(deps, b),
|
|
2458
|
+
heldLine(deps, b),
|
|
2459
|
+
// The group's own number, where the booking has one (0.77.6).
|
|
2460
|
+
b.orderNumber ? `Order number ${b.orderNumber}.` : '',
|
|
2461
|
+
couponPointsLine(b, holderOf(deps, b.supplier)),
|
|
2462
|
+
]
|
|
2455
2463
|
.filter(Boolean)
|
|
2456
2464
|
.join(' ');
|
|
2457
2465
|
/**
|
|
@@ -2483,6 +2491,12 @@ const heldLine = (deps, b) => {
|
|
|
2483
2491
|
return `${total} all in. **This booking was not sent to ${h.name}** - no room is held for anyone and nothing is paid, now or at any hotel. ${notSentSaid(h.name)}`;
|
|
2484
2492
|
if (h.test)
|
|
2485
2493
|
return `${total} all in. **This booking holds no room for anyone** - nothing is paid, now or at any hotel, and nobody needs to go there.`;
|
|
2494
|
+
// ⚠️ A RATE PAID IN ADVANCE, BOOKED WITHOUT ITS PAYMENT (0.77.5): never "paid at the
|
|
2495
|
+
// hotel". That nothing was paid is `bookingNotes`' sentence, said after this one.
|
|
2496
|
+
if (b.paymentNotConnected)
|
|
2497
|
+
return b.status === 'requested'
|
|
2498
|
+
? `${total} all in. ${h.name} has not confirmed this order yet - that takes up to eight minutes, and ${deps.tools.listBookings} shows when it has.`
|
|
2499
|
+
: `${total} all in. The order is created with ${h.name}, under confirmation code ${b.confirmationCode}.`;
|
|
2486
2500
|
return b.status === 'requested'
|
|
2487
2501
|
? `${total} all in, to be paid at the hotel. ${h.name} has not confirmed this booking yet - that takes up to eight minutes, and ${deps.tools.listBookings} shows when it has. Nothing has been charged.`
|
|
2488
2502
|
: `${total} all in, paid at the hotel. **Nothing has been charged here** - this is ${h.name}'s own reservation, kept until it is cancelled, and the guest pays at check-in.`;
|
|
@@ -2710,6 +2724,8 @@ const quoteForCard = (quote, groupOf) => ({
|
|
|
2710
2724
|
// Paid in advance: the review says so, and its button leads to the
|
|
2711
2725
|
// payment page rather than to a booking (香格里拉's card, 2026-10-12).
|
|
2712
2726
|
...(l.payment ? { payment: l.payment } : {}),
|
|
2727
|
+
// …or, paid in advance, booked with no payment taken (0.77.5): the review says that instead.
|
|
2728
|
+
...(l.paymentNotConnected ? { paymentNotConnected: true } : {}),
|
|
2713
2729
|
day: l.day,
|
|
2714
2730
|
})),
|
|
2715
2731
|
subtotal: formatMoney(quote.subtotal),
|
|
@@ -3238,6 +3254,8 @@ const labelWords = (r) => {
|
|
|
3238
3254
|
// Paid in advance, and nothing more - not "not booked here" (0.75.1, robin 11-18:
|
|
3239
3255
|
// that is said when the guest wants one - `notSoldHereWords`).
|
|
3240
3256
|
...(r.payment === 'prepaid' ? ['paid in advance'] : []),
|
|
3257
|
+
// …and booked here all the same, with nothing charged (0.77.5 - `unpaidBookingWords`).
|
|
3258
|
+
...(r.paymentNotConnected ? [UNPAID_TAG] : []),
|
|
3241
3259
|
];
|
|
3242
3260
|
return words.length ? ` [${words.join(', ')}]` : '';
|
|
3243
3261
|
};
|
|
@@ -3294,7 +3312,20 @@ const OWN_WHY = {
|
|
|
3294
3312
|
* `huazhu-prod-text-one-hotel-is-numbered`, 0/3). robin meant not to volunteer that it cannot
|
|
3295
3313
|
* be booked here, never to hide how a rate is paid: the two are said apart.
|
|
3296
3314
|
*/
|
|
3297
|
-
export const notSoldHereWords = (group
|
|
3315
|
+
export const notSoldHereWords = (group, someBookedHere = false) => someBookedHere
|
|
3316
|
+
? // ⚠️ BESIDE RATES PAID IN ADVANCE THAT ARE BOOKED HERE (0.77.5, `unpaidBookingWords`):
|
|
3317
|
+
// "only rates paid at the hotel can be" would not be true of this answer.
|
|
3318
|
+
`Rates marked paid in advance are listed as ${group} sells them. Say "paid in advance" of each, as this answer marks it: it is how that rate is paid, and it stays in your reply. Those also marked "${UNPAID_TAG}" can be booked here; what you do not bring up on your own is that the other rates paid in advance cannot be booked here yet. Only when the guest wants one of those - asks to book it, or you go to book it - say that plainly - nothing is booked or charged - and ${waysOnWords(group, `a rate marked "${UNPAID_TAG}" or one paid at the hotel, where this answer lists one`)}`
|
|
3319
|
+
: `Rates marked paid in advance are listed as ${group} sells them. Say "paid in advance" of each, as this answer marks it: it is how that rate is paid, and it stays in your reply. What you do not bring up on your own is that a stay paid in advance cannot be booked here yet; only rates paid at the hotel can be. Only when the guest wants one - asks to book it, or you go to book it - say that plainly - nothing is booked or charged - and ${waysOnWords(group, 'a rate paid at the hotel, where this answer lists one')}`;
|
|
3320
|
+
/** The tag a rate paid in advance that is booked here without its payment carries (0.77.5). */
|
|
3321
|
+
const UNPAID_TAG = 'booked here, nothing charged';
|
|
3322
|
+
/**
|
|
3323
|
+
* What is said of rates paid in advance that ARE booked here, without their payment (0.77.5,
|
|
3324
|
+
* robin 2026-11-19 - `Room.paymentNotConnected`, Huazhu's `data.api.demoBooking`): in the text
|
|
3325
|
+
* and, word for word, in the structure (`bookedWithoutPayment`) - the model reads the structure.
|
|
3326
|
+
* The fact, and nothing about what kind of booking it is.
|
|
3327
|
+
*/
|
|
3328
|
+
export const unpaidBookingWords = (group) => `Rates marked "${UNPAID_TAG}" are paid in advance and CAN be booked here now: booking one creates the order with ${group} at once, and no payment is taken - nothing is charged, because payment is not connected here yet. Say that when the guest wants one; never that it is paid at the hotel, and never that it cannot be booked here.`;
|
|
3298
3329
|
/**
|
|
3299
3330
|
* Where a guest goes from a rate paid in advance (总线程 11-09, Manus on Huazhu:
|
|
3300
3331
|
* 「选最便宜那个」 was answered "it cannot be booked here" and nothing more,
|
|
@@ -3608,7 +3639,13 @@ readOnly = false) => {
|
|
|
3608
3639
|
blocks,
|
|
3609
3640
|
ids: rows.map(({ r }) => r.id),
|
|
3610
3641
|
// How it is paid, for the model too (0.75.1: no "not booked here" before the guest wants one).
|
|
3611
|
-
notes: rows.map(({ r }) =>
|
|
3642
|
+
notes: rows.map(({ r }) => readOnly
|
|
3643
|
+
? ''
|
|
3644
|
+
: r.notSoldHere
|
|
3645
|
+
? 'paid in advance'
|
|
3646
|
+
: r.paymentNotConnected
|
|
3647
|
+
? `paid in advance, ${UNPAID_TAG}`
|
|
3648
|
+
: ''),
|
|
3612
3649
|
};
|
|
3613
3650
|
};
|
|
3614
3651
|
/**
|
|
@@ -3896,9 +3933,20 @@ const confirmUnseenWords = (deps, b) => {
|
|
|
3896
3933
|
const autoAcceptedWords = (deps, b) => b.groupTermsAutoAccepted
|
|
3897
3934
|
? `${holderOf(deps, b.supplier).name} asked for its terms to be agreed to before booking but gave no text of them; this service agreed to them on the guest's behalf when it placed the booking.`
|
|
3898
3935
|
: '';
|
|
3899
|
-
const bookingNotes = (deps, b) => [noTermsWords(deps, b), autoAcceptedWords(deps, b), confirmUnseenWords(deps, b)]
|
|
3936
|
+
const bookingNotes = (deps, b) => [noTermsWords(deps, b), autoAcceptedWords(deps, b), confirmUnseenWords(deps, b), notPaidWords(b)]
|
|
3900
3937
|
.filter(Boolean)
|
|
3901
3938
|
.join(' ');
|
|
3939
|
+
/**
|
|
3940
|
+
* A booking of a rate paid in advance made without its payment (0.77.5,
|
|
3941
|
+
* `Booking.paymentNotConnected`): the fact - not paid, nothing charged, payment not connected
|
|
3942
|
+
* here yet - in the text and, word for word, in the structure (`notPaidSaid`). Never "paid at
|
|
3943
|
+
* the hotel", and nothing about what kind of booking it is.
|
|
3944
|
+
*/
|
|
3945
|
+
const notPaidWords = (b) => !b.paymentNotConnected
|
|
3946
|
+
? ''
|
|
3947
|
+
: b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed'
|
|
3948
|
+
? 'Nothing was paid or charged for this booking.'
|
|
3949
|
+
: '**It is not paid: nothing has been charged** - payment is not connected here yet. Say exactly that; never that it is paid at the hotel.';
|
|
3902
3950
|
/** A booking for the card and the model's structure, with `notSentStatus` where there is one. */
|
|
3903
3951
|
const listedForCard = (deps, b) => {
|
|
3904
3952
|
const said = notSentStatus(deps, b) ?? unconfirmedSaid(deps, b);
|
|
@@ -3907,6 +3955,8 @@ const listedForCard = (deps, b) => {
|
|
|
3907
3955
|
// 0.67.1: no terms given / may need the group's own confirmation - the same words as the text.
|
|
3908
3956
|
...(b.noTermsGiven ? { noTermsSaid: noTermsWords(deps, b) } : {}),
|
|
3909
3957
|
...(b.confirmUnseen ? { confirmUnseenSaid: confirmUnseenWords(deps, b) } : {}),
|
|
3958
|
+
// 0.77.5: booked without its payment - the same words as the text.
|
|
3959
|
+
...(b.paymentNotConnected ? { notPaidSaid: notPaidWords(b) } : {}),
|
|
3910
3960
|
// 0.68.1: the group's terms agreed for the guest - the same words as the text.
|
|
3911
3961
|
...(b.groupTermsAutoAccepted ? { termsAutoAcceptedSaid: autoAcceptedWords(deps, b) } : {}),
|
|
3912
3962
|
...(said ? { statusSaid: said } : {}),
|
|
@@ -4242,7 +4292,7 @@ const bookingLine = (deps, b, noCards) => {
|
|
|
4242
4292
|
const held = noCards ? heldRoomsWords(b) : '';
|
|
4243
4293
|
const notSent = holderOf(deps, b.supplier).notReal;
|
|
4244
4294
|
return [
|
|
4245
|
-
`${b.confirmationCode} · ${withZh(b.hotelName, b.hotelNames, noCards)} · ${stayWords(b.stay, b.hourly)} · ${notSentStatus(deps, b) ??
|
|
4295
|
+
`${b.confirmationCode}${b.orderNumber ? ` (order number ${b.orderNumber})` : ''} · ${withZh(b.hotelName, b.hotelNames, noCards)} · ${stayWords(b.stay, b.hourly)} · ${notSentStatus(deps, b) ??
|
|
4246
4296
|
unconfirmedSaid(deps, b) ??
|
|
4247
4297
|
// ⚠️ SAID AS WHAT IT IS - see BookingStatus. Neither booked nor failed.
|
|
4248
4298
|
(b.status === 'unconfirmed'
|
|
@@ -5809,7 +5859,13 @@ readOnly = false) => {
|
|
|
5809
5859
|
said,
|
|
5810
5860
|
blocks,
|
|
5811
5861
|
// How its price is paid (0.75.1: no "not booked here" before the guest wants one).
|
|
5812
|
-
notes: hotels.map((h) =>
|
|
5862
|
+
notes: hotels.map((h) => readOnly
|
|
5863
|
+
? ''
|
|
5864
|
+
: h.forStay?.notSoldHere
|
|
5865
|
+
? 'its price is paid in advance'
|
|
5866
|
+
: h.forStay?.paymentNotConnected
|
|
5867
|
+
? `its price is paid in advance, ${UNPAID_TAG}`
|
|
5868
|
+
: ''),
|
|
5813
5869
|
};
|
|
5814
5870
|
};
|
|
5815
5871
|
/**
|
|
@@ -6220,8 +6276,15 @@ const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
|
|
|
6220
6276
|
// ONE ANSWER FOR A ROOM BY THE NIGHT AND A ROOM BY THE HOUR (2026-11-03
|
|
6221
6277
|
// review, C6): the hourly branch put such a room in the trip before this was
|
|
6222
6278
|
// asked, and the guest met the refusal at "Book".
|
|
6223
|
-
const prepaidNotHere = (room,
|
|
6279
|
+
const prepaidNotHere = (room, bookable, stay, when, wanted = 1) => {
|
|
6224
6280
|
const group = groupNameOf(deps, hotelId);
|
|
6281
|
+
// ⚠️ "PAID AT THE HOTEL" ONLY OF RATES THAT ARE (0.77.5): beside them, a hotel may have rates
|
|
6282
|
+
// paid in advance that are booked here without payment (`Room.paymentNotConnected`) - said
|
|
6283
|
+
// as those, never listed as paid at the hotel, and left off the card's list of them.
|
|
6284
|
+
const unpaid = bookable
|
|
6285
|
+
.filter((r) => r.paymentNotConnected)
|
|
6286
|
+
.sort((a, b) => a.stayTotal.minor - b.stayTotal.minor);
|
|
6287
|
+
const open = bookable.filter((r) => r.payment !== 'prepaid');
|
|
6225
6288
|
// ⚠️ WITH THEIR PRICES, CHEAPEST FIRST, AND THE WAYS ON SAID (总线程 11-09,
|
|
6226
6289
|
// Manus on Huazhu): the names alone and "the other ways on" last, and the
|
|
6227
6290
|
// model told the guest only that the room could not be booked here.
|
|
@@ -6233,15 +6296,25 @@ const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
|
|
|
6233
6296
|
: wanted > 1
|
|
6234
6297
|
? `${formatMoney(multiplyMoney(r.stayTotal, wanted))} for ${wanted} rooms, for the stay incl. taxes and fees`
|
|
6235
6298
|
: `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
6299
|
+
const named = (rs) => rs
|
|
6300
|
+
.map((r) => `${withZh(r.name, r.roomType ? r.roomType.names : r.names, true)} (\`${r.id}\`) - ${price(r)}`)
|
|
6301
|
+
.join('; ');
|
|
6236
6302
|
const said = [
|
|
6237
|
-
|
|
6303
|
+
unpaid.length
|
|
6304
|
+
? `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.`
|
|
6305
|
+
: `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.`,
|
|
6238
6306
|
priced.length
|
|
6239
|
-
? `Paid at the hotel at ${detail.hotel.name} ${when}, cheapest first: ${priced
|
|
6307
|
+
? `Paid at the hotel at ${detail.hotel.name} ${when}, cheapest first: ${named(priced)}.`
|
|
6240
6308
|
: `No rate at ${detail.hotel.name} ${when} is paid at the hotel.`,
|
|
6241
|
-
|
|
6242
|
-
?
|
|
6309
|
+
unpaid.length
|
|
6310
|
+
? `Paid in advance and booked here with nothing charged (payment is not connected here yet) at ${detail.hotel.name} ${when}, cheapest first: ${named(unpaid)}.`
|
|
6311
|
+
: '',
|
|
6312
|
+
`Tell the guest that nothing was booked, and ${waysOnWords(group, priced.length || unpaid.length
|
|
6313
|
+
? `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`
|
|
6243
6314
|
: undefined)}`,
|
|
6244
|
-
]
|
|
6315
|
+
]
|
|
6316
|
+
.filter(Boolean)
|
|
6317
|
+
.join(' ');
|
|
6245
6318
|
return {
|
|
6246
6319
|
structured: {
|
|
6247
6320
|
view: 'error',
|
|
@@ -6882,6 +6955,22 @@ const bookTripLines = async (deps, t, ctx, key, store, args, nothingThere) => {
|
|
|
6882
6955
|
].join('\n\n'),
|
|
6883
6956
|
};
|
|
6884
6957
|
}
|
|
6958
|
+
// ⚠️ AS MANY BOOKINGS WITHOUT PAYMENT STAND AS MAY AT ONCE (0.77.5, `demoBooking`'s
|
|
6959
|
+
// `maxOpen`): nothing was booked or sent - its own code and the number, so the card says it
|
|
6960
|
+
// in the guest's language, with the bookings a press away.
|
|
6961
|
+
if (err.code === 'open-orders') {
|
|
6962
|
+
const max = Number(err.max);
|
|
6963
|
+
return {
|
|
6964
|
+
structured: {
|
|
6965
|
+
view: 'error',
|
|
6966
|
+
...common(deps, key),
|
|
6967
|
+
error: 'open-orders',
|
|
6968
|
+
detail: words,
|
|
6969
|
+
...(Number.isInteger(max) && max > 0 ? { max } : {}),
|
|
6970
|
+
},
|
|
6971
|
+
text: words,
|
|
6972
|
+
};
|
|
6973
|
+
}
|
|
6885
6974
|
// The group's checkout's own refusals - signed out, a guest detail missing,
|
|
6886
6975
|
// terms gone - each with its own code (`BOOKING_REFUSALS`).
|
|
6887
6976
|
const refused = refusalAnswer(deps, key, err);
|
|
@@ -7622,8 +7711,22 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7622
7711
|
// robin 11-18): 0.58.2 had a list whose every price was one say so before the list
|
|
7623
7712
|
// (总线程 11-09, Manus: 「选最便宜那个」 met "it cannot be booked here" and nothing more);
|
|
7624
7713
|
// now it is said when the guest wants one, with the ways on - as on the hotel's page.
|
|
7714
|
+
// …and a price paid in advance that IS booked here, without payment (0.77.5).
|
|
7715
|
+
const unpaidOn = hotels.find((h) => h.forStay?.paymentNotConnected);
|
|
7716
|
+
// …and, where the deployment books some hotels so and one of them is listed, that
|
|
7717
|
+
// one sentence whether or not a priced rate is among its rows (0.77.6): the first thing
|
|
7718
|
+
// a model read said "paid at the hotel" of the whole connector.
|
|
7719
|
+
const unpaidListed = (deps.backend.capabilities ?? FULL_CAPABILITIES).unpaidBooking?.hotels.filter((u) => hotels.some((h) => h.id === u.id));
|
|
7720
|
+
const unpaidHere = [
|
|
7721
|
+
unpaidListed?.length
|
|
7722
|
+
? unpaidBookingNote(groupNameOf(deps, unpaidListed[0]?.id ?? ''), unpaidListed)
|
|
7723
|
+
: '',
|
|
7724
|
+
unpaidOn ? unpaidBookingWords(groupNameOf(deps, unpaidOn.id)) : '',
|
|
7725
|
+
]
|
|
7726
|
+
.filter(Boolean)
|
|
7727
|
+
.join(' ');
|
|
7625
7728
|
const notSoldOn = hotels.find((h) => h.forStay?.notSoldHere);
|
|
7626
|
-
const notSold = notSoldOn ? notSoldHereWords(groupNameOf(deps, notSoldOn.id)) : '';
|
|
7729
|
+
const notSold = notSoldOn ? notSoldHereWords(groupNameOf(deps, notSoldOn.id), !!unpaidOn) : '';
|
|
7627
7730
|
// To a client that draws no card, the hotels as numbered lines - numbered
|
|
7628
7731
|
// across pages, so "the 23rd" on the second page is still one hotel. In the
|
|
7629
7732
|
// text and, word for word, in the structure (`hotelChoices`).
|
|
@@ -7740,6 +7843,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7740
7843
|
...(factsNote ? { hotelFactsNote: factsNote } : {}),
|
|
7741
7844
|
...(fromPrices ? { stayDefault: fromPrices } : {}),
|
|
7742
7845
|
...(ctx.drawsCards && hotels.length ? { cardShows: ON_CARD.hotels } : {}),
|
|
7846
|
+
...(unpaidHere ? { bookedWithoutPayment: unpaidHere } : {}),
|
|
7743
7847
|
...(notSold ? { notSoldHere: notSold } : {}),
|
|
7744
7848
|
...(notBookable ? { notBookable } : {}),
|
|
7745
7849
|
},
|
|
@@ -7760,6 +7864,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7760
7864
|
degraded.said,
|
|
7761
7865
|
hotelChoices ? `\n${LIST_NOT_DRAWN}\n${hotelChoices}\n` : '',
|
|
7762
7866
|
// After the hotels, never before them: for when the guest wants one (0.75.1).
|
|
7867
|
+
unpaidHere,
|
|
7763
7868
|
notSold,
|
|
7764
7869
|
factsNote,
|
|
7765
7870
|
ctx.drawsCards && hotels.length ? ON_CARD.hotels : '',
|
|
@@ -7947,8 +8052,13 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7947
8052
|
// card needs no call to the server.
|
|
7948
8053
|
const terms = roomTermsOf(args);
|
|
7949
8054
|
const soldOut = soldOutTypesOf(detail, enough, roomsWanted);
|
|
8055
|
+
// Rates paid in advance booked here without payment (0.77.5) - said beside, never instead of,
|
|
8056
|
+
// what is said of the ones not booked here.
|
|
8057
|
+
const unpaidHere = enough.some((r) => r.paymentNotConnected)
|
|
8058
|
+
? unpaidBookingWords(groupNameOf(deps, h.id))
|
|
8059
|
+
: '';
|
|
7950
8060
|
const notSold = enough.some((r) => r.notSoldHere)
|
|
7951
|
-
? notSoldHereWords(groupNameOf(deps, h.id))
|
|
8061
|
+
? notSoldHereWords(groupNameOf(deps, h.id), !!unpaidHere)
|
|
7952
8062
|
: '';
|
|
7953
8063
|
const rooms = enough.map(({ roomsLeft, refundable, ...r }) => ({
|
|
7954
8064
|
...r,
|
|
@@ -8034,6 +8144,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8034
8144
|
activeFilters: activeKeysOf(terms),
|
|
8035
8145
|
// Types with no room to book for these nights, said and not left out.
|
|
8036
8146
|
...(byTheHour || !soldOut.length ? {} : { soldOut }),
|
|
8147
|
+
...(unpaidHere ? { bookedWithoutPayment: unpaidHere } : {}),
|
|
8037
8148
|
...(notSold ? { notSoldHere: notSold } : {}),
|
|
8038
8149
|
...(memberRates ? { memberRates } : {}),
|
|
8039
8150
|
...flex.structured,
|
|
@@ -8058,6 +8169,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8058
8169
|
// Said before the list to a client that draws no card (`before`).
|
|
8059
8170
|
ctx.noCards && choosable.length ? '' : flexSaid,
|
|
8060
8171
|
// After the rooms, never before them: for when the guest wants one (0.75.1).
|
|
8172
|
+
unpaidHere,
|
|
8061
8173
|
notSold,
|
|
8062
8174
|
ctx.drawsCards && enough.length ? ON_CARD.rooms : '',
|
|
8063
8175
|
]
|
|
@@ -9104,7 +9216,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9104
9216
|
`${cancelled.confirmationCode} is cancelled. ${charged.minor === 0 ? 'No fee.' : `A real booking on this rate would be charged ${formatMoney(charged)}; this booking was never sent to ${h.name}, and nothing is charged.`}`
|
|
9105
9217
|
: h.test
|
|
9106
9218
|
? `${cancelled.confirmationCode} is cancelled. ${charged.minor === 0 ? 'No fee.' : `A real booking on this rate would be charged ${formatMoney(charged)}; this booking held no room for anyone, and nothing is charged.`}`
|
|
9107
|
-
: `${cancelled.confirmationCode} is cancelled. ${charged.minor === 0 ? 'No fee.' : `The hotel charges ${formatMoney(charged)}.`}`,
|
|
9219
|
+
: `${cancelled.confirmationCode} is cancelled. ${charged.minor === 0 ? 'No fee.' : `The hotel charges ${formatMoney(charged)}.`}${cancelled.paymentNotConnected ? ` ${notPaidWords(cancelled)}` : ''}`,
|
|
9108
9220
|
couponNow?.said ?? '',
|
|
9109
9221
|
demoBookingNote(deps, cancelled.supplier),
|
|
9110
9222
|
]
|