@pisell/pisellos 0.0.465 → 0.0.467
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/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/Rules/index.js +9 -6
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +4 -4
- package/lib/modules/Rules/index.js +8 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,9 +14,9 @@ export declare class BaseModule {
|
|
|
14
14
|
store: any;
|
|
15
15
|
cacheKey: string[];
|
|
16
16
|
}): void;
|
|
17
|
-
effectsOn(eventType: string, callback: (payload: any) => void): void;
|
|
17
|
+
effectsOn(eventType: string, callback: (payload: any) => void, force?: boolean): void;
|
|
18
18
|
effectsOff(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
-
effectsOnce(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
+
effectsOnce(eventType: string, callback: (payload: any) => void, force?: boolean): void;
|
|
20
20
|
effectsEmit(eventType: string, payload: any): Promise<{
|
|
21
21
|
status: boolean;
|
|
22
22
|
data: any;
|
|
@@ -68,8 +68,8 @@ export var BaseModule = /*#__PURE__*/function () {
|
|
|
68
68
|
}
|
|
69
69
|
}, {
|
|
70
70
|
key: "effectsOn",
|
|
71
|
-
value: function effectsOn(eventType, callback) {
|
|
72
|
-
return this.core.effects.on("".concat(this.name, ":").concat(eventType), callback);
|
|
71
|
+
value: function effectsOn(eventType, callback, force) {
|
|
72
|
+
return this.core.effects.on("".concat(this.name, ":").concat(eventType), callback, force);
|
|
73
73
|
}
|
|
74
74
|
}, {
|
|
75
75
|
key: "effectsOff",
|
|
@@ -78,8 +78,8 @@ export var BaseModule = /*#__PURE__*/function () {
|
|
|
78
78
|
}
|
|
79
79
|
}, {
|
|
80
80
|
key: "effectsOnce",
|
|
81
|
-
value: function effectsOnce(eventType, callback) {
|
|
82
|
-
return this.core.effects.once("".concat(this.name, ":").concat(eventType), callback);
|
|
81
|
+
value: function effectsOnce(eventType, callback, force) {
|
|
82
|
+
return this.core.effects.once("".concat(this.name, ":").concat(eventType), callback, force);
|
|
83
83
|
}
|
|
84
84
|
}, {
|
|
85
85
|
key: "effectsEmit",
|
|
@@ -1325,12 +1325,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1325
1325
|
// 前端使用的num数量,为了计算优惠金额(拆分时为1)
|
|
1326
1326
|
_num: isNeedSplit ? 1 : product.num,
|
|
1327
1327
|
config: currentSelectedDiscount === null || currentSelectedDiscount === void 0 ? void 0 : currentSelectedDiscount.config,
|
|
1328
|
-
metadata: _objectSpread(
|
|
1329
|
-
num: 1
|
|
1328
|
+
metadata: _objectSpread({
|
|
1329
|
+
num: 1,
|
|
1330
|
+
discount_rule_uncheck_flag: selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.discount_rule_uncheck_flag
|
|
1330
1331
|
}, productDiscountDifference !== undefined && {
|
|
1331
1332
|
product_discount_difference: productDiscountDifference
|
|
1332
|
-
}), {}, {
|
|
1333
|
-
discount_rule_uncheck_flag: selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.discount_rule_uncheck_flag
|
|
1334
1333
|
})
|
|
1335
1334
|
};
|
|
1336
1335
|
appliedProducts.push(discountDetail);
|
|
@@ -1973,8 +1972,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1973
1972
|
quantity: 1,
|
|
1974
1973
|
discount_list: updatedMainDiscountList,
|
|
1975
1974
|
bundle: newBundleWithDiscount,
|
|
1976
|
-
total: newTotalWithDiscount,
|
|
1977
|
-
origin_total: newOriginTotalWithDiscount
|
|
1975
|
+
total: new Decimal(newTotalWithDiscount).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber(),
|
|
1976
|
+
origin_total: new Decimal(newOriginTotalWithDiscount).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber()
|
|
1978
1977
|
})));
|
|
1979
1978
|
|
|
1980
1979
|
// 第二个:包含原始bundle (qty=原quantity-1)
|
|
@@ -2036,6 +2035,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2036
2035
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
2037
2036
|
}, new Decimal(newTotalOriginal)).toNumber();
|
|
2038
2037
|
}
|
|
2038
|
+
newTotalOriginal = new Decimal(newTotalOriginal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
2039
|
+
newOriginTotalOriginal = new Decimal(newOriginTotalOriginal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
2039
2040
|
|
|
2040
2041
|
// 添加第二个主商品:qty=原quantity-1,包含原始bundle
|
|
2041
2042
|
result.push(_this3.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
|
|
@@ -2137,6 +2138,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2137
2138
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
2138
2139
|
}, new Decimal(newTotal)).toNumber();
|
|
2139
2140
|
}
|
|
2141
|
+
newTotal = new Decimal(newTotal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
2142
|
+
newOriginTotal = new Decimal(newOriginTotal).toDecimalPlaces(2, Decimal.ROUND_HALF_UP).toNumber();
|
|
2140
2143
|
|
|
2141
2144
|
// 生成最终的主商品
|
|
2142
2145
|
result.push(_this3.hooks.setProduct(mainProduct, _objectSpread(_objectSpread({}, mainProductData), {}, {
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -38,9 +38,9 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
42
41
|
on: (event: string, callback: (payload: any) => void, force?: boolean) => void;
|
|
43
42
|
once: (event: string, callback: (payload: any) => void, force?: boolean) => void;
|
|
43
|
+
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
44
44
|
off: (event: string, callback: (payload: any) => void) => void;
|
|
45
45
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
46
46
|
status: boolean;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -14,9 +14,9 @@ export declare class BaseModule {
|
|
|
14
14
|
store: any;
|
|
15
15
|
cacheKey: string[];
|
|
16
16
|
}): void;
|
|
17
|
-
effectsOn(eventType: string, callback: (payload: any) => void): void;
|
|
17
|
+
effectsOn(eventType: string, callback: (payload: any) => void, force?: boolean): void;
|
|
18
18
|
effectsOff(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
-
effectsOnce(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
+
effectsOnce(eventType: string, callback: (payload: any) => void, force?: boolean): void;
|
|
20
20
|
effectsEmit(eventType: string, payload: any): Promise<{
|
|
21
21
|
status: boolean;
|
|
22
22
|
data: any;
|
|
@@ -84,14 +84,14 @@ var BaseModule = class {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
effectsOn(eventType, callback) {
|
|
88
|
-
return this.core.effects.on(`${this.name}:${eventType}`, callback);
|
|
87
|
+
effectsOn(eventType, callback, force) {
|
|
88
|
+
return this.core.effects.on(`${this.name}:${eventType}`, callback, force);
|
|
89
89
|
}
|
|
90
90
|
effectsOff(eventType, callback) {
|
|
91
91
|
return this.core.effects.off(`${this.name}:${eventType}`, callback);
|
|
92
92
|
}
|
|
93
|
-
effectsOnce(eventType, callback) {
|
|
94
|
-
return this.core.effects.once(`${this.name}:${eventType}`, callback);
|
|
93
|
+
effectsOnce(eventType, callback, force) {
|
|
94
|
+
return this.core.effects.once(`${this.name}:${eventType}`, callback, force);
|
|
95
95
|
}
|
|
96
96
|
effectsEmit(eventType, payload) {
|
|
97
97
|
return this.core.effects.emit(`${this.name}:${eventType}`, payload);
|
|
@@ -990,9 +990,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
990
990
|
config: currentSelectedDiscount == null ? void 0 : currentSelectedDiscount.config,
|
|
991
991
|
metadata: {
|
|
992
992
|
num: 1,
|
|
993
|
+
discount_rule_uncheck_flag: selectedDiscount == null ? void 0 : selectedDiscount.discount_rule_uncheck_flag,
|
|
993
994
|
// 🔥 order_level 分摊差值
|
|
994
|
-
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
995
|
-
discount_rule_uncheck_flag: selectedDiscount == null ? void 0 : selectedDiscount.discount_rule_uncheck_flag
|
|
995
|
+
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
996
996
|
}
|
|
997
997
|
};
|
|
998
998
|
appliedProducts.push(discountDetail);
|
|
@@ -1579,8 +1579,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1579
1579
|
quantity: 1,
|
|
1580
1580
|
discount_list: updatedMainDiscountList,
|
|
1581
1581
|
bundle: newBundleWithDiscount,
|
|
1582
|
-
total: newTotalWithDiscount,
|
|
1583
|
-
origin_total: newOriginTotalWithDiscount
|
|
1582
|
+
total: new import_decimal.default(newTotalWithDiscount).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber(),
|
|
1583
|
+
origin_total: new import_decimal.default(newOriginTotalWithDiscount).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber()
|
|
1584
1584
|
})
|
|
1585
1585
|
);
|
|
1586
1586
|
if (mainProductQuantity > 1) {
|
|
@@ -1638,6 +1638,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1638
1638
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
1639
1639
|
}, new import_decimal.default(newTotalOriginal)).toNumber();
|
|
1640
1640
|
}
|
|
1641
|
+
newTotalOriginal = new import_decimal.default(newTotalOriginal).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
|
|
1642
|
+
newOriginTotalOriginal = new import_decimal.default(newOriginTotalOriginal).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
|
|
1641
1643
|
result.push(
|
|
1642
1644
|
this.hooks.setProduct(mainProduct, {
|
|
1643
1645
|
...mainProductData,
|
|
@@ -1729,6 +1731,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1729
1731
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
1730
1732
|
}, new import_decimal.default(newTotal)).toNumber();
|
|
1731
1733
|
}
|
|
1734
|
+
newTotal = new import_decimal.default(newTotal).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
|
|
1735
|
+
newOriginTotal = new import_decimal.default(newOriginTotal).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
|
|
1732
1736
|
result.push(
|
|
1733
1737
|
this.hooks.setProduct(mainProduct, {
|
|
1734
1738
|
...mainProductData,
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -38,9 +38,9 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
42
41
|
on: (event: string, callback: (payload: any) => void, force?: boolean) => void;
|
|
43
42
|
once: (event: string, callback: (payload: any) => void, force?: boolean) => void;
|
|
43
|
+
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
44
44
|
off: (event: string, callback: (payload: any) => void) => void;
|
|
45
45
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
46
46
|
status: boolean;
|