@pisell/pisellos 2.3.23 → 2.3.25

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.
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -1913,9 +1913,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1913
1913
  });
1914
1914
  case 26:
1915
1915
  this.store.order.persistTempOrder();
1916
+ _context18.next = 29;
1917
+ return this.effectsEmit('onDiscountApplied', {
1918
+ productList: tempOrder.products || [],
1919
+ discountList: nextDiscountList,
1920
+ selectedDiscountList: tempOrder.discount_list || [],
1921
+ tempOrder: tempOrder
1922
+ });
1923
+ case 29:
1916
1924
  cb === null || cb === void 0 || cb(result);
1917
1925
  return _context18.abrupt("return", result);
1918
- case 29:
1926
+ case 31:
1919
1927
  case "end":
1920
1928
  return _context18.stop();
1921
1929
  }
@@ -1993,7 +2001,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1993
2001
  key: "scanPromotionCode",
1994
2002
  value: function () {
1995
2003
  var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(code, customerId) {
1996
- var raw;
2004
+ var raw, tempOrder;
1997
2005
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1998
2006
  while (1) switch (_context20.prev = _context20.next) {
1999
2007
  case 0:
@@ -2009,7 +2017,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2009
2017
  case 5:
2010
2018
  raw = _context20.sent;
2011
2019
  if (!raw.isAvailable) {
2012
- _context20.next = 10;
2020
+ _context20.next = 13;
2013
2021
  break;
2014
2022
  }
2015
2023
  _context20.next = 9;
@@ -2018,22 +2026,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2018
2026
  });
2019
2027
  case 9:
2020
2028
  this.store.order.persistTempOrder();
2021
- case 10:
2029
+ tempOrder = this.store.order.ensureTempOrder();
2030
+ _context20.next = 13;
2031
+ return this.effectsEmit('onDiscountApplied', {
2032
+ productList: tempOrder.products || [],
2033
+ discountList: this.store.order.getDiscountList(),
2034
+ selectedDiscountList: tempOrder.discount_list || [],
2035
+ tempOrder: tempOrder
2036
+ });
2037
+ case 13:
2022
2038
  return _context20.abrupt("return", {
2023
2039
  isAvailable: raw.isAvailable,
2024
2040
  type: raw.type,
2025
2041
  unavailableReason: raw.unavailableReason,
2026
2042
  scannedDiscountList: raw.scannedDiscountList
2027
2043
  });
2028
- case 13:
2029
- _context20.prev = 13;
2044
+ case 16:
2045
+ _context20.prev = 16;
2030
2046
  _context20.t0 = _context20["catch"](0);
2031
2047
  throw _context20.t0;
2032
- case 16:
2048
+ case 19:
2033
2049
  case "end":
2034
2050
  return _context20.stop();
2035
2051
  }
2036
- }, _callee20, this, [[0, 13]]);
2052
+ }, _callee20, this, [[0, 16]]);
2037
2053
  }));
2038
2054
  function scanPromotionCode(_x14, _x15) {
2039
2055
  return _scanPromotionCode.apply(this, arguments);
@@ -2276,17 +2292,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2276
2292
  });
2277
2293
  case 16:
2278
2294
  this.store.order.persistTempOrder();
2279
- _context22.next = 22;
2280
- break;
2295
+ _context22.next = 19;
2296
+ return this.effectsEmit('onDiscountApplied', {
2297
+ productList: tempOrder.products || [],
2298
+ discountList: result.discountList || [],
2299
+ selectedDiscountList: tempOrder.discount_list || [],
2300
+ tempOrder: tempOrder
2301
+ });
2281
2302
  case 19:
2282
- _context22.prev = 19;
2303
+ _context22.next = 24;
2304
+ break;
2305
+ case 21:
2306
+ _context22.prev = 21;
2283
2307
  _context22.t0 = _context22["catch"](0);
2284
2308
  throw _context22.t0;
2285
- case 22:
2309
+ case 24:
2286
2310
  case "end":
2287
2311
  return _context22.stop();
2288
2312
  }
2289
- }, _callee22, this, [[0, 19]]);
2313
+ }, _callee22, this, [[0, 21]]);
2290
2314
  }));
2291
2315
  function applyDiscountCalculationResult(_x17) {
2292
2316
  return _applyDiscountCalculationResult.apply(this, arguments);
@@ -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 | 6 | 3 | 4 | 5;
314
+ weekNum: 0 | 1 | 5 | 3 | 2 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -549,7 +549,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
549
549
  key: "scanPromotionCode",
550
550
  value: function () {
551
551
  var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
552
- var raw, scannedList, extractedCustomerId, hasOrderCustomer;
552
+ var raw, scannedList, extractedCustomerId, hasOrderCustomer, tempOrder;
553
553
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
554
554
  while (1) switch (_context7.prev = _context7.next) {
555
555
  case 0:
@@ -574,7 +574,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
574
574
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
575
575
  case 11:
576
576
  if (!raw.isAvailable) {
577
- _context7.next = 15;
577
+ _context7.next = 18;
578
578
  break;
579
579
  }
580
580
  _context7.next = 14;
@@ -583,14 +583,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
583
583
  });
584
584
  case 14:
585
585
  this.store.order.persistTempOrder();
586
- case 15:
586
+ tempOrder = this.store.order.ensureTempOrder();
587
+ _context7.next = 18;
588
+ return this.effectsEmit('onDiscountApplied', {
589
+ productList: tempOrder.products || [],
590
+ discountList: this.store.order.getDiscountList(),
591
+ selectedDiscountList: tempOrder.discount_list || [],
592
+ tempOrder: tempOrder
593
+ });
594
+ case 18:
587
595
  return _context7.abrupt("return", {
588
596
  isAvailable: raw.isAvailable,
589
597
  type: raw.type,
590
598
  unavailableReason: raw.unavailableReason,
591
599
  scannedDiscountList: raw.scannedDiscountList
592
600
  });
593
- case 16:
601
+ case 19:
594
602
  case "end":
595
603
  return _context7.stop();
596
604
  }
@@ -1519,7 +1527,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1519
1527
  void this.store.order.recalculateSummary({
1520
1528
  createIfMissing: true
1521
1529
  }).then(function () {
1522
- return _this3.store.order.persistTempOrder();
1530
+ var _discountModule$getDi;
1531
+ var tempOrder = _this3.store.order.ensureTempOrder();
1532
+ _this3.store.order.persistTempOrder();
1533
+ return _this3.effectsEmit('onDiscountApplied', {
1534
+ productList: tempOrder.products || [],
1535
+ discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
1536
+ selectedDiscountList: tempOrder.discount_list || [],
1537
+ tempOrder: tempOrder
1538
+ });
1523
1539
  }).catch(function (error) {
1524
1540
  console.error('Failed to recalculate summary after clearing customer:', error);
1525
1541
  });
@@ -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
+ });
@@ -75,6 +75,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
75
75
  apply?: boolean;
76
76
  }): Promise<Discount[]>;
77
77
  getDiscountList(): Discount[];
78
+ private syncScannedDiscountsToOriginalDiscountList;
78
79
  private ensureEditDiscountConfigForProductChange;
79
80
  scanCode(code: string, customerId?: number): Promise<{
80
81
  isAvailable: boolean;
@@ -464,7 +465,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
464
465
  generateIdempotencyToken(): string;
465
466
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
466
467
  createOrder(params: CommitOrderParams['query']): {
467
- type: "virtual" | "appointment_booking";
468
+ type: "appointment_booking" | "virtual";
468
469
  platform: string;
469
470
  sales_channel: string;
470
471
  order_sales_channel: string;
@@ -477,6 +477,19 @@ var OrderModule = class extends import_BaseModule.BaseModule {
477
477
  var _a;
478
478
  return ((_a = this.store.discount) == null ? void 0 : _a.getDiscountList()) || [];
479
479
  }
480
+ async syncScannedDiscountsToOriginalDiscountList(discountList) {
481
+ var _a, _b, _c, _d;
482
+ const scanDiscounts = (discountList || []).filter((discount) => discount == null ? void 0 : discount.isScan);
483
+ if (!scanDiscounts.length)
484
+ return;
485
+ const scanDiscountIds = new Set(scanDiscounts.map((discount) => discount == null ? void 0 : discount.id));
486
+ const originalDiscounts = ((_b = (_a = this.store.discount) == null ? void 0 : _a.getOriginalDiscountList) == null ? void 0 : _b.call(_a)) || [];
487
+ const nextOriginalDiscounts = [
488
+ ...scanDiscounts,
489
+ ...originalDiscounts.filter((discount) => !scanDiscountIds.has(discount == null ? void 0 : discount.id))
490
+ ];
491
+ await ((_d = (_c = this.store.discount) == null ? void 0 : _c.setOriginalDiscountList) == null ? void 0 : _d.call(_c, nextOriginalDiscounts));
492
+ }
480
493
  async ensureEditDiscountConfigForProductChange(tempOrder) {
481
494
  var _a, _b, _c, _d, _e, _f;
482
495
  const orderId = tempOrder.order_id;
@@ -525,6 +538,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
525
538
  }));
526
539
  const currentSelected = this.getDiscountList().filter((n) => n.isSelected);
527
540
  if (currentSelected.length && currentSelected.some((n) => withScanList.some((m) => m.id === n.id))) {
541
+ await this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
528
542
  return {
529
543
  type: "clientCalc",
530
544
  isAvailable: true,
@@ -545,6 +559,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
545
559
  if (isAvailable && newDiscountList) {
546
560
  (_d = this.store.discount) == null ? void 0 : _d.setDiscountList(newDiscountList);
547
561
  this.applyDiscount();
562
+ await this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
548
563
  }
549
564
  return {
550
565
  type: "clientCalc",
@@ -3986,7 +4001,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3986
4001
  async hydrateTempOrderFromRecord(record, options) {
3987
4002
  var _a, _b, _c;
3988
4003
  const raw = record && typeof record === "object" && record.data && record.order_id == null ? record.data : record || {};
3989
- const nextTempOrder = this.normalizeTempOrderForRuntime(raw);
4004
+ const nextTempOrder = this.normalizeTempOrderForRuntime(raw, { makeEditMark: true });
3990
4005
  const rawSummary = raw.summary && typeof raw.summary === "object" ? raw.summary : {};
3991
4006
  const summarySurcharges = Array.isArray(rawSummary.surcharges) ? rawSummary.surcharges.map((s) => ({ ...s || {} })) : (0, import_lodash_es.cloneDeep)(nextTempOrder.surcharges || []);
3992
4007
  this.store.tempOrder = nextTempOrder;
@@ -4009,14 +4024,25 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4009
4024
  this.store.lastOrderInfo = raw.lastOrderInfo || raw;
4010
4025
  const hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
4011
4026
  const currentDiscounts = typeof ((_a = this.store.discount) == null ? void 0 : _a.getDiscountList) === "function" ? this.store.discount.getDiscountList() || [] : [];
4012
- const shouldSkipEmptyDiscountSync = hydratedEditDiscounts.length === 0 && currentDiscounts.length === 0;
4027
+ const currentScanDiscounts = currentDiscounts.filter((discount) => discount == null ? void 0 : discount.isScan);
4028
+ const hydratedDiscountIds = new Set(
4029
+ hydratedEditDiscounts.map((discount) => discount == null ? void 0 : discount.id)
4030
+ );
4031
+ const retainedScanDiscounts = currentScanDiscounts.filter(
4032
+ (discount) => !hydratedDiscountIds.has(discount == null ? void 0 : discount.id)
4033
+ );
4034
+ const nextDiscounts = [
4035
+ ...hydratedEditDiscounts,
4036
+ ...retainedScanDiscounts
4037
+ ];
4038
+ const shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
4013
4039
  if (!shouldSkipEmptyDiscountSync) {
4014
4040
  OrderModule.populateSavedAmounts(
4015
4041
  nextTempOrder.products,
4016
- hydratedEditDiscounts
4042
+ nextDiscounts
4017
4043
  );
4018
- await ((_b = this.store.discount) == null ? void 0 : _b.setOriginalDiscountList(hydratedEditDiscounts));
4019
- await ((_c = this.store.discount) == null ? void 0 : _c.setDiscountList(hydratedEditDiscounts));
4044
+ await ((_b = this.store.discount) == null ? void 0 : _b.setOriginalDiscountList(nextDiscounts));
4045
+ await ((_c = this.store.discount) == null ? void 0 : _c.setDiscountList(nextDiscounts));
4020
4046
  }
4021
4047
  if (options == null ? void 0 : options.recalcOnHydrate) {
4022
4048
  await this.recalculateSummary({ createIfMissing: false });
@@ -4073,7 +4099,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4073
4099
  nextTempOrder.metadata = raw.metadata && typeof raw.metadata === "object" ? { ...raw.metadata } : {};
4074
4100
  nextTempOrder.holder = raw.holder && typeof raw.holder === "object" ? { ...raw.holder } : null;
4075
4101
  const rawProducts = Array.isArray(raw.products) ? raw.products : [];
4076
- nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map((p) => this.normalizeHydratedOrderProduct(p)) : [];
4102
+ nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map((p) => this.normalizeHydratedOrderProduct(p, { makeEditMark: options == null ? void 0 : options.makeEditMark })) : [];
4077
4103
  nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map((b) => {
4078
4104
  const booking = this.normalizeHydratedBookingHolder(b || {});
4079
4105
  return {
@@ -4219,7 +4245,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4219
4245
  normalized.id = optionItem.id;
4220
4246
  return normalized;
4221
4247
  }
4222
- normalizeHydratedOrderProduct(product) {
4248
+ normalizeHydratedOrderProduct(product, options) {
4223
4249
  let row = { ...product || {} };
4224
4250
  if (row.num === void 0 && row.product_quantity !== void 0) {
4225
4251
  row.num = row.product_quantity;
@@ -4246,7 +4272,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4246
4272
  if (!existingIdentity) {
4247
4273
  row.metadata.unique_identification_number = (0, import_utils.createUuidV4)();
4248
4274
  }
4249
- row.metadata.is_edit_for_runtime = true;
4275
+ if (options == null ? void 0 : options.makeEditMark) {
4276
+ row.metadata.is_edit_for_runtime = true;
4277
+ }
4250
4278
  const normalized = (0, import_utils3.normalizeOrderProduct)(row);
4251
4279
  normalized.discount_list = (0, import_utils.normalizeOrderProductDiscountList)(
4252
4280
  normalized.discount_list
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -1301,6 +1301,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1301
1301
  }
1302
1302
  await this.store.order.recalculateSummary({ createIfMissing: true });
1303
1303
  this.store.order.persistTempOrder();
1304
+ await this.effectsEmit("onDiscountApplied", {
1305
+ productList: tempOrder.products || [],
1306
+ discountList: nextDiscountList,
1307
+ selectedDiscountList: tempOrder.discount_list || [],
1308
+ tempOrder
1309
+ });
1304
1310
  cb == null ? void 0 : cb(result);
1305
1311
  return result;
1306
1312
  }
@@ -1341,6 +1347,13 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1341
1347
  if (raw.isAvailable) {
1342
1348
  await this.store.order.recalculateSummary({ createIfMissing: true });
1343
1349
  this.store.order.persistTempOrder();
1350
+ const tempOrder = this.store.order.ensureTempOrder();
1351
+ await this.effectsEmit("onDiscountApplied", {
1352
+ productList: tempOrder.products || [],
1353
+ discountList: this.store.order.getDiscountList(),
1354
+ selectedDiscountList: tempOrder.discount_list || [],
1355
+ tempOrder
1356
+ });
1344
1357
  }
1345
1358
  return {
1346
1359
  isAvailable: raw.isAvailable,
@@ -1499,6 +1512,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1499
1512
  }
1500
1513
  await this.store.order.recalculateSummary({ createIfMissing: true });
1501
1514
  this.store.order.persistTempOrder();
1515
+ await this.effectsEmit("onDiscountApplied", {
1516
+ productList: tempOrder.products || [],
1517
+ discountList: result.discountList || [],
1518
+ selectedDiscountList: tempOrder.discount_list || [],
1519
+ tempOrder
1520
+ });
1502
1521
  } catch (error) {
1503
1522
  throw error;
1504
1523
  }
@@ -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 | 6 | 3 | 4 | 5;
314
+ weekNum: 0 | 1 | 5 | 3 | 2 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -350,6 +350,13 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
350
350
  if (raw.isAvailable) {
351
351
  await this.store.order.recalculateSummary({ createIfMissing: true });
352
352
  this.store.order.persistTempOrder();
353
+ const tempOrder = this.store.order.ensureTempOrder();
354
+ await this.effectsEmit("onDiscountApplied", {
355
+ productList: tempOrder.products || [],
356
+ discountList: this.store.order.getDiscountList(),
357
+ selectedDiscountList: tempOrder.discount_list || [],
358
+ tempOrder
359
+ });
353
360
  }
354
361
  return {
355
362
  isAvailable: raw.isAvailable,
@@ -870,7 +877,17 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
870
877
  void ((_a = discountModule == null ? void 0 : discountModule.setOriginalDiscountList) == null ? void 0 : _a.call(discountModule, []));
871
878
  void ((_b = discountModule == null ? void 0 : discountModule.setDiscountList) == null ? void 0 : _b.call(discountModule, []));
872
879
  this.store.order.applyDiscount();
873
- void this.store.order.recalculateSummary({ createIfMissing: true }).then(() => this.store.order.persistTempOrder()).catch((error) => {
880
+ void this.store.order.recalculateSummary({ createIfMissing: true }).then(() => {
881
+ var _a2;
882
+ const tempOrder = this.store.order.ensureTempOrder();
883
+ this.store.order.persistTempOrder();
884
+ return this.effectsEmit("onDiscountApplied", {
885
+ productList: tempOrder.products || [],
886
+ discountList: ((_a2 = discountModule == null ? void 0 : discountModule.getDiscountList) == null ? void 0 : _a2.call(discountModule)) || [],
887
+ selectedDiscountList: tempOrder.discount_list || [],
888
+ tempOrder
889
+ });
890
+ }).catch((error) => {
874
891
  console.error("Failed to recalculate summary after clearing customer:", error);
875
892
  });
876
893
  this.core.effects.emit(`${this.name}:onOrderCustomerChange`, null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.23",
4
+ "version": "2.3.25",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",