@pisell/pisellos 0.10.7 → 0.10.9
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/core/index.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +32 -6
- package/dist/modules/Order/index.js +1165 -819
- package/dist/modules/Order/types.d.ts +32 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +28 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +894 -781
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +41 -7
- package/dist/solution/BaseSales/index.js +1405 -974
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -162
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +32 -6
- package/lib/modules/Order/index.js +518 -148
- package/lib/modules/Order/types.d.ts +32 -4
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +30 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +105 -14
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +41 -7
- package/lib/solution/BaseSales/index.js +325 -39
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +31 -6
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
3
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -7,6 +6,7 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
7
6
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
7
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
8
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -24,7 +24,7 @@ import { DataVariantAdapter } from "./adapter";
|
|
|
24
24
|
/**
|
|
25
25
|
* Data Variant 评估器。
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* OS Server 商品路由开启时由 ProductsModule 调用;路由关闭时由 ProductList 在远端响应后调用。
|
|
28
28
|
*/
|
|
29
29
|
export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
30
30
|
function DataVariantEvaluator() {
|
|
@@ -51,7 +51,7 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
51
51
|
/**
|
|
52
52
|
* 批量解析商品 Data Variant。
|
|
53
53
|
*
|
|
54
|
-
*
|
|
54
|
+
* 优先使用商品 metadata.data_variant_ids;缺少权威命中结果时才执行本地策略判断。
|
|
55
55
|
*/
|
|
56
56
|
}, {
|
|
57
57
|
key: "resolveProducts",
|
|
@@ -60,9 +60,17 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
60
60
|
var strategyConfigs = businessData.strategyConfigs ? this.normalizeStrategyConfigs(businessData.strategyConfigs) : this.strategyConfigs;
|
|
61
61
|
var menuScopeMap = this.buildMenuScopeMap(businessData.menuList || []);
|
|
62
62
|
var scheduleTimePoints = this.buildScheduleTimePoints(strategyConfigs, businessData.scheduleList || []);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
// metadata.data_variant_ids 存在时,接口已经完成规则计算;只有仍有商品缺少
|
|
64
|
+
// 该权威结果时才初始化本地策略引擎,避免 OS/接口与客户端重复评估。
|
|
65
|
+
var shouldEvaluateStrategies = businessData.products.some(function (product) {
|
|
66
|
+
return _this.requiresLocalStrategyEvaluation(product);
|
|
67
|
+
});
|
|
68
|
+
var _ref = shouldEvaluateStrategies ? this.buildGlobalEffectiveRuleMap(strategyConfigs, businessData, menuScopeMap) : {
|
|
69
|
+
globalEffectiveRuleMap: new Map(),
|
|
70
|
+
rawResults: []
|
|
71
|
+
},
|
|
72
|
+
globalEffectiveRuleMap = _ref.globalEffectiveRuleMap,
|
|
73
|
+
rawResults = _ref.rawResults;
|
|
66
74
|
var products = businessData.products.map(function (product) {
|
|
67
75
|
var resolvedProduct = _this.resolveProduct(product, businessData, globalEffectiveRuleMap, menuScopeMap);
|
|
68
76
|
// 套餐子商品也可能携带 data_variants,需在同一策略上下文内继续评估并写回 bundle_item。
|
|
@@ -180,6 +188,69 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
180
188
|
});
|
|
181
189
|
return this.extractTimePointsFromSchedules(matchedSchedules);
|
|
182
190
|
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 判断商品(含套餐子商品)是否仍需要本地执行策略条件。
|
|
194
|
+
* metadata.data_variant_ids 只要是数组,即使为空,也表示接口已经给出权威命中结果。
|
|
195
|
+
*/
|
|
196
|
+
}, {
|
|
197
|
+
key: "requiresLocalStrategyEvaluation",
|
|
198
|
+
value: function requiresLocalStrategyEvaluation(product) {
|
|
199
|
+
var _this2 = this;
|
|
200
|
+
var dataVariants = this.getProductDataVariants(product);
|
|
201
|
+
var hasConditionalVariant = dataVariants.some(function (variant) {
|
|
202
|
+
return Number(variant.data_variant_rule_id) !== 0;
|
|
203
|
+
});
|
|
204
|
+
if (hasConditionalVariant && this.getAuthoritativeVariantPriorities(product) === null) {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
var bundleGroups = Array.isArray(product.bundle_group) ? product.bundle_group : [];
|
|
208
|
+
return bundleGroups.some(function (group) {
|
|
209
|
+
var bundleItems = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : [];
|
|
210
|
+
return bundleItems.some(function (item) {
|
|
211
|
+
return _this2.requiresLocalStrategyEvaluation(_this2.toBundleItemDataVariantProduct(item));
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* 将接口返回的高 -> 低优先级 Variant ID 转成数值优先级。
|
|
218
|
+
* 返回 null 表示接口没有提供该字段;空 Map 表示已计算但没有任何命中。
|
|
219
|
+
*/
|
|
220
|
+
}, {
|
|
221
|
+
key: "getAuthoritativeVariantPriorities",
|
|
222
|
+
value: function getAuthoritativeVariantPriorities(product) {
|
|
223
|
+
var _product$metadata;
|
|
224
|
+
var rawIds = product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.data_variant_ids;
|
|
225
|
+
if (!Array.isArray(rawIds)) return null;
|
|
226
|
+
var orderedIds = [];
|
|
227
|
+
var seen = new Set();
|
|
228
|
+
var _iterator4 = _createForOfIteratorHelper(rawIds),
|
|
229
|
+
_step4;
|
|
230
|
+
try {
|
|
231
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
232
|
+
var rawId = _step4.value;
|
|
233
|
+
var id = this.normalizeDataVariantId(rawId);
|
|
234
|
+
if (id === null || seen.has(id)) continue;
|
|
235
|
+
seen.add(id);
|
|
236
|
+
orderedIds.push(id);
|
|
237
|
+
}
|
|
238
|
+
} catch (err) {
|
|
239
|
+
_iterator4.e(err);
|
|
240
|
+
} finally {
|
|
241
|
+
_iterator4.f();
|
|
242
|
+
}
|
|
243
|
+
return new Map(orderedIds.map(function (id, index) {
|
|
244
|
+
return [id, orderedIds.length - index];
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "normalizeDataVariantId",
|
|
249
|
+
value: function normalizeDataVariantId(value) {
|
|
250
|
+
if (value === undefined || value === null) return null;
|
|
251
|
+
var normalized = String(value).trim();
|
|
252
|
+
return normalized || null;
|
|
253
|
+
}
|
|
183
254
|
}, {
|
|
184
255
|
key: "buildGlobalEffectiveRuleMap",
|
|
185
256
|
value: function buildGlobalEffectiveRuleMap(strategyConfigs, businessData, menuScopeMap) {
|
|
@@ -187,11 +258,11 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
187
258
|
var rawResults = [];
|
|
188
259
|
var engine = this.createEngine(businessData, menuScopeMap);
|
|
189
260
|
var context = this.adapter.prepareGlobalContext(businessData);
|
|
190
|
-
var
|
|
191
|
-
|
|
261
|
+
var _iterator5 = _createForOfIteratorHelper(strategyConfigs),
|
|
262
|
+
_step5;
|
|
192
263
|
try {
|
|
193
|
-
for (
|
|
194
|
-
var config =
|
|
264
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
265
|
+
var config = _step5.value;
|
|
195
266
|
if (!this.isStrategyActive(config)) continue;
|
|
196
267
|
var _this$splitStrategyCo = this.splitStrategyConfig(config),
|
|
197
268
|
globalConfig = _this$splitStrategyCo.globalConfig,
|
|
@@ -208,9 +279,9 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
208
279
|
});
|
|
209
280
|
}
|
|
210
281
|
} catch (err) {
|
|
211
|
-
|
|
282
|
+
_iterator5.e(err);
|
|
212
283
|
} finally {
|
|
213
|
-
|
|
284
|
+
_iterator5.f();
|
|
214
285
|
}
|
|
215
286
|
return {
|
|
216
287
|
globalEffectiveRuleMap: globalEffectiveRuleMap,
|
|
@@ -223,11 +294,28 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
223
294
|
var dataVariants = this.getProductDataVariants(product);
|
|
224
295
|
if (!dataVariants.length) return product;
|
|
225
296
|
var matchedVariants = [];
|
|
226
|
-
var
|
|
227
|
-
|
|
297
|
+
var authoritativeVariantPriorities = this.getAuthoritativeVariantPriorities(product);
|
|
298
|
+
var settlementVariants = dataVariants.filter(function (variant) {
|
|
299
|
+
return variant.business_type === 'multi_currency_settlement' && variant.status === 'enable';
|
|
300
|
+
});
|
|
301
|
+
var _iterator6 = _createForOfIteratorHelper(dataVariants),
|
|
302
|
+
_step6;
|
|
228
303
|
try {
|
|
229
|
-
for (
|
|
230
|
-
var variant =
|
|
304
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
305
|
+
var variant = _step6.value;
|
|
306
|
+
if (variant.business_type === 'multi_currency_settlement') continue;
|
|
307
|
+
if (authoritativeVariantPriorities !== null) {
|
|
308
|
+
var variantId = this.normalizeDataVariantId(variant.id);
|
|
309
|
+
var priority = variantId === null ? undefined : authoritativeVariantPriorities.get(variantId);
|
|
310
|
+
if (priority === undefined) continue;
|
|
311
|
+
matchedVariants.push({
|
|
312
|
+
ruleId: String(variant.data_variant_rule_id),
|
|
313
|
+
priority: priority,
|
|
314
|
+
data: variant.data || {},
|
|
315
|
+
variant: variant
|
|
316
|
+
});
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
231
319
|
var rule = globalEffectiveRuleMap.get(String(variant.data_variant_rule_id));
|
|
232
320
|
if (!rule) continue;
|
|
233
321
|
if (!this.evaluateProductRules(rule, product, businessData, menuScopeMap)) {
|
|
@@ -241,12 +329,103 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
241
329
|
});
|
|
242
330
|
}
|
|
243
331
|
} catch (err) {
|
|
244
|
-
|
|
332
|
+
_iterator6.e(err);
|
|
245
333
|
} finally {
|
|
246
|
-
|
|
334
|
+
_iterator6.f();
|
|
247
335
|
}
|
|
248
|
-
|
|
249
|
-
|
|
336
|
+
var resolvedProduct = matchedVariants.length ? this.mergeMatchedVariants(product, matchedVariants) : product;
|
|
337
|
+
var availableSettlementOptions = this.resolveSettlementOptions(settlementVariants, product, businessData, globalEffectiveRuleMap, menuScopeMap, authoritativeVariantPriorities);
|
|
338
|
+
if (!settlementVariants.length) return resolvedProduct;
|
|
339
|
+
return _objectSpread(_objectSpread({}, resolvedProduct), {}, {
|
|
340
|
+
available_settlement_options: availableSettlementOptions
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* 多货币 Data Variant 只生成候选列表,不参与商品字段覆盖。
|
|
346
|
+
* rule_id=0 是无条件默认价;同币种命中的条件价优先于默认价。
|
|
347
|
+
*/
|
|
348
|
+
}, {
|
|
349
|
+
key: "resolveSettlementOptions",
|
|
350
|
+
value: function resolveSettlementOptions(variants, product, businessData, globalEffectiveRuleMap, menuScopeMap, authoritativeVariantPriorities) {
|
|
351
|
+
var _this3 = this;
|
|
352
|
+
if (!variants.length) return [];
|
|
353
|
+
var candidates = variants.flatMap(function (variant) {
|
|
354
|
+
var _variant$data, _variant$id, _variant$data$price, _variant$data2;
|
|
355
|
+
var settlement = (_variant$data = variant.data) === null || _variant$data === void 0 ? void 0 : _variant$data.multi_currency_settlement;
|
|
356
|
+
if (!settlement || _typeof(settlement) !== 'object') return [];
|
|
357
|
+
var ruleId = String(variant.data_variant_rule_id);
|
|
358
|
+
var isDefault = Number(variant.data_variant_rule_id) === 0;
|
|
359
|
+
var rule = isDefault ? undefined : globalEffectiveRuleMap.get(ruleId);
|
|
360
|
+
var variantId = _this3.normalizeDataVariantId(variant.id);
|
|
361
|
+
var authoritativePriority = variantId === null ? undefined : authoritativeVariantPriorities === null || authoritativeVariantPriorities === void 0 ? void 0 : authoritativeVariantPriorities.get(variantId);
|
|
362
|
+
var available;
|
|
363
|
+
var priority;
|
|
364
|
+
if (isDefault) {
|
|
365
|
+
// rule 0 是无条件默认候选,不依赖接口命中 ID 或本地策略引擎。
|
|
366
|
+
available = true;
|
|
367
|
+
priority = Number.NEGATIVE_INFINITY;
|
|
368
|
+
} else if (authoritativeVariantPriorities !== null) {
|
|
369
|
+
var _ref2;
|
|
370
|
+
// 数组存在(包括 [])即表示接口已经算过规则,不再在客户端二次判断。
|
|
371
|
+
available = authoritativePriority !== undefined;
|
|
372
|
+
priority = (_ref2 = authoritativePriority !== null && authoritativePriority !== void 0 ? authoritativePriority : rule === null || rule === void 0 ? void 0 : rule.priority) !== null && _ref2 !== void 0 ? _ref2 : Number.NEGATIVE_INFINITY;
|
|
373
|
+
} else {
|
|
374
|
+
var _rule$priority;
|
|
375
|
+
available = Boolean(rule && _this3.evaluateProductRules(rule, product, businessData, menuScopeMap));
|
|
376
|
+
priority = (_rule$priority = rule === null || rule === void 0 ? void 0 : rule.priority) !== null && _rule$priority !== void 0 ? _rule$priority : Number.NEGATIVE_INFINITY;
|
|
377
|
+
}
|
|
378
|
+
var settlementType = String(settlement.settlement_type || '');
|
|
379
|
+
var currencyProductId = _this3.toNumber(settlement.currency_product_id);
|
|
380
|
+
var settlementKey = settlementType === 'virtual_currency' ? "virtual_currency:".concat(currencyProductId || '') : settlementType || "variant:".concat((_variant$id = variant.id) !== null && _variant$id !== void 0 ? _variant$id : ruleId);
|
|
381
|
+
return [{
|
|
382
|
+
key: settlementKey,
|
|
383
|
+
priority: priority,
|
|
384
|
+
isDefault: isDefault,
|
|
385
|
+
option: _objectSpread(_objectSpread(_objectSpread({}, settlement), {}, {
|
|
386
|
+
settlement_type: settlementType
|
|
387
|
+
}, currencyProductId ? {
|
|
388
|
+
currency_product_id: currencyProductId
|
|
389
|
+
} : {}), {}, {
|
|
390
|
+
price: String((_variant$data$price = (_variant$data2 = variant.data) === null || _variant$data2 === void 0 ? void 0 : _variant$data2.price) !== null && _variant$data$price !== void 0 ? _variant$data$price : '0'),
|
|
391
|
+
data_variant_id: variant.id,
|
|
392
|
+
data_variant_rule_id: variant.data_variant_rule_id,
|
|
393
|
+
available: available,
|
|
394
|
+
disabled_reason: available ? '' : String(settlement.disabled_reason || 'Not available for this purchase.')
|
|
395
|
+
})
|
|
396
|
+
}];
|
|
397
|
+
});
|
|
398
|
+
var grouped = new Map();
|
|
399
|
+
var _iterator7 = _createForOfIteratorHelper(candidates),
|
|
400
|
+
_step7;
|
|
401
|
+
try {
|
|
402
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
403
|
+
var candidate = _step7.value;
|
|
404
|
+
var group = grouped.get(candidate.key) || [];
|
|
405
|
+
group.push(candidate);
|
|
406
|
+
grouped.set(candidate.key, group);
|
|
407
|
+
}
|
|
408
|
+
} catch (err) {
|
|
409
|
+
_iterator7.e(err);
|
|
410
|
+
} finally {
|
|
411
|
+
_iterator7.f();
|
|
412
|
+
}
|
|
413
|
+
return Array.from(grouped.values()).map(function (group) {
|
|
414
|
+
var matchedConditional = group.filter(function (candidate) {
|
|
415
|
+
return !candidate.isDefault && candidate.option.available;
|
|
416
|
+
}).sort(function (a, b) {
|
|
417
|
+
return b.priority - a.priority;
|
|
418
|
+
})[0];
|
|
419
|
+
var defaultCandidate = group.find(function (candidate) {
|
|
420
|
+
return candidate.isDefault;
|
|
421
|
+
});
|
|
422
|
+
var unavailableCandidate = _toConsumableArray(group).filter(function (candidate) {
|
|
423
|
+
return !candidate.option.available;
|
|
424
|
+
}).sort(function (a, b) {
|
|
425
|
+
return b.priority - a.priority;
|
|
426
|
+
})[0];
|
|
427
|
+
return (matchedConditional || defaultCandidate || unavailableCandidate).option;
|
|
428
|
+
});
|
|
250
429
|
}
|
|
251
430
|
|
|
252
431
|
/**
|
|
@@ -257,7 +436,7 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
257
436
|
}, {
|
|
258
437
|
key: "resolveProductBundleItems",
|
|
259
438
|
value: function resolveProductBundleItems(product, businessData, globalEffectiveRuleMap, menuScopeMap) {
|
|
260
|
-
var
|
|
439
|
+
var _this4 = this;
|
|
261
440
|
var bundleGroups = product.bundle_group;
|
|
262
441
|
if (!Array.isArray(bundleGroups) || bundleGroups.length === 0) {
|
|
263
442
|
return product;
|
|
@@ -269,7 +448,7 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
269
448
|
}
|
|
270
449
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
271
450
|
bundle_item: bundleItems.map(function (item) {
|
|
272
|
-
return
|
|
451
|
+
return _this4.resolveBundleItem(item, businessData, globalEffectiveRuleMap, menuScopeMap);
|
|
273
452
|
})
|
|
274
453
|
});
|
|
275
454
|
});
|
|
@@ -298,16 +477,17 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
298
477
|
}, {
|
|
299
478
|
key: "toBundleItemDataVariantProduct",
|
|
300
479
|
value: function toBundleItemDataVariantProduct(item) {
|
|
301
|
-
var _item$bundle_product_,
|
|
480
|
+
var _item$bundle_product_, _ref3, _ref4, _item$bundle_variant_;
|
|
302
481
|
var productId = (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item.product_id;
|
|
303
|
-
var variantId = (
|
|
482
|
+
var variantId = (_ref3 = (_ref4 = (_item$bundle_variant_ = item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item.variant_id) !== null && _ref4 !== void 0 ? _ref4 : item.product_variant_id) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
304
483
|
return {
|
|
305
484
|
id: productId,
|
|
306
485
|
product_id: productId,
|
|
307
486
|
product_variant_id: variantId,
|
|
308
487
|
variant_id: variantId,
|
|
309
488
|
collection: item.collection,
|
|
310
|
-
data_variants: item.data_variants
|
|
489
|
+
data_variants: item.data_variants,
|
|
490
|
+
metadata: item.metadata
|
|
311
491
|
};
|
|
312
492
|
}
|
|
313
493
|
|
|
@@ -323,19 +503,19 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
323
503
|
return originalItem;
|
|
324
504
|
}
|
|
325
505
|
var result = _objectSpread({}, originalItem);
|
|
326
|
-
var
|
|
327
|
-
|
|
506
|
+
var _iterator8 = _createForOfIteratorHelper(appliedInfo.appliedFields),
|
|
507
|
+
_step8;
|
|
328
508
|
try {
|
|
329
|
-
for (
|
|
330
|
-
var field =
|
|
509
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
510
|
+
var field = _step8.value;
|
|
331
511
|
if (resolvedItem[field] !== undefined) {
|
|
332
512
|
result[field] = resolvedItem[field];
|
|
333
513
|
}
|
|
334
514
|
}
|
|
335
515
|
} catch (err) {
|
|
336
|
-
|
|
516
|
+
_iterator8.e(err);
|
|
337
517
|
} finally {
|
|
338
|
-
|
|
518
|
+
_iterator8.f();
|
|
339
519
|
}
|
|
340
520
|
result._dataVariant = appliedInfo;
|
|
341
521
|
return result;
|
|
@@ -375,11 +555,11 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
375
555
|
productRules: this.flattenConditionRules(conditions)
|
|
376
556
|
};
|
|
377
557
|
}
|
|
378
|
-
var
|
|
379
|
-
|
|
558
|
+
var _iterator9 = _createForOfIteratorHelper(conditions.rules),
|
|
559
|
+
_step9;
|
|
380
560
|
try {
|
|
381
|
-
for (
|
|
382
|
-
var rule =
|
|
561
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
562
|
+
var rule = _step9.value;
|
|
383
563
|
if (this.isConditionGroup(rule)) {
|
|
384
564
|
productRules.push.apply(productRules, _toConsumableArray(this.flattenConditionRules(rule)));
|
|
385
565
|
continue;
|
|
@@ -391,9 +571,9 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
391
571
|
}
|
|
392
572
|
}
|
|
393
573
|
} catch (err) {
|
|
394
|
-
|
|
574
|
+
_iterator9.e(err);
|
|
395
575
|
} finally {
|
|
396
|
-
|
|
576
|
+
_iterator9.f();
|
|
397
577
|
}
|
|
398
578
|
return {
|
|
399
579
|
globalConfig: _objectSpread(_objectSpread({}, config), {}, {
|
|
@@ -409,16 +589,16 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
409
589
|
}, {
|
|
410
590
|
key: "createEngine",
|
|
411
591
|
value: function createEngine(businessData, menuScopeMap) {
|
|
412
|
-
var
|
|
592
|
+
var _this5 = this;
|
|
413
593
|
var operatorHandlers = {
|
|
414
594
|
schedule_match: function schedule_match(fieldValue, compareValue) {
|
|
415
|
-
return
|
|
595
|
+
return _this5.evaluateScheduleMatch(fieldValue, compareValue, businessData.scheduleList || []);
|
|
416
596
|
},
|
|
417
597
|
menu_match: function menu_match(fieldValue, compareValue) {
|
|
418
|
-
return
|
|
598
|
+
return _this5.evaluateMenuMatch(fieldValue, compareValue, menuScopeMap);
|
|
419
599
|
},
|
|
420
600
|
array_intersects: function array_intersects(fieldValue, compareValue) {
|
|
421
|
-
return
|
|
601
|
+
return _this5.evaluateArrayIntersects(fieldValue, compareValue);
|
|
422
602
|
}
|
|
423
603
|
};
|
|
424
604
|
return new StrategyEngine({
|
|
@@ -444,19 +624,19 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
444
624
|
value: function evaluateMenuMatch(fieldValue, compareValue, menuScopeMap) {
|
|
445
625
|
var menuIds = this.normalizeNumberArray(compareValue);
|
|
446
626
|
if (!menuIds.length) return true;
|
|
447
|
-
var
|
|
448
|
-
|
|
627
|
+
var _iterator10 = _createForOfIteratorHelper(menuIds),
|
|
628
|
+
_step10;
|
|
449
629
|
try {
|
|
450
|
-
for (
|
|
451
|
-
var menuId =
|
|
630
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
631
|
+
var menuId = _step10.value;
|
|
452
632
|
var scope = menuScopeMap.get(menuId);
|
|
453
633
|
if (!scope) continue;
|
|
454
634
|
if (this.isProductInMenuScope(fieldValue, scope)) return true;
|
|
455
635
|
}
|
|
456
636
|
} catch (err) {
|
|
457
|
-
|
|
637
|
+
_iterator10.e(err);
|
|
458
638
|
} finally {
|
|
459
|
-
|
|
639
|
+
_iterator10.f();
|
|
460
640
|
}
|
|
461
641
|
return false;
|
|
462
642
|
}
|
|
@@ -475,55 +655,55 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
475
655
|
key: "collectScheduleIdsFromStrategies",
|
|
476
656
|
value: function collectScheduleIdsFromStrategies(strategyConfigs) {
|
|
477
657
|
var scheduleIds = new Set();
|
|
478
|
-
var
|
|
479
|
-
|
|
658
|
+
var _iterator11 = _createForOfIteratorHelper(strategyConfigs),
|
|
659
|
+
_step11;
|
|
480
660
|
try {
|
|
481
|
-
for (
|
|
482
|
-
var config =
|
|
661
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
662
|
+
var config = _step11.value;
|
|
483
663
|
if (!this.isStrategyActive(config)) continue;
|
|
484
664
|
var rules = this.flattenConditionRules(config.conditions);
|
|
485
|
-
var
|
|
486
|
-
|
|
665
|
+
var _iterator12 = _createForOfIteratorHelper(rules),
|
|
666
|
+
_step12;
|
|
487
667
|
try {
|
|
488
|
-
for (
|
|
489
|
-
var rule =
|
|
668
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
669
|
+
var rule = _step12.value;
|
|
490
670
|
if (rule.operator !== 'schedule_match') continue;
|
|
491
|
-
var
|
|
492
|
-
|
|
671
|
+
var _iterator13 = _createForOfIteratorHelper(this.normalizeNumberArray(rule.value)),
|
|
672
|
+
_step13;
|
|
493
673
|
try {
|
|
494
|
-
for (
|
|
495
|
-
var scheduleId =
|
|
674
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
675
|
+
var scheduleId = _step13.value;
|
|
496
676
|
scheduleIds.add(scheduleId);
|
|
497
677
|
}
|
|
498
678
|
} catch (err) {
|
|
499
|
-
|
|
679
|
+
_iterator13.e(err);
|
|
500
680
|
} finally {
|
|
501
|
-
|
|
681
|
+
_iterator13.f();
|
|
502
682
|
}
|
|
503
683
|
}
|
|
504
684
|
} catch (err) {
|
|
505
|
-
|
|
685
|
+
_iterator12.e(err);
|
|
506
686
|
} finally {
|
|
507
|
-
|
|
687
|
+
_iterator12.f();
|
|
508
688
|
}
|
|
509
689
|
}
|
|
510
690
|
} catch (err) {
|
|
511
|
-
|
|
691
|
+
_iterator11.e(err);
|
|
512
692
|
} finally {
|
|
513
|
-
|
|
693
|
+
_iterator11.f();
|
|
514
694
|
}
|
|
515
695
|
return Array.from(scheduleIds);
|
|
516
696
|
}
|
|
517
697
|
}, {
|
|
518
698
|
key: "extractTimePointsFromSchedules",
|
|
519
699
|
value: function extractTimePointsFromSchedules(schedules) {
|
|
520
|
-
var
|
|
700
|
+
var _this6 = this;
|
|
521
701
|
var timePoints = new Set();
|
|
522
|
-
var
|
|
523
|
-
|
|
702
|
+
var _iterator14 = _createForOfIteratorHelper(schedules),
|
|
703
|
+
_step14;
|
|
524
704
|
try {
|
|
525
|
-
for (
|
|
526
|
-
var schedule =
|
|
705
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
706
|
+
var schedule = _step14.value;
|
|
527
707
|
switch (schedule.type) {
|
|
528
708
|
case 'standard':
|
|
529
709
|
{
|
|
@@ -534,36 +714,36 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
534
714
|
case 'time-slots':
|
|
535
715
|
{
|
|
536
716
|
var slots = Array.isArray(schedule.time_slot) ? schedule.time_slot : [];
|
|
537
|
-
var
|
|
538
|
-
|
|
717
|
+
var _iterator15 = _createForOfIteratorHelper(slots),
|
|
718
|
+
_step15;
|
|
539
719
|
try {
|
|
540
|
-
for (
|
|
541
|
-
var slot =
|
|
720
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
721
|
+
var slot = _step15.value;
|
|
542
722
|
this.addRawTimePoint(timePoints, slot.start_time);
|
|
543
723
|
this.addRawTimePoint(timePoints, slot.end_time);
|
|
544
724
|
}
|
|
545
725
|
} catch (err) {
|
|
546
|
-
|
|
726
|
+
_iterator15.e(err);
|
|
547
727
|
} finally {
|
|
548
|
-
|
|
728
|
+
_iterator15.f();
|
|
549
729
|
}
|
|
550
730
|
break;
|
|
551
731
|
}
|
|
552
732
|
case 'designation':
|
|
553
733
|
{
|
|
554
734
|
var designations = Array.isArray(schedule.designation) ? schedule.designation : schedule.designation ? [schedule.designation] : [];
|
|
555
|
-
var
|
|
556
|
-
|
|
735
|
+
var _iterator16 = _createForOfIteratorHelper(designations),
|
|
736
|
+
_step16;
|
|
557
737
|
try {
|
|
558
|
-
for (
|
|
559
|
-
var designation =
|
|
738
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
739
|
+
var designation = _step16.value;
|
|
560
740
|
this.addRawTimePoint(timePoints, designation.start_time);
|
|
561
741
|
this.addRawTimePoint(timePoints, designation.end_time);
|
|
562
742
|
}
|
|
563
743
|
} catch (err) {
|
|
564
|
-
|
|
744
|
+
_iterator16.e(err);
|
|
565
745
|
} finally {
|
|
566
|
-
|
|
746
|
+
_iterator16.f();
|
|
567
747
|
}
|
|
568
748
|
break;
|
|
569
749
|
}
|
|
@@ -572,12 +752,12 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
572
752
|
}
|
|
573
753
|
}
|
|
574
754
|
} catch (err) {
|
|
575
|
-
|
|
755
|
+
_iterator14.e(err);
|
|
576
756
|
} finally {
|
|
577
|
-
|
|
757
|
+
_iterator14.f();
|
|
578
758
|
}
|
|
579
759
|
return Array.from(timePoints).sort(function (a, b) {
|
|
580
|
-
return
|
|
760
|
+
return _this6.timeToMinutes(a) - _this6.timeToMinutes(b);
|
|
581
761
|
});
|
|
582
762
|
}
|
|
583
763
|
}, {
|
|
@@ -624,14 +804,14 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
624
804
|
key: "isProductInMenuScope",
|
|
625
805
|
value: function isProductInMenuScope(product, scope) {
|
|
626
806
|
var _product$id,
|
|
627
|
-
|
|
807
|
+
_this7 = this;
|
|
628
808
|
if (scope.isAllProducts) return true;
|
|
629
809
|
if (!product || _typeof(product) !== 'object') return false;
|
|
630
810
|
var productId = this.toNumber((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id);
|
|
631
811
|
var variantId = this.toNumber(product.product_variant_id);
|
|
632
812
|
var productKey = this.buildProductKey(productId, variantId);
|
|
633
813
|
var collectionIds = Array.isArray(product.collection_ids) ? product.collection_ids.map(function (id) {
|
|
634
|
-
return
|
|
814
|
+
return _this7.toNumber(id);
|
|
635
815
|
}) : [];
|
|
636
816
|
return collectionIds.some(function (id) {
|
|
637
817
|
return scope.collectionIds.has(id);
|
|
@@ -640,6 +820,7 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
640
820
|
}, {
|
|
641
821
|
key: "mergeMatchedVariants",
|
|
642
822
|
value: function mergeMatchedVariants(product, matchedVariants) {
|
|
823
|
+
var _this8 = this;
|
|
643
824
|
var original = _objectSpread({}, product);
|
|
644
825
|
var sortedVariants = _toConsumableArray(matchedVariants).sort(function (a, b) {
|
|
645
826
|
if (a.priority !== b.priority) return a.priority - b.priority;
|
|
@@ -648,11 +829,11 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
648
829
|
var result = _objectSpread({}, product);
|
|
649
830
|
var appliedRuleIds = [];
|
|
650
831
|
var appliedFields = new Set();
|
|
651
|
-
var
|
|
652
|
-
|
|
832
|
+
var _iterator17 = _createForOfIteratorHelper(sortedVariants),
|
|
833
|
+
_step17;
|
|
653
834
|
try {
|
|
654
|
-
for (
|
|
655
|
-
var matched =
|
|
835
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
836
|
+
var matched = _step17.value;
|
|
656
837
|
for (var _i = 0, _Object$entries = Object.entries(matched.data); _i < _Object$entries.length; _i++) {
|
|
657
838
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
658
839
|
key = _Object$entries$_i[0],
|
|
@@ -664,12 +845,17 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
664
845
|
appliedRuleIds.push(matched.ruleId);
|
|
665
846
|
}
|
|
666
847
|
} catch (err) {
|
|
667
|
-
|
|
848
|
+
_iterator17.e(err);
|
|
668
849
|
} finally {
|
|
669
|
-
|
|
850
|
+
_iterator17.f();
|
|
670
851
|
}
|
|
671
852
|
result._dataVariant = {
|
|
672
853
|
appliedRuleIds: appliedRuleIds,
|
|
854
|
+
appliedVariantIds: Array.from(new Set(_toConsumableArray(sortedVariants).reverse().map(function (matched) {
|
|
855
|
+
return _this8.normalizeDataVariantId(matched.variant.id);
|
|
856
|
+
}).filter(function (id) {
|
|
857
|
+
return id !== null;
|
|
858
|
+
}))),
|
|
673
859
|
appliedFields: Array.from(appliedFields),
|
|
674
860
|
original: original
|
|
675
861
|
};
|
|
@@ -718,11 +904,11 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
718
904
|
key: "flattenConditionRules",
|
|
719
905
|
value: function flattenConditionRules(group) {
|
|
720
906
|
var rules = [];
|
|
721
|
-
var
|
|
722
|
-
|
|
907
|
+
var _iterator18 = _createForOfIteratorHelper(group.rules),
|
|
908
|
+
_step18;
|
|
723
909
|
try {
|
|
724
|
-
for (
|
|
725
|
-
var rule =
|
|
910
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
911
|
+
var rule = _step18.value;
|
|
726
912
|
if (this.isConditionGroup(rule)) {
|
|
727
913
|
rules.push.apply(rules, _toConsumableArray(this.flattenConditionRules(rule)));
|
|
728
914
|
} else {
|
|
@@ -730,9 +916,9 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
730
916
|
}
|
|
731
917
|
}
|
|
732
918
|
} catch (err) {
|
|
733
|
-
|
|
919
|
+
_iterator18.e(err);
|
|
734
920
|
} finally {
|
|
735
|
-
|
|
921
|
+
_iterator18.f();
|
|
736
922
|
}
|
|
737
923
|
return rules;
|
|
738
924
|
}
|
|
@@ -744,10 +930,10 @@ export var DataVariantEvaluator = /*#__PURE__*/function () {
|
|
|
744
930
|
}, {
|
|
745
931
|
key: "normalizeNumberArray",
|
|
746
932
|
value: function normalizeNumberArray(value) {
|
|
747
|
-
var
|
|
933
|
+
var _this9 = this;
|
|
748
934
|
if (!Array.isArray(value)) return [];
|
|
749
935
|
return value.map(function (item) {
|
|
750
|
-
return
|
|
936
|
+
return _this9.toNumber(item);
|
|
751
937
|
}).filter(function (item) {
|
|
752
938
|
return item > 0;
|
|
753
939
|
});
|