@pisell/pisellos 0.0.502 → 0.0.503
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 +0 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +11 -10
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +11 -14
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
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";
|
|
@@ -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 | 1 |
|
|
314
|
+
weekNum: 0 | 1 | 4 | 3 | 2 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -62,7 +62,7 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
62
62
|
restoreOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
63
63
|
getOrderProducts(): ScanOrderOrderProduct[];
|
|
64
64
|
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
65
|
-
private
|
|
65
|
+
private buildSubmitPayloadEnhancer;
|
|
66
66
|
submitScanOrder<T = any>(): Promise<T>;
|
|
67
67
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
68
68
|
updateProductInOrder(params: {
|
|
@@ -750,16 +750,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
750
750
|
return _getSummary.apply(this, arguments);
|
|
751
751
|
}
|
|
752
752
|
return getSummary;
|
|
753
|
-
}() //
|
|
754
|
-
// -
|
|
753
|
+
}() // ScanOrder 提交 payload enhancer:
|
|
754
|
+
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
755
|
+
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
755
756
|
// - 追加一条 is_rule=true 的 rule product,与 booking 互相关联
|
|
756
|
-
// 无 rule product 也无 resource 时返回 undefined,跳过增强
|
|
757
757
|
}, {
|
|
758
|
-
key: "
|
|
759
|
-
value: function
|
|
758
|
+
key: "buildSubmitPayloadEnhancer",
|
|
759
|
+
value: function buildSubmitPayloadEnhancer() {
|
|
760
760
|
var ruleProduct = this.enabledReservationRuleProducts[0];
|
|
761
761
|
var resourceState = this.store.resource;
|
|
762
|
-
if (!ruleProduct && !resourceState) return undefined;
|
|
763
762
|
return function (payload, _ref) {
|
|
764
763
|
var _tempOrder$resource_i, _ref2, _pickOriginal, _resourceState$table_, _resourceState$relati;
|
|
765
764
|
var bookingUuid = _ref.bookingUuid,
|
|
@@ -785,11 +784,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
785
784
|
} : undefined;
|
|
786
785
|
var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
|
|
787
786
|
var nextBookings = (payload.bookings || []).map(function (booking, idx) {
|
|
788
|
-
return
|
|
787
|
+
return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
|
|
788
|
+
appointment_status: 'started'
|
|
789
|
+
}, idx === 0 && resourceEntry ? {
|
|
789
790
|
resources: [resourceEntry]
|
|
790
|
-
} : {}), ruleProductUid ? {
|
|
791
|
+
} : {}), idx === 0 && ruleProductUid ? {
|
|
791
792
|
product_uid: ruleProductUid
|
|
792
|
-
} : {})
|
|
793
|
+
} : {});
|
|
793
794
|
});
|
|
794
795
|
var nextProducts = _toConsumableArray(payload.products || []);
|
|
795
796
|
if (ruleProduct && ruleProductUid) {
|
|
@@ -854,7 +855,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
854
855
|
delete tempOrderForSubmit.table_number;
|
|
855
856
|
}
|
|
856
857
|
this.store.order.persistTempOrder();
|
|
857
|
-
enhancePayload = this.
|
|
858
|
+
enhancePayload = this.buildSubmitPayloadEnhancer();
|
|
858
859
|
_context10.next = 17;
|
|
859
860
|
return this.store.order.submitTempOrder({
|
|
860
861
|
cacheId: this.cacheId,
|
|
@@ -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 | 1 |
|
|
314
|
+
weekNum: 0 | 1 | 4 | 3 | 2 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -62,7 +62,7 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
62
62
|
restoreOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
63
63
|
getOrderProducts(): ScanOrderOrderProduct[];
|
|
64
64
|
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
65
|
-
private
|
|
65
|
+
private buildSubmitPayloadEnhancer;
|
|
66
66
|
submitScanOrder<T = any>(): Promise<T>;
|
|
67
67
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
68
68
|
updateProductInOrder(params: {
|
|
@@ -494,15 +494,13 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
494
494
|
throw error;
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
//
|
|
498
|
-
// -
|
|
497
|
+
// ScanOrder 提交 payload enhancer:
|
|
498
|
+
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
499
|
+
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
499
500
|
// - 追加一条 is_rule=true 的 rule product,与 booking 互相关联
|
|
500
|
-
|
|
501
|
-
buildReservationRuleEnhancer() {
|
|
501
|
+
buildSubmitPayloadEnhancer() {
|
|
502
502
|
const ruleProduct = this.enabledReservationRuleProducts[0];
|
|
503
503
|
const resourceState = this.store.resource;
|
|
504
|
-
if (!ruleProduct && !resourceState)
|
|
505
|
-
return void 0;
|
|
506
504
|
return (payload, { bookingUuid, tempOrder }) => {
|
|
507
505
|
var _a;
|
|
508
506
|
const resourceId = tempOrder.resource_id ?? (resourceState == null ? void 0 : resourceState.relationId);
|
|
@@ -525,13 +523,12 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
525
523
|
metadata: {}
|
|
526
524
|
} : void 0;
|
|
527
525
|
const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
|
|
528
|
-
const nextBookings = (payload.bookings || []).map(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
);
|
|
526
|
+
const nextBookings = (payload.bookings || []).map((booking, idx) => ({
|
|
527
|
+
...booking,
|
|
528
|
+
appointment_status: "started",
|
|
529
|
+
...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
|
|
530
|
+
...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
|
|
531
|
+
}));
|
|
535
532
|
const nextProducts = [...payload.products || []];
|
|
536
533
|
if (ruleProduct && ruleProductUid) {
|
|
537
534
|
const sellingPrice = String(ruleProduct.price ?? "0.00");
|
|
@@ -580,7 +577,7 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
580
577
|
delete tempOrderForSubmit.table_number;
|
|
581
578
|
}
|
|
582
579
|
this.store.order.persistTempOrder();
|
|
583
|
-
const enhancePayload = this.
|
|
580
|
+
const enhancePayload = this.buildSubmitPayloadEnhancer();
|
|
584
581
|
const result = await this.store.order.submitTempOrder({
|
|
585
582
|
cacheId: this.cacheId,
|
|
586
583
|
platform: (_c = this.otherParams) == null ? void 0 : _c.platform,
|