@pisell/pisellos 2.1.99 → 2.1.100
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.
- package/dist/effects/index.d.ts +2 -2
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/types.d.ts +7 -7
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/core/index.js +27 -28
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +3 -7
- package/lib/modules/Account/index.js +9 -10
- package/lib/modules/AccountList/index.js +14 -11
- package/lib/modules/BaseModule.js +6 -3
- package/lib/modules/Cart/index.js +14 -9
- package/lib/modules/Cart/utils/cartProduct.js +3 -6
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/modules/Customer/index.js +18 -15
- package/lib/modules/Customer/types.d.ts +1 -1
- package/lib/modules/Date/index.js +10 -6
- package/lib/modules/Date/types.js +1 -0
- package/lib/modules/Discount/index.js +11 -6
- package/lib/modules/Guests/index.js +10 -15
- package/lib/modules/Order/index.js +10 -7
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +84 -73
- package/lib/modules/Payment/types.d.ts +7 -7
- package/lib/modules/Payment/utils.js +3 -6
- package/lib/modules/Payment/walletpass.js +31 -31
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/index.js +6 -5
- package/lib/modules/ProductList/index.js +5 -3
- package/lib/modules/Resource/index.js +8 -12
- package/lib/modules/Rules/index.js +21 -35
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/lib/modules/Schedule/index.js +8 -5
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +2 -4
- package/lib/modules/Step/index.js +7 -4
- package/lib/modules/Summary/index.js +9 -4
- package/lib/modules/Summary/utils.js +8 -16
- package/lib/plugins/request.js +34 -33
- package/lib/plugins/window.js +101 -113
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +110 -177
- package/lib/solution/BookingByStep/utils/capacity.js +11 -16
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +4 -8
- package/lib/solution/BookingByStep/utils/stock.js +3 -6
- package/lib/solution/BookingByStep/utils/timeslots.js +24 -27
- package/lib/solution/BookingTicket/index.js +19 -14
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/Checkout/index.js +216 -211
- package/lib/solution/Checkout/utils/index.js +18 -22
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +114 -110
- package/lib/solution/RegisterAndLogin/utils.js +9 -9
- package/lib/solution/ShopDiscount/index.js +16 -13
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/solution/ShopDiscount/utils.js +1 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/task.js +3 -3
- package/lib/utils/watch.d.ts +2 -2
- package/lib/utils/watch.js +5 -7
- package/package.json +16 -17
|
@@ -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
|
|
68
|
+
throw new Error("SummaryModule \u9700\u8981 shopStore \u63D2\u4EF6\u652F\u6301");
|
|
64
69
|
}
|
|
65
70
|
this.getSurchargeList();
|
|
66
71
|
}
|
|
@@ -134,11 +134,9 @@ var getTax = ({ service, addons, bookingDetail, bookingId }, options) => {
|
|
|
134
134
|
};
|
|
135
135
|
function getDiscountedTaxableBase(input) {
|
|
136
136
|
const { basePrice, discount, surchargeFee } = input;
|
|
137
|
-
if (surchargeFee.lte(0) && basePrice.lte(0))
|
|
138
|
-
return new import_decimal.default(0);
|
|
137
|
+
if (surchargeFee.lte(0) && basePrice.lte(0)) return new import_decimal.default(0);
|
|
139
138
|
const discountedBase = basePrice.minus(discount);
|
|
140
|
-
if (discountedBase.lte(0))
|
|
141
|
-
return surchargeFee;
|
|
139
|
+
if (discountedBase.lte(0)) return surchargeFee;
|
|
142
140
|
return discountedBase.plus(surchargeFee);
|
|
143
141
|
}
|
|
144
142
|
var processItemsTax = (items, { bookingDetail, bookingId }, options) => {
|
|
@@ -405,8 +403,7 @@ var getSurchargeAmount = ({ bookingDetail, bookingId }, surcharge, options) => {
|
|
|
405
403
|
return Number(bookingDetail.surcharge_fee);
|
|
406
404
|
}
|
|
407
405
|
}
|
|
408
|
-
if (!Array.isArray(surcharge))
|
|
409
|
-
return 0;
|
|
406
|
+
if (!Array.isArray(surcharge)) return 0;
|
|
410
407
|
return surcharge.reduce((total, item) => {
|
|
411
408
|
return total + (item.value || 0);
|
|
412
409
|
}, 0);
|
|
@@ -546,8 +543,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
|
|
|
546
543
|
return [];
|
|
547
544
|
}
|
|
548
545
|
resetItemsSurchargeSideEffects({ service, addons });
|
|
549
|
-
if (!Array.isArray(surcharge_list) || !(surcharge_list == null ? void 0 : surcharge_list.length))
|
|
550
|
-
return [];
|
|
546
|
+
if (!Array.isArray(surcharge_list) || !(surcharge_list == null ? void 0 : surcharge_list.length)) return [];
|
|
551
547
|
const surchargeWithAmount = [];
|
|
552
548
|
for (let i = 0; i < surcharge_list.length; i++) {
|
|
553
549
|
const surchargeConfig = surcharge_list[i];
|
|
@@ -760,8 +756,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
|
|
|
760
756
|
};
|
|
761
757
|
function resetItemsSurchargeSideEffects({ service, addons }) {
|
|
762
758
|
const resetItem = (item) => {
|
|
763
|
-
if (!item)
|
|
764
|
-
return;
|
|
759
|
+
if (!item) return;
|
|
765
760
|
item.surcharge_fee = 0;
|
|
766
761
|
item.surcharge_rounding_remainder = 0;
|
|
767
762
|
item.relation_surcharge_ids = [];
|
|
@@ -770,15 +765,12 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
|
|
|
770
765
|
for (let item of service) {
|
|
771
766
|
resetItem(item);
|
|
772
767
|
const arr = (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || [];
|
|
773
|
-
for (let bundleItem of arr)
|
|
774
|
-
|
|
775
|
-
for (let relationDetail of (item == null ? void 0 : item.relation_details) || [])
|
|
776
|
-
resetItem(relationDetail);
|
|
768
|
+
for (let bundleItem of arr) resetItem(bundleItem);
|
|
769
|
+
for (let relationDetail of (item == null ? void 0 : item.relation_details) || []) resetItem(relationDetail);
|
|
777
770
|
}
|
|
778
771
|
}
|
|
779
772
|
if (Array.isArray(addons == null ? void 0 : addons.value)) {
|
|
780
|
-
for (let item of addons.value)
|
|
781
|
-
resetItem(item);
|
|
773
|
+
for (let item of addons.value) resetItem(item);
|
|
782
774
|
}
|
|
783
775
|
}
|
|
784
776
|
// Annotate the CommonJS export names for ESM import in node:
|
package/lib/plugins/request.js
CHANGED
|
@@ -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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
|
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(
|
|
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("
|
|
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
|
-
|
|
301
|
+
`\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${response.status}`,
|
|
301
302
|
config,
|
|
302
303
|
fetchOptions,
|
|
303
304
|
result
|
package/lib/plugins/window.js
CHANGED
|
@@ -23,9 +23,7 @@ __export(window_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(window_exports);
|
|
25
25
|
var SimpleStorage = class {
|
|
26
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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();
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|