@curless/hotel-storefront 0.76.0 → 0.76.2
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/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 +33 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/legal.d.ts +31 -3
- package/dist/legal.d.ts.map +1 -1
- package/dist/legal.js +273 -22
- package/dist/legal.js.map +1 -1
- package/dist/otaless/backend.d.ts +31 -0
- package/dist/otaless/backend.d.ts.map +1 -1
- package/dist/otaless/backend.js +437 -85
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/make.d.ts.map +1 -1
- package/dist/otaless/make.js +3 -0
- package/dist/otaless/make.js.map +1 -1
- package/dist/present.d.ts.map +1 -1
- package/dist/present.js +7 -1
- package/dist/present.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +26 -5
- package/dist/server.js.map +1 -1
- package/dist/tools.d.ts +6 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +84 -40
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -3203,7 +3203,9 @@ const priceWords = (r, noCards) => r.hourly
|
|
|
3203
3203
|
* for a rate the group had priced for one night only.
|
|
3204
3204
|
*/
|
|
3205
3205
|
const wholeStayWords = (r) => r.stayTotalUnquoted
|
|
3206
|
-
?
|
|
3206
|
+
? // ⚠️ SAID AS NOT A TOTAL (0.76.1, the review of 11-18, H1): a night's price read beside
|
|
3207
|
+
// a stay's was taken for one.
|
|
3208
|
+
'not a total for these nights - no price from the group for the whole stay yet'
|
|
3207
3209
|
: `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
3208
3210
|
/**
|
|
3209
3211
|
* "a night" - and to a client that draws no card, "a night before taxes".
|
|
@@ -3285,8 +3287,14 @@ const OWN_WHY = {
|
|
|
3285
3287
|
* it - no sentence first, no "not booked here" on a price (0.65.0 said it before anything was
|
|
3286
3288
|
* chosen). The card says it when Reserve is pressed; the assistant when the guest asks to
|
|
3287
3289
|
* book one, or when it goes to book one (and the booking is refused, with the same ways on).
|
|
3290
|
+
*
|
|
3291
|
+
* ⚠️ "PAID IN ADVANCE" IS SAID, "NOT HERE" IS NOT (0.76.2, 总线程 11-18 for robin): 0.75.1's
|
|
3292
|
+
* "Do not bring that up on your own" was read as "do not bring up paid in advance" - the
|
|
3293
|
+
* model dropped it from a list whose text said "Paid in advance." (eval
|
|
3294
|
+
* `huazhu-prod-text-one-hotel-is-numbered`, 0/3). robin meant not to volunteer that it cannot
|
|
3295
|
+
* be booked here, never to hide how a rate is paid: the two are said apart.
|
|
3288
3296
|
*/
|
|
3289
|
-
export const notSoldHereWords = (group) => `Rates marked paid in advance are listed as ${group} sells them
|
|
3297
|
+
export const notSoldHereWords = (group) => `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')}`;
|
|
3290
3298
|
/**
|
|
3291
3299
|
* Where a guest goes from a rate paid in advance (总线程 11-09, Manus on Huazhu:
|
|
3292
3300
|
* 「选最便宜那个」 was answered "it cannot be booked here" and nothing more,
|
|
@@ -3442,12 +3450,18 @@ const roomChoicesBlock = (rooms, roomsWanted,
|
|
|
3442
3450
|
group,
|
|
3443
3451
|
/** Nothing can be booked here (`capabilities.readOnly`): said once, and no payment told apart. */
|
|
3444
3452
|
readOnly = false) => {
|
|
3453
|
+
// ⚠️ ONE ROOM'S STAY QUOTED BESIDE OTHERS' NIGHTS (0.76.1, Otaless - H1): where a stay total
|
|
3454
|
+
// is ours (`stayTotalUnquoted`) the rooms are put side by side by the group's rate a night,
|
|
3455
|
+
// and the one the group priced for the stay says "for the stay".
|
|
3456
|
+
const unquoted = rooms.some((r) => r.stayTotalUnquoted);
|
|
3457
|
+
const mixed = unquoted && rooms.some((r) => !r.stayTotalUnquoted && !r.hourly);
|
|
3458
|
+
const basis = (r) => (unquoted ? r.nightly.minor : r.stayTotal.minor);
|
|
3445
3459
|
const rows = byRoomType(rooms)
|
|
3446
3460
|
.map((type) => ({
|
|
3447
3461
|
type,
|
|
3448
|
-
r: type.rooms.reduce((a, b) => (b
|
|
3462
|
+
r: type.rooms.reduce((a, b) => (basis(b) < basis(a) ? b : a)),
|
|
3449
3463
|
}))
|
|
3450
|
-
.sort((a, b) => a.r
|
|
3464
|
+
.sort((a, b) => basis(a.r) - basis(b.r))
|
|
3451
3465
|
.map(({ type, r }) => ({ type, r, others: type.rooms.length - 1 }));
|
|
3452
3466
|
const many = roomsWanted > 1;
|
|
3453
3467
|
const price = (r) => r.hourly
|
|
@@ -3456,8 +3470,8 @@ readOnly = false) => {
|
|
|
3456
3470
|
? // ⚠️ A NIGHT'S PRICE, NOT OUR TOTAL (总线程 11-13, `Room.stayTotalUnquoted`).
|
|
3457
3471
|
`${formatMoney(r.nightly)} a night${many ? ', per room' : ''}`
|
|
3458
3472
|
: many
|
|
3459
|
-
? `${formatMoney(multiplyMoney(r.stayTotal, roomsWanted))} for ${roomsWanted} rooms`
|
|
3460
|
-
: formatMoney(r.stayTotal)
|
|
3473
|
+
? `${formatMoney(multiplyMoney(r.stayTotal, roomsWanted))} for ${roomsWanted} rooms${mixed ? ' for the stay' : ''}`
|
|
3474
|
+
: `${formatMoney(r.stayTotal)}${mixed ? ' for the stay' : ''}`;
|
|
3461
3475
|
// ⚠️ "BEFORE TAXES" ONLY WHERE IT IS SO (0.55.3): see `nightlyIncludesTaxes`.
|
|
3462
3476
|
const nightly = (r) => r.hourly
|
|
3463
3477
|
? ''
|
|
@@ -3477,9 +3491,9 @@ readOnly = false) => {
|
|
|
3477
3491
|
const pay = readOnly
|
|
3478
3492
|
? { said: '', tags: [] }
|
|
3479
3493
|
: paymentOf(rows.map(({ r }) => payOf(r)), 'room');
|
|
3480
|
-
const lowest = Math.min(...rows.map(({ r }) => r
|
|
3494
|
+
const lowest = Math.min(...rows.map(({ r }) => basis(r)));
|
|
3481
3495
|
const apart = {
|
|
3482
|
-
cheapest: setsApart(rows.map(({ r }) => !r.hourly && r
|
|
3496
|
+
cheapest: setsApart(rows.map(({ r }) => !r.hourly && basis(r) === lowest)),
|
|
3483
3497
|
breakfast: setsApart(rows.map(({ r }) => facetsOf(r).breakfast)),
|
|
3484
3498
|
free: setsApart(rows.map(({ r }) => facetsOf(r).freeCancellation)),
|
|
3485
3499
|
family: setsApart(rows.map(({ r }) => r.sleeps >= FAMILY_SLEEPS)),
|
|
@@ -3510,7 +3524,7 @@ readOnly = false) => {
|
|
|
3510
3524
|
]),
|
|
3511
3525
|
tags: [
|
|
3512
3526
|
pay.tags[i] ?? '',
|
|
3513
|
-
apart.cheapest && r
|
|
3527
|
+
apart.cheapest && basis(r) === lowest ? 'Lowest price' : '',
|
|
3514
3528
|
apart.breakfast && facetsOf(r).breakfast ? 'Breakfast' : '',
|
|
3515
3529
|
apart.free && facetsOf(r).freeCancellation ? 'Free cancellation' : '',
|
|
3516
3530
|
apart.family && r.sleeps >= FAMILY_SLEEPS ? `Sleeps ${r.sleeps}` : '',
|
|
@@ -3538,13 +3552,16 @@ readOnly = false) => {
|
|
|
3538
3552
|
first?.hourly
|
|
3539
3553
|
? "Prices are for each room's hours, taxes and fees included."
|
|
3540
3554
|
: rows.every(({ r }) => r.stayTotalUnquoted)
|
|
3541
|
-
? // ⚠️ NIGHTLY PRICES, NOT STAY PRICES (总线程 11-13, `Room.stayTotalUnquoted`)
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
: '
|
|
3555
|
+
? // ⚠️ NIGHTLY PRICES, NOT STAY PRICES (总线程 11-13, `Room.stayTotalUnquoted`) - and said
|
|
3556
|
+
// as not a total (0.76.1, H1).
|
|
3557
|
+
'Prices are a night each, as the group gives them - not totals for these nights; it has quoted no price for the whole stay yet.'
|
|
3558
|
+
: mixed
|
|
3559
|
+
? `A price that says "for the stay" is the whole stay, taxes and fees included; the others are a night each, as the group gives them - not totals for these nights.`
|
|
3560
|
+
: samePrice && rows.length > 1
|
|
3561
|
+
? `All ${rows.length} are ${samePrice}${many ? '' : ' for the stay'}, taxes and fees included${sharedBy(spread.nightly) ? ` (${sharedBy(spread.nightly)})` : ''}.`
|
|
3562
|
+
: many
|
|
3563
|
+
? `Prices are for ${roomsWanted} rooms for the whole stay, taxes and fees included.`
|
|
3564
|
+
: 'Prices are for the stay, taxes and fees included.',
|
|
3548
3565
|
shared.length ? `Every one: ${shared.join('; ')}.` : '',
|
|
3549
3566
|
most.length ? `Unless a room says otherwise: ${most.join('; ')}.` : '',
|
|
3550
3567
|
pay.said,
|
|
@@ -5607,7 +5624,10 @@ readOnly = false) => {
|
|
|
5607
5624
|
: paymentOf(priced.map((h) => payOf(h.forStay ?? {})), 'hotel');
|
|
5608
5625
|
const payTag = (h) => (h.forStay ? (pay.tags[priced.indexOf(h)] ?? '') : '');
|
|
5609
5626
|
// The cheapest, in one currency, and the best rated - among more than one.
|
|
5610
|
-
|
|
5627
|
+
// ⚠️ LIKE WITH LIKE (0.76.1): on a list for given nights only stays' prices are set side by
|
|
5628
|
+
// side - a from-price a night, kept by a hotel not priced or with no room, is not "cheaper".
|
|
5629
|
+
const dated = hotels.some((h) => h.forStay || h.noRoomsForStay || h.stayUnpriced);
|
|
5630
|
+
const priceOf = (h) => (dated ? h.forStay?.total : h.fromNightly);
|
|
5611
5631
|
const withPrice = hotels.filter((h) => priceOf(h));
|
|
5612
5632
|
const oneCurrency = new Set(withPrice.map((h) => priceOf(h)?.currency)).size === 1;
|
|
5613
5633
|
const lowest = withPrice.length > 1 && oneCurrency
|
|
@@ -5691,8 +5711,12 @@ readOnly = false) => {
|
|
|
5691
5711
|
? 'Not priced just now'
|
|
5692
5712
|
: (OWN_WHY[h.noRoomsForStayCode ?? '']?.price ?? 'No room for those nights')
|
|
5693
5713
|
: h.fromNightly
|
|
5694
|
-
? `from ${formatMoney(h.fromNightly)} ${nightWords(true, h.fromNightlyTaxes === 'unknown')}
|
|
5695
|
-
:
|
|
5714
|
+
? `from ${formatMoney(h.fromNightly)} ${nightWords(true, h.fromNightlyTaxes === 'unknown')}${
|
|
5715
|
+
// ⚠️ ON A DATED LIST, A FROM-PRICE SAYS IT IS ONE (0.76.1): not priced for the nights.
|
|
5716
|
+
h.stayUnpriced ? ' - its from-price, not a total for those nights' : ''}`
|
|
5717
|
+
: h.stayUnpriced
|
|
5718
|
+
? 'Not priced for those nights just now'
|
|
5719
|
+
: '',
|
|
5696
5720
|
});
|
|
5697
5721
|
});
|
|
5698
5722
|
const said = [
|
|
@@ -5749,7 +5773,7 @@ const comparedInWords = (c) => {
|
|
|
5749
5773
|
const p = c.price;
|
|
5750
5774
|
const priced = p
|
|
5751
5775
|
? [
|
|
5752
|
-
`${withZh(p.room, p.roomNames, true)} at ${p.nightly} ${nightWords(true, p.nightlyTaxesIn)}, ${p.stayTotal === undefined ? 'no price from the group for the whole stay yet' : `${p.stayTotal} for the stay incl. taxes and fees`}`,
|
|
5776
|
+
`${withZh(p.room, p.roomNames, true)} at ${p.nightly} ${nightWords(true, p.nightlyTaxesIn)}, ${p.stayTotal === undefined ? 'not a total for these nights - no price from the group for the whole stay yet' : `${p.stayTotal} for the stay incl. taxes and fees`}`,
|
|
5753
5777
|
p.terms !== undefined
|
|
5754
5778
|
? termsWords(p.terms)
|
|
5755
5779
|
: p.freeCancellationUntil
|
|
@@ -7432,6 +7456,16 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7432
7456
|
// the sentence was in the text alone, and a host that hands its model the
|
|
7433
7457
|
// structure (claude.ai) had `fromPricesOnly: true` and no word of what it means.
|
|
7434
7458
|
// `fromPricesSaid` is the same sentence.
|
|
7459
|
+
// ⚠️ A HOTEL NOT PRICED FOR THE NIGHTS SAYS SO, BY NAME (0.76.1, 总线程 11-18 - Otaless prices a
|
|
7460
|
+
// dated list's page; the review of 11-18, H1: a from-price beside stays' totals, the same size,
|
|
7461
|
+
// read as one): what it shows is its from-price a night. In both, in the same words.
|
|
7462
|
+
const stayPriced = hotels.some((h) => h.forStay);
|
|
7463
|
+
const unpriced = ask.stay ? hotels.filter((h) => h.stayUnpriced) : [];
|
|
7464
|
+
const unpricedSaid = unpriced.length && !fromPricesOnly
|
|
7465
|
+
? `${unpriced.length === 1 ? 'One' : unpriced.length} of these could not be priced for those nights just now: ${unpriced
|
|
7466
|
+
.map((h) => hotelName(h.name))
|
|
7467
|
+
.join('; ')}. ${unpriced.length === 1 ? 'Its price is its' : 'Their prices are their'} from-price a night, not a total for those nights - say so, and do not quote ${unpriced.length === 1 ? 'it' : 'them'} as one; ${unpriced.length === 1 ? 'its' : "each one's"} own page prices it for the nights.`
|
|
7468
|
+
: '';
|
|
7435
7469
|
const fromOnlySaid = ask.stay && fromPricesOnly
|
|
7436
7470
|
? `No price for ${ctx.noCards
|
|
7437
7471
|
? `${stayDayWords(ask.stay.checkIn, ask.stay.checkOut)} - ${ask.stay.checkIn} to ${ask.stay.checkOut} (open your reply with those nights in one sentence, by weekday and date) -`
|
|
@@ -7477,31 +7511,39 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7477
7511
|
: fromOnlySaid
|
|
7478
7512
|
? fromOnlySaid
|
|
7479
7513
|
: ask.stay
|
|
7480
|
-
?
|
|
7514
|
+
? `${
|
|
7515
|
+
// Nothing priced for the stay here is not "priced for" it (0.76.1).
|
|
7516
|
+
stayPriced || !unpriced.length ? 'Priced for' : 'Asked for'} ${
|
|
7481
7517
|
// ⚠️ THE NIGHTS BY THEIR WEEKDAYS, SAID FIRST (总线程 11-09, Manus: a
|
|
7482
7518
|
// list for 「这周末」 came back and the reply never said which nights).
|
|
7483
7519
|
ctx.noCards
|
|
7484
7520
|
? `${stayDayWords(ask.stay.checkIn, ask.stay.checkOut)} - ${ask.stay.checkIn} to ${ask.stay.checkOut}, ${ask.stay.guests} ${ask.stay.guests === 1 ? 'guest' : 'guests'} (open your reply with those nights in one sentence, by weekday and date)`
|
|
7485
|
-
: `${ask.stay.checkIn} to ${ask.stay.checkOut}`}${ask.rooms && ask.rooms > 1 ? `, ${ask.rooms} rooms` : ''}:
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
:
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7521
|
+
: `${ask.stay.checkIn} to ${ask.stay.checkOut}`}${ask.rooms && ask.rooms > 1 ? `, ${ask.rooms} rooms` : ''}: ${[
|
|
7522
|
+
stayPriced || !unpriced.length
|
|
7523
|
+
? `each price is that ${deps.vocab.noun}'s cheapest room for the whole stay, taxes included`
|
|
7524
|
+
: '',
|
|
7525
|
+
hotels.some((h) => h.noRoomsForStay && !NOT_NO_ROOM.has(h.noRoomsForStayCode ?? ''))
|
|
7526
|
+
? `${hotels.filter((h) => h.noRoomsForStay && !NOT_NO_ROOM.has(h.noRoomsForStayCode ?? '')).length} in this answer ${hotels.filter((h) => h.noRoomsForStay && !NOT_NO_ROOM.has(h.noRoomsForStayCode ?? '')).length === 1 ? 'has' : 'have'} no room for those nights`
|
|
7527
|
+
: '',
|
|
7528
|
+
// The other kind, said as its own (U11): other nights will not help.
|
|
7529
|
+
hotels.some((h) => h.noRoomsForStayCode === 'none-on-sale')
|
|
7530
|
+
? `${hotels.filter((h) => h.noRoomsForStayCode === 'none-on-sale').length} in this answer ${hotels.filter((h) => h.noRoomsForStayCode === 'none-on-sale').length === 1 ? 'has' : 'have'} no rooms on sale here - ${NOT_SOLD_OUT}`
|
|
7531
|
+
: '',
|
|
7532
|
+
// ⚠️ AND A GROUP THAT DID NOT ANSWER IS NOT "NO ROOM" (总线程 11-13): the
|
|
7533
|
+
// hotel's prices could not be read this time - its own page asks again.
|
|
7534
|
+
hotels.some((h) => h.noRoomsForStay && h.noRoomsForStayCode === 'unreachable')
|
|
7535
|
+
? `${hotels.filter((h) => h.noRoomsForStay && h.noRoomsForStayCode === 'unreachable').length} in this answer could not be priced just now - ${hotels.filter((h) => h.noRoomsForStay && h.noRoomsForStayCode === 'unreachable').length === 1 ? 'its group did not answer, which does not mean it has' : 'their group did not answer, which does not mean they have'} no room`
|
|
7536
|
+
: '',
|
|
7537
|
+
// Each of the other whys by itself, never as no room (review of 0.71.0, P3 4).
|
|
7538
|
+
...Object.entries(OWN_WHY).map(([code, w]) => {
|
|
7539
|
+
const n = hotels.filter((h) => h.noRoomsForStay && h.noRoomsForStayCode === code).length;
|
|
7540
|
+
return n ? w.many(n) : '';
|
|
7541
|
+
}),
|
|
7542
|
+
]
|
|
7543
|
+
.filter(Boolean)
|
|
7544
|
+
.join('; ')}.`
|
|
7504
7545
|
: '',
|
|
7546
|
+
unpricedSaid,
|
|
7505
7547
|
].filter(Boolean);
|
|
7506
7548
|
// A price on the list that is not booked here (`notSoldHere`): said as on
|
|
7507
7549
|
// the hotel's page, in both - see `notSoldHereWords`. ⚠️ NOT FIRST ANY MORE (0.75.1,
|
|
@@ -7599,6 +7641,8 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7599
7641
|
...(weekend ? { weekend } : {}),
|
|
7600
7642
|
...(fromPricesOnly ? { fromPricesOnly: true } : {}),
|
|
7601
7643
|
...(fromOnlySaid ? { fromPricesSaid: fromOnlySaid } : {}),
|
|
7644
|
+
// The hotels not priced for the nights, by name - the same sentence as the text (0.76.1).
|
|
7645
|
+
...(unpricedSaid ? { stayUnpricedSaid: unpricedSaid } : {}),
|
|
7602
7646
|
...(answer.refine
|
|
7603
7647
|
? { refine: refineFor(answer.refine, asked.filters, total, !!ask.stay) }
|
|
7604
7648
|
: {}),
|