@pisell/pisellos 2.3.133 → 2.3.135
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/modules/ProductList/index.js +18 -5
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/VenueBooking/utils/smartPricing.js +4 -1
- package/lib/modules/ProductList/index.js +14 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/VenueBooking/utils/smartPricing.js +4 -1
- 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, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -156,7 +156,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
156
156
|
value: function () {
|
|
157
157
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
158
158
|
var _this$otherParams,
|
|
159
|
+
_this$otherParams$bus,
|
|
159
160
|
_this$otherParams2,
|
|
161
|
+
_this$otherParams3,
|
|
162
|
+
_this$otherParams4,
|
|
160
163
|
_this2 = this;
|
|
161
164
|
var _ref,
|
|
162
165
|
_ref$category_ids,
|
|
@@ -185,6 +188,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
185
188
|
channelMap,
|
|
186
189
|
rawApplicationCode,
|
|
187
190
|
mappedApplicationCode,
|
|
191
|
+
configuredBusinessCode,
|
|
192
|
+
resolvedStrategyContext,
|
|
188
193
|
queryPayload,
|
|
189
194
|
handledByOsServer,
|
|
190
195
|
originalCallback,
|
|
@@ -227,7 +232,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
227
232
|
};
|
|
228
233
|
rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
|
|
229
234
|
mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
230
|
-
|
|
235
|
+
configuredBusinessCode = (_this$otherParams$bus = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code; // application_code 是后端商品筛选字段;智能定价评估器则只读取
|
|
236
|
+
// strategy_context 中的 channel / business_code。默认补齐两者,
|
|
237
|
+
// 但允许调用方显式传入的上下文覆盖默认值。
|
|
238
|
+
resolvedStrategyContext = _objectSpread(_objectSpread(_objectSpread({}, mappedApplicationCode ? {
|
|
239
|
+
channel: mappedApplicationCode
|
|
240
|
+
} : {}), configuredBusinessCode ? {
|
|
241
|
+
business_code: configuredBusinessCode
|
|
242
|
+
} : {}), strategy_context || {});
|
|
243
|
+
queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, isCustomerUserPlatform((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform) ? {} : {
|
|
231
244
|
open_quotation: 1
|
|
232
245
|
}), {}, {
|
|
233
246
|
open_bundle: 0,
|
|
@@ -256,7 +269,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
256
269
|
with_schedule: with_schedule,
|
|
257
270
|
schedule_datetime: schedule_datetime,
|
|
258
271
|
extension_type: extension_type,
|
|
259
|
-
strategy_context:
|
|
272
|
+
strategy_context: Object.keys(resolvedStrategyContext).length ? resolvedStrategyContext : undefined
|
|
260
273
|
});
|
|
261
274
|
handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
|
|
262
275
|
originalCallback = options === null || options === void 0 ? void 0 : options.callback;
|
|
@@ -305,14 +318,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
305
318
|
return _ref2.apply(this, arguments);
|
|
306
319
|
};
|
|
307
320
|
}()) : undefined;
|
|
308
|
-
_context5.next =
|
|
321
|
+
_context5.next = 16;
|
|
309
322
|
return this.request.post("/product/query", queryPayload, {
|
|
310
323
|
osServer: true,
|
|
311
324
|
callback: subscriptionCallback,
|
|
312
325
|
subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
|
|
313
326
|
customToast: function customToast() {}
|
|
314
327
|
});
|
|
315
|
-
case
|
|
328
|
+
case 16:
|
|
316
329
|
productsData = _context5.sent;
|
|
317
330
|
if (!handledByOsServer && Array.isArray(productsData.data.list)) {
|
|
318
331
|
this.replaceRawProductQueryResult(productsData.data.list, product_ids);
|
|
@@ -335,7 +348,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
335
348
|
// }
|
|
336
349
|
this.addProduct(sortedList);
|
|
337
350
|
return _context5.abrupt("return", sortedList);
|
|
338
|
-
case
|
|
351
|
+
case 22:
|
|
339
352
|
case "end":
|
|
340
353
|
return _context5.stop();
|
|
341
354
|
}
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -49,7 +49,10 @@ export function formatProductsWithDataVariant(products, context, scheduleDateTim
|
|
|
49
49
|
console.warn('[VenueBooking][smartPricing] dataVariantEvaluator 未注入,跳过智能定价格式化');
|
|
50
50
|
return products;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
|
+
// 日程包含结束边界,向后偏移一秒评估,避免前一时段的定价规则覆盖当前时段。
|
|
54
|
+
// 仅调整规则匹配时间,预约时间和分段缓存 key 仍保留原值。
|
|
55
|
+
var resolvedAt = dayjs(scheduleDateTime || undefined).add(1, 'second').format('YYYY-MM-DD HH:mm:ss');
|
|
53
56
|
// 接口的命中 ID 对应商品查询时刻,不能用于另一个预约时段/客户。
|
|
54
57
|
// 仅处理本次评估副本,保留目录中的原始数据。
|
|
55
58
|
var pricingProducts = products.map(function (product) {
|
|
@@ -130,6 +130,19 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
130
130
|
};
|
|
131
131
|
const rawApplicationCode = this.otherParams?.channel;
|
|
132
132
|
const mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
133
|
+
const configuredBusinessCode = this.otherParams?.businessCode ?? this.otherParams?.business_code;
|
|
134
|
+
// application_code 是后端商品筛选字段;智能定价评估器则只读取
|
|
135
|
+
// strategy_context 中的 channel / business_code。默认补齐两者,
|
|
136
|
+
// 但允许调用方显式传入的上下文覆盖默认值。
|
|
137
|
+
const resolvedStrategyContext = {
|
|
138
|
+
...(mappedApplicationCode ? {
|
|
139
|
+
channel: mappedApplicationCode
|
|
140
|
+
} : {}),
|
|
141
|
+
...(configuredBusinessCode ? {
|
|
142
|
+
business_code: configuredBusinessCode
|
|
143
|
+
} : {}),
|
|
144
|
+
...(strategy_context || {})
|
|
145
|
+
};
|
|
133
146
|
const queryPayload = {
|
|
134
147
|
...((0, _platform.isCustomerUserPlatform)(this.otherParams?.platform) ? {} : {
|
|
135
148
|
open_quotation: 1
|
|
@@ -162,7 +175,7 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
162
175
|
with_schedule,
|
|
163
176
|
schedule_datetime,
|
|
164
177
|
extension_type,
|
|
165
|
-
strategy_context
|
|
178
|
+
strategy_context: Object.keys(resolvedStrategyContext).length ? resolvedStrategyContext : undefined
|
|
166
179
|
};
|
|
167
180
|
const handledByOsServer = (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request);
|
|
168
181
|
const originalCallback = options?.callback;
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -52,7 +52,10 @@ function formatProductsWithDataVariant(products, context, scheduleDateTime) {
|
|
|
52
52
|
console.warn('[VenueBooking][smartPricing] dataVariantEvaluator 未注入,跳过智能定价格式化');
|
|
53
53
|
return products;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
|
+
// 日程包含结束边界,向后偏移一秒评估,避免前一时段的定价规则覆盖当前时段。
|
|
57
|
+
// 仅调整规则匹配时间,预约时间和分段缓存 key 仍保留原值。
|
|
58
|
+
const resolvedAt = (0, _dayjs.default)(scheduleDateTime || undefined).add(1, 'second').format('YYYY-MM-DD HH:mm:ss');
|
|
56
59
|
// 接口的命中 ID 对应商品查询时刻,不能用于另一个预约时段/客户。
|
|
57
60
|
// 仅处理本次评估副本,保留目录中的原始数据。
|
|
58
61
|
const pricingProducts = products.map(product => {
|