@curless/hotel-storefront 0.85.0 → 0.86.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 +1342 -0
- package/dist/tools/all-tools.d.ts.map +1 -0
- package/dist/tools/all-tools.js +954 -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 +380 -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 +485 -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 +364 -0
- package/dist/tools/cancel.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 +261 -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 +324 -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 +558 -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 +148 -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.d.ts +4 -0
- package/dist/tools/list-hotels.d.ts.map +1 -0
- package/dist/tools/list-hotels.js +891 -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 +170 -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 +314 -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 +348 -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 +475 -0
- package/dist/tools/terms-answer.js.map +1 -0
- package/dist/tools/tool-set.d.ts +1474 -0
- package/dist/tools/tool-set.d.ts.map +1 -0
- package/dist/tools/tool-set.js +497 -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,485 @@
|
|
|
1
|
+
import { FULL_CAPABILITIES, LASTING_REQUESTS, guestTooLong, maskedEmail, wholeEmail, } from '../backend.js';
|
|
2
|
+
import { stayWords } from '../hourly.js';
|
|
3
|
+
import { formatMoney } from '../money.js';
|
|
4
|
+
import { stampOf } from '../trip.js';
|
|
5
|
+
import { MAX_FAILED_WITH_ALTERNATIVES, alternativesFor, groupNamed, inFailedStay, place, roomsIn, str, unset, } from './args.js';
|
|
6
|
+
import { holderOf } from './cancel-facts.js';
|
|
7
|
+
import { currentTrip } from './current-trip.js';
|
|
8
|
+
import { couponNotUsedOf } from './hotel-choices.js';
|
|
9
|
+
import { bookedLine, common, confirming, madeForCard } from './paid-lines.js';
|
|
10
|
+
import { bookingNotes, heldRoomsWords, refusalAnswer, valueAddedLine } from './payment-words.js';
|
|
11
|
+
import { couponOf, refreshMember } from './pricing.js';
|
|
12
|
+
import { withZh } from './quote-card.js';
|
|
13
|
+
import { OPPOSITES, REQUEST_WORDS, readRequests, requestLines } from './request-words.js';
|
|
14
|
+
import { BOOKING_FAULT, groupsOfFailed, guestWords, identity, listAnd } from './session-notes.js';
|
|
15
|
+
import { termsAnswer } from './terms-answer.js';
|
|
16
|
+
/**
|
|
17
|
+
* What a booking asked for came to, said: the stays booked, those that were not
|
|
18
|
+
* and why, and any terms a group sent back for the guest to agree to - for
|
|
19
|
+
* request_booking, for the picked room's booking, and for the card's agreement
|
|
20
|
+
* to terms (`fromTerms`: only the stays that agreement booked leave the trip).
|
|
21
|
+
*/
|
|
22
|
+
export const bookingAnswer = async (deps, t, ctx, key, store, args, inTrip, lines, shown, result, requests, dropped, fromTerms = false) => {
|
|
23
|
+
const { booked: made, failed, repeat, reused } = result;
|
|
24
|
+
// Terms a group sent back: the stay waits for the guest's own agreement.
|
|
25
|
+
const pendingTerms = result.terms ?? [];
|
|
26
|
+
// A coupon spent is spent on the member's badge too.
|
|
27
|
+
await refreshMember(deps, key);
|
|
28
|
+
// ⚠️ WHAT WAS BOOKED LEAVES THE TRIP; WHAT WAS NOT STAYS IN IT, add-ons
|
|
29
|
+
// and all - to ask again, or to put another hotel in its place (robin,
|
|
30
|
+
// 2026-10-14).
|
|
31
|
+
//
|
|
32
|
+
// ⚠️ AND A STAY WITH TERMS WAITING IS NEITHER: it stays in the trip until the
|
|
33
|
+
// guest has agreed and it is booked (then `fromTerms` takes out exactly the
|
|
34
|
+
// stays that agreement booked, and leaves every other line where it is).
|
|
35
|
+
const stillOut = (l) => fromTerms
|
|
36
|
+
? !made.some((b) => inFailedStay(l, b))
|
|
37
|
+
: failed.some((f) => inFailedStay(l, f)) || pendingTerms.some((x) => inFailedStay(l, x));
|
|
38
|
+
if (lines.length === inTrip.length && !lines.some(stillOut))
|
|
39
|
+
deps.trips.clear(store);
|
|
40
|
+
else
|
|
41
|
+
for (const l of lines)
|
|
42
|
+
if (!stillOut(l))
|
|
43
|
+
deps.trips.set(store, unset(l));
|
|
44
|
+
// What is left is priced again, and that price is what the next
|
|
45
|
+
// booking is held to (ShownQuote).
|
|
46
|
+
const rest = fromTerms
|
|
47
|
+
? lines.some(stillOut)
|
|
48
|
+
? await currentTrip(deps, key, identity(deps, ctx, key), store, undefined, ctx)
|
|
49
|
+
: undefined
|
|
50
|
+
: lines.length === inTrip.length && !failed.length
|
|
51
|
+
? undefined
|
|
52
|
+
: await currentTrip(deps, key, identity(deps, ctx, key), store, undefined, ctx);
|
|
53
|
+
const others = rest && (fromTerms || lines.length !== inTrip.length);
|
|
54
|
+
// What could be booked instead of each, found now (robin, 2026-10-14).
|
|
55
|
+
const instead = await Promise.all(failed.map((f, i) => i < MAX_FAILED_WITH_ALTERNATIVES
|
|
56
|
+
? alternativesFor(deps, f, lines, shown, identity(deps, ctx, key))
|
|
57
|
+
: Promise.resolve({ hotels: [] })));
|
|
58
|
+
// ⚠️ REMEMBERED ONLY WHEN ASKED - see `rememberPreferences`. Said either
|
|
59
|
+
// way, so neither the guest nor the model assumes something was kept.
|
|
60
|
+
const signedIn = deps.members.read(key);
|
|
61
|
+
let remembered;
|
|
62
|
+
if (args.rememberRequests === true) {
|
|
63
|
+
const lasting = (requests?.kinds ?? []).filter((k) => LASTING_REQUESTS.includes(k));
|
|
64
|
+
if (!signedIn) {
|
|
65
|
+
remembered = {
|
|
66
|
+
kept: [],
|
|
67
|
+
line: 'Nothing was remembered: saved preferences belong to a membership, and nobody is signed in.',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else if (!lasting.length) {
|
|
71
|
+
remembered = {
|
|
72
|
+
kept: signedIn.preferences ?? [],
|
|
73
|
+
line: 'Nothing new was remembered: an early check-in, a late arrival and a note are for one stay, not every stay.',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// ADDED TO what is kept, not in place of it: a quiet room remembered
|
|
78
|
+
// this time silently dropped the king bed remembered last time. A new
|
|
79
|
+
// request does replace its opposite - twin beds over a king bed.
|
|
80
|
+
const clash = (k) => lasting.some((n) => OPPOSITES.some((pair) => pair.includes(n) && pair.includes(k)));
|
|
81
|
+
const merged = [
|
|
82
|
+
...(signedIn.preferences ?? []).filter((k) => !lasting.includes(k) && !clash(k)),
|
|
83
|
+
...lasting,
|
|
84
|
+
];
|
|
85
|
+
const kept = await deps.backend.rememberPreferences(signedIn, merged);
|
|
86
|
+
deps.members.set(key, { ...signedIn, preferences: kept });
|
|
87
|
+
deps.members.setPreferences(signedIn.number, kept);
|
|
88
|
+
remembered = {
|
|
89
|
+
kept,
|
|
90
|
+
line: `Remembered on this ${signedIn.programme} membership for next time: ${kept.map((k) => REQUEST_WORDS[k]).join(', ')}. ${t.forgetPreferences} forgets them.`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// The hotel's own check-in hour, so an early-check-in request is answered
|
|
95
|
+
// with the time it is early against - London opens at 16:00 and Hong Kong
|
|
96
|
+
// at 15:00, and a generic "check-in is in the afternoon" is not an answer.
|
|
97
|
+
// Per booking: each is its own hotel, with its own hour and its own desk.
|
|
98
|
+
const booked = await Promise.all(made.map(async (booking, i) => {
|
|
99
|
+
// ⚠️ THE BOOKING IS MADE: a read after it that fails (a group slow to
|
|
100
|
+
// answer) loses the check-in hour, never the answer.
|
|
101
|
+
const hotel = await deps.backend.getHotel(booking.hotelId).catch(() => null);
|
|
102
|
+
return {
|
|
103
|
+
booking,
|
|
104
|
+
// The requests that could not both be asked for are said once.
|
|
105
|
+
asked: requestLines(booking, i === 0 ? dropped : [], hotel?.hotel.checkInFrom),
|
|
106
|
+
};
|
|
107
|
+
}));
|
|
108
|
+
const [first] = booked;
|
|
109
|
+
const several = booked.length > 1;
|
|
110
|
+
// The stays asked for minutes before, beside new ones - see `reused`.
|
|
111
|
+
const earlier = booked.filter(({ booking }) => reused?.includes(booking.id));
|
|
112
|
+
// The coupon asked for, when the stays asked for before did not carry it
|
|
113
|
+
// and nothing new did either - see `couponNotUsedOf`.
|
|
114
|
+
const askedCoupon = couponOf(deps, args);
|
|
115
|
+
const notUsed = couponNotUsedOf(deps, key, askedCoupon, repeat ? made : earlier.map(({ booking }) => booking), made);
|
|
116
|
+
const waiting = booked.filter(({ booking }) => confirming(deps, booking)).length;
|
|
117
|
+
const notBooked = failed.map((f, i) => ({
|
|
118
|
+
hotelId: f.hotelId,
|
|
119
|
+
hotelName: f.hotelName,
|
|
120
|
+
stay: f.stay,
|
|
121
|
+
...(f.hourly ? { hourly: f.hourly } : {}),
|
|
122
|
+
...(f.roomName ? { roomName: f.roomName } : {}),
|
|
123
|
+
rooms: roomsIn(lines, f),
|
|
124
|
+
// What to take out of the trip to put another hotel in its place.
|
|
125
|
+
roomRefs: lines.flatMap((l) => (l.kind === 'room' && inFailedStay(l, f) ? [l.roomId] : [])),
|
|
126
|
+
extraRefs: lines.flatMap((l) => (l.kind === 'extra' && inFailedStay(l, f) ? [l.extraId] : [])),
|
|
127
|
+
why: f.why,
|
|
128
|
+
...(f.code ? { code: f.code } : {}),
|
|
129
|
+
...(f.args ? { args: f.args } : {}),
|
|
130
|
+
// The group a link is asked of (0.74.5, `link-first`): the card's Link button names it.
|
|
131
|
+
...(groupsOfFailed(f).length ? { groups: groupsOfFailed(f) } : {}),
|
|
132
|
+
...(instead[i]?.city ? { city: instead[i]?.city } : {}),
|
|
133
|
+
alternatives: (instead[i]?.hotels ?? []).map((h) => ({
|
|
134
|
+
hotelId: h.id,
|
|
135
|
+
name: h.name,
|
|
136
|
+
brand: h.brand,
|
|
137
|
+
...(h.forStay
|
|
138
|
+
? {
|
|
139
|
+
total: formatMoney(h.forStay.total),
|
|
140
|
+
room: h.forStay.room,
|
|
141
|
+
...(h.forStay.roomNames ? { roomNames: h.forStay.roomNames } : {}),
|
|
142
|
+
freeCancellation: h.forStay.freeCancellation,
|
|
143
|
+
}
|
|
144
|
+
: {}),
|
|
145
|
+
})),
|
|
146
|
+
}));
|
|
147
|
+
// A stay refused for a link or the account's sign-in (0.74.5): the tool for it, as a booking
|
|
148
|
+
// refused for that alone says (`refusalAnswer`).
|
|
149
|
+
const signInFor = (f) => {
|
|
150
|
+
const how = deps.groupSignIn;
|
|
151
|
+
if ((f.code === 'link-first' || f.code === 'link-redo') && how?.linkTool)
|
|
152
|
+
return (f.groups ?? [])
|
|
153
|
+
.map((code) => {
|
|
154
|
+
const name = deps.backend.suppliers?.().find((x) => x.id === code)?.name ?? code;
|
|
155
|
+
return ` To link the guest's ${name} membership: ${how.linkTool} with group "${code}" gives the guest a one-time page for it.`;
|
|
156
|
+
})
|
|
157
|
+
.join('');
|
|
158
|
+
if ((f.code === 'sign-in' || f.code === 'signed-out') && how?.signInTool)
|
|
159
|
+
return ` ${how.signInTool} gives the guest a one-time page to sign in to their ${deps.vocab.brand} account.`;
|
|
160
|
+
return '';
|
|
161
|
+
};
|
|
162
|
+
const failedText = notBooked.map((f) => `NOT BOOKED - ${f.hotelName} · ${stayWords(f.stay, f.hourly)}: ${f.why}${signInFor(f)} It is still in the trip.${f.alternatives.length
|
|
163
|
+
? ` Bookable instead for the same nights: ${f.alternatives.map((a) => `${a.name}${a.room ? ` (${a.room}` : ''}${a.total ? `${a.room ? ', ' : ' ('}${a.total} for the stay)` : a.room ? ')' : ''} [hotel \`${a.hotelId}\`]`).join('; ')}.`
|
|
164
|
+
: ''} The guest can ask again, take another hotel, or leave it.`);
|
|
165
|
+
// Terms waiting for the guest, said first: that is what needs doing.
|
|
166
|
+
const termsPart = pendingTerms.length ? termsAnswer(deps, ctx, key, pendingTerms) : undefined;
|
|
167
|
+
if (!first) {
|
|
168
|
+
if (termsPart)
|
|
169
|
+
return {
|
|
170
|
+
structured: {
|
|
171
|
+
view: 'terms',
|
|
172
|
+
...common(deps, key),
|
|
173
|
+
paid: false,
|
|
174
|
+
...(notBooked.length ? { failed: notBooked } : {}),
|
|
175
|
+
...termsPart.structured,
|
|
176
|
+
},
|
|
177
|
+
text: [termsPart.text, ...failedText].join('\n'),
|
|
178
|
+
...(termsPart.meta ? { meta: termsPart.meta } : {}),
|
|
179
|
+
};
|
|
180
|
+
// Nothing booked at all: every stay said, each with its way on.
|
|
181
|
+
return {
|
|
182
|
+
structured: {
|
|
183
|
+
view: 'booking',
|
|
184
|
+
...common(deps, key),
|
|
185
|
+
paid: false,
|
|
186
|
+
failed: notBooked,
|
|
187
|
+
},
|
|
188
|
+
text: [
|
|
189
|
+
`Nothing was booked: ${notBooked.length === 1 ? 'the stay' : `none of the ${notBooked.length} stays`} could be.`,
|
|
190
|
+
...failedText,
|
|
191
|
+
].join('\n'),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
const answer = {
|
|
195
|
+
structured: {
|
|
196
|
+
// ⚠️ 'booking' EVEN WHEN IT IS AWAITING PAYMENT: the card draws a view
|
|
197
|
+
// only once it knows it, and the card-contract test holds every view
|
|
198
|
+
// here to that. 香格里拉's card turns this into its own 'payment' step
|
|
199
|
+
// (booking.status 'awaiting-payment', booking.payment) - and moves the
|
|
200
|
+
// view with it.
|
|
201
|
+
view: 'booking',
|
|
202
|
+
...common(deps, key),
|
|
203
|
+
booking: madeForCard(deps, first.booking),
|
|
204
|
+
// ⚠️ ONE PER STAY - see `requestBooking`. The card draws each with its
|
|
205
|
+
// own code; `booking` stays the first, for a host that reads one.
|
|
206
|
+
...(several
|
|
207
|
+
? {
|
|
208
|
+
bookings: booked.map(({ booking, asked }) => ({
|
|
209
|
+
...madeForCard(deps, booking),
|
|
210
|
+
total: formatMoney(booking.quote.total),
|
|
211
|
+
...(asked.length ? { requested: asked } : {}),
|
|
212
|
+
// Each its own warning colour - it rode on the first alone.
|
|
213
|
+
...(booking.requests?.kinds.includes('accessible-room')
|
|
214
|
+
? { accessibility: true }
|
|
215
|
+
: {}),
|
|
216
|
+
})),
|
|
217
|
+
}
|
|
218
|
+
: {}),
|
|
219
|
+
paid: false,
|
|
220
|
+
...(remembered ? { remembered: remembered.kept } : {}),
|
|
221
|
+
// What they come to together, said by the server like every figure on
|
|
222
|
+
// the card - never added up there (r10, #15). Only in one currency.
|
|
223
|
+
...(several &&
|
|
224
|
+
booked.every(({ booking }) => booking.quote.total.currency === first.booking.quote.total.currency)
|
|
225
|
+
? {
|
|
226
|
+
totalAll: formatMoney({
|
|
227
|
+
minor: booked.reduce((n, { booking }) => n + booking.quote.total.minor, 0),
|
|
228
|
+
currency: first.booking.quote.total.currency,
|
|
229
|
+
}),
|
|
230
|
+
}
|
|
231
|
+
: {}),
|
|
232
|
+
holdUntil: first.booking.holdUntil,
|
|
233
|
+
total: formatMoney(first.booking.quote.total),
|
|
234
|
+
...(first.asked.length ? { requested: first.asked } : {}),
|
|
235
|
+
...(first.booking.requests?.kinds.includes('accessible-room') ? { accessibility: true } : {}),
|
|
236
|
+
...(notBooked.length ? { failed: notBooked } : {}),
|
|
237
|
+
...(repeat ? { repeat: true } : {}),
|
|
238
|
+
...(earlier.length ? { repeated: earlier.map(({ booking }) => booking.id) } : {}),
|
|
239
|
+
...(notUsed ? { couponNotUsed: notUsed.structured } : {}),
|
|
240
|
+
},
|
|
241
|
+
text: [
|
|
242
|
+
// ⚠️ THE SAME BOOKING ASKED FOR AGAIN IS SAID TO BE THAT, never a new
|
|
243
|
+
// one (2026-10-27 audit, F2): it was answered as if just booked.
|
|
244
|
+
repeat
|
|
245
|
+
? `NOTHING NEW WAS BOOKED: the same ${booked.length > 1 ? 'stays' : 'stay'} for the same guest ${booked.length > 1 ? 'were' : 'was'} asked for a few minutes ago, and ${booked.length > 1 ? 'these are the bookings' : 'this is the booking'} made then. A booking for someone else is made under their name.`
|
|
246
|
+
: earlier.length
|
|
247
|
+
? `NOT ALL NEW: ${listAnd(earlier.map(({ booking }) => booking.confirmationCode || booking.hotelName))} ${earlier.length > 1 ? 'were' : 'was'} asked for a few minutes ago for the same guest and ${earlier.length > 1 ? 'are the bookings' : 'is the booking'} made then; the rest were booked now.`
|
|
248
|
+
: '',
|
|
249
|
+
notUsed?.said ?? '',
|
|
250
|
+
// ⚠️ BOOKED IS CONFIRMED: a stay still being confirmed is said as
|
|
251
|
+
// that, and not counted (总线程, 2026-10-14).
|
|
252
|
+
notBooked.length || (booked.length > 1 && waiting)
|
|
253
|
+
? `${booked.length - waiting} of ${booked.length + notBooked.length} stays booked${waiting ? `, ${waiting} being confirmed by the hotel - no code until it is` : ''}${notBooked.length ? `; ${notBooked.length === 1 ? 'one' : notBooked.length} could not be, said below` : ''} - what was booked stays booked.`
|
|
254
|
+
: '',
|
|
255
|
+
several
|
|
256
|
+
? `${booked.length} bookings, one for each stay - each hotel keeps its own nights under its own code, and each is ${holderOf(deps, first.booking.supplier).caps.changes ? 'changed or cancelled' : 'cancelled'} on its own.`
|
|
257
|
+
: '',
|
|
258
|
+
...booked.flatMap(({ booking, asked }) => [
|
|
259
|
+
`**${confirming(deps, booking) ? 'Being confirmed' : booking.confirmationCode}** · ${withZh(booking.hotelName, booking.hotelNames, ctx.noCards)} · ${stayWords(booking.stay, booking.hourly)}`,
|
|
260
|
+
// ⚠️ NOT ITS CANCELLATION TERMS (0.74.2, robin 11-17): a booking just made is said
|
|
261
|
+
// without them - they are said when the guest asks, or cancels (the preview).
|
|
262
|
+
ctx.noCards ? heldRoomsWords(booking, false) : '',
|
|
263
|
+
bookedLine(deps, booking),
|
|
264
|
+
bookingNotes(deps, booking),
|
|
265
|
+
...asked,
|
|
266
|
+
]),
|
|
267
|
+
...failedText,
|
|
268
|
+
// 0.84.0: what can be bought with a booking just made and confirmed (增值服务).
|
|
269
|
+
valueAddedLine(deps, t, ctx, booked.map(({ booking }) => booking), true),
|
|
270
|
+
remembered?.line ?? '',
|
|
271
|
+
others ? `The trip's other stays are still in it, not booked:\n${rest?.text ?? ''}` : '',
|
|
272
|
+
]
|
|
273
|
+
.filter(Boolean)
|
|
274
|
+
.join('\n'),
|
|
275
|
+
};
|
|
276
|
+
if (!termsPart)
|
|
277
|
+
return answer;
|
|
278
|
+
// Some stays booked in this call and some waiting for terms: both are said,
|
|
279
|
+
// the terms first, and the structure is the terms' view with the bookings in it.
|
|
280
|
+
return {
|
|
281
|
+
structured: { ...answer.structured, view: 'terms', ...termsPart.structured },
|
|
282
|
+
text: [termsPart.text, answer.text].join('\n\n'),
|
|
283
|
+
...(termsPart.meta ? { meta: { ...answer.meta, ...termsPart.meta } } : {}),
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Books the rooms in one slot of the trip store for a named guest - THE ONE
|
|
288
|
+
* BOOKING CODE, for the trip (`request_booking`, `store` the trip's own key)
|
|
289
|
+
* and for the picked room (`book_picked_room`, `store` its `pickedKey`).
|
|
290
|
+
*
|
|
291
|
+
* ⚠️ TWO KEYS, AND THEY ARE NOT THE SAME THING. `key` is the conversation's
|
|
292
|
+
* trip key: the signed-in member, the identity a booking is made as, the
|
|
293
|
+
* limits and every answer's `common` keep it. `store` is only where the LINES
|
|
294
|
+
* come from and where what was booked leaves from - so a pick is booked at the
|
|
295
|
+
* member rate and under the same limits, and the trip is never read or emptied.
|
|
296
|
+
* `nothingThere` is what is said when the slot is empty.
|
|
297
|
+
*/
|
|
298
|
+
export const bookTripLines = async (deps, t, ctx, key, store, args, nothingThere) => {
|
|
299
|
+
const inTrip = deps.trips.read(store);
|
|
300
|
+
if (inTrip.length === 0) {
|
|
301
|
+
return {
|
|
302
|
+
structured: { view: 'empty-trip', ...common(deps, key) },
|
|
303
|
+
text: nothingThere,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
// ⚠️ THE TRIP THE CARD DREW, OR NOTHING - see `stampOf`. The assistant books
|
|
307
|
+
// the trip as it is now (no stamp); a card's form books the one it showed.
|
|
308
|
+
const drawn = str(args.stamp);
|
|
309
|
+
if (drawn && drawn !== stampOf(inTrip, deps.trips.shown(store))) {
|
|
310
|
+
const again = await currentTrip(deps, key, identity(deps, ctx, key), store, undefined, ctx);
|
|
311
|
+
return {
|
|
312
|
+
...again,
|
|
313
|
+
structured: { ...again.structured, tripChanged: true },
|
|
314
|
+
text: [
|
|
315
|
+
'Nothing was booked: the trip changed after the card the guest pressed Book on was drawn - a stay was added, taken out or changed in this conversation, or its price moved. It is shown again as it is now; the guest checks it and presses Book again.',
|
|
316
|
+
again.text,
|
|
317
|
+
].join('\n\n'),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
// ⚠️ ONE GROUP AT A TIME, in a market: a booking cannot be all-or-nothing
|
|
321
|
+
// across two groups' systems (Marketplace, §6-1). `group` books one
|
|
322
|
+
// group's stays and leaves the rest in the trip.
|
|
323
|
+
const asked = deps.backend.suppliers ? place(args.group) : '';
|
|
324
|
+
const group = asked ? groupNamed(deps, asked) : undefined;
|
|
325
|
+
const groupOf = (l) => deps.backend.supplierOf?.(l.hotelId);
|
|
326
|
+
const lines = group ? inTrip.filter((l) => groupOf(l) === group.id) : inTrip;
|
|
327
|
+
if (asked && (!group || lines.length === 0)) {
|
|
328
|
+
const there = [...new Set(inTrip.map(groupOf))]
|
|
329
|
+
.map((id) => holderOf(deps, id).name)
|
|
330
|
+
.filter(Boolean);
|
|
331
|
+
const words = group
|
|
332
|
+
? `Nothing in the trip is with ${group.name}. It holds stays with ${listAnd(there)}.`
|
|
333
|
+
: `No hotel group here is called "${asked}". The trip holds stays with ${listAnd(there)}.`;
|
|
334
|
+
return {
|
|
335
|
+
structured: { view: 'error', ...common(deps, key), error: 'no-such-group', detail: words },
|
|
336
|
+
text: words,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
const guest = { name: str(args.name), email: str(args.email) };
|
|
340
|
+
// A phone where the backend needs one: a booking paid at the hotel and
|
|
341
|
+
// guaranteed by nobody, which the hotel has to be able to follow up.
|
|
342
|
+
// In a market, the trip's own groups decide - not whichever group needs most.
|
|
343
|
+
const phoneNeeded = deps.backend.suppliers
|
|
344
|
+
? lines.some((l) => !!holderOf(deps, deps.backend.supplierOf?.(l.hotelId)).caps.requiresPhone)
|
|
345
|
+
: !!(deps.backend.capabilities ?? FULL_CAPABILITIES).requiresPhone;
|
|
346
|
+
const phone = str(args.phone);
|
|
347
|
+
// ⚠️ A HIDDEN OR HALF EMAIL IS NO EMAIL (0.71.5, 总线程 11-13 P3 - `wholeEmail`): the
|
|
348
|
+
// account's masked `x•••@c•••.ai` passed back is turned away here, with the guest asked
|
|
349
|
+
// for the whole address - never handed to the terms page, never sent to the backend.
|
|
350
|
+
const halfEmail = !!guest.email && !wholeEmail(guest.email);
|
|
351
|
+
const missing = [
|
|
352
|
+
!guest.name && 'a name',
|
|
353
|
+
!guest.email ? 'an email' : halfEmail && 'a complete email',
|
|
354
|
+
phoneNeeded && phone.replace(/\D/g, '').length < 6 && 'a phone number',
|
|
355
|
+
// Too long is as unusable as missing - see GUEST_LIMITS.
|
|
356
|
+
...guestTooLong({ ...guest, phone }),
|
|
357
|
+
].filter((x) => typeof x === 'string');
|
|
358
|
+
if (missing.length) {
|
|
359
|
+
const said = missing.length > 1
|
|
360
|
+
? `${missing.slice(0, -1).join(', ')} and ${missing.at(-1)}`
|
|
361
|
+
: (missing[0] ?? '');
|
|
362
|
+
const detail = [
|
|
363
|
+
`The booking needs ${said}.`,
|
|
364
|
+
halfEmail
|
|
365
|
+
? maskedEmail(guest.email)
|
|
366
|
+
? 'The email given is hidden (it has "•" in it), not the guest\'s whole address - a masked email, such as the one an account answer shows, cannot be booked with.'
|
|
367
|
+
: 'The email given is not a whole email address (name@example.com).'
|
|
368
|
+
: '',
|
|
369
|
+
`Ask the guest for ${missing.length > 1 ? 'them' : 'it'}${halfEmail ? ' - their full email address, typed out' : ''} - do not use a ${phoneNeeded ? 'name, email or phone number' : 'name or email'} you know from anywhere else.`,
|
|
370
|
+
]
|
|
371
|
+
.filter(Boolean)
|
|
372
|
+
.join(' ');
|
|
373
|
+
return {
|
|
374
|
+
structured: {
|
|
375
|
+
view: 'needs-guest',
|
|
376
|
+
...common(deps, key),
|
|
377
|
+
missing,
|
|
378
|
+
...(halfEmail ? { emailRefused: true } : {}),
|
|
379
|
+
// What the text says, word for word - a host that reads only this has it too.
|
|
380
|
+
detail,
|
|
381
|
+
},
|
|
382
|
+
text: detail,
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
const { requests, dropped } = readRequests(args);
|
|
386
|
+
try {
|
|
387
|
+
const shown = deps.trips.shown(store);
|
|
388
|
+
const result = await deps.backend.requestBooking(
|
|
389
|
+
// The coupon the guest named, spent on the one stay it goes on - or
|
|
390
|
+
// nothing is booked (see `TripDraft.coupon`).
|
|
391
|
+
{
|
|
392
|
+
lines,
|
|
393
|
+
...(shown ? { shown } : {}),
|
|
394
|
+
...(couponOf(deps, args) ? { coupon: couponOf(deps, args) } : {}),
|
|
395
|
+
}, {
|
|
396
|
+
...guest,
|
|
397
|
+
...(str(args.phone) ? { phone: str(args.phone) } : {}),
|
|
398
|
+
...(requests?.note ? { notes: requests.note } : {}),
|
|
399
|
+
},
|
|
400
|
+
// ⚠️ THE SIGNED-IN MEMBER, NOT A HAND-BUILT IDENTITY. This read
|
|
401
|
+
// `{ sessionId, email }` and nothing else, so the booking was re-quoted
|
|
402
|
+
// with no member and written at the PUBLIC rate - after the card had
|
|
403
|
+
// shown the member rate, the saving, and the tier. A guest was quoted a
|
|
404
|
+
// discount and then booked without it, which is the one step where
|
|
405
|
+
// being wrong leaves a record (robin, 2026-09-21). `identity()` is the
|
|
406
|
+
// only place an Identity is built; the guest's email still overrides,
|
|
407
|
+
// because a booking is found by the address it was made with.
|
|
408
|
+
{ ...identity(deps, ctx, key), email: guest.email }, requests);
|
|
409
|
+
return await bookingAnswer(deps, t, ctx, key, store, args, inTrip, lines, shown, result, requests, dropped);
|
|
410
|
+
}
|
|
411
|
+
catch (err) {
|
|
412
|
+
const words = guestWords(err, BOOKING_FAULT);
|
|
413
|
+
// The price or terms moved since the guest saw them: nothing was booked,
|
|
414
|
+
// and the trip is shown again at today's - which is then what the guest
|
|
415
|
+
// has seen, and what a second ask books.
|
|
416
|
+
if (err.code === 'price-changed') {
|
|
417
|
+
const again = await currentTrip(deps, key, identity(deps, ctx, key), store, undefined, ctx);
|
|
418
|
+
// ⚠️ THE CODE REACHES THE CARD (`notBooked`, as the coupon's does): the trip is
|
|
419
|
+
// drawn again at today's price, and the card says why nothing was booked.
|
|
420
|
+
return {
|
|
421
|
+
...again,
|
|
422
|
+
structured: { ...again.structured, notBooked: 'price-changed' },
|
|
423
|
+
text: [words, again.text].join('\n\n'),
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
// The coupon asked for cannot be used: nothing was booked, and the trip
|
|
427
|
+
// is shown again with it refused and why - the guest decides what next.
|
|
428
|
+
if (err.code === 'coupon') {
|
|
429
|
+
// ⚠️ WITH THE CONTEXT, like every other answer of the trip (2026-11-03
|
|
430
|
+
// review, T1): without it the restated trip lost the Chinese room and
|
|
431
|
+
// hotel names a host with no card is given beside the plain ones.
|
|
432
|
+
const again = await currentTrip(deps, key, identity(deps, ctx, key), store, couponOf(deps, args), ctx);
|
|
433
|
+
return {
|
|
434
|
+
...again,
|
|
435
|
+
structured: { ...again.structured, notBooked: 'coupon' },
|
|
436
|
+
text: [words, again.text].join('\n\n'),
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
if (err.code === 'mixed-supplier') {
|
|
440
|
+
const again = await currentTrip(deps, key, identity(deps, ctx, key), store, undefined, ctx);
|
|
441
|
+
return {
|
|
442
|
+
...again,
|
|
443
|
+
text: [
|
|
444
|
+
words,
|
|
445
|
+
`${t.requestBooking} with \`group\` books one group's stays and leaves the others in the trip.`,
|
|
446
|
+
again.text,
|
|
447
|
+
].join('\n\n'),
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
// ⚠️ AS MANY BOOKINGS WITHOUT PAYMENT STAND AS MAY AT ONCE (0.77.5, `demoBooking`'s
|
|
451
|
+
// `maxOpen`): nothing was booked or sent - its own code and the number, so the card says it
|
|
452
|
+
// in the guest's language, with the bookings a press away.
|
|
453
|
+
if (err.code === 'open-orders') {
|
|
454
|
+
const max = Number(err.max);
|
|
455
|
+
return {
|
|
456
|
+
structured: {
|
|
457
|
+
view: 'error',
|
|
458
|
+
...common(deps, key),
|
|
459
|
+
error: 'open-orders',
|
|
460
|
+
detail: words,
|
|
461
|
+
...(Number.isInteger(max) && max > 0 ? { max } : {}),
|
|
462
|
+
},
|
|
463
|
+
text: words,
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
// The group's checkout's own refusals - signed out, a guest detail missing,
|
|
467
|
+
// terms gone - each with its own code (`BOOKING_REFUSALS`).
|
|
468
|
+
const refused = refusalAnswer(deps, key, err);
|
|
469
|
+
if (refused)
|
|
470
|
+
return refused;
|
|
471
|
+
return {
|
|
472
|
+
structured: {
|
|
473
|
+
view: 'error',
|
|
474
|
+
...common(deps, key),
|
|
475
|
+
// ⚠️ NOT KNOWN IS NOT "NOT BOOKED" (2026-10-29 audit, H2): the card
|
|
476
|
+
// said a fault as "could not be booked, try again later" - the one
|
|
477
|
+
// thing a guest must not do after a booking that may have gone through.
|
|
478
|
+
error: words === BOOKING_FAULT ? 'uncertain' : 'not-bookable',
|
|
479
|
+
detail: words,
|
|
480
|
+
},
|
|
481
|
+
text: words,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
//# sourceMappingURL=booking-answer.js.map
|
|
@@ -0,0 +1 @@
|
|
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AK,KAAK,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc;gBAC7D,MAAM,EAAE,KAAK;aACd;YACD,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buy-shop-item.d.ts","sourceRoot":"","sources":["../../src/tools/buy-shop-item.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAQ5C,eAAO,MAAM,iBAAiB,GAAU,8BAMrC,QAAQ,KAAG,OAAO,CAAC,UAAU,CAyC/B,CAAC"}
|
|
@@ -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,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AC;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":""}
|