@pisell/pisellos 1.0.146 → 1.0.148

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 (107) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/model/strategy/adapter/itemRule/type.d.ts +6 -6
  3. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  4. package/dist/model/strategy/adapter/promotion/type.d.ts +5 -5
  5. package/dist/model/strategy/type.d.ts +1 -1
  6. package/dist/modules/Cart/utils/changePrice.js +16 -9
  7. package/dist/modules/Customer/types.d.ts +1 -1
  8. package/dist/modules/Discount/types.d.ts +1 -1
  9. package/dist/modules/Payment/types.d.ts +7 -7
  10. package/dist/modules/Rules/index.js +2 -1
  11. package/dist/modules/Rules/types.d.ts +1 -1
  12. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  13. package/dist/modules/Schedule/type.d.ts +7 -7
  14. package/dist/modules/Schedule/types.d.ts +9 -9
  15. package/dist/solution/BookingByStep/index.d.ts +1 -1
  16. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  17. package/dist/solution/BookingTicket/index.d.ts +1 -1
  18. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  19. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  20. package/dist/types/index.d.ts +1 -1
  21. package/dist/utils/task.d.ts +2 -2
  22. package/dist/utils/watch.d.ts +2 -2
  23. package/lib/core/index.js +27 -28
  24. package/lib/effects/index.d.ts +2 -2
  25. package/lib/effects/index.js +3 -7
  26. package/lib/model/strategy/adapter/itemRule/adapter.js +7 -14
  27. package/lib/model/strategy/adapter/itemRule/evaluator.js +5 -5
  28. package/lib/model/strategy/adapter/itemRule/examples.js +12 -12
  29. package/lib/model/strategy/adapter/itemRule/type.d.ts +6 -6
  30. package/lib/model/strategy/adapter/promotion/adapter.js +2 -4
  31. package/lib/model/strategy/adapter/promotion/evaluator.js +16 -19
  32. package/lib/model/strategy/adapter/promotion/examples.js +8 -8
  33. package/lib/model/strategy/adapter/promotion/type.d.ts +5 -5
  34. package/lib/model/strategy/adapter/walletPass/evaluator.js +5 -5
  35. package/lib/model/strategy/adapter/walletPass/example.js +21 -21
  36. package/lib/model/strategy/adapter/walletPass/index.js +2 -4
  37. package/lib/model/strategy/adapter/walletPass/locales.js +18 -18
  38. package/lib/model/strategy/adapter/walletPass/utils.js +21 -42
  39. package/lib/model/strategy/engine.js +6 -8
  40. package/lib/model/strategy/strategy-example.js +19 -19
  41. package/lib/model/strategy/type.d.ts +1 -1
  42. package/lib/modules/Account/index.js +9 -10
  43. package/lib/modules/AccountList/index.js +14 -11
  44. package/lib/modules/BaseModule.js +6 -3
  45. package/lib/modules/Cart/index.js +14 -9
  46. package/lib/modules/Cart/utils/cartProduct.js +3 -6
  47. package/lib/modules/Cart/utils/changePrice.js +13 -9
  48. package/lib/modules/Customer/constants.js +1 -1
  49. package/lib/modules/Customer/index.js +18 -15
  50. package/lib/modules/Customer/types.d.ts +1 -1
  51. package/lib/modules/Date/index.js +10 -6
  52. package/lib/modules/Date/types.js +1 -0
  53. package/lib/modules/Discount/index.js +11 -6
  54. package/lib/modules/Discount/types.d.ts +1 -1
  55. package/lib/modules/Guests/index.js +10 -15
  56. package/lib/modules/Order/index.js +10 -7
  57. package/lib/modules/Payment/cash.js +1 -1
  58. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  59. package/lib/modules/Payment/eftpos.js +1 -1
  60. package/lib/modules/Payment/index.js +86 -73
  61. package/lib/modules/Payment/types.d.ts +7 -7
  62. package/lib/modules/Payment/utils.js +3 -6
  63. package/lib/modules/Payment/walletpass.js +33 -33
  64. package/lib/modules/Product/index.js +6 -5
  65. package/lib/modules/ProductList/index.js +5 -3
  66. package/lib/modules/Resource/index.js +8 -12
  67. package/lib/modules/Rules/index.js +24 -36
  68. package/lib/modules/Rules/types.d.ts +1 -1
  69. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  70. package/lib/modules/Schedule/index.js +8 -5
  71. package/lib/modules/Schedule/type.d.ts +7 -7
  72. package/lib/modules/Schedule/types.d.ts +9 -9
  73. package/lib/modules/Schedule/utils.js +2 -4
  74. package/lib/modules/Step/index.js +7 -4
  75. package/lib/modules/Summary/index.js +9 -4
  76. package/lib/modules/Summary/utils.js +8 -16
  77. package/lib/plugins/request.js +34 -33
  78. package/lib/plugins/window.js +101 -113
  79. package/lib/solution/BookingByStep/index.d.ts +1 -1
  80. package/lib/solution/BookingByStep/index.js +110 -177
  81. package/lib/solution/BookingByStep/utils/capacity.js +10 -15
  82. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  83. package/lib/solution/BookingByStep/utils/resources.js +4 -8
  84. package/lib/solution/BookingByStep/utils/stock.js +3 -6
  85. package/lib/solution/BookingByStep/utils/timeslots.js +26 -31
  86. package/lib/solution/BookingTicket/index.d.ts +1 -1
  87. package/lib/solution/BookingTicket/index.js +19 -14
  88. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  89. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  90. package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
  91. package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
  92. package/lib/solution/BuyTickets/index.js +15 -15
  93. package/lib/solution/Checkout/index.js +216 -211
  94. package/lib/solution/Checkout/utils/index.js +18 -22
  95. package/lib/solution/RegisterAndLogin/config.js +2 -2
  96. package/lib/solution/RegisterAndLogin/index.js +114 -110
  97. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  98. package/lib/solution/ShopDiscount/index.js +16 -13
  99. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  100. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  101. package/lib/solution/ShopDiscount/utils.js +1 -2
  102. package/lib/types/index.d.ts +1 -1
  103. package/lib/utils/task.d.ts +2 -2
  104. package/lib/utils/task.js +3 -3
  105. package/lib/utils/watch.d.ts +2 -2
  106. package/lib/utils/watch.js +5 -7
  107. package/package.json +16 -17
@@ -27,12 +27,12 @@ var import_utils = require("./utils");
27
27
  var WalletPassPaymentImpl = class {
28
28
  constructor(paymentModule) {
29
29
  this.paymentModule = paymentModule;
30
- this.walletRecommendList = [];
31
- this.userIdentificationCodes = [];
32
- this.searchResults = [];
33
- this.walletParams = null;
34
- this.walletInitData = null;
35
30
  }
31
+ walletRecommendList = [];
32
+ userIdentificationCodes = [];
33
+ searchResults = [];
34
+ walletParams = null;
35
+ walletInitData = null;
36
36
  /**
37
37
  * 发送事件的辅助方法
38
38
  * 支持使用WalletPassHooks或PaymentHooks
@@ -43,7 +43,7 @@ var WalletPassPaymentImpl = class {
43
43
  const fullEventName = `${this.paymentModule.name}:${eventName}`;
44
44
  this.paymentModule.core.effects.emit(fullEventName, data);
45
45
  } catch (error) {
46
- this.paymentModule.logError("[WalletPass] 发送事件失败", error, {
46
+ this.paymentModule.logError("[WalletPass] \u53D1\u9001\u4E8B\u4EF6\u5931\u8D25", error, {
47
47
  hook
48
48
  });
49
49
  }
@@ -80,7 +80,7 @@ var WalletPassPaymentImpl = class {
80
80
  payment_order_id
81
81
  };
82
82
  this.walletParams = walletParams;
83
- this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
83
+ this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u9ED8\u8BA4\u53C2\u6570\u5DF2\u751F\u6210\u5E76\u5B58\u50A8", {
84
84
  customer_id: walletParams.customer_id,
85
85
  order_expect_amount: walletParams.order_expect_amount,
86
86
  order_product_amount: walletParams.order_product_amount,
@@ -102,7 +102,7 @@ var WalletPassPaymentImpl = class {
102
102
  */
103
103
  clearStoredWalletParams() {
104
104
  this.walletParams = null;
105
- this.paymentModule.logInfo("[WalletPass] 已存储的钱包参数已清理");
105
+ this.paymentModule.logInfo("[WalletPass] \u5DF2\u5B58\u50A8\u7684\u94B1\u5305\u53C2\u6570\u5DF2\u6E05\u7406");
106
106
  }
107
107
  /**
108
108
  * 从业务数据初始化钱包数据
@@ -125,7 +125,7 @@ var WalletPassPaymentImpl = class {
125
125
  businessData,
126
126
  startTime
127
127
  });
128
- this.paymentModule.logInfo("[WalletPass] 开始从业务数据初始化钱包数据", {
128
+ this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E", {
129
129
  customer_id: businessData.customer_id,
130
130
  totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
131
131
  subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
@@ -143,7 +143,7 @@ var WalletPassPaymentImpl = class {
143
143
  endTime,
144
144
  duration
145
145
  });
146
- this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
146
+ this.paymentModule.logInfo(`[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u6210\u529F`, {
147
147
  duration: `${duration}ms`,
148
148
  walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
149
149
  userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
@@ -160,7 +160,7 @@ var WalletPassPaymentImpl = class {
160
160
  duration
161
161
  });
162
162
  this.paymentModule.logError(
163
- `[WalletPass] 从业务数据初始化钱包数据失败`,
163
+ `[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25`,
164
164
  error,
165
165
  {
166
166
  duration: `${duration}ms`,
@@ -234,7 +234,7 @@ var WalletPassPaymentImpl = class {
234
234
  products: products || []
235
235
  };
236
236
  } catch (error) {
237
- this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
237
+ this.paymentModule.logError("[WalletPass] \u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", error, {
238
238
  customer_id: baseParams.customer_id,
239
239
  order_expect_amount: baseParams.order_expect_amount
240
240
  });
@@ -244,7 +244,7 @@ var WalletPassPaymentImpl = class {
244
244
  async getWalletPassRecommendListAsync(params) {
245
245
  var _a;
246
246
  try {
247
- this.paymentModule.logInfo("[WalletPass] 开始获取钱包推荐列表", {
247
+ this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868", {
248
248
  customer_id: params.customer_id,
249
249
  order_expect_amount: params.order_expect_amount,
250
250
  sale_channel: params.sale_channel,
@@ -259,7 +259,7 @@ var WalletPassPaymentImpl = class {
259
259
  this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
260
260
  walletRecommendList: this.walletRecommendList
261
261
  });
262
- this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已更新", {
262
+ this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u66F4\u65B0", {
263
263
  count: this.walletRecommendList.length,
264
264
  items: this.walletRecommendList.map((item) => ({
265
265
  voucher_id: item.voucher_id,
@@ -270,7 +270,7 @@ var WalletPassPaymentImpl = class {
270
270
  });
271
271
  return this.walletRecommendList;
272
272
  } catch (error) {
273
- this.paymentModule.logError("[WalletPass] 获取钱包推荐列表失败", error, {
273
+ this.paymentModule.logError("[WalletPass] \u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868\u5931\u8D25", error, {
274
274
  customer_id: params.customer_id,
275
275
  order_expect_amount: params.order_expect_amount,
276
276
  sale_channel: params.sale_channel
@@ -288,7 +288,7 @@ var WalletPassPaymentImpl = class {
288
288
  ...this.walletParams,
289
289
  ...params
290
290
  };
291
- this.paymentModule.logInfo("[WalletPass] 开始获取用户识别码列表", {
291
+ this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868", {
292
292
  customer_id: newParams.customer_id,
293
293
  available: newParams.available,
294
294
  prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
@@ -304,7 +304,7 @@ var WalletPassPaymentImpl = class {
304
304
  this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
305
305
  userIdentificationCodes: this.userIdentificationCodes
306
306
  });
307
- this.paymentModule.logInfo("[WalletPass] 用户识别码列表已更新", {
307
+ this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u66F4\u65B0", {
308
308
  count: this.userIdentificationCodes.length,
309
309
  sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
310
310
  code: item.code,
@@ -315,7 +315,7 @@ var WalletPassPaymentImpl = class {
315
315
  return this.userIdentificationCodes;
316
316
  } catch (error) {
317
317
  this.paymentModule.logError(
318
- "[WalletPass] 获取用户识别码列表失败",
318
+ "[WalletPass] \u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5931\u8D25",
319
319
  error,
320
320
  {
321
321
  customer_id: params.customer_id,
@@ -334,7 +334,7 @@ var WalletPassPaymentImpl = class {
334
334
  async searchIdentificationCodeAsync(params, config = {}) {
335
335
  try {
336
336
  const { code } = params;
337
- this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
337
+ this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u641C\u7D22\u8BC6\u522B\u7801", {
338
338
  code,
339
339
  code_length: code.length,
340
340
  noCache: config.noCache || false
@@ -346,7 +346,7 @@ var WalletPassPaymentImpl = class {
346
346
  with_customer: 1,
347
347
  with: ["wallet"]
348
348
  };
349
- this.paymentModule.logInfo("[WalletPass] 搜索钱包识别码", {
349
+ this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u94B1\u5305\u8BC6\u522B\u7801", {
350
350
  code,
351
351
  with_customer: walletDetailParams.with_customer,
352
352
  with: walletDetailParams.with
@@ -356,7 +356,7 @@ var WalletPassPaymentImpl = class {
356
356
  walletDetailParams
357
357
  );
358
358
  const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
359
- this.paymentModule.logInfo("[WalletPass] 钱包识别码搜索完成", {
359
+ this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
360
360
  code,
361
361
  results_count: searchResults2.length,
362
362
  type: "walletCode"
@@ -382,7 +382,7 @@ var WalletPassPaymentImpl = class {
382
382
  code: params.code,
383
383
  payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
384
384
  };
385
- this.paymentModule.logInfo("[WalletPass] 搜索普通识别码", {
385
+ this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u666E\u901A\u8BC6\u522B\u7801", {
386
386
  code: searchParams.code,
387
387
  customer_id: searchParams.customer_id,
388
388
  order_expect_amount: searchParams.order_expect_amount,
@@ -415,7 +415,7 @@ var WalletPassPaymentImpl = class {
415
415
  cachedSearchResults: [...this.searchResults],
416
416
  searchParams: params
417
417
  });
418
- this.paymentModule.logInfo("[WalletPass] 普通识别码搜索完成", {
418
+ this.paymentModule.logInfo("[WalletPass] \u666E\u901A\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
419
419
  code: params.code,
420
420
  results_count: searchResults.length,
421
421
  cached_results_count: this.searchResults.length,
@@ -426,7 +426,7 @@ var WalletPassPaymentImpl = class {
426
426
  data: searchResults
427
427
  };
428
428
  } catch (error) {
429
- this.paymentModule.logError("[WalletPass] 搜索识别码信息失败", error, {
429
+ this.paymentModule.logError("[WalletPass] \u641C\u7D22\u8BC6\u522B\u7801\u4FE1\u606F\u5931\u8D25", error, {
430
430
  code: params.code,
431
431
  customer_id: params.customer_id,
432
432
  order_expect_amount: params.order_expect_amount
@@ -435,19 +435,19 @@ var WalletPassPaymentImpl = class {
435
435
  }
436
436
  }
437
437
  async processWalletPayment(amount, orderUuid, voucherId) {
438
- this.paymentModule.logInfo("[WalletPass] 开始处理钱包支付", {
438
+ this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u5904\u7406\u94B1\u5305\u652F\u4ED8", {
439
439
  amount,
440
440
  orderUuid,
441
441
  voucherId: voucherId || "none"
442
442
  });
443
443
  const walletMethod = await this.paymentModule.getWalletPaymentMethod();
444
444
  if (!walletMethod) {
445
- this.paymentModule.logError("[WalletPass] 钱包支付方式未找到", null, {
445
+ this.paymentModule.logError("[WalletPass] \u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230", null, {
446
446
  amount,
447
447
  orderUuid,
448
448
  voucherId
449
449
  });
450
- throw new Error("钱包支付方式未找到");
450
+ throw new Error("\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
451
451
  }
452
452
  const paymentItem = {
453
453
  amount: amount.toString(),
@@ -458,7 +458,7 @@ var WalletPassPaymentImpl = class {
458
458
  voucher_id: voucherId || ""
459
459
  };
460
460
  await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
461
- this.paymentModule.logInfo("[WalletPass] 钱包支付处理完成", {
461
+ this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u652F\u4ED8\u5904\u7406\u5B8C\u6210", {
462
462
  amount,
463
463
  orderUuid,
464
464
  voucherId: voucherId || "none",
@@ -488,7 +488,7 @@ var WalletPassPaymentImpl = class {
488
488
  this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
489
489
  clearedTypes: ["walletRecommendList"]
490
490
  });
491
- this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已清除");
491
+ this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u6E05\u9664");
492
492
  }
493
493
  /**
494
494
  * 清除用户识别码列表
@@ -498,7 +498,7 @@ var WalletPassPaymentImpl = class {
498
498
  this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
499
499
  clearedTypes: ["userIdentificationCodes"]
500
500
  });
501
- this.paymentModule.logInfo("[WalletPass] 用户识别码列表已清除");
501
+ this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u6E05\u9664");
502
502
  }
503
503
  /**
504
504
  * 获取缓存的搜索结果列表
@@ -517,7 +517,7 @@ var WalletPassPaymentImpl = class {
517
517
  */
518
518
  clearSearchResults() {
519
519
  this.searchResults = [];
520
- this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
520
+ this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u7ED3\u679C\u7F13\u5B58\u5DF2\u6E05\u9664");
521
521
  }
522
522
  /**
523
523
  * 获取存储的钱包初始化数据
@@ -530,7 +530,7 @@ var WalletPassPaymentImpl = class {
530
530
  */
531
531
  clearStoredWalletInitData() {
532
532
  this.walletInitData = null;
533
- this.paymentModule.logInfo("[WalletPass] 钱包初始化数据已清除");
533
+ this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u521D\u59CB\u5316\u6570\u636E\u5DF2\u6E05\u9664");
534
534
  }
535
535
  /**
536
536
  * 清除所有缓存数据
@@ -544,7 +544,7 @@ var WalletPassPaymentImpl = class {
544
544
  this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
545
545
  clearedTypes: ["all"]
546
546
  });
547
- this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
547
+ this.paymentModule.logInfo("[WalletPass] \u6240\u6709\u7F13\u5B58\u6570\u636E\u5DF2\u6E05\u9664", {
548
548
  cleared_types: [
549
549
  "walletRecommendList",
550
550
  "userIdentificationCodes",
@@ -26,13 +26,14 @@ module.exports = __toCommonJS(Product_exports);
26
26
  var import_BaseModule = require("../BaseModule");
27
27
  __reExport(Product_exports, require("./types"), module.exports);
28
28
  var Product = class extends import_BaseModule.BaseModule {
29
+ defaultName = "product";
30
+ defaultVersion = "1.0.0";
31
+ store;
32
+ otherParams = {
33
+ scheduler: []
34
+ };
29
35
  constructor(name, version) {
30
36
  super(name, version);
31
- this.defaultName = "product";
32
- this.defaultVersion = "1.0.0";
33
- this.otherParams = {
34
- scheduler: []
35
- };
36
37
  }
37
38
  async initialize(core, options) {
38
39
  this.core = core;
@@ -27,11 +27,13 @@ var import_BaseModule = require("../BaseModule");
27
27
  var import_lodash_es = require("lodash-es");
28
28
  __reExport(ProductList_exports, require("./types"), module.exports);
29
29
  var ProductList = class extends import_BaseModule.BaseModule {
30
+ defaultName = "productList";
31
+ defaultVersion = "1.0.0";
32
+ store;
33
+ request;
34
+ otherParams = {};
30
35
  constructor(name, version) {
31
36
  super(name, version);
32
- this.defaultName = "productList";
33
- this.defaultVersion = "1.0.0";
34
- this.otherParams = {};
35
37
  }
36
38
  async initialize(core, options) {
37
39
  var _a;
@@ -25,10 +25,11 @@ module.exports = __toCommonJS(Resource_exports);
25
25
  var import_BaseModule = require("../BaseModule");
26
26
  var import_types = require("./types");
27
27
  var ResourceListModule = class extends import_BaseModule.BaseModule {
28
+ defaultName = "resourceList";
29
+ defaultVersion = "1.0.0";
30
+ store;
28
31
  constructor(name, version) {
29
32
  super(name, version);
30
- this.defaultName = "resourceList";
31
- this.defaultVersion = "1.0.0";
32
33
  }
33
34
  async initialize(core, options) {
34
35
  this.core = core;
@@ -39,8 +40,7 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
39
40
  }
40
41
  async selectResource(resourceId) {
41
42
  const resource = this.store.list.find((r) => r.id === resourceId);
42
- if (!resource)
43
- return;
43
+ if (!resource) return;
44
44
  this.store.selectedResource = resource;
45
45
  await this.core.effects.emit(`${this.name}:onResourceSelect`, resource);
46
46
  }
@@ -49,22 +49,19 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
49
49
  }
50
50
  async checkAvailability(resourceId, start, end) {
51
51
  const resource = this.store.list.find((r) => r.id === resourceId);
52
- if (!resource)
53
- return false;
52
+ if (!resource) return false;
54
53
  return resource.timeSlots.some(
55
54
  (slot) => slot.start.getTime() <= start.getTime() && slot.end.getTime() >= end.getTime() && slot.availableCapacity > 0
56
55
  );
57
56
  }
58
57
  async getAvailableTimeSlots(resourceId) {
59
58
  const resource = this.store.list.find((r) => r.id === resourceId);
60
- if (!resource)
61
- return [];
59
+ if (!resource) return [];
62
60
  return resource.timeSlots.filter((slot) => slot.availableCapacity > 0);
63
61
  }
64
62
  getAvailableCapacity(resourceId, timeSlot) {
65
63
  const resource = this.store.list.find((r) => r.id === resourceId);
66
- if (!resource)
67
- return 0;
64
+ if (!resource) return 0;
68
65
  const slot = resource.timeSlots.find(
69
66
  (s) => s.start.getTime() === timeSlot.start.getTime() && s.end.getTime() === timeSlot.end.getTime()
70
67
  );
@@ -72,8 +69,7 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
72
69
  }
73
70
  async updateResource(resourceId, updates) {
74
71
  const index = this.store.list.findIndex((r) => r.id === resourceId);
75
- if (index === -1)
76
- return;
72
+ if (index === -1) return;
77
73
  this.store.list[index] = {
78
74
  ...this.store.list[index],
79
75
  ...updates
@@ -40,10 +40,14 @@ var import_decimal = __toESM(require("decimal.js"));
40
40
  var import_lodash_es = require("lodash-es");
41
41
  var import_dayjs = __toESM(require("dayjs"));
42
42
  var RulesModule = class extends import_BaseModule.BaseModule {
43
+ defaultName = "rules";
44
+ defaultVersion = "1.0.0";
45
+ store;
46
+ window;
47
+ // WindowPlugin 实例
48
+ hooks;
43
49
  constructor(name, version) {
44
50
  super(name, version);
45
- this.defaultName = "rules";
46
- this.defaultVersion = "1.0.0";
47
51
  this.hooks = {};
48
52
  }
49
53
  async initialize(core, options) {
@@ -62,14 +66,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
62
66
  // 商品不需要holder,则不需要判断,直接返回true,商品需要holder但是还没填写,那么暂时不使用带有holder的券,直到填写才去匹配
63
67
  checkHolderMatch(discount, product, holders) {
64
68
  var _a;
65
- if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form")
66
- return true;
69
+ if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form") return true;
67
70
  const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : void 0;
68
71
  const productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
69
- if (!product.isNeedHolder)
70
- return true;
71
- if (!orderHolderId && !productHolderId)
72
- return false;
72
+ if (!product.isNeedHolder) return true;
73
+ if (!orderHolderId && !productHolderId) return false;
73
74
  return (productHolderId || orderHolderId) === discount.holder.holder_id;
74
75
  }
75
76
  getWalletPassEvaluator() {
@@ -278,19 +279,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
278
279
  const getPriority = (discount) => {
279
280
  const isHolder = isHolderDiscount(discount);
280
281
  if (isHolder) {
281
- if (isGoodPass(discount))
282
- return 1;
283
- if (isItemLevelDiscount(discount))
284
- return 2;
285
- if (isOrderLevelDiscount(discount))
286
- return 3;
282
+ if (isGoodPass(discount)) return 1;
283
+ if (isItemLevelDiscount(discount)) return 2;
284
+ if (isOrderLevelDiscount(discount)) return 3;
287
285
  } else {
288
- if (isGoodPass(discount))
289
- return 4;
290
- if (isItemLevelDiscount(discount))
291
- return 5;
292
- if (isOrderLevelDiscount(discount))
293
- return 6;
286
+ if (isGoodPass(discount)) return 4;
287
+ if (isItemLevelDiscount(discount)) return 5;
288
+ if (isOrderLevelDiscount(discount)) return 6;
294
289
  }
295
290
  return 7;
296
291
  };
@@ -306,10 +301,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
306
301
  var _a, _b;
307
302
  const typeA = ((_a = itemA.metadata) == null ? void 0 : _a.discount_card_type) || "percent";
308
303
  const typeB = ((_b = itemB.metadata) == null ? void 0 : _b.discount_card_type) || "percent";
309
- if (typeA === "fixed_amount" && typeB === "percent")
310
- return -1;
311
- if (typeA === "percent" && typeB === "fixed_amount")
312
- return 1;
304
+ if (typeA === "fixed_amount" && typeB === "percent") return -1;
305
+ if (typeA === "percent" && typeB === "fixed_amount") return 1;
313
306
  if (typeA === "fixed_amount" && typeB === "fixed_amount") {
314
307
  if (itemA.par_value !== itemB.par_value) {
315
308
  const valueA = new import_decimal.default(itemA.par_value || 0);
@@ -336,8 +329,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
336
329
  }
337
330
  if (a.tag === "product_discount_card" && b.tag === "product_discount_card") {
338
331
  const valueCompare = compareDiscountCardValue(a, b);
339
- if (valueCompare !== 0)
340
- return valueCompare;
332
+ if (valueCompare !== 0) return valueCompare;
341
333
  return compareByExpireTime(a, b);
342
334
  }
343
335
  return compareByExpireTime(a, b);
@@ -676,13 +668,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
676
668
  return false;
677
669
  }
678
670
  }
679
- if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.length) && (discount.tag || discount.type) === "good_pass")
680
- return false;
671
+ if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.length) && (discount.tag || discount.type) === "good_pass") return false;
681
672
  if ((Number(product.price) <= 0 || !product.price) && !((_c2 = product.discount_list) == null ? void 0 : _c2.find((n) => {
682
673
  var _a3;
683
674
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
684
- })) && (discount.tag || discount.type) !== "good_pass")
685
- return false;
675
+ })) && (discount.tag || discount.type) !== "good_pass") return false;
686
676
  const targetUsedDiscounts = usedDiscounts.get(discount.id);
687
677
  if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
688
678
  return false;
@@ -720,8 +710,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
720
710
  },
721
711
  holders
722
712
  );
723
- if (!isHolderMatch)
724
- return false;
713
+ if (!isHolderMatch) return false;
725
714
  if (limitedData.type === "product_all") {
726
715
  if (limitedData.filter === 1 && limitedData.exclude_product_ids.includes(product.id)) {
727
716
  return false;
@@ -1084,8 +1073,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1084
1073
  var _a3;
1085
1074
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === nextDiscount.id;
1086
1075
  }
1087
- )) && nextDiscountType !== "good_pass")
1088
- return false;
1076
+ )) && nextDiscountType !== "good_pass") return false;
1089
1077
  if (usedDiscounts.get(nextDiscount.id) && nextDiscountType === "good_pass")
1090
1078
  return false;
1091
1079
  if (nextDiscountType === "good_pass") {
@@ -1795,7 +1783,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1795
1783
  }
1796
1784
  const ruleType = usageRules.type;
1797
1785
  const packageScope = usageRules == null ? void 0 : usageRules.package_scope;
1798
- const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
1786
+ const { type: scopeType = "product_all", exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
1799
1787
  const isMainProduct = flatItem.type === "main";
1800
1788
  const isBundleItem = flatItem.type === "bundle";
1801
1789
  if (isMainProduct) {
@@ -1865,7 +1853,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1865
1853
  async destroy() {
1866
1854
  this.core.effects.offByModuleDestroy(this.name);
1867
1855
  await this.core.effects.emit(`${this.name}:onDestroy`, {});
1868
- console.log("[Rules] 已销毁");
1856
+ console.log("[Rules] \u5DF2\u9500\u6BC1");
1869
1857
  }
1870
1858
  async clear() {
1871
1859
  console.log("[Rules] clear");
@@ -35,7 +35,7 @@ export interface RulesModuleAPI {
35
35
  isFormSubject: boolean;
36
36
  }) => DiscountResult;
37
37
  }
38
- type ProductDetail = {
38
+ declare type ProductDetail = {
39
39
  isClient?: boolean;
40
40
  isManualDiscount?: boolean;
41
41
  booking_id: any;
@@ -1,7 +1,7 @@
1
1
  import dayjs from "dayjs";
2
2
  import { ScheduleItem } from "./types";
3
3
  export declare const getDateIsInSchedule: (dateTime: string, scheduleList: ScheduleItem[]) => boolean;
4
- export type ScheduleTimeSlot = {
4
+ export declare type ScheduleTimeSlot = {
5
5
  /** 开始时间 HH:mm */
6
6
  start_time: string;
7
7
  /** 结束时间 HH:mm */
@@ -43,19 +43,22 @@ var import_getDateIsInSchedule = require("./getDateIsInSchedule");
43
43
  import_dayjs.default.extend(import_isSameOrBefore.default);
44
44
  import_dayjs.default.extend(import_isSameOrAfter.default);
45
45
  var ScheduleModule = class extends import_BaseModule.BaseModule {
46
+ defaultName = "schedule";
47
+ defaultVersion = "1.0.0";
48
+ request;
49
+ store = {};
50
+ cacheId;
51
+ openCache = false;
52
+ fatherModule;
46
53
  constructor(name, version) {
47
54
  super(name, version);
48
- this.defaultName = "schedule";
49
- this.defaultVersion = "1.0.0";
50
- this.store = {};
51
- this.openCache = false;
52
55
  }
53
56
  async initialize(core, options) {
54
57
  var _a, _b;
55
58
  this.core = core;
56
59
  this.request = core.getPlugin("request");
57
60
  if (!this.request) {
58
- throw new Error("ScheduleModule 需要 request 插件支持");
61
+ throw new Error("ScheduleModule \u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
59
62
  }
60
63
  this.store = options == null ? void 0 : options.store;
61
64
  if (options.initialState) {
@@ -1,4 +1,4 @@
1
- export type ScheduleItem = {
1
+ export declare type ScheduleItem = {
2
2
  /** 颜色 */
3
3
  color: string;
4
4
  /** 创建时间 */
@@ -65,7 +65,7 @@ export type ScheduleItem = {
65
65
  schedule_id: number;
66
66
  }[];
67
67
  };
68
- export type ScheduleFormOtherValue = {
68
+ export declare type ScheduleFormOtherValue = {
69
69
  /** 截止模式
70
70
  * 1: 永不截止
71
71
  * 2: 按日期截止
@@ -79,11 +79,11 @@ export type ScheduleFormOtherValue = {
79
79
  includeStatus: boolean;
80
80
  type: 'standard' | 'time-slots' | 'designation';
81
81
  };
82
- export type ExcIncDate = {
82
+ export declare type ExcIncDate = {
83
83
  start: string;
84
84
  end: string;
85
85
  };
86
- export type ScheduleFormData = {
86
+ export declare type ScheduleFormData = {
87
87
  /** 颜色 */
88
88
  color: string;
89
89
  /** 日程名称 */
@@ -131,20 +131,20 @@ export type ScheduleFormData = {
131
131
  start_time: any;
132
132
  end_time: any;
133
133
  };
134
- export type CalendarDataItem = {
134
+ export declare 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 type RequestData<Data> = {
141
+ export declare type RequestData<Data> = {
142
142
  data: Data;
143
143
  status: boolean;
144
144
  message: string;
145
145
  code: number;
146
146
  };
147
- export type ResponseListData<Data> = {
147
+ export declare 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 type ScheduleAvailabilityDateItem = {
7
+ export declare 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 type ScheduleItem = {
27
+ export declare type ScheduleItem = {
28
28
  /** 颜色 */
29
29
  color: string;
30
30
  /** 创建时间 */
@@ -91,7 +91,7 @@ export type ScheduleItem = {
91
91
  schedule_id: number;
92
92
  }[];
93
93
  };
94
- export type ScheduleFormOtherValue = {
94
+ export declare type ScheduleFormOtherValue = {
95
95
  /** 截止模式
96
96
  * 1: 永不截止
97
97
  * 2: 按日期截止
@@ -105,11 +105,11 @@ export type ScheduleFormOtherValue = {
105
105
  includeStatus: boolean;
106
106
  type: 'standard' | 'time-slots' | 'designation';
107
107
  };
108
- export type ExcIncDate = {
108
+ export declare type ExcIncDate = {
109
109
  start: string;
110
110
  end: string;
111
111
  };
112
- export type ScheduleFormData = {
112
+ export declare type ScheduleFormData = {
113
113
  /** 颜色 */
114
114
  color: string;
115
115
  /** 日程名称 */
@@ -157,20 +157,20 @@ export type ScheduleFormData = {
157
157
  start_time: any;
158
158
  end_time: any;
159
159
  };
160
- export type CalendarDataItem = {
160
+ export declare 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 type RequestData<Data> = {
167
+ export declare type RequestData<Data> = {
168
168
  data: Data;
169
169
  status: boolean;
170
170
  message: string;
171
171
  code: number;
172
172
  };
173
- export type ResponseListData<Data> = {
173
+ export declare type ResponseListData<Data> = {
174
174
  status: boolean;
175
175
  message: string;
176
176
  code: number;
@@ -181,7 +181,7 @@ export type ResponseListData<Data> = {
181
181
  skip: number;
182
182
  };
183
183
  };
184
- export type ScheduleAllMap = Record<string, {
184
+ export declare type ScheduleAllMap = Record<string, {
185
185
  minTime: dayjs.Dayjs | null;
186
186
  maxTime: dayjs.Dayjs | null;
187
187
  minTimeStr: string | null;