@pisell/pisellos 2.3.33 → 2.3.35

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 (33) hide show
  1. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  2. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/index.js +84 -34
  5. package/dist/modules/Order/payment-utils.d.ts +3 -0
  6. package/dist/modules/Order/payment-utils.js +25 -3
  7. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  8. package/dist/server/index.d.ts +2 -0
  9. package/dist/server/index.js +73 -10
  10. package/dist/server/modules/order/index.d.ts +4 -1
  11. package/dist/server/modules/order/index.js +108 -18
  12. package/dist/solution/BaseSales/index.js +10 -1
  13. package/dist/solution/BaseSales/utils/cartPromotion.js +19 -7
  14. package/dist/solution/BookingByStep/index.d.ts +1 -1
  15. package/dist/solution/Sales/index.d.ts +1 -0
  16. package/dist/solution/Sales/index.js +10 -2
  17. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  18. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
  19. package/lib/modules/Order/index.d.ts +1 -1
  20. package/lib/modules/Order/index.js +75 -11
  21. package/lib/modules/Order/payment-utils.d.ts +3 -0
  22. package/lib/modules/Order/payment-utils.js +33 -2
  23. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  24. package/lib/server/index.d.ts +2 -0
  25. package/lib/server/index.js +60 -10
  26. package/lib/server/modules/order/index.d.ts +4 -1
  27. package/lib/server/modules/order/index.js +89 -10
  28. package/lib/solution/BaseSales/index.js +9 -0
  29. package/lib/solution/BaseSales/utils/cartPromotion.js +13 -1
  30. package/lib/solution/BookingByStep/index.d.ts +1 -1
  31. package/lib/solution/Sales/index.d.ts +1 -0
  32. package/lib/solution/Sales/index.js +5 -3
  33. package/package.json +1 -1
@@ -179,6 +179,7 @@ function mergeIdenticalPromotionCartLines(products) {
179
179
  promotion.finalPrice ?? ((_c = line.metadata) == null ? void 0 : _c.main_product_selling_price) ?? ""
180
180
  );
181
181
  const noteSignature = getProductLineNoteSignature(line);
182
+ const lineMergeBoundary = getPromotionLineMergeBoundary(line);
182
183
  const bookingUid = (line == null ? void 0 : line.booking_uid) ?? ((_d = line == null ? void 0 : line.metadata) == null ? void 0 : _d.booking_uid);
183
184
  const orderDetailId = (line == null ? void 0 : line.order_detail_id) ?? (line == null ? void 0 : line.orderDetailId);
184
185
  const mergeKey = [
@@ -186,6 +187,7 @@ function mergeIdenticalPromotionCartLines(products) {
186
187
  line.product_variant_id ?? 0,
187
188
  fingerprint,
188
189
  noteSignature,
190
+ lineMergeBoundary,
189
191
  bookingUid ? String(bookingUid) : "",
190
192
  orderDetailId !== void 0 && orderDetailId !== null && orderDetailId !== "" ? String(orderDetailId) : "",
191
193
  promotion.strategyId,
@@ -329,6 +331,12 @@ function getProductLineNoteSignature(product) {
329
331
  const uid = getOrderProductUid(product);
330
332
  return uid ? `note:${uid}` : `note:${normalizedNote}`;
331
333
  }
334
+ function getPromotionLineMergeBoundary(product) {
335
+ var _a;
336
+ if (((_a = product == null ? void 0 : product.metadata) == null ? void 0 : _a.is_edit_for_runtime) !== true)
337
+ return "";
338
+ return `edit:${getOrderProductUid(product)}`;
339
+ }
332
340
  function isPersistedGeneratedVoucher(product) {
333
341
  const orderDetailId = (product == null ? void 0 : product.order_detail_id) ?? (product == null ? void 0 : product.orderDetailId);
334
342
  if (orderDetailId === void 0 || orderDetailId === null || orderDetailId === "") {
@@ -356,6 +364,7 @@ function buildConsolidateKeyForPromotion(item) {
356
364
  item.product_bundle
357
365
  );
358
366
  const noteSignature = getProductLineNoteSignature(item);
367
+ const lineMergeBoundary = getPromotionLineMergeBoundary(item);
359
368
  const bookingUid = (item == null ? void 0 : item.booking_uid) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.booking_uid);
360
369
  const orderDetailId = (item == null ? void 0 : item.order_detail_id) ?? (item == null ? void 0 : item.orderDetailId);
361
370
  if (orderDetailId !== void 0 && orderDetailId !== null && orderDetailId !== "") {
@@ -364,6 +373,7 @@ function buildConsolidateKeyForPromotion(item) {
364
373
  item.product_variant_id ?? 0,
365
374
  fingerprint,
366
375
  noteSignature,
376
+ lineMergeBoundary,
367
377
  String(orderDetailId)
368
378
  ].join("#");
369
379
  }
@@ -373,6 +383,7 @@ function buildConsolidateKeyForPromotion(item) {
373
383
  item.product_variant_id ?? 0,
374
384
  fingerprint,
375
385
  noteSignature,
386
+ lineMergeBoundary,
376
387
  String(bookingUid)
377
388
  ].join("#");
378
389
  }
@@ -380,7 +391,8 @@ function buildConsolidateKeyForPromotion(item) {
380
391
  item.product_id,
381
392
  item.product_variant_id ?? 0,
382
393
  fingerprint,
383
- noteSignature
394
+ noteSignature,
395
+ lineMergeBoundary
384
396
  ].join("#");
385
397
  }
386
398
  function consolidateMainProductsForPromotion(entries) {
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
314
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -83,6 +83,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
+ private isUnpaidBooking;
86
87
  private countBookingOrders;
87
88
  private countCompletedBookings;
88
89
  private groupBookingsByResource;
@@ -39,6 +39,7 @@ var import_dayjs = __toESM(require("dayjs"));
39
39
  var import_BaseModule = require("../../modules/BaseModule");
40
40
  var import_types = require("./types");
41
41
  __reExport(Sales_exports, require("./types"), module.exports);
42
+ var UNPAID_PAYMENT_STATUSES = /* @__PURE__ */ new Set(["unpaid", "partially_paid", "payment_processing"]);
42
43
  var SalesImpl = class extends import_BaseModule.BaseModule {
43
44
  // LoggerManager 实例
44
45
  constructor(name, version) {
@@ -258,6 +259,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
258
259
  var _a;
259
260
  return String(((_a = booking.order) == null ? void 0 : _a.payment_status) ?? "");
260
261
  }
262
+ isUnpaidBooking(booking) {
263
+ return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
264
+ }
261
265
  countBookingOrders(bookings) {
262
266
  const orderIds = /* @__PURE__ */ new Set();
263
267
  bookings.forEach((booking) => {
@@ -631,9 +635,7 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
631
635
  const completedBookingList = matchedBookingList.filter(
632
636
  (booking) => this.getBookingAppointmentStatus(booking) === "completed"
633
637
  );
634
- const unpaidBookingList = matchedBookingList.filter(
635
- (booking) => this.getBookingOrderPaymentStatus(booking) === "unpaid" || this.getBookingOrderPaymentStatus(booking) === "payment_processing"
636
- );
638
+ const unpaidBookingList = matchedBookingList.filter((booking) => this.isUnpaidBooking(booking));
637
639
  const bookings = this.pickBookingsForCurrentPoint(
638
640
  current,
639
641
  this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.33",
4
+ "version": "2.3.35",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",