@curless/hotel-storefront 0.85.0 → 0.87.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/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tools/accept-terms.d.ts +4 -0
- package/dist/tools/accept-terms.d.ts.map +1 -0
- package/dist/tools/accept-terms.js +26 -0
- package/dist/tools/accept-terms.js.map +1 -0
- package/dist/tools/add-booking-addon.d.ts +4 -0
- package/dist/tools/add-booking-addon.d.ts.map +1 -0
- package/dist/tools/add-booking-addon.js +44 -0
- package/dist/tools/add-booking-addon.js.map +1 -0
- package/dist/tools/add-to-trip.d.ts +4 -0
- package/dist/tools/add-to-trip.d.ts.map +1 -0
- package/dist/tools/add-to-trip.js +49 -0
- package/dist/tools/add-to-trip.js.map +1 -0
- package/dist/tools/all-tools.d.ts +19124 -0
- package/dist/tools/all-tools.d.ts.map +1 -0
- package/dist/tools/all-tools.js +43 -0
- package/dist/tools/all-tools.js.map +1 -0
- package/dist/tools/answer.d.ts +3 -0
- package/dist/tools/answer.d.ts.map +1 -0
- package/dist/tools/answer.js +104 -0
- package/dist/tools/answer.js.map +1 -0
- package/dist/tools/args.d.ts +149 -0
- package/dist/tools/args.d.ts.map +1 -0
- package/dist/tools/args.js +176 -0
- package/dist/tools/args.js.map +1 -0
- package/dist/tools/base-output-schemas.d.ts +3 -0
- package/dist/tools/base-output-schemas.d.ts.map +1 -0
- package/dist/tools/base-output-schemas.js +396 -0
- package/dist/tools/base-output-schemas.js.map +1 -0
- package/dist/tools/book-picked.d.ts +4 -0
- package/dist/tools/book-picked.d.ts.map +1 -0
- package/dist/tools/book-picked.js +14 -0
- package/dist/tools/book-picked.js.map +1 -0
- package/dist/tools/booking-answer.d.ts +24 -0
- package/dist/tools/booking-answer.d.ts.map +1 -0
- package/dist/tools/booking-answer.js +567 -0
- package/dist/tools/booking-answer.js.map +1 -0
- package/dist/tools/buy-shop-item.d.ts +4 -0
- package/dist/tools/buy-shop-item.d.ts.map +1 -0
- package/dist/tools/buy-shop-item.js +45 -0
- package/dist/tools/buy-shop-item.js.map +1 -0
- package/dist/tools/call.d.ts +11 -0
- package/dist/tools/call.d.ts.map +1 -0
- package/dist/tools/call.js +2 -0
- package/dist/tools/call.js.map +1 -0
- package/dist/tools/cancel-facts.d.ts +281 -0
- package/dist/tools/cancel-facts.d.ts.map +1 -0
- package/dist/tools/cancel-facts.js +309 -0
- package/dist/tools/cancel-facts.js.map +1 -0
- package/dist/tools/cancel.d.ts +4 -0
- package/dist/tools/cancel.d.ts.map +1 -0
- package/dist/tools/cancel.js +415 -0
- package/dist/tools/cancel.js.map +1 -0
- package/dist/tools/capability-adjust.d.ts +31 -0
- package/dist/tools/capability-adjust.d.ts.map +1 -0
- package/dist/tools/capability-adjust.js +299 -0
- package/dist/tools/capability-adjust.js.map +1 -0
- package/dist/tools/card-addons.d.ts +4 -0
- package/dist/tools/card-addons.d.ts.map +1 -0
- package/dist/tools/card-addons.js +76 -0
- package/dist/tools/card-addons.js.map +1 -0
- package/dist/tools/change-booking.d.ts +4 -0
- package/dist/tools/change-booking.d.ts.map +1 -0
- package/dist/tools/change-booking.js +145 -0
- package/dist/tools/change-booking.js.map +1 -0
- package/dist/tools/clear-trip.d.ts +4 -0
- package/dist/tools/clear-trip.d.ts.map +1 -0
- package/dist/tools/clear-trip.js +10 -0
- package/dist/tools/clear-trip.js.map +1 -0
- package/dist/tools/compare.d.ts +4 -0
- package/dist/tools/compare.d.ts.map +1 -0
- package/dist/tools/compare.js +114 -0
- package/dist/tools/compare.js.map +1 -0
- package/dist/tools/current-trip.d.ts +70 -0
- package/dist/tools/current-trip.d.ts.map +1 -0
- package/dist/tools/current-trip.js +269 -0
- package/dist/tools/current-trip.js.map +1 -0
- package/dist/tools/deps.d.ts +229 -0
- package/dist/tools/deps.d.ts.map +1 -0
- package/dist/tools/deps.js +2 -0
- package/dist/tools/deps.js.map +1 -0
- package/dist/tools/follow-ups.d.ts +120 -0
- package/dist/tools/follow-ups.d.ts.map +1 -0
- package/dist/tools/follow-ups.js +369 -0
- package/dist/tools/follow-ups.js.map +1 -0
- package/dist/tools/forget-preferences.d.ts +4 -0
- package/dist/tools/forget-preferences.d.ts.map +1 -0
- package/dist/tools/forget-preferences.js +24 -0
- package/dist/tools/forget-preferences.js.map +1 -0
- package/dist/tools/get-hotel.d.ts +4 -0
- package/dist/tools/get-hotel.d.ts.map +1 -0
- package/dist/tools/get-hotel.js +350 -0
- package/dist/tools/get-hotel.js.map +1 -0
- package/dist/tools/hotel-choices.d.ts +132 -0
- package/dist/tools/hotel-choices.d.ts.map +1 -0
- package/dist/tools/hotel-choices.js +587 -0
- package/dist/tools/hotel-choices.js.map +1 -0
- package/dist/tools/itinerary.d.ts +4 -0
- package/dist/tools/itinerary.d.ts.map +1 -0
- package/dist/tools/itinerary.js +158 -0
- package/dist/tools/itinerary.js.map +1 -0
- package/dist/tools/list-booking-addons.d.ts +4 -0
- package/dist/tools/list-booking-addons.d.ts.map +1 -0
- package/dist/tools/list-booking-addons.js +21 -0
- package/dist/tools/list-booking-addons.js.map +1 -0
- package/dist/tools/list-bookings.d.ts +4 -0
- package/dist/tools/list-bookings.d.ts.map +1 -0
- package/dist/tools/list-bookings.js +119 -0
- package/dist/tools/list-bookings.js.map +1 -0
- package/dist/tools/list-extras.d.ts +4 -0
- package/dist/tools/list-extras.d.ts.map +1 -0
- package/dist/tools/list-extras.js +90 -0
- package/dist/tools/list-extras.js.map +1 -0
- package/dist/tools/list-hotels-ask.d.ts +133 -0
- package/dist/tools/list-hotels-ask.d.ts.map +1 -0
- package/dist/tools/list-hotels-ask.js +326 -0
- package/dist/tools/list-hotels-ask.js.map +1 -0
- package/dist/tools/list-hotels-empty.d.ts +5 -0
- package/dist/tools/list-hotels-empty.d.ts.map +1 -0
- package/dist/tools/list-hotels-empty.js +130 -0
- package/dist/tools/list-hotels-empty.js.map +1 -0
- package/dist/tools/list-hotels-home.d.ts +9 -0
- package/dist/tools/list-hotels-home.d.ts.map +1 -0
- package/dist/tools/list-hotels-home.js +181 -0
- package/dist/tools/list-hotels-home.js.map +1 -0
- package/dist/tools/list-hotels-page.d.ts +43 -0
- package/dist/tools/list-hotels-page.d.ts.map +1 -0
- package/dist/tools/list-hotels-page.js +344 -0
- package/dist/tools/list-hotels-page.js.map +1 -0
- package/dist/tools/list-hotels.d.ts +4 -0
- package/dist/tools/list-hotels.d.ts.map +1 -0
- package/dist/tools/list-hotels.js +24 -0
- package/dist/tools/list-hotels.js.map +1 -0
- package/dist/tools/list-shop-items.d.ts +4 -0
- package/dist/tools/list-shop-items.d.ts.map +1 -0
- package/dist/tools/list-shop-items.js +34 -0
- package/dist/tools/list-shop-items.js.map +1 -0
- package/dist/tools/list-shop-orders.d.ts +4 -0
- package/dist/tools/list-shop-orders.d.ts.map +1 -0
- package/dist/tools/list-shop-orders.js +22 -0
- package/dist/tools/list-shop-orders.js.map +1 -0
- package/dist/tools/look-up.d.ts +4 -0
- package/dist/tools/look-up.d.ts.map +1 -0
- package/dist/tools/look-up.js +207 -0
- package/dist/tools/look-up.js.map +1 -0
- package/dist/tools/output-schemas.d.ts +645 -0
- package/dist/tools/output-schemas.d.ts.map +1 -0
- package/dist/tools/output-schemas.js +503 -0
- package/dist/tools/output-schemas.js.map +1 -0
- package/dist/tools/paid-lines.d.ts +718 -0
- package/dist/tools/paid-lines.d.ts.map +1 -0
- package/dist/tools/paid-lines.js +359 -0
- package/dist/tools/paid-lines.js.map +1 -0
- package/dist/tools/pay-with-union-pay.d.ts +4 -0
- package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
- package/dist/tools/pay-with-union-pay.js +112 -0
- package/dist/tools/pay-with-union-pay.js.map +1 -0
- package/dist/tools/payment-words.d.ts +269 -0
- package/dist/tools/payment-words.d.ts.map +1 -0
- package/dist/tools/payment-words.js +365 -0
- package/dist/tools/payment-words.js.map +1 -0
- package/dist/tools/pick-room.d.ts +4 -0
- package/dist/tools/pick-room.d.ts.map +1 -0
- package/dist/tools/pick-room.js +23 -0
- package/dist/tools/pick-room.js.map +1 -0
- package/dist/tools/policies.d.ts +4 -0
- package/dist/tools/policies.d.ts.map +1 -0
- package/dist/tools/policies.js +74 -0
- package/dist/tools/policies.js.map +1 -0
- package/dist/tools/pricing.d.ts +55 -0
- package/dist/tools/pricing.d.ts.map +1 -0
- package/dist/tools/pricing.js +260 -0
- package/dist/tools/pricing.js.map +1 -0
- package/dist/tools/put-room-line.d.ts +12 -0
- package/dist/tools/put-room-line.d.ts.map +1 -0
- package/dist/tools/put-room-line.js +347 -0
- package/dist/tools/put-room-line.js.map +1 -0
- package/dist/tools/quote-card.d.ts +234 -0
- package/dist/tools/quote-card.d.ts.map +1 -0
- package/dist/tools/quote-card.js +375 -0
- package/dist/tools/quote-card.js.map +1 -0
- package/dist/tools/refund-booking.d.ts +4 -0
- package/dist/tools/refund-booking.d.ts.map +1 -0
- package/dist/tools/refund-booking.js +112 -0
- package/dist/tools/refund-booking.js.map +1 -0
- package/dist/tools/request-booking.d.ts +4 -0
- package/dist/tools/request-booking.d.ts.map +1 -0
- package/dist/tools/request-booking.js +5 -0
- package/dist/tools/request-booking.js.map +1 -0
- package/dist/tools/request-words.d.ts +238 -0
- package/dist/tools/request-words.d.ts.map +1 -0
- package/dist/tools/request-words.js +487 -0
- package/dist/tools/request-words.js.map +1 -0
- package/dist/tools/room-choices.d.ts +64 -0
- package/dist/tools/room-choices.d.ts.map +1 -0
- package/dist/tools/room-choices.js +374 -0
- package/dist/tools/room-choices.js.map +1 -0
- package/dist/tools/session-notes.d.ts +164 -0
- package/dist/tools/session-notes.d.ts.map +1 -0
- package/dist/tools/session-notes.js +412 -0
- package/dist/tools/session-notes.js.map +1 -0
- package/dist/tools/sign-in.d.ts +4 -0
- package/dist/tools/sign-in.d.ts.map +1 -0
- package/dist/tools/sign-in.js +72 -0
- package/dist/tools/sign-in.js.map +1 -0
- package/dist/tools/sign-out.d.ts +4 -0
- package/dist/tools/sign-out.d.ts.map +1 -0
- package/dist/tools/sign-out.js +13 -0
- package/dist/tools/sign-out.js.map +1 -0
- package/dist/tools/terms-answer.d.ts +114 -0
- package/dist/tools/terms-answer.d.ts.map +1 -0
- package/dist/tools/terms-answer.js +492 -0
- package/dist/tools/terms-answer.js.map +1 -0
- package/dist/tools/tool-defs-account.d.ts +80 -0
- package/dist/tools/tool-defs-account.d.ts.map +1 -0
- package/dist/tools/tool-defs-account.js +65 -0
- package/dist/tools/tool-defs-account.js.map +1 -0
- package/dist/tools/tool-defs-addons.d.ts +251 -0
- package/dist/tools/tool-defs-addons.d.ts.map +1 -0
- package/dist/tools/tool-defs-addons.js +198 -0
- package/dist/tools/tool-defs-addons.js.map +1 -0
- package/dist/tools/tool-defs-booking.d.ts +410 -0
- package/dist/tools/tool-defs-booking.d.ts.map +1 -0
- package/dist/tools/tool-defs-booking.js +285 -0
- package/dist/tools/tool-defs-booking.js.map +1 -0
- package/dist/tools/tool-defs-browse.d.ts +444 -0
- package/dist/tools/tool-defs-browse.d.ts.map +1 -0
- package/dist/tools/tool-defs-browse.js +307 -0
- package/dist/tools/tool-defs-browse.js.map +1 -0
- package/dist/tools/tool-defs-trip.d.ts +136 -0
- package/dist/tools/tool-defs-trip.d.ts.map +1 -0
- package/dist/tools/tool-defs-trip.js +79 -0
- package/dist/tools/tool-defs-trip.js.map +1 -0
- package/dist/tools/tool-env.d.ts +64 -0
- package/dist/tools/tool-env.d.ts.map +1 -0
- package/dist/tools/tool-env.js +49 -0
- package/dist/tools/tool-env.js.map +1 -0
- package/dist/tools/tool-set.d.ts +1425 -0
- package/dist/tools/tool-set.d.ts.map +1 -0
- package/dist/tools/tool-set.js +244 -0
- package/dist/tools/tool-set.js.map +1 -0
- package/dist/tools/view-trip.d.ts +4 -0
- package/dist/tools/view-trip.d.ts.map +1 -0
- package/dist/tools/view-trip.js +7 -0
- package/dist/tools/view-trip.js.map +1 -0
- package/dist/tools.d.ts +13 -2089
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +11 -10685
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { prepareRefusal, preparedAnswer } from '../otaless/addons-answers.js';
|
|
2
|
+
import { buyAnswer } from '../otaless/shop-answers.js';
|
|
3
|
+
import { unitCentsOf } from '../otaless/shop-service.js';
|
|
4
|
+
import { str } from './args.js';
|
|
5
|
+
import { common } from './paid-lines.js';
|
|
6
|
+
import { clockWords, noConfirmPage } from './payment-words.js';
|
|
7
|
+
import { identity } from './session-notes.js';
|
|
8
|
+
import { inBrowserWords } from './terms-answer.js';
|
|
9
|
+
// ⚠️ NEVER BUYS (0.82.0): it checks the item, the booking and the price the guest was shown, and
|
|
10
|
+
// PREPARES a one-time confirm page. The purchase is the guest's press on that page.
|
|
11
|
+
export const answerBuyShopItem = async ({ deps, args, ctx, t, key, }) => {
|
|
12
|
+
const api = deps.backend.otalessAddons;
|
|
13
|
+
const base = common(deps, key);
|
|
14
|
+
const used = {
|
|
15
|
+
ordersTool: t.listBookings,
|
|
16
|
+
signIn: deps.groupSignIn?.signInTool,
|
|
17
|
+
...(deps.shopLink ? { shopLink: deps.shopLink } : {}),
|
|
18
|
+
};
|
|
19
|
+
if (!api?.buyOpen)
|
|
20
|
+
return buyAnswer(base, { outcome: 'off' }, used);
|
|
21
|
+
const unitCents = unitCentsOf(args.unitPrice);
|
|
22
|
+
const currency = str(args.currency).toUpperCase();
|
|
23
|
+
// ⚠️ THE PRICE THE GUEST WAS SHOWN IS PART OF THE ASK: without it nothing is prepared.
|
|
24
|
+
if (unitCents === undefined || !/^[A-Z]{3}$/.test(currency))
|
|
25
|
+
return buyAnswer(base, { outcome: 'refused', why: 'shown' }, used);
|
|
26
|
+
const lang = deps.lang === 'zh' ? 'zh' : 'en';
|
|
27
|
+
const who = identity(deps, ctx, key);
|
|
28
|
+
const prepared = await api.prepareShop(who, {
|
|
29
|
+
item: str(args.item),
|
|
30
|
+
...(str(args.option) ? { option: str(args.option) } : {}),
|
|
31
|
+
quantity: typeof args.quantity === 'number' ? args.quantity : 0,
|
|
32
|
+
booking: str(args.booking),
|
|
33
|
+
unitPrice: (unitCents / 100).toFixed(2),
|
|
34
|
+
currency,
|
|
35
|
+
}, lang);
|
|
36
|
+
if (!prepared.ok)
|
|
37
|
+
return prepareRefusal(base, str(args.booking), prepared.result, deps.shopLink);
|
|
38
|
+
const link = deps.addonLink?.(key, prepared.ref, lang);
|
|
39
|
+
if (!link) {
|
|
40
|
+
api.discard(who, prepared.ref);
|
|
41
|
+
return noConfirmPage(base);
|
|
42
|
+
}
|
|
43
|
+
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso, inBrowserWords(deps, ctx));
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=buy-shop-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buy-shop-item.js","sourceRoot":"","sources":["../../src/tools/buy-shop-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGhC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,iGAAiG;AACjG,oFAAoF;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,CAAC,EACD,GAAG,GACM,EAAuB,EAAE;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC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G,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,QAAQ,EAAE,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAC1B,SAAS,EAAE,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACvC,QAAQ;KACT,EACD,IAAI,CACL,CAAC;IACF,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,OAAO,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjG,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,cAAc,CACnB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,EAC/B,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAC1B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToolContext, ToolDeps } from './deps.js';
|
|
2
|
+
/** What every tool's handler gets: the parts `answerTool` works out once, before it picks the tool. */
|
|
3
|
+
export type ToolCall = {
|
|
4
|
+
deps: ToolDeps;
|
|
5
|
+
name: string;
|
|
6
|
+
args: Record<string, unknown>;
|
|
7
|
+
ctx: ToolContext;
|
|
8
|
+
t: ToolDeps['tools'];
|
|
9
|
+
key: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/tools/call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEvD,uGAAuG;AACvG,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,GAAG,EAAE,WAAW,CAAC;IACjB,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/tools/call.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import type { CancelFacts, CancelOutcome } from '../account/cancel-pages.js';
|
|
2
|
+
import { type BackendCapabilities } from '../backend.js';
|
|
3
|
+
import type { Booking, BookingPayment, CancellationPreview } from '../types.js';
|
|
4
|
+
import type { ToolDeps } from './deps.js';
|
|
5
|
+
/** Who a booking or a hotel is with, and what that group makes of a booking. */
|
|
6
|
+
export type Holder = {
|
|
7
|
+
name: string;
|
|
8
|
+
caps: BackendCapabilities;
|
|
9
|
+
demo: boolean;
|
|
10
|
+
sandbox: boolean;
|
|
11
|
+
/** The group's own test system - see `Vocabulary.test`. */
|
|
12
|
+
test: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* A group whose bookings here are never sent to it (a demonstration file, a
|
|
15
|
+
* simulated copy of its system): said as the fact - not sent to the group, no room
|
|
16
|
+
* held, nothing charged - and never as 演示 / 模拟 / 测试 (robin, 2026-11-03: 「不用特意
|
|
17
|
+
* 写不是真的」, every deployment as a market's). Its own test system is `test`: the
|
|
18
|
+
* booking reaches it and holds no room for anyone.
|
|
19
|
+
*/
|
|
20
|
+
notReal: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* On a group's own connector, the connector itself. In a market, the supplier
|
|
24
|
+
* named on the booking or the hotel.
|
|
25
|
+
*
|
|
26
|
+
* ⚠️ NEVER THE MARKET. "Asks Otaless to hold the rooms" or "Otaless's own
|
|
27
|
+
* reservation" would send a guest to a desk that has never heard of Otaless,
|
|
28
|
+
* and a market holding a demonstration beside a group's real system must not
|
|
29
|
+
* call either by the other's terms (robin, 2026-10-07).
|
|
30
|
+
*/
|
|
31
|
+
export declare const holderOf: (deps: ToolDeps, supplier?: string) => Holder;
|
|
32
|
+
/**
|
|
33
|
+
* What was made, in one sentence - which depends on what asking MAKES here.
|
|
34
|
+
*
|
|
35
|
+
* ⚠️ HELD IS NOT BOOKED, AND BOOKED IS NOT PAID. The demonstration holds rooms
|
|
36
|
+
* until a moment and then lets them go; a group's own system makes its own
|
|
37
|
+
* reservation, kept until cancelled and paid at the hotel. Saying "held until"
|
|
38
|
+
* of a reservation invents a deadline, and saying "booked" of a hold invents a
|
|
39
|
+
* room - and a booking whose confirmation has not come back yet is neither,
|
|
40
|
+
* and is said as exactly that.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* A booking as the card is given it: its money as strings, like every other
|
|
44
|
+
* price - the card never does arithmetic, and an amount sent as
|
|
45
|
+
* `{ minor, currency }` was drawn as "[object Object]" (香格里拉, 2026-10-12).
|
|
46
|
+
*/
|
|
47
|
+
export declare const bookingForCard: (b: Booking) => {
|
|
48
|
+
payment?: BookingPayment | {
|
|
49
|
+
quotedAs?: string | import("../types.js").Money | undefined;
|
|
50
|
+
refundAmountText?: string | undefined;
|
|
51
|
+
amount: string;
|
|
52
|
+
payByWords?: string | undefined;
|
|
53
|
+
linkClosed?: true | undefined;
|
|
54
|
+
linkClosedSaid?: string | undefined;
|
|
55
|
+
host?: string | undefined;
|
|
56
|
+
method: import("../types.js").PaymentMethod;
|
|
57
|
+
status: "awaiting" | "issued" | "paid" | "lapsed" | "refunding" | "refunded" | "hotel-refunds";
|
|
58
|
+
url?: string;
|
|
59
|
+
payBy?: string;
|
|
60
|
+
payByLocal?: string;
|
|
61
|
+
payByLocalIso?: import("../types.js").LocalIso;
|
|
62
|
+
refundReason?: string;
|
|
63
|
+
refundAmount?: import("../types.js").Money;
|
|
64
|
+
refundStuck?: boolean;
|
|
65
|
+
groupReviews?: true;
|
|
66
|
+
refundUnsure?: true;
|
|
67
|
+
chargedWhenBooked?: true;
|
|
68
|
+
amountUnsaid?: true;
|
|
69
|
+
cancelledUnpaid?: true;
|
|
70
|
+
} | undefined;
|
|
71
|
+
cancellationFeeText?: string | undefined;
|
|
72
|
+
quote: {
|
|
73
|
+
dropped?: import("../types.js").DroppedLine[] | undefined;
|
|
74
|
+
stay?: import("../types.js").Stay | undefined;
|
|
75
|
+
coupons?: {
|
|
76
|
+
spend?: string | import("../types.js").Money | undefined;
|
|
77
|
+
off?: string | import("../types.js").Money | undefined;
|
|
78
|
+
minSpend?: string | import("../types.js").Money | undefined;
|
|
79
|
+
maxOff?: string | import("../types.js").Money | undefined;
|
|
80
|
+
amountOff?: string | import("../types.js").Money | undefined;
|
|
81
|
+
id: string;
|
|
82
|
+
kind: import("../types.js").CouponKind;
|
|
83
|
+
name: string;
|
|
84
|
+
names?: import("../types.js").Names;
|
|
85
|
+
percentOff?: number;
|
|
86
|
+
brands?: {
|
|
87
|
+
name: string;
|
|
88
|
+
names?: import("../types.js").Names;
|
|
89
|
+
}[];
|
|
90
|
+
hotels?: {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
names?: import("../types.js").Names;
|
|
94
|
+
}[];
|
|
95
|
+
validFrom: string;
|
|
96
|
+
validUntil: string;
|
|
97
|
+
state: "usable" | "used" | "expired" | "not-yet";
|
|
98
|
+
usedOn?: {
|
|
99
|
+
code?: string;
|
|
100
|
+
stands: boolean;
|
|
101
|
+
};
|
|
102
|
+
}[] | undefined;
|
|
103
|
+
couponRefused?: {
|
|
104
|
+
spend?: string | import("../types.js").Money | undefined;
|
|
105
|
+
minSpend?: string | import("../types.js").Money | undefined;
|
|
106
|
+
id: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
names?: import("../types.js").Names;
|
|
109
|
+
code: import("../types.js").CouponRefusal;
|
|
110
|
+
why: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
coupon?: {
|
|
113
|
+
off: string;
|
|
114
|
+
id: string;
|
|
115
|
+
name: string;
|
|
116
|
+
names?: import("../types.js").Names;
|
|
117
|
+
kind: import("../types.js").CouponKind;
|
|
118
|
+
hotelId: string;
|
|
119
|
+
hotelName: string;
|
|
120
|
+
hotelNames?: import("../types.js").Names;
|
|
121
|
+
checkIn: string;
|
|
122
|
+
checkOut: string;
|
|
123
|
+
validUntil: string;
|
|
124
|
+
} | undefined;
|
|
125
|
+
memberSaving?: {
|
|
126
|
+
memberTotal: string;
|
|
127
|
+
roomSaved?: string | undefined;
|
|
128
|
+
saved: string;
|
|
129
|
+
publicTotal: string;
|
|
130
|
+
publicSubtotal: string;
|
|
131
|
+
programme: string;
|
|
132
|
+
tier: string;
|
|
133
|
+
points: number;
|
|
134
|
+
} | undefined;
|
|
135
|
+
lines: {
|
|
136
|
+
day: string | undefined;
|
|
137
|
+
paymentNotConnected?: boolean | undefined;
|
|
138
|
+
payment?: "at-hotel" | "prepaid" | undefined;
|
|
139
|
+
freeCancellationLocalIso?: string | undefined;
|
|
140
|
+
freeCancellationLocal?: string | undefined;
|
|
141
|
+
freeCancellationUntil: string | undefined;
|
|
142
|
+
terms?: string | undefined;
|
|
143
|
+
refundable: boolean | undefined;
|
|
144
|
+
totalWithTaxes?: string | undefined;
|
|
145
|
+
total: string;
|
|
146
|
+
publicUnit?: string | undefined;
|
|
147
|
+
roomCharges?: string | undefined;
|
|
148
|
+
unit: string;
|
|
149
|
+
ordered?: number | undefined;
|
|
150
|
+
quantity: number | undefined;
|
|
151
|
+
hourly?: import("../types.js").HourlyStay | undefined;
|
|
152
|
+
stay: import("../types.js").Stay | undefined;
|
|
153
|
+
nights: number | undefined;
|
|
154
|
+
rate?: {
|
|
155
|
+
name: string;
|
|
156
|
+
kind?: import("../types.js").RateKind;
|
|
157
|
+
} | undefined;
|
|
158
|
+
meal?: import("../types.js").MealPlan | undefined;
|
|
159
|
+
window?: import("../types.js").WindowKind | undefined;
|
|
160
|
+
bedTypes?: import("../types.js").BedType[] | undefined;
|
|
161
|
+
detail: string | undefined;
|
|
162
|
+
titleNames?: Partial<Record<import("../types.js").NameLang, string>> | undefined;
|
|
163
|
+
roomRef: string | undefined;
|
|
164
|
+
extraRef: string | undefined;
|
|
165
|
+
title: string;
|
|
166
|
+
hotelNames?: Partial<Record<import("../types.js").NameLang, string>> | undefined;
|
|
167
|
+
hotelName: string;
|
|
168
|
+
supplier?: string | undefined;
|
|
169
|
+
kind: "room" | "extra";
|
|
170
|
+
hotelId: string;
|
|
171
|
+
}[];
|
|
172
|
+
subtotal: string;
|
|
173
|
+
taxesAndFees: string;
|
|
174
|
+
total: string;
|
|
175
|
+
};
|
|
176
|
+
couponNotReturnedBecause?: import("../types.js").CouponKeptWhy;
|
|
177
|
+
id: string;
|
|
178
|
+
supplier?: string;
|
|
179
|
+
confirmationCode: string;
|
|
180
|
+
status: import("../types.js").BookingStatus;
|
|
181
|
+
unverifiable?: true;
|
|
182
|
+
needsPerson?: "paid-amount" | "release";
|
|
183
|
+
termsChanged?: true;
|
|
184
|
+
confirmAsked?: true;
|
|
185
|
+
noTermsGiven?: true;
|
|
186
|
+
confirmUnseen?: true;
|
|
187
|
+
groupTermsAutoAccepted?: true;
|
|
188
|
+
termsUntil?: string;
|
|
189
|
+
rebookable?: true;
|
|
190
|
+
createdAt: string;
|
|
191
|
+
holdUntil?: string;
|
|
192
|
+
holdUntilLocal?: string;
|
|
193
|
+
holdUntilLocalIso?: import("../types.js").LocalIso;
|
|
194
|
+
hotelId: string;
|
|
195
|
+
hotelName: string;
|
|
196
|
+
hotelNames?: import("../types.js").Names;
|
|
197
|
+
stay: import("../types.js").Stay;
|
|
198
|
+
hourly?: import("../types.js").HourlyStay;
|
|
199
|
+
paymentNotConnected?: true;
|
|
200
|
+
orderNumber?: string;
|
|
201
|
+
guest: import("../types.js").Guest;
|
|
202
|
+
cancelledAt?: string;
|
|
203
|
+
cancellationFee?: import("../types.js").Money;
|
|
204
|
+
couponReturned?: boolean;
|
|
205
|
+
changedAt?: string;
|
|
206
|
+
requests?: import("../types.js").RoomRequests;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* What was paid here in advance on a booking being cancelled, and what
|
|
210
|
+
* cancelling it now gives back - as facts for the card to say in the guest's
|
|
211
|
+
* language (2026-10-21 re-audit, T2-2).
|
|
212
|
+
*
|
|
213
|
+
* ⚠️ WHY THE CARD NEEDS THEM. For a booking with terms as facts the card does
|
|
214
|
+
* not show `rule`, and "paid ¥300, all of it goes back to the card" / "nothing
|
|
215
|
+
* goes back, the fee is the whole stay" is only in `rule`: a guest who had
|
|
216
|
+
* paid ¥300 saw "Cancelling would cost ¥300" on the screen where they decide,
|
|
217
|
+
* and could read it as a second payment. `rule` stays for the model, word for
|
|
218
|
+
* word; these are the same facts, as data. The shape is the booking's own
|
|
219
|
+
* payment (`method`, `amount` as text) with what cancelling now does to it:
|
|
220
|
+
* `refund` is `all`, `part` (and `refundAmount` says how much) or `none`.
|
|
221
|
+
*
|
|
222
|
+
* Only where money was paid HERE and the booking can be cancelled now: paid in
|
|
223
|
+
* advance by card, or paid with UnionPay - which the hotel charged, and gives
|
|
224
|
+
* back to that card, not through this connector. A booking paid at the hotel,
|
|
225
|
+
* a demonstration's hold, a page not paid yet and a booking that cannot be
|
|
226
|
+
* cancelled have none, and the card says nothing of money for them.
|
|
227
|
+
*/
|
|
228
|
+
/**
|
|
229
|
+
* A cancellation preview as a string the guest's press must find again (0.84.2, P1-8 - the cancel page):
|
|
230
|
+
* the fee and whether it is known, the terms, the reason, what was paid and what goes back. Anything of it
|
|
231
|
+
* different at the press - a fee moved, the terms changed, the booking paid meanwhile - and nothing is
|
|
232
|
+
* sent. In memory only, never shown.
|
|
233
|
+
*/
|
|
234
|
+
export declare const cancelShapeOf: (preview: CancellationPreview, refundAsked: {
|
|
235
|
+
amount: string;
|
|
236
|
+
} | undefined, paid: PaidFacts | undefined, booked: Booking | null) => string;
|
|
237
|
+
/** What the cancel page shows (0.84.2, P1-8): the preview the tool made, as facts - `until` is the account's to set. */
|
|
238
|
+
export declare const cancelFactsOf: (deps: ToolDeps, preview: CancellationPreview, booked: Booking | null, which: {
|
|
239
|
+
hotelName?: string;
|
|
240
|
+
hotelNames?: unknown;
|
|
241
|
+
stay?: unknown;
|
|
242
|
+
}, refundAsked: {
|
|
243
|
+
amount: string;
|
|
244
|
+
} | undefined, paid: PaidFacts | undefined, shown: Record<string, unknown>, shape: string) => CancelFacts;
|
|
245
|
+
/**
|
|
246
|
+
* ⚠️ THE GUEST'S PRESS ON THE ONE-TIME CANCEL PAGE (0.84.2, the 11-25 code audit's P1-8 - account/index.ts
|
|
247
|
+
* `cancels`): the cancel tool's own confirmed cancel - the same 9, 9.1 and value-added service orders as
|
|
248
|
+
* a card's button - for the conversation the link was made in, and only if the preview is still the one
|
|
249
|
+
* the page showed (`facts.shape`). How it came out, for the page. Throws only what the tool throws.
|
|
250
|
+
*/
|
|
251
|
+
export declare const cancelOnPage: (deps: ToolDeps, key: string, facts: CancelFacts) => Promise<CancelOutcome>;
|
|
252
|
+
export type PaidFacts = {
|
|
253
|
+
method: BookingPayment['method'];
|
|
254
|
+
/** What was paid, as text like every amount the card is given. */
|
|
255
|
+
amount: string;
|
|
256
|
+
/** What cancelling now gives back of it. */
|
|
257
|
+
refund: 'all' | 'part' | 'none';
|
|
258
|
+
/** How much of `amount`, as text - only when `refund` is `part`. */
|
|
259
|
+
refundAmount?: string;
|
|
260
|
+
};
|
|
261
|
+
export declare const paidFactsOf: (booked: Booking | null, preview: CancellationPreview) => PaidFacts | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* A booking paid in advance, as the guest is told it - where its money stands.
|
|
264
|
+
* Undefined for any other booking.
|
|
265
|
+
*
|
|
266
|
+
* ⚠️ THE BOOKING FIRST, THEN THE MONEY (2026-10-16 audit, P0-C). This read the
|
|
267
|
+
* payment alone, so a stay cancelled after its free time - whose fee is all of
|
|
268
|
+
* it, and nothing goes back - was told "the hotel has not confirmed it; if it
|
|
269
|
+
* does not take it, all of it goes back", every time; and a UnionPay stay
|
|
270
|
+
* cancelled was told "cancelled. undefined". Each state of each way of paying
|
|
271
|
+
* is said here, and a cancelled stay by what the cancellation kept (`fee`,
|
|
272
|
+
* the hotel's own figure where it gave one).
|
|
273
|
+
*/
|
|
274
|
+
/**
|
|
275
|
+
* A refund asked of the hotel group (`groupReviews`, Otaless 9.1 - 0.74.2, robin 11-17 through
|
|
276
|
+
* 总线程): submitted, and back on the card it was paid with once the group has reviewed it -
|
|
277
|
+
* or, held up, not submitted at all: the booking stays cancelled and a person takes it up.
|
|
278
|
+
* Undefined for any other refund.
|
|
279
|
+
*/
|
|
280
|
+
export declare const groupRefundWords: (p: BookingPayment, group: string, back: string, whole: boolean, amount: string) => string | undefined;
|
|
281
|
+
//# sourceMappingURL=cancel-facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-facts.d.ts","sourceRoot":"","sources":["../../src/tools/cancel-facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAE5E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,KAA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