@curless/hotel-storefront 0.68.0 → 0.68.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/otaless/backend.d.ts +5 -0
- package/dist/otaless/backend.d.ts.map +1 -1
- package/dist/otaless/backend.js +73 -23
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/booking.d.ts +14 -2
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +172 -7
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +10 -1
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +44 -4
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +16 -1
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +36 -0
- package/dist/otaless/fake.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/pictures.d.ts +6 -3
- package/dist/pictures.d.ts.map +1 -1
- package/dist/pictures.js +46 -12
- package/dist/pictures.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +21 -9
- package/dist/server.js.map +1 -1
- package/dist/supplier.d.ts +11 -0
- package/dist/supplier.d.ts.map +1 -1
- package/dist/supplier.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +38 -6
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -2899,6 +2899,27 @@ const bare = (kind) => REQUEST_WORDS[kind].replace(/^an? /, '');
|
|
|
2899
2899
|
* desk cannot act on.
|
|
2900
2900
|
*/
|
|
2901
2901
|
const SORTS = ['group', 'price-low', 'price-high', 'rating'];
|
|
2902
|
+
/** How long a market's every city is kept - see `everyCityOf`. */
|
|
2903
|
+
const CITIES_KEPT_MS = 60_000;
|
|
2904
|
+
const citiesKept = new WeakMap();
|
|
2905
|
+
/**
|
|
2906
|
+
* Every city a market has, for its lists' city field (0.68.0) - asked with nothing named.
|
|
2907
|
+
*
|
|
2908
|
+
* ⚠️ KEPT A MINUTE, WHATEVER CAME BACK, AND ASKED AS NOBODY'S (0.68.1, 总线程's review of
|
|
2909
|
+
* 0.68.0, 5): a group that failed was kept failed by Otaless's client for 3 seconds only, so
|
|
2910
|
+
* every narrowed search asked it again - on the guest's own outbound limit, which could then
|
|
2911
|
+
* call the search they did want "too busy". Now one ask a minute per deployment, on
|
|
2912
|
+
* everyone's limit alone (no conversation, no address); a failure is no menu for that minute.
|
|
2913
|
+
*/
|
|
2914
|
+
const everyCityOf = (deps) => {
|
|
2915
|
+
const now = deps.trips.now();
|
|
2916
|
+
const kept = citiesKept.get(deps.backend);
|
|
2917
|
+
if (kept && now - kept.at < CITIES_KEPT_MS)
|
|
2918
|
+
return kept.cities;
|
|
2919
|
+
const cities = deps.backend.searchHotels({}).then((r) => r.facets?.cities ?? [], () => []);
|
|
2920
|
+
citiesKept.set(deps.backend, { at: now, cities });
|
|
2921
|
+
return cities;
|
|
2922
|
+
};
|
|
2902
2923
|
const widen = (ask) => {
|
|
2903
2924
|
if (ask.city && ask.query) {
|
|
2904
2925
|
return {
|
|
@@ -3589,7 +3610,18 @@ const confirmUnseenWords = (deps, b) => {
|
|
|
3589
3610
|
? `${g} may ask for this booking to be confirmed separately; what it would ask is not shown here.`
|
|
3590
3611
|
: '';
|
|
3591
3612
|
};
|
|
3592
|
-
|
|
3613
|
+
/**
|
|
3614
|
+
* Terms agreed for the guest (0.68.1, 酒店对接 a4760ae1 - the dev backend's switch alone): the
|
|
3615
|
+
* group asked for them, gave no text of them, and this service agreed to them when it placed the
|
|
3616
|
+
* booking. Said as that - who agreed (0.68.2, 总线程's re-review: 「写明是谁同意的」) - never as
|
|
3617
|
+
* the guest's own agreement.
|
|
3618
|
+
*/
|
|
3619
|
+
const autoAcceptedWords = (deps, b) => b.groupTermsAutoAccepted
|
|
3620
|
+
? `${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.`
|
|
3621
|
+
: '';
|
|
3622
|
+
const bookingNotes = (deps, b) => [noTermsWords(deps, b), autoAcceptedWords(deps, b), confirmUnseenWords(deps, b)]
|
|
3623
|
+
.filter(Boolean)
|
|
3624
|
+
.join(' ');
|
|
3593
3625
|
/** A booking for the card and the model's structure, with `notSentStatus` where there is one. */
|
|
3594
3626
|
const listedForCard = (deps, b) => {
|
|
3595
3627
|
const said = notSentStatus(deps, b) ?? unconfirmedSaid(deps, b);
|
|
@@ -3598,6 +3630,8 @@ const listedForCard = (deps, b) => {
|
|
|
3598
3630
|
// 0.67.1: no terms given / may need the group's own confirmation - the same words as the text.
|
|
3599
3631
|
...(b.noTermsGiven ? { noTermsSaid: noTermsWords(deps, b) } : {}),
|
|
3600
3632
|
...(b.confirmUnseen ? { confirmUnseenSaid: confirmUnseenWords(deps, b) } : {}),
|
|
3633
|
+
// 0.68.1: the group's terms agreed for the guest - the same words as the text.
|
|
3634
|
+
...(b.groupTermsAutoAccepted ? { termsAutoAcceptedSaid: autoAcceptedWords(deps, b) } : {}),
|
|
3601
3635
|
...(said ? { statusSaid: said } : {}),
|
|
3602
3636
|
// 0.66.0: its payment page held back for the group's new terms - said, for the model.
|
|
3603
3637
|
...(b.termsChanged || b.confirmAsked ? { termsHeldSaid: termsHeldWords(deps, b) } : {}),
|
|
@@ -6334,12 +6368,10 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6334
6368
|
const who = identity(deps, ctx, key, args);
|
|
6335
6369
|
// ⚠️ A MARKET'S CITY FIELD, ASKED BESIDE THE SEARCH (0.68.0): a narrowed list's menu is
|
|
6336
6370
|
// every city, so the market is asked once more with nothing - at the same time, not
|
|
6337
|
-
// after: a group that hangs would otherwise be waited for twice. Kept a minute
|
|
6338
|
-
//
|
|
6371
|
+
// after: a group that hangs would otherwise be waited for twice. Kept a minute whatever
|
|
6372
|
+
// came back, and asked as no guest's (`everyCityOf`). One that fails is no menu.
|
|
6339
6373
|
const narrowedAsk = !!(ask.query || ask.city || ask.filters || ask.maxNightly);
|
|
6340
|
-
const marketCities = narrowedAsk && (deps.backend.suppliers || deps.vocab.market)
|
|
6341
|
-
? deps.backend.searchHotels({}, who).then((r) => r.facets?.cities ?? [], () => [])
|
|
6342
|
-
: undefined;
|
|
6374
|
+
const marketCities = narrowedAsk && (deps.backend.suppliers || deps.vocab.market) ? everyCityOf(deps) : undefined;
|
|
6343
6375
|
let answer = await deps.backend.searchHotels(ask, who);
|
|
6344
6376
|
// A brand as the data spells it, so its chip shows as ON and can be turned
|
|
6345
6377
|
// off: `brand: 'kerry'` filtered, and then no chip matched it.
|