@curless/hotel-storefront 0.83.0 → 0.84.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/account/addon-pages.d.ts +1 -0
- package/dist/account/addon-pages.d.ts.map +1 -1
- package/dist/account/addon-pages.js +6 -1
- package/dist/account/addon-pages.js.map +1 -1
- package/dist/account/index.d.ts +32 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +71 -15
- package/dist/account/index.js.map +1 -1
- package/dist/account/page-words.d.ts +5 -0
- package/dist/account/page-words.d.ts.map +1 -0
- package/dist/account/page-words.js +10 -0
- package/dist/account/page-words.js.map +1 -0
- package/dist/account/store.js +3 -3
- package/dist/account/store.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/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/money.d.ts +2 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +14 -1
- package/dist/money.js.map +1 -1
- package/dist/otaless/addons-answers.d.ts +18 -1
- package/dist/otaless/addons-answers.d.ts.map +1 -1
- package/dist/otaless/addons-answers.js +51 -5
- package/dist/otaless/addons-answers.js.map +1 -1
- package/dist/otaless/addons.d.ts +25 -4
- package/dist/otaless/addons.d.ts.map +1 -1
- package/dist/otaless/addons.js +78 -0
- package/dist/otaless/addons.js.map +1 -1
- package/dist/otaless/shop-answers.d.ts.map +1 -1
- package/dist/otaless/shop-answers.js +4 -2
- package/dist/otaless/shop-answers.js.map +1 -1
- package/dist/otaless/shop-service.d.ts +7 -0
- package/dist/otaless/shop-service.d.ts.map +1 -1
- package/dist/otaless/shop-service.js +11 -0
- package/dist/otaless/shop-service.js.map +1 -1
- package/dist/otaless/shop.d.ts +9 -0
- package/dist/otaless/shop.d.ts.map +1 -1
- package/dist/otaless/shop.js +39 -1
- package/dist/otaless/shop.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -5
- package/dist/server.js.map +1 -1
- package/dist/tools.d.ts +34 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +134 -19
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { aboutLines } from './about.js';
|
|
2
|
+
import { GUEST_ALONE, OPENS_SIGNED_IN } from './account/page-words.js';
|
|
2
3
|
import { DEFAULT_PAGE, FULL_CAPABILITIES, LASTING_REQUESTS, MAX_PAGE, REQUEST_KINDS, REQUEST_NOTE_MAX, guestTooLong, maskedEmail, notPricedForNoAnswer, unansweredBy, unitWords, unpaidBookingNote, wholeEmail, } from './backend.js';
|
|
3
4
|
import { PAY_WORDS, allOrEach, choiceBlock, payOf, paymentOf, saysOwn, sentenceOf, setsApart, sharedBy, spreadOf, } from './choices.js';
|
|
4
5
|
import { usedOnWords } from './coupon-words.js';
|
|
@@ -6,9 +7,9 @@ import { MAX_GUESTS, addDays, dateOptions, dayWords, isDay, nights as nightsBetw
|
|
|
6
7
|
import { FACILITIES } from './facilities.js';
|
|
7
8
|
import { DESCRIPTION_MAX, POLICY_MAX, hotelName, hotelText } from './fence.js';
|
|
8
9
|
import { clockOf, minutesOf, startProblem, stayWords, windowWords } from './hourly.js';
|
|
9
|
-
import { amountsIn, formatMoney, keepingAmounts, money, multiplyMoney, toMinor } from './money.js';
|
|
10
|
+
import { amountsIn, formatMoney, inFullCurrency, keepingAmounts, money, multiplyMoney, toMinor, } from './money.js';
|
|
10
11
|
import { namedExactly, roomNamesOf, roomTypeNamed, withTraditional } from './names.js';
|
|
11
|
-
import { cardAnswer, hotelListAnswer, prepareRefusal, preparedAnswer, } from './otaless/addons-answers.js';
|
|
12
|
+
import { cardAnswer, hotelListAnswer, prepareRefusal, preparedAnswer, statusAnswer, } from './otaless/addons-answers.js';
|
|
12
13
|
import { buyAnswer, finishAnswer, itemAnswer, listAnswer, ordersPart, previewAnswer, shopSignInAnswer, } from './otaless/shop-answers.js';
|
|
13
14
|
import { looksLikeShopOrder, unitCentsOf } from './otaless/shop-service.js';
|
|
14
15
|
import { overlapsOf } from './overlap.js';
|
|
@@ -1321,7 +1322,7 @@ const allTools = (n, v) => {
|
|
|
1321
1322
|
? [
|
|
1322
1323
|
{
|
|
1323
1324
|
name: n.listShopItems,
|
|
1324
|
-
description: "The
|
|
1325
|
+
description: "The value-added services (增值服务): goods in Otaless's shop to buy for a stay, not rooms - each with its id, name, price and currency, whether it is available and its options. With `item` it opens one item. It only reads the shop; nothing is ordered.",
|
|
1325
1326
|
annotations: reads('Shop items', open),
|
|
1326
1327
|
inputSchema: {
|
|
1327
1328
|
type: 'object',
|
|
@@ -1346,7 +1347,7 @@ const allTools = (n, v) => {
|
|
|
1346
1347
|
? [
|
|
1347
1348
|
{
|
|
1348
1349
|
name: n.buyShopItem,
|
|
1349
|
-
description: "Prepares buying one shop item to go with the guest's own hotel booking. It does NOT order or charge anything: the answer gives a one-time page address for the guest to open in the browser signed in to their account, where they see the item, the quantity and the total and press confirm themselves - and when they do, the backend charges a card linked to their account, or gives a payment link if there is none. Pass that link on; never say the item was ordered or paid until the guest confirmed and the shop says so. It checks the price against the one the guest was shown and refuses a booking that is not theirs or is over.",
|
|
1350
|
+
description: "Prepares buying one value-added service (增值服务: a shop item) to go with the guest's own hotel booking. It does NOT order or charge anything: the answer gives a one-time page address for the guest to open in the browser signed in to their account, where they see the item, the quantity and the total and press confirm themselves - and when they do, the backend charges a card linked to their account, or gives a payment link if there is none. Pass that link on; never say the item was ordered or paid until the guest confirmed and the shop says so. It checks the price against the one the guest was shown and refuses a booking that is not theirs or is over.",
|
|
1350
1351
|
annotations: books('Prepare a shop purchase', open),
|
|
1351
1352
|
inputSchema: {
|
|
1352
1353
|
type: 'object',
|
|
@@ -1388,12 +1389,15 @@ const allTools = (n, v) => {
|
|
|
1388
1389
|
? [
|
|
1389
1390
|
{
|
|
1390
1391
|
name: n.cardAddons,
|
|
1391
|
-
description: `The card's own
|
|
1392
|
+
description: `The card's own steps for the value-added services (增值服务) of a booking made here: \`view\` reads what can be added (the shop's goods, and the hotel's own services where they are offered) fresh; \`buy_shop_item\` (and \`book_hotel_addon\`, where hotel services are offered) is the guest's press on a confirm screen that showed the item, the quantity and the total - each answers with \`addonResult\` and a fresh \`addonsView\`; \`shop_status\` reads whether a shop \`order\` the guest is paying for is paid yet (a read, nothing changes). Never the assistant's: nothing here is called without the guest's press.`,
|
|
1392
1393
|
annotations: orders('Add to a booking', open),
|
|
1393
1394
|
inputSchema: {
|
|
1394
1395
|
type: 'object',
|
|
1395
1396
|
properties: {
|
|
1396
|
-
action: {
|
|
1397
|
+
action: {
|
|
1398
|
+
type: 'string',
|
|
1399
|
+
enum: ['view', 'book_hotel_addon', 'buy_shop_item', 'shop_status'],
|
|
1400
|
+
},
|
|
1397
1401
|
booking: {
|
|
1398
1402
|
type: 'string',
|
|
1399
1403
|
description: "The confirmation code of the guest's own booking",
|
|
@@ -1411,6 +1415,10 @@ const allTools = (n, v) => {
|
|
|
1411
1415
|
},
|
|
1412
1416
|
currency: { type: 'string', description: 'The currency the screen showed' },
|
|
1413
1417
|
item: { type: 'string', description: 'buy_shop_item: the shop item id' },
|
|
1418
|
+
order: {
|
|
1419
|
+
type: 'string',
|
|
1420
|
+
description: 'shop_status: the shop order id buy_shop_item answered with',
|
|
1421
|
+
},
|
|
1414
1422
|
option: { type: 'string', description: 'buy_shop_item: the option, as listed' },
|
|
1415
1423
|
shownUnit: {
|
|
1416
1424
|
type: 'string',
|
|
@@ -4243,6 +4251,36 @@ const notPaidWords = (b) => !b.paymentNotConnected
|
|
|
4243
4251
|
: b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed'
|
|
4244
4252
|
? 'Nothing was paid or charged for this booking.'
|
|
4245
4253
|
: '**It is not paid: nothing has been charged** - payment is not connected here yet. Say exactly that; never that it is paid at the hotel.';
|
|
4254
|
+
/**
|
|
4255
|
+
* ⚠️ VALUE-ADDED SERVICES (增值服务), SAID WHERE A BOOKING IS DONE (0.84.0, robin 11-24: 「应该在订单完成的
|
|
4256
|
+
* 时候就可以购买,而不是要去我的预订买」). Only where the deployment sells them (`/claude`: the shop with
|
|
4257
|
+
* buying open), only for a booking of this account that can still take them, and - where the booking
|
|
4258
|
+
* was just made - only once it is confirmed (a booking waiting for its payment is paid first). The next
|
|
4259
|
+
* step in words, tool names and what each takes, so a client that draws no card can go on; a card
|
|
4260
|
+
* client is told the card shows them under the booking. ⚠️ NOTHING IS BOUGHT BY THE ASSISTANT: the buy
|
|
4261
|
+
* tool prepares a page the guest confirms on.
|
|
4262
|
+
*/
|
|
4263
|
+
const valueAddedLine = (deps, t, ctx, list, confirmedOnly) => {
|
|
4264
|
+
const api = deps.backend.otalessAddons;
|
|
4265
|
+
if (!api?.buyOpen || !t.listShopItems || !t.buyShopItem)
|
|
4266
|
+
return '';
|
|
4267
|
+
const codes = list
|
|
4268
|
+
.filter((b) => b.confirmationCode && api.canAdd(b))
|
|
4269
|
+
.filter((b) => !confirmedOnly || b.status === 'confirmed')
|
|
4270
|
+
.map((b) => b.confirmationCode);
|
|
4271
|
+
if (!codes.length)
|
|
4272
|
+
return '';
|
|
4273
|
+
const one = codes[0];
|
|
4274
|
+
return [
|
|
4275
|
+
`Value-added services (增值服务: goods from the Otaless shop to go with a stay) can be bought now for ${codes.join(', ')} - tell the guest.`,
|
|
4276
|
+
ctx.noCards
|
|
4277
|
+
? ''
|
|
4278
|
+
: 'Where the booking is drawn for the guest they are shown under it, each with its picture, price and a Buy button to press.',
|
|
4279
|
+
`${t.listShopItems} lists them (each item's id, price and currency); then ${t.buyShopItem} with \`item\` (the item id), \`quantity\`, \`booking\` ("${one}"), \`unitPrice\` and \`currency\` as listed prepares a one-time page where the guest confirms the purchase - nothing is bought by the assistant.`,
|
|
4280
|
+
]
|
|
4281
|
+
.filter(Boolean)
|
|
4282
|
+
.join(' ');
|
|
4283
|
+
};
|
|
4246
4284
|
/** A booking for the card and the model's structure, with `notSentStatus` where there is one. */
|
|
4247
4285
|
const listedForCard = (deps, b) => {
|
|
4248
4286
|
const said = notSentStatus(deps, b) ?? unconfirmedSaid(deps, b);
|
|
@@ -4260,6 +4298,10 @@ const listedForCard = (deps, b) => {
|
|
|
4260
4298
|
...(b.termsChanged || b.confirmAsked ? { termsHeldSaid: termsHeldWords(deps, b) } : {}),
|
|
4261
4299
|
// …and past its time: for the card, which has no clock of the deployment's (0.67.0).
|
|
4262
4300
|
...(termsOverdue(deps, b) ? { termsOverdue: true } : {}),
|
|
4301
|
+
// 0.84.0: a booking of this account that can still take value-added services, wherever it is
|
|
4302
|
+
// drawn - the booking just made and paid too, not only My bookings (robin 11-24). Only where the
|
|
4303
|
+
// deployment has them (`otalessAddons`); everywhere else nothing changes.
|
|
4304
|
+
...(deps.backend.otalessAddons?.canAdd(b) ? { addons: true } : {}),
|
|
4263
4305
|
};
|
|
4264
4306
|
};
|
|
4265
4307
|
/**
|
|
@@ -4451,6 +4493,12 @@ const TERMS_TEXT_MAX = 2_000;
|
|
|
4451
4493
|
* the same (`termsSaid`) - the model reads the structure. Neither carries the
|
|
4452
4494
|
* terms' `ref` or their text: see `TERMS_META_KEY`.
|
|
4453
4495
|
*/
|
|
4496
|
+
/**
|
|
4497
|
+
* Whether a link to our pages is handed out with the words of a Lax account cookie (0.84.0): a client
|
|
4498
|
+
* that said it draws no card, on a deployment with `account.cookieSameSite: "Lax"` - see
|
|
4499
|
+
* `ToolDeps.accountCookieLax`. A card host's words, and every word of the root deployment, as before.
|
|
4500
|
+
*/
|
|
4501
|
+
const inBrowserWords = (deps, ctx) => deps.accountCookieLax === true && ctx.noCards === true;
|
|
4454
4502
|
const termsAnswer = (deps, ctx, key, terms) => {
|
|
4455
4503
|
const t = deps.tools;
|
|
4456
4504
|
// A client that draws no card, or that never said it does, is given the page.
|
|
@@ -4468,7 +4516,9 @@ const termsAnswer = (deps, ctx, key, terms) => {
|
|
|
4468
4516
|
const before = terms.filter((x) => !x.changed && !x.askedByGroup);
|
|
4469
4517
|
const changed = terms.filter((x) => x.changed);
|
|
4470
4518
|
const where = onPage
|
|
4471
|
-
?
|
|
4519
|
+
? inBrowserWords(deps, ctx)
|
|
4520
|
+
? 'on the one-time page linked below, in their own browser, signed in to their account there'
|
|
4521
|
+
: "on the one-time page linked below, which opens only in the browser signed in to the guest's account"
|
|
4472
4522
|
: `on the card, with its ${terms.every((x) => x.askedByGroup === 'confirm') ? 'Confirm' : 'Agree'} button`;
|
|
4473
4523
|
// ⚠️ EVERY BOOKING STARTS WITH ITS TERMS (Otaless 0.66.0, 8 booking/create, docs/
|
|
4474
4524
|
// otaless-hotels.md §15): nothing is ordered before the guest agrees - but terms the
|
|
@@ -4558,7 +4608,9 @@ const termsAnswer = (deps, ctx, key, terms) => {
|
|
|
4558
4608
|
: `They can be agreed to until ${until}.`,
|
|
4559
4609
|
onPage
|
|
4560
4610
|
? link
|
|
4561
|
-
?
|
|
4611
|
+
? inBrowserWords(deps, ctx)
|
|
4612
|
+
? `Give the guest this one-time link to read the terms and agree on ${deps.vocab.brand}'s page - it works once, until ${clockWords(link.expiresAt) ?? link.expiresAt}: ${link.url}. ${OPENS_SIGNED_IN} ${GUEST_ALONE} When they say they are done, call ${t.listBookings} to see the booking and its payment page.`
|
|
4613
|
+
: `Give the guest this one-time link to read the terms and agree on ${deps.vocab.brand}'s page - it opens only in the browser signed in to their ${deps.vocab.brand} account, works once, until ${clockWords(link.expiresAt) ?? link.expiresAt}: ${link.url}. When they say they are done, call ${t.listBookings} to see the booking and its payment page.`
|
|
4562
4614
|
: x.changed
|
|
4563
4615
|
? 'These terms can only be agreed to on a client that shows the card.'
|
|
4564
4616
|
: heldOrder
|
|
@@ -5840,6 +5892,45 @@ export const tripGone = (deps) => {
|
|
|
5840
5892
|
text: detail,
|
|
5841
5893
|
};
|
|
5842
5894
|
};
|
|
5895
|
+
/**
|
|
5896
|
+
* ⚠️ A CARD DRAWN BEFORE THE SIGN-IN, PRESSED AFTER IT (0.84.0; walkthrough 11-24 #5). Since a sign-in
|
|
5897
|
+
* the conversation's trip goes by a new id, handed only to the card that started the sign-in (0.75.1,
|
|
5898
|
+
* P1-a - `renewedAway` in server.ts): any other card from before it can no longer act on the trip. That
|
|
5899
|
+
* is by design and STAYS - this only says what happened, instead of `tripGone`'s "updated, or quiet for
|
|
5900
|
+
* a long time", which was not true a few minutes after a sign-in. Still `trip-gone` (a card holding the
|
|
5901
|
+
* sign-in's claim asks again with it, as before), with `renewed: true` for the card's own words.
|
|
5902
|
+
*/
|
|
5903
|
+
export const tripRenewed = (deps, o = {
|
|
5904
|
+
pressed: 'other',
|
|
5905
|
+
signedIn: false,
|
|
5906
|
+
}) => {
|
|
5907
|
+
const t = deps.tools;
|
|
5908
|
+
const again = t.listHotels
|
|
5909
|
+
? `, or draw the hotels again (${t.listHotels}) and carry on from there`
|
|
5910
|
+
: '';
|
|
5911
|
+
const older = "Since the sign-in the conversation's trip continues on the newer card, so this older card cannot act on it any more - nothing was lost, booked or changed by the press.";
|
|
5912
|
+
// ⚠️ "ALREADY SIGNED IN" ONLY WHEN IT IS SO (总线程 11-24 for robin: the old card's Sign in said the
|
|
5913
|
+
// trip could not be found). Whether the conversation is signed in now, and nothing of whose it is.
|
|
5914
|
+
const detail = o.pressed === 'sign-in' && o.signedIn
|
|
5915
|
+
? `The guest is already signed in - on another card or page, after this card was drawn - so there is nothing to sign in to here. ${older} Tell the guest they are signed in, and to use the newest card${again}.`
|
|
5916
|
+
: o.pressed === 'book'
|
|
5917
|
+
? `This card was drawn before the guest signed in. ${older} Nothing was booked. To go on booking, draw the trip or the hotels again on a new card${[t.viewTrip, t.listHotels].filter(Boolean).length
|
|
5918
|
+
? ` (${[t.viewTrip, t.listHotels].filter(Boolean).join(', ')})`
|
|
5919
|
+
: ''}.`
|
|
5920
|
+
: `This card was drawn before the guest signed in. ${older} Tell the guest to use the newest card${again}.`;
|
|
5921
|
+
return {
|
|
5922
|
+
structured: {
|
|
5923
|
+
view: 'error',
|
|
5924
|
+
...common(deps),
|
|
5925
|
+
error: 'trip-gone',
|
|
5926
|
+
renewed: true,
|
|
5927
|
+
renewedFor: o.pressed,
|
|
5928
|
+
...(o.pressed === 'sign-in' && o.signedIn ? { renewedSignedIn: true } : {}),
|
|
5929
|
+
detail,
|
|
5930
|
+
},
|
|
5931
|
+
text: detail,
|
|
5932
|
+
};
|
|
5933
|
+
};
|
|
5843
5934
|
/**
|
|
5844
5935
|
* The guest's agreement to the terms behind `ref`, and what it came to: the
|
|
5845
5936
|
* booking (with its payment page), the group's terms again, or a refusal's
|
|
@@ -5894,7 +5985,12 @@ export const contextFor = (deps, key) => {
|
|
|
5894
5985
|
export const identityFor = (deps, key) => identity(deps, contextFor(deps, key), key);
|
|
5895
5986
|
/** A booking refusal as its answer (`view: 'error'`, its code), or undefined when `err` is not one. */
|
|
5896
5987
|
export const bookingRefusal = refusalAnswer;
|
|
5897
|
-
|
|
5988
|
+
/**
|
|
5989
|
+
* A tool's answer - every amount in it written with its whole currency where the deployment says so
|
|
5990
|
+
* (`fullCurrency`, 0.84.0), else exactly as before.
|
|
5991
|
+
*/
|
|
5992
|
+
export const handleTool = (deps, name, rawArgs, ctx) => inFullCurrency(deps.fullCurrency, () => answerWithAmounts(deps, name, rawArgs, ctx));
|
|
5993
|
+
const answerWithAmounts = async (deps, name, rawArgs, ctx) => {
|
|
5898
5994
|
const { result, written } = await keepingAmounts(async () => {
|
|
5899
5995
|
// ⚠️ A GROUP THAT DID NOT ANSWER A READ IS AN ANSWER, NOT A FAULT (2026-11-03
|
|
5900
5996
|
// review, C5/C8): the hotel page, the add-ons, the dates, a booking looked
|
|
@@ -7093,6 +7189,8 @@ const bookingAnswer = async (deps, t, ctx, key, store, args, inTrip, lines, show
|
|
|
7093
7189
|
...asked,
|
|
7094
7190
|
]),
|
|
7095
7191
|
...failedText,
|
|
7192
|
+
// 0.84.0: what can be bought with a booking just made and confirmed (增值服务).
|
|
7193
|
+
valueAddedLine(deps, t, ctx, booked.map(({ booking }) => booking), true),
|
|
7096
7194
|
remembered?.line ?? '',
|
|
7097
7195
|
others ? `The trip's other stays are still in it, not booked:\n${rest?.text ?? ''}` : '',
|
|
7098
7196
|
]
|
|
@@ -8998,7 +9096,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8998
9096
|
api.discard(who, prepared.ref);
|
|
8999
9097
|
return noConfirmPage(base);
|
|
9000
9098
|
}
|
|
9001
|
-
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso);
|
|
9099
|
+
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso, inBrowserWords(deps, ctx));
|
|
9002
9100
|
}
|
|
9003
9101
|
// The card's own add-ons steps (0.82.0, app-only): the guest's press on a confirm screen. ⚠️ NO
|
|
9004
9102
|
// PARAMETER MEANS "CONFIRMED" EXCEPT THE `press` THE CARD MADE FOR THAT SCREEN, with the values it
|
|
@@ -9055,10 +9153,15 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9055
9153
|
press: str(args.press),
|
|
9056
9154
|
}, lang);
|
|
9057
9155
|
}
|
|
9156
|
+
else if (action === 'shop_status') {
|
|
9157
|
+
// ⚠️ A READ (0.84.0): one order's payment state, held to one backend check per order every few
|
|
9158
|
+
// seconds (addons.ts) - and no fresh view, so the card's checks cost the backend one read each.
|
|
9159
|
+
return statusAnswer(base, booking, await api.shopStatus(who, str(args.order), lang));
|
|
9160
|
+
}
|
|
9058
9161
|
else if (action !== 'view') {
|
|
9059
9162
|
return {
|
|
9060
9163
|
structured: { view: 'error', ...base, error: 'bad-input' },
|
|
9061
|
-
text: 'action is view, book_hotel_addon or
|
|
9164
|
+
text: 'action is view, book_hotel_addon, buy_shop_item or shop_status.',
|
|
9062
9165
|
isError: true,
|
|
9063
9166
|
};
|
|
9064
9167
|
}
|
|
@@ -9117,7 +9220,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9117
9220
|
api.discard(who, prepared.ref);
|
|
9118
9221
|
return noConfirmPage(base);
|
|
9119
9222
|
}
|
|
9120
|
-
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso);
|
|
9223
|
+
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso, inBrowserWords(deps, ctx));
|
|
9121
9224
|
}
|
|
9122
9225
|
if (name === t.listBookings) {
|
|
9123
9226
|
const who = identity(deps, ctx, key, args);
|
|
@@ -9183,15 +9286,27 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9183
9286
|
? 'No bookings on this account.'
|
|
9184
9287
|
: 'No bookings in this conversation. A booking made elsewhere is found with its confirmation code and the email it was made with.',
|
|
9185
9288
|
missing.said,
|
|
9289
|
+
// 0.84.0: called value-added services (增值服务), with the next step in words where the shop sells.
|
|
9186
9290
|
addable.length
|
|
9187
|
-
?
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9291
|
+
? (addonsApi?.buyOpen && t.listShopItems && t.buyShopItem
|
|
9292
|
+
? [
|
|
9293
|
+
valueAddedLine(deps, t, ctx, addable, false),
|
|
9294
|
+
deps.backend.capabilities?.addons && t.listBookingAddons
|
|
9295
|
+
? `${t.listBookingAddons} lists the hotel's own services for a booking; the guest confirms each on a page it gives them.`
|
|
9296
|
+
: '',
|
|
9297
|
+
]
|
|
9298
|
+
: [
|
|
9299
|
+
`Value-added services (增值服务) can be added to ${addable.map((b) => b.confirmationCode).join(', ')}: ${[
|
|
9300
|
+
deps.backend.capabilities?.addons && t.listBookingAddons
|
|
9301
|
+
? `${t.listBookingAddons} lists the hotel's own services`
|
|
9302
|
+
: '',
|
|
9303
|
+
shopApi && t.listShopItems ? `${t.listShopItems} lists the shop's goods` : '',
|
|
9304
|
+
]
|
|
9305
|
+
.filter(Boolean)
|
|
9306
|
+
.join('; ')}. The guest confirms each one on a page it gives them - nothing is added by the assistant.`,
|
|
9307
|
+
])
|
|
9193
9308
|
.filter(Boolean)
|
|
9194
|
-
.join('
|
|
9309
|
+
.join(' ')
|
|
9195
9310
|
: '',
|
|
9196
9311
|
shopPart?.text ?? '',
|
|
9197
9312
|
]
|