@pisell/pisellos 2.1.146 → 2.1.147
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.js +8 -7
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.js +6 -5
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
329
329
|
count: number;
|
|
330
330
|
left: number;
|
|
331
331
|
summaryCount: number;
|
|
332
|
-
status: "
|
|
332
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
333
333
|
}[];
|
|
334
334
|
/**
|
|
335
335
|
* 找到多个资源的公共可用时间段
|
|
@@ -1349,7 +1349,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1349
1349
|
var resourceState = this.store.resource;
|
|
1350
1350
|
var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
|
|
1351
1351
|
|
|
1352
|
-
//
|
|
1352
|
+
// 无 collect_pax 时的资源占用兜底:single 独占整张桌台,其余模式占 1 个容量位。
|
|
1353
1353
|
var resolveResourceCapacity = function resolveResourceCapacity() {
|
|
1354
1354
|
if (resourceSelectType === 'single') {
|
|
1355
1355
|
var _resourceState$table_;
|
|
@@ -1361,10 +1361,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1361
1361
|
return 1;
|
|
1362
1362
|
};
|
|
1363
1363
|
return function (payload, _ref3) {
|
|
1364
|
-
var _tempOrder$resource_i, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati,
|
|
1364
|
+
var _tempOrder$resource_i, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _pickFirstCustomCapac;
|
|
1365
1365
|
var bookingUuid = _ref3.bookingUuid,
|
|
1366
1366
|
tempOrder = _ref3.tempOrder;
|
|
1367
1367
|
var resourceId = (_tempOrder$resource_i = tempOrder.resource_id) !== null && _tempOrder$resource_i !== void 0 ? _tempOrder$resource_i : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
|
|
1368
|
+
var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
|
|
1369
|
+
var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
|
|
1370
|
+
var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
|
|
1368
1371
|
var pickOriginal = function pickOriginal(value) {
|
|
1369
1372
|
if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
|
|
1370
1373
|
var original = value.original;
|
|
@@ -1380,17 +1383,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1380
1383
|
main_field: mainField,
|
|
1381
1384
|
form_id: resourceState.tableFormId,
|
|
1382
1385
|
relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
|
|
1383
|
-
capacity:
|
|
1386
|
+
capacity: resourceCapacityValue,
|
|
1384
1387
|
metadata: _this5.buildScanOrderResourceMetadata({
|
|
1385
1388
|
resourceState: resourceState,
|
|
1386
1389
|
resourceName: mainField
|
|
1387
1390
|
})
|
|
1388
1391
|
} : undefined;
|
|
1389
1392
|
var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
|
|
1390
|
-
//
|
|
1391
|
-
var
|
|
1392
|
-
var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
|
|
1393
|
-
var bookingCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
|
|
1393
|
+
// 有 collect_pax 时 booking/resource capacity 都代表本次 pax;否则使用资源占用兜底值。
|
|
1394
|
+
var bookingCapacityValue = resourceCapacityValue;
|
|
1394
1395
|
var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
|
|
1395
1396
|
var nextBookings = (payload.bookings || []).map(function (booking, idx) {
|
|
1396
1397
|
return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
|
|
@@ -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
|
-
});
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
329
329
|
count: number;
|
|
330
330
|
left: number;
|
|
331
331
|
summaryCount: number;
|
|
332
|
-
status: "
|
|
332
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
333
333
|
}[];
|
|
334
334
|
/**
|
|
335
335
|
* 找到多个资源的公共可用时间段
|
|
@@ -838,6 +838,9 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
838
838
|
return (payload, { bookingUuid, tempOrder }) => {
|
|
839
839
|
var _a, _b;
|
|
840
840
|
const resourceId = tempOrder.resource_id ?? (resourceState == null ? void 0 : resourceState.relationId);
|
|
841
|
+
const rawCollectPax = (_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax;
|
|
842
|
+
const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
|
|
843
|
+
const resourceCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
|
|
841
844
|
const pickOriginal = (value) => {
|
|
842
845
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
843
846
|
const original = value.original;
|
|
@@ -845,7 +848,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
845
848
|
}
|
|
846
849
|
return void 0;
|
|
847
850
|
};
|
|
848
|
-
const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((
|
|
851
|
+
const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_b = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _b.name) ?? "";
|
|
849
852
|
const resourceEntry = resourceState && resourceId ? {
|
|
850
853
|
relation_type: "form",
|
|
851
854
|
like_status: "common",
|
|
@@ -853,16 +856,14 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
853
856
|
main_field: mainField,
|
|
854
857
|
form_id: resourceState.tableFormId,
|
|
855
858
|
relation_id: resourceState.relationId ?? resourceId,
|
|
856
|
-
capacity:
|
|
859
|
+
capacity: resourceCapacityValue,
|
|
857
860
|
metadata: this.buildScanOrderResourceMetadata({
|
|
858
861
|
resourceState,
|
|
859
862
|
resourceName: mainField
|
|
860
863
|
})
|
|
861
864
|
} : void 0;
|
|
862
865
|
const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
|
|
863
|
-
const
|
|
864
|
-
const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
|
|
865
|
-
const bookingCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
|
|
866
|
+
const bookingCapacityValue = resourceCapacityValue;
|
|
866
867
|
const bookingCapacityDimensionId = (0, import_utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
|
|
867
868
|
const nextBookings = (payload.bookings || []).map((booking, idx) => ({
|
|
868
869
|
...booking,
|