@pisell/pisellos 2.2.293 → 2.2.295
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/itemRule/adapter.d.ts +1 -4
- package/dist/model/strategy/adapter/itemRule/adapter.js +35 -135
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
- package/dist/model/strategy/adapter/itemRule/evaluator.js +1 -25
- package/dist/model/strategy/adapter/itemRule/type.d.ts +0 -44
- package/dist/model/strategy/adapter/itemRule/type.js +1 -19
- package/dist/modules/Order/index.d.ts +3 -18
- package/dist/modules/Order/index.js +485 -885
- package/dist/modules/Order/types.d.ts +5 -91
- package/dist/modules/Order/types.js +0 -5
- package/dist/modules/Order/utils.js +10 -22
- package/dist/modules/ProductList/index.d.ts +1 -2
- package/dist/modules/ProductList/index.js +20 -100
- package/dist/modules/ProductList/types.d.ts +0 -10
- package/dist/server/index.d.ts +0 -6
- package/dist/server/index.js +3 -43
- package/dist/solution/BaseSales/index.d.ts +1 -9
- package/dist/solution/BaseSales/index.js +706 -894
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/orderCustomer.js +2 -3
- package/dist/solution/RegisterAndLogin/config.d.ts +3 -9
- package/dist/solution/RegisterAndLogin/config.js +40 -95
- package/dist/solution/RegisterAndLogin/index.js +1 -4
- package/dist/solution/ScanOrder/index.d.ts +0 -1
- package/dist/solution/ScanOrder/index.js +27 -31
- package/dist/solution/ScanOrder/utils.d.ts +0 -1
- package/dist/solution/ScanOrder/utils.js +0 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +4 -17
- package/dist/solution/UnifiedBookingSales/index.js +489 -755
- package/dist/solution/UnifiedBookingSales/types.d.ts +1 -14
- package/dist/solution/VenueBooking/index.d.ts +0 -1
- package/dist/solution/VenueBooking/index.js +4 -8
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +1 -4
- package/lib/model/strategy/adapter/itemRule/adapter.js +4 -73
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
- package/lib/model/strategy/adapter/itemRule/evaluator.js +1 -23
- package/lib/model/strategy/adapter/itemRule/type.d.ts +0 -44
- package/lib/model/strategy/adapter/itemRule/type.js +1 -19
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Order/index.d.ts +3 -18
- package/lib/modules/Order/index.js +28 -325
- package/lib/modules/Order/types.d.ts +5 -91
- package/lib/modules/Order/types.js +0 -4
- package/lib/modules/Order/utils.js +1 -13
- package/lib/modules/ProductList/index.d.ts +1 -2
- package/lib/modules/ProductList/index.js +2 -47
- package/lib/modules/ProductList/types.d.ts +0 -10
- package/lib/server/index.d.ts +0 -6
- package/lib/server/index.js +3 -37
- package/lib/solution/BaseSales/index.d.ts +1 -9
- package/lib/solution/BaseSales/index.js +1 -105
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/orderCustomer.js +1 -2
- package/lib/solution/RegisterAndLogin/config.d.ts +3 -9
- package/lib/solution/RegisterAndLogin/config.js +8 -49
- package/lib/solution/RegisterAndLogin/index.js +1 -4
- package/lib/solution/ScanOrder/index.d.ts +0 -1
- package/lib/solution/ScanOrder/index.js +1 -5
- package/lib/solution/ScanOrder/utils.d.ts +0 -1
- package/lib/solution/ScanOrder/utils.js +0 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +4 -17
- package/lib/solution/UnifiedBookingSales/index.js +6 -128
- package/lib/solution/UnifiedBookingSales/types.d.ts +1 -14
- package/lib/solution/VenueBooking/index.d.ts +0 -1
- package/lib/solution/VenueBooking/index.js +1 -5
- package/package.json +1 -1
- package/dist/modules/Order/salesNotes.d.ts +0 -31
- package/dist/modules/Order/salesNotes.js +0 -492
- package/lib/modules/Order/salesNotes.d.ts +0 -31
- package/lib/modules/Order/salesNotes.js +0 -382
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
2
|
-
import type { ProductListLoadProductsParams
|
|
3
|
-
import type { ProductData } from '../../modules/Product/types';
|
|
2
|
+
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
4
3
|
import type { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
5
4
|
import type { AvailabilityDateRange, AvailabilityErrorCode, AvailabilityId, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProjection, AvailabilityQuery, AvailabilityRequirementSelection, AvailabilityResource, AvailabilitySelectionValidationResult, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, ResourceAvailabilityGroup, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem } from '../../modules/ResourcePlanner';
|
|
6
5
|
import type { BookingTicketState } from '../BookingTicket/types';
|
|
7
|
-
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
8
|
-
import type { SalesNoteDraftInput } from '../../modules/Order/types';
|
|
9
|
-
export type { ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
10
6
|
export type { AvailabilityAbsoluteRange, AvailabilityAssignment, AvailabilityCell, AvailabilityDateRange, AvailabilityDisplayRange, AvailabilityErrorCode, AvailabilityId, AvailabilityMode, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProductKind, AvailabilityProjection, AvailabilityProjectionInput, AvailabilityProjectionMeta, AvailabilityQuery, AvailabilityQueryResult, AvailabilityRequirementGroup, AvailabilityRequirementGroupResult, AvailabilityRequirementSelection, AvailabilityResource, AvailabilityResourceOption, AvailabilityResourceType, AvailabilityResourceWindow, AvailabilityScheduleMode, AvailabilityScheduleRef, AvailabilityScheduleRule, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, AvailabilitySessionRange, AvailabilityStatus, DateAvailabilityGroup, DateAvailabilityItem, DateAvailabilityQuery, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityGroup, ProductAvailabilityItem, ProductAvailabilityQuery, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, QueryAvailabilityBaseRequest, ResourceAvailabilityGroup, ResourceAvailabilityQuery, ResourceAvailabilityQueryResult, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem, TimeAvailabilityQuery, TimeAvailabilityQueryResult, } from '../../modules/ResourcePlanner';
|
|
11
7
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
12
8
|
}
|
|
@@ -28,12 +24,6 @@ export declare enum UnifiedBookingSalesHooks {
|
|
|
28
24
|
export interface UnifiedBookingSalesOtherParams extends Record<string, any> {
|
|
29
25
|
enableSessionStoragePersist?: boolean;
|
|
30
26
|
}
|
|
31
|
-
export type UnifiedBookingSalesAllergyRequirement = AllergyRequirement;
|
|
32
|
-
export interface UnifiedBookingSalesResolveProductAllergyRequirementParams {
|
|
33
|
-
productId: number | string;
|
|
34
|
-
productVariantId?: number | string;
|
|
35
|
-
channel?: string;
|
|
36
|
-
}
|
|
37
27
|
export interface UnifiedBookingSalesLoadOpenDataParams {
|
|
38
28
|
businessCode: string;
|
|
39
29
|
channel: string;
|
|
@@ -161,8 +151,6 @@ export interface ContextualCommitAvailabilitySelectionParams {
|
|
|
161
151
|
requirementSelections: AvailabilityRequirementSelection[];
|
|
162
152
|
partySize: number;
|
|
163
153
|
bookingCount?: number;
|
|
164
|
-
/** 新增商品行时与商品、预约在同一次 Order mutation 内写入的 Sales Notes。 */
|
|
165
|
-
salesNotes?: SalesNoteDraftInput[];
|
|
166
154
|
/** 编辑预约时,允许本次显式报价覆盖已落库订单行的历史价格。 */
|
|
167
155
|
allowBookingReprice?: boolean;
|
|
168
156
|
/** 编辑预约重报价后,允许订单模块重新应用已选编辑态折扣。 */
|
|
@@ -220,7 +208,6 @@ export interface UnifiedBookingSalesApi {
|
|
|
220
208
|
getOpenData: () => Promise<OpenDataConfig | null>;
|
|
221
209
|
loadScheduleAvailableDate: (params: LoadScheduleAvailableDateParams) => Promise<unknown>;
|
|
222
210
|
loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
|
|
223
|
-
queryProducts: (params?: ProductListStoreQueryParams) => Promise<ProductData[]>;
|
|
224
211
|
stageRetailProducts: (params: UnifiedBookingSalesStageRetailProductsParams) => Promise<Record<string, any> | null>;
|
|
225
212
|
addRetailProduct: (params: UnifiedBookingSalesAddRetailProductParams) => Promise<Record<string, any>[]>;
|
|
226
213
|
prepareAvailabilityProjection: (params: UnifiedBookingSalesPrepareAvailabilityProjectionParams) => Promise<AvailabilityContextRef>;
|
|
@@ -3140,11 +3140,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3140
3140
|
}, {
|
|
3141
3141
|
key: "getItemRuleRuntimeConfig",
|
|
3142
3142
|
value: function getItemRuleRuntimeConfig() {
|
|
3143
|
-
|
|
3144
|
-
var runtimeConfig = this.itemRuleRuntimeConfig || {};
|
|
3145
|
-
return _objectSpread(_objectSpread({}, runtimeConfig), {}, {
|
|
3146
|
-
channel: (_ref6 = (_runtimeConfig$channe = runtimeConfig.channel) !== null && _runtimeConfig$channe !== void 0 ? _runtimeConfig$channe : (_runtimeConfig$custom = runtimeConfig.custom) === null || _runtimeConfig$custom === void 0 ? void 0 : _runtimeConfig$custom.channel) !== null && _ref6 !== void 0 ? _ref6 : (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.channel
|
|
3147
|
-
});
|
|
3143
|
+
return this.itemRuleRuntimeConfig || {};
|
|
3148
3144
|
}
|
|
3149
3145
|
}, {
|
|
3150
3146
|
key: "ensureItemRuleConfigsLoaded",
|
|
@@ -3810,14 +3806,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3810
3806
|
key: "setOtherParams",
|
|
3811
3807
|
value: function () {
|
|
3812
3808
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
3813
|
-
var
|
|
3814
|
-
|
|
3809
|
+
var _ref7,
|
|
3810
|
+
_ref7$cover,
|
|
3815
3811
|
cover,
|
|
3816
3812
|
_args46 = arguments;
|
|
3817
3813
|
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3818
3814
|
while (1) switch (_context46.prev = _context46.next) {
|
|
3819
3815
|
case 0:
|
|
3820
|
-
|
|
3816
|
+
_ref7 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
|
|
3821
3817
|
if (cover) {
|
|
3822
3818
|
this.otherParams = params;
|
|
3823
3819
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EvaluationResult, RuntimeContext, ActionEffect } from '../../type';
|
|
2
2
|
import type { BusinessAdapter } from '../type';
|
|
3
|
-
import { type ItemRuleBusinessData, type QuantityCheckResult, type PrefillItemResult, type QuantityLimitResult
|
|
3
|
+
import { type ItemRuleBusinessData, type QuantityCheckResult, type PrefillItemResult, type QuantityLimitResult } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* ItemRule 适配器
|
|
6
6
|
*
|
|
@@ -14,10 +14,7 @@ export declare class ItemRuleAdapter implements BusinessAdapter {
|
|
|
14
14
|
transformResult(result: EvaluationResult, businessData?: ItemRuleBusinessData): {
|
|
15
15
|
quantityChecks: QuantityCheckResult[];
|
|
16
16
|
prefillItems: PrefillItemResult[];
|
|
17
|
-
allergyRequirements: AllergyRequirement[];
|
|
18
17
|
};
|
|
19
|
-
private processAllergyCheck;
|
|
20
|
-
private normalizeAllergyDataSourceItems;
|
|
21
18
|
formatConfig(result: EvaluationResult, businessData?: ItemRuleBusinessData): {
|
|
22
19
|
result: EvaluationResult;
|
|
23
20
|
businessData?: ItemRuleBusinessData;
|
|
@@ -19,17 +19,14 @@ class ItemRuleAdapter {
|
|
|
19
19
|
pax,
|
|
20
20
|
cartItems,
|
|
21
21
|
serviceType,
|
|
22
|
-
channel,
|
|
23
22
|
submissionIndex,
|
|
24
23
|
custom
|
|
25
24
|
} = businessData;
|
|
26
|
-
const resolvedChannel = String(channel ?? custom?.channel ?? '').trim();
|
|
27
25
|
return {
|
|
28
26
|
entities: {
|
|
29
27
|
cartItems,
|
|
30
28
|
historicalItems: businessData.historicalItems || [],
|
|
31
|
-
pax
|
|
32
|
-
currentProduct: businessData.currentProduct
|
|
29
|
+
pax
|
|
33
30
|
},
|
|
34
31
|
attributes: {
|
|
35
32
|
serviceType: serviceType || '',
|
|
@@ -39,8 +36,7 @@ class ItemRuleAdapter {
|
|
|
39
36
|
submissionIndex: submissionIndex ?? 0,
|
|
40
37
|
cartItemCount: cartItems.length,
|
|
41
38
|
cartTotalQuantity: cartItems.reduce((sum, item) => sum + item.quantity, 0),
|
|
42
|
-
...custom
|
|
43
|
-
channel: resolvedChannel
|
|
39
|
+
...custom
|
|
44
40
|
},
|
|
45
41
|
metadata: {
|
|
46
42
|
timestamp: Date.now()
|
|
@@ -50,12 +46,10 @@ class ItemRuleAdapter {
|
|
|
50
46
|
transformResult(result, businessData) {
|
|
51
47
|
const quantityChecks = [];
|
|
52
48
|
const prefillItems = [];
|
|
53
|
-
const allergyRequirements = [];
|
|
54
49
|
if (!result.applicable || !businessData) {
|
|
55
50
|
return {
|
|
56
51
|
quantityChecks,
|
|
57
|
-
prefillItems
|
|
58
|
-
allergyRequirements
|
|
52
|
+
prefillItems
|
|
59
53
|
};
|
|
60
54
|
}
|
|
61
55
|
for (const action of result.matchedActions) {
|
|
@@ -67,76 +61,13 @@ class ItemRuleAdapter {
|
|
|
67
61
|
} else if (action.type === _type.ITEM_RULE_ACTION_TYPES.PREFILL_CART) {
|
|
68
62
|
const items = this.processPrefillCart(action, businessData);
|
|
69
63
|
prefillItems.push(...items);
|
|
70
|
-
} else if (action.type === _type.ITEM_RULE_ACTION_TYPES.ALLERGY_CHECK) {
|
|
71
|
-
const requirement = this.processAllergyCheck(action, result, businessData);
|
|
72
|
-
if (requirement) allergyRequirements.push(requirement);
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
66
|
return {
|
|
76
67
|
quantityChecks,
|
|
77
|
-
prefillItems
|
|
78
|
-
allergyRequirements
|
|
68
|
+
prefillItems
|
|
79
69
|
};
|
|
80
70
|
}
|
|
81
|
-
|
|
82
|
-
// ============================================
|
|
83
|
-
// Allergy Check 处理
|
|
84
|
-
// ============================================
|
|
85
|
-
|
|
86
|
-
processAllergyCheck(action, result, businessData) {
|
|
87
|
-
const config = action.config;
|
|
88
|
-
const currentProduct = businessData.currentProduct;
|
|
89
|
-
if (!config || config.targetType !== 'product' || config.promptScope !== 'once_per_order_product' || !Array.isArray(config.targets) || !currentProduct) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
const currentProductId = Number(currentProduct.product_id);
|
|
93
|
-
const currentVariantId = Number(currentProduct.product_variant_id ?? 0);
|
|
94
|
-
if (!Number.isFinite(currentProductId) || currentProductId <= 0) return null;
|
|
95
|
-
const productTargets = config.targets.filter(item => Number(item.product_id) === currentProductId);
|
|
96
|
-
const target = productTargets.find(item => currentVariantId > 0 && Number(item.product_variant_id ?? 0) === currentVariantId) ?? productTargets.find(item => Number(item.product_variant_id ?? 0) <= 0);
|
|
97
|
-
if (!target || target.dataSource?.type !== 'inline') return null;
|
|
98
|
-
const items = this.normalizeAllergyDataSourceItems(target.dataSource.items);
|
|
99
|
-
if (!items.length) return null;
|
|
100
|
-
return {
|
|
101
|
-
strategyId: result.config.metadata.id,
|
|
102
|
-
ruleId: action.id,
|
|
103
|
-
priority: action.priority ?? 0,
|
|
104
|
-
targetType: 'product',
|
|
105
|
-
product_id: currentProductId,
|
|
106
|
-
...(Number(target.product_variant_id ?? 0) > 0 ? {
|
|
107
|
-
product_variant_id: Number(target.product_variant_id)
|
|
108
|
-
} : {}),
|
|
109
|
-
dataSource: {
|
|
110
|
-
type: 'inline',
|
|
111
|
-
items
|
|
112
|
-
},
|
|
113
|
-
promptScope: config.promptScope,
|
|
114
|
-
allowNote: config.allowNote === true
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
normalizeAllergyDataSourceItems(items) {
|
|
118
|
-
if (!Array.isArray(items)) return [];
|
|
119
|
-
const uniqueIds = new Set();
|
|
120
|
-
const normalized = [];
|
|
121
|
-
for (const item of items) {
|
|
122
|
-
const id = String(item?.id ?? '').trim();
|
|
123
|
-
const rawLabel = item?.label;
|
|
124
|
-
const label = typeof rawLabel === 'string' ? rawLabel.trim() : Object.entries(rawLabel || {}).reduce((labels, [locale, value]) => {
|
|
125
|
-
if (typeof value === 'string' && value.trim().length > 0) {
|
|
126
|
-
labels[locale] = value.trim();
|
|
127
|
-
}
|
|
128
|
-
return labels;
|
|
129
|
-
}, {});
|
|
130
|
-
const hasLabel = typeof label === 'string' ? label.length > 0 : Object.keys(label).length > 0;
|
|
131
|
-
if (!id || !hasLabel || uniqueIds.has(id)) continue;
|
|
132
|
-
uniqueIds.add(id);
|
|
133
|
-
normalized.push({
|
|
134
|
-
id,
|
|
135
|
-
label
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return normalized;
|
|
139
|
-
}
|
|
140
71
|
formatConfig(result, businessData) {
|
|
141
72
|
return {
|
|
142
73
|
result,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StrategyConfig } from '../../type';
|
|
2
|
-
import { type ItemRuleBusinessData, type ItemRuleEvaluationResult, type QuantityCheckResult, type QuantityLimitResult, type PrefillItemResult
|
|
2
|
+
import { type ItemRuleBusinessData, type ItemRuleEvaluationResult, type QuantityCheckResult, type QuantityLimitResult, type PrefillItemResult } from './type';
|
|
3
3
|
/**
|
|
4
4
|
* ItemRule 评估器
|
|
5
5
|
*
|
|
@@ -21,13 +21,6 @@ export declare class ItemRuleEvaluator {
|
|
|
21
21
|
* 完整评估:数量校验 + 预填购物车
|
|
22
22
|
*/
|
|
23
23
|
evaluate(businessData: ItemRuleBusinessData): ItemRuleEvaluationResult;
|
|
24
|
-
/**
|
|
25
|
-
* 获取当前商品优先级最高的过敏门禁要求。
|
|
26
|
-
*
|
|
27
|
-
* 不同商品或不同 Action 的数据源不会合并;相同优先级按
|
|
28
|
-
* strategyId + ruleId 稳定排序,保证多次评估结果一致。
|
|
29
|
-
*/
|
|
30
|
-
getAllergyRequirement(businessData: ItemRuleBusinessData): AllergyRequirement | null;
|
|
31
24
|
/**
|
|
32
25
|
* 获取当前配置中各商品的数量限制
|
|
33
26
|
*
|
|
@@ -43,7 +43,6 @@ class ItemRuleEvaluator {
|
|
|
43
43
|
const configs = businessData.strategyConfigs ? businessData.strategyConfigs.filter(c => c.metadata.type === 'item_rule') : this.strategyConfigs;
|
|
44
44
|
const allQuantityChecks = [];
|
|
45
45
|
const allPrefillItems = [];
|
|
46
|
-
const allAllergyRequirements = [];
|
|
47
46
|
const rawResults = [];
|
|
48
47
|
const context = this.adapter.prepareContext(businessData);
|
|
49
48
|
for (const config of configs) {
|
|
@@ -51,42 +50,21 @@ class ItemRuleEvaluator {
|
|
|
51
50
|
rawResults.push(evalResult);
|
|
52
51
|
const {
|
|
53
52
|
quantityChecks,
|
|
54
|
-
prefillItems
|
|
55
|
-
allergyRequirements
|
|
53
|
+
prefillItems
|
|
56
54
|
} = this.adapter.transformResult(evalResult, businessData);
|
|
57
55
|
allQuantityChecks.push(...quantityChecks);
|
|
58
56
|
allPrefillItems.push(...prefillItems);
|
|
59
|
-
allAllergyRequirements.push(...allergyRequirements);
|
|
60
57
|
}
|
|
61
58
|
const failedChecks = allQuantityChecks.filter(c => !c.passed);
|
|
62
59
|
return {
|
|
63
60
|
quantityChecks: allQuantityChecks,
|
|
64
61
|
prefillItems: allPrefillItems,
|
|
65
|
-
allergyRequirements: allAllergyRequirements,
|
|
66
62
|
allPassed: failedChecks.length === 0,
|
|
67
63
|
failedChecks,
|
|
68
64
|
rawResults
|
|
69
65
|
};
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
/**
|
|
73
|
-
* 获取当前商品优先级最高的过敏门禁要求。
|
|
74
|
-
*
|
|
75
|
-
* 不同商品或不同 Action 的数据源不会合并;相同优先级按
|
|
76
|
-
* strategyId + ruleId 稳定排序,保证多次评估结果一致。
|
|
77
|
-
*/
|
|
78
|
-
getAllergyRequirement(businessData) {
|
|
79
|
-
const requirements = this.evaluate(businessData).allergyRequirements;
|
|
80
|
-
if (!requirements.length) return null;
|
|
81
|
-
return [...requirements].sort((left, right) => {
|
|
82
|
-
const priorityDiff = right.priority - left.priority;
|
|
83
|
-
if (priorityDiff !== 0) return priorityDiff;
|
|
84
|
-
const strategyDiff = left.strategyId.localeCompare(right.strategyId);
|
|
85
|
-
if (strategyDiff !== 0) return strategyDiff;
|
|
86
|
-
return left.ruleId.localeCompare(right.ruleId);
|
|
87
|
-
})[0];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
68
|
/**
|
|
91
69
|
* 获取当前配置中各商品的数量限制
|
|
92
70
|
*
|
|
@@ -4,8 +4,6 @@ export declare const ITEM_RULE_ACTION_TYPES: {
|
|
|
4
4
|
readonly QUANTITY_CHECK: "QUANTITY_CHECK";
|
|
5
5
|
/** 预填购物车 */
|
|
6
6
|
readonly PREFILL_CART: "PREFILL_CART";
|
|
7
|
-
/** 加购前过敏信息确认 */
|
|
8
|
-
readonly ALLERGY_CHECK: "ALLERGY_CHECK";
|
|
9
7
|
};
|
|
10
8
|
export type ItemRuleActionType = (typeof ITEM_RULE_ACTION_TYPES)[keyof typeof ITEM_RULE_ACTION_TYPES];
|
|
11
9
|
export declare const ITEM_RULE_TEMPLATES: {
|
|
@@ -65,42 +63,6 @@ export interface TargetItem {
|
|
|
65
63
|
/** 变体 ID */
|
|
66
64
|
product_variant_id?: number;
|
|
67
65
|
}
|
|
68
|
-
/** 策略展示文案,可由调用方按当前 locale 解析。 */
|
|
69
|
-
export type ItemRuleLocalizedText = string | Record<string, string>;
|
|
70
|
-
/** 内联过敏源选项。稳定 id 用于保存选择,label 只负责展示。 */
|
|
71
|
-
export interface AllergyDataSourceItem {
|
|
72
|
-
id: string;
|
|
73
|
-
label: ItemRuleLocalizedText;
|
|
74
|
-
}
|
|
75
|
-
/** 当前仅支持随策略下发的内联过敏源。 */
|
|
76
|
-
export interface AllergyDataSource {
|
|
77
|
-
type: 'inline';
|
|
78
|
-
items: AllergyDataSourceItem[];
|
|
79
|
-
}
|
|
80
|
-
/** 每个目标商品独立持有自己的过敏源,禁止跨商品合并。 */
|
|
81
|
-
export interface AllergyTargetItem extends TargetItem {
|
|
82
|
-
dataSource: AllergyDataSource;
|
|
83
|
-
}
|
|
84
|
-
export type AllergyPromptScope = 'once_per_order_product';
|
|
85
|
-
/** ALLERGY_CHECK Action 的商品级配置。 */
|
|
86
|
-
export interface AllergyCheckConfig {
|
|
87
|
-
targetType: 'product';
|
|
88
|
-
targets: AllergyTargetItem[];
|
|
89
|
-
promptScope: AllergyPromptScope;
|
|
90
|
-
allowNote?: boolean;
|
|
91
|
-
}
|
|
92
|
-
/** 当前商品命中的单条过敏门禁要求。 */
|
|
93
|
-
export interface AllergyRequirement {
|
|
94
|
-
strategyId: string;
|
|
95
|
-
ruleId: string;
|
|
96
|
-
priority: number;
|
|
97
|
-
targetType: 'product';
|
|
98
|
-
product_id: number;
|
|
99
|
-
product_variant_id?: number;
|
|
100
|
-
dataSource: AllergyDataSource;
|
|
101
|
-
promptScope: AllergyPromptScope;
|
|
102
|
-
allowNote: boolean;
|
|
103
|
-
}
|
|
104
66
|
/**
|
|
105
67
|
* 预填商品项
|
|
106
68
|
*/
|
|
@@ -157,10 +119,6 @@ export interface ItemRuleBusinessData {
|
|
|
157
119
|
historicalItems?: CartItemSummary[];
|
|
158
120
|
/** 服务类型(如 'dine-in', 'takeaway') */
|
|
159
121
|
serviceType?: string;
|
|
160
|
-
/** 当前业务渠道(如 'kiosk', 'pos', 'online_store') */
|
|
161
|
-
channel?: string;
|
|
162
|
-
/** 当前正在加入购物车的商品;ALLERGY_CHECK 只读取该商品的 Target。 */
|
|
163
|
-
currentProduct?: Pick<TargetItem, 'product_id' | 'product_variant_id'>;
|
|
164
122
|
/** 当前提交次数(0=首次提交, >0=追加提交) */
|
|
165
123
|
submissionIndex?: number;
|
|
166
124
|
/** 策略配置列表(可选,如果不传则使用 setStrategyConfigs 设置的) */
|
|
@@ -258,8 +216,6 @@ export interface ItemRuleEvaluationResult {
|
|
|
258
216
|
quantityChecks: QuantityCheckResult[];
|
|
259
217
|
/** 需要预填的商品列表 */
|
|
260
218
|
prefillItems: PrefillItemResult[];
|
|
261
|
-
/** 当前商品命中的过敏门禁要求;不同 Action/商品不会合并。 */
|
|
262
|
-
allergyRequirements: AllergyRequirement[];
|
|
263
219
|
/** 所有校验是否全部通过 */
|
|
264
220
|
allPassed: boolean;
|
|
265
221
|
/** 未通过的校验列表 */
|
|
@@ -12,9 +12,7 @@ const ITEM_RULE_ACTION_TYPES = exports.ITEM_RULE_ACTION_TYPES = {
|
|
|
12
12
|
/** 数量校验 */
|
|
13
13
|
QUANTITY_CHECK: 'QUANTITY_CHECK',
|
|
14
14
|
/** 预填购物车 */
|
|
15
|
-
PREFILL_CART: 'PREFILL_CART'
|
|
16
|
-
/** 加购前过敏信息确认 */
|
|
17
|
-
ALLERGY_CHECK: 'ALLERGY_CHECK'
|
|
15
|
+
PREFILL_CART: 'PREFILL_CART'
|
|
18
16
|
};
|
|
19
17
|
// ============================================
|
|
20
18
|
// Rule Template 类型(创建规则时的起始模板)
|
|
@@ -58,22 +56,6 @@ const ITEM_RULE_TEMPLATES = exports.ITEM_RULE_TEMPLATES = {
|
|
|
58
56
|
|
|
59
57
|
/** 目标项 */
|
|
60
58
|
|
|
61
|
-
// ============================================
|
|
62
|
-
// Allergy Check 相关类型
|
|
63
|
-
// ============================================
|
|
64
|
-
|
|
65
|
-
/** 策略展示文案,可由调用方按当前 locale 解析。 */
|
|
66
|
-
|
|
67
|
-
/** 内联过敏源选项。稳定 id 用于保存选择,label 只负责展示。 */
|
|
68
|
-
|
|
69
|
-
/** 当前仅支持随策略下发的内联过敏源。 */
|
|
70
|
-
|
|
71
|
-
/** 每个目标商品独立持有自己的过敏源,禁止跨商品合并。 */
|
|
72
|
-
|
|
73
|
-
/** ALLERGY_CHECK Action 的商品级配置。 */
|
|
74
|
-
|
|
75
|
-
/** 当前商品命中的单条过敏门禁要求。 */
|
|
76
|
-
|
|
77
59
|
// ============================================
|
|
78
60
|
// Prefill Cart 相关类型
|
|
79
61
|
// ============================================
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _adapter.PromotionAdapter;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _evaluator.PromotionEvaluator;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "default", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _adapter.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _evaluator = require("./evaluator");
|
|
43
|
+
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
+
var _examples = require("./examples");
|
|
45
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -301,24 +301,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
301
301
|
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
302
302
|
syncTempOrderNoteToRemote(orderId: number | string, note: string): Promise<string>;
|
|
303
303
|
getTempOrderNote(): string;
|
|
304
|
-
private ensureSalesNotesRuntimeState;
|
|
305
|
-
private ensureSalesNotesLoadedForMutation;
|
|
306
|
-
private normalizeSalesNoteUuid;
|
|
307
|
-
private getSalesNotePrimaryRelation;
|
|
308
|
-
private removeSalesNotesForMissingProductLines;
|
|
309
|
-
private setSalesNoteOnTempOrder;
|
|
310
|
-
getSalesNotes(): SalesNote[];
|
|
311
|
-
createSalesNotesMutationSnapshot(): SalesNotesMutationSnapshot;
|
|
312
|
-
restoreSalesNotesMutationSnapshot(snapshot: SalesNotesMutationSnapshot): void;
|
|
313
|
-
setSalesNote(input: SetSalesNoteInput): Promise<SalesNote>;
|
|
314
|
-
removeSalesNote(uuid: string): Promise<void>;
|
|
315
|
-
clearSalesNotes(): Promise<void>;
|
|
316
304
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
317
305
|
updateTempOrderDepositAmount(amount: string | number): OrderSummary;
|
|
318
306
|
updateTempOrderBuzzer(buzzer: string): string;
|
|
319
|
-
private updateTempOrderShopServiceData;
|
|
320
|
-
updateTempOrderPickupReferenceMode(mode: PickupReferenceMode): ShopServiceData;
|
|
321
|
-
updateTempOrderServiceType(serviceType: ShopServiceType): ShopServiceData;
|
|
322
307
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
323
308
|
private buildTempOrderCustomer;
|
|
324
309
|
private isCustomerBoundDiscount;
|
|
@@ -469,7 +454,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
469
454
|
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
470
455
|
/**
|
|
471
456
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
472
|
-
*
|
|
457
|
+
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
473
458
|
*/
|
|
474
459
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
475
460
|
buildCurrentSubmitPayloadForLocalPrint(params?: {
|
|
@@ -606,4 +591,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
606
591
|
getOrderInfo(order_id: number): Promise<any>;
|
|
607
592
|
getVouchers(): any[];
|
|
608
593
|
}
|
|
609
|
-
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions,
|
|
594
|
+
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|