@curless/hotel-storefront 0.67.2 → 0.68.1
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 +66 -11
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/booking.d.ts +6 -0
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +97 -12
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +25 -2
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +32 -4
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +10 -1
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +28 -4
- 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 +62 -16
- package/dist/pictures.d.ts.map +1 -1
- package/dist/pictures.js +244 -37
- 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 +47 -8
- 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 +66 -10
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +16 -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,17 @@ 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 they were agreed as the booking was placed.
|
|
3616
|
+
* Said as that, never as the guest's own agreement.
|
|
3617
|
+
*/
|
|
3618
|
+
const autoAcceptedWords = (deps, b) => b.groupTermsAutoAccepted
|
|
3619
|
+
? `${holderOf(deps, b.supplier).name} asked for its terms to be agreed to before booking but gave no text of them; they were agreed to as the booking was placed.`
|
|
3620
|
+
: '';
|
|
3621
|
+
const bookingNotes = (deps, b) => [noTermsWords(deps, b), autoAcceptedWords(deps, b), confirmUnseenWords(deps, b)]
|
|
3622
|
+
.filter(Boolean)
|
|
3623
|
+
.join(' ');
|
|
3593
3624
|
/** A booking for the card and the model's structure, with `notSentStatus` where there is one. */
|
|
3594
3625
|
const listedForCard = (deps, b) => {
|
|
3595
3626
|
const said = notSentStatus(deps, b) ?? unconfirmedSaid(deps, b);
|
|
@@ -3598,6 +3629,8 @@ const listedForCard = (deps, b) => {
|
|
|
3598
3629
|
// 0.67.1: no terms given / may need the group's own confirmation - the same words as the text.
|
|
3599
3630
|
...(b.noTermsGiven ? { noTermsSaid: noTermsWords(deps, b) } : {}),
|
|
3600
3631
|
...(b.confirmUnseen ? { confirmUnseenSaid: confirmUnseenWords(deps, b) } : {}),
|
|
3632
|
+
// 0.68.1: the group's terms agreed for the guest - the same words as the text.
|
|
3633
|
+
...(b.groupTermsAutoAccepted ? { termsAutoAcceptedSaid: autoAcceptedWords(deps, b) } : {}),
|
|
3601
3634
|
...(said ? { statusSaid: said } : {}),
|
|
3602
3635
|
// 0.66.0: its payment page held back for the group's new terms - said, for the model.
|
|
3603
3636
|
...(b.termsChanged || b.confirmAsked ? { termsHeldSaid: termsHeldWords(deps, b) } : {}),
|
|
@@ -6332,6 +6365,12 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6332
6365
|
if (ask.filters?.supplier && named)
|
|
6333
6366
|
ask.filters = { ...ask.filters, supplier: named.id };
|
|
6334
6367
|
const who = identity(deps, ctx, key, args);
|
|
6368
|
+
// ⚠️ A MARKET'S CITY FIELD, ASKED BESIDE THE SEARCH (0.68.0): a narrowed list's menu is
|
|
6369
|
+
// every city, so the market is asked once more with nothing - at the same time, not
|
|
6370
|
+
// after: a group that hangs would otherwise be waited for twice. Kept a minute whatever
|
|
6371
|
+
// came back, and asked as no guest's (`everyCityOf`). One that fails is no menu.
|
|
6372
|
+
const narrowedAsk = !!(ask.query || ask.city || ask.filters || ask.maxNightly);
|
|
6373
|
+
const marketCities = narrowedAsk && (deps.backend.suppliers || deps.vocab.market) ? everyCityOf(deps) : undefined;
|
|
6335
6374
|
let answer = await deps.backend.searchHotels(ask, who);
|
|
6336
6375
|
// A brand as the data spells it, so its chip shows as ON and can be turned
|
|
6337
6376
|
// off: `brand: 'kerry'` filtered, and then no chip matched it.
|
|
@@ -6811,7 +6850,11 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6811
6850
|
// which narrowing would make the question answerable.
|
|
6812
6851
|
const oneCurrency = answer.currencies.length === 1;
|
|
6813
6852
|
const wantedPrice = sort === 'price-low' || sort === 'price-high';
|
|
6814
|
-
|
|
6853
|
+
// …UNLESS THE BACKEND ORDERS THEM BY ONE CURRENCY THEY ARE ALL WORTH (0.68.0, robin
|
|
6854
|
+
// 11-12 - Otaless, by the US dollars it settles in): then the order is applied and
|
|
6855
|
+
// said as what it is by; the prices are still each hotel's own.
|
|
6856
|
+
const inUsd = !oneCurrency && answer.priceOrderIn === 'USD';
|
|
6857
|
+
const applied = (wantedPrice && !oneCurrency && !inUsd) || answer.ignored?.sort ? 'group' : sort;
|
|
6815
6858
|
// Room terms the backend could not apply are not "filtered to".
|
|
6816
6859
|
const filtersSaid = asked.filters && answer.ignored?.roomTerms
|
|
6817
6860
|
? { ...asked.filters, freeCancellation: undefined, breakfast: undefined, bed: undefined }
|
|
@@ -6820,10 +6863,17 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6820
6863
|
// What the backend was asked and did not do, in its own words.
|
|
6821
6864
|
...(answer.unapplied ?? []),
|
|
6822
6865
|
wantedPrice && !oneCurrency
|
|
6823
|
-
?
|
|
6824
|
-
|
|
6866
|
+
? inUsd
|
|
6867
|
+
? `In price order, ${sort === 'price-low' ? 'lowest' : 'highest'} first, by each ${deps.vocab.noun}'s price in US dollars as the hotel groups give it. The prices here are each ${deps.vocab.noun}'s own, in ${answer.currencies.join(', ')}: quote them as they are, never converted.`
|
|
6868
|
+
: `These are quoted in ${answer.currencies.length} currencies (${answer.currencies.join(', ')}), and no rate is applied here, so they are not in price order — one city or one country gives one currency.`
|
|
6869
|
+
: // How a client with no card puts them in price order: it has no Sort to press.
|
|
6870
|
+
inUsd && ctx?.noCards && hotels.length > 1
|
|
6871
|
+
? `These are quoted in ${answer.currencies.join(', ')}; asked again with \`sort: "price-low"\` or \`"price-high"\` they are put in price order by each ${deps.vocab.noun}'s price in US dollars, the prices still shown in their own currencies.`
|
|
6872
|
+
: '',
|
|
6825
6873
|
ceiling !== undefined && !oneCurrency
|
|
6826
|
-
?
|
|
6874
|
+
? inUsd
|
|
6875
|
+
? 'The price ceiling is not applied: it is only applied within one currency.'
|
|
6876
|
+
: 'The price ceiling is not applied for the same reason.'
|
|
6827
6877
|
: '',
|
|
6828
6878
|
answer.overBudget && hotels.length
|
|
6829
6879
|
? `${answer.overBudget} more matched and came in over the ceiling.`
|
|
@@ -6930,11 +6980,15 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6930
6980
|
// unnarrowed answer's own, or the catalogue asked once more with nothing (no
|
|
6931
6981
|
// nights, so nothing is priced). Names and counts only, never a hotel - and
|
|
6932
6982
|
// for the card only: the server puts it beside the answer (`CITIES_META_KEY`).
|
|
6933
|
-
//
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6983
|
+
// ⚠️ A MARKET'S TOO (0.68.0, robin 11-12): with none, its 「全部 ▾」 went to the
|
|
6984
|
+
// destinations page - 「全部」 answered with the home. Asked beside the search
|
|
6985
|
+
// (`marketCities`); one that fails leaves the field going to the destinations page,
|
|
6986
|
+
// as before, and the list is answered all the same.
|
|
6987
|
+
const allCities = unnarrowed
|
|
6988
|
+
? (answer.facets?.cities ?? [])
|
|
6989
|
+
: marketCities
|
|
6990
|
+
? await marketCities
|
|
6991
|
+
: ((await deps.backend.searchHotels({}, who)).facets?.cities ?? []);
|
|
6938
6992
|
return {
|
|
6939
6993
|
structured: {
|
|
6940
6994
|
view: 'hotels',
|
|
@@ -6970,6 +7024,8 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6970
7024
|
...(answer.overBudget ? { overBudget: answer.overBudget } : {}),
|
|
6971
7025
|
...(widened?.found ? { widened } : {}),
|
|
6972
7026
|
...(answer.currencies.length > 1 ? { currencies: answer.currencies } : {}),
|
|
7027
|
+
// A price order across them is by US dollars here (0.68.0) - the card offers it and says so.
|
|
7028
|
+
...(inUsd ? { priceOrderIn: 'USD' } : {}),
|
|
6973
7029
|
// A group that did not answer, in both: the card draws a line from it.
|
|
6974
7030
|
...degraded.structured,
|
|
6975
7031
|
// A place not recognised, in both: the card heads the list without it.
|