@pisell/pisellos 2.2.200 → 2.2.202

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.
@@ -141,6 +141,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
141
141
  private extractOrderIdFromSubmitResult;
142
142
  private calculatePaymentEffectiveAmount;
143
143
  private calculatePaymentTotal;
144
+ private getDepositAmount;
145
+ private isDepositOrder;
146
+ private getOrderExpectedAmount;
147
+ private isDepositCovered;
144
148
  private normalizePaymentSource;
145
149
  private updateTempOrderPaymentStatus;
146
150
  private shouldKeepPaymentStatusAfterAmountRecalc;
@@ -1123,14 +1123,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1123
1123
  return sum.plus(_this3.calculatePaymentEffectiveAmount(payment));
1124
1124
  }, new Decimal(0));
1125
1125
  }
1126
+ }, {
1127
+ key: "getDepositAmount",
1128
+ value: function getDepositAmount(tempOrder, summary) {
1129
+ return new Decimal(summary.deposit_amount || tempOrder.deposit_amount || '0.00');
1130
+ }
1131
+ }, {
1132
+ key: "isDepositOrder",
1133
+ value: function isDepositOrder(tempOrder, depositAmount) {
1134
+ return tempOrder.is_deposit === 1 || depositAmount.gt(0);
1135
+ }
1136
+ }, {
1137
+ key: "getOrderExpectedAmount",
1138
+ value: function getOrderExpectedAmount(summary) {
1139
+ return new Decimal(summary.expect_amount || summary.total_amount || 0);
1140
+ }
1141
+ }, {
1142
+ key: "isDepositCovered",
1143
+ value: function isDepositCovered(params) {
1144
+ var depositAmount = this.getDepositAmount(params.tempOrder, params.summary);
1145
+ if (!this.isDepositOrder(params.tempOrder, depositAmount)) return false;
1146
+ if (depositAmount.lte(0)) return false;
1147
+ return params.paidAmount.gte(depositAmount);
1148
+ }
1126
1149
  }, {
1127
1150
  key: "normalizePaymentSource",
1128
1151
  value: function normalizePaymentSource(payment, options) {
1129
1152
  var _ref17, _paymentRecord$origin;
1130
1153
  var paymentRecord = payment;
1131
1154
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
1132
- if (!metadata.unique_identification_number) {
1133
- metadata.unique_identification_number = createUuidV4();
1155
+ if (!metadata.unique_payment_number) {
1156
+ metadata.unique_payment_number = createUuidV4();
1134
1157
  }
1135
1158
  var normalized = _objectSpread(_objectSpread({}, paymentRecord), {}, {
1136
1159
  metadata: metadata,
@@ -1150,7 +1173,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1150
1173
  var paymentTotal = this.calculatePaymentTotal(tempOrder.payments || []);
1151
1174
  var refundAmount = this.getSummaryRefundAmount(summary);
1152
1175
  var netPaymentTotal = Decimal.max(paymentTotal.minus(refundAmount), 0);
1153
- var targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary);
1176
+ var targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary, netPaymentTotal);
1154
1177
  if (this.shouldKeepPaymentStatusAfterAmountRecalc(tempOrder.payment_status, {
1155
1178
  netPaymentTotal: netPaymentTotal,
1156
1179
  paymentTotal: paymentTotal,
@@ -1180,7 +1203,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1180
1203
  }
1181
1204
  if (params.refundAmount.lte(0)) return false;
1182
1205
  if (params.previousSummary) {
1183
- var previousTargetAmount = this.calculatePaymentTargetAmount(params.tempOrder, params.previousSummary);
1206
+ var previousTargetAmount = this.calculatePaymentTargetAmount(params.tempOrder, params.previousSummary, params.netPaymentTotal);
1184
1207
  if (!previousTargetAmount.eq(params.targetAmount)) return false;
1185
1208
  }
1186
1209
  if (normalizedStatus === 'refunded') {
@@ -1388,7 +1411,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1388
1411
  orderPaidAmount = params.orderPaidAmount;
1389
1412
  var refundAmount = this.getSummaryRefundAmount(summary);
1390
1413
  var netOrderPaidAmount = Decimal.max(orderPaidAmount.minus(refundAmount), 0);
1391
- var targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary);
1414
+ var targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary, netOrderPaidAmount);
1392
1415
  return targetAmount.minus(netOrderPaidAmount).toFixed(2);
1393
1416
  }
1394
1417
  }, {
@@ -1399,9 +1422,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1399
1422
  }, {
1400
1423
  key: "calculatePaymentTargetAmount",
1401
1424
  value: function calculatePaymentTargetAmount(tempOrder, summary) {
1402
- var depositAmount = summary.deposit_amount || tempOrder.deposit_amount || '0.00';
1403
- var isDeposit = tempOrder.is_deposit === 1 || new Decimal(depositAmount || 0).gt(0);
1404
- return isDeposit ? new Decimal(depositAmount || 0) : new Decimal(summary.expect_amount || summary.total_amount || 0);
1425
+ var paidAmount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Decimal(0);
1426
+ var depositAmount = this.getDepositAmount(tempOrder, summary);
1427
+ if (!this.isDepositOrder(tempOrder, depositAmount)) {
1428
+ return this.getOrderExpectedAmount(summary);
1429
+ }
1430
+ if (this.isDepositCovered({
1431
+ tempOrder: tempOrder,
1432
+ summary: summary,
1433
+ paidAmount: paidAmount
1434
+ })) {
1435
+ return this.getOrderExpectedAmount(summary);
1436
+ }
1437
+ return depositAmount;
1405
1438
  }
1406
1439
  }, {
1407
1440
  key: "normalizeFingerprintMoney",
@@ -1727,7 +1760,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1727
1760
  value: function getPaymentTargetAmount() {
1728
1761
  var tempOrder = this.ensureTempOrder();
1729
1762
  var summary = this.store.summary || createEmptySummary();
1730
- return this.calculatePaymentTargetAmount(tempOrder, summary);
1763
+ var paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
1764
+ var refundAmount = this.getSummaryRefundAmount(summary);
1765
+ var netPaidAmount = Decimal.max(paidPaymentSummary.gapPaidAmount.minus(refundAmount), 0);
1766
+ return this.calculatePaymentTargetAmount(tempOrder, summary, netPaidAmount);
1731
1767
  }
1732
1768
  }, {
1733
1769
  key: "ensureTempOrder",
@@ -2091,7 +2127,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2091
2127
  _context12.next = 21;
2092
2128
  break;
2093
2129
  }
2094
- emptyBaseSummary = _objectSpread(_objectSpread({}, createEmptySummary()), {}, {
2130
+ emptyBaseSummary = _objectSpread(_objectSpread(_objectSpread({}, createEmptySummary()), existedSummary), {}, {
2095
2131
  total_refund_amount: totalRefundAmount
2096
2132
  });
2097
2133
  emptySummary = _objectSpread(_objectSpread({}, emptyBaseSummary), {}, {
@@ -2599,7 +2635,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2599
2635
  };
2600
2636
  var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
2601
2637
  return _this15.normalizePaymentSource(payment, {
2602
- defaultPaid: true
2638
+ defaultPaid: false
2603
2639
  });
2604
2640
  })).filter(function (payment) {
2605
2641
  return isVoucherPayment(payment);
@@ -1976,8 +1976,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1976
1976
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
1977
1977
  metadata.shop_wallet_pass_id = shopWalletPassId;
1978
1978
  }
1979
- if (!metadata.unique_identification_number) {
1980
- metadata.unique_identification_number = createUuidV4();
1979
+ if (!metadata.unique_payment_number) {
1980
+ metadata.unique_payment_number = createUuidV4();
1981
1981
  }
1982
1982
  var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread({}, paymentRecord), {}, {
1983
1983
  metadata: metadata
@@ -410,6 +410,17 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
410
410
  * 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
411
411
  */
412
412
  getResourceErrors(resource: any, cacheItem: any): ResourceError[];
413
+ /**
414
+ * session 商品 catalog 日期与 TimeBar 不一致时写业务日志。
415
+ *
416
+ * @example
417
+ * this.logSessionCatalogDateMismatch(product, ctx.date);
418
+ */
419
+ private logSessionCatalogDateMismatch;
420
+ /**
421
+ * 加车前:session 商品 catalog 日历日与 bookingDate 不一致时中断加购,交由 SDK reload products。
422
+ */
423
+ private resolveSessionCatalogBeforeAdd;
413
424
  /**
414
425
  * 拼装 addProductDecision 通用上下文(从 store 自取)。
415
426
  */
@@ -418,7 +429,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
418
429
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
419
430
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
420
431
  */
421
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
432
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
433
+ action: "reloadCatalog";
434
+ } | {
435
+ action: "add";
436
+ cacheItem: any;
437
+ } | {
438
+ action: "requiresDetail";
439
+ payload: AddProductRequiresDetailPayload;
440
+ } | {
441
+ action: "requiresBookingEdit";
442
+ cacheItem: any;
443
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
444
+ };
422
445
  /** 规格弹窗 callback 后的第二段决策。 */
423
446
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
424
447
  /**
@@ -42,6 +42,7 @@ import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
42
42
  import { buildCartView } from "./utils/cartView";
43
43
  import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
44
44
  import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
45
+ import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils/sessionCatalogStale";
45
46
  import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
46
47
  import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
47
48
  import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
@@ -1710,6 +1711,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1710
1711
  // 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
1711
1712
  // 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
1712
1713
 
1714
+ /**
1715
+ * session 商品 catalog 日期与 TimeBar 不一致时写业务日志。
1716
+ *
1717
+ * @example
1718
+ * this.logSessionCatalogDateMismatch(product, ctx.date);
1719
+ */
1720
+ }, {
1721
+ key: "logSessionCatalogDateMismatch",
1722
+ value: function logSessionCatalogDateMismatch(item, bookingDate) {
1723
+ var _this$getTempOrder, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
1724
+ var logger = this.logger;
1725
+ if (!(logger !== null && logger !== void 0 && logger.addLog)) return;
1726
+ var tempOrder = (_this$getTempOrder = this.getTempOrder) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.call(this);
1727
+ var staleInfo = buildSessionCatalogStaleInfo(item, bookingDate);
1728
+ logger.addLog({
1729
+ type: 'warning',
1730
+ title: "[BookingTicket] session catalog date mismatch, reload products",
1731
+ metadata: _objectSpread(_objectSpread({
1732
+ order_id: (_tempOrder$order_id = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : null,
1733
+ external_sale_number: (_tempOrder$external_s = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) !== null && _tempOrder$external_s !== void 0 ? _tempOrder$external_s : null
1734
+ }, staleInfo), {}, {
1735
+ cartDetailValueSession: (_item$cartDetailValue = item === null || item === void 0 || (_item$cartDetailValue2 = item.cartDetailValue) === null || _item$cartDetailValue2 === void 0 ? void 0 : _item$cartDetailValue2.session) !== null && _item$cartDetailValue !== void 0 ? _item$cartDetailValue : null
1736
+ })
1737
+ });
1738
+ }
1739
+
1740
+ /**
1741
+ * 加车前:session 商品 catalog 日历日与 bookingDate 不一致时中断加购,交由 SDK reload products。
1742
+ */
1743
+ }, {
1744
+ key: "resolveSessionCatalogBeforeAdd",
1745
+ value: function resolveSessionCatalogBeforeAdd(item, ctx) {
1746
+ if (!isSessionCatalogDateStale(item, ctx.date)) {
1747
+ return null;
1748
+ }
1749
+ this.logSessionCatalogDateMismatch(item, ctx.date);
1750
+ return {
1751
+ action: 'reloadCatalog'
1752
+ };
1753
+ }
1754
+
1713
1755
  /**
1714
1756
  * 拼装 addProductDecision 通用上下文(从 store 自取)。
1715
1757
  */
@@ -1737,7 +1779,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1737
1779
  }, {
1738
1780
  key: "decideAddProduct",
1739
1781
  value: function decideAddProduct(item, options) {
1740
- return decideAddProductUtil(item, this.buildAddProductCtx(options));
1782
+ var ctx = this.buildAddProductCtx(options);
1783
+ var staleDecision = this.resolveSessionCatalogBeforeAdd(item, ctx);
1784
+ if (staleDecision) {
1785
+ return staleDecision;
1786
+ }
1787
+ return decideAddProductUtil(item, ctx);
1741
1788
  }
1742
1789
 
1743
1790
  /** 规格弹窗 callback 后的第二段决策。 */
@@ -1777,7 +1824,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1777
1824
  }, {
1778
1825
  key: "buildRequiresDetailPayload",
1779
1826
  value: function buildRequiresDetailPayload(item, options) {
1780
- return _buildRequiresDetailPayload(item, this.buildAddProductCtx(options));
1827
+ var ctx = this.buildAddProductCtx(options);
1828
+ return _buildRequiresDetailPayload(item, ctx);
1781
1829
  }
1782
1830
 
1783
1831
  /**
@@ -18,6 +18,10 @@ export type AddProductDecision = {
18
18
  action: 'requiresBookingEdit';
19
19
  cacheItem: any;
20
20
  payload: AddProductRequiresBookingEditPayload;
21
+ }
22
+ /** session 商品 catalog 日期与 TimeBar 不一致,需 reload products 后由用户重试加购。 */
23
+ | {
24
+ action: 'reloadCatalog';
21
25
  };
22
26
  /** 资源 / 时间编辑抽屉所需的最小 payload。 */
23
27
  export interface AddProductRequiresBookingEditPayload {
@@ -119,8 +119,14 @@ function _runAddProductDecision() {
119
119
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
120
120
  while (1) switch (_context3.prev = _context3.next) {
121
121
  case 0:
122
+ if (!(decision.action === 'reloadCatalog')) {
123
+ _context3.next = 2;
124
+ break;
125
+ }
126
+ return _context3.abrupt("return", 'cancelled');
127
+ case 2:
122
128
  if (!(decision.action === 'add')) {
123
- _context3.next = 5;
129
+ _context3.next = 7;
124
130
  break;
125
131
  }
126
132
  transformed = host.transformDetailToProductAndBooking({
@@ -128,52 +134,52 @@ function _runAddProductDecision() {
128
134
  cacheItem: decision.cacheItem,
129
135
  options: ctx
130
136
  });
131
- _context3.next = 4;
137
+ _context3.next = 6;
132
138
  return host.addProductToOrder(transformed.product, transformed.booking);
133
- case 4:
139
+ case 6:
134
140
  return _context3.abrupt("return", 'added');
135
- case 5:
141
+ case 7:
136
142
  if (!(decision.action === 'requiresDetail')) {
137
- _context3.next = 7;
143
+ _context3.next = 9;
138
144
  break;
139
145
  }
140
146
  return _context3.abrupt("return", runRequiresDetailFlow(host, catalogItem, ctx, bridge));
141
- case 7:
147
+ case 9:
142
148
  if (!(decision.action === 'requiresBookingEdit')) {
143
- _context3.next = 20;
149
+ _context3.next = 22;
144
150
  break;
145
151
  }
146
152
  if (bridge !== null && bridge !== void 0 && bridge.openBookingEdit) {
147
- _context3.next = 10;
153
+ _context3.next = 12;
148
154
  break;
149
155
  }
150
156
  return _context3.abrupt("return", 'pending');
151
- case 10:
152
- _context3.next = 12;
153
- return bridge.openBookingEdit(decision.payload);
154
157
  case 12:
158
+ _context3.next = 14;
159
+ return bridge.openBookingEdit(decision.payload);
160
+ case 14:
155
161
  edited = _context3.sent;
156
162
  if (edited) {
157
- _context3.next = 15;
163
+ _context3.next = 17;
158
164
  break;
159
165
  }
160
166
  return _context3.abrupt("return", 'cancelled');
161
- case 15:
167
+ case 17:
162
168
  if (bridge.confirmBookingEdit) {
163
- _context3.next = 17;
169
+ _context3.next = 19;
164
170
  break;
165
171
  }
166
172
  return _context3.abrupt("return", 'pending');
167
- case 17:
168
- _context3.next = 19;
173
+ case 19:
174
+ _context3.next = 21;
169
175
  return bridge.confirmBookingEdit({
170
176
  cacheItem: edited
171
177
  });
172
- case 19:
178
+ case 21:
173
179
  return _context3.abrupt("return", 'added');
174
- case 20:
180
+ case 22:
175
181
  return _context3.abrupt("return", 'pending');
176
- case 21:
182
+ case 23:
177
183
  case "end":
178
184
  return _context3.stop();
179
185
  }
@@ -0,0 +1,23 @@
1
+ import type { ProductData } from '../../../modules/Product/types';
2
+ export interface SessionCatalogStaleInfo {
3
+ productId: number | string | null;
4
+ productTitle: string | null;
5
+ sessionDay: string | null;
6
+ timeBarDay: string | null;
7
+ bookingDate: unknown;
8
+ }
9
+ /**
10
+ * 判断 session 商品 catalog 中的 session 日历日是否与当前 TimeBar / bookingDate 不一致。
11
+ *
12
+ * @example
13
+ * isSessionCatalogDateStale(product, '2026-06-05 19:01:18');
14
+ * // session 为 2026-06-04 → true;一致或无 session 快照 → false
15
+ */
16
+ export declare function isSessionCatalogDateStale(product: ProductData & Record<string, any>, bookingDate: unknown): boolean;
17
+ /**
18
+ * 组装 session catalog 日期不一致时的日志 metadata。
19
+ *
20
+ * @example
21
+ * buildSessionCatalogStaleInfo(product, '2026-06-05 19:01:18');
22
+ */
23
+ export declare function buildSessionCatalogStaleInfo(product: ProductData & Record<string, any>, bookingDate: unknown): SessionCatalogStaleInfo;
@@ -0,0 +1,78 @@
1
+ import dayjs from 'dayjs';
2
+ var SESSION_EXTENSION_TYPES = ['session_product', 'session_ticket'];
3
+
4
+ /**
5
+ * 是否为 session 商品。
6
+ *
7
+ * @example
8
+ * getIsSessionProduct({ extension_type: 'session_ticket' }); // true
9
+ */
10
+ function getIsSessionProduct(product) {
11
+ return SESSION_EXTENSION_TYPES.includes(product === null || product === void 0 ? void 0 : product.extension_type);
12
+ }
13
+
14
+ /**
15
+ * 从 session 快照解析日历日 YYYY-MM-DD。
16
+ *
17
+ * @example
18
+ * resolveSessionCalendarDay({ start_at: '2026-06-05 10:00:00' }); // '2026-06-05'
19
+ */
20
+ function resolveSessionCalendarDay(session) {
21
+ var _session$start_at;
22
+ if (!session) return null;
23
+ var raw = (_session$start_at = session.start_at) !== null && _session$start_at !== void 0 ? _session$start_at : session.end_at;
24
+ if (!raw) return null;
25
+ var parsed = dayjs(raw);
26
+ return parsed.isValid() ? parsed.format('YYYY-MM-DD') : null;
27
+ }
28
+
29
+ /**
30
+ * 将 booking / TimeBar 日期规范为 YYYY-MM-DD。
31
+ *
32
+ * @example
33
+ * formatScheduleCalendarDay('2026-06-05 19:01:18'); // '2026-06-05'
34
+ */
35
+ function formatScheduleCalendarDay(date) {
36
+ if (date == null || date === '') return null;
37
+ var parsed = dayjs(date);
38
+ return parsed.isValid() ? parsed.format('YYYY-MM-DD') : null;
39
+ }
40
+ /**
41
+ * 判断 session 商品 catalog 中的 session 日历日是否与当前 TimeBar / bookingDate 不一致。
42
+ *
43
+ * @example
44
+ * isSessionCatalogDateStale(product, '2026-06-05 19:01:18');
45
+ * // session 为 2026-06-04 → true;一致或无 session 快照 → false
46
+ */
47
+ export function isSessionCatalogDateStale(product, bookingDate) {
48
+ var _product$cartDetailVa;
49
+ if (!getIsSessionProduct(product)) {
50
+ return false;
51
+ }
52
+ var timeBarDay = formatScheduleCalendarDay(bookingDate);
53
+ if (!timeBarDay) {
54
+ return false;
55
+ }
56
+ var sessionDay = resolveSessionCalendarDay((_product$cartDetailVa = product.cartDetailValue) === null || _product$cartDetailVa === void 0 ? void 0 : _product$cartDetailVa.session);
57
+ if (!sessionDay) {
58
+ return false;
59
+ }
60
+ return sessionDay !== timeBarDay;
61
+ }
62
+
63
+ /**
64
+ * 组装 session catalog 日期不一致时的日志 metadata。
65
+ *
66
+ * @example
67
+ * buildSessionCatalogStaleInfo(product, '2026-06-05 19:01:18');
68
+ */
69
+ export function buildSessionCatalogStaleInfo(product, bookingDate) {
70
+ var _product$id, _ref, _product$title, _product$cartDetailVa2;
71
+ return {
72
+ productId: (_product$id = product === null || product === void 0 ? void 0 : product.id) !== null && _product$id !== void 0 ? _product$id : null,
73
+ productTitle: (_ref = (_product$title = product === null || product === void 0 ? void 0 : product.title) !== null && _product$title !== void 0 ? _product$title : product === null || product === void 0 ? void 0 : product.name) !== null && _ref !== void 0 ? _ref : null,
74
+ sessionDay: resolveSessionCalendarDay((_product$cartDetailVa2 = product.cartDetailValue) === null || _product$cartDetailVa2 === void 0 ? void 0 : _product$cartDetailVa2.session),
75
+ timeBarDay: formatScheduleCalendarDay(bookingDate),
76
+ bookingDate: bookingDate
77
+ };
78
+ }
@@ -742,11 +742,7 @@ var webposConfig = {
742
742
  // withCredentials: true,
743
743
  prefix: false,
744
744
  isDefaultSaasDomain: true,
745
- cache: {
746
- mode: "remote_local",
747
- type: "indexDB",
748
- cacheKeyData: values
749
- }
745
+ cache: false
750
746
  };
751
747
  }
752
748
  },
@@ -1079,11 +1075,7 @@ var shopWebposConfig = {
1079
1075
  return {
1080
1076
  // withCredentials: true,
1081
1077
  prefix: false,
1082
- cache: {
1083
- mode: "remote_local",
1084
- type: "indexDB",
1085
- cacheKeyData: values
1086
- }
1078
+ cache: false
1087
1079
  };
1088
1080
  }
1089
1081
  },
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -141,6 +141,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
141
141
  private extractOrderIdFromSubmitResult;
142
142
  private calculatePaymentEffectiveAmount;
143
143
  private calculatePaymentTotal;
144
+ private getDepositAmount;
145
+ private isDepositOrder;
146
+ private getOrderExpectedAmount;
147
+ private isDepositCovered;
144
148
  private normalizePaymentSource;
145
149
  private updateTempOrderPaymentStatus;
146
150
  private shouldKeepPaymentStatusAfterAmountRecalc;
@@ -727,11 +727,28 @@ var OrderModule = class extends import_BaseModule.BaseModule {
727
727
  return sum.plus(this.calculatePaymentEffectiveAmount(payment));
728
728
  }, new import_decimal.default(0));
729
729
  }
730
+ getDepositAmount(tempOrder, summary) {
731
+ return new import_decimal.default(summary.deposit_amount || tempOrder.deposit_amount || "0.00");
732
+ }
733
+ isDepositOrder(tempOrder, depositAmount) {
734
+ return tempOrder.is_deposit === 1 || depositAmount.gt(0);
735
+ }
736
+ getOrderExpectedAmount(summary) {
737
+ return new import_decimal.default(summary.expect_amount || summary.total_amount || 0);
738
+ }
739
+ isDepositCovered(params) {
740
+ const depositAmount = this.getDepositAmount(params.tempOrder, params.summary);
741
+ if (!this.isDepositOrder(params.tempOrder, depositAmount))
742
+ return false;
743
+ if (depositAmount.lte(0))
744
+ return false;
745
+ return params.paidAmount.gte(depositAmount);
746
+ }
730
747
  normalizePaymentSource(payment, options) {
731
748
  const paymentRecord = payment;
732
749
  const metadata = paymentRecord.metadata && typeof paymentRecord.metadata === "object" ? { ...paymentRecord.metadata } : {};
733
- if (!metadata.unique_identification_number) {
734
- metadata.unique_identification_number = (0, import_utils.createUuidV4)();
750
+ if (!metadata.unique_payment_number) {
751
+ metadata.unique_payment_number = (0, import_utils.createUuidV4)();
735
752
  }
736
753
  const normalized = {
737
754
  ...paymentRecord,
@@ -750,7 +767,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
750
767
  const paymentTotal = this.calculatePaymentTotal(tempOrder.payments || []);
751
768
  const refundAmount = this.getSummaryRefundAmount(summary);
752
769
  const netPaymentTotal = import_decimal.default.max(paymentTotal.minus(refundAmount), 0);
753
- const targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary);
770
+ const targetAmount = this.calculatePaymentTargetAmount(
771
+ tempOrder,
772
+ summary,
773
+ netPaymentTotal
774
+ );
754
775
  if (this.shouldKeepPaymentStatusAfterAmountRecalc(tempOrder.payment_status, {
755
776
  netPaymentTotal,
756
777
  paymentTotal,
@@ -781,7 +802,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
781
802
  if (params.previousSummary) {
782
803
  const previousTargetAmount = this.calculatePaymentTargetAmount(
783
804
  params.tempOrder,
784
- params.previousSummary
805
+ params.previousSummary,
806
+ params.netPaymentTotal
785
807
  );
786
808
  if (!previousTargetAmount.eq(params.targetAmount))
787
809
  return false;
@@ -960,16 +982,25 @@ var OrderModule = class extends import_BaseModule.BaseModule {
960
982
  const { tempOrder, summary, orderPaidAmount } = params;
961
983
  const refundAmount = this.getSummaryRefundAmount(summary);
962
984
  const netOrderPaidAmount = import_decimal.default.max(orderPaidAmount.minus(refundAmount), 0);
963
- const targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary);
985
+ const targetAmount = this.calculatePaymentTargetAmount(
986
+ tempOrder,
987
+ summary,
988
+ netOrderPaidAmount
989
+ );
964
990
  return targetAmount.minus(netOrderPaidAmount).toFixed(2);
965
991
  }
966
992
  getSummaryRefundAmount(summary) {
967
993
  return import_decimal.default.max(new import_decimal.default((summary == null ? void 0 : summary.total_refund_amount) || 0), 0);
968
994
  }
969
- calculatePaymentTargetAmount(tempOrder, summary) {
970
- const depositAmount = summary.deposit_amount || tempOrder.deposit_amount || "0.00";
971
- const isDeposit = tempOrder.is_deposit === 1 || new import_decimal.default(depositAmount || 0).gt(0);
972
- return isDeposit ? new import_decimal.default(depositAmount || 0) : new import_decimal.default(summary.expect_amount || summary.total_amount || 0);
995
+ calculatePaymentTargetAmount(tempOrder, summary, paidAmount = new import_decimal.default(0)) {
996
+ const depositAmount = this.getDepositAmount(tempOrder, summary);
997
+ if (!this.isDepositOrder(tempOrder, depositAmount)) {
998
+ return this.getOrderExpectedAmount(summary);
999
+ }
1000
+ if (this.isDepositCovered({ tempOrder, summary, paidAmount })) {
1001
+ return this.getOrderExpectedAmount(summary);
1002
+ }
1003
+ return depositAmount;
973
1004
  }
974
1005
  normalizeFingerprintMoney(value) {
975
1006
  if (value === void 0 || value === null || value === "")
@@ -1186,7 +1217,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1186
1217
  getPaymentTargetAmount() {
1187
1218
  const tempOrder = this.ensureTempOrder();
1188
1219
  const summary = this.store.summary || (0, import_utils.createEmptySummary)();
1189
- return this.calculatePaymentTargetAmount(tempOrder, summary);
1220
+ const paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
1221
+ const refundAmount = this.getSummaryRefundAmount(summary);
1222
+ const netPaidAmount = import_decimal.default.max(
1223
+ paidPaymentSummary.gapPaidAmount.minus(refundAmount),
1224
+ 0
1225
+ );
1226
+ return this.calculatePaymentTargetAmount(tempOrder, summary, netPaidAmount);
1190
1227
  }
1191
1228
  ensureTempOrder() {
1192
1229
  if (this.store.tempOrder) {
@@ -1456,6 +1493,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1456
1493
  if (!salesSummary) {
1457
1494
  const emptyBaseSummary = {
1458
1495
  ...(0, import_utils.createEmptySummary)(),
1496
+ ...existedSummary,
1459
1497
  total_refund_amount: totalRefundAmount
1460
1498
  };
1461
1499
  const emptySummary = {
@@ -1877,7 +1915,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1877
1915
  };
1878
1916
  const mappedVouchers = (0, import_utils.mapPaymentItemsToOrderPayments)(
1879
1917
  payments.map(
1880
- (payment) => this.normalizePaymentSource(payment, { defaultPaid: true })
1918
+ (payment) => this.normalizePaymentSource(payment, { defaultPaid: false })
1881
1919
  )
1882
1920
  ).filter((payment) => {
1883
1921
  return isVoucherPayment(payment);
@@ -1253,8 +1253,8 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1253
1253
  if (shopWalletPassId !== void 0 && shopWalletPassId !== null) {
1254
1254
  metadata.shop_wallet_pass_id = shopWalletPassId;
1255
1255
  }
1256
- if (!metadata.unique_identification_number) {
1257
- metadata.unique_identification_number = (0, import_utils.createUuidV4)();
1256
+ if (!metadata.unique_payment_number) {
1257
+ metadata.unique_payment_number = (0, import_utils.createUuidV4)();
1258
1258
  }
1259
1259
  const payments = this.store.order.addOrderPayment({
1260
1260
  ...paymentRecord,
@@ -410,6 +410,17 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
410
410
  * 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
411
411
  */
412
412
  getResourceErrors(resource: any, cacheItem: any): ResourceError[];
413
+ /**
414
+ * session 商品 catalog 日期与 TimeBar 不一致时写业务日志。
415
+ *
416
+ * @example
417
+ * this.logSessionCatalogDateMismatch(product, ctx.date);
418
+ */
419
+ private logSessionCatalogDateMismatch;
420
+ /**
421
+ * 加车前:session 商品 catalog 日历日与 bookingDate 不一致时中断加购,交由 SDK reload products。
422
+ */
423
+ private resolveSessionCatalogBeforeAdd;
413
424
  /**
414
425
  * 拼装 addProductDecision 通用上下文(从 store 自取)。
415
426
  */
@@ -418,7 +429,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
418
429
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
419
430
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
420
431
  */
421
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
432
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
433
+ action: "reloadCatalog";
434
+ } | {
435
+ action: "add";
436
+ cacheItem: any;
437
+ } | {
438
+ action: "requiresDetail";
439
+ payload: AddProductRequiresDetailPayload;
440
+ } | {
441
+ action: "requiresBookingEdit";
442
+ cacheItem: any;
443
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
444
+ };
422
445
  /** 规格弹窗 callback 后的第二段决策。 */
423
446
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
424
447
  /**
@@ -46,6 +46,7 @@ var import_applyGlobalScan = require("./utils/scan/applyGlobalScan");
46
46
  var import_cartView = require("./utils/cartView");
47
47
  var import_addProductDecision = require("./utils/addProductDecision");
48
48
  var import_buildCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildCacheItemFromOrderLine");
49
+ var import_sessionCatalogStale = require("./utils/sessionCatalogStale");
49
50
  var import_buildNormalProductCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine");
50
51
  var import_orderLineDisplay = require("../../modules/BookingContext/utils/orderLineDisplay");
51
52
  var import_bookingStatus = require("./utils/bookingStatus");
@@ -1003,6 +1004,40 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1003
1004
  // 这一组方法是 SalesSdkCartContext.addProduct / confirmDetail 的 OS 后端。
1004
1005
  // 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
1005
1006
  // 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
1007
+ /**
1008
+ * session 商品 catalog 日期与 TimeBar 不一致时写业务日志。
1009
+ *
1010
+ * @example
1011
+ * this.logSessionCatalogDateMismatch(product, ctx.date);
1012
+ */
1013
+ logSessionCatalogDateMismatch(item, bookingDate) {
1014
+ var _a, _b;
1015
+ const logger = this.logger;
1016
+ if (!(logger == null ? void 0 : logger.addLog))
1017
+ return;
1018
+ const tempOrder = (_a = this.getTempOrder) == null ? void 0 : _a.call(this);
1019
+ const staleInfo = (0, import_sessionCatalogStale.buildSessionCatalogStaleInfo)(item, bookingDate);
1020
+ logger.addLog({
1021
+ type: "warning",
1022
+ title: `[BookingTicket] session catalog date mismatch, reload products`,
1023
+ metadata: {
1024
+ order_id: (tempOrder == null ? void 0 : tempOrder.order_id) ?? null,
1025
+ external_sale_number: (tempOrder == null ? void 0 : tempOrder.external_sale_number) ?? null,
1026
+ ...staleInfo,
1027
+ cartDetailValueSession: ((_b = item == null ? void 0 : item.cartDetailValue) == null ? void 0 : _b.session) ?? null
1028
+ }
1029
+ });
1030
+ }
1031
+ /**
1032
+ * 加车前:session 商品 catalog 日历日与 bookingDate 不一致时中断加购,交由 SDK reload products。
1033
+ */
1034
+ resolveSessionCatalogBeforeAdd(item, ctx) {
1035
+ if (!(0, import_sessionCatalogStale.isSessionCatalogDateStale)(item, ctx.date)) {
1036
+ return null;
1037
+ }
1038
+ this.logSessionCatalogDateMismatch(item, ctx.date);
1039
+ return { action: "reloadCatalog" };
1040
+ }
1006
1041
  /**
1007
1042
  * 拼装 addProductDecision 通用上下文(从 store 自取)。
1008
1043
  */
@@ -1026,7 +1061,12 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1026
1061
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
1027
1062
  */
1028
1063
  decideAddProduct(item, options) {
1029
- return (0, import_addProductDecision.decideAddProduct)(item, this.buildAddProductCtx(options));
1064
+ const ctx = this.buildAddProductCtx(options);
1065
+ const staleDecision = this.resolveSessionCatalogBeforeAdd(item, ctx);
1066
+ if (staleDecision) {
1067
+ return staleDecision;
1068
+ }
1069
+ return (0, import_addProductDecision.decideAddProduct)(item, ctx);
1030
1070
  }
1031
1071
  /** 规格弹窗 callback 后的第二段决策。 */
1032
1072
  decideAfterDetail(cacheItem, options) {
@@ -1050,7 +1090,8 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1050
1090
  * 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
1051
1091
  */
1052
1092
  buildRequiresDetailPayload(item, options) {
1053
- return (0, import_addProductDecision.buildRequiresDetailPayload)(item, this.buildAddProductCtx(options));
1093
+ const ctx = this.buildAddProductCtx(options);
1094
+ return (0, import_addProductDecision.buildRequiresDetailPayload)(item, ctx);
1054
1095
  }
1055
1096
  /**
1056
1097
  * 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
@@ -18,6 +18,10 @@ export type AddProductDecision = {
18
18
  action: 'requiresBookingEdit';
19
19
  cacheItem: any;
20
20
  payload: AddProductRequiresBookingEditPayload;
21
+ }
22
+ /** session 商品 catalog 日期与 TimeBar 不一致,需 reload products 后由用户重试加购。 */
23
+ | {
24
+ action: 'reloadCatalog';
21
25
  };
22
26
  /** 资源 / 时间编辑抽屉所需的最小 payload。 */
23
27
  export interface AddProductRequiresBookingEditPayload {
@@ -57,6 +57,9 @@ async function runRequiresDetailFlow(host, item, ctx, bridge) {
57
57
  return "added";
58
58
  }
59
59
  async function runAddProductDecision(host, catalogItem, decision, ctx, bridge) {
60
+ if (decision.action === "reloadCatalog") {
61
+ return "cancelled";
62
+ }
60
63
  if (decision.action === "add") {
61
64
  const transformed = host.transformDetailToProductAndBooking({
62
65
  item: catalogItem,
@@ -0,0 +1,23 @@
1
+ import type { ProductData } from '../../../modules/Product/types';
2
+ export interface SessionCatalogStaleInfo {
3
+ productId: number | string | null;
4
+ productTitle: string | null;
5
+ sessionDay: string | null;
6
+ timeBarDay: string | null;
7
+ bookingDate: unknown;
8
+ }
9
+ /**
10
+ * 判断 session 商品 catalog 中的 session 日历日是否与当前 TimeBar / bookingDate 不一致。
11
+ *
12
+ * @example
13
+ * isSessionCatalogDateStale(product, '2026-06-05 19:01:18');
14
+ * // session 为 2026-06-04 → true;一致或无 session 快照 → false
15
+ */
16
+ export declare function isSessionCatalogDateStale(product: ProductData & Record<string, any>, bookingDate: unknown): boolean;
17
+ /**
18
+ * 组装 session catalog 日期不一致时的日志 metadata。
19
+ *
20
+ * @example
21
+ * buildSessionCatalogStaleInfo(product, '2026-06-05 19:01:18');
22
+ */
23
+ export declare function buildSessionCatalogStaleInfo(product: ProductData & Record<string, any>, bookingDate: unknown): SessionCatalogStaleInfo;
@@ -0,0 +1,85 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/solution/BookingTicket/utils/sessionCatalogStale.ts
30
+ var sessionCatalogStale_exports = {};
31
+ __export(sessionCatalogStale_exports, {
32
+ buildSessionCatalogStaleInfo: () => buildSessionCatalogStaleInfo,
33
+ isSessionCatalogDateStale: () => isSessionCatalogDateStale
34
+ });
35
+ module.exports = __toCommonJS(sessionCatalogStale_exports);
36
+ var import_dayjs = __toESM(require("dayjs"));
37
+ var SESSION_EXTENSION_TYPES = ["session_product", "session_ticket"];
38
+ function getIsSessionProduct(product) {
39
+ return SESSION_EXTENSION_TYPES.includes(product == null ? void 0 : product.extension_type);
40
+ }
41
+ function resolveSessionCalendarDay(session) {
42
+ if (!session)
43
+ return null;
44
+ const raw = session.start_at ?? session.end_at;
45
+ if (!raw)
46
+ return null;
47
+ const parsed = (0, import_dayjs.default)(raw);
48
+ return parsed.isValid() ? parsed.format("YYYY-MM-DD") : null;
49
+ }
50
+ function formatScheduleCalendarDay(date) {
51
+ if (date == null || date === "")
52
+ return null;
53
+ const parsed = (0, import_dayjs.default)(date);
54
+ return parsed.isValid() ? parsed.format("YYYY-MM-DD") : null;
55
+ }
56
+ function isSessionCatalogDateStale(product, bookingDate) {
57
+ var _a;
58
+ if (!getIsSessionProduct(product)) {
59
+ return false;
60
+ }
61
+ const timeBarDay = formatScheduleCalendarDay(bookingDate);
62
+ if (!timeBarDay) {
63
+ return false;
64
+ }
65
+ const sessionDay = resolveSessionCalendarDay((_a = product.cartDetailValue) == null ? void 0 : _a.session);
66
+ if (!sessionDay) {
67
+ return false;
68
+ }
69
+ return sessionDay !== timeBarDay;
70
+ }
71
+ function buildSessionCatalogStaleInfo(product, bookingDate) {
72
+ var _a;
73
+ return {
74
+ productId: (product == null ? void 0 : product.id) ?? null,
75
+ productTitle: (product == null ? void 0 : product.title) ?? (product == null ? void 0 : product.name) ?? null,
76
+ sessionDay: resolveSessionCalendarDay((_a = product.cartDetailValue) == null ? void 0 : _a.session),
77
+ timeBarDay: formatScheduleCalendarDay(bookingDate),
78
+ bookingDate
79
+ };
80
+ }
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ buildSessionCatalogStaleInfo,
84
+ isSessionCatalogDateStale
85
+ });
@@ -584,11 +584,7 @@ var webposConfig = {
584
584
  // withCredentials: true,
585
585
  prefix: false,
586
586
  isDefaultSaasDomain: true,
587
- cache: {
588
- mode: "remote_local",
589
- type: "indexDB",
590
- cacheKeyData: values
591
- }
587
+ cache: false
592
588
  })
593
589
  },
594
590
  emailCodeRegister: {
@@ -847,11 +843,7 @@ var shopWebposConfig = {
847
843
  options: (values) => ({
848
844
  // withCredentials: true,
849
845
  prefix: false,
850
- cache: {
851
- mode: "remote_local",
852
- type: "indexDB",
853
- cacheKeyData: values
854
- }
846
+ cache: false
855
847
  })
856
848
  },
857
849
  emailCodeRegister: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.200",
4
+ "version": "2.2.202",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",