@curless/hotel-storefront 0.53.0 → 0.54.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/about.d.ts +24 -0
- package/dist/about.d.ts.map +1 -0
- package/dist/about.js +28 -0
- package/dist/about.js.map +1 -0
- package/dist/aggregate/make.js +2 -2
- package/dist/aggregate/make.js.map +1 -1
- package/dist/backend.d.ts +6 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js.map +1 -1
- 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/coupon-words.d.ts +12 -0
- package/dist/coupon-words.d.ts.map +1 -0
- package/dist/coupon-words.js +19 -0
- package/dist/coupon-words.js.map +1 -0
- package/dist/dates.js +1 -1
- package/dist/dates.js.map +1 -1
- package/dist/demo-hotels.d.ts +6 -0
- package/dist/demo-hotels.d.ts.map +1 -1
- package/dist/demo-hotels.js +39 -15
- package/dist/demo-hotels.js.map +1 -1
- package/dist/huazhu/backend.d.ts +6 -0
- package/dist/huazhu/backend.d.ts.map +1 -1
- package/dist/huazhu/backend.js +38 -30
- package/dist/huazhu/backend.js.map +1 -1
- package/dist/huazhu/catalog.d.ts.map +1 -1
- package/dist/huazhu/catalog.js +27 -6
- package/dist/huazhu/catalog.js.map +1 -1
- package/dist/huazhu/client.js +1 -1
- package/dist/huazhu/client.js.map +1 -1
- package/dist/huazhu/make.d.ts.map +1 -1
- package/dist/huazhu/make.js +1 -0
- package/dist/huazhu/make.js.map +1 -1
- package/dist/huazhu/sandbox.d.ts.map +1 -1
- package/dist/huazhu/sandbox.js +5 -3
- package/dist/huazhu/sandbox.js.map +1 -1
- package/dist/paid.d.ts.map +1 -1
- package/dist/paid.js +3 -1
- package/dist/paid.js.map +1 -1
- package/dist/reference.d.ts.map +1 -1
- package/dist/reference.js +13 -6
- package/dist/reference.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +4 -4
- package/dist/server.js.map +1 -1
- package/dist/supplier.d.ts +6 -0
- package/dist/supplier.d.ts.map +1 -1
- package/dist/supplier.js +1 -0
- package/dist/supplier.js.map +1 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +27 -18
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +11 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +98 -39
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vocab.d.ts +15 -1
- package/dist/vocab.d.ts.map +1 -1
- package/dist/vocab.js +26 -2
- package/dist/vocab.js.map +1 -1
- package/package.json +1 -1
package/dist/huazhu/backend.js
CHANGED
|
@@ -1147,8 +1147,8 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1147
1147
|
if (fails.some((f) => f.kind === 'prepaid'))
|
|
1148
1148
|
return {
|
|
1149
1149
|
why: prepaidType
|
|
1150
|
-
? "This hotel's rooms by the hour are sold only on payment terms
|
|
1151
|
-
: "This hotel's rooms by the hour are paid in advance, and
|
|
1150
|
+
? "This hotel's rooms by the hour are sold only on payment terms that cannot be taken here."
|
|
1151
|
+
: "This hotel's rooms by the hour are paid in advance, and only rates paid at the hotel can be booked here.",
|
|
1152
1152
|
code: 'prepaid-only',
|
|
1153
1153
|
};
|
|
1154
1154
|
const said = (re) => fails
|
|
@@ -1175,7 +1175,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1175
1175
|
const noRoomsWhy = (priced, stay, rooms) => {
|
|
1176
1176
|
if (priced.length === 0)
|
|
1177
1177
|
return {
|
|
1178
|
-
why: 'This hotel has no rooms on sale
|
|
1178
|
+
why: 'This hotel has no rooms on sale here.',
|
|
1179
1179
|
code: 'none-on-sale',
|
|
1180
1180
|
};
|
|
1181
1181
|
const fails = priced.map((p) => p.res).filter((r) => !r.ok);
|
|
@@ -1200,8 +1200,8 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1200
1200
|
if (kinds.has('prepaid') && !kinds.has('party') && !kinds.has('too-many-rooms'))
|
|
1201
1201
|
return {
|
|
1202
1202
|
why: prepaidType
|
|
1203
|
-
? 'Every room still open here for those nights is sold only on payment terms
|
|
1204
|
-
: 'Every room still open here for those nights is paid in advance, and
|
|
1203
|
+
? 'Every room still open here for those nights is sold only on payment terms that cannot be taken here.'
|
|
1204
|
+
: 'Every room still open here for those nights is paid in advance, and only rates paid at the hotel can be booked here.',
|
|
1205
1205
|
code: 'prepaid-only',
|
|
1206
1206
|
};
|
|
1207
1207
|
if (only('sold-out'))
|
|
@@ -1251,7 +1251,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1251
1251
|
for (const [i, line] of trip.lines.entries()) {
|
|
1252
1252
|
const h = catalog.get(line.hotelId);
|
|
1253
1253
|
if (!h) {
|
|
1254
|
-
dropped.push({ title: line.hotelId, why: 'That hotel is not
|
|
1254
|
+
dropped.push({ title: line.hotelId, why: 'That hotel is not offered here any more.' });
|
|
1255
1255
|
continue;
|
|
1256
1256
|
}
|
|
1257
1257
|
const hotelName = toHotel(h, view, now()).name;
|
|
@@ -1641,8 +1641,8 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1641
1641
|
const refresh = async (found) => (await lookAt(found)).booking;
|
|
1642
1642
|
/** Why a booking cannot be cancelled yet: Huazhu has not said whether it exists. */
|
|
1643
1643
|
const waitingWords = (b) => b.status === 'unconfirmed'
|
|
1644
|
-
? `${opts.sandbox ? 'The simulated Huazhu' : 'Huazhu'} has not said whether this booking was made, and a person here is confirming it. It cannot be cancelled here until then - ask again later.`
|
|
1645
|
-
: `${opts.sandbox ? 'The simulated Huazhu' : 'Huazhu'} has not confirmed this booking yet - that takes up to eight minutes. It can be cancelled once it is confirmed.`;
|
|
1644
|
+
? `${opts.sandbox && !opts.inMarket ? 'The simulated Huazhu' : 'Huazhu'} has not said whether this booking was made, and a person here is confirming it. It cannot be cancelled here until then - ask again later.`
|
|
1645
|
+
: `${opts.sandbox && !opts.inMarket ? 'The simulated Huazhu' : 'Huazhu'} has not confirmed this booking yet - that takes up to eight minutes. It can be cancelled once it is confirmed.`;
|
|
1646
1646
|
const feeNow = (b, at = now()) => {
|
|
1647
1647
|
const policy = policyOf(b.cancelCode);
|
|
1648
1648
|
const amounts = {
|
|
@@ -1838,7 +1838,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1838
1838
|
if (liveForEmail + lines.length > limits.perEmailLive) {
|
|
1839
1839
|
// ⚠️ "THIS EMAIL", NEVER THE ADDRESS (2026-10-29 audit, H5): these words
|
|
1840
1840
|
// go back to the model, and what the guest typed on the card does not.
|
|
1841
|
-
throw new Error(`Nothing was booked. This email already has ${plural(liveForEmail, 'booking')} still to come
|
|
1841
|
+
throw new Error(`Nothing was booked. This email already has ${plural(liveForEmail, 'booking')} here still to come, and ${limits.perEmailLive} at once is the most - cancel one that is not needed, then ask again.`);
|
|
1842
1842
|
}
|
|
1843
1843
|
if (requestsByEmail.count(email) >= limits.perEmailPerDay) {
|
|
1844
1844
|
throw new Error(`Nothing was booked. This email has asked for ${plural(limits.perEmailPerDay, 'booking')} in the last 24 hours, which is the most here - try again later.`);
|
|
@@ -1874,7 +1874,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
1874
1874
|
console.error(`[huazhu bookings] ⚠️ NEEDS A PERSON: ${madeToday} bookings in the last 24 hours reached the ceiling of ${limits.perDeploymentPerDay}; new bookings are refused until the count falls`);
|
|
1875
1875
|
}
|
|
1876
1876
|
store.ceilingHitAt = now();
|
|
1877
|
-
throw new Error(`Nothing was booked:
|
|
1877
|
+
throw new Error(`Nothing was booked: booking here is paused for now - the limit on bookings made in a day has been reached. Try again later, or book with ${opts.brand} directly.`);
|
|
1878
1878
|
}
|
|
1879
1879
|
// The network counted once it has passed every limit - a request turned
|
|
1880
1880
|
// away is not one more against the guest, or a guest at a limit could
|
|
@@ -2335,7 +2335,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
2335
2335
|
for (let i = 0; busy.has(id) && i < 400; i += 1)
|
|
2336
2336
|
await new Promise((r) => setTimeout(r, 25));
|
|
2337
2337
|
if (closing)
|
|
2338
|
-
throw new Error('
|
|
2338
|
+
throw new Error('Booking here is briefly unavailable. Nothing changed - ask again in a moment.');
|
|
2339
2339
|
if (busy.has(id))
|
|
2340
2340
|
throw new Error('A payment on this booking is being settled right now. Ask again in a moment.');
|
|
2341
2341
|
return (await ifFree(id, fn));
|
|
@@ -2793,7 +2793,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
2793
2793
|
console.error(`[huazhu bookings] ⚠️ NEEDS A PERSON: ${unpaid} requests to pay in advance left unpaid (waiting for payment or lapsed) in the last 24 hours reached the unpaid ceiling of ${unpaidPerDay}; new requests to pay in advance are refused until the count falls`);
|
|
2794
2794
|
}
|
|
2795
2795
|
store.ceilingHitAt = now();
|
|
2796
|
-
throw new Error(`Nothing was booked:
|
|
2796
|
+
throw new Error(`Nothing was booked: booking a stay paid in advance here is paused for now - the limit on payment requests left unpaid in a day has been reached. Try again later, pay at the hotel where the rate allows it, or book with ${opts.brand} directly.`);
|
|
2797
2797
|
}
|
|
2798
2798
|
}
|
|
2799
2799
|
// Prebook is Huazhu's own check of price, rooms and rules - for each stay
|
|
@@ -4092,7 +4092,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
4092
4092
|
quote,
|
|
4093
4093
|
async requestBooking(trip, guest, who, requests) {
|
|
4094
4094
|
if (closing) {
|
|
4095
|
-
throw new Error('Nothing was booked:
|
|
4095
|
+
throw new Error('Nothing was booked: booking here is briefly unavailable. Ask again in a minute - the trip is kept.');
|
|
4096
4096
|
}
|
|
4097
4097
|
if (!guest.name.trim() || !guest.email.includes('@')) {
|
|
4098
4098
|
// Nothing is emailed from here (2026-10-05 audit): the email is how the
|
|
@@ -4241,17 +4241,23 @@ export const createHuazhuHotels = (opts) => {
|
|
|
4241
4241
|
// said for Huazhu's test system only, so in the sandbox the "nothing
|
|
4242
4242
|
// comes back" and "cannot be cancelled" previews said nothing of being a
|
|
4243
4243
|
// test - while the "all of it back" one did.
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4244
|
+
// ⚠️ ONE WORD PER ENVIRONMENT (0.54.0, M9): "simulated" on the simulated Huazhu, "test"
|
|
4245
|
+
// on Huazhu's test system - and in a market neither, only the fact.
|
|
4246
|
+
const testNote = opts.inMarket && (opts.sandbox || opts.testEnvironment)
|
|
4247
|
+
? ' This booking was not sent to Huazhu: nothing is charged to anyone.'
|
|
4248
|
+
: opts.sandbox
|
|
4249
|
+
? ' This is a simulated booking in the simulated Huazhu: nothing is charged to anyone.'
|
|
4250
|
+
: opts.testEnvironment
|
|
4251
|
+
? " This is a test booking in Huazhu's test system: nothing is charged to anyone."
|
|
4252
|
+
: '';
|
|
4253
|
+
// A booking paid here in advance, in either: the money is not real either.
|
|
4254
|
+
const paidTestNote = opts.inMarket && (opts.sandbox || opts.testEnvironment)
|
|
4255
|
+
? ' This booking was not sent to Huazhu, and no real money moves.'
|
|
4256
|
+
: opts.sandbox
|
|
4257
|
+
? ' This is a simulated booking in the simulated Huazhu, paid on a card page where no real money moves.'
|
|
4258
|
+
: opts.testEnvironment
|
|
4259
|
+
? ' This is a test booking in Huazhu’s test system, paid in test mode: no real money moves.'
|
|
4260
|
+
: '';
|
|
4255
4261
|
// Paid with UnionPay: Huazhu charged the one-time card, and gives back
|
|
4256
4262
|
// to it what its terms allow - nothing passes through here (audit P0-C:
|
|
4257
4263
|
// it was told as "paid at the hotel, nothing paid through here").
|
|
@@ -4299,11 +4305,13 @@ export const createHuazhuHotels = (opts) => {
|
|
|
4299
4305
|
refund: zero,
|
|
4300
4306
|
rule: forbidden
|
|
4301
4307
|
? `This rate cannot be cancelled now. ${rule}`
|
|
4302
|
-
: opts.sandbox
|
|
4303
|
-
? `${rule} This
|
|
4304
|
-
: opts.
|
|
4305
|
-
? `${rule} This is a
|
|
4306
|
-
:
|
|
4308
|
+
: opts.inMarket && (opts.sandbox || opts.testEnvironment)
|
|
4309
|
+
? `${rule} This booking was not sent to Huazhu: the fee is worked out as a real booking's would be, and nothing is charged to anyone.`
|
|
4310
|
+
: opts.sandbox
|
|
4311
|
+
? `${rule} This is a simulated booking in the simulated Huazhu: the fee is worked out as a real booking's would be, and nothing is charged to anyone.`
|
|
4312
|
+
: opts.testEnvironment
|
|
4313
|
+
? `${rule} This is a test booking in Huazhu's test system: the fee is worked out as a real booking's would be, and nothing is charged to anyone.`
|
|
4314
|
+
: `${rule} Nothing was paid here - the booking is paid at the hotel - so any fee is charged under the hotel's terms, and Huazhu works out the exact amount when it cancels.`,
|
|
4307
4315
|
...(freeUntil ? { freeUntil: new Date(freeUntil).toISOString() } : {}),
|
|
4308
4316
|
cancellable: !forbidden,
|
|
4309
4317
|
...facts,
|
|
@@ -4438,7 +4446,7 @@ export const createHuazhuHotels = (opts) => {
|
|
|
4438
4446
|
: 'Huazhu says this booking cannot be cancelled.');
|
|
4439
4447
|
}
|
|
4440
4448
|
else if (err instanceof HuazhuTooBusy) {
|
|
4441
|
-
throw new Error('Huazhu was not asked:
|
|
4449
|
+
throw new Error('Huazhu was not asked: too many calls were going to Huazhu just now, so nothing was cancelled. Ask again in a moment.');
|
|
4442
4450
|
}
|
|
4443
4451
|
else if (err instanceof HuazhuUnreachable) {
|
|
4444
4452
|
throw new Error('Huazhu did not answer, so it is not known whether the booking was cancelled. Asking again is safe - cancelling twice does not charge twice.');
|