@pisell/pisellos 0.0.324 → 0.0.325

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 (90) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/modules/Account/index.js +2 -3
  3. package/dist/modules/BaseModule.d.ts +3 -0
  4. package/dist/modules/BaseModule.js +15 -0
  5. package/dist/modules/Customer/index.js +9 -10
  6. package/dist/modules/Customer/types.d.ts +1 -1
  7. package/dist/modules/Discount/index.js +1 -1
  8. package/dist/modules/Guests/index.js +9 -9
  9. package/dist/modules/Payment/index.js +18 -18
  10. package/dist/modules/Payment/types.d.ts +7 -7
  11. package/dist/modules/Payment/walletpass.js +4 -1
  12. package/dist/modules/Product/index.d.ts +1 -1
  13. package/dist/modules/ProductList/index.js +2 -3
  14. package/dist/modules/Resource/index.js +1 -1
  15. package/dist/modules/Rules/index.js +2 -3
  16. package/dist/modules/Rules/types.d.ts +1 -1
  17. package/dist/modules/Schedule/type.d.ts +7 -7
  18. package/dist/modules/Schedule/types.d.ts +9 -9
  19. package/dist/solution/BookingByStep/index.d.ts +1 -1
  20. package/dist/solution/BookingByStep/index.js +2 -2
  21. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  22. package/dist/solution/BookingTicket/index.js +7 -7
  23. package/dist/solution/BuyTickets/index.js +7 -8
  24. package/dist/solution/Checkout/index.js +29 -29
  25. package/dist/solution/ShopDiscount/index.js +1 -1
  26. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  27. package/dist/types/index.d.ts +1 -1
  28. package/dist/utils/task.d.ts +2 -2
  29. package/dist/utils/watch.d.ts +2 -2
  30. package/lib/core/index.js +28 -27
  31. package/lib/effects/index.d.ts +2 -2
  32. package/lib/effects/index.js +7 -3
  33. package/lib/modules/Account/index.js +12 -12
  34. package/lib/modules/AccountList/index.js +11 -14
  35. package/lib/modules/BaseModule.d.ts +3 -0
  36. package/lib/modules/BaseModule.js +12 -6
  37. package/lib/modules/Cart/index.js +9 -14
  38. package/lib/modules/Cart/utils/cartProduct.js +6 -3
  39. package/lib/modules/Customer/constants.js +1 -1
  40. package/lib/modules/Customer/index.js +24 -28
  41. package/lib/modules/Customer/types.d.ts +1 -1
  42. package/lib/modules/Date/index.js +6 -10
  43. package/lib/modules/Date/types.js +0 -1
  44. package/lib/modules/Discount/index.js +7 -12
  45. package/lib/modules/Guests/index.js +24 -19
  46. package/lib/modules/Order/index.js +9 -11
  47. package/lib/modules/Payment/cash.js +1 -1
  48. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  49. package/lib/modules/Payment/eftpos.js +1 -1
  50. package/lib/modules/Payment/index.js +86 -97
  51. package/lib/modules/Payment/types.d.ts +7 -7
  52. package/lib/modules/Payment/utils.js +6 -3
  53. package/lib/modules/Payment/walletpass.js +34 -32
  54. package/lib/modules/Product/index.d.ts +1 -1
  55. package/lib/modules/Product/index.js +5 -6
  56. package/lib/modules/ProductList/index.js +5 -8
  57. package/lib/modules/Resource/index.js +13 -9
  58. package/lib/modules/Rules/index.js +19 -15
  59. package/lib/modules/Rules/types.d.ts +1 -1
  60. package/lib/modules/Schedule/index.js +5 -8
  61. package/lib/modules/Schedule/type.d.ts +7 -7
  62. package/lib/modules/Schedule/types.d.ts +9 -9
  63. package/lib/modules/Schedule/utils.js +4 -2
  64. package/lib/modules/Step/index.js +4 -7
  65. package/lib/modules/Summary/index.js +4 -9
  66. package/lib/plugins/request.js +33 -34
  67. package/lib/plugins/window.js +113 -101
  68. package/lib/solution/BookingByStep/index.d.ts +1 -1
  69. package/lib/solution/BookingByStep/index.js +105 -71
  70. package/lib/solution/BookingByStep/utils/capacity.js +15 -10
  71. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  72. package/lib/solution/BookingByStep/utils/resources.js +8 -4
  73. package/lib/solution/BookingByStep/utils/stock.js +6 -3
  74. package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
  75. package/lib/solution/BookingTicket/index.js +20 -25
  76. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  77. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  78. package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
  79. package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
  80. package/lib/solution/BuyTickets/index.js +22 -23
  81. package/lib/solution/Checkout/index.js +227 -234
  82. package/lib/solution/Checkout/utils/index.js +22 -18
  83. package/lib/solution/ShopDiscount/index.js +12 -16
  84. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  85. package/lib/types/index.d.ts +1 -1
  86. package/lib/utils/task.d.ts +2 -2
  87. package/lib/utils/task.js +3 -3
  88. package/lib/utils/watch.d.ts +2 -2
  89. package/lib/utils/watch.js +7 -5
  90. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- declare type EffectCallback = (payload: any) => void | Promise<void | {
1
+ type EffectCallback = (payload: any) => void | Promise<void | {
2
2
  status: boolean;
3
3
  message?: string;
4
4
  }>;
5
- declare type UnsubscribeFunction = () => void;
5
+ type UnsubscribeFunction = () => void;
6
6
  declare class EffectsManager {
7
7
  private listeners;
8
8
  on(event: string, callback: EffectCallback): UnsubscribeFunction;
@@ -18,7 +18,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
20
  import { BaseModule } from "../BaseModule";
21
- import { AccountHooks } from "./types";
22
21
  export * from "./types";
23
22
  export var AccountModule = /*#__PURE__*/function (_BaseModule) {
24
23
  _inherits(AccountModule, _BaseModule);
@@ -85,7 +84,7 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
85
84
  this.store.accountInfo = account;
86
85
  this.store.isLoggedIn = true;
87
86
  _context2.next = 5;
88
- return this.core.effects.emit(AccountHooks.OnLogin, account);
87
+ return this.core.effects.emit("".concat(this.name, ":onLogin"), account);
89
88
  case 5:
90
89
  case "end":
91
90
  return _context2.stop();
@@ -117,7 +116,7 @@ export var AccountModule = /*#__PURE__*/function (_BaseModule) {
117
116
  case 2:
118
117
  this.store.accountInfo = _objectSpread(_objectSpread({}, this.store.accountInfo), updates);
119
118
  _context3.next = 5;
120
- return this.core.effects.emit(AccountHooks.OnProfileUpdate, this.store.accountInfo);
119
+ return this.core.effects.emit("".concat(this.name, ":onProfileUpdate"), this.store.accountInfo);
121
120
  case 5:
122
121
  case "end":
123
122
  return _context3.stop();
@@ -14,4 +14,7 @@ export declare class BaseModule {
14
14
  store: any;
15
15
  cacheKey: string[];
16
16
  }): void;
17
+ effectsOn(eventType: string, callback: (payload: any) => void): void;
18
+ effectsOff(eventType: string, callback: (payload: any) => void): void;
19
+ effectsOnce(eventType: string, callback: (payload: any) => void): void;
17
20
  }
@@ -66,6 +66,21 @@ export var BaseModule = /*#__PURE__*/function () {
66
66
  }
67
67
  }
68
68
  }
69
+ }, {
70
+ key: "effectsOn",
71
+ value: function effectsOn(eventType, callback) {
72
+ this.core.effects.on("".concat(this.name, ":").concat(eventType), callback);
73
+ }
74
+ }, {
75
+ key: "effectsOff",
76
+ value: function effectsOff(eventType, callback) {
77
+ this.core.effects.off("".concat(this.name, ":").concat(eventType), callback);
78
+ }
79
+ }, {
80
+ key: "effectsOnce",
81
+ value: function effectsOnce(eventType, callback) {
82
+ this.core.effects.once("".concat(this.name, ":").concat(eventType), callback);
83
+ }
69
84
  }]);
70
85
  return BaseModule;
71
86
  }();
@@ -29,7 +29,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
29
29
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
30
30
  import { cloneDeep } from 'lodash-es';
31
31
  import { BaseModule } from "../BaseModule";
32
- import { CustomerHooks } from "./types";
33
32
  import { DEFAULT_CUSTOMER, DEFAULT_PAGE_SIZE, SORT_BY } from "./constants";
34
33
  export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
35
34
  _inherits(CustomerModule, _BaseModule);
@@ -203,7 +202,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
203
202
  console.error("Failed to ".concat(operation, ":"), error);
204
203
  this.store.error = error instanceof Error ? error.message : "Failed to ".concat(operation);
205
204
  _context3.next = 4;
206
- return this.core.effects.emit(CustomerHooks.OnCustomerListError, this.store.error);
205
+ return this.core.effects.emit("".concat(this.name, ":onCustomerListError"), this.store.error);
207
206
  case 4:
208
207
  case "end":
209
208
  return _context3.stop();
@@ -266,7 +265,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
266
265
  // 设置客户列表(替换模式)
267
266
  this.store.customerList = cloneDeep(customerList);
268
267
  _context4.next = 20;
269
- return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
268
+ return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
270
269
  case 20:
271
270
  // 触发分页变化事件
272
271
  this.triggerPaginationChange({
@@ -329,7 +328,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
329
328
  key: "setSelectedCustomer",
330
329
  value: function setSelectedCustomer(customer) {
331
330
  this.store.selectedCustomer = !customer ? DEFAULT_CUSTOMER : cloneDeep(customer);
332
- this.core.effects.emit(CustomerHooks.OnCustomerSelected, this.store.selectedCustomer);
331
+ this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), this.store.selectedCustomer);
333
332
  this.storeChange();
334
333
  }
335
334
 
@@ -380,7 +379,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
380
379
  this.store.hasMore = true;
381
380
  this.store.loadingMore = false;
382
381
  this.store.searchParams = {};
383
- this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
382
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
384
383
  this.storeChange();
385
384
  }
386
385
 
@@ -401,7 +400,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
401
400
  this.store.total += 1;
402
401
 
403
402
  // 触发客户列表更新事件
404
- this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
403
+ this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
405
404
 
406
405
  // 保存状态变化
407
406
  this.storeChange();
@@ -439,7 +438,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
439
438
  }, {
440
439
  key: "triggerPaginationChange",
441
440
  value: function triggerPaginationChange(pagination) {
442
- this.core.effects.emit(CustomerHooks.OnPaginationChange, pagination);
441
+ this.core.effects.emit("".concat(this.name, ":onPaginationChange"), pagination);
443
442
  }
444
443
 
445
444
  /**
@@ -552,7 +551,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
552
551
 
553
552
  // 触发滚动加载特定事件
554
553
  _context6.next = 20;
555
- return this.core.effects.emit(CustomerHooks.OnScrollLoadMore, {
554
+ return this.core.effects.emit("".concat(this.name, ":onScrollLoadMore"), {
556
555
  newCustomers: newCustomers,
557
556
  allCustomers: this.store.customerList,
558
557
  currentPage: page,
@@ -560,7 +559,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
560
559
  });
561
560
  case 20:
562
561
  _context6.next = 22;
563
- return this.core.effects.emit(CustomerHooks.OnCustomerListUpdate, this.store);
562
+ return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
564
563
  case 22:
565
564
  // 触发分页变化事件
566
565
  this.triggerPaginationChange({
@@ -634,7 +633,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
634
633
  case 8:
635
634
  response = _context7.sent;
636
635
  _context7.next = 11;
637
- return this.core.effects.emit(CustomerHooks.OnScrollLoadComplete, {
636
+ return this.core.effects.emit("".concat(this.name, ":onScrollLoadComplete"), {
638
637
  customers: this.store.customerList,
639
638
  total: this.store.total,
640
639
  hasMore: this.store.hasMore
@@ -33,7 +33,7 @@ export interface ShopCustomer extends ICustomer {
33
33
  * walletDetails.wallet: 用户所有wallet
34
34
  * latestWalletDetail.wallet: 用户最新wallet
35
35
  */
36
- declare type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
36
+ type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
37
37
  /**
38
38
  * 获取客户列表参数
39
39
  */
@@ -314,7 +314,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
314
314
  this.store.discountList = [];
315
315
  this.core.effects.offByModuleDestroy(this.name);
316
316
  _context6.next = 4;
317
- return this.core.effects.emit(DiscountHooks.OnDestroy, {});
317
+ return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
318
318
  case 4:
319
319
  console.log('[Discount] 已销毁');
320
320
  case 5:
@@ -70,10 +70,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
70
70
  case 0:
71
71
  this.state.list.push(guest);
72
72
  _context2.next = 3;
73
- return this.core.effects.emit(GuestHooks.OnGuestAdd, guest);
73
+ return this.core.effects.emit("".concat(this.name, ":onGuestAdd"), guest);
74
74
  case 3:
75
75
  _context2.next = 5;
76
- return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
76
+ return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
77
77
  case 5:
78
78
  case "end":
79
79
  return _context2.stop();
@@ -107,7 +107,7 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
107
107
  return this.core.effects.emit(GuestHooks.OnGuestUpdate, this.state.list[index]);
108
108
  case 6:
109
109
  _context3.next = 8;
110
- return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
110
+ return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
111
111
  case 8:
112
112
  case "end":
113
113
  return _context3.stop();
@@ -138,10 +138,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
138
138
  case 3:
139
139
  _this$state$list$spli = this.state.list.splice(index, 1), _this$state$list$spli2 = _slicedToArray(_this$state$list$spli, 1), removed = _this$state$list$spli2[0];
140
140
  _context4.next = 6;
141
- return this.core.effects.emit(GuestHooks.OnGuestRemove, removed);
141
+ return this.core.effects.emit("".concat(this.name, ":onGuestRemove"), removed);
142
142
  case 6:
143
143
  _context4.next = 8;
144
- return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
144
+ return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
145
145
  case 8:
146
146
  case "end":
147
147
  return _context4.stop();
@@ -196,10 +196,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
196
196
  case 3:
197
197
  guest.items.push(item);
198
198
  _context6.next = 6;
199
- return this.core.effects.emit(GuestHooks.OnGuestUpdate, guest);
199
+ return this.core.effects.emit("".concat(this.name, ":onGuestUpdate"), guest);
200
200
  case 6:
201
201
  _context6.next = 8;
202
- return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
202
+ return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
203
203
  case 8:
204
204
  case "end":
205
205
  return _context6.stop();
@@ -239,10 +239,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
239
239
  case 6:
240
240
  guest.items.splice(index, 1);
241
241
  _context7.next = 9;
242
- return this.core.effects.emit(GuestHooks.OnGuestUpdate, guest);
242
+ return this.core.effects.emit("".concat(this.name, ":onGuestUpdate"), guest);
243
243
  case 9:
244
244
  _context7.next = 11;
245
- return this.core.effects.emit(GuestHooks.OnGuestChange, this.state.list);
245
+ return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
246
246
  case 11:
247
247
  case "end":
248
248
  return _context7.stop();
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
22
22
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
23
  import { BaseModule } from "../BaseModule";
24
- import { PaymentStatus, PaymentHooks, PaymentMethodType, RoundingRule } from "./types";
24
+ import { PaymentStatus, PaymentMethodType, RoundingRule } from "./types";
25
25
  import { getUniqueId } from "../Cart/utils";
26
26
  import { CashPaymentImpl } from "./cash";
27
27
  import { EftposPaymentImpl } from "./eftpos";
@@ -334,7 +334,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
334
334
  console.warn('[PaymentModule] 无法缓存支付方式,pay_method 表不存在');
335
335
  case 43:
336
336
  _context3.next = 45;
337
- return this.core.effects.emit(PaymentHooks.OnPaymentMethodsLoaded, payMethods);
337
+ return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsLoaded"), payMethods);
338
338
  case 45:
339
339
  this.logInfo('getPayMethodListAsync completed successfully', {
340
340
  methodCount: payMethods.length,
@@ -465,7 +465,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
465
465
  newMethods: newPayMethods
466
466
  };
467
467
  _context4.next = 54;
468
- return this.core.effects.emit(PaymentHooks.OnPaymentMethodsChanged, eventData);
468
+ return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsChanged"), eventData);
469
469
  case 54:
470
470
  _context4.next = 57;
471
471
  break;
@@ -697,7 +697,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
697
697
  return this.dbManager.update('order', existingOrder);
698
698
  case 15:
699
699
  _context7.next = 17;
700
- return this.core.effects.emit(PaymentHooks.OnOrderUpdated, existingOrder);
700
+ return this.core.effects.emit("".concat(this.name, ":onOrderUpdated"), existingOrder);
701
701
  case 17:
702
702
  return _context7.abrupt("return", existingOrder);
703
703
  case 20:
@@ -719,7 +719,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
719
719
  _context7.next = 23;
720
720
  return this.dbManager.add('order', newOrder);
721
721
  case 23:
722
- this.core.effects.emit(PaymentHooks.OnOrderAdded, newOrder);
722
+ this.core.effects.emit("".concat(this.name, ":onOrderAdded"), newOrder);
723
723
  this.logInfo('createPaymentOrderAsync completed - new payment order created', {
724
724
  orderUuid: newOrder.uuid,
725
725
  orderId: newOrder.id
@@ -772,7 +772,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
772
772
  return this.dbManager.delete('order', orderUuid);
773
773
  case 7:
774
774
  _context8.next = 9;
775
- return this.core.effects.emit(PaymentHooks.OnOrderDeleted, order);
775
+ return this.core.effects.emit("".concat(this.name, ":onOrderDeleted"), order);
776
776
  case 9:
777
777
  console.log('[PaymentModule] 支付订单删除成功:', orderUuid);
778
778
  case 10:
@@ -821,10 +821,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
821
821
  return this.dbManager.update('order', updatedOrder);
822
822
  case 9:
823
823
  _context9.next = 11;
824
- return this.core.effects.emit(PaymentHooks.OnOrderUpdated, updatedOrder);
824
+ return this.core.effects.emit("".concat(this.name, ":onOrderUpdated"), updatedOrder);
825
825
  case 11:
826
826
  _context9.next = 13;
827
- return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
827
+ return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
828
828
  action: 'update',
829
829
  order: updatedOrder,
830
830
  originalOrder: order
@@ -919,10 +919,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
919
919
  return this.dbManager.update('order', updatedOrder);
920
920
  case 19:
921
921
  _context10.next = 21;
922
- return this.core.effects.emit(PaymentHooks.OnOrderUpdated, updatedOrder);
922
+ return this.core.effects.emit("".concat(this.name, ":onOrderUpdated"), updatedOrder);
923
923
  case 21:
924
924
  _context10.next = 23;
925
- return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
925
+ return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
926
926
  action: 'order_id_replaced',
927
927
  order: updatedOrder,
928
928
  originalOrder: existingOrder,
@@ -1119,7 +1119,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1119
1119
  return this.dbManager.update('order', order);
1120
1120
  case 21:
1121
1121
  _context13.next = 23;
1122
- return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
1122
+ return this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
1123
1123
  orderUuid: orderUuid,
1124
1124
  payment: newPaymentItem
1125
1125
  });
@@ -1221,13 +1221,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1221
1221
  return this.dbManager.update('order', order);
1222
1222
  case 20:
1223
1223
  _context14.next = 22;
1224
- return this.core.effects.emit(PaymentHooks.OnPaymentDeleted, {
1224
+ return this.core.effects.emit("".concat(this.name, ":onPaymentDeleted"), {
1225
1225
  order: order,
1226
1226
  paymentItem: paymentItem
1227
1227
  });
1228
1228
  case 22:
1229
1229
  _context14.next = 24;
1230
- return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
1230
+ return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1231
1231
  action: 'payment_delete',
1232
1232
  order: order,
1233
1233
  paymentItem: paymentItem
@@ -1394,7 +1394,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1394
1394
  case 50:
1395
1395
  updatedOrder = _context15.sent;
1396
1396
  _context15.next = 53;
1397
- return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
1397
+ return this.core.effects.emit("".concat(this.name, ":onPaymentAdded"), {
1398
1398
  orderUuid: orderUuid,
1399
1399
  order: updatedOrder,
1400
1400
  payment: null // 批量操作不提供单个支付项
@@ -1473,13 +1473,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1473
1473
  return this.dbManager.update('order', order);
1474
1474
  case 14:
1475
1475
  _context16.next = 16;
1476
- return this.core.effects.emit(PaymentHooks.OnPaymentUpdated, {
1476
+ return this.core.effects.emit("".concat(this.name, ":onPaymentUpdated"), {
1477
1477
  order: order,
1478
1478
  paymentItem: paymentItem
1479
1479
  });
1480
1480
  case 16:
1481
1481
  _context16.next = 18;
1482
- return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
1482
+ return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1483
1483
  action: 'payment_update',
1484
1484
  order: order,
1485
1485
  paymentItem: paymentItem
@@ -1658,10 +1658,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1658
1658
  return _context18.abrupt("return");
1659
1659
  case 12:
1660
1660
  _context18.next = 14;
1661
- return this.core.effects.emit(PaymentHooks.OnPaymentSubmitted, order);
1661
+ return this.core.effects.emit("".concat(this.name, ":onPaymentSubmitted"), order);
1662
1662
  case 14:
1663
1663
  _context18.next = 16;
1664
- return this.core.effects.emit(PaymentHooks.OnOrderChanged, {
1664
+ return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1665
1665
  action: 'submit',
1666
1666
  order: order
1667
1667
  });
@@ -581,12 +581,12 @@ export declare enum PaymentHooks {
581
581
  OnOrderAmountChanged = "payment:onOrderAmountChanged",
582
582
  OnPaymentSyncError = "payment:onPaymentSyncError",
583
583
  OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess",
584
- OnWalletRecommendListUpdated = 0,
585
- OnWalletRecommendListCleared = 0,
586
- OnUserIdentificationCodesUpdated = 0,
587
- OnUserIdentificationCodesCleared = 0,
588
- OnWalletCacheCleared = 0,
589
- OnSearchIdentificationCodeCompleted = 0
584
+ OnWalletRecommendListUpdated = "wallet:onWalletRecommendListUpdated",
585
+ OnWalletRecommendListCleared = "wallet:onWalletRecommendListCleared",
586
+ OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
587
+ OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
588
+ OnWalletCacheCleared = "wallet:onWalletCacheCleared",
589
+ OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
590
590
  }
591
591
  /**
592
592
  * 钱包推荐扣款请求参数
@@ -739,7 +739,7 @@ export interface SearchIdentificationCodeResponse {
739
739
  /**
740
740
  * 搜索识别码结果类型
741
741
  */
742
- export declare type SearchIdentificationCodeResult = {
742
+ export type SearchIdentificationCodeResult = {
743
743
  type: 'walletCode';
744
744
  data: SearchIdentificationCodeItem[];
745
745
  } | {
@@ -40,7 +40,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
40
40
  key: "emitEvent",
41
41
  value: function emitEvent(hook, data) {
42
42
  try {
43
- this.paymentModule.core.effects.emit(hook, data);
43
+ // 提取事件名称,去掉模块前缀
44
+ var eventName = hook.split(':')[1] || hook.replace(/^[A-Z][a-z]+/, '').replace(/^On/, '').toLowerCase();
45
+ var fullEventName = "".concat(this.paymentModule.name, ":").concat(eventName);
46
+ this.paymentModule.core.effects.emit(fullEventName, data);
44
47
  } catch (error) {
45
48
  this.paymentModule.logError('[WalletPass] 发送事件失败', error, {
46
49
  hook: hook
@@ -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
  }
@@ -16,7 +16,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
17
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
18
  import { BaseModule } from "../BaseModule";
19
- import { ProductListHooks } from "./types";
20
19
  import { cloneDeep } from 'lodash-es';
21
20
  export * from "./types";
22
21
  export var ProductList = /*#__PURE__*/function (_BaseModule) {
@@ -195,7 +194,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
195
194
  while (1) switch (_context5.prev = _context5.next) {
196
195
  case 0:
197
196
  _context5.next = 2;
198
- return this.core.effects.emit(ProductListHooks.onGetProducts, this.store.list);
197
+ return this.core.effects.emit("".concat(this.name, ":onGetProducts"), this.store.list);
199
198
  case 2:
200
199
  return _context5.abrupt("return", cloneDeep(this.store.list));
201
200
  case 3:
@@ -218,7 +217,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
218
217
  while (1) switch (_context6.prev = _context6.next) {
219
218
  case 0:
220
219
  _context6.next = 2;
221
- return this.core.effects.emit(ProductListHooks.onGetProduct, this.store.list);
220
+ return this.core.effects.emit("".concat(this.name, ":onGetProduct"), this.store.list);
222
221
  case 2:
223
222
  product = this.store.list.find(function (product) {
224
223
  return product.id === id;
@@ -89,7 +89,7 @@ export var ResourceListModule = /*#__PURE__*/function (_BaseModule) {
89
89
  case 3:
90
90
  this.store.selectedResource = resource;
91
91
  _context3.next = 6;
92
- return this.core.effects.emit(ResourceHooks.OnResourceSelect, resource);
92
+ return this.core.effects.emit("".concat(this.name, ":onResourceSelect"), resource);
93
93
  case 6:
94
94
  case "end":
95
95
  return _context3.stop();
@@ -24,7 +24,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
24
24
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
25
25
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
26
  import { BaseModule } from "../BaseModule";
27
- import { RulesHooks } from "./types";
28
27
  import { uniqueById, getDiscountAmount } from "../../solution/ShopDiscount/utils";
29
28
  import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
30
29
  import Decimal from 'decimal.js';
@@ -73,7 +72,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
73
72
  case 0:
74
73
  this.store.rulesList = rulesList;
75
74
  _context2.next = 3;
76
- return this.core.effects.emit(RulesHooks.OnRulesListChange, rulesList);
75
+ return this.core.effects.emit("".concat(this.name, ":onRulesListChange"), rulesList);
77
76
  case 3:
78
77
  case "end":
79
78
  return _context2.stop();
@@ -665,7 +664,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
665
664
  case 0:
666
665
  this.core.effects.offByModuleDestroy(this.name);
667
666
  _context3.next = 3;
668
- return this.core.effects.emit(RulesHooks.OnDestroy, {});
667
+ return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
669
668
  case 3:
670
669
  console.log('[Rules] 已销毁');
671
670
  case 4:
@@ -24,7 +24,7 @@ export interface RulesModuleAPI {
24
24
  productList: any[];
25
25
  }) => DiscountResult;
26
26
  }
27
- declare type ProductDetail = {
27
+ type ProductDetail = {
28
28
  isClient?: boolean;
29
29
  isManualDiscount?: boolean;
30
30
  booking_id: any;
@@ -1,4 +1,4 @@
1
- export declare type ScheduleItem = {
1
+ export type ScheduleItem = {
2
2
  /** 颜色 */
3
3
  color: string;
4
4
  /** 创建时间 */
@@ -65,7 +65,7 @@ export declare type ScheduleItem = {
65
65
  schedule_id: number;
66
66
  }[];
67
67
  };
68
- export declare type ScheduleFormOtherValue = {
68
+ export type ScheduleFormOtherValue = {
69
69
  /** 截止模式
70
70
  * 1: 永不截止
71
71
  * 2: 按日期截止
@@ -79,11 +79,11 @@ export declare type ScheduleFormOtherValue = {
79
79
  includeStatus: boolean;
80
80
  type: 'standard' | 'time-slots' | 'designation';
81
81
  };
82
- export declare type ExcIncDate = {
82
+ export type ExcIncDate = {
83
83
  start: string;
84
84
  end: string;
85
85
  };
86
- export declare type ScheduleFormData = {
86
+ export type ScheduleFormData = {
87
87
  /** 颜色 */
88
88
  color: string;
89
89
  /** 日程名称 */
@@ -131,20 +131,20 @@ export declare type ScheduleFormData = {
131
131
  start_time: any;
132
132
  end_time: any;
133
133
  };
134
- export declare type CalendarDataItem = {
134
+ export type CalendarDataItem = {
135
135
  date: string;
136
136
  color: string[];
137
137
  isExcluded: boolean;
138
138
  schedule_ids?: number[];
139
139
  [key: string]: any;
140
140
  };
141
- export declare type RequestData<Data> = {
141
+ export type RequestData<Data> = {
142
142
  data: Data;
143
143
  status: boolean;
144
144
  message: string;
145
145
  code: number;
146
146
  };
147
- export declare type ResponseListData<Data> = {
147
+ export type ResponseListData<Data> = {
148
148
  status: boolean;
149
149
  message: string;
150
150
  code: number;
@@ -4,7 +4,7 @@ export interface ScheduleState {
4
4
  availabilityDateList: ScheduleAvailabilityDateItem[];
5
5
  otherProductsIds: number[];
6
6
  }
7
- export declare type ScheduleAvailabilityDateItem = {
7
+ export type ScheduleAvailabilityDateItem = {
8
8
  date: string;
9
9
  schedule_id: number[];
10
10
  product_ids: number[];
@@ -24,7 +24,7 @@ export interface LoadScheduleAvailableDateParams {
24
24
  }
25
25
  export interface ScheduleModuleAPI {
26
26
  }
27
- export declare type ScheduleItem = {
27
+ export type ScheduleItem = {
28
28
  /** 颜色 */
29
29
  color: string;
30
30
  /** 创建时间 */
@@ -91,7 +91,7 @@ export declare type ScheduleItem = {
91
91
  schedule_id: number;
92
92
  }[];
93
93
  };
94
- export declare type ScheduleFormOtherValue = {
94
+ export type ScheduleFormOtherValue = {
95
95
  /** 截止模式
96
96
  * 1: 永不截止
97
97
  * 2: 按日期截止
@@ -105,11 +105,11 @@ export declare type ScheduleFormOtherValue = {
105
105
  includeStatus: boolean;
106
106
  type: 'standard' | 'time-slots' | 'designation';
107
107
  };
108
- export declare type ExcIncDate = {
108
+ export type ExcIncDate = {
109
109
  start: string;
110
110
  end: string;
111
111
  };
112
- export declare type ScheduleFormData = {
112
+ export type ScheduleFormData = {
113
113
  /** 颜色 */
114
114
  color: string;
115
115
  /** 日程名称 */
@@ -157,20 +157,20 @@ export declare type ScheduleFormData = {
157
157
  start_time: any;
158
158
  end_time: any;
159
159
  };
160
- export declare type CalendarDataItem = {
160
+ export type CalendarDataItem = {
161
161
  date: string;
162
162
  color: string[];
163
163
  isExcluded: boolean;
164
164
  schedule_ids?: number[];
165
165
  [key: string]: any;
166
166
  };
167
- export declare type RequestData<Data> = {
167
+ export type RequestData<Data> = {
168
168
  data: Data;
169
169
  status: boolean;
170
170
  message: string;
171
171
  code: number;
172
172
  };
173
- export declare type ResponseListData<Data> = {
173
+ export type ResponseListData<Data> = {
174
174
  status: boolean;
175
175
  message: string;
176
176
  code: number;
@@ -181,7 +181,7 @@ export declare type ResponseListData<Data> = {
181
181
  skip: number;
182
182
  };
183
183
  };
184
- export declare type ScheduleAllMap = Record<string, {
184
+ export type ScheduleAllMap = Record<string, {
185
185
  minTime: dayjs.Dayjs | null;
186
186
  maxTime: dayjs.Dayjs | null;
187
187
  minTimeStr: string | null;
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  };
327
327
  setOtherData(key: string, value: any): void;
328
328
  getOtherData(key: string): any;
329
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
329
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
330
330
  /**
331
331
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
332
332
  *