@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.
Files changed (64) hide show
  1. package/dist/about.d.ts +24 -0
  2. package/dist/about.d.ts.map +1 -0
  3. package/dist/about.js +28 -0
  4. package/dist/about.js.map +1 -0
  5. package/dist/aggregate/make.js +2 -2
  6. package/dist/aggregate/make.js.map +1 -1
  7. package/dist/backend.d.ts +6 -0
  8. package/dist/backend.d.ts.map +1 -1
  9. package/dist/backend.js.map +1 -1
  10. package/dist/card.generated.d.ts +1 -1
  11. package/dist/card.generated.js +2 -2
  12. package/dist/card.generated.js.map +1 -1
  13. package/dist/coupon-words.d.ts +12 -0
  14. package/dist/coupon-words.d.ts.map +1 -0
  15. package/dist/coupon-words.js +19 -0
  16. package/dist/coupon-words.js.map +1 -0
  17. package/dist/dates.js +1 -1
  18. package/dist/dates.js.map +1 -1
  19. package/dist/demo-hotels.d.ts +6 -0
  20. package/dist/demo-hotels.d.ts.map +1 -1
  21. package/dist/demo-hotels.js +39 -15
  22. package/dist/demo-hotels.js.map +1 -1
  23. package/dist/huazhu/backend.d.ts +6 -0
  24. package/dist/huazhu/backend.d.ts.map +1 -1
  25. package/dist/huazhu/backend.js +38 -30
  26. package/dist/huazhu/backend.js.map +1 -1
  27. package/dist/huazhu/catalog.d.ts.map +1 -1
  28. package/dist/huazhu/catalog.js +27 -6
  29. package/dist/huazhu/catalog.js.map +1 -1
  30. package/dist/huazhu/client.js +1 -1
  31. package/dist/huazhu/client.js.map +1 -1
  32. package/dist/huazhu/make.d.ts.map +1 -1
  33. package/dist/huazhu/make.js +1 -0
  34. package/dist/huazhu/make.js.map +1 -1
  35. package/dist/huazhu/sandbox.d.ts.map +1 -1
  36. package/dist/huazhu/sandbox.js +5 -3
  37. package/dist/huazhu/sandbox.js.map +1 -1
  38. package/dist/paid.d.ts.map +1 -1
  39. package/dist/paid.js +3 -1
  40. package/dist/paid.js.map +1 -1
  41. package/dist/reference.d.ts.map +1 -1
  42. package/dist/reference.js +13 -6
  43. package/dist/reference.js.map +1 -1
  44. package/dist/server.d.ts +2 -2
  45. package/dist/server.js +4 -4
  46. package/dist/server.js.map +1 -1
  47. package/dist/supplier.d.ts +6 -0
  48. package/dist/supplier.d.ts.map +1 -1
  49. package/dist/supplier.js +1 -0
  50. package/dist/supplier.js.map +1 -1
  51. package/dist/surface.d.ts.map +1 -1
  52. package/dist/surface.js +27 -18
  53. package/dist/surface.js.map +1 -1
  54. package/dist/tools.d.ts +11 -0
  55. package/dist/tools.d.ts.map +1 -1
  56. package/dist/tools.js +98 -39
  57. package/dist/tools.js.map +1 -1
  58. package/dist/types.d.ts +23 -0
  59. package/dist/types.d.ts.map +1 -1
  60. package/dist/vocab.d.ts +15 -1
  61. package/dist/vocab.d.ts.map +1 -1
  62. package/dist/vocab.js +26 -2
  63. package/dist/vocab.js.map +1 -1
  64. package/package.json +1 -1
@@ -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 this connector cannot take."
1151
- : "This hotel's rooms by the hour are paid in advance, and this connector books rates paid at the hotel.",
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 through this connector.',
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 this connector cannot take.'
1204
- : 'Every room still open here for those nights is paid in advance, and this connector books rates paid at the hotel.',
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 in this connector any more.' });
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 through this connector, and ${limits.perEmailLive} at once is the most - cancel one that is not needed, then ask again.`);
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: bookings through this connector are paused for now - the limit on bookings made in a day has been reached. Try again later, or book with ${opts.brand} directly.`);
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('This connector is restarting. Nothing changed - ask again in a moment.');
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: bookings paid in advance through this connector are 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.`);
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: this connector is restarting. Ask again in a minute - the trip is kept.');
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
- const testNote = opts.sandbox
4245
- ? ' This is a test booking in the simulated Huazhu: nothing is charged to anyone.'
4246
- : opts.testEnvironment
4247
- ? " This is a test booking in Huazhu's test system: nothing is charged to anyone."
4248
- : '';
4249
- // A booking paid here in advance, in either: the money is a test too.
4250
- const paidTestNote = opts.sandbox
4251
- ? ' This is a test booking in the simulated Huazhu, paid in Stripe’s test mode: no real money moves.'
4252
- : opts.testEnvironment
4253
- ? ' This is a test booking in Huazhu’s test system, paid in test mode: no real money moves.'
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 is a test booking in the simulated Huazhu: the fee is worked out as a real booking's would be, and nothing is charged to anyone.`
4304
- : opts.testEnvironment
4305
- ? `${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.`
4306
- : `${rule} Nothing was paid through this connector - 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.`,
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: this connector is calling Huazhu at its own limit just now, so nothing was cancelled. Ask again in a moment.');
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.');