@pisell/pisellos 2.1.98 → 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
|
@@ -48,26 +48,26 @@ var import_types = require("../../../modules/Payment/types");
|
|
|
48
48
|
function validateCheckoutData(params) {
|
|
49
49
|
const errors = [];
|
|
50
50
|
if (!params.cartItems || params.cartItems.length === 0) {
|
|
51
|
-
errors.push("
|
|
51
|
+
errors.push("\u8D2D\u7269\u8F66\u4E0D\u80FD\u4E3A\u7A7A");
|
|
52
52
|
}
|
|
53
53
|
if (params.cartItems) {
|
|
54
54
|
params.cartItems.forEach((item, index) => {
|
|
55
55
|
if (!item.id) {
|
|
56
|
-
errors.push(
|
|
56
|
+
errors.push(`\u8D2D\u7269\u8F66\u5546\u54C1 ${index + 1} \u7F3A\u5C11\u5546\u54C1ID`);
|
|
57
57
|
}
|
|
58
58
|
if (!item.price || parseFloat(String(item.price)) < 0) {
|
|
59
|
-
errors.push(
|
|
59
|
+
errors.push(`\u8D2D\u7269\u8F66\u5546\u54C1 ${index + 1} \u4EF7\u683C\u65E0\u6548`);
|
|
60
60
|
}
|
|
61
61
|
if (!item.num || item.num <= 0) {
|
|
62
|
-
errors.push(
|
|
62
|
+
errors.push(`\u8D2D\u7269\u8F66\u5546\u54C1 ${index + 1} \u6570\u91CF\u65E0\u6548`);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
if (params.orderType && !["virtual", "appointment_booking"].includes(params.orderType)) {
|
|
67
|
-
errors.push("
|
|
67
|
+
errors.push("\u8BA2\u5355\u7C7B\u578B\u65E0\u6548\uFF0C\u5FC5\u987B\u662F virtual \u6216 appointment_booking");
|
|
68
68
|
}
|
|
69
69
|
if (params.platform && !["pc", "h5"].includes(params.platform)) {
|
|
70
|
-
errors.push("
|
|
70
|
+
errors.push("\u5E73\u53F0\u7C7B\u578B\u65E0\u6548\uFF0C\u5FC5\u987B\u662F pc \u6216 h5");
|
|
71
71
|
}
|
|
72
72
|
return {
|
|
73
73
|
valid: errors.length === 0,
|
|
@@ -84,8 +84,7 @@ function createCheckoutError(type, message, details) {
|
|
|
84
84
|
}
|
|
85
85
|
function formatAmount(amount) {
|
|
86
86
|
const numAmount = typeof amount === "string" ? parseFloat(amount) : amount;
|
|
87
|
-
if (isNaN(numAmount))
|
|
88
|
-
return "0.00";
|
|
87
|
+
if (isNaN(numAmount)) return "0.00";
|
|
89
88
|
return numAmount.toFixed(2);
|
|
90
89
|
}
|
|
91
90
|
function validateAmount(amount) {
|
|
@@ -165,12 +164,9 @@ async function retry(fn, maxAttempts = 3, delay = 1e3) {
|
|
|
165
164
|
throw lastError;
|
|
166
165
|
}
|
|
167
166
|
function isEmpty(obj) {
|
|
168
|
-
if (obj == null)
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
return obj.length === 0;
|
|
172
|
-
if (typeof obj === "object")
|
|
173
|
-
return Object.keys(obj).length === 0;
|
|
167
|
+
if (obj == null) return true;
|
|
168
|
+
if (Array.isArray(obj) || typeof obj === "string") return obj.length === 0;
|
|
169
|
+
if (typeof obj === "object") return Object.keys(obj).length === 0;
|
|
174
170
|
return false;
|
|
175
171
|
}
|
|
176
172
|
function getErrorMessage(error) {
|
|
@@ -183,7 +179,7 @@ function getErrorMessage(error) {
|
|
|
183
179
|
if (error && typeof error === "object" && "message" in error) {
|
|
184
180
|
return String(error.message);
|
|
185
181
|
}
|
|
186
|
-
return "
|
|
182
|
+
return "\u672A\u77E5\u9519\u8BEF";
|
|
187
183
|
}
|
|
188
184
|
function isProduction() {
|
|
189
185
|
return process.env.NODE_ENV === "production";
|
|
@@ -208,24 +204,24 @@ function validateLocalOrderData(orderData) {
|
|
|
208
204
|
var _a;
|
|
209
205
|
const errors = [];
|
|
210
206
|
if (!orderData.type) {
|
|
211
|
-
errors.push("
|
|
207
|
+
errors.push("\u8BA2\u5355\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
|
|
212
208
|
}
|
|
213
209
|
if (!orderData.platform) {
|
|
214
|
-
errors.push("
|
|
210
|
+
errors.push("\u5E73\u53F0\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A");
|
|
215
211
|
}
|
|
216
212
|
if ((!orderData.bookings || orderData.bookings.length === 0) && !((_a = orderData == null ? void 0 : orderData.relation_products) == null ? void 0 : _a.length)) {
|
|
217
|
-
errors.push("
|
|
213
|
+
errors.push("\u9884\u8BA2\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A");
|
|
218
214
|
}
|
|
219
215
|
if (orderData.bookings) {
|
|
220
216
|
orderData.bookings.forEach((booking, index) => {
|
|
221
217
|
if (!booking.product || !booking.product.product_id) {
|
|
222
|
-
errors.push(
|
|
218
|
+
errors.push(`\u9884\u8BA2\u9879 ${index + 1} \u7F3A\u5C11\u5546\u54C1\u4FE1\u606F`);
|
|
223
219
|
}
|
|
224
220
|
if (!booking.start_date) {
|
|
225
|
-
errors.push(
|
|
221
|
+
errors.push(`\u9884\u8BA2\u9879 ${index + 1} \u7F3A\u5C11\u5F00\u59CB\u65E5\u671F`);
|
|
226
222
|
}
|
|
227
223
|
if (!booking.start_time) {
|
|
228
|
-
errors.push(
|
|
224
|
+
errors.push(`\u9884\u8BA2\u9879 ${index + 1} \u7F3A\u5C11\u5F00\u59CB\u65F6\u95F4`);
|
|
229
225
|
}
|
|
230
226
|
});
|
|
231
227
|
}
|
|
@@ -288,7 +284,7 @@ function extractAmountFromCartSummary(cartSummary) {
|
|
|
288
284
|
break;
|
|
289
285
|
}
|
|
290
286
|
});
|
|
291
|
-
console.log("[Checkout]
|
|
287
|
+
console.log("[Checkout] \u4ECE\u8D2D\u7269\u8F66\u5C0F\u8BA1\u63D0\u53D6\u91D1\u989D\u4FE1\u606F:", {
|
|
292
288
|
totalAmount: result.totalAmount,
|
|
293
289
|
subTotal: result.subTotal,
|
|
294
290
|
taxAmount: result.taxAmount,
|
|
@@ -550,7 +550,7 @@ var ApiCaller = class {
|
|
|
550
550
|
async call(apiName, params, additionalOptions) {
|
|
551
551
|
const apiConfig = this.config[apiName];
|
|
552
552
|
if (!apiConfig) {
|
|
553
|
-
throw new Error(`API
|
|
553
|
+
throw new Error(`API \u914D\u7F6E\u672A\u627E\u5230: ${String(apiName)}`);
|
|
554
554
|
}
|
|
555
555
|
const transformedParams = apiConfig.transformParams ? apiConfig.transformParams(params) : params;
|
|
556
556
|
let requestOptions = { ...apiConfig.options, ...additionalOptions };
|
|
@@ -578,7 +578,7 @@ var ApiCaller = class {
|
|
|
578
578
|
response = await this.request.delete(apiConfig.url, requestOptions);
|
|
579
579
|
break;
|
|
580
580
|
default:
|
|
581
|
-
throw new Error(
|
|
581
|
+
throw new Error(`\u4E0D\u652F\u6301\u7684 HTTP \u65B9\u6CD5: ${apiConfig.method}`);
|
|
582
582
|
}
|
|
583
583
|
return apiConfig.transformResponse ? apiConfig.transformResponse(response) : response;
|
|
584
584
|
}
|