@curless/hotel-storefront 0.45.2 → 0.47.0
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/data.d.ts +2 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +281 -19
- package/dist/data.js.map +1 -1
- package/dist/demo-hotels.d.ts +46 -1
- package/dist/demo-hotels.d.ts.map +1 -1
- package/dist/demo-hotels.js +50 -12
- package/dist/demo-hotels.js.map +1 -1
- package/dist/huazhu/backend.d.ts.map +1 -1
- package/dist/huazhu/backend.js +9 -5
- package/dist/huazhu/backend.js.map +1 -1
- package/dist/huazhu/catalog.d.ts +9 -2
- package/dist/huazhu/catalog.d.ts.map +1 -1
- package/dist/huazhu/catalog.js +65 -5
- package/dist/huazhu/catalog.js.map +1 -1
- package/dist/huazhu/english.d.ts +8 -0
- package/dist/huazhu/english.d.ts.map +1 -1
- package/dist/huazhu/english.js +295 -2
- package/dist/huazhu/english.js.map +1 -1
- package/dist/room-filters.d.ts +106 -0
- package/dist/room-filters.d.ts.map +1 -0
- package/dist/room-filters.js +252 -0
- package/dist/room-filters.js.map +1 -0
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/supplier.d.ts +1 -0
- package/dist/supplier.d.ts.map +1 -1
- package/dist/supplier.js +4 -1
- package/dist/supplier.js.map +1 -1
- package/dist/tools.d.ts +33 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +243 -9
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +44 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Room } from './types.js';
|
|
2
|
+
/** The bed a guest asks for: a large bed for two, or two beds. */
|
|
3
|
+
export type BedFilter = 'king' | 'twin';
|
|
4
|
+
/** Where a room is paid: at the hotel on arrival, or online in advance (`Room.payment` 'prepaid'). */
|
|
5
|
+
export type PaymentFilter = 'at-hotel' | 'online';
|
|
6
|
+
/** The ways a room can be narrowed, as the card's chips and `roomFilters` name them. */
|
|
7
|
+
export type RoomFilterKey = 'breakfast' | 'king' | 'twin' | 'freeCancellation' | 'window' | 'payAtHotel' | 'payOnline' | 'family';
|
|
8
|
+
/**
|
|
9
|
+
* The four a hotel's chip row ALWAYS has - a guest looks for these on every
|
|
10
|
+
* hotel, and a chip that is gone says nothing, where one marked 0 says the
|
|
11
|
+
* hotel has none (robin, 2026-10-23).
|
|
12
|
+
*/
|
|
13
|
+
export declare const CORE_FILTER_KEYS: readonly RoomFilterKey[];
|
|
14
|
+
/**
|
|
15
|
+
* The ones that are offered only where a hotel's rooms DIFFER in them: a chip
|
|
16
|
+
* for a window every room has (or none has) narrows nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare const SPLIT_FILTER_KEYS: readonly RoomFilterKey[];
|
|
19
|
+
/** In the order a chip row shows them. */
|
|
20
|
+
export declare const ROOM_FILTER_KEYS: readonly RoomFilterKey[];
|
|
21
|
+
/** What a call asked for - all of it must hold (AND). */
|
|
22
|
+
export type RoomTerms = {
|
|
23
|
+
bed?: BedFilter;
|
|
24
|
+
breakfast?: true;
|
|
25
|
+
freeCancellation?: true;
|
|
26
|
+
window?: true;
|
|
27
|
+
payment?: PaymentFilter;
|
|
28
|
+
family?: true;
|
|
29
|
+
};
|
|
30
|
+
/** A room that sleeps this many is a family room: 家庭房, "Sleeps 3+". */
|
|
31
|
+
export declare const FAMILY_SLEEPS = 3;
|
|
32
|
+
/** What is true of one room, for the card to draw and to filter by without re-deriving. */
|
|
33
|
+
export type RoomFacets = Record<RoomFilterKey, boolean>;
|
|
34
|
+
/** One chip a hotel's rooms offer, with how many rooms (rates) it keeps. */
|
|
35
|
+
export type RoomFilterOption = {
|
|
36
|
+
key: RoomFilterKey;
|
|
37
|
+
count: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Which beds a room has: from `bedTypes` where they say a king or a twin,
|
|
41
|
+
* otherwise from what `beds` says in words ("1 king", "1 king or 2 twins",
|
|
42
|
+
* "2 twins or 1 king", "1 queen", "1 king and 2 singles", 大床 / 双床,
|
|
43
|
+
* 「2张1.2米单人床」), and last from the room type's NAME where neither says a
|
|
44
|
+
* bed: Huazhu's test environment sends no `bedTypes` and no `beds`, but a type
|
|
45
|
+
* called 「豪华大床房」 is a king room (2026-10-23). The order is the order of trust.
|
|
46
|
+
*/
|
|
47
|
+
export declare const bedKindsOf: (room: Pick<Room, "beds" | "bedTypes"> & Partial<Pick<Room, "name" | "names" | "roomType">>) => {
|
|
48
|
+
king: boolean;
|
|
49
|
+
twin: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Whether the room's rate includes breakfast. The meal, where a backend gives
|
|
53
|
+
* one, is what the rate includes (`MealPlan`); then its labels; then the plain
|
|
54
|
+
* flag. Room only is no.
|
|
55
|
+
*/
|
|
56
|
+
export declare const breakfastOf: (room: Pick<Room, "breakfast" | "meal" | "labels">) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the rate can be cancelled for nothing NOW: refundable, with a free
|
|
59
|
+
* window that has not closed. Where the window has closed, `refundable` stays
|
|
60
|
+
* true and `freeCancellationUntil` is gone - "refundable" alone is a rate that
|
|
61
|
+
* once had a free window (the demo's own search and Huazhu's read it the same
|
|
62
|
+
* way). A room by the hour has no cancellation terms to speak of.
|
|
63
|
+
*/
|
|
64
|
+
export declare const freeCancellationOf: (room: Pick<Room, "refundable" | "freeCancellationUntil" | "hourly">) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Everything a card needs to know about one room to filter it.
|
|
67
|
+
*
|
|
68
|
+
* ⚠️ A WINDOW IS 'yes' AND NOTHING ELSE (robin, 2026-10-23): a partly-windowed
|
|
69
|
+
* room, an inner window onto a light well, a room with none, and a room whose
|
|
70
|
+
* data says nothing are not "has a window". A room that says nothing of how it
|
|
71
|
+
* is paid is neither at the hotel nor online - the card does not guess.
|
|
72
|
+
*/
|
|
73
|
+
export declare const facetsOf: (room: Room) => RoomFacets;
|
|
74
|
+
/** The terms a call asked for, or undefined when it asked for none. Only `true` (or a payment given) narrows. */
|
|
75
|
+
export declare const roomTermsOf: (args: Record<string, unknown>) => RoomTerms | undefined;
|
|
76
|
+
/** The terms as the chip keys they switch on - the order a chip row shows them. */
|
|
77
|
+
export declare const activeKeysOf: (terms: RoomTerms | undefined) => RoomFilterKey[];
|
|
78
|
+
/** Whether a room has everything the terms ask for. */
|
|
79
|
+
export declare const matchesTerms: (room: Room, terms: RoomTerms | undefined) => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The chips a hotel's rooms offer, each with how many rooms (rates) it keeps
|
|
82
|
+
* on its own, in the order a chip row shows them.
|
|
83
|
+
*
|
|
84
|
+
* ⚠️ THE CORE FOUR ARE ALWAYS HERE, even at 0: a hotel with no twin room says
|
|
85
|
+
* so, and the card draws that chip empty and pressable. The rest are here ONLY
|
|
86
|
+
* WHERE THEY SPLIT the hotel's rooms - some have it and some do not. A window
|
|
87
|
+
* every room has, or none does, narrows nothing, and a row of chips that do
|
|
88
|
+
* nothing is noise.
|
|
89
|
+
*/
|
|
90
|
+
export declare const optionsOf: (rooms: Room[]) => RoomFilterOption[];
|
|
91
|
+
/** The terms in words, for a sentence: "king bed, breakfast included, free cancellation". */
|
|
92
|
+
export declare const termWords: (terms: RoomTerms) => string;
|
|
93
|
+
/** One chip in words, for a sentence. */
|
|
94
|
+
export declare const keyWords: (key: RoomFilterKey) => string;
|
|
95
|
+
/**
|
|
96
|
+
* A hotel's rooms by room type, in the order the types first appear: a group
|
|
97
|
+
* that sells several rates on one type (Huazhu's 房型 × 房价码) shares a
|
|
98
|
+
* `roomType`; one whose every room is its own type (Shangri-La's) does not,
|
|
99
|
+
* and each is a type of its own.
|
|
100
|
+
*/
|
|
101
|
+
export declare const byRoomType: <R extends Pick<Room, "id" | "name" | "roomType">>(rooms: R[]) => {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
rooms: R[];
|
|
105
|
+
}[];
|
|
106
|
+
//# sourceMappingURL=room-filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-filters.d.ts","sourceRoot":"","sources":["../src/room-filters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAchD,kEAAkE;AAClE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAElD,wFAAwF;AACxF,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,MAAM,GACN,MAAM,GACN,kBAAkB,GAClB,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,QAAQ,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAKpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,aAAa,EAKrD,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAGpD,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,gBAAgB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GAAI,KAAK,aAAa,KAAG,MAAwB,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,UAAU,CAAC,EACzE,OAAO,CAAC,EAAE,KACT;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,EAS1C,CAAC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four a hotel's chip row ALWAYS has - a guest looks for these on every
|
|
3
|
+
* hotel, and a chip that is gone says nothing, where one marked 0 says the
|
|
4
|
+
* hotel has none (robin, 2026-10-23).
|
|
5
|
+
*/
|
|
6
|
+
export const CORE_FILTER_KEYS = [
|
|
7
|
+
'breakfast',
|
|
8
|
+
'king',
|
|
9
|
+
'twin',
|
|
10
|
+
'freeCancellation',
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* The ones that are offered only where a hotel's rooms DIFFER in them: a chip
|
|
14
|
+
* for a window every room has (or none has) narrows nothing.
|
|
15
|
+
*/
|
|
16
|
+
export const SPLIT_FILTER_KEYS = [
|
|
17
|
+
'window',
|
|
18
|
+
'payAtHotel',
|
|
19
|
+
'payOnline',
|
|
20
|
+
'family',
|
|
21
|
+
];
|
|
22
|
+
/** In the order a chip row shows them. */
|
|
23
|
+
export const ROOM_FILTER_KEYS = [
|
|
24
|
+
...CORE_FILTER_KEYS,
|
|
25
|
+
...SPLIT_FILTER_KEYS,
|
|
26
|
+
];
|
|
27
|
+
/** A room that sleeps this many is a family room: 家庭房, "Sleeps 3+". */
|
|
28
|
+
export const FAMILY_SLEEPS = 3;
|
|
29
|
+
/**
|
|
30
|
+
* Two ways of reading a bed in words. A QUEEN COUNTS WITH THE KING: "king" is
|
|
31
|
+
* the large-bed filter - one big bed for two, which is what a guest who says
|
|
32
|
+
* 大床 / "a king" wants and what a hotel that lists "1 queen" sells. A DOUBLE
|
|
33
|
+
* is the same bed.
|
|
34
|
+
*/
|
|
35
|
+
const LARGE = /\b(?:king|queen|double)\b|大床|双人床/i;
|
|
36
|
+
const TWIN = /\btwins?\b|双床/i;
|
|
37
|
+
/** "2 singles" - the digits before the word. */
|
|
38
|
+
const SINGLES = /(\d+)\s*(?:x\s*)?singles?\b/gi;
|
|
39
|
+
/**
|
|
40
|
+
* 「2张1.2米单人床」 / 「两张单人床」 - the count before 张, then the word. The gap
|
|
41
|
+
* may not cross another 张, so "1张1.8米大床 + 2张1.2米单人床" counts the two
|
|
42
|
+
* beside the king, not one run from the first 张 to the last bed.
|
|
43
|
+
*/
|
|
44
|
+
const SINGLES_ZH = /(\d+|两|二)\s*张[^张]*?单人床/g;
|
|
45
|
+
const singlesIn = (text) => [...text.matchAll(SINGLES)].reduce((n, m) => n + Number(m[1]), 0) +
|
|
46
|
+
[...text.matchAll(SINGLES_ZH)].reduce((n, m) => n + (Number(m[1]) || 2), 0);
|
|
47
|
+
/**
|
|
48
|
+
* The beds in a text. A "1 king or 2 twins" room is sold either way, so the
|
|
49
|
+
* alternatives (split on "or" and "/") are read one by one and a room matches
|
|
50
|
+
* every kind any of them has. Within one alternative the beds are all there at
|
|
51
|
+
* once - "1 king and 2 singles" is a king room with two singles beside it, not
|
|
52
|
+
* a twin - so singles make twin beds only where there is no large bed with them.
|
|
53
|
+
*/
|
|
54
|
+
const bedsInText = (text) => {
|
|
55
|
+
let king = false;
|
|
56
|
+
let twin = false;
|
|
57
|
+
for (const part of text.split(/\bor\b|\/|或/i)) {
|
|
58
|
+
const large = LARGE.test(part);
|
|
59
|
+
if (large)
|
|
60
|
+
king = true;
|
|
61
|
+
if (TWIN.test(part) || (!large && singlesIn(part) >= 2))
|
|
62
|
+
twin = true;
|
|
63
|
+
}
|
|
64
|
+
return { king, twin };
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The same split, for a room type's NAME: only the words a name says a bed in -
|
|
68
|
+
* 大床 / 双床, "king" / "twin" - and none of the looser ones (a "queen", a
|
|
69
|
+
* "double", singles) that a `beds` line reads. In Chinese hotel naming 大床房 /
|
|
70
|
+
* 双床房 is the trade convention, so it is trustworthy; a name without them
|
|
71
|
+
* (家庭房, 榻榻米房, 备用房) says no bed and stays neither.
|
|
72
|
+
*/
|
|
73
|
+
const bedsInName = (text) => {
|
|
74
|
+
let king = false;
|
|
75
|
+
let twin = false;
|
|
76
|
+
for (const part of text.split(/\bor\b|\/|或/i)) {
|
|
77
|
+
if (/\bking\b|大床/i.test(part))
|
|
78
|
+
king = true;
|
|
79
|
+
if (TWIN.test(part))
|
|
80
|
+
twin = true;
|
|
81
|
+
}
|
|
82
|
+
return { king, twin };
|
|
83
|
+
};
|
|
84
|
+
/** The beds in a room's codes: a king, a twin, or two singles that are not beside a king. */
|
|
85
|
+
const bedsInCodes = (types) => {
|
|
86
|
+
const king = types.some((b) => b.kind === 'king');
|
|
87
|
+
const singles = types.filter((b) => b.kind === 'single').length;
|
|
88
|
+
return { king, twin: types.some((b) => b.kind === 'twin') || (!king && singles >= 2) };
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Which beds a room has: from `bedTypes` where they say a king or a twin,
|
|
92
|
+
* otherwise from what `beds` says in words ("1 king", "1 king or 2 twins",
|
|
93
|
+
* "2 twins or 1 king", "1 queen", "1 king and 2 singles", 大床 / 双床,
|
|
94
|
+
* 「2张1.2米单人床」), and last from the room type's NAME where neither says a
|
|
95
|
+
* bed: Huazhu's test environment sends no `bedTypes` and no `beds`, but a type
|
|
96
|
+
* called 「豪华大床房」 is a king room (2026-10-23). The order is the order of trust.
|
|
97
|
+
*/
|
|
98
|
+
export const bedKindsOf = (room) => {
|
|
99
|
+
const coded = room.bedTypes?.length ? bedsInCodes(room.bedTypes) : undefined;
|
|
100
|
+
if (coded && (coded.king || coded.twin))
|
|
101
|
+
return coded;
|
|
102
|
+
const worded = room.beds ? bedsInText(room.beds) : undefined;
|
|
103
|
+
if (worded && (worded.king || worded.twin))
|
|
104
|
+
return worded;
|
|
105
|
+
// The type's name, else the room's own - a rate's suffix ("· 门市价含早") is not the type's.
|
|
106
|
+
const names = room.roomType
|
|
107
|
+
? [room.roomType.name, room.roomType.names?.zh]
|
|
108
|
+
: [room.name, room.names?.zh];
|
|
109
|
+
let king = false;
|
|
110
|
+
let twin = false;
|
|
111
|
+
for (const name of names) {
|
|
112
|
+
if (!name)
|
|
113
|
+
continue;
|
|
114
|
+
const named = bedsInName(name);
|
|
115
|
+
king ||= named.king;
|
|
116
|
+
twin ||= named.twin;
|
|
117
|
+
}
|
|
118
|
+
return { king, twin };
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Whether the room's rate includes breakfast. The meal, where a backend gives
|
|
122
|
+
* one, is what the rate includes (`MealPlan`); then its labels; then the plain
|
|
123
|
+
* flag. Room only is no.
|
|
124
|
+
*/
|
|
125
|
+
export const breakfastOf = (room) => {
|
|
126
|
+
if (room.meal)
|
|
127
|
+
return room.meal.plan !== 'none';
|
|
128
|
+
const labels = room.labels ?? [];
|
|
129
|
+
if (labels.some((l) => l.startsWith('breakfast')))
|
|
130
|
+
return true;
|
|
131
|
+
if (labels.includes('room-only'))
|
|
132
|
+
return false;
|
|
133
|
+
return !!room.breakfast;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Whether the rate can be cancelled for nothing NOW: refundable, with a free
|
|
137
|
+
* window that has not closed. Where the window has closed, `refundable` stays
|
|
138
|
+
* true and `freeCancellationUntil` is gone - "refundable" alone is a rate that
|
|
139
|
+
* once had a free window (the demo's own search and Huazhu's read it the same
|
|
140
|
+
* way). A room by the hour has no cancellation terms to speak of.
|
|
141
|
+
*/
|
|
142
|
+
export const freeCancellationOf = (room) => !room.hourly && room.refundable && !!room.freeCancellationUntil;
|
|
143
|
+
/**
|
|
144
|
+
* Everything a card needs to know about one room to filter it.
|
|
145
|
+
*
|
|
146
|
+
* ⚠️ A WINDOW IS 'yes' AND NOTHING ELSE (robin, 2026-10-23): a partly-windowed
|
|
147
|
+
* room, an inner window onto a light well, a room with none, and a room whose
|
|
148
|
+
* data says nothing are not "has a window". A room that says nothing of how it
|
|
149
|
+
* is paid is neither at the hotel nor online - the card does not guess.
|
|
150
|
+
*/
|
|
151
|
+
export const facetsOf = (room) => {
|
|
152
|
+
const beds = bedKindsOf(room);
|
|
153
|
+
return {
|
|
154
|
+
breakfast: breakfastOf(room),
|
|
155
|
+
king: beds.king,
|
|
156
|
+
twin: beds.twin,
|
|
157
|
+
freeCancellation: freeCancellationOf(room),
|
|
158
|
+
window: room.window === 'yes',
|
|
159
|
+
payAtHotel: room.payment === 'at-hotel',
|
|
160
|
+
payOnline: room.payment === 'prepaid',
|
|
161
|
+
family: room.sleeps >= FAMILY_SLEEPS,
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/** The terms a call asked for, or undefined when it asked for none. Only `true` (or a payment given) narrows. */
|
|
165
|
+
export const roomTermsOf = (args) => {
|
|
166
|
+
const terms = {
|
|
167
|
+
...(args.bed === 'king' || args.bed === 'twin' ? { bed: args.bed } : {}),
|
|
168
|
+
...(args.breakfast === true ? { breakfast: true } : {}),
|
|
169
|
+
...(args.freeCancellation === true ? { freeCancellation: true } : {}),
|
|
170
|
+
...(args.window === true ? { window: true } : {}),
|
|
171
|
+
...(args.payment === 'at-hotel' || args.payment === 'online' ? { payment: args.payment } : {}),
|
|
172
|
+
...(args.family === true ? { family: true } : {}),
|
|
173
|
+
};
|
|
174
|
+
return Object.keys(terms).length ? terms : undefined;
|
|
175
|
+
};
|
|
176
|
+
/** Whether the terms switch this chip on. The two beds, and the two ways to pay, are one choice each. */
|
|
177
|
+
const termsHave = (terms, k) => {
|
|
178
|
+
if (!terms)
|
|
179
|
+
return false;
|
|
180
|
+
switch (k) {
|
|
181
|
+
case 'king':
|
|
182
|
+
case 'twin':
|
|
183
|
+
return terms.bed === k;
|
|
184
|
+
case 'payAtHotel':
|
|
185
|
+
return terms.payment === 'at-hotel';
|
|
186
|
+
case 'payOnline':
|
|
187
|
+
return terms.payment === 'online';
|
|
188
|
+
default:
|
|
189
|
+
return !!terms[k];
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
/** The terms as the chip keys they switch on - the order a chip row shows them. */
|
|
193
|
+
export const activeKeysOf = (terms) => ROOM_FILTER_KEYS.filter((k) => termsHave(terms, k));
|
|
194
|
+
/** Whether a room has everything the terms ask for. */
|
|
195
|
+
export const matchesTerms = (room, terms) => {
|
|
196
|
+
if (!terms)
|
|
197
|
+
return true;
|
|
198
|
+
const f = facetsOf(room);
|
|
199
|
+
return activeKeysOf(terms).every((k) => f[k]);
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* The chips a hotel's rooms offer, each with how many rooms (rates) it keeps
|
|
203
|
+
* on its own, in the order a chip row shows them.
|
|
204
|
+
*
|
|
205
|
+
* ⚠️ THE CORE FOUR ARE ALWAYS HERE, even at 0: a hotel with no twin room says
|
|
206
|
+
* so, and the card draws that chip empty and pressable. The rest are here ONLY
|
|
207
|
+
* WHERE THEY SPLIT the hotel's rooms - some have it and some do not. A window
|
|
208
|
+
* every room has, or none does, narrows nothing, and a row of chips that do
|
|
209
|
+
* nothing is noise.
|
|
210
|
+
*/
|
|
211
|
+
export const optionsOf = (rooms) => {
|
|
212
|
+
const all = rooms.map(facetsOf);
|
|
213
|
+
return ROOM_FILTER_KEYS.map((key) => ({ key, count: all.filter((f) => f[key]).length })).filter((o) => CORE_FILTER_KEYS.includes(o.key) || (o.count > 0 && o.count < all.length));
|
|
214
|
+
};
|
|
215
|
+
const KEY_WORDS = {
|
|
216
|
+
breakfast: 'breakfast included',
|
|
217
|
+
king: 'king bed',
|
|
218
|
+
twin: 'twin beds',
|
|
219
|
+
freeCancellation: 'free cancellation',
|
|
220
|
+
window: 'a window',
|
|
221
|
+
payAtHotel: 'payment at the hotel',
|
|
222
|
+
payOnline: 'payment online',
|
|
223
|
+
family: `room for ${FAMILY_SLEEPS} or more`,
|
|
224
|
+
};
|
|
225
|
+
const isBedKey = (k) => k === 'king' || k === 'twin';
|
|
226
|
+
/** The terms in words, for a sentence: "king bed, breakfast included, free cancellation". */
|
|
227
|
+
export const termWords = (terms) => activeKeysOf(terms)
|
|
228
|
+
// The sentence has always said the bed first.
|
|
229
|
+
.sort((a, b) => Number(!isBedKey(a)) - Number(!isBedKey(b)))
|
|
230
|
+
.map((k) => KEY_WORDS[k])
|
|
231
|
+
.join(', ');
|
|
232
|
+
/** One chip in words, for a sentence. */
|
|
233
|
+
export const keyWords = (key) => KEY_WORDS[key];
|
|
234
|
+
/**
|
|
235
|
+
* A hotel's rooms by room type, in the order the types first appear: a group
|
|
236
|
+
* that sells several rates on one type (Huazhu's 房型 × 房价码) shares a
|
|
237
|
+
* `roomType`; one whose every room is its own type (Shangri-La's) does not,
|
|
238
|
+
* and each is a type of its own.
|
|
239
|
+
*/
|
|
240
|
+
export const byRoomType = (rooms) => {
|
|
241
|
+
const types = new Map();
|
|
242
|
+
for (const r of rooms) {
|
|
243
|
+
const id = r.roomType?.id ?? r.id;
|
|
244
|
+
const type = types.get(id);
|
|
245
|
+
if (type)
|
|
246
|
+
type.rooms.push(r);
|
|
247
|
+
else
|
|
248
|
+
types.set(id, { id, name: r.roomType?.name ?? r.name, rooms: [r] });
|
|
249
|
+
}
|
|
250
|
+
return [...types.values()];
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=room-filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-filters.js","sourceRoot":"","sources":["../src/room-filters.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,WAAW;IACX,MAAM;IACN,MAAM;IACN,kBAAkB;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA6B;IACzD,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,QAAQ;CAC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AC,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3B,IAAI,IAAI;YAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YACxB,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AAC7B,CAAC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare const INITIALIZE_PER_MINUTE = 300;
|
|
|
28
28
|
* number. Found by reading the boot banner of a container that had just been
|
|
29
29
|
* deployed (2026-09-22): seventeen tools listed, and "0.7.0" above them.
|
|
30
30
|
*/
|
|
31
|
-
export declare const VERSION = "0.
|
|
31
|
+
export declare const VERSION = "0.47.0";
|
|
32
32
|
/**
|
|
33
33
|
* The card's resource URI.
|
|
34
34
|
*
|
|
@@ -37,7 +37,7 @@ export declare const VERSION = "0.45.2";
|
|
|
37
37
|
* connector went storefront-v35 → v40 in a single day of UI work for exactly
|
|
38
38
|
* this reason.
|
|
39
39
|
*/
|
|
40
|
-
export declare const CARD_URI = "ui://curless/hotel/booking-
|
|
40
|
+
export declare const CARD_URI = "ui://curless/hotel/booking-v88.html";
|
|
41
41
|
/**
|
|
42
42
|
* The URI one deployment names its card by: `CARD_URI` with a short hash of
|
|
43
43
|
* everything a host caches under it - the card itself, and the hosts it may
|
package/dist/server.js
CHANGED
|
@@ -47,7 +47,7 @@ export const INITIALIZE_PER_MINUTE = 300;
|
|
|
47
47
|
* number. Found by reading the boot banner of a container that had just been
|
|
48
48
|
* deployed (2026-09-22): seventeen tools listed, and "0.7.0" above them.
|
|
49
49
|
*/
|
|
50
|
-
export const VERSION = '0.
|
|
50
|
+
export const VERSION = '0.47.0';
|
|
51
51
|
/**
|
|
52
52
|
* The card's resource URI.
|
|
53
53
|
*
|
|
@@ -56,7 +56,7 @@ export const VERSION = '0.45.2';
|
|
|
56
56
|
* connector went storefront-v35 → v40 in a single day of UI work for exactly
|
|
57
57
|
* this reason.
|
|
58
58
|
*/
|
|
59
|
-
export const CARD_URI = 'ui://curless/hotel/booking-
|
|
59
|
+
export const CARD_URI = 'ui://curless/hotel/booking-v88.html';
|
|
60
60
|
/** The card as it ships, hashed once - what a host caches under the URI. */
|
|
61
61
|
const CARD_HTML_SHA = createHash('sha256').update(HOTEL_CARD_HTML).digest('hex');
|
|
62
62
|
/**
|
package/dist/supplier.d.ts
CHANGED
package/dist/supplier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier.d.ts","sourceRoot":"","sources":["../src/supplier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAa3C,8FAA8F;AAC9F,MAAM,MAAM,IAAI,GAAG;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,qDAAqD;IACrD,YAAY,EAAE,MAAM,MAAM,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,iGAAiG;IACjG,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM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plier.js
CHANGED
|
@@ -43,7 +43,10 @@ const makeDemo = (data, ctx) => {
|
|
|
43
43
|
* one blank thumbnail per room, with nothing in any log to say why.
|
|
44
44
|
*/
|
|
45
45
|
export const imageDomainsOf = (hotels) => [
|
|
46
|
-
...new Set(hotels.flatMap((h) => [
|
|
46
|
+
...new Set(hotels.flatMap((h) => [
|
|
47
|
+
...hostOf(h.imageUrl),
|
|
48
|
+
...h.rooms.flatMap((r) => [...hostOf(r.imageUrl), ...(r.images ?? []).flatMap(hostOf)]),
|
|
49
|
+
])),
|
|
47
50
|
];
|
|
48
51
|
const hostOf = (url) => {
|
|
49
52
|
if (!url)
|
package/dist/supplier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supplier.js","sourceRoot":"","sources":["../src/supplier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAkD9C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAyB,EAAE,GAAoB,EAAQ,EAAE;IACpF,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACvD,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW;QAAE,OAAO,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;IAC/E,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACrB,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAClG,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,C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AM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACpB,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;QACrB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;KACxF,CAAC,CACH;CACF,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,GAAY,EAAY,EAAE;IACxC,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const LOOK_UP_MAX = 6;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCapabilities) => ({
|
|
17
17
|
readonly name: `list_${string}${string}`;
|
|
18
|
-
readonly description: `${string}, shown as a card. Asked with no place - or a country of many cities - it answers with the places to choose from: regions, countries and cities, each with how many ${string} it has; \`all\` lists the ${string} themselves. \`city\` (a city or a country) or \`query\` answers with the ${string}: a picture, the city and area, a rating where the ${string} publishes one, and a from-price, and a city usually holds several. With \`checkIn\` and \`checkOut\` every ${string} is priced for those nights - its cheapest room that takes the party, \`rooms\` of it, for the whole stay with taxes - or marked as having no room for them. \`sort\` and \`maxNightly\` order and cap by that price, or by the from-price without dates, where the matches share one currency. \`brand\`, \`facilities\`, \`freeCancellation\` and \`
|
|
18
|
+
readonly description: `${string}, shown as a card. Asked with no place - or a country of many cities - it answers with the places to choose from: regions, countries and cities, each with how many ${string} it has; \`all\` lists the ${string} themselves. \`city\` (a city or a country) or \`query\` answers with the ${string}: a picture, the city and area, a rating where the ${string} publishes one, and a from-price, and a city usually holds several. With \`checkIn\` and \`checkOut\` every ${string} is priced for those nights - its cheapest room that takes the party, \`rooms\` of it, for the whole stay with taxes - or marked as having no room for them. \`sort\` and \`maxNightly\` order and cap by that price, or by the from-price without dates, where the matches share one currency. \`brand\`, \`facilities\`, \`freeCancellation\`, \`breakfast\` and \`bed\` narrow the list, and the answer counts what each would leave. A long list comes a page at a time: the answer says how many more there are and the \`offset\` of the next page. Words or a place that match nothing are widened once, and the answer names what it widened to.${string}`;
|
|
19
19
|
readonly annotations: {
|
|
20
20
|
readonly title: string;
|
|
21
21
|
readonly readOnlyHint: true;
|
|
@@ -42,6 +42,11 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
42
42
|
readonly type: "boolean";
|
|
43
43
|
readonly description: `Only ${string} with a room that includes breakfast - and, with dates, that room is the one priced`;
|
|
44
44
|
};
|
|
45
|
+
readonly bed: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly enum: readonly ["king", "twin"];
|
|
48
|
+
readonly description: `Only ${string} with a room that has this bed - \`king\` is one large bed (king, queen or double), \`twin\` is two beds - and, with dates, that room is the one priced. Given with \`freeCancellation\` or \`breakfast\`, one room must have all of them`;
|
|
49
|
+
};
|
|
45
50
|
readonly all: {
|
|
46
51
|
readonly type: "boolean";
|
|
47
52
|
readonly description: `Unnarrowed, or narrowed to a country of many cities, the answer is the places to choose from; true lists the ${string} themselves`;
|
|
@@ -105,7 +110,7 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
105
110
|
};
|
|
106
111
|
} | {
|
|
107
112
|
readonly name: `get_${string}${string}`;
|
|
108
|
-
readonly description: `One ${string} in full: description, amenities, address, and check-in and check-out times where the ${string} publishes them. Given \`checkIn\` and \`checkOut\` it also returns the room types that can be booked for those nights,
|
|
113
|
+
readonly description: `One ${string} in full: description, amenities, address, and check-in and check-out times where the ${string} publishes them. Given \`checkIn\` and \`checkOut\` it also returns the room types that can be booked for those nights, one line per type at its lowest rate: the nightly rate, the stay total including taxes and fees, whether it can be cancelled free and until when, and how many rates it has. \`rooms\` leaves out the types that have fewer than that many left. \`bed\`, \`breakfast\`, \`freeCancellation\`, \`window\`, \`payment\` and \`family\` keep only the rates that meet all of those given; the card still holds every room, with the given filters selected. Without dates it returns the ${string} only, because a room has no price until the nights are known. The ${string} is drawn as a card for the guest to look at.${string}`;
|
|
109
114
|
readonly annotations: {
|
|
110
115
|
readonly title: string;
|
|
111
116
|
readonly readOnlyHint: true;
|
|
@@ -122,6 +127,32 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
122
127
|
readonly maximum: 5;
|
|
123
128
|
readonly description: "How many rooms of one type, 1 to 5. Default 1";
|
|
124
129
|
};
|
|
130
|
+
readonly bed: {
|
|
131
|
+
readonly type: "string";
|
|
132
|
+
readonly enum: readonly ["king", "twin"];
|
|
133
|
+
readonly description: "With dates: only rooms with this bed - `king` is one large bed (king, queen or double), `twin` is two beds. A room sold as king or twin has both";
|
|
134
|
+
};
|
|
135
|
+
readonly breakfast: {
|
|
136
|
+
readonly type: "boolean";
|
|
137
|
+
readonly description: "With dates: only rooms whose rate includes breakfast";
|
|
138
|
+
};
|
|
139
|
+
readonly freeCancellation: {
|
|
140
|
+
readonly type: "boolean";
|
|
141
|
+
readonly description: "With dates: only rooms that can be cancelled free";
|
|
142
|
+
};
|
|
143
|
+
readonly window: {
|
|
144
|
+
readonly type: "boolean";
|
|
145
|
+
readonly description: "With dates: only rooms with a window (not a partial or an inner one)";
|
|
146
|
+
};
|
|
147
|
+
readonly payment: {
|
|
148
|
+
readonly type: "string";
|
|
149
|
+
readonly enum: readonly ["at-hotel", "online"];
|
|
150
|
+
readonly description: "With dates: only rooms paid at the hotel (`at-hotel`) or in advance online (`online`)";
|
|
151
|
+
};
|
|
152
|
+
readonly family: {
|
|
153
|
+
readonly type: "boolean";
|
|
154
|
+
readonly description: "With dates: only rooms that sleep 3 or more";
|
|
155
|
+
};
|
|
125
156
|
readonly checkIn: {
|
|
126
157
|
readonly type: "string";
|
|
127
158
|
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}$";
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EASzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAK7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EASzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,cAAc,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAK7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA8BhD,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAEV,cAAc,EAkBd,eAAe,EAKhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAa,KAAK,UAAU,EAAwC,MAAM,YAAY,CAAC;AAuF9F,+GAA+G;AAC/G,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B;;;;GAIG;AACH,eAAO,MAAM,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