@curless/hotel-storefront 0.74.0 → 0.74.2
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 +5 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +34 -10
- package/dist/account/index.js.map +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/otaless/backend.d.ts.map +1 -1
- package/dist/otaless/backend.js +48 -11
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/booking.d.ts +32 -3
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +172 -18
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +5 -2
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +8 -4
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +9 -0
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +10 -3
- package/dist/otaless/fake.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -2
- package/dist/server.js.map +1 -1
- package/dist/surface.js +4 -4
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +72 -25
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -152,7 +152,10 @@ export const withheldTools = (n, caps) => new Set([
|
|
|
152
152
|
// listed only where the backend says it has them, and never where nothing
|
|
153
153
|
// can be booked.
|
|
154
154
|
...(caps.groupCheckout && !caps.readOnly ? [] : [n.acceptTerms]),
|
|
155
|
-
|
|
155
|
+
// ⚠️ NO REFUND TOOL BESIDE CANCEL (0.74.2, robin 11-17: 「这个申请退款和取消有什么区别,应该留
|
|
156
|
+
// 一个取消就好了吧」): a paid booking's money is asked back by cancelling it (`caps.refunds`
|
|
157
|
+
// now says that), so a guest - or a model - never has two ways out of one booking.
|
|
158
|
+
n.refundBooking,
|
|
156
159
|
...(caps.addons && !caps.readOnly ? [] : [n.listBookingAddons, n.addBookingAddon]),
|
|
157
160
|
// Nothing can be booked here yet (`readOnly`, Otaless 2026-11-03): no tool
|
|
158
161
|
// that books, finds, changes or cancels a booking - the card's own two
|
|
@@ -367,6 +370,13 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
367
370
|
};
|
|
368
371
|
}
|
|
369
372
|
}
|
|
373
|
+
// ⚠️ ONE CANCEL, WHICH ASKS THE REFUND TOO (0.74.2, robin 11-17): said by the tool
|
|
374
|
+
// itself, for the model in every client - there is no refund tool to reach for.
|
|
375
|
+
if (t.name === n.cancelBooking && caps.refunds && !caps.readOnly)
|
|
376
|
+
out = {
|
|
377
|
+
...out,
|
|
378
|
+
description: `${out.description} A booking already paid: cancelling it also asks the hotel group for all of what was paid back, in the same step - there is no separate refund; the group reviews it and returns it to the card it was paid with, and the answer says what became of the request.`,
|
|
379
|
+
};
|
|
370
380
|
return out;
|
|
371
381
|
});
|
|
372
382
|
};
|
|
@@ -1295,6 +1305,12 @@ const CANCEL_SCHEMA = {
|
|
|
1295
1305
|
feeIsCap: BOOL,
|
|
1296
1306
|
reason: STR,
|
|
1297
1307
|
steps: ARR,
|
|
1308
|
+
/** Paid, at a group that refunds: confirming also asks all of `amount` back (0.74.2). */
|
|
1309
|
+
refundWithCancel: {
|
|
1310
|
+
type: 'object',
|
|
1311
|
+
properties: { amount: STR, supplier: STR },
|
|
1312
|
+
required: ['amount'],
|
|
1313
|
+
},
|
|
1298
1314
|
},
|
|
1299
1315
|
required: ['view'],
|
|
1300
1316
|
};
|
|
@@ -2082,21 +2098,21 @@ const holderOf = (deps, supplier) => {
|
|
|
2082
2098
|
};
|
|
2083
2099
|
};
|
|
2084
2100
|
/**
|
|
2085
|
-
* ⚠️ A
|
|
2086
|
-
*
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
* …and a booking that is gone or not known (0.67.0, 总线程 11-12, from the gracious-hugle
|
|
2096
|
-
* session's 0.67.0): cancelled, lapsed, failed, or with a person. The integration's release
|
|
2097
|
-
* keeps a held order's line terms - nobody agreed to them, and nobody needs them now.
|
|
2101
|
+
* ⚠️ A BOOKING MADE CARRIES NO CANCELLATION TERMS, TO THE CARD OR THE MODEL (0.74.2, robin
|
|
2102
|
+
* 11-17: 「成功页不需要显示,取消的时候显示就行」). Atour's 8 answered its `cancelPolicy` with its test
|
|
2103
|
+
* system's own notes - 「Confirming books the stay and pays it at once … refund_atour_booking files
|
|
2104
|
+
* the request …」, a tool's name in it - and the booked page drew them under the room, word for
|
|
2105
|
+
* word. A booking's terms are said where it is cancelled: the cancellation preview reads them
|
|
2106
|
+
* from the order itself (`rule`), as the group gave them. The order keeps them (`QuoteLine.terms`,
|
|
2107
|
+
* the check that they are the ones the guest agreed to included); only this shape drops them.
|
|
2108
|
+
*
|
|
2109
|
+
* (0.67.0, 总线程's review of 0.66.0, 5: a held booking's new terms were a stranger's text in the
|
|
2110
|
+
* structure the model reads - they reach the card as the terms to agree to, `TERMS_META_KEY`.)
|
|
2098
2111
|
*/
|
|
2099
|
-
const
|
|
2112
|
+
const heldQuoteForCard = (_b, q) => ({
|
|
2113
|
+
...q,
|
|
2114
|
+
lines: q.lines.map(({ terms: _terms, ...rest }) => rest),
|
|
2115
|
+
});
|
|
2100
2116
|
/**
|
|
2101
2117
|
* What was made, in one sentence - which depends on what asking MAKES here.
|
|
2102
2118
|
*
|
|
@@ -2178,6 +2194,17 @@ const paidFactsOf = (booked, preview) => {
|
|
|
2178
2194
|
* is said here, and a cancelled stay by what the cancellation kept (`fee`,
|
|
2179
2195
|
* the hotel's own figure where it gave one).
|
|
2180
2196
|
*/
|
|
2197
|
+
/**
|
|
2198
|
+
* A refund asked of the hotel group (`groupReviews`, Otaless 9.1 - 0.74.2, robin 11-17 through
|
|
2199
|
+
* 总线程): submitted, and back on the card it was paid with once the group has reviewed it -
|
|
2200
|
+
* or, held up, not submitted at all: the booking stays cancelled and a person takes it up.
|
|
2201
|
+
* Undefined for any other refund.
|
|
2202
|
+
*/
|
|
2203
|
+
const groupRefundWords = (p, group, back, whole, amount) => !p.groupReviews
|
|
2204
|
+
? undefined
|
|
2205
|
+
: p.refundStuck
|
|
2206
|
+
? `The refund of the ${amount} paid was NOT submitted: ${group} did not take the request, so nothing is on its way back yet. The cancellation stands; a person here is taking the refund up with ${group}.`
|
|
2207
|
+
: `A refund of ${whole ? `all ${back}` : `${back} of the ${amount} paid`} has been submitted to ${group}: once ${group} has reviewed it, it goes back to the card it was paid with.`;
|
|
2181
2208
|
const paidLine = (deps, b, fee) => {
|
|
2182
2209
|
const p = b.payment;
|
|
2183
2210
|
if (!p)
|
|
@@ -2219,9 +2246,10 @@ const paidLine = (deps, b, fee) => {
|
|
|
2219
2246
|
: `What of the ${amount} paid comes back depends on ${h.name}'s cancellation fee, which a person here is confirming.`;
|
|
2220
2247
|
}
|
|
2221
2248
|
case 'refunding':
|
|
2222
|
-
return p.
|
|
2223
|
-
|
|
2224
|
-
|
|
2249
|
+
return (groupRefundWords(p, h.name, back, whole, amount) ??
|
|
2250
|
+
(p.refundStuck
|
|
2251
|
+
? `${back} is due back to the card it was paid with${p.refundReason ? ` - ${p.refundReason}` : ''}. Sending it back did not go through, and a person is seeing to it.`
|
|
2252
|
+
: `${whole ? `All ${back}` : `${back} of the ${amount} paid`} is going back to the card it was paid with${p.refundReason ? ` - ${p.refundReason}` : ''}.`));
|
|
2225
2253
|
case 'refunded':
|
|
2226
2254
|
return `${whole ? `All ${back}` : `${back} of the ${amount} paid`} has gone back to the card it was paid with${p.refundReason ? ` - ${p.refundReason}` : ''}.`;
|
|
2227
2255
|
case 'hotel-refunds':
|
|
@@ -2270,9 +2298,10 @@ const paidLine = (deps, b, fee) => {
|
|
|
2270
2298
|
case 'lapsed':
|
|
2271
2299
|
return 'Not paid in time: nothing was booked and nothing was charged.';
|
|
2272
2300
|
case 'refunding':
|
|
2273
|
-
return p.
|
|
2274
|
-
|
|
2275
|
-
|
|
2301
|
+
return (groupRefundWords(p, h.name, back, whole, amount) ??
|
|
2302
|
+
(p.refundStuck
|
|
2303
|
+
? `${back} is due back to the card it was paid with${p.refundReason ? ` - ${p.refundReason}` : ''}. Sending it back did not go through, and a person is seeing to it.`
|
|
2304
|
+
: `${whole ? `All ${back}` : `${back} of the ${amount} paid`} is going back to the card it was paid with${p.refundReason ? ` - ${p.refundReason}` : ''}.`));
|
|
2276
2305
|
case 'refunded':
|
|
2277
2306
|
return `${whole ? `All ${back}` : `${back} of the ${amount} paid`} has gone back to the card it was paid with${p.refundReason ? ` - ${p.refundReason}` : ''}.`;
|
|
2278
2307
|
case 'hotel-refunds':
|
|
@@ -3563,7 +3592,11 @@ const paymentWords = (b) => {
|
|
|
3563
3592
|
? 'cancelled after its free time - the fee was the whole amount paid, and nothing goes back'
|
|
3564
3593
|
: 'cancelled - what comes back of it depends on the cancellation fee, which a person is settling';
|
|
3565
3594
|
if (p.status === 'refunding' && p.refundStuck)
|
|
3566
|
-
return
|
|
3595
|
+
return p.groupReviews
|
|
3596
|
+
? 'cancelled - the refund was not submitted to the group; a person is taking it up'
|
|
3597
|
+
: 'due back to the card it was paid with - sending it back did not go through, and a person is seeing to it';
|
|
3598
|
+
if (p.status === 'refunding' && p.groupReviews)
|
|
3599
|
+
return `refund of ${p.refundAmount && p.refundAmount.minor !== p.amount.minor ? formatMoney(p.refundAmount) : `all ${formatMoney(p.amount)}`} submitted - back to the card it was paid with once the group has reviewed it`;
|
|
3567
3600
|
if ((p.status === 'refunding' || p.status === 'refunded') &&
|
|
3568
3601
|
p.refundAmount &&
|
|
3569
3602
|
p.refundAmount.minor !== p.amount.minor)
|
|
@@ -3578,9 +3611,9 @@ const paymentWords = (b) => {
|
|
|
3578
3611
|
* the same conversation a model fills in the room from what came before, but
|
|
3579
3612
|
* a booking looked up later by its code had no room and no terms beside it.
|
|
3580
3613
|
*/
|
|
3581
|
-
const heldRoomsWords = (b) => b.quote.lines
|
|
3614
|
+
const heldRoomsWords = (b, terms = true) => b.quote.lines
|
|
3582
3615
|
.filter((l) => l.kind === 'room')
|
|
3583
|
-
.map((l) => `${(l.quantity ?? 1) > 1 ? `${l.quantity}× ` : ''}${withZh(l.title, l.titleNames, true)}${b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed'
|
|
3616
|
+
.map((l) => `${(l.quantity ?? 1) > 1 ? `${l.quantity}× ` : ''}${withZh(l.title, l.titleNames, true)}${!terms || b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed'
|
|
3584
3617
|
? ''
|
|
3585
3618
|
: l.freeCancellationUntil
|
|
3586
3619
|
? `, free to cancel until ${freeUntilText(l)}`
|
|
@@ -6373,7 +6406,9 @@ const bookingAnswer = async (deps, t, ctx, key, store, args, inTrip, lines, show
|
|
|
6373
6406
|
: '',
|
|
6374
6407
|
...booked.flatMap(({ booking, asked }) => [
|
|
6375
6408
|
`**${confirming(deps, booking) ? 'Being confirmed' : booking.confirmationCode}** · ${withZh(booking.hotelName, booking.hotelNames, ctx.noCards)} · ${stayWords(booking.stay, booking.hourly)}`,
|
|
6376
|
-
|
|
6409
|
+
// ⚠️ NOT ITS CANCELLATION TERMS (0.74.2, robin 11-17): a booking just made is said
|
|
6410
|
+
// without them - they are said when the guest asks, or cancels (the preview).
|
|
6411
|
+
ctx.noCards ? heldRoomsWords(booking, false) : '',
|
|
6377
6412
|
bookedLine(deps, booking),
|
|
6378
6413
|
bookingNotes(deps, booking),
|
|
6379
6414
|
...asked,
|
|
@@ -8467,6 +8502,14 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8467
8502
|
// Money already paid here, and what comes back: see `paidFactsOf`.
|
|
8468
8503
|
// ⚠️ NOT WHEN THE FEE IS NOT KNOWN: what comes back is then the group's to say.
|
|
8469
8504
|
const paid = preview.feeUnknown ? undefined : paidFactsOf(booked, preview);
|
|
8505
|
+
// ⚠️ THE REFUND IS PART OF THIS YES (0.74.2, robin 11-17: one Cancel): a booking paid here
|
|
8506
|
+
// at a group that refunds (`caps.refunds`) is cancelled AND its money asked back by the one
|
|
8507
|
+
// confirmation - said before it is given, with what was paid and who reviews it.
|
|
8508
|
+
const refundAsked = booked?.payment?.status === 'paid' &&
|
|
8509
|
+
preview.cancellable &&
|
|
8510
|
+
holderOf(deps, preview.supplier).caps.refunds === true
|
|
8511
|
+
? { amount: formatMoney(booked.payment.amount), supplier: preview.supplier }
|
|
8512
|
+
: undefined;
|
|
8470
8513
|
const asPreview = {
|
|
8471
8514
|
structured: {
|
|
8472
8515
|
view: 'cancellation-preview',
|
|
@@ -8527,6 +8570,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8527
8570
|
}
|
|
8528
8571
|
: {}),
|
|
8529
8572
|
toolToConfirm: t.cancelBooking,
|
|
8573
|
+
...(refundAsked ? { refundWithCancel: refundAsked } : {}),
|
|
8530
8574
|
// Whether cancelling hands the coupon back - the same sentence as the text.
|
|
8531
8575
|
...(preview.coupon
|
|
8532
8576
|
? {
|
|
@@ -8545,6 +8589,9 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8545
8589
|
preview.coupon
|
|
8546
8590
|
? couponBackWords(preview.coupon, formatMoney(preview.fee), false, holderOf(deps, preview.supplier).notReal)
|
|
8547
8591
|
: '',
|
|
8592
|
+
refundAsked
|
|
8593
|
+
? `It was paid (${refundAsked.amount}): cancelling it also asks ${holderOf(deps, preview.supplier).name} for all of that back, in the same step - ${holderOf(deps, preview.supplier).name} reviews it and returns it to the card it was paid with.`
|
|
8594
|
+
: '',
|
|
8548
8595
|
preview.cancellable
|
|
8549
8596
|
? `Say the word and it is cancelled (${t.cancelBooking} with \`confirmed\`).`
|
|
8550
8597
|
: '',
|