@pisell/pisellos 2.1.38 → 2.1.40
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 +1 -0
- package/dist/effects/index.js +29 -6
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +10 -11
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +5 -5
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Payment/index.js +17 -17
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -3
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/plugins/request.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +6 -2
- package/dist/solution/BookingByStep/index.js +33 -9
- package/dist/solution/BookingTicket/index.d.ts +4 -0
- package/dist/solution/BookingTicket/index.js +17 -8
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.js +35 -35
- package/dist/solution/RegisterAndLogin/config.d.ts +87 -0
- package/dist/solution/RegisterAndLogin/config.js +792 -0
- package/dist/solution/RegisterAndLogin/index.d.ts +189 -0
- package/dist/solution/RegisterAndLogin/index.js +2667 -0
- package/dist/solution/RegisterAndLogin/types.d.ts +444 -0
- package/dist/solution/RegisterAndLogin/types.js +231 -0
- package/dist/solution/RegisterAndLogin/utils.d.ts +95 -0
- package/dist/solution/RegisterAndLogin/utils.js +322 -0
- package/dist/solution/ShopDiscount/index.js +36 -19
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- package/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +10 -11
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +6 -3
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Payment/index.js +16 -16
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -3
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/plugins/request.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +6 -2
- package/lib/solution/BookingByStep/index.js +10 -3
- package/lib/solution/BookingTicket/index.d.ts +4 -0
- package/lib/solution/BookingTicket/index.js +12 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.js +34 -34
- package/lib/solution/RegisterAndLogin/config.d.ts +87 -0
- package/lib/solution/RegisterAndLogin/config.js +594 -0
- package/lib/solution/RegisterAndLogin/index.d.ts +189 -0
- package/lib/solution/RegisterAndLogin/index.js +1593 -0
- package/lib/solution/RegisterAndLogin/types.d.ts +444 -0
- package/lib/solution/RegisterAndLogin/types.js +78 -0
- package/lib/solution/RegisterAndLogin/utils.d.ts +95 -0
- package/lib/solution/RegisterAndLogin/utils.js +279 -0
- package/lib/solution/ShopDiscount/index.js +19 -11
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/solution/RegisterAndLogin/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
debounce: () => debounce,
|
|
23
|
+
deepClone: () => deepClone,
|
|
24
|
+
formatEmailDisplay: () => formatEmailDisplay,
|
|
25
|
+
formatPhoneDisplay: () => formatPhoneDisplay,
|
|
26
|
+
formatTimestamp: () => formatTimestamp,
|
|
27
|
+
generateRandomString: () => generateRandomString,
|
|
28
|
+
getDeviceType: () => getDeviceType,
|
|
29
|
+
getOAuthProviderDisplayName: () => getOAuthProviderDisplayName,
|
|
30
|
+
getOAuthProviderIconUrl: () => getOAuthProviderIconUrl,
|
|
31
|
+
getTimeDifference: () => getTimeDifference,
|
|
32
|
+
isAndroidDevice: () => isAndroidDevice,
|
|
33
|
+
isIOSDevice: () => isIOSDevice,
|
|
34
|
+
isMobileDevice: () => isMobileDevice,
|
|
35
|
+
isTimestampExpired: () => isTimestampExpired,
|
|
36
|
+
isWebAuthnSupported: () => isWebAuthnSupported,
|
|
37
|
+
safeJsonParse: () => safeJsonParse,
|
|
38
|
+
safeJsonStringify: () => safeJsonStringify,
|
|
39
|
+
throttle: () => throttle,
|
|
40
|
+
validateEmail: () => validateEmail,
|
|
41
|
+
validatePassword: () => validatePassword,
|
|
42
|
+
validatePhone: () => validatePhone,
|
|
43
|
+
validateVerificationCode: () => validateVerificationCode
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(utils_exports);
|
|
46
|
+
var import_types = require("./types");
|
|
47
|
+
function validateEmail(email) {
|
|
48
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
49
|
+
return emailRegex.test(email);
|
|
50
|
+
}
|
|
51
|
+
function validatePhone(phone) {
|
|
52
|
+
const cleanPhone = phone.replace(/[^\d+]/g, "");
|
|
53
|
+
const phoneRegex = /^(\+\d{1,3}[- ]?)?\d{10,14}$/;
|
|
54
|
+
return phoneRegex.test(cleanPhone);
|
|
55
|
+
}
|
|
56
|
+
function validatePassword(password) {
|
|
57
|
+
const errors = [];
|
|
58
|
+
if (password.length < 8) {
|
|
59
|
+
errors.push("密码长度至少为8位");
|
|
60
|
+
}
|
|
61
|
+
if (password.length > 128) {
|
|
62
|
+
errors.push("密码长度不能超过128位");
|
|
63
|
+
}
|
|
64
|
+
if (!/[a-z]/.test(password)) {
|
|
65
|
+
errors.push("密码必须包含至少一个小写字母");
|
|
66
|
+
}
|
|
67
|
+
if (!/[A-Z]/.test(password)) {
|
|
68
|
+
errors.push("密码必须包含至少一个大写字母");
|
|
69
|
+
}
|
|
70
|
+
if (!/\d/.test(password)) {
|
|
71
|
+
errors.push("密码必须包含至少一个数字");
|
|
72
|
+
}
|
|
73
|
+
if (!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password)) {
|
|
74
|
+
errors.push("密码必须包含至少一个特殊字符");
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
isValid: errors.length === 0,
|
|
78
|
+
errors
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function validateVerificationCode(code, type) {
|
|
82
|
+
const cleanCode = code.replace(/\s/g, "");
|
|
83
|
+
switch (type) {
|
|
84
|
+
case import_types.VerificationCodeType.EMAIL:
|
|
85
|
+
case import_types.VerificationCodeType.SMS:
|
|
86
|
+
return /^\d{4,8}$/.test(cleanCode);
|
|
87
|
+
default:
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function formatPhoneDisplay(phone) {
|
|
92
|
+
const cleanPhone = phone.replace(/[^\d+]/g, "");
|
|
93
|
+
if (/^\d{11}$/.test(cleanPhone)) {
|
|
94
|
+
return cleanPhone.replace(/(\d{3})(\d{4})(\d{4})/, "$1 $2 $3");
|
|
95
|
+
}
|
|
96
|
+
if (cleanPhone.startsWith("+")) {
|
|
97
|
+
return cleanPhone;
|
|
98
|
+
}
|
|
99
|
+
return phone;
|
|
100
|
+
}
|
|
101
|
+
function formatEmailDisplay(email, maskLength = 3) {
|
|
102
|
+
const [localPart, domain] = email.split("@");
|
|
103
|
+
if (!localPart || !domain) {
|
|
104
|
+
return email;
|
|
105
|
+
}
|
|
106
|
+
if (localPart.length <= maskLength * 2) {
|
|
107
|
+
return email;
|
|
108
|
+
}
|
|
109
|
+
const visibleStart = localPart.substring(0, maskLength);
|
|
110
|
+
const visibleEnd = localPart.substring(localPart.length - maskLength);
|
|
111
|
+
const maskedPart = "*".repeat(localPart.length - maskLength * 2);
|
|
112
|
+
return `${visibleStart}${maskedPart}${visibleEnd}@${domain}`;
|
|
113
|
+
}
|
|
114
|
+
function generateRandomString(length = 32) {
|
|
115
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
116
|
+
let result = "";
|
|
117
|
+
for (let i = 0; i < length; i++) {
|
|
118
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
function getOAuthProviderDisplayName(provider) {
|
|
123
|
+
const displayNames = {
|
|
124
|
+
[import_types.OAuthProvider.FACEBOOK]: "Facebook",
|
|
125
|
+
[import_types.OAuthProvider.APPLE]: "Apple",
|
|
126
|
+
[import_types.OAuthProvider.GOOGLE]: "Google",
|
|
127
|
+
[import_types.OAuthProvider.WECHAT]: "微信",
|
|
128
|
+
[import_types.OAuthProvider.GITHUB]: "GitHub"
|
|
129
|
+
};
|
|
130
|
+
return displayNames[provider] || provider;
|
|
131
|
+
}
|
|
132
|
+
function getOAuthProviderIconUrl(provider) {
|
|
133
|
+
const iconUrls = {
|
|
134
|
+
[import_types.OAuthProvider.FACEBOOK]: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/facebook.svg",
|
|
135
|
+
[import_types.OAuthProvider.APPLE]: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/apple.svg",
|
|
136
|
+
[import_types.OAuthProvider.GOOGLE]: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/google.svg",
|
|
137
|
+
[import_types.OAuthProvider.WECHAT]: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/wechat.svg",
|
|
138
|
+
[import_types.OAuthProvider.GITHUB]: "https://cdn.jsdelivr.net/npm/simple-icons@v9/icons/github.svg"
|
|
139
|
+
};
|
|
140
|
+
return iconUrls[provider] || "";
|
|
141
|
+
}
|
|
142
|
+
function isMobileDevice() {
|
|
143
|
+
if (typeof window === "undefined") {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
147
|
+
navigator.userAgent
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function isWebAuthnSupported() {
|
|
151
|
+
if (typeof window === "undefined") {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
return !!(navigator.credentials && navigator.credentials.create);
|
|
155
|
+
}
|
|
156
|
+
function isIOSDevice() {
|
|
157
|
+
if (typeof window === "undefined") {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
return /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
161
|
+
}
|
|
162
|
+
function isAndroidDevice() {
|
|
163
|
+
if (typeof window === "undefined") {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return /Android/.test(navigator.userAgent);
|
|
167
|
+
}
|
|
168
|
+
function getDeviceType() {
|
|
169
|
+
if (typeof window === "undefined") {
|
|
170
|
+
return "desktop";
|
|
171
|
+
}
|
|
172
|
+
const userAgent = navigator.userAgent;
|
|
173
|
+
if (/iPad/.test(userAgent)) {
|
|
174
|
+
return "tablet";
|
|
175
|
+
}
|
|
176
|
+
if (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
|
|
177
|
+
return "mobile";
|
|
178
|
+
}
|
|
179
|
+
return "desktop";
|
|
180
|
+
}
|
|
181
|
+
function debounce(func, wait) {
|
|
182
|
+
let timeout = null;
|
|
183
|
+
return (...args) => {
|
|
184
|
+
if (timeout) {
|
|
185
|
+
clearTimeout(timeout);
|
|
186
|
+
}
|
|
187
|
+
timeout = setTimeout(() => {
|
|
188
|
+
func(...args);
|
|
189
|
+
}, wait);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function throttle(func, wait) {
|
|
193
|
+
let lastTime = 0;
|
|
194
|
+
return (...args) => {
|
|
195
|
+
const now = Date.now();
|
|
196
|
+
if (now - lastTime >= wait) {
|
|
197
|
+
lastTime = now;
|
|
198
|
+
func(...args);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function deepClone(obj) {
|
|
203
|
+
if (obj === null || typeof obj !== "object") {
|
|
204
|
+
return obj;
|
|
205
|
+
}
|
|
206
|
+
if (obj instanceof Date) {
|
|
207
|
+
return new Date(obj.getTime());
|
|
208
|
+
}
|
|
209
|
+
if (obj instanceof Array) {
|
|
210
|
+
return obj.map((item) => deepClone(item));
|
|
211
|
+
}
|
|
212
|
+
if (typeof obj === "object") {
|
|
213
|
+
const cloned = {};
|
|
214
|
+
for (const key in obj) {
|
|
215
|
+
if (obj.hasOwnProperty(key)) {
|
|
216
|
+
cloned[key] = deepClone(obj[key]);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return cloned;
|
|
220
|
+
}
|
|
221
|
+
return obj;
|
|
222
|
+
}
|
|
223
|
+
function safeJsonParse(jsonString, defaultValue) {
|
|
224
|
+
try {
|
|
225
|
+
return JSON.parse(jsonString);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
console.warn("JSON 解析失败:", error);
|
|
228
|
+
return defaultValue;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
function safeJsonStringify(obj, defaultValue = "{}") {
|
|
232
|
+
try {
|
|
233
|
+
return JSON.stringify(obj);
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.warn("JSON 字符串化失败:", error);
|
|
236
|
+
return defaultValue;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function formatTimestamp(timestamp, format = "YYYY-MM-DD HH:mm:ss") {
|
|
240
|
+
const date = new Date(timestamp);
|
|
241
|
+
const year = date.getFullYear();
|
|
242
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
243
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
244
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
245
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
246
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
247
|
+
return format.replace("YYYY", year.toString()).replace("MM", month).replace("DD", day).replace("HH", hours).replace("mm", minutes).replace("ss", seconds);
|
|
248
|
+
}
|
|
249
|
+
function getTimeDifference(timestamp1, timestamp2) {
|
|
250
|
+
return Math.abs(timestamp1 - timestamp2) / 1e3;
|
|
251
|
+
}
|
|
252
|
+
function isTimestampExpired(timestamp, expirationTime = 5 * 60 * 1e3) {
|
|
253
|
+
return Date.now() - timestamp > expirationTime;
|
|
254
|
+
}
|
|
255
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
256
|
+
0 && (module.exports = {
|
|
257
|
+
debounce,
|
|
258
|
+
deepClone,
|
|
259
|
+
formatEmailDisplay,
|
|
260
|
+
formatPhoneDisplay,
|
|
261
|
+
formatTimestamp,
|
|
262
|
+
generateRandomString,
|
|
263
|
+
getDeviceType,
|
|
264
|
+
getOAuthProviderDisplayName,
|
|
265
|
+
getOAuthProviderIconUrl,
|
|
266
|
+
getTimeDifference,
|
|
267
|
+
isAndroidDevice,
|
|
268
|
+
isIOSDevice,
|
|
269
|
+
isMobileDevice,
|
|
270
|
+
isTimestampExpired,
|
|
271
|
+
isWebAuthnSupported,
|
|
272
|
+
safeJsonParse,
|
|
273
|
+
safeJsonStringify,
|
|
274
|
+
throttle,
|
|
275
|
+
validateEmail,
|
|
276
|
+
validatePassword,
|
|
277
|
+
validatePhone,
|
|
278
|
+
validateVerificationCode
|
|
279
|
+
});
|
|
@@ -34,7 +34,6 @@ __export(ShopDiscount_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(ShopDiscount_exports);
|
|
36
36
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
37
|
-
var import_types = require("./types");
|
|
38
37
|
var import_Discount = require("../../modules/Discount");
|
|
39
38
|
var import_Rules = require("../../modules/Rules");
|
|
40
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
@@ -73,7 +72,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
73
72
|
(_a = this.store.discount) == null ? void 0 : _a.destroy();
|
|
74
73
|
(_b = this.store.rules) == null ? void 0 : _b.destroy();
|
|
75
74
|
this.core.effects.offByModuleDestroy(this.name);
|
|
76
|
-
await this.core.effects.emit(
|
|
75
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
77
76
|
console.log("[ShopDiscount] 已销毁");
|
|
78
77
|
}
|
|
79
78
|
async clear() {
|
|
@@ -123,8 +122,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
123
122
|
this.store.rules = rules;
|
|
124
123
|
}
|
|
125
124
|
registerEventListeners() {
|
|
126
|
-
this.core.effects.
|
|
127
|
-
|
|
125
|
+
this.core.effects.only(
|
|
126
|
+
`${this.name}:onCustomerChange`,
|
|
128
127
|
(customer) => {
|
|
129
128
|
var _a;
|
|
130
129
|
if (((_a = this.options.otherParams) == null ? void 0 : _a.cacheId) && this.getDiscountList().length) {
|
|
@@ -146,7 +145,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
146
145
|
if (((_a = this.store.customer) == null ? void 0 : _a.id) !== customer.id) {
|
|
147
146
|
this.store.customer = customer;
|
|
148
147
|
await this.core.effects.emit(
|
|
149
|
-
|
|
148
|
+
`${this.name}:onCustomerChange`,
|
|
150
149
|
customer
|
|
151
150
|
);
|
|
152
151
|
}
|
|
@@ -234,6 +233,15 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
234
233
|
isScan: true
|
|
235
234
|
};
|
|
236
235
|
});
|
|
236
|
+
const currentSelectedDiscountList = this.getDiscountList().filter((n) => n.isSelected);
|
|
237
|
+
if (currentSelectedDiscountList.length && currentSelectedDiscountList.some((n) => withScanList.some((m) => m.id === n.id))) {
|
|
238
|
+
return {
|
|
239
|
+
type: "clientCalc",
|
|
240
|
+
isAvailable: true,
|
|
241
|
+
productList: this.store.productList || [],
|
|
242
|
+
discountList: this.getDiscountList()
|
|
243
|
+
};
|
|
244
|
+
}
|
|
237
245
|
const {
|
|
238
246
|
productList: newProductList,
|
|
239
247
|
discountList: newDiscountList,
|
|
@@ -292,7 +300,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
292
300
|
// 触发优惠列表变更事件
|
|
293
301
|
async emitDiscountListChange(discountList) {
|
|
294
302
|
await this.core.effects.emit(
|
|
295
|
-
|
|
303
|
+
`${this.name}:onDiscountListChange`,
|
|
296
304
|
discountList
|
|
297
305
|
);
|
|
298
306
|
}
|
|
@@ -390,7 +398,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
390
398
|
const { ...customer } = result.data;
|
|
391
399
|
this.setCustomer(customer);
|
|
392
400
|
await this.core.effects.emit(
|
|
393
|
-
|
|
401
|
+
`${this.name}:onScanCustomerChange`,
|
|
394
402
|
customer
|
|
395
403
|
);
|
|
396
404
|
}
|
|
@@ -406,12 +414,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
406
414
|
const result = this.calcDiscount(this.store.productList);
|
|
407
415
|
cb == null ? void 0 : cb(result);
|
|
408
416
|
await this.core.effects.emit(
|
|
409
|
-
|
|
417
|
+
`${this.name}:onLoadPrepareCalcResult`,
|
|
410
418
|
result
|
|
411
419
|
);
|
|
412
420
|
}
|
|
413
421
|
await this.core.effects.emit(
|
|
414
|
-
|
|
422
|
+
`${this.name}:onLoadDiscountList`,
|
|
415
423
|
newDiscountList
|
|
416
424
|
);
|
|
417
425
|
}
|
|
@@ -437,12 +445,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
437
445
|
if ((_d = this.store.productList) == null ? void 0 : _d.length) {
|
|
438
446
|
const result = this.calcDiscount(this.store.productList);
|
|
439
447
|
await this.core.effects.emit(
|
|
440
|
-
|
|
448
|
+
`${this.name}:onLoadPrepareCalcResult`,
|
|
441
449
|
result
|
|
442
450
|
);
|
|
443
451
|
}
|
|
444
452
|
await this.core.effects.emit(
|
|
445
|
-
|
|
453
|
+
`${this.name}:onLoadDiscountList`,
|
|
446
454
|
newDiscountList
|
|
447
455
|
);
|
|
448
456
|
} catch (error) {
|
package/lib/solution/index.d.ts
CHANGED
package/lib/solution/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __reExport(solution_exports, require("./BuyTickets"), module.exports);
|
|
|
20
20
|
__reExport(solution_exports, require("./BookingByStep"), module.exports);
|
|
21
21
|
__reExport(solution_exports, require("./BookingTicket"), module.exports);
|
|
22
22
|
__reExport(solution_exports, require("./ShopDiscount"), module.exports);
|
|
23
|
+
__reExport(solution_exports, require("./RegisterAndLogin"), module.exports);
|
|
23
24
|
__reExport(solution_exports, require("./Checkout"), module.exports);
|
|
24
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25
26
|
0 && (module.exports = {
|
|
@@ -27,5 +28,6 @@ __reExport(solution_exports, require("./Checkout"), module.exports);
|
|
|
27
28
|
...require("./BookingByStep"),
|
|
28
29
|
...require("./BookingTicket"),
|
|
29
30
|
...require("./ShopDiscount"),
|
|
31
|
+
...require("./RegisterAndLogin"),
|
|
30
32
|
...require("./Checkout")
|
|
31
33
|
});
|
package/lib/types/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface PisellCore {
|
|
|
40
40
|
effects: {
|
|
41
41
|
on: (event: string, callback: (payload: any) => void) => () => void;
|
|
42
42
|
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
+
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
44
|
off: (event: string, callback: (payload: any) => void) => void;
|
|
44
45
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
45
46
|
status: boolean;
|