@pisell/pisellos 2.2.112 → 2.2.114
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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -561,13 +561,16 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
561
561
|
return _this3.normalizeMatchedBooking(current, deviceCurrent, booking);
|
|
562
562
|
}).filter(function (booking) {
|
|
563
563
|
return Boolean(booking);
|
|
564
|
-
}).filter(function (booking) {
|
|
565
|
-
return !booking.status;
|
|
566
564
|
}).sort(function (left, right) {
|
|
567
565
|
var leftStartAt = _this3.toBookingDateTime(left.start_date, left.start_time).valueOf();
|
|
568
566
|
var rightStartAt = _this3.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
569
567
|
return leftStartAt - rightStartAt;
|
|
570
|
-
}); //
|
|
568
|
+
}); // 过滤掉没有 status 的 booking
|
|
569
|
+
normalizedBookings = normalizedBookings.filter(function (booking) {
|
|
570
|
+
return booking.status;
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// 建立 resourceId -> bookings[] 倒排索引,加速资源匹配
|
|
571
574
|
bookingMap = new Map();
|
|
572
575
|
normalizedBookings.forEach(function (booking) {
|
|
573
576
|
if (!Array.isArray(booking.resources)) return;
|
|
@@ -598,7 +601,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
598
601
|
list: list
|
|
599
602
|
});
|
|
600
603
|
return _context3.abrupt("return", list);
|
|
601
|
-
case
|
|
604
|
+
case 21:
|
|
602
605
|
case "end":
|
|
603
606
|
return _context3.stop();
|
|
604
607
|
}
|
|
@@ -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
|
-
});
|
|
@@ -409,11 +409,12 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
409
409
|
const resourceList = ((_a = resourceResponse == null ? void 0 : resourceResponse.data) == null ? void 0 : _a.list) ?? [];
|
|
410
410
|
if (!Array.isArray(resourceList) || resourceList.length === 0)
|
|
411
411
|
return [];
|
|
412
|
-
|
|
412
|
+
let normalizedBookings = bookingList.map((booking) => this.normalizeMatchedBooking(current, deviceCurrent, booking)).filter((booking) => Boolean(booking)).sort((left, right) => {
|
|
413
413
|
const leftStartAt = this.toBookingDateTime(left.start_date, left.start_time).valueOf();
|
|
414
414
|
const rightStartAt = this.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
415
415
|
return leftStartAt - rightStartAt;
|
|
416
416
|
});
|
|
417
|
+
normalizedBookings = normalizedBookings.filter((booking) => booking.status);
|
|
417
418
|
const bookingMap = /* @__PURE__ */ new Map();
|
|
418
419
|
normalizedBookings.forEach((booking) => {
|
|
419
420
|
if (!Array.isArray(booking.resources))
|