@pisell/pisellos 2.2.222 → 2.2.224

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.
Files changed (61) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
  3. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
  4. package/dist/modules/Customer/index.d.ts +7 -0
  5. package/dist/modules/Customer/index.js +16 -0
  6. package/dist/modules/OpenData/index.d.ts +7 -0
  7. package/dist/modules/OpenData/index.js +16 -1
  8. package/dist/modules/Order/index.d.ts +43 -0
  9. package/dist/modules/Order/index.js +296 -112
  10. package/dist/modules/Order/types.d.ts +16 -0
  11. package/dist/modules/Order/utils.js +7 -4
  12. package/dist/modules/Payment/index.d.ts +7 -0
  13. package/dist/modules/Payment/index.js +12 -0
  14. package/dist/modules/ProductList/index.d.ts +7 -0
  15. package/dist/modules/ProductList/index.js +11 -0
  16. package/dist/modules/SalesSummary/index.d.ts +7 -0
  17. package/dist/modules/SalesSummary/index.js +61 -26
  18. package/dist/modules/Schedule/index.d.ts +7 -0
  19. package/dist/modules/Schedule/index.js +16 -0
  20. package/dist/modules/Summary/index.js +2 -1
  21. package/dist/server/modules/order/types.d.ts +2 -0
  22. package/dist/server/modules/order/utils/filterBookings.js +25 -2
  23. package/dist/server/utils/small-ticket.js +160 -30
  24. package/dist/solution/BaseSales/index.d.ts +17 -0
  25. package/dist/solution/BaseSales/index.js +524 -439
  26. package/dist/solution/BaseSales/utils/cartPromotion.js +24 -7
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/index.d.ts +0 -8
  29. package/dist/solution/BookingTicket/index.js +41 -75
  30. package/dist/types/index.d.ts +10 -0
  31. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  32. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
  33. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
  34. package/lib/modules/Customer/index.d.ts +7 -0
  35. package/lib/modules/Customer/index.js +12 -0
  36. package/lib/modules/OpenData/index.d.ts +7 -0
  37. package/lib/modules/OpenData/index.js +13 -1
  38. package/lib/modules/Order/index.d.ts +43 -0
  39. package/lib/modules/Order/index.js +145 -3
  40. package/lib/modules/Order/types.d.ts +16 -0
  41. package/lib/modules/Order/utils.js +6 -2
  42. package/lib/modules/Payment/index.d.ts +7 -0
  43. package/lib/modules/Payment/index.js +9 -0
  44. package/lib/modules/ProductList/index.d.ts +7 -0
  45. package/lib/modules/ProductList/index.js +9 -0
  46. package/lib/modules/SalesSummary/index.d.ts +7 -0
  47. package/lib/modules/SalesSummary/index.js +15 -1
  48. package/lib/modules/Schedule/index.d.ts +7 -0
  49. package/lib/modules/Schedule/index.js +12 -0
  50. package/lib/modules/Summary/index.js +2 -1
  51. package/lib/server/modules/order/types.d.ts +2 -0
  52. package/lib/server/modules/order/utils/filterBookings.js +17 -2
  53. package/lib/server/utils/small-ticket.js +141 -32
  54. package/lib/solution/BaseSales/index.d.ts +17 -0
  55. package/lib/solution/BaseSales/index.js +48 -10
  56. package/lib/solution/BaseSales/utils/cartPromotion.js +28 -2
  57. package/lib/solution/BookingByStep/index.d.ts +1 -1
  58. package/lib/solution/BookingTicket/index.d.ts +0 -8
  59. package/lib/solution/BookingTicket/index.js +0 -12
  60. package/lib/types/index.d.ts +10 -0
  61. package/package.json +1 -1
@@ -309,6 +309,19 @@ export interface UpdateOrderProductParams {
309
309
  product_sku?: OrderProductSku;
310
310
  product_bundle?: any[];
311
311
  booking?: AddProductBookingInput;
312
+ /**
313
+ * 预约时间 / 时长变更后允许使用本次报价覆盖已落库订单行历史价。
314
+ *
315
+ * @example
316
+ * await order.updateOrderProduct({
317
+ * product_id: 1,
318
+ * product_variant_id: 0,
319
+ * updates: { selling_price: '6.00', metadata: { source_product_price: '6.00' } },
320
+ * booking: { duration: 2 },
321
+ * allow_booking_reprice: true,
322
+ * });
323
+ */
324
+ allow_booking_reprice?: boolean;
312
325
  }
313
326
  /** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
314
327
  export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
@@ -436,6 +449,8 @@ export interface PaymentItemData {
436
449
  type: string;
437
450
  /** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
438
451
  payment_time?: string;
452
+ /** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
453
+ created_at?: string;
439
454
  /** @deprecated BaseSales/Sales 协议不提交该字段;旧 Checkout/Payment 内部仍可能使用 */
440
455
  isSynced?: boolean;
441
456
  }
@@ -470,6 +485,7 @@ export interface OrderPaymentData {
470
485
  amount?: string;
471
486
  };
472
487
  order_payment_type?: 'normal' | 'deposit';
488
+ /** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
473
489
  created_at?: string;
474
490
  updated_at?: string;
475
491
  }
@@ -677,7 +677,7 @@ function normalizeSubmitProduct(product) {
677
677
  payment_price: (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
678
678
  });
679
679
  }
680
- var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type'];
680
+ var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
681
681
  export function normalizeBookingIsAll(booking) {
682
682
  return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
683
683
  }
@@ -896,7 +896,7 @@ export function buildSubmitPayload(params) {
896
896
  });
897
897
  }
898
898
  export function mapPaymentItemToOrderPayment(paymentItem) {
899
- var _item$custom_payment_, _item$payment_time, _item$amount;
899
+ var _item$custom_payment_, _item$payment_time, _item$created_at, _item$amount;
900
900
  var item = paymentItem;
901
901
  var customPaymentId = (_item$custom_payment_ = item.custom_payment_id) !== null && _item$custom_payment_ !== void 0 ? _item$custom_payment_ : item.id;
902
902
  var metadata = item.metadata && _typeof(item.metadata) === 'object' ? _objectSpread({}, item.metadata) : {};
@@ -910,7 +910,9 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
910
910
  metadata[key] = item[key];
911
911
  }
912
912
  }
913
- var paymentTime = (_item$payment_time = item.payment_time) !== null && _item$payment_time !== void 0 ? _item$payment_time : dayjs().format('YYYY-MM-DD HH:mm:ss');
913
+ var timestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
914
+ var paymentTime = (_item$payment_time = item.payment_time) !== null && _item$payment_time !== void 0 ? _item$payment_time : timestamp;
915
+ var createdAt = (_item$created_at = item.created_at) !== null && _item$created_at !== void 0 ? _item$created_at : timestamp;
914
916
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, item.order_payment_id !== undefined ? {
915
917
  order_payment_id: item.order_payment_id
916
918
  } : {}), {}, {
@@ -928,7 +930,8 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
928
930
  } : {}), item.status !== undefined ? {
929
931
  status: item.status
930
932
  } : {}), {}, {
931
- payment_time: paymentTime
933
+ payment_time: paymentTime,
934
+ created_at: createdAt
932
935
  }, item.wallet_pass_usage_unit !== undefined ? {
933
936
  wallet_pass_usage_unit: item.wallet_pass_usage_unit
934
937
  } : {}), item.wallet_pass_use_value !== undefined ? {
@@ -33,6 +33,13 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
33
33
  private runVoucherUpdateLocked;
34
34
  private normalizeVoucherPaymentItems;
35
35
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
36
+ /**
37
+ * 更新父级解决方案透传的运行态参数,主要用于日志父模块等上下文。
38
+ *
39
+ * @example
40
+ * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
41
+ */
42
+ updateOtherParams(params: Record<string, any>): void;
36
43
  /**
37
44
  * 记录信息日志
38
45
  */
@@ -217,6 +217,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
217
217
  }
218
218
  return initialize;
219
219
  }()
220
+ /**
221
+ * 更新父级解决方案透传的运行态参数,主要用于日志父模块等上下文。
222
+ *
223
+ * @example
224
+ * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
225
+ */
226
+ }, {
227
+ key: "updateOtherParams",
228
+ value: function updateOtherParams(params) {
229
+ this.otherParams = params || {};
230
+ }
231
+
220
232
  /**
221
233
  * 记录信息日志
222
234
  */
@@ -10,6 +10,13 @@ export declare class ProductList extends BaseModule implements Module {
10
10
  private otherParams;
11
11
  constructor(name?: string, version?: string);
12
12
  initialize(core: PisellCore, options: any): Promise<void>;
13
+ /**
14
+ * 更新运行态参数,供父级解决方案 setOtherParams 后同步查询上下文。
15
+ *
16
+ * @example
17
+ * productList.updateOtherParams({ channel: 'pos' });
18
+ */
19
+ updateOtherParams(params: Record<string, any>): void;
13
20
  storeChange(path?: string, value?: any): Promise<void>;
14
21
  loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
15
22
  category_ids?: number[];
@@ -64,6 +64,17 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
64
64
  }
65
65
  return initialize;
66
66
  }()
67
+ /**
68
+ * 更新运行态参数,供父级解决方案 setOtherParams 后同步查询上下文。
69
+ *
70
+ * @example
71
+ * productList.updateOtherParams({ channel: 'pos' });
72
+ */
73
+ }, {
74
+ key: "updateOtherParams",
75
+ value: function updateOtherParams(params) {
76
+ this.otherParams = params || {};
77
+ }
67
78
  }, {
68
79
  key: "storeChange",
69
80
  value: function () {
@@ -11,6 +11,13 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
11
11
  private surchargeListModuleName;
12
12
  constructor(name?: string, version?: string);
13
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
14
+ /**
15
+ * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
16
+ *
17
+ * @example
18
+ * await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
19
+ */
20
+ updateOtherParams(params: Record<string, any>): Promise<void>;
14
21
  getSurchargeList(): Promise<void>;
15
22
  private getAppData;
16
23
  private getTaxConfig;
@@ -85,27 +85,62 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
85
85
  }
86
86
  return initialize;
87
87
  }()
88
+ /**
89
+ * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
90
+ *
91
+ * @example
92
+ * await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
93
+ */
94
+ }, {
95
+ key: "updateOtherParams",
96
+ value: (function () {
97
+ var _updateOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
98
+ var nextSurchargeListModuleName;
99
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
100
+ while (1) switch (_context2.prev = _context2.next) {
101
+ case 0:
102
+ nextSurchargeListModuleName = (params === null || params === void 0 ? void 0 : params.surchargeListModuleName) || 'surchargeList';
103
+ if (!(nextSurchargeListModuleName === this.surchargeListModuleName)) {
104
+ _context2.next = 3;
105
+ break;
106
+ }
107
+ return _context2.abrupt("return");
108
+ case 3:
109
+ this.surchargeListModuleName = nextSurchargeListModuleName;
110
+ _context2.next = 6;
111
+ return this.getSurchargeList();
112
+ case 6:
113
+ case "end":
114
+ return _context2.stop();
115
+ }
116
+ }, _callee2, this);
117
+ }));
118
+ function updateOtherParams(_x3) {
119
+ return _updateOtherParams.apply(this, arguments);
120
+ }
121
+ return updateOtherParams;
122
+ }())
88
123
  }, {
89
124
  key: "getSurchargeList",
90
125
  value: function () {
91
- var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
126
+ var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
92
127
  var surchargeListModule, surchargeList;
93
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
94
- while (1) switch (_context2.prev = _context2.next) {
128
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
129
+ while (1) switch (_context3.prev = _context3.next) {
95
130
  case 0:
96
- _context2.prev = 0;
131
+ _context3.prev = 0;
97
132
  surchargeListModule = this.core.getModule(this.surchargeListModuleName);
98
133
  if (!(surchargeListModule !== null && surchargeListModule !== void 0 && surchargeListModule.getSurchargeList)) {
99
- _context2.next = 7;
134
+ _context3.next = 7;
100
135
  break;
101
136
  }
102
- _context2.next = 5;
137
+ _context3.next = 5;
103
138
  return surchargeListModule.getSurchargeList();
104
139
  case 5:
105
- this.store.surchargeList = _context2.sent;
106
- return _context2.abrupt("return");
140
+ this.store.surchargeList = _context3.sent;
141
+ return _context3.abrupt("return");
107
142
  case 7:
108
- _context2.next = 9;
143
+ _context3.next = 9;
109
144
  return this.request.get('/order/custom-surcharge/available/v2', {
110
145
  // TODO 真实的渠道
111
146
  channel: 'online-store',
@@ -114,20 +149,20 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
114
149
  with: ['relationSchedule']
115
150
  });
116
151
  case 9:
117
- surchargeList = _context2.sent;
152
+ surchargeList = _context3.sent;
118
153
  this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
119
- _context2.next = 17;
154
+ _context3.next = 17;
120
155
  break;
121
156
  case 13:
122
- _context2.prev = 13;
123
- _context2.t0 = _context2["catch"](0);
124
- console.warn('[SalesSummaryModule] 加载附加费配置失败', _context2.t0);
157
+ _context3.prev = 13;
158
+ _context3.t0 = _context3["catch"](0);
159
+ console.warn('[SalesSummaryModule] 加载附加费配置失败', _context3.t0);
125
160
  this.store.surchargeList = [];
126
161
  case 17:
127
162
  case "end":
128
- return _context2.stop();
163
+ return _context3.stop();
129
164
  }
130
- }, _callee2, this, [[0, 13]]);
165
+ }, _callee3, this, [[0, 13]]);
131
166
  }));
132
167
  function getSurchargeList() {
133
168
  return _getSurchargeList.apply(this, arguments);
@@ -157,18 +192,18 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
157
192
  }, {
158
193
  key: "getSummary",
159
194
  value: function () {
160
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
161
- var _ref;
195
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
196
+ var _this$store$surcharge, _ref;
162
197
  var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
163
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
164
- while (1) switch (_context3.prev = _context3.next) {
198
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
199
+ while (1) switch (_context4.prev = _context4.next) {
165
200
  case 0:
166
201
  _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount;
167
202
  taxConfig = this.getTaxConfig();
168
203
  summarySchedule = this.core.getModule("".concat(this.name.split('_')[0], "_schedule"));
169
- needScheduleIds = this.store.surchargeList.map(function (item) {
204
+ needScheduleIds = (_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
170
205
  return item.available_schedule_ids;
171
- }).flat();
206
+ })) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat();
172
207
  scheduleList = summarySchedule === null || summarySchedule === void 0 ? void 0 : summarySchedule.getScheduleListByIds(needScheduleIds);
173
208
  scheduleById = {};
174
209
  if (Array.isArray(scheduleList)) {
@@ -198,14 +233,14 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
198
233
  tax_rate: taxRate !== null && taxRate !== void 0 ? taxRate : taxConfig.taxRate
199
234
  });
200
235
  this.store.summary = summaryWithTaxMeta;
201
- return _context3.abrupt("return", summaryWithTaxMeta);
236
+ return _context4.abrupt("return", summaryWithTaxMeta);
202
237
  case 11:
203
238
  case "end":
204
- return _context3.stop();
239
+ return _context4.stop();
205
240
  }
206
- }, _callee3, this);
241
+ }, _callee4, this);
207
242
  }));
208
- function getSummary(_x3) {
243
+ function getSummary(_x4) {
209
244
  return _getSummary.apply(this, arguments);
210
245
  }
211
246
  return getSummary;
@@ -11,6 +11,13 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
11
11
  private fatherModule;
12
12
  constructor(name?: string, version?: string);
13
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
14
+ /**
15
+ * 更新父级解决方案透传的运行态参数,并刷新 schedule 缓存写入配置。
16
+ *
17
+ * @example
18
+ * scheduleModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' });
19
+ */
20
+ updateOtherParams(params: Record<string, any>): void;
14
21
  /**
15
22
  * 加载当前店铺下所有 schedule
16
23
  *
@@ -93,6 +93,22 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
93
93
  }
94
94
  return initialize;
95
95
  }()
96
+ /**
97
+ * 更新父级解决方案透传的运行态参数,并刷新 schedule 缓存写入配置。
98
+ *
99
+ * @example
100
+ * scheduleModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' });
101
+ */
102
+ }, {
103
+ key: "updateOtherParams",
104
+ value: function updateOtherParams(params) {
105
+ var _otherParams$openCach;
106
+ var otherParams = params || {};
107
+ this.openCache = (_otherParams$openCach = otherParams.openCache) !== null && _otherParams$openCach !== void 0 ? _otherParams$openCach : false;
108
+ this.cacheId = otherParams.cacheId;
109
+ this.fatherModule = otherParams.fatherModule;
110
+ }
111
+
96
112
  /**
97
113
  * 加载当前店铺下所有 schedule
98
114
  *
@@ -208,9 +208,10 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
208
208
  }, {
209
209
  key: "getSurchargeforUtils",
210
210
  value: function getSurchargeforUtils(items) {
211
+ var _this$store$surcharge2;
211
212
  // const surchargeList = this.store.surchargeList;
212
213
  var scheduleModule = this.core.getModule('appointmentBooking_schedule');
213
- var needScheduleIds = this.store.surchargeList.map(function (item) {
214
+ var needScheduleIds = (_this$store$surcharge2 = this.store.surchargeList) === null || _this$store$surcharge2 === void 0 ? void 0 : _this$store$surcharge2.map(function (item) {
214
215
  return item.available_schedule_ids;
215
216
  }).flat();
216
217
  var scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
@@ -241,6 +241,8 @@ export interface OrderPaymentItem {
241
241
  status?: OrderPaymentRecordStatus;
242
242
  /** 支付时间(输入/输出均保留)。来源:OrderPayment.payment_time */
243
243
  payment_time?: string | null;
244
+ /** 支付创建时间(输入/输出均保留)。来源:OrderPayment.created_at */
245
+ created_at?: string | null;
244
246
  /** 手续费配置。来源:OrderPayment.service_charge */
245
247
  service_charge?: Record<string, unknown> | null;
246
248
  /** Wallet Pass 使用单位 */
@@ -54,6 +54,29 @@ function bookingDateTimeString(datePart, timePart) {
54
54
  }
55
55
  return "".concat(d, " ").concat(t).trim();
56
56
  }
57
+
58
+ /**
59
+ * 解析预约自身的起止时间区间,供 `sales_time_between` 做区间重叠匹配。
60
+ *
61
+ * @example
62
+ * const span = resolveBookingTimeRange({ start_date: '2026-06-09', start_time: '10:00', end_date: '2026-06-15', end_time: '10:00' })
63
+ */
64
+ function resolveBookingTimeRange(booking) {
65
+ var start = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
66
+ if (!start) return null;
67
+ var end = toTimestamp(bookingDateTimeString(booking.end_date || booking.start_date, booking.end_time || booking.start_time)) || start;
68
+ return end >= start ? [start, end] : [end, start];
69
+ }
70
+
71
+ /**
72
+ * 判断两个闭区间是否有交集。
73
+ *
74
+ * @example
75
+ * isRangeOverlapping([1, 10], [5, 6]) // true
76
+ */
77
+ function isRangeOverlapping(left, right) {
78
+ return left[0] <= right[1] && left[1] >= right[0];
79
+ }
57
80
  function parseDateRange(range) {
58
81
  if (!Array.isArray(range) || range.length < 2) return null;
59
82
  var start = toRangeBoundary(range[0], false);
@@ -160,8 +183,8 @@ function matchBooking(booking, orderInfo, ctx) {
160
183
  }
161
184
  if (ctx.appointmentStatusSet && !ctx.appointmentStatusSet.has(getBookingAppointmentStatus(booking))) return false;
162
185
  if (ctx.bookingTimeRange) {
163
- var ts = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
164
- if (ts < ctx.bookingTimeRange[0] || ts > ctx.bookingTimeRange[1]) return false;
186
+ var bookingRange = resolveBookingTimeRange(booking);
187
+ if (!bookingRange || !isRangeOverlapping(bookingRange, ctx.bookingTimeRange)) return false;
165
188
  }
166
189
  if (ctx.afterExecutionTimeMs != null) {
167
190
  var bookingStartMs = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));