@curless/hotel-storefront 0.84.7 → 0.84.8

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/tools.js CHANGED
@@ -13,7 +13,7 @@ import { cardAnswer, hotelListAnswer, prepareRefusal, preparedAnswer, statusAnsw
13
13
  import { addOnsCancelPreview, addOnsCancelResult, buyAnswer, finishAnswer, itemAnswer, listAnswer, ordersPart, previewAnswer, shopOrdersAnswer, shopSignInAnswer, } from './otaless/shop-answers.js';
14
14
  import { BOOKING_ENDED, looksLikeShopOrder, unitCentsOf } from './otaless/shop-service.js';
15
15
  import { overlapsOf } from './overlap.js';
16
- import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, candidatesFor, compareHotels, namesMoreThanOne, nightlyIncludesTaxes, } from './present.js';
16
+ import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, candidatesFor, compareHotels, namesMoreThanOne, nightIsTheStay, nightlyIncludesTaxes, } from './present.js';
17
17
  import { withReference } from './reference.js';
18
18
  import { regionOf } from './regions.js';
19
19
  import { FAMILY_SLEEPS, activeKeysOf, byRoomType, facetsOf, keyWords, matchesTerms, optionsOf, roomTermsOf, termWords, } from './room-filters.js';
@@ -3772,22 +3772,6 @@ const priceWords = (r, noCards, roomsWanted = 1) => r.hourly
3772
3772
  const nightlyPart = (r, noCards) => r.roomCharges
3773
3773
  ? `${formatMoney(r.roomCharges)} room charges for ${r.nights} nights before taxes (${formatMoney(r.taxesAndFees)} tax and fees on top)`
3774
3774
  : `${formatMoney(r.nightly)} ${nightWords(noCards, nightlyIncludesTaxes(r))}`;
3775
- /**
3776
- * ⚠️ ONE NIGHT, ONE ROOM: THE NIGHT IS THE STAY (0.79.5, 总线程 11-19, Otaless - a one-night stay
3777
- * said 「$132 a night.」 and, a line under it, 「Lowest price · $132」): where the stay is one night
3778
- * for one room and the night's price IS the stay's (the same number in the same currency), the
3779
- * text says the whole stay and not the night as well. Not where two rooms make "$132 a night, per
3780
- * room" and "$264 for 2 rooms" two numbers; not where the night is before taxes and the stay has
3781
- * them in (Huazhu: two numbers); not for a room by the hour, a stay the group has not totalled,
3782
- * or a night that is a rounded average of room charges (`roomCharges`).
3783
- */
3784
- const nightIsTheStay = (r, roomsWanted) => r.nights === 1 &&
3785
- roomsWanted === 1 &&
3786
- !r.hourly &&
3787
- !r.stayTotalUnquoted &&
3788
- !r.roomCharges &&
3789
- r.nightly.currency === r.stayTotal.currency &&
3790
- r.nightly.minor === r.stayTotal.minor;
3791
3775
  /**
3792
3776
  * The whole stay, as the text says it - or that the group has quoted none.
3793
3777
  *
@@ -9607,6 +9591,8 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
9607
9591
  // bookings in the conversation, a wrong code answered "2 bookings" and
9608
9592
  // nothing else - read as "found it" (2026-09-28 audit).
9609
9593
  const missed = code && !there;
9594
+ // 0.84.8: where orders are the account's and nobody is signed in, an empty list is "not signed in", not "none".
9595
+ const notSignedIn = byAccount && !!deps.accountWho && !deps.accountWho(who.tripOwner ?? who.sessionId);
9610
9596
  const missLine = tooMany
9611
9597
  ? TOO_MANY_TRIES
9612
9598
  : byAccount
@@ -9637,6 +9623,8 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
9637
9623
  ...(addable.includes(b) ? { addons: true } : {}),
9638
9624
  })),
9639
9625
  count: bookings.length,
9626
+ // The list is empty because nobody is signed in, not because there are none (0.84.8).
9627
+ ...(notSignedIn && !bookings.length ? { notSignedIn: true } : {}),
9640
9628
  ...(shopPart?.structured ?? {}),
9641
9629
  // What was looked for, so a card can say THAT did not match rather
9642
9630
  // than "nothing in this conversation".
@@ -9662,7 +9650,9 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
9662
9650
  missing.said
9663
9651
  ? ''
9664
9652
  : byAccount
9665
- ? 'No bookings on this account.'
9653
+ ? notSignedIn
9654
+ ? `Nobody is signed in to the ${deps.vocab.brand} account here, so no bookings were listed - this does not mean the guest has none. Bookings are the account's: the guest signs in first${deps.groupSignIn?.signInTool ? ` (the Sign in button on the card, or ${deps.groupSignIn.signInTool} gives them a sign-in link)` : ''}, then ask again. Do not tell the guest they have no bookings.`
9655
+ : 'No bookings on this account.'
9666
9656
  : 'No bookings in this conversation. A booking made elsewhere is found with its confirmation code and the email it was made with.',
9667
9657
  missing.said,
9668
9658
  // 0.84.0: called value-added services (增值服务), with the next step in words where the shop sells.