@pisell/pisellos 3.0.77 → 3.0.79
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/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +21 -1
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +16 -8
- package/dist/modules/Date/types.d.ts +3 -1
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +2 -1
- package/dist/modules/ProductList/index.js +8 -9
- package/dist/modules/Rules/index.d.ts +3 -1
- package/dist/modules/Rules/index.js +110 -27
- package/dist/modules/Rules/types.d.ts +6 -0
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +76 -0
- package/dist/modules/Summary/index.d.ts +3 -0
- package/dist/modules/Summary/index.js +134 -15
- package/dist/modules/Summary/types.d.ts +7 -0
- package/dist/modules/Summary/utils.d.ts +104 -1
- package/dist/modules/Summary/utils.js +1131 -13
- package/dist/solution/BookingByStep/index.d.ts +14 -0
- package/dist/solution/BookingByStep/index.js +688 -210
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/resources.js +4 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +11 -6
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +16 -1
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +7 -1
- package/lib/modules/Date/types.d.ts +3 -1
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +2 -1
- package/lib/modules/ProductList/index.js +0 -7
- package/lib/modules/Rules/index.d.ts +3 -1
- package/lib/modules/Rules/index.js +43 -5
- package/lib/modules/Rules/types.d.ts +6 -0
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +60 -0
- package/lib/modules/Summary/index.d.ts +3 -0
- package/lib/modules/Summary/index.js +61 -2
- package/lib/modules/Summary/types.d.ts +7 -0
- package/lib/modules/Summary/utils.d.ts +104 -1
- package/lib/modules/Summary/utils.js +673 -8
- package/lib/solution/BookingByStep/index.d.ts +14 -0
- package/lib/solution/BookingByStep/index.js +465 -89
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +4 -1
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +11 -5
- package/package.json +1 -1
|
@@ -230,7 +230,7 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
230
230
|
let totalAvailableCapacity = 0;
|
|
231
231
|
resourcesInType.forEach((resource) => {
|
|
232
232
|
const availableTimes = resource.times.filter((time) => {
|
|
233
|
-
return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute");
|
|
233
|
+
return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || resource.onlyComputed && (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute");
|
|
234
234
|
});
|
|
235
235
|
if (availableTimes.length > 0) {
|
|
236
236
|
totalAvailableCapacity += resource.capacity || 0;
|
|
@@ -353,7 +353,10 @@ var getTimeSlicesByResource = ({
|
|
|
353
353
|
});
|
|
354
354
|
times.forEach((time) => {
|
|
355
355
|
const startTime = (0, import_dayjs.default)(`${time.start_at}`);
|
|
356
|
-
|
|
356
|
+
let endTime = (0, import_dayjs.default)(`${time.end_at}`);
|
|
357
|
+
if (endTime.isAfter((0, import_dayjs.default)(currentDate).endOf("day"))) {
|
|
358
|
+
endTime = (0, import_dayjs.default)(currentDate).endOf("day");
|
|
359
|
+
}
|
|
357
360
|
let currentStart = startTime;
|
|
358
361
|
while (true) {
|
|
359
362
|
const currentEnd = currentStart.add(duration, "minute");
|
|
@@ -2,6 +2,7 @@ import { Module, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { Customer } from './types';
|
|
4
4
|
import { Discount } from '../../modules/Discount/types';
|
|
5
|
+
import { UnavailableReason } from '../../modules/Rules/types';
|
|
5
6
|
export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
6
7
|
protected defaultName: string;
|
|
7
8
|
protected defaultVersion: string;
|
|
@@ -48,6 +49,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
48
49
|
productList: Record<string, any>[];
|
|
49
50
|
discountList: Discount[];
|
|
50
51
|
type: "server" | "clientCalc";
|
|
52
|
+
unavailableReason?: UnavailableReason;
|
|
51
53
|
}>;
|
|
52
54
|
calcDiscountApplicableProductTotalPrice(discount: Discount): number | undefined;
|
|
53
55
|
private getCustomer;
|
|
@@ -38,6 +38,7 @@ var import_types = require("./types");
|
|
|
38
38
|
var import_Discount = require("../../modules/Discount");
|
|
39
39
|
var import_Rules = require("../../modules/Rules");
|
|
40
40
|
var import_utils = require("./utils");
|
|
41
|
+
var import_types2 = require("../../modules/Rules/types");
|
|
41
42
|
var import_decimal = __toESM(require("decimal.js"));
|
|
42
43
|
var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
43
44
|
constructor(name, version) {
|
|
@@ -262,7 +263,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
262
263
|
type: "clientCalc",
|
|
263
264
|
isAvailable: false,
|
|
264
265
|
productList: this.store.productList || [],
|
|
265
|
-
discountList: this.getDiscountList()
|
|
266
|
+
discountList: this.getDiscountList(),
|
|
267
|
+
unavailableReason: import_types2.UnavailableReason.Unknown
|
|
266
268
|
};
|
|
267
269
|
}
|
|
268
270
|
if (!resultDiscountList.length) {
|
|
@@ -291,7 +293,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
291
293
|
const {
|
|
292
294
|
productList: newProductList,
|
|
293
295
|
discountList: newDiscountList,
|
|
294
|
-
isAvailable
|
|
296
|
+
isAvailable,
|
|
297
|
+
unavailableReason
|
|
295
298
|
} = rulesModule.isDiscountListAvailable({
|
|
296
299
|
productList: this.store.productList || [],
|
|
297
300
|
oldDiscountList: this.getDiscountList(),
|
|
@@ -316,7 +319,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
316
319
|
type: "clientCalc",
|
|
317
320
|
isAvailable: isAvailable || false,
|
|
318
321
|
productList: newProductList || this.store.productList || [],
|
|
319
|
-
discountList: newDiscountList || this.getDiscountList()
|
|
322
|
+
discountList: newDiscountList || this.getDiscountList(),
|
|
323
|
+
unavailableReason
|
|
320
324
|
};
|
|
321
325
|
} catch (error) {
|
|
322
326
|
console.error("[ShopDiscount] 扫码出错:", error);
|
|
@@ -324,7 +328,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
324
328
|
type: "clientCalc",
|
|
325
329
|
isAvailable: false,
|
|
326
330
|
productList: this.store.productList || [],
|
|
327
|
-
discountList: this.getDiscountList()
|
|
331
|
+
discountList: this.getDiscountList(),
|
|
332
|
+
unavailableReason: import_types2.UnavailableReason.Unknown
|
|
328
333
|
};
|
|
329
334
|
}
|
|
330
335
|
}
|
|
@@ -464,7 +469,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
464
469
|
action: "create",
|
|
465
470
|
with_good_pass: 1,
|
|
466
471
|
with_discount_card: 1,
|
|
467
|
-
with_wallet_pass_holder: 1
|
|
472
|
+
with_wallet_pass_holder: 1,
|
|
473
|
+
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
468
474
|
}));
|
|
469
475
|
const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
|
|
470
476
|
(item) => item.isScan
|