@pisell/pisellos 1.0.147 → 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/Customer/types.d.ts +1 -1
  7. package/dist/modules/Discount/types.d.ts +1 -1
  8. package/dist/modules/Payment/types.d.ts +7 -7
  9. package/dist/modules/Product/index.d.ts +1 -1
  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/Customer/constants.js +1 -1
  48. package/lib/modules/Customer/index.js +18 -15
  49. package/lib/modules/Customer/types.d.ts +1 -1
  50. package/lib/modules/Date/index.js +10 -6
  51. package/lib/modules/Date/types.js +1 -0
  52. package/lib/modules/Discount/index.js +11 -6
  53. package/lib/modules/Discount/types.d.ts +1 -1
  54. package/lib/modules/Guests/index.js +10 -15
  55. package/lib/modules/Order/index.js +10 -7
  56. package/lib/modules/Payment/cash.js +1 -1
  57. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  58. package/lib/modules/Payment/eftpos.js +1 -1
  59. package/lib/modules/Payment/index.js +86 -73
  60. package/lib/modules/Payment/types.d.ts +7 -7
  61. package/lib/modules/Payment/utils.js +3 -6
  62. package/lib/modules/Payment/walletpass.js +33 -33
  63. package/lib/modules/Product/index.d.ts +1 -1
  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
@@ -346,8 +346,7 @@ var calcCalendarDataByTimeSlots = (values, others, isGetRange) => {
346
346
  time_slot
347
347
  } = values;
348
348
  const { endRadio, excludedStatus, includeStatus } = others;
349
- if (!start_time)
350
- return [];
349
+ if (!start_time) return [];
351
350
  const start = (0, import_dayjs.default)(start_time);
352
351
  const end = (0, import_dayjs.default)(start_time);
353
352
  return processDateRange(
@@ -581,8 +580,7 @@ function getAllSortedDateRanges(schedules) {
581
580
  }
582
581
  let sortedDateRanges = allDateRanges.sort((a, b) => {
583
582
  const startTimeCompare = (0, import_dayjs.default)(a.start).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
584
- if (startTimeCompare !== 0)
585
- return startTimeCompare;
583
+ if (startTimeCompare !== 0) return startTimeCompare;
586
584
  const durationA = (0, import_dayjs.default)(a.end).valueOf() - (0, import_dayjs.default)(a.start).valueOf();
587
585
  const durationB = (0, import_dayjs.default)(b.end).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
588
586
  return durationA - durationB;
@@ -24,11 +24,14 @@ __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;
27
33
  constructor(name, version) {
28
34
  super(name, version);
29
- this.defaultName = "step";
30
- this.defaultVersion = "1.0.0";
31
- this.openCache = false;
32
35
  }
33
36
  async initialize(core, options) {
34
37
  var _a, _b;
@@ -113,7 +116,7 @@ var StepModule = class extends import_BaseModule.BaseModule {
113
116
  let stepList = this.store.stepList;
114
117
  const index = stepList.findIndex((n) => n.key === step.key);
115
118
  if (index !== -1) {
116
- console.log("[StepModule] 步骤已存在,添加失败");
119
+ console.log("[StepModule] \u6B65\u9AA4\u5DF2\u5B58\u5728\uFF0C\u6DFB\u52A0\u5931\u8D25");
117
120
  return;
118
121
  }
119
122
  if (key) {
@@ -37,11 +37,16 @@ var import_BaseModule = require("../BaseModule");
37
37
  var import_Schedule = require("../Schedule");
38
38
  var import_utils = require("./utils");
39
39
  var SummaryModule = class extends import_BaseModule.BaseModule {
40
+ defaultName = "summary";
41
+ defaultVersion = "1.0.0";
42
+ shopStore;
43
+ store;
44
+ request;
45
+ cacheId;
46
+ openCache = false;
47
+ fatherModule;
40
48
  constructor(name, version) {
41
49
  super(name, version);
42
- this.defaultName = "summary";
43
- this.defaultVersion = "1.0.0";
44
- this.openCache = false;
45
50
  }
46
51
  async initialize(core, options) {
47
52
  var _a, _b;
@@ -60,7 +65,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
60
65
  this.fatherModule = options.otherParams.fatherModule;
61
66
  }
62
67
  if (!this.shopStore) {
63
- throw new Error("SummaryModule 需要 shopStore 插件支持");
68
+ throw new Error("SummaryModule \u9700\u8981 shopStore \u63D2\u4EF6\u652F\u6301");
64
69
  }
65
70
  this.getSurchargeList();
66
71
  }
@@ -138,11 +138,9 @@ var getTax = ({ service, addons, bookingDetail, bookingId }, options) => {
138
138
  };
139
139
  function getDiscountedTaxableBase(input) {
140
140
  const { basePrice, discount, surchargeFee } = input;
141
- if (surchargeFee.lte(0) && basePrice.lte(0))
142
- return new import_decimal.default(0);
141
+ if (surchargeFee.lte(0) && basePrice.lte(0)) return new import_decimal.default(0);
143
142
  const discountedBase = basePrice.minus(discount);
144
- if (discountedBase.lte(0))
145
- return surchargeFee;
143
+ if (discountedBase.lte(0)) return surchargeFee;
146
144
  return discountedBase.plus(surchargeFee);
147
145
  }
148
146
  var processItemsTax = (items, { bookingDetail, bookingId }, options) => {
@@ -419,8 +417,7 @@ var getSurchargeAmount = ({ bookingDetail, bookingId }, surcharge, options) => {
419
417
  return Number(bookingDetail.surcharge_fee);
420
418
  }
421
419
  }
422
- if (!Array.isArray(surcharge))
423
- return 0;
420
+ if (!Array.isArray(surcharge)) return 0;
424
421
  return surcharge.reduce((total, item) => {
425
422
  return total + (item.value || 0);
426
423
  }, 0);
@@ -560,8 +557,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
560
557
  return [];
561
558
  }
562
559
  resetItemsSurchargeSideEffects({ service, addons });
563
- if (!Array.isArray(surcharge_list) || !(surcharge_list == null ? void 0 : surcharge_list.length))
564
- return [];
560
+ if (!Array.isArray(surcharge_list) || !(surcharge_list == null ? void 0 : surcharge_list.length)) return [];
565
561
  const surchargeWithAmount = [];
566
562
  for (let i = 0; i < surcharge_list.length; i++) {
567
563
  const surchargeConfig = surcharge_list[i];
@@ -774,8 +770,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
774
770
  };
775
771
  function resetItemsSurchargeSideEffects({ service, addons }) {
776
772
  const resetItem = (item) => {
777
- if (!item)
778
- return;
773
+ if (!item) return;
779
774
  item.surcharge_fee = 0;
780
775
  item.surcharge_rounding_remainder = 0;
781
776
  item.relation_surcharge_ids = [];
@@ -784,15 +779,12 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
784
779
  for (let item of service) {
785
780
  resetItem(item);
786
781
  const arr = (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || [];
787
- for (let bundleItem of arr)
788
- resetItem(bundleItem);
789
- for (let relationDetail of (item == null ? void 0 : item.relation_details) || [])
790
- resetItem(relationDetail);
782
+ for (let bundleItem of arr) resetItem(bundleItem);
783
+ for (let relationDetail of (item == null ? void 0 : item.relation_details) || []) resetItem(relationDetail);
791
784
  }
792
785
  }
793
786
  if (Array.isArray(addons == null ? void 0 : addons.value)) {
794
- for (let item of addons.value)
795
- resetItem(item);
787
+ for (let item of addons.value) resetItem(item);
796
788
  }
797
789
  }
798
790
  // Annotate the CommonJS export names for ESM import in node:
@@ -24,6 +24,9 @@ __export(request_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(request_exports);
26
26
  var RequestError = class extends Error {
27
+ response;
28
+ request;
29
+ config;
27
30
  constructor(message, config, request, response) {
28
31
  super(message);
29
32
  this.name = "RequestError";
@@ -33,38 +36,36 @@ var RequestError = class extends Error {
33
36
  }
34
37
  };
35
38
  var RequestPluginImpl = class {
36
- constructor() {
37
- this.name = "request";
38
- this.version = "1.0.0";
39
- this.core = null;
40
- /**
41
- * 默认请求选项
42
- */
43
- this.defaultOptions = {
44
- method: "GET",
45
- headers: {
46
- "Content-Type": "application/json"
47
- },
48
- timeout: 3e4,
49
- responseType: "json"
50
- };
51
- /**
52
- * 全局拦截器
53
- */
54
- this.interceptors = {
55
- request: [],
56
- response: [],
57
- error: []
58
- };
59
- }
39
+ name = "request";
40
+ version = "1.0.0";
41
+ core = null;
42
+ /**
43
+ * 默认请求选项
44
+ */
45
+ defaultOptions = {
46
+ method: "GET",
47
+ headers: {
48
+ "Content-Type": "application/json"
49
+ },
50
+ timeout: 3e4,
51
+ responseType: "json"
52
+ };
53
+ /**
54
+ * 全局拦截器
55
+ */
56
+ interceptors = {
57
+ request: [],
58
+ response: [],
59
+ error: []
60
+ };
60
61
  // 初始化方法
61
62
  initialize() {
62
63
  this.core = globalThis.pisellOS;
63
- console.log("[RequestPlugin] 初始化完成");
64
+ console.log("[RequestPlugin] \u521D\u59CB\u5316\u5B8C\u6210");
64
65
  }
65
66
  // 销毁方法
66
67
  destroy() {
67
- console.log("[RequestPlugin] 已销毁");
68
+ console.log("[RequestPlugin] \u5DF2\u9500\u6BC1");
68
69
  }
69
70
  /**
70
71
  * 添加请求拦截器
@@ -149,7 +150,7 @@ var RequestPluginImpl = class {
149
150
  config = await Promise.resolve(interceptor(config));
150
151
  } catch (error) {
151
152
  const requestError = error instanceof RequestError ? error : new RequestError(
152
- error instanceof Error ? error.message : "请求拦截器错误",
153
+ error instanceof Error ? error.message : "\u8BF7\u6C42\u62E6\u622A\u5668\u9519\u8BEF",
153
154
  config
154
155
  );
155
156
  let processedError = requestError;
@@ -174,7 +175,7 @@ var RequestPluginImpl = class {
174
175
  );
175
176
  } catch (error) {
176
177
  const requestError = error instanceof RequestError ? error : new RequestError(
177
- error instanceof Error ? error.message : "响应拦截器错误",
178
+ error instanceof Error ? error.message : "\u54CD\u5E94\u62E6\u622A\u5668\u9519\u8BEF",
178
179
  config,
179
180
  null,
180
181
  response
@@ -194,7 +195,7 @@ var RequestPluginImpl = class {
194
195
  return processedResponse.data;
195
196
  } catch (error) {
196
197
  const requestError = error instanceof RequestError ? error : new RequestError(
197
- error instanceof Error ? error.message : "请求错误",
198
+ error instanceof Error ? error.message : "\u8BF7\u6C42\u9519\u8BEF",
198
199
  config
199
200
  );
200
201
  let processedError = requestError;
@@ -225,7 +226,7 @@ var RequestPluginImpl = class {
225
226
  withCredentials
226
227
  } = config;
227
228
  if (!url) {
228
- throw new RequestError("URL不能为空", config);
229
+ throw new RequestError("URL\u4E0D\u80FD\u4E3A\u7A7A", config);
229
230
  }
230
231
  let fullUrl = url;
231
232
  if (params && Object.keys(params).length > 0) {
@@ -255,13 +256,13 @@ var RequestPluginImpl = class {
255
256
  const timeoutPromise = new Promise((_, reject) => {
256
257
  if (timeout) {
257
258
  timeoutId = setTimeout(() => {
258
- reject(new RequestError(`请求超时: ${timeout}ms`, config));
259
+ reject(new RequestError(`\u8BF7\u6C42\u8D85\u65F6: ${timeout}ms`, config));
259
260
  }, timeout);
260
261
  }
261
262
  });
262
263
  try {
263
264
  const fetchPromise = typeof fetch !== "undefined" ? fetch(fullUrl, fetchOptions) : Promise.reject(
264
- new RequestError("当前环境不支持 fetch API", config)
265
+ new RequestError("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301 fetch API", config)
265
266
  );
266
267
  const response = await Promise.race([fetchPromise, timeoutPromise]);
267
268
  const responseHeaders = {};
@@ -297,7 +298,7 @@ var RequestPluginImpl = class {
297
298
  };
298
299
  if (!response.ok) {
299
300
  throw new RequestError(
300
- `请求失败,状态码: ${response.status}`,
301
+ `\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${response.status}`,
301
302
  config,
302
303
  fetchOptions,
303
304
  result
@@ -23,9 +23,7 @@ __export(window_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(window_exports);
25
25
  var SimpleStorage = class {
26
- constructor() {
27
- this.items = {};
28
- }
26
+ items = {};
29
27
  get length() {
30
28
  return Object.keys(this.items).length;
31
29
  }
@@ -47,18 +45,16 @@ var SimpleStorage = class {
47
45
  }
48
46
  };
49
47
  var SimpleLocation = class {
50
- constructor() {
51
- this.hash = "";
52
- this.host = "localhost";
53
- this.hostname = "localhost";
54
- this.href = "https://localhost";
55
- this.origin = "https://localhost";
56
- this.pathname = "/";
57
- this.port = "";
58
- this.protocol = "https:";
59
- this.search = "";
60
- this.ancestorOrigins = {};
61
- }
48
+ hash = "";
49
+ host = "localhost";
50
+ hostname = "localhost";
51
+ href = "https://localhost";
52
+ origin = "https://localhost";
53
+ pathname = "/";
54
+ port = "";
55
+ protocol = "https:";
56
+ search = "";
57
+ ancestorOrigins = {};
62
58
  assign(url) {
63
59
  }
64
60
  reload() {
@@ -70,29 +66,25 @@ var SimpleLocation = class {
70
66
  }
71
67
  };
72
68
  var SimpleNavigator = class {
73
- constructor() {
74
- this.userAgent = "PisellOS/1.0";
75
- this.language = "zh-CN";
76
- this.languages = ["zh-CN", "en-US"];
77
- this.onLine = true;
78
- this.cookieEnabled = true;
79
- // 以下属性只提供必要实现
80
- this.appCodeName = "PisellOS";
81
- this.appName = "PisellOS";
82
- this.appVersion = "1.0";
83
- this.platform = "PisellOS";
84
- this.product = "PisellOS";
85
- }
69
+ userAgent = "PisellOS/1.0";
70
+ language = "zh-CN";
71
+ languages = ["zh-CN", "en-US"];
72
+ onLine = true;
73
+ cookieEnabled = true;
74
+ // 以下属性只提供必要实现
75
+ appCodeName = "PisellOS";
76
+ appName = "PisellOS";
77
+ appVersion = "1.0";
78
+ platform = "PisellOS";
79
+ product = "PisellOS";
86
80
  javaEnabled() {
87
81
  return false;
88
82
  }
89
83
  };
90
84
  var SimpleHistory = class {
91
- constructor() {
92
- this.length = 0;
93
- this.scrollRestoration = "auto";
94
- this.state = null;
95
- }
85
+ length = 0;
86
+ scrollRestoration = "auto";
87
+ state = null;
96
88
  back() {
97
89
  }
98
90
  forward() {
@@ -105,17 +97,8 @@ var SimpleHistory = class {
105
97
  }
106
98
  };
107
99
  var SimpleDocument = class {
108
- constructor() {
109
- // 仅实现基本功能
110
- this.elements = {};
111
- // Document 接口的必要属性
112
- this.URL = "https://localhost";
113
- this.documentURI = "https://localhost";
114
- this.origin = "https://localhost";
115
- this.characterSet = "UTF-8";
116
- this.contentType = "text/html";
117
- this.compatMode = "CSS1Compat";
118
- }
100
+ // 仅实现基本功能
101
+ elements = {};
119
102
  createElement(tagName) {
120
103
  const element = {
121
104
  tagName: tagName.toUpperCase(),
@@ -155,6 +138,13 @@ var SimpleDocument = class {
155
138
  getElementById(id) {
156
139
  return this.elements[id] || null;
157
140
  }
141
+ // Document 接口的必要属性
142
+ URL = "https://localhost";
143
+ documentURI = "https://localhost";
144
+ origin = "https://localhost";
145
+ characterSet = "UTF-8";
146
+ contentType = "text/html";
147
+ compatMode = "CSS1Compat";
158
148
  querySelector() {
159
149
  return null;
160
150
  }
@@ -169,84 +159,82 @@ var SimpleDocument = class {
169
159
  }
170
160
  };
171
161
  var WindowPluginImpl = class {
172
- constructor() {
173
- this.name = "window";
174
- this.version = "1.0.0";
175
- // 定时器相关
176
- this.setTimeout = Object.assign(
177
- function(handler, timeout, ...args) {
178
- if (typeof globalThis !== "undefined" && globalThis.setTimeout) {
179
- return globalThis.setTimeout(handler, timeout, ...args);
180
- }
181
- const timeoutId = Date.now();
182
- Promise.resolve().then(() => {
183
- setTimeout(() => {
184
- if (typeof handler === "function") {
185
- handler(...args);
186
- } else {
187
- eval(handler);
188
- }
189
- }, timeout || 0);
190
- });
191
- return timeoutId;
192
- },
193
- {
194
- __promisify__: function(delay, value) {
195
- return new Promise((resolve) => setTimeout(resolve, delay, value));
196
- }
162
+ name = "window";
163
+ version = "1.0.0";
164
+ // 定时器相关
165
+ setTimeout = Object.assign(
166
+ function(handler, timeout, ...args) {
167
+ if (typeof globalThis !== "undefined" && globalThis.setTimeout) {
168
+ return globalThis.setTimeout(handler, timeout, ...args);
197
169
  }
198
- );
199
- this.clearTimeout = function(timeout2) {
200
- if (typeof globalThis !== "undefined" && globalThis.clearTimeout) {
201
- globalThis.clearTimeout(timeout2);
170
+ const timeoutId = Date.now();
171
+ Promise.resolve().then(() => {
172
+ setTimeout(() => {
173
+ if (typeof handler === "function") {
174
+ handler(...args);
175
+ } else {
176
+ eval(handler);
177
+ }
178
+ }, timeout || 0);
179
+ });
180
+ return timeoutId;
181
+ },
182
+ {
183
+ __promisify__: function(delay, value) {
184
+ return new Promise((resolve) => setTimeout(resolve, delay, value));
202
185
  }
203
- };
204
- this.setInterval = Object.assign(
205
- function(handler, timeout, ...args) {
206
- if (typeof globalThis !== "undefined" && globalThis.setInterval) {
207
- return globalThis.setInterval(handler, timeout, ...args);
208
- }
209
- const intervalId = Date.now();
210
- const recursiveTimeout = () => {
211
- this.setTimeout(() => {
212
- if (typeof handler === "function") {
213
- handler(...args);
214
- } else {
215
- eval(handler);
216
- }
217
- recursiveTimeout();
218
- }, timeout || 0);
219
- };
220
- recursiveTimeout();
221
- return intervalId;
222
- },
223
- {
224
- __promisify__: function(delay, value) {
225
- return new Promise((resolve) => setInterval(resolve, delay, value));
226
- }
186
+ }
187
+ );
188
+ clearTimeout = function(timeout2) {
189
+ if (typeof globalThis !== "undefined" && globalThis.clearTimeout) {
190
+ globalThis.clearTimeout(timeout2);
191
+ }
192
+ };
193
+ setInterval = Object.assign(
194
+ function(handler, timeout, ...args) {
195
+ if (typeof globalThis !== "undefined" && globalThis.setInterval) {
196
+ return globalThis.setInterval(handler, timeout, ...args);
227
197
  }
228
- );
229
- this.clearInterval = function(timeout2) {
230
- if (typeof globalThis !== "undefined" && globalThis.clearInterval) {
231
- globalThis.clearInterval(timeout2);
198
+ const intervalId = Date.now();
199
+ const recursiveTimeout = () => {
200
+ this.setTimeout(() => {
201
+ if (typeof handler === "function") {
202
+ handler(...args);
203
+ } else {
204
+ eval(handler);
205
+ }
206
+ recursiveTimeout();
207
+ }, timeout || 0);
208
+ };
209
+ recursiveTimeout();
210
+ return intervalId;
211
+ },
212
+ {
213
+ __promisify__: function(delay, value) {
214
+ return new Promise((resolve) => setInterval(resolve, delay, value));
232
215
  }
233
- };
234
- // 存储相关
235
- this.localStorage = new SimpleStorage();
236
- this.sessionStorage = new SimpleStorage();
237
- // 浏览器环境对象
238
- this.location = new SimpleLocation();
239
- this.navigator = new SimpleNavigator();
240
- this.document = new SimpleDocument();
241
- this.history = new SimpleHistory();
242
- }
216
+ }
217
+ );
218
+ clearInterval = function(timeout2) {
219
+ if (typeof globalThis !== "undefined" && globalThis.clearInterval) {
220
+ globalThis.clearInterval(timeout2);
221
+ }
222
+ };
223
+ // 存储相关
224
+ localStorage = new SimpleStorage();
225
+ sessionStorage = new SimpleStorage();
226
+ // 浏览器环境对象
227
+ location = new SimpleLocation();
228
+ navigator = new SimpleNavigator();
229
+ document = new SimpleDocument();
230
+ history = new SimpleHistory();
243
231
  // 初始化方法
244
232
  initialize() {
245
- console.log("[WindowPlugin] 初始化完成");
233
+ console.log("[WindowPlugin] \u521D\u59CB\u5316\u5B8C\u6210");
246
234
  }
247
235
  // 销毁方法
248
236
  destroy() {
249
- console.log("[WindowPlugin] 已销毁");
237
+ console.log("[WindowPlugin] \u5DF2\u9500\u6BC1");
250
238
  }
251
239
  };
252
240
  var window_default = new WindowPluginImpl();
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
358
358
  };
359
359
  setOtherData(key: string, value: any): void;
360
360
  getOtherData(key: string): any;
361
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
361
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
362
362
  /**
363
363
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
364
364
  *