@pisell/pisellos 0.0.373 → 0.0.376

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 (92) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/model/strategy/adapter/walletPass/utils.js +7 -2
  3. package/dist/model/strategy/type.d.ts +1 -1
  4. package/dist/modules/Customer/types.d.ts +1 -1
  5. package/dist/modules/Payment/index.js +35 -7
  6. package/dist/modules/Payment/types.d.ts +9 -7
  7. package/dist/modules/Product/index.d.ts +1 -1
  8. package/dist/modules/Rules/types.d.ts +1 -1
  9. package/dist/modules/Schedule/type.d.ts +7 -7
  10. package/dist/modules/Schedule/types.d.ts +9 -9
  11. package/dist/solution/BookingByStep/index.d.ts +2 -2
  12. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  13. package/dist/solution/Checkout/index.js +31 -2
  14. package/dist/solution/Checkout/types.d.ts +2 -0
  15. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  16. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  17. package/dist/types/index.d.ts +1 -1
  18. package/dist/utils/task.d.ts +2 -2
  19. package/dist/utils/watch.d.ts +2 -2
  20. package/lib/core/index.js +28 -27
  21. package/lib/effects/index.d.ts +2 -2
  22. package/lib/effects/index.js +7 -3
  23. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -3
  24. package/lib/model/strategy/adapter/walletPass/example.js +21 -21
  25. package/lib/model/strategy/adapter/walletPass/index.js +4 -2
  26. package/lib/model/strategy/adapter/walletPass/locales.js +10 -10
  27. package/lib/model/strategy/adapter/walletPass/utils.js +9 -4
  28. package/lib/model/strategy/index.js +10 -7
  29. package/lib/model/strategy/strategy-example.js +19 -19
  30. package/lib/model/strategy/type.d.ts +1 -1
  31. package/lib/modules/Account/index.js +10 -9
  32. package/lib/modules/AccountList/index.js +11 -14
  33. package/lib/modules/BaseModule.js +3 -6
  34. package/lib/modules/Cart/index.js +9 -14
  35. package/lib/modules/Cart/utils/cartProduct.js +6 -3
  36. package/lib/modules/Customer/constants.js +1 -1
  37. package/lib/modules/Customer/index.js +15 -18
  38. package/lib/modules/Customer/types.d.ts +1 -1
  39. package/lib/modules/Date/index.js +6 -10
  40. package/lib/modules/Date/types.js +0 -1
  41. package/lib/modules/Discount/index.js +6 -11
  42. package/lib/modules/Guests/index.js +15 -10
  43. package/lib/modules/Order/index.js +9 -11
  44. package/lib/modules/Payment/cash.js +1 -1
  45. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  46. package/lib/modules/Payment/eftpos.js +1 -1
  47. package/lib/modules/Payment/index.js +94 -86
  48. package/lib/modules/Payment/types.d.ts +9 -7
  49. package/lib/modules/Payment/utils.js +6 -3
  50. package/lib/modules/Payment/walletpass.js +33 -33
  51. package/lib/modules/Product/index.d.ts +1 -1
  52. package/lib/modules/Product/index.js +5 -6
  53. package/lib/modules/ProductList/index.js +3 -5
  54. package/lib/modules/Resource/index.js +12 -8
  55. package/lib/modules/Rules/index.js +21 -16
  56. package/lib/modules/Rules/types.d.ts +1 -1
  57. package/lib/modules/Schedule/index.js +5 -8
  58. package/lib/modules/Schedule/type.d.ts +7 -7
  59. package/lib/modules/Schedule/types.d.ts +9 -9
  60. package/lib/modules/Schedule/utils.js +4 -2
  61. package/lib/modules/Step/index.js +4 -7
  62. package/lib/modules/Summary/index.js +4 -9
  63. package/lib/plugins/request.js +33 -34
  64. package/lib/plugins/window.js +113 -101
  65. package/lib/solution/BookingByStep/index.d.ts +2 -2
  66. package/lib/solution/BookingByStep/index.js +129 -86
  67. package/lib/solution/BookingByStep/utils/capacity.js +15 -10
  68. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  69. package/lib/solution/BookingByStep/utils/resources.js +8 -4
  70. package/lib/solution/BookingByStep/utils/stock.js +6 -3
  71. package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
  72. package/lib/solution/BookingTicket/index.js +14 -19
  73. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  74. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  75. package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
  76. package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
  77. package/lib/solution/BuyTickets/index.js +15 -15
  78. package/lib/solution/Checkout/index.js +233 -217
  79. package/lib/solution/Checkout/types.d.ts +2 -0
  80. package/lib/solution/Checkout/utils/index.js +22 -18
  81. package/lib/solution/RegisterAndLogin/config.js +2 -2
  82. package/lib/solution/RegisterAndLogin/index.js +110 -114
  83. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  84. package/lib/solution/ShopDiscount/index.js +13 -16
  85. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  86. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  87. package/lib/types/index.d.ts +1 -1
  88. package/lib/utils/task.d.ts +2 -2
  89. package/lib/utils/task.js +3 -3
  90. package/lib/utils/watch.d.ts +2 -2
  91. package/lib/utils/watch.js +7 -5
  92. package/package.json +18 -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;
30
35
  }
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] \u53D1\u9001\u4E8B\u4EF6\u5931\u8D25", error, {
46
+ this.paymentModule.logError("[WalletPass] 发送事件失败", error, {
47
47
  hook
48
48
  });
49
49
  }
@@ -82,7 +82,7 @@ var WalletPassPaymentImpl = class {
82
82
  payment_order_id
83
83
  };
84
84
  this.walletParams = walletParams;
85
- this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u9ED8\u8BA4\u53C2\u6570\u5DF2\u751F\u6210\u5E76\u5B58\u50A8", {
85
+ this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
86
86
  customer_id: walletParams.customer_id,
87
87
  holder_id: walletParams.holder_id,
88
88
  order_expect_amount: walletParams.order_expect_amount,
@@ -105,7 +105,7 @@ var WalletPassPaymentImpl = class {
105
105
  */
106
106
  clearStoredWalletParams() {
107
107
  this.walletParams = null;
108
- this.paymentModule.logInfo("[WalletPass] \u5DF2\u5B58\u50A8\u7684\u94B1\u5305\u53C2\u6570\u5DF2\u6E05\u7406");
108
+ this.paymentModule.logInfo("[WalletPass] 已存储的钱包参数已清理");
109
109
  }
110
110
  /**
111
111
  * 从业务数据初始化钱包数据
@@ -128,7 +128,7 @@ var WalletPassPaymentImpl = class {
128
128
  businessData,
129
129
  startTime
130
130
  });
131
- this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E", {
131
+ this.paymentModule.logInfo("[WalletPass] 开始从业务数据初始化钱包数据", {
132
132
  customer_id: businessData.customer_id,
133
133
  totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
134
134
  subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
@@ -147,7 +147,7 @@ var WalletPassPaymentImpl = class {
147
147
  endTime,
148
148
  duration
149
149
  });
150
- this.paymentModule.logInfo(`[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u6210\u529F`, {
150
+ this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
151
151
  duration: `${duration}ms`,
152
152
  walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
153
153
  userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
@@ -164,7 +164,7 @@ var WalletPassPaymentImpl = class {
164
164
  duration
165
165
  });
166
166
  this.paymentModule.logError(
167
- `[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25`,
167
+ `[WalletPass] 从业务数据初始化钱包数据失败`,
168
168
  error,
169
169
  {
170
170
  duration: `${duration}ms`,
@@ -238,7 +238,7 @@ var WalletPassPaymentImpl = class {
238
238
  products: products || []
239
239
  };
240
240
  } catch (error) {
241
- this.paymentModule.logError("[WalletPass] \u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", error, {
241
+ this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
242
242
  customer_id: baseParams.customer_id,
243
243
  order_expect_amount: baseParams.order_expect_amount
244
244
  });
@@ -248,7 +248,7 @@ var WalletPassPaymentImpl = class {
248
248
  async getWalletPassRecommendListAsync(params) {
249
249
  var _a;
250
250
  try {
251
- this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868", {
251
+ this.paymentModule.logInfo("[WalletPass] 开始获取钱包推荐列表", {
252
252
  customer_id: params.customer_id,
253
253
  order_expect_amount: params.order_expect_amount,
254
254
  sale_channel: params.sale_channel,
@@ -263,7 +263,7 @@ var WalletPassPaymentImpl = class {
263
263
  this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
264
264
  walletRecommendList: this.walletRecommendList
265
265
  });
266
- this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u66F4\u65B0", {
266
+ this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已更新", {
267
267
  count: this.walletRecommendList.length,
268
268
  items: this.walletRecommendList.map((item) => ({
269
269
  voucher_id: item.voucher_id,
@@ -274,7 +274,7 @@ var WalletPassPaymentImpl = class {
274
274
  });
275
275
  return this.walletRecommendList;
276
276
  } catch (error) {
277
- this.paymentModule.logError("[WalletPass] \u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868\u5931\u8D25", error, {
277
+ this.paymentModule.logError("[WalletPass] 获取钱包推荐列表失败", error, {
278
278
  customer_id: params.customer_id,
279
279
  order_expect_amount: params.order_expect_amount,
280
280
  sale_channel: params.sale_channel
@@ -292,7 +292,7 @@ var WalletPassPaymentImpl = class {
292
292
  ...this.walletParams,
293
293
  ...params
294
294
  };
295
- this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868", {
295
+ this.paymentModule.logInfo("[WalletPass] 开始获取用户识别码列表", {
296
296
  customer_id: newParams.customer_id,
297
297
  available: newParams.available,
298
298
  prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
@@ -308,7 +308,7 @@ var WalletPassPaymentImpl = class {
308
308
  this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
309
309
  userIdentificationCodes: this.userIdentificationCodes
310
310
  });
311
- this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u66F4\u65B0", {
311
+ this.paymentModule.logInfo("[WalletPass] 用户识别码列表已更新", {
312
312
  count: this.userIdentificationCodes.length,
313
313
  sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
314
314
  code: item.code,
@@ -319,7 +319,7 @@ var WalletPassPaymentImpl = class {
319
319
  return this.userIdentificationCodes;
320
320
  } catch (error) {
321
321
  this.paymentModule.logError(
322
- "[WalletPass] \u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5931\u8D25",
322
+ "[WalletPass] 获取用户识别码列表失败",
323
323
  error,
324
324
  {
325
325
  customer_id: params.customer_id,
@@ -338,7 +338,7 @@ var WalletPassPaymentImpl = class {
338
338
  async searchIdentificationCodeAsync(params, config = {}) {
339
339
  try {
340
340
  const { code } = params;
341
- this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u641C\u7D22\u8BC6\u522B\u7801", {
341
+ this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
342
342
  code,
343
343
  code_length: code.length,
344
344
  noCache: config.noCache || false
@@ -350,7 +350,7 @@ var WalletPassPaymentImpl = class {
350
350
  with_customer: 1,
351
351
  with: ["wallet"]
352
352
  };
353
- this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u94B1\u5305\u8BC6\u522B\u7801", {
353
+ this.paymentModule.logInfo("[WalletPass] 搜索钱包识别码", {
354
354
  code,
355
355
  with_customer: walletDetailParams.with_customer,
356
356
  with: walletDetailParams.with
@@ -360,7 +360,7 @@ var WalletPassPaymentImpl = class {
360
360
  walletDetailParams
361
361
  );
362
362
  const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
363
- this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
363
+ this.paymentModule.logInfo("[WalletPass] 钱包识别码搜索完成", {
364
364
  code,
365
365
  results_count: searchResults2.length,
366
366
  type: "walletCode"
@@ -386,7 +386,7 @@ var WalletPassPaymentImpl = class {
386
386
  code: params.code,
387
387
  payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
388
388
  };
389
- this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u666E\u901A\u8BC6\u522B\u7801", {
389
+ this.paymentModule.logInfo("[WalletPass] 搜索普通识别码", {
390
390
  code: searchParams.code,
391
391
  customer_id: searchParams.customer_id,
392
392
  order_expect_amount: searchParams.order_expect_amount,
@@ -419,7 +419,7 @@ var WalletPassPaymentImpl = class {
419
419
  cachedSearchResults: [...this.searchResults],
420
420
  searchParams: params
421
421
  });
422
- this.paymentModule.logInfo("[WalletPass] \u666E\u901A\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
422
+ this.paymentModule.logInfo("[WalletPass] 普通识别码搜索完成", {
423
423
  code: params.code,
424
424
  results_count: searchResults.length,
425
425
  cached_results_count: this.searchResults.length,
@@ -430,7 +430,7 @@ var WalletPassPaymentImpl = class {
430
430
  data: searchResults
431
431
  };
432
432
  } catch (error) {
433
- this.paymentModule.logError("[WalletPass] \u641C\u7D22\u8BC6\u522B\u7801\u4FE1\u606F\u5931\u8D25", error, {
433
+ this.paymentModule.logError("[WalletPass] 搜索识别码信息失败", error, {
434
434
  code: params.code,
435
435
  customer_id: params.customer_id,
436
436
  order_expect_amount: params.order_expect_amount
@@ -439,19 +439,19 @@ var WalletPassPaymentImpl = class {
439
439
  }
440
440
  }
441
441
  async processWalletPayment(amount, orderUuid, voucherId) {
442
- this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u5904\u7406\u94B1\u5305\u652F\u4ED8", {
442
+ this.paymentModule.logInfo("[WalletPass] 开始处理钱包支付", {
443
443
  amount,
444
444
  orderUuid,
445
445
  voucherId: voucherId || "none"
446
446
  });
447
447
  const walletMethod = await this.paymentModule.getWalletPaymentMethod();
448
448
  if (!walletMethod) {
449
- this.paymentModule.logError("[WalletPass] \u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230", null, {
449
+ this.paymentModule.logError("[WalletPass] 钱包支付方式未找到", null, {
450
450
  amount,
451
451
  orderUuid,
452
452
  voucherId
453
453
  });
454
- throw new Error("\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
454
+ throw new Error("钱包支付方式未找到");
455
455
  }
456
456
  const paymentItem = {
457
457
  amount: amount.toString(),
@@ -462,7 +462,7 @@ var WalletPassPaymentImpl = class {
462
462
  voucher_id: voucherId || ""
463
463
  };
464
464
  await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
465
- this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u652F\u4ED8\u5904\u7406\u5B8C\u6210", {
465
+ this.paymentModule.logInfo("[WalletPass] 钱包支付处理完成", {
466
466
  amount,
467
467
  orderUuid,
468
468
  voucherId: voucherId || "none",
@@ -492,7 +492,7 @@ var WalletPassPaymentImpl = class {
492
492
  this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
493
493
  clearedTypes: ["walletRecommendList"]
494
494
  });
495
- this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u6E05\u9664");
495
+ this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已清除");
496
496
  }
497
497
  /**
498
498
  * 清除用户识别码列表
@@ -502,7 +502,7 @@ var WalletPassPaymentImpl = class {
502
502
  this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
503
503
  clearedTypes: ["userIdentificationCodes"]
504
504
  });
505
- this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u6E05\u9664");
505
+ this.paymentModule.logInfo("[WalletPass] 用户识别码列表已清除");
506
506
  }
507
507
  /**
508
508
  * 获取缓存的搜索结果列表
@@ -521,7 +521,7 @@ var WalletPassPaymentImpl = class {
521
521
  */
522
522
  clearSearchResults() {
523
523
  this.searchResults = [];
524
- this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u7ED3\u679C\u7F13\u5B58\u5DF2\u6E05\u9664");
524
+ this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
525
525
  }
526
526
  /**
527
527
  * 获取存储的钱包初始化数据
@@ -534,7 +534,7 @@ var WalletPassPaymentImpl = class {
534
534
  */
535
535
  clearStoredWalletInitData() {
536
536
  this.walletInitData = null;
537
- this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u521D\u59CB\u5316\u6570\u636E\u5DF2\u6E05\u9664");
537
+ this.paymentModule.logInfo("[WalletPass] 钱包初始化数据已清除");
538
538
  }
539
539
  /**
540
540
  * 清除所有缓存数据
@@ -548,7 +548,7 @@ var WalletPassPaymentImpl = class {
548
548
  this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
549
549
  clearedTypes: ["all"]
550
550
  });
551
- this.paymentModule.logInfo("[WalletPass] \u6240\u6709\u7F13\u5B58\u6570\u636E\u5DF2\u6E05\u9664", {
551
+ this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
552
552
  cleared_types: [
553
553
  "walletRecommendList",
554
554
  "userIdentificationCodes",
@@ -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
  }
@@ -26,14 +26,13 @@ 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
- };
35
29
  constructor(name, version) {
36
30
  super(name, version);
31
+ this.defaultName = "product";
32
+ this.defaultVersion = "1.0.0";
33
+ this.otherParams = {
34
+ scheduler: []
35
+ };
37
36
  }
38
37
  async initialize(core, options) {
39
38
  this.core = core;
@@ -27,13 +27,11 @@ 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 = {};
35
30
  constructor(name, version) {
36
31
  super(name, version);
32
+ this.defaultName = "productList";
33
+ this.defaultVersion = "1.0.0";
34
+ this.otherParams = {};
37
35
  }
38
36
  async initialize(core, options) {
39
37
  var _a;
@@ -25,11 +25,10 @@ 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;
31
28
  constructor(name, version) {
32
29
  super(name, version);
30
+ this.defaultName = "resourceList";
31
+ this.defaultVersion = "1.0.0";
33
32
  }
34
33
  async initialize(core, options) {
35
34
  this.core = core;
@@ -40,7 +39,8 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
40
39
  }
41
40
  async selectResource(resourceId) {
42
41
  const resource = this.store.list.find((r) => r.id === resourceId);
43
- if (!resource) return;
42
+ if (!resource)
43
+ return;
44
44
  this.store.selectedResource = resource;
45
45
  await this.core.effects.emit(`${this.name}:onResourceSelect`, resource);
46
46
  }
@@ -49,19 +49,22 @@ 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) return false;
52
+ if (!resource)
53
+ return false;
53
54
  return resource.timeSlots.some(
54
55
  (slot) => slot.start.getTime() <= start.getTime() && slot.end.getTime() >= end.getTime() && slot.availableCapacity > 0
55
56
  );
56
57
  }
57
58
  async getAvailableTimeSlots(resourceId) {
58
59
  const resource = this.store.list.find((r) => r.id === resourceId);
59
- if (!resource) return [];
60
+ if (!resource)
61
+ return [];
60
62
  return resource.timeSlots.filter((slot) => slot.availableCapacity > 0);
61
63
  }
62
64
  getAvailableCapacity(resourceId, timeSlot) {
63
65
  const resource = this.store.list.find((r) => r.id === resourceId);
64
- if (!resource) return 0;
66
+ if (!resource)
67
+ return 0;
65
68
  const slot = resource.timeSlots.find(
66
69
  (s) => s.start.getTime() === timeSlot.start.getTime() && s.end.getTime() === timeSlot.end.getTime()
67
70
  );
@@ -69,7 +72,8 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
69
72
  }
70
73
  async updateResource(resourceId, updates) {
71
74
  const index = this.store.list.findIndex((r) => r.id === resourceId);
72
- if (index === -1) return;
75
+ if (index === -1)
76
+ return;
73
77
  this.store.list[index] = {
74
78
  ...this.store.list[index],
75
79
  ...updates
@@ -39,14 +39,10 @@ var import_decimal = __toESM(require("decimal.js"));
39
39
  var import_lodash_es = require("lodash-es");
40
40
  var import_dayjs = __toESM(require("dayjs"));
41
41
  var RulesModule = class extends import_BaseModule.BaseModule {
42
- defaultName = "rules";
43
- defaultVersion = "1.0.0";
44
- store;
45
- window;
46
- // WindowPlugin 实例
47
- hooks;
48
42
  constructor(name, version) {
49
43
  super(name, version);
44
+ this.defaultName = "rules";
45
+ this.defaultVersion = "1.0.0";
50
46
  this.hooks = {};
51
47
  }
52
48
  async initialize(core, options) {
@@ -69,10 +65,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
69
65
  // 检查 holder 是否匹配
70
66
  checkHolderMatch(discount, product, holders) {
71
67
  var _a;
72
- if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form") return true;
68
+ if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form")
69
+ return true;
73
70
  const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : void 0;
74
71
  const productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
75
- if (!orderHolderId && !productHolderId) return true;
72
+ if (!orderHolderId && !productHolderId)
73
+ return true;
76
74
  return (productHolderId || orderHolderId) === discount.holder.holder_id;
77
75
  }
78
76
  // 判断discountList 是否可以对当前productList生效
@@ -205,15 +203,19 @@ var RulesModule = class extends import_BaseModule.BaseModule {
205
203
  };
206
204
  const sortedDiscountList = [...filteredDiscountList].sort((a, b) => {
207
205
  var _a, _b;
208
- if (a.tag === "good_pass" && b.tag !== "good_pass") return -1;
209
- if (b.tag === "good_pass" && a.tag !== "good_pass") return 1;
206
+ if (a.tag === "good_pass" && b.tag !== "good_pass")
207
+ return -1;
208
+ if (b.tag === "good_pass" && a.tag !== "good_pass")
209
+ return 1;
210
210
  if (a.tag === "good_pass" && b.tag === "good_pass") {
211
211
  return compareByExpireTime(a, b);
212
212
  } else if (a.tag === "product_discount_card" && b.tag === "product_discount_card") {
213
213
  const typeA = ((_a = a.metadata) == null ? void 0 : _a.discount_card_type) || "percent";
214
214
  const typeB = ((_b = b.metadata) == null ? void 0 : _b.discount_card_type) || "percent";
215
- if (typeA === "fixed_amount" && typeB === "percent") return -1;
216
- if (typeA === "percent" && typeB === "fixed_amount") return 1;
215
+ if (typeA === "fixed_amount" && typeB === "percent")
216
+ return -1;
217
+ if (typeA === "percent" && typeB === "fixed_amount")
218
+ return 1;
217
219
  if (typeA === "fixed_amount" && typeB === "fixed_amount") {
218
220
  if (a.par_value !== b.par_value) {
219
221
  const valueA = new import_decimal.default(a.par_value || 0);
@@ -432,11 +434,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
432
434
  if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
433
435
  var _a3;
434
436
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
435
- })) && (discount.tag || discount.type) === "good_pass") return false;
437
+ })) && (discount.tag || discount.type) === "good_pass")
438
+ return false;
436
439
  if ((Number(product.price) <= 0 || !product.price) && !((_c2 = product.discount_list) == null ? void 0 : _c2.find((n) => {
437
440
  var _a3;
438
441
  return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
439
- })) && (discount.tag || discount.type) !== "good_pass") return false;
442
+ })) && (discount.tag || discount.type) !== "good_pass")
443
+ return false;
440
444
  const targetUsedDiscounts = usedDiscounts.get(discount.id);
441
445
  if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
442
446
  return false;
@@ -453,7 +457,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
453
457
  },
454
458
  holders
455
459
  );
456
- if (!isHolderMatch) return false;
460
+ if (!isHolderMatch)
461
+ return false;
457
462
  if (limitedData.type === "product_all") {
458
463
  if (limitedData.filter === 1 && limitedData.exclude_product_ids.includes(product.id)) {
459
464
  return false;
@@ -1312,7 +1317,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1312
1317
  async destroy() {
1313
1318
  this.core.effects.offByModuleDestroy(this.name);
1314
1319
  await this.core.effects.emit(`${this.name}:onDestroy`, {});
1315
- console.log("[Rules] \u5DF2\u9500\u6BC1");
1320
+ console.log("[Rules] 已销毁");
1316
1321
  }
1317
1322
  async clear() {
1318
1323
  console.log("[Rules] clear");
@@ -28,7 +28,7 @@ export interface RulesModuleAPI {
28
28
  }[];
29
29
  }) => DiscountResult;
30
30
  }
31
- declare type ProductDetail = {
31
+ type ProductDetail = {
32
32
  isClient?: boolean;
33
33
  isManualDiscount?: boolean;
34
34
  booking_id: any;
@@ -42,22 +42,19 @@ var import_utils2 = require("./utils");
42
42
  import_dayjs.default.extend(import_isSameOrBefore.default);
43
43
  import_dayjs.default.extend(import_isSameOrAfter.default);
44
44
  var ScheduleModule = class extends import_BaseModule.BaseModule {
45
- defaultName = "schedule";
46
- defaultVersion = "1.0.0";
47
- request;
48
- store = {};
49
- cacheId;
50
- openCache = false;
51
- fatherModule;
52
45
  constructor(name, version) {
53
46
  super(name, version);
47
+ this.defaultName = "schedule";
48
+ this.defaultVersion = "1.0.0";
49
+ this.store = {};
50
+ this.openCache = false;
54
51
  }
55
52
  async initialize(core, options) {
56
53
  var _a, _b;
57
54
  this.core = core;
58
55
  this.request = core.getPlugin("request");
59
56
  if (!this.request) {
60
- throw new Error("ScheduleModule \u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
57
+ throw new Error("ScheduleModule 需要 request 插件支持");
61
58
  }
62
59
  this.store = options == null ? void 0 : options.store;
63
60
  if (options.initialState) {
@@ -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;
@@ -346,7 +346,8 @@ var calcCalendarDataByTimeSlots = (values, others, isGetRange) => {
346
346
  time_slot
347
347
  } = values;
348
348
  const { endRadio, excludedStatus, includeStatus } = others;
349
- if (!start_time) return [];
349
+ if (!start_time)
350
+ return [];
350
351
  const start = (0, import_dayjs.default)(start_time);
351
352
  const end = (0, import_dayjs.default)(start_time);
352
353
  return processDateRange(
@@ -580,7 +581,8 @@ function getAllSortedDateRanges(schedules) {
580
581
  }
581
582
  let sortedDateRanges = allDateRanges.sort((a, b) => {
582
583
  const startTimeCompare = (0, import_dayjs.default)(a.start).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
583
- if (startTimeCompare !== 0) return startTimeCompare;
584
+ if (startTimeCompare !== 0)
585
+ return startTimeCompare;
584
586
  const durationA = (0, import_dayjs.default)(a.end).valueOf() - (0, import_dayjs.default)(a.start).valueOf();
585
587
  const durationB = (0, import_dayjs.default)(b.end).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
586
588
  return durationA - durationB;
@@ -24,14 +24,11 @@ __export(Step_exports, {
24
24
  module.exports = __toCommonJS(Step_exports);
25
25
  var import_BaseModule = require("../BaseModule");
26
26
  var StepModule = class extends import_BaseModule.BaseModule {
27
- defaultName = "step";
28
- defaultVersion = "1.0.0";
29
- store;
30
- cacheId;
31
- openCache = false;
32
- fatherModule;
33
27
  constructor(name, version) {
34
28
  super(name, version);
29
+ this.defaultName = "step";
30
+ this.defaultVersion = "1.0.0";
31
+ this.openCache = false;
35
32
  }
36
33
  async initialize(core, options) {
37
34
  var _a, _b;
@@ -116,7 +113,7 @@ var StepModule = class extends import_BaseModule.BaseModule {
116
113
  let stepList = this.store.stepList;
117
114
  const index = stepList.findIndex((n) => n.key === step.key);
118
115
  if (index !== -1) {
119
- console.log("[StepModule] \u6B65\u9AA4\u5DF2\u5B58\u5728\uFF0C\u6DFB\u52A0\u5931\u8D25");
116
+ console.log("[StepModule] 步骤已存在,添加失败");
120
117
  return;
121
118
  }
122
119
  if (key) {