@curless/hotel-storefront 0.80.3 → 0.81.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/index.d.ts +14 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +427 -43
- package/dist/account/index.js.map +1 -1
- package/dist/account/pages.d.ts +15 -2
- package/dist/account/pages.d.ts.map +1 -1
- package/dist/account/pages.js +13 -10
- package/dist/account/pages.js.map +1 -1
- package/dist/account/wallet-pages.d.ts +84 -0
- package/dist/account/wallet-pages.d.ts.map +1 -0
- package/dist/account/wallet-pages.js +229 -0
- package/dist/account/wallet-pages.js.map +1 -0
- package/dist/account/wallet.d.ts +163 -0
- package/dist/account/wallet.d.ts.map +1 -0
- package/dist/account/wallet.js +365 -0
- package/dist/account/wallet.js.map +1 -0
- package/dist/backend.d.ts +18 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js.map +1 -1
- package/dist/card-v168.generated.d.ts +6 -0
- package/dist/card-v168.generated.d.ts.map +1 -0
- package/dist/card-v168.generated.js +10 -0
- package/dist/card-v168.generated.js.map +1 -0
- 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 +48 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -1
- package/dist/config.js.map +1 -1
- package/dist/legal.d.ts.map +1 -1
- package/dist/legal.js +26 -4
- package/dist/legal.js.map +1 -1
- package/dist/otaless/client.d.ts +109 -0
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +44 -4
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +92 -0
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +265 -0
- package/dist/otaless/fake.js.map +1 -1
- package/dist/otaless/make.d.ts +40 -1
- package/dist/otaless/make.d.ts.map +1 -1
- package/dist/otaless/make.js +150 -2
- package/dist/otaless/make.js.map +1 -1
- package/dist/otaless/shop-answers.d.ts +72 -0
- package/dist/otaless/shop-answers.d.ts.map +1 -0
- package/dist/otaless/shop-answers.js +344 -0
- package/dist/otaless/shop-answers.js.map +1 -0
- package/dist/otaless/shop-client.d.ts +133 -0
- package/dist/otaless/shop-client.d.ts.map +1 -0
- package/dist/otaless/shop-client.js +201 -0
- package/dist/otaless/shop-client.js.map +1 -0
- package/dist/otaless/shop-fake.d.ts +100 -0
- package/dist/otaless/shop-fake.d.ts.map +1 -0
- package/dist/otaless/shop-fake.js +259 -0
- package/dist/otaless/shop-fake.js.map +1 -0
- package/dist/otaless/shop-service.d.ts +105 -0
- package/dist/otaless/shop-service.d.ts.map +1 -0
- package/dist/otaless/shop-service.js +187 -0
- package/dist/otaless/shop-service.js.map +1 -0
- package/dist/otaless/shop.d.ts +160 -0
- package/dist/otaless/shop.d.ts.map +1 -0
- package/dist/otaless/shop.js +715 -0
- package/dist/otaless/shop.js.map +1 -0
- package/dist/otaless/wallet.d.ts +160 -0
- package/dist/otaless/wallet.d.ts.map +1 -0
- package/dist/otaless/wallet.js +650 -0
- package/dist/otaless/wallet.js.map +1 -0
- package/dist/server.d.ts +14 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +41 -12
- package/dist/server.js.map +1 -1
- package/dist/surface.d.ts +7 -0
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +14 -0
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +98 -93
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +239 -1
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.d.ts
CHANGED
|
@@ -1118,6 +1118,90 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
1118
1118
|
};
|
|
1119
1119
|
readonly required: readonly ["booking", "addon"];
|
|
1120
1120
|
};
|
|
1121
|
+
} | {
|
|
1122
|
+
name: string;
|
|
1123
|
+
description: string;
|
|
1124
|
+
annotations: {
|
|
1125
|
+
readonly title: string;
|
|
1126
|
+
readonly readOnlyHint: true;
|
|
1127
|
+
readonly destructiveHint: false;
|
|
1128
|
+
readonly idempotentHint: true;
|
|
1129
|
+
readonly openWorldHint: boolean;
|
|
1130
|
+
};
|
|
1131
|
+
inputSchema: {
|
|
1132
|
+
type: string;
|
|
1133
|
+
properties: {
|
|
1134
|
+
query: {
|
|
1135
|
+
type: string;
|
|
1136
|
+
description: string;
|
|
1137
|
+
};
|
|
1138
|
+
category: {
|
|
1139
|
+
type: string;
|
|
1140
|
+
description: string;
|
|
1141
|
+
};
|
|
1142
|
+
maxPrice: {
|
|
1143
|
+
type: string;
|
|
1144
|
+
minimum: number;
|
|
1145
|
+
description: string;
|
|
1146
|
+
};
|
|
1147
|
+
item: {
|
|
1148
|
+
type: string;
|
|
1149
|
+
description: string;
|
|
1150
|
+
};
|
|
1151
|
+
option?: undefined;
|
|
1152
|
+
quantity?: undefined;
|
|
1153
|
+
booking?: undefined;
|
|
1154
|
+
unitPrice?: undefined;
|
|
1155
|
+
currency?: undefined;
|
|
1156
|
+
};
|
|
1157
|
+
required?: undefined;
|
|
1158
|
+
};
|
|
1159
|
+
} | {
|
|
1160
|
+
name: string;
|
|
1161
|
+
description: string;
|
|
1162
|
+
annotations: {
|
|
1163
|
+
readonly title: string;
|
|
1164
|
+
readonly readOnlyHint: false;
|
|
1165
|
+
readonly destructiveHint: true;
|
|
1166
|
+
readonly idempotentHint: false;
|
|
1167
|
+
readonly openWorldHint: boolean;
|
|
1168
|
+
};
|
|
1169
|
+
inputSchema: {
|
|
1170
|
+
type: string;
|
|
1171
|
+
properties: {
|
|
1172
|
+
item: {
|
|
1173
|
+
type: string;
|
|
1174
|
+
description: string;
|
|
1175
|
+
};
|
|
1176
|
+
option: {
|
|
1177
|
+
type: string;
|
|
1178
|
+
description: string;
|
|
1179
|
+
};
|
|
1180
|
+
quantity: {
|
|
1181
|
+
type: string;
|
|
1182
|
+
minimum: number;
|
|
1183
|
+
maximum: number;
|
|
1184
|
+
description: string;
|
|
1185
|
+
};
|
|
1186
|
+
booking: {
|
|
1187
|
+
type: string;
|
|
1188
|
+
description: string;
|
|
1189
|
+
};
|
|
1190
|
+
unitPrice: {
|
|
1191
|
+
type: string;
|
|
1192
|
+
exclusiveMinimum: number;
|
|
1193
|
+
description: string;
|
|
1194
|
+
};
|
|
1195
|
+
currency: {
|
|
1196
|
+
type: string;
|
|
1197
|
+
description: string;
|
|
1198
|
+
};
|
|
1199
|
+
query?: undefined;
|
|
1200
|
+
category?: undefined;
|
|
1201
|
+
maxPrice?: undefined;
|
|
1202
|
+
};
|
|
1203
|
+
required: string[];
|
|
1204
|
+
};
|
|
1121
1205
|
})[];
|
|
1122
1206
|
/**
|
|
1123
1207
|
* The most hotels a list priced for tonight by default holds on one page
|
|
@@ -1189,6 +1273,11 @@ export declare const outputSchemasFor: (schemas: Record<string, unknown>, caps:
|
|
|
1189
1273
|
homeImage?: boolean;
|
|
1190
1274
|
brandNames?: boolean;
|
|
1191
1275
|
}) => Record<string, unknown>;
|
|
1276
|
+
/**
|
|
1277
|
+
* ⚠️ ONLY WHERE THE SHOP'S NAMES EXIST (`data.otaless.shop`): its two tools' schemas, and the
|
|
1278
|
+
* shop views a bookings list and a cancellation may also answer with. Everywhere else the schemas
|
|
1279
|
+
* are the ones above, untouched.
|
|
1280
|
+
*/
|
|
1192
1281
|
export declare const buildOutputSchemas: (n: ToolNames) => Record<string, unknown>;
|
|
1193
1282
|
/** The languages the card draws its own words in. */
|
|
1194
1283
|
export type Lang = 'zh' | 'en';
|
|
@@ -1420,37 +1509,9 @@ export declare const commonFields: (deps: ToolDeps, key?: string) => {
|
|
|
1420
1509
|
phoneAsked?: boolean | undefined;
|
|
1421
1510
|
phoneRequired?: boolean | undefined;
|
|
1422
1511
|
toolNames: {
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
readonly listExtras: `list_${string}extras`;
|
|
1427
|
-
readonly addToTrip: `add_to_${string}trip`;
|
|
1428
|
-
readonly viewTrip: `view_${string}trip`;
|
|
1429
|
-
readonly clearTrip: `clear_${string}trip`;
|
|
1430
|
-
readonly requestBooking: `request_${string}booking`;
|
|
1431
|
-
readonly listBookings: `list_my_${string}bookings`;
|
|
1432
|
-
readonly previewCancellation: `preview_${string}cancellation`;
|
|
1433
|
-
readonly cancelBooking: `cancel_${string}booking`;
|
|
1434
|
-
readonly previewChange: `preview_${string}booking_change`;
|
|
1435
|
-
readonly changeBooking: `change_${string}booking`;
|
|
1436
|
-
readonly policies: `get_${string}${string}_policies`;
|
|
1437
|
-
readonly compare: `compare_${string}${string}`;
|
|
1438
|
-
readonly itinerary: `show_${string}itinerary`;
|
|
1439
|
-
readonly signIn: `sign_in_${string}member`;
|
|
1440
|
-
readonly signOut: `sign_out_${string}member`;
|
|
1441
|
-
readonly memberCard: `card_${string}member`;
|
|
1442
|
-
readonly forgetPreferences: `forget_${string}preferences`;
|
|
1443
|
-
readonly payWithUnionPay: `pay_${string}booking_with_unionpay`;
|
|
1444
|
-
readonly pickRoom: `pick_${string}room`;
|
|
1445
|
-
readonly bookPicked: `book_picked_${string}room`;
|
|
1446
|
-
readonly acceptTerms: `card_${string}terms`;
|
|
1447
|
-
readonly refundBooking: `refund_${string}booking`;
|
|
1448
|
-
readonly listBookingAddons: `list_${string}booking_addons`;
|
|
1449
|
-
readonly addBookingAddon: `add_${string}booking_addon`;
|
|
1450
|
-
} | {
|
|
1451
|
-
[k: string]: `list_${string}${string}` | `get_${string}${string}` | `look_up_${string}${string}` | `list_${string}extras` | `add_to_${string}trip` | `view_${string}trip` | `clear_${string}trip` | `request_${string}booking` | `list_my_${string}bookings` | `preview_${string}cancellation` | `cancel_${string}booking` | `preview_${string}booking_change` | `change_${string}booking` | `get_${string}${string}_policies` | `compare_${string}${string}` | `show_${string}itinerary` | `sign_in_${string}member` | `sign_out_${string}member` | `card_${string}member` | `forget_${string}preferences` | `pay_${string}booking_with_unionpay` | `pick_${string}room` | `book_picked_${string}room` | `card_${string}terms` | `refund_${string}booking` | `list_${string}booking_addons` | `add_${string}booking_addon`;
|
|
1452
|
-
};
|
|
1453
|
-
bookingMode: "pay-at-hotel" | "hold";
|
|
1512
|
+
[k: string]: string;
|
|
1513
|
+
} | ToolNames;
|
|
1514
|
+
bookingMode: "hold" | "pay-at-hotel";
|
|
1454
1515
|
showName?: boolean | undefined;
|
|
1455
1516
|
fonts?: BrandFonts | undefined;
|
|
1456
1517
|
primary?: {
|
|
@@ -1533,37 +1594,9 @@ export declare const commonFields: (deps: ToolDeps, key?: string) => {
|
|
|
1533
1594
|
phoneAsked?: boolean | undefined;
|
|
1534
1595
|
phoneRequired?: boolean | undefined;
|
|
1535
1596
|
toolNames: {
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
readonly listExtras: `list_${string}extras`;
|
|
1540
|
-
readonly addToTrip: `add_to_${string}trip`;
|
|
1541
|
-
readonly viewTrip: `view_${string}trip`;
|
|
1542
|
-
readonly clearTrip: `clear_${string}trip`;
|
|
1543
|
-
readonly requestBooking: `request_${string}booking`;
|
|
1544
|
-
readonly listBookings: `list_my_${string}bookings`;
|
|
1545
|
-
readonly previewCancellation: `preview_${string}cancellation`;
|
|
1546
|
-
readonly cancelBooking: `cancel_${string}booking`;
|
|
1547
|
-
readonly previewChange: `preview_${string}booking_change`;
|
|
1548
|
-
readonly changeBooking: `change_${string}booking`;
|
|
1549
|
-
readonly policies: `get_${string}${string}_policies`;
|
|
1550
|
-
readonly compare: `compare_${string}${string}`;
|
|
1551
|
-
readonly itinerary: `show_${string}itinerary`;
|
|
1552
|
-
readonly signIn: `sign_in_${string}member`;
|
|
1553
|
-
readonly signOut: `sign_out_${string}member`;
|
|
1554
|
-
readonly memberCard: `card_${string}member`;
|
|
1555
|
-
readonly forgetPreferences: `forget_${string}preferences`;
|
|
1556
|
-
readonly payWithUnionPay: `pay_${string}booking_with_unionpay`;
|
|
1557
|
-
readonly pickRoom: `pick_${string}room`;
|
|
1558
|
-
readonly bookPicked: `book_picked_${string}room`;
|
|
1559
|
-
readonly acceptTerms: `card_${string}terms`;
|
|
1560
|
-
readonly refundBooking: `refund_${string}booking`;
|
|
1561
|
-
readonly listBookingAddons: `list_${string}booking_addons`;
|
|
1562
|
-
readonly addBookingAddon: `add_${string}booking_addon`;
|
|
1563
|
-
} | {
|
|
1564
|
-
[k: string]: `list_${string}${string}` | `get_${string}${string}` | `look_up_${string}${string}` | `list_${string}extras` | `add_to_${string}trip` | `view_${string}trip` | `clear_${string}trip` | `request_${string}booking` | `list_my_${string}bookings` | `preview_${string}cancellation` | `cancel_${string}booking` | `preview_${string}booking_change` | `change_${string}booking` | `get_${string}${string}_policies` | `compare_${string}${string}` | `show_${string}itinerary` | `sign_in_${string}member` | `sign_out_${string}member` | `card_${string}member` | `forget_${string}preferences` | `pay_${string}booking_with_unionpay` | `pick_${string}room` | `book_picked_${string}room` | `card_${string}terms` | `refund_${string}booking` | `list_${string}booking_addons` | `add_${string}booking_addon`;
|
|
1565
|
-
};
|
|
1566
|
-
bookingMode: "pay-at-hotel" | "hold";
|
|
1597
|
+
[k: string]: string;
|
|
1598
|
+
} | ToolNames;
|
|
1599
|
+
bookingMode: "hold" | "pay-at-hotel";
|
|
1567
1600
|
showName?: boolean | undefined;
|
|
1568
1601
|
fonts?: BrandFonts | undefined;
|
|
1569
1602
|
primary?: {
|
|
@@ -1604,37 +1637,9 @@ export declare const commonFields: (deps: ToolDeps, key?: string) => {
|
|
|
1604
1637
|
phoneAsked?: boolean | undefined;
|
|
1605
1638
|
phoneRequired?: boolean | undefined;
|
|
1606
1639
|
toolNames: {
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
readonly listExtras: `list_${string}extras`;
|
|
1611
|
-
readonly addToTrip: `add_to_${string}trip`;
|
|
1612
|
-
readonly viewTrip: `view_${string}trip`;
|
|
1613
|
-
readonly clearTrip: `clear_${string}trip`;
|
|
1614
|
-
readonly requestBooking: `request_${string}booking`;
|
|
1615
|
-
readonly listBookings: `list_my_${string}bookings`;
|
|
1616
|
-
readonly previewCancellation: `preview_${string}cancellation`;
|
|
1617
|
-
readonly cancelBooking: `cancel_${string}booking`;
|
|
1618
|
-
readonly previewChange: `preview_${string}booking_change`;
|
|
1619
|
-
readonly changeBooking: `change_${string}booking`;
|
|
1620
|
-
readonly policies: `get_${string}${string}_policies`;
|
|
1621
|
-
readonly compare: `compare_${string}${string}`;
|
|
1622
|
-
readonly itinerary: `show_${string}itinerary`;
|
|
1623
|
-
readonly signIn: `sign_in_${string}member`;
|
|
1624
|
-
readonly signOut: `sign_out_${string}member`;
|
|
1625
|
-
readonly memberCard: `card_${string}member`;
|
|
1626
|
-
readonly forgetPreferences: `forget_${string}preferences`;
|
|
1627
|
-
readonly payWithUnionPay: `pay_${string}booking_with_unionpay`;
|
|
1628
|
-
readonly pickRoom: `pick_${string}room`;
|
|
1629
|
-
readonly bookPicked: `book_picked_${string}room`;
|
|
1630
|
-
readonly acceptTerms: `card_${string}terms`;
|
|
1631
|
-
readonly refundBooking: `refund_${string}booking`;
|
|
1632
|
-
readonly listBookingAddons: `list_${string}booking_addons`;
|
|
1633
|
-
readonly addBookingAddon: `add_${string}booking_addon`;
|
|
1634
|
-
} | {
|
|
1635
|
-
[k: string]: `list_${string}${string}` | `get_${string}${string}` | `look_up_${string}${string}` | `list_${string}extras` | `add_to_${string}trip` | `view_${string}trip` | `clear_${string}trip` | `request_${string}booking` | `list_my_${string}bookings` | `preview_${string}cancellation` | `cancel_${string}booking` | `preview_${string}booking_change` | `change_${string}booking` | `get_${string}${string}_policies` | `compare_${string}${string}` | `show_${string}itinerary` | `sign_in_${string}member` | `sign_out_${string}member` | `card_${string}member` | `forget_${string}preferences` | `pay_${string}booking_with_unionpay` | `pick_${string}room` | `book_picked_${string}room` | `card_${string}terms` | `refund_${string}booking` | `list_${string}booking_addons` | `add_${string}booking_addon`;
|
|
1636
|
-
};
|
|
1637
|
-
bookingMode: "pay-at-hotel" | "hold";
|
|
1640
|
+
[k: string]: string;
|
|
1641
|
+
} | ToolNames;
|
|
1642
|
+
bookingMode: "hold" | "pay-at-hotel";
|
|
1638
1643
|
showName?: boolean | undefined;
|
|
1639
1644
|
fonts?: BrandFonts | undefined;
|
|
1640
1645
|
primary?: {
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,KAAK,mBAAmB,EAczB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAa,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAa1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiB7C,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":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,KAAK,mBAAmB,EAczB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAa,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAa1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiB7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA+ChD,OAAO,EAGL,KAAK,SAAS,EAMf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAEV,cAAc,EAiBd,QAAQ,EAER,KAAK,EACL,KAAK,EAKL,eAAe,EAOhB,MAAM,YAAY,C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mB,IAAI,CAAC;AAMrC,eAAO,MAAM,cAAc,gxBAA8xB,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -8,6 +8,8 @@ import { DESCRIPTION_MAX, POLICY_MAX, hotelName, hotelText } from './fence.js';
|
|
|
8
8
|
import { clockOf, minutesOf, startProblem, stayWords, windowWords } from './hourly.js';
|
|
9
9
|
import { amountsIn, formatMoney, keepingAmounts, money, multiplyMoney, toMinor } from './money.js';
|
|
10
10
|
import { namedExactly, roomNamesOf, roomTypeNamed, withTraditional } from './names.js';
|
|
11
|
+
import { buyAnswer, finishAnswer, itemAnswer, listAnswer, ordersPart, previewAnswer, shopSignInAnswer, } from './otaless/shop-answers.js';
|
|
12
|
+
import { looksLikeShopOrder, unitCentsOf } from './otaless/shop-service.js';
|
|
11
13
|
import { overlapsOf } from './overlap.js';
|
|
12
14
|
import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, candidatesFor, compareHotels, namesMoreThanOne, nightlyIncludesTaxes, } from './present.js';
|
|
13
15
|
import { withReference } from './reference.js';
|
|
@@ -189,6 +191,10 @@ export const withheldTools = (n, caps) => new Set([
|
|
|
189
191
|
// now says that), so a guest - or a model - never has two ways out of one booking.
|
|
190
192
|
n.refundBooking,
|
|
191
193
|
...(caps.addons && !caps.readOnly ? [] : [n.listBookingAddons, n.addBookingAddon]),
|
|
194
|
+
// The add-on shop (`capabilities.shop`, docs §17.6): its listing where the deployment has it, and
|
|
195
|
+
// its buy tool only where buying is open too. The names exist only with `data.otaless.shop`.
|
|
196
|
+
...(n.listShopItems && !(caps.shop && !caps.readOnly) ? [n.listShopItems] : []),
|
|
197
|
+
...(n.buyShopItem && !(caps.shop && caps.shopBuy && !caps.readOnly) ? [n.buyShopItem] : []),
|
|
192
198
|
// Nothing can be booked here yet (`readOnly`, Otaless 2026-11-03): no tool
|
|
193
199
|
// that books, finds, changes or cancels a booking - the card's own two
|
|
194
200
|
// for Reserve included, so no button that books is drawn.
|
|
@@ -1298,6 +1304,71 @@ const allTools = (n, v) => {
|
|
|
1298
1304
|
required: ['booking', 'addon'],
|
|
1299
1305
|
},
|
|
1300
1306
|
},
|
|
1307
|
+
// The add-on shop (`capabilities.shop`): goods sold beside the rooms. Not instructions - what the tools do.
|
|
1308
|
+
...(n.listShopItems
|
|
1309
|
+
? [
|
|
1310
|
+
{
|
|
1311
|
+
name: n.listShopItems,
|
|
1312
|
+
description: "The add-on goods in Otaless's shop - things 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.",
|
|
1313
|
+
annotations: reads('Shop items', open),
|
|
1314
|
+
inputSchema: {
|
|
1315
|
+
type: 'object',
|
|
1316
|
+
properties: {
|
|
1317
|
+
query: { type: 'string', description: 'Words in the item name' },
|
|
1318
|
+
category: { type: 'string', description: "One of the shop's categories" },
|
|
1319
|
+
maxPrice: {
|
|
1320
|
+
type: 'number',
|
|
1321
|
+
minimum: 0,
|
|
1322
|
+
description: "The highest price, in the shop's currency (US dollars)",
|
|
1323
|
+
},
|
|
1324
|
+
item: {
|
|
1325
|
+
type: 'string',
|
|
1326
|
+
description: 'An item id, as this tool listed it, for that one item in detail',
|
|
1327
|
+
},
|
|
1328
|
+
},
|
|
1329
|
+
},
|
|
1330
|
+
},
|
|
1331
|
+
]
|
|
1332
|
+
: []),
|
|
1333
|
+
...(n.buyShopItem
|
|
1334
|
+
? [
|
|
1335
|
+
{
|
|
1336
|
+
name: n.buyShopItem,
|
|
1337
|
+
description: "Orders one shop item to go with the guest's own hotel booking. It makes the order on the shop's checkout page and answers with that page's address: nothing is charged until the guest pays on that page. It checks the price against the one the guest was shown and refuses a booking that is not theirs or is over.",
|
|
1338
|
+
annotations: orders('Order a shop item', open),
|
|
1339
|
+
inputSchema: {
|
|
1340
|
+
type: 'object',
|
|
1341
|
+
properties: {
|
|
1342
|
+
item: { type: 'string', description: 'The item id, as the shop listing gave it' },
|
|
1343
|
+
option: {
|
|
1344
|
+
type: 'string',
|
|
1345
|
+
description: "One of the item's options, exactly as listed - for an item that has options",
|
|
1346
|
+
},
|
|
1347
|
+
quantity: {
|
|
1348
|
+
type: 'integer',
|
|
1349
|
+
minimum: 1,
|
|
1350
|
+
maximum: 10,
|
|
1351
|
+
description: 'How many, 1 to 10',
|
|
1352
|
+
},
|
|
1353
|
+
booking: {
|
|
1354
|
+
type: 'string',
|
|
1355
|
+
description: "The confirmation code of the guest's own hotel booking this goes with",
|
|
1356
|
+
},
|
|
1357
|
+
unitPrice: {
|
|
1358
|
+
type: 'number',
|
|
1359
|
+
exclusiveMinimum: 0,
|
|
1360
|
+
description: 'The price of one, as the guest was shown it',
|
|
1361
|
+
},
|
|
1362
|
+
currency: {
|
|
1363
|
+
type: 'string',
|
|
1364
|
+
description: 'Its currency code, as the guest was shown it',
|
|
1365
|
+
},
|
|
1366
|
+
},
|
|
1367
|
+
required: ['item', 'quantity', 'booking', 'unitPrice', 'currency'],
|
|
1368
|
+
},
|
|
1369
|
+
},
|
|
1370
|
+
]
|
|
1371
|
+
: []),
|
|
1301
1372
|
];
|
|
1302
1373
|
};
|
|
1303
1374
|
/** A guest's reason for a refund, as the group's staff are sent it (`otaless/booking.ts`). */
|
|
@@ -1657,7 +1728,101 @@ const BOOKING_SCHEMA = {
|
|
|
1657
1728
|
},
|
|
1658
1729
|
required: ['view'],
|
|
1659
1730
|
};
|
|
1660
|
-
|
|
1731
|
+
/**
|
|
1732
|
+
* ⚠️ ONLY WHERE THE SHOP'S NAMES EXIST (`data.otaless.shop`): its two tools' schemas, and the
|
|
1733
|
+
* shop views a bookings list and a cancellation may also answer with. Everywhere else the schemas
|
|
1734
|
+
* are the ones above, untouched.
|
|
1735
|
+
*/
|
|
1736
|
+
export const buildOutputSchemas = (n) => {
|
|
1737
|
+
const base = baseOutputSchemas(n);
|
|
1738
|
+
if (!n.listShopItems)
|
|
1739
|
+
return base;
|
|
1740
|
+
const widen = (name, views, more) => {
|
|
1741
|
+
const s = base[name];
|
|
1742
|
+
if (!s)
|
|
1743
|
+
return;
|
|
1744
|
+
base[name] = {
|
|
1745
|
+
...s,
|
|
1746
|
+
properties: {
|
|
1747
|
+
...s.properties,
|
|
1748
|
+
view: { enum: [...(s.properties.view?.enum ?? []), ...views] },
|
|
1749
|
+
...more,
|
|
1750
|
+
},
|
|
1751
|
+
};
|
|
1752
|
+
};
|
|
1753
|
+
widen(n.listBookings, [], {
|
|
1754
|
+
shopOrders: ARR,
|
|
1755
|
+
shopOrdersUnavailable: BOOL,
|
|
1756
|
+
shopOrdersNeedShopSignIn: BOOL,
|
|
1757
|
+
});
|
|
1758
|
+
const cancelMore = {
|
|
1759
|
+
shopOrder: OBJ,
|
|
1760
|
+
kind: STR,
|
|
1761
|
+
charged: STR,
|
|
1762
|
+
refund: STR,
|
|
1763
|
+
refundMinor: { type: 'number' },
|
|
1764
|
+
shopSaidMinor: { type: 'number' },
|
|
1765
|
+
pointsTakenBack: BOOL,
|
|
1766
|
+
until: STR,
|
|
1767
|
+
toolToConfirm: STR,
|
|
1768
|
+
done: STR,
|
|
1769
|
+
};
|
|
1770
|
+
const cancelViews = ['shop-order-preview', 'shop-order-done', 'shop-order-unknown'];
|
|
1771
|
+
widen(n.previewCancellation, cancelViews, cancelMore);
|
|
1772
|
+
widen(n.cancelBooking, cancelViews, cancelMore);
|
|
1773
|
+
return { ...base, ...shopSchemas(n) };
|
|
1774
|
+
};
|
|
1775
|
+
/** The shop tools' answers. */
|
|
1776
|
+
const shopSchemas = (n) => ({
|
|
1777
|
+
...(n.listShopItems
|
|
1778
|
+
? {
|
|
1779
|
+
[n.listShopItems]: {
|
|
1780
|
+
type: 'object',
|
|
1781
|
+
properties: {
|
|
1782
|
+
view: { enum: ['shop-items', 'shop-item', 'shop-item-not-found', 'error'] },
|
|
1783
|
+
brand: STR,
|
|
1784
|
+
toolNames: OBJ,
|
|
1785
|
+
bookingMode: STR,
|
|
1786
|
+
items: ARR,
|
|
1787
|
+
item: OBJ,
|
|
1788
|
+
count: { type: 'number' },
|
|
1789
|
+
buyOpen: BOOL,
|
|
1790
|
+
query: STR,
|
|
1791
|
+
error: STR,
|
|
1792
|
+
detail: STR,
|
|
1793
|
+
},
|
|
1794
|
+
required: ['view'],
|
|
1795
|
+
},
|
|
1796
|
+
}
|
|
1797
|
+
: {}),
|
|
1798
|
+
...(n.buyShopItem
|
|
1799
|
+
? {
|
|
1800
|
+
[n.buyShopItem]: {
|
|
1801
|
+
type: 'object',
|
|
1802
|
+
properties: {
|
|
1803
|
+
view: { enum: ['shop-buy', 'error'] },
|
|
1804
|
+
brand: STR,
|
|
1805
|
+
toolNames: OBJ,
|
|
1806
|
+
bookingMode: STR,
|
|
1807
|
+
outcome: STR,
|
|
1808
|
+
order: OBJ,
|
|
1809
|
+
checkoutUrl: STR,
|
|
1810
|
+
checkoutHost: STR,
|
|
1811
|
+
now: OBJ,
|
|
1812
|
+
cancelled: BOOL,
|
|
1813
|
+
needsPerson: BOOL,
|
|
1814
|
+
overShown: BOOL,
|
|
1815
|
+
charged: STR,
|
|
1816
|
+
orderId: STR,
|
|
1817
|
+
error: STR,
|
|
1818
|
+
detail: STR,
|
|
1819
|
+
},
|
|
1820
|
+
required: ['view'],
|
|
1821
|
+
},
|
|
1822
|
+
}
|
|
1823
|
+
: {}),
|
|
1824
|
+
});
|
|
1825
|
+
const baseOutputSchemas = (n) => ({
|
|
1661
1826
|
[n.listHotels]: {
|
|
1662
1827
|
type: 'object',
|
|
1663
1828
|
properties: {
|
|
@@ -8673,6 +8838,57 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8673
8838
|
: 'the group has taken the request.'}`,
|
|
8674
8839
|
};
|
|
8675
8840
|
}
|
|
8841
|
+
// The add-on shop (`capabilities.shop`): goods beside the rooms - read here, bought only where buying
|
|
8842
|
+
// is open. Text and structure, no card. Every rule about money is in otaless/shop.ts and
|
|
8843
|
+
// shop-service.ts; this only asks and words the answer.
|
|
8844
|
+
if (t.listShopItems && name === t.listShopItems) {
|
|
8845
|
+
const shop = deps.backend.otalessShop;
|
|
8846
|
+
const base = common(deps, key);
|
|
8847
|
+
if (!shop)
|
|
8848
|
+
return {
|
|
8849
|
+
structured: { view: 'error', ...base, error: 'not-offered' },
|
|
8850
|
+
text: `There is no shop through ${deps.vocab.brand}.`,
|
|
8851
|
+
isError: true,
|
|
8852
|
+
};
|
|
8853
|
+
const lang = deps.lang === 'zh' ? 'zh' : 'en';
|
|
8854
|
+
const item = str(args.item);
|
|
8855
|
+
if (item)
|
|
8856
|
+
return itemAnswer(base, await shop.item(item, lang), item, shop.buyOpen);
|
|
8857
|
+
const query = str(args.query).slice(0, 100);
|
|
8858
|
+
const category = str(args.category).slice(0, 60);
|
|
8859
|
+
const maxPrice = typeof args.maxPrice === 'number' && Number.isFinite(args.maxPrice) && args.maxPrice >= 0
|
|
8860
|
+
? args.maxPrice
|
|
8861
|
+
: undefined;
|
|
8862
|
+
const found = await shop.items({
|
|
8863
|
+
...(query ? { keyword: query } : {}),
|
|
8864
|
+
...(category ? { category } : {}),
|
|
8865
|
+
...(maxPrice !== undefined ? { maxPrice } : {}),
|
|
8866
|
+
lang,
|
|
8867
|
+
});
|
|
8868
|
+
return listAnswer(base, found, { ...(query ? { query } : {}), ...(category ? { category } : {}), maxPrice }, shop.buyOpen);
|
|
8869
|
+
}
|
|
8870
|
+
if (t.buyShopItem && name === t.buyShopItem) {
|
|
8871
|
+
const shop = deps.backend.otalessShop;
|
|
8872
|
+
const base = common(deps, key);
|
|
8873
|
+
const used = { ordersTool: t.listBookings, signIn: deps.groupSignIn?.signInTool };
|
|
8874
|
+
if (!shop?.buyOpen)
|
|
8875
|
+
return buyAnswer(base, { outcome: 'off' }, used);
|
|
8876
|
+
const unitCents = unitCentsOf(args.unitPrice);
|
|
8877
|
+
const currency = str(args.currency).toUpperCase();
|
|
8878
|
+
// ⚠️ THE PRICE THE GUEST WAS SHOWN IS PART OF THE ASK: without it nothing is sent.
|
|
8879
|
+
if (unitCents === undefined || !/^[A-Z]{3}$/.test(currency))
|
|
8880
|
+
return buyAnswer(base, { outcome: 'refused', why: 'shown' }, used);
|
|
8881
|
+
const answer = await shop.buy(identity(deps, ctx, key), {
|
|
8882
|
+
itemId: str(args.item),
|
|
8883
|
+
...(str(args.option) ? { option: str(args.option) } : {}),
|
|
8884
|
+
quantity: typeof args.quantity === 'number' ? args.quantity : 0,
|
|
8885
|
+
booking: str(args.booking),
|
|
8886
|
+
unitCents,
|
|
8887
|
+
currency,
|
|
8888
|
+
lang: deps.lang === 'zh' ? 'zh' : 'en',
|
|
8889
|
+
});
|
|
8890
|
+
return buyAnswer(base, answer, used);
|
|
8891
|
+
}
|
|
8676
8892
|
// What can be added to a booking after it is made, and adding one: text and
|
|
8677
8893
|
// structure, no card. The id is the one the list gave - the backend checks it
|
|
8678
8894
|
// was listed for this very booking a moment ago.
|
|
@@ -8774,12 +8990,19 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8774
8990
|
: code && !str(args.email)
|
|
8775
8991
|
? 'A booking made elsewhere needs the email it was made with as well as its code.'
|
|
8776
8992
|
: 'No booking matches that confirmation code and email. Both are needed, as they are on the confirmation.';
|
|
8993
|
+
// The add-on shop's orders, after the hotel bookings (`capabilities.shop`; nothing without it).
|
|
8994
|
+
// Not with a code asked for: that looks for one hotel booking.
|
|
8995
|
+
const shopApi = deps.backend.otalessShop;
|
|
8996
|
+
const shopPart = shopApi && !code
|
|
8997
|
+
? ordersPart(await shopApi.orders(who, deps.lang === 'zh' ? 'zh' : 'en'))
|
|
8998
|
+
: undefined;
|
|
8777
8999
|
return {
|
|
8778
9000
|
structured: {
|
|
8779
9001
|
view: 'bookings',
|
|
8780
9002
|
...common(deps, key),
|
|
8781
9003
|
bookings: bookings.map((b) => listedForCard(deps, b)),
|
|
8782
9004
|
count: bookings.length,
|
|
9005
|
+
...(shopPart?.structured ?? {}),
|
|
8783
9006
|
// What was looked for, so a card can say THAT did not match rather
|
|
8784
9007
|
// than "nothing in this conversation".
|
|
8785
9008
|
...(missed ? { notFound: code, notFoundLine: missLine } : {}),
|
|
@@ -8799,6 +9022,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8799
9022
|
? 'No bookings on this account.'
|
|
8800
9023
|
: 'No bookings in this conversation. A booking made elsewhere is found with its confirmation code and the email it was made with.',
|
|
8801
9024
|
missing.said,
|
|
9025
|
+
shopPart?.text ?? '',
|
|
8802
9026
|
]
|
|
8803
9027
|
.filter(Boolean)
|
|
8804
9028
|
.join('\n'),
|
|
@@ -9048,6 +9272,20 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9048
9272
|
if (name === t.previewCancellation || name === t.cancelBooking) {
|
|
9049
9273
|
const ref = str(args.booking);
|
|
9050
9274
|
const who = identity(deps, ctx, key, args);
|
|
9275
|
+
// ⚠️ A SHOP ORDER, NOT A HOTEL BOOKING: a UUID-shaped id that THIS account's shop orders hold
|
|
9276
|
+
// (`looksLikeShopOrder` - no hotel order id has that shape - and then `mine`). The same two steps:
|
|
9277
|
+
// what it would do, then the cancel or the refund that was shown - see shop-service.ts.
|
|
9278
|
+
const shopApi = deps.backend.otalessShop;
|
|
9279
|
+
const shopLang = deps.lang === 'zh' ? 'zh' : 'en';
|
|
9280
|
+
const shopMine = shopApi && looksLikeShopOrder(ref) ? await shopApi.mine(who, ref, shopLang) : false;
|
|
9281
|
+
if (shopMine === 'shop-sign-in')
|
|
9282
|
+
return shopSignInAnswer(common(deps, key));
|
|
9283
|
+
if (shopApi && shopMine) {
|
|
9284
|
+
const base = common(deps, key);
|
|
9285
|
+
if (name === t.previewCancellation || args.confirmed !== true)
|
|
9286
|
+
return previewAnswer(base, await shopApi.preview(who, ref.trim(), shopLang), t.cancelBooking, (iso) => clockWords(iso) ?? iso);
|
|
9287
|
+
return finishAnswer(base, await shopApi.finish(who, ref.trim(), shopLang), t.previewCancellation, t.listBookings);
|
|
9288
|
+
}
|
|
9051
9289
|
const { found: preview, tooMany } = await guarded(deps, ctx, who, ref, () => deps.backend.previewCancellation(ref, who));
|
|
9052
9290
|
if (!preview) {
|
|
9053
9291
|
return {
|