@curless/hotel-storefront 0.71.3 → 0.71.4

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/tools.js CHANGED
@@ -4661,23 +4661,11 @@ const needsRoomIn = (t, lines, parts) => {
4661
4661
  };
4662
4662
  };
4663
4663
  /**
4664
- * The sentence that asks the guest for what a booking takes - or, for a guest
4665
- * signed in to an account that has their details (0.67.0), says those are used:
4666
- * the model asks for nothing it would only be told back (masked).
4664
+ * The sentence that asks the guest for what a booking takes. ⚠️ NEVER FROM AN ACCOUNT
4665
+ * (0.71.4, robin 11-13): the Otaless account has no name and no phone to give, so its
4666
+ * 「用会员资料」 filled in nothing - the guest types their own, as everywhere.
4667
4667
  */
4668
- const detailsAsked = (deps, key, rooms) => {
4669
- const asked = `ask for their own ${guestDetailsFor(deps, rooms)} if they have not typed them in this conversation.`;
4670
- const p = deps.guestProfile?.(key)?.shown;
4671
- if (!p?.email)
4672
- return asked;
4673
- const has = [p.name ? 'name' : '', `email (${p.email})`, p.phone ? 'phone' : ''].filter(Boolean);
4674
- // ⚠️ WHAT THE ACCOUNT DOES NOT HAVE IS STILL ASKED FOR (0.69.1, 总线程 11-12): an
4675
- // account with no phone - the card's form asks for one where a group needs it, and
4676
- // so does this - never left for the booking to refuse.
4677
- const phone = phoneNeededFor(deps, rooms);
4678
- const missing = [p.name ? '' : 'full name', p.phone || !phone ? '' : phone].filter(Boolean);
4679
- return `say that the booking uses the ${listAnd(has)} on their ${deps.vocab.brand} account - do not ask for ${has.length > 1 ? 'them' : 'it'}; pass name, email or phone to ${deps.tools.requestBooking} only for ones the guest gives instead${missing.length ? `, and ask for their ${listAnd(missing)} if they have not typed ${missing.length > 1 ? 'them' : 'it'} in this conversation - the account has ${missing.length > 1 ? 'neither' : 'none'}` : ''}.`;
4680
- };
4668
+ const detailsAsked = (deps, _key, rooms) => `ask for their own ${guestDetailsFor(deps, rooms)} if they have not typed them in this conversation.`;
4681
4669
  /**
4682
4670
  * Where a booking of these stays takes a phone number: "phone number" for all of
4683
4671
  * them, "phone number for the stays with …" for some in a market - '' for none.
@@ -6342,52 +6330,6 @@ const bookingAnswer = async (deps, t, ctx, key, store, args, inTrip, lines, show
6342
6330
  * member rate and under the same limits, and the trip is never read or emptied.
6343
6331
  * `nothingThere` is what is said when the slot is empty.
6344
6332
  */
6345
- /**
6346
- * A booking's name, email and phone, with what the guest left empty taken from
6347
- * their signed-in account (0.67.0, `ToolDeps.guestProfile`). What they typed
6348
- * stands; a field that is empty - or masked, as the account's is shown (a model
6349
- * passing back 「l•••@e•••.com」) - is the account's. `used` names what was taken,
6350
- * and `shown` says it masked, for the answer.
6351
- */
6352
- const withProfile = (deps, key, args) => {
6353
- const p = deps.guestProfile?.(key);
6354
- if (!p)
6355
- return { args, used: [] };
6356
- const blank = (v) => {
6357
- const t = str(v).trim();
6358
- return !t || t.includes('•');
6359
- };
6360
- const out = { ...args };
6361
- const used = [];
6362
- for (const k of ['name', 'email', 'phone']) {
6363
- const v = p.whole[k];
6364
- if (v && blank(args[k])) {
6365
- out[k] = v;
6366
- used.push(k);
6367
- }
6368
- }
6369
- return {
6370
- args: out,
6371
- used,
6372
- shown: used.includes('email') && p.shown.email ? { email: p.shown.email } : {},
6373
- };
6374
- };
6375
- /** The answer to a booking, saying what of the account it used (masked) - see `withProfile`. */
6376
- const saidProfile = (deps, answer, filled) => {
6377
- if (!filled.used.length)
6378
- return answer;
6379
- const parts = [
6380
- filled.used.includes('name') ? 'name' : '',
6381
- filled.shown?.email ? `email ${filled.shown.email}` : '',
6382
- filled.used.includes('phone') ? 'phone' : '',
6383
- ].filter(Boolean);
6384
- const words = `For what the guest did not give, this booking uses their ${deps.vocab.brand} account's ${listAnd(parts)}.`;
6385
- return {
6386
- ...answer,
6387
- structured: { ...answer.structured, fromAccount: { used: filled.used, ...filled.shown } },
6388
- text: `${answer.text}\n\n${words}`,
6389
- };
6390
- };
6391
6333
  const bookTripLines = async (deps, t, ctx, key, store, args, nothingThere) => {
6392
6334
  const inTrip = deps.trips.read(store);
6393
6335
  if (inTrip.length === 0) {
@@ -7876,20 +7818,17 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
7876
7818
  };
7877
7819
  }
7878
7820
  if (name === t.requestBooking) {
7879
- const filled = withProfile(deps, key, args);
7880
- return saidProfile(deps, await bookTripLines(deps, t, ctx, key, key, filled.args, `There is nothing in the trip yet. ${t.addToTrip} puts room nights in it.`), filled);
7821
+ return bookTripLines(deps, t, ctx, key, key, args, `There is nothing in the trip yet. ${t.addToTrip} puts room nights in it.`);
7881
7822
  }
7882
7823
  // The card's own: the room the guest picked with Reserve, booked exactly as
7883
7824
  // a trip is - and the trip left as it is.
7884
7825
  if (name === t.bookPicked) {
7885
- // What the guest left empty on the card's form, from their account (0.67.0).
7886
- const filled = withProfile(deps, key, args);
7887
- const changed = pickChanged(deps, key, filled.args);
7826
+ const changed = pickChanged(deps, key, args);
7888
7827
  if (changed) {
7889
7828
  const emptied = !deps.trips.read(pickedKey(key)).some((l) => l.kind === 'room');
7890
- return direct((emptied && (await bookedFromThisForm(deps, ctx, key, filled.args))) || changed);
7829
+ return direct((emptied && (await bookedFromThisForm(deps, ctx, key, args))) || changed);
7891
7830
  }
7892
- return direct(saidProfile(deps, await bookTripLines(deps, t, ctx, key, pickedKey(key), filled.args, 'Nothing is picked: the guest presses Reserve on a room first.'), filled));
7831
+ return direct(await bookTripLines(deps, t, ctx, key, pickedKey(key), args, 'Nothing is picked: the guest presses Reserve on a room first.'));
7893
7832
  }
7894
7833
  // The card's own: the guest pressed "Agree and continue" under a group's
7895
7834
  // booking terms. ⚠️ THE ONLY AGREEMENT THERE IS: no tool the model sees has a