@pisell/pisellos 2.1.169 → 2.1.171
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 +2 -2
- package/dist/solution/VenueBooking/index.d.ts +19 -0
- package/dist/solution/VenueBooking/index.js +406 -67
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/VenueBooking/index.d.ts +19 -0
- package/lib/solution/VenueBooking/index.js +299 -6
- package/package.json +1 -1
|
@@ -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 | 3 | 4 | 5 | 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
|
* 找到多个资源的公共可用时间段
|
|
@@ -18,6 +18,7 @@ interface VenueBookingItemRuleRuntimeConfig {
|
|
|
18
18
|
custom?: Record<string, any>;
|
|
19
19
|
}
|
|
20
20
|
export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
21
|
+
private static readonly PRICING_DEBUG_CACHE_ID;
|
|
21
22
|
protected defaultName: string;
|
|
22
23
|
protected defaultVersion: string;
|
|
23
24
|
isSolution: boolean;
|
|
@@ -53,6 +54,16 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
53
54
|
private pickErrorMessage;
|
|
54
55
|
private serializeError;
|
|
55
56
|
private addVenueBookingLog;
|
|
57
|
+
/**
|
|
58
|
+
* 临时线上排查日志:
|
|
59
|
+
* - 仅对指定页面 cacheId 开启,避免影响其他页面
|
|
60
|
+
* - 不 await,且吞掉日志上报异常,保证日志系统不会阻断登录/商品加载主流程
|
|
61
|
+
*/
|
|
62
|
+
private logPricingDiagnostics;
|
|
63
|
+
private isPricingDiagnosticsEnabled;
|
|
64
|
+
private getAvailableWalletIdsForDiagnostics;
|
|
65
|
+
private getOrderPricingSnapshotForDiagnostics;
|
|
66
|
+
private getCatalogPricingSnapshotForDiagnostics;
|
|
56
67
|
private logMethodStart;
|
|
57
68
|
private logMethodSuccess;
|
|
58
69
|
private logMethodError;
|
|
@@ -172,6 +183,14 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
172
183
|
onCustomerLogin(params: {
|
|
173
184
|
customerId: number;
|
|
174
185
|
}): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* 接收 pisell2 VenueBooking 登录链路诊断日志。
|
|
188
|
+
* 实际是否上报仍由 OS 内部 cacheId 白名单统一控制。
|
|
189
|
+
*/
|
|
190
|
+
logPricingDiagnosticsFromClient(params: {
|
|
191
|
+
title: string;
|
|
192
|
+
payload?: Record<string, any>;
|
|
193
|
+
}): void;
|
|
175
194
|
private recalculateOrderPricesFromSmartPricing;
|
|
176
195
|
/**
|
|
177
196
|
* DataVariant 重算价格后,同步刷新订单展示、Rules 与 Summary 共用的价格口径。
|
|
@@ -190,6 +190,75 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
190
190
|
extra
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* 临时线上排查日志:
|
|
195
|
+
* - 仅对指定页面 cacheId 开启,避免影响其他页面
|
|
196
|
+
* - 不 await,且吞掉日志上报异常,保证日志系统不会阻断登录/商品加载主流程
|
|
197
|
+
*/
|
|
198
|
+
logPricingDiagnostics(title, payload = {}) {
|
|
199
|
+
if (!this.isPricingDiagnosticsEnabled())
|
|
200
|
+
return;
|
|
201
|
+
void this.addVenueBookingLog({
|
|
202
|
+
level: "info",
|
|
203
|
+
title,
|
|
204
|
+
payload
|
|
205
|
+
}).catch((error) => {
|
|
206
|
+
console.warn("[VenueBooking] pricing diagnostic log failed", error);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
isPricingDiagnosticsEnabled() {
|
|
210
|
+
return String(this.cacheId || "") === _VenueBookingImpl.PRICING_DEBUG_CACHE_ID;
|
|
211
|
+
}
|
|
212
|
+
getAvailableWalletIdsForDiagnostics() {
|
|
213
|
+
var _a, _b;
|
|
214
|
+
try {
|
|
215
|
+
return (_b = (_a = this.store.order) == null ? void 0 : _a.getAvailableWalletIds) == null ? void 0 : _b.call(_a);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
return {
|
|
218
|
+
readFailed: true,
|
|
219
|
+
error: this.serializeError(error)
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
getOrderPricingSnapshotForDiagnostics() {
|
|
224
|
+
var _a, _b;
|
|
225
|
+
try {
|
|
226
|
+
const products = (_b = (_a = this.store.order) == null ? void 0 : _a.getTempOrder()) == null ? void 0 : _b.products;
|
|
227
|
+
if (!Array.isArray(products))
|
|
228
|
+
return [];
|
|
229
|
+
return products.map((product) => {
|
|
230
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
231
|
+
return {
|
|
232
|
+
productId: product == null ? void 0 : product.product_id,
|
|
233
|
+
resourceId: (_a2 = product == null ? void 0 : product.metadata) == null ? void 0 : _a2.resource_id,
|
|
234
|
+
isVenueBooking: !!((_b2 = product == null ? void 0 : product.metadata) == null ? void 0 : _b2.venue_booking),
|
|
235
|
+
sellingPrice: product == null ? void 0 : product.selling_price,
|
|
236
|
+
originalPrice: product == null ? void 0 : product.original_price,
|
|
237
|
+
sourceProductPrice: (_c = product == null ? void 0 : product.metadata) == null ? void 0 : _c.source_product_price,
|
|
238
|
+
mainProductOriginalPrice: (_d = product == null ? void 0 : product.metadata) == null ? void 0 : _d.main_product_original_price,
|
|
239
|
+
mainProductSellingPrice: (_e = product == null ? void 0 : product.metadata) == null ? void 0 : _e.main_product_selling_price,
|
|
240
|
+
priceBreakdown: (_f = product == null ? void 0 : product.metadata) == null ? void 0 : _f.price_breakdown,
|
|
241
|
+
discountList: product == null ? void 0 : product.discount_list
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
} catch (error) {
|
|
245
|
+
return [{ readFailed: true, error: this.serializeError(error) }];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
getCatalogPricingSnapshotForDiagnostics() {
|
|
249
|
+
const orderProductIds = new Set(
|
|
250
|
+
this.getOrderPricingSnapshotForDiagnostics().map((product) => Number(product.productId)).filter((productId) => Number.isFinite(productId))
|
|
251
|
+
);
|
|
252
|
+
return this.getAllProductsForSmartPricing().filter((product) => orderProductIds.has(Number(product == null ? void 0 : product.id))).map((product) => ({
|
|
253
|
+
productId: product == null ? void 0 : product.id,
|
|
254
|
+
price: product == null ? void 0 : product.price,
|
|
255
|
+
sellingPrice: product == null ? void 0 : product.selling_price,
|
|
256
|
+
dataVariants: Array.isArray(product == null ? void 0 : product.data_variants) ? product.data_variants.map((variant) => ({
|
|
257
|
+
ruleId: variant == null ? void 0 : variant.data_variant_rule_id,
|
|
258
|
+
data: variant == null ? void 0 : variant.data
|
|
259
|
+
})) : []
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
193
262
|
logMethodStart(method, payload = {}) {
|
|
194
263
|
void this.addVenueBookingLog({
|
|
195
264
|
level: "info",
|
|
@@ -291,6 +360,18 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
291
360
|
async refreshOrderMarketingAfterLogin(params) {
|
|
292
361
|
if (!this.store.order)
|
|
293
362
|
throw new Error("order 模块未初始化");
|
|
363
|
+
const pricingDiagnosticsEnabled = this.isPricingDiagnosticsEnabled();
|
|
364
|
+
if (pricingDiagnosticsEnabled) {
|
|
365
|
+
this.logPricingDiagnostics("[VenueBooking] refreshOrderMarketingAfterLogin entered", {
|
|
366
|
+
customerId: params.customerId,
|
|
367
|
+
hasCustomerLoginRefreshInFlight: !!this.customerLoginRefreshInFlight,
|
|
368
|
+
customerLoginRefreshIdInFlight: this.customerLoginRefreshIdInFlight,
|
|
369
|
+
hasLoadAllProductsInFlight: !!this.loadAllProductsInFlight,
|
|
370
|
+
productsLoaded: this.productsLoaded,
|
|
371
|
+
smartPricingProductCatalogCount: this.smartPricingProductCatalog.length,
|
|
372
|
+
note: "This login refresh reloads products with the confirmed customer context before recalculation"
|
|
373
|
+
});
|
|
374
|
+
}
|
|
294
375
|
if (this.customerLoginRefreshInFlight) {
|
|
295
376
|
if (this.customerLoginRefreshIdInFlight === params.customerId) {
|
|
296
377
|
await this.customerLoginRefreshInFlight;
|
|
@@ -300,29 +381,139 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
300
381
|
}
|
|
301
382
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
302
383
|
const refreshTask = (async () => {
|
|
303
|
-
var _a, _b, _c;
|
|
384
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
304
385
|
this.smartPricingCustomerId = params.customerId;
|
|
386
|
+
if (pricingDiagnosticsEnabled) {
|
|
387
|
+
this.logPricingDiagnostics("[VenueBooking] login pricing customer context set", {
|
|
388
|
+
customerId: params.customerId,
|
|
389
|
+
userPluginCustomerId: this.resolveCustomerIdForSmartPricing(),
|
|
390
|
+
availableWalletIdsBeforeDiscountConfig: this.getAvailableWalletIdsForDiagnostics(),
|
|
391
|
+
orderProductsBeforeDiscountConfig: this.getOrderPricingSnapshotForDiagnostics()
|
|
392
|
+
});
|
|
393
|
+
}
|
|
305
394
|
await this.store.order.loadDiscountConfig({
|
|
306
395
|
customerId: params.customerId
|
|
307
396
|
});
|
|
397
|
+
if (pricingDiagnosticsEnabled) {
|
|
398
|
+
const productsLoadBeforeLogin = this.loadAllProductsInFlight;
|
|
399
|
+
if (productsLoadBeforeLogin) {
|
|
400
|
+
this.logPricingDiagnostics("[VenueBooking] login waiting for previous product load", {
|
|
401
|
+
customerId: params.customerId
|
|
402
|
+
});
|
|
403
|
+
try {
|
|
404
|
+
await productsLoadBeforeLogin;
|
|
405
|
+
} catch (error) {
|
|
406
|
+
this.logPricingDiagnostics("[VenueBooking] previous product load failed before login reload", {
|
|
407
|
+
customerId: params.customerId,
|
|
408
|
+
error: this.serializeError(error)
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
this.logPricingDiagnostics("[VenueBooking] login product reload starting", {
|
|
413
|
+
customerId: params.customerId,
|
|
414
|
+
productsLoadedBeforeReload: this.productsLoaded,
|
|
415
|
+
catalogCountBeforeReload: this.smartPricingProductCatalog.length,
|
|
416
|
+
availableWalletIds: this.getAvailableWalletIdsForDiagnostics()
|
|
417
|
+
});
|
|
418
|
+
const loginProducts = await this.loadAllProducts();
|
|
419
|
+
this.logPricingDiagnostics("[VenueBooking] login product reload completed", {
|
|
420
|
+
customerId: params.customerId,
|
|
421
|
+
venueProductCount: loginProducts.venueProducts.length,
|
|
422
|
+
addonProductCount: loginProducts.addonProducts.length,
|
|
423
|
+
catalogCountAfterReload: this.smartPricingProductCatalog.length,
|
|
424
|
+
resourceProductMapSize: this.resourceProductMap.size
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if (pricingDiagnosticsEnabled) {
|
|
428
|
+
const smartPricingContext = this.buildSmartPricingContext();
|
|
429
|
+
const strategyConfigs = ((_b = (_a = smartPricingContext.evaluator) == null ? void 0 : _a.getStrategyConfigs) == null ? void 0 : _b.call(_a)) || [];
|
|
430
|
+
this.logPricingDiagnostics("[VenueBooking] login discount config loaded", {
|
|
431
|
+
customerId: params.customerId,
|
|
432
|
+
availableWalletIdsAfterDiscountConfig: this.getAvailableWalletIdsForDiagnostics(),
|
|
433
|
+
discountList: this.store.order.getDiscountList(),
|
|
434
|
+
smartPricingContext: {
|
|
435
|
+
customerId: smartPricingContext.customerId,
|
|
436
|
+
availableWalletIds: smartPricingContext.availableWalletIds,
|
|
437
|
+
channel: smartPricingContext.channel,
|
|
438
|
+
businessCode: smartPricingContext.businessCode,
|
|
439
|
+
orderType: smartPricingContext.orderType,
|
|
440
|
+
scheduleCount: ((_c = smartPricingContext.scheduleList) == null ? void 0 : _c.length) || 0,
|
|
441
|
+
menuCount: ((_d = smartPricingContext.menuList) == null ? void 0 : _d.length) || 0,
|
|
442
|
+
hasEvaluator: !!smartPricingContext.evaluator
|
|
443
|
+
},
|
|
444
|
+
strategyConfigs: strategyConfigs.map((config) => {
|
|
445
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
446
|
+
return {
|
|
447
|
+
ruleId: (_a2 = config == null ? void 0 : config.metadata) == null ? void 0 : _a2.id,
|
|
448
|
+
name: (_b2 = config == null ? void 0 : config.metadata) == null ? void 0 : _b2.name,
|
|
449
|
+
status: (_d2 = (_c2 = config == null ? void 0 : config.metadata) == null ? void 0 : _c2.custom) == null ? void 0 : _d2.status,
|
|
450
|
+
priority: (_f2 = (_e2 = config == null ? void 0 : config.metadata) == null ? void 0 : _e2.custom) == null ? void 0 : _f2.priority,
|
|
451
|
+
conditions: config == null ? void 0 : config.conditions
|
|
452
|
+
};
|
|
453
|
+
}),
|
|
454
|
+
productsLoaded: this.productsLoaded,
|
|
455
|
+
smartPricingProductCatalogCount: (_e = this.smartPricingProductCatalog) == null ? void 0 : _e.length,
|
|
456
|
+
resourceProductMapSize: this.resourceProductMap.size,
|
|
457
|
+
matchingCatalogProducts: this.getCatalogPricingSnapshotForDiagnostics()
|
|
458
|
+
});
|
|
459
|
+
}
|
|
308
460
|
this.clearSlotPriceMapCache();
|
|
461
|
+
if (pricingDiagnosticsEnabled) {
|
|
462
|
+
this.logPricingDiagnostics("[VenueBooking] login smart pricing recalculation starting", {
|
|
463
|
+
slotPriceMapCacheSizeAfterClear: this.slotPriceMapCache.size,
|
|
464
|
+
orderProductsBeforeRecalculation: this.getOrderPricingSnapshotForDiagnostics()
|
|
465
|
+
});
|
|
466
|
+
}
|
|
309
467
|
this.recalculateOrderPricesFromSmartPricing();
|
|
468
|
+
if (pricingDiagnosticsEnabled) {
|
|
469
|
+
this.logPricingDiagnostics("[VenueBooking] login smart pricing recalculation completed", {
|
|
470
|
+
orderProductsAfterRecalculation: this.getOrderPricingSnapshotForDiagnostics()
|
|
471
|
+
});
|
|
472
|
+
}
|
|
310
473
|
this.store.order.applyDiscount();
|
|
311
474
|
this.normalizeDiscountedOrderPrices(
|
|
312
475
|
this.store.order.getDiscountList()
|
|
313
476
|
);
|
|
477
|
+
if (pricingDiagnosticsEnabled) {
|
|
478
|
+
this.logPricingDiagnostics("[VenueBooking] login discounts reapplied", {
|
|
479
|
+
discountList: this.store.order.getDiscountList(),
|
|
480
|
+
orderProductsAfterDiscount: this.getOrderPricingSnapshotForDiagnostics()
|
|
481
|
+
});
|
|
482
|
+
}
|
|
314
483
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
315
484
|
this.store.order.persistTempOrder();
|
|
485
|
+
if (pricingDiagnosticsEnabled) {
|
|
486
|
+
this.logPricingDiagnostics("[VenueBooking] login pricing summary persisted", {
|
|
487
|
+
summary: (_f = this.store.order.getTempOrder()) == null ? void 0 : _f.summary,
|
|
488
|
+
orderProducts: this.getOrderPricingSnapshotForDiagnostics()
|
|
489
|
+
});
|
|
490
|
+
}
|
|
316
491
|
await this.refreshItemRuleQuantityLimits();
|
|
317
492
|
await this.refreshCartValidationPassed();
|
|
318
|
-
await ((
|
|
493
|
+
await ((_i = (_h = (_g = this.core) == null ? void 0 : _g.effects) == null ? void 0 : _h.emit) == null ? void 0 : _i.call(_h, import_types.VenueBookingHooks.onSmartPricingUpdated, {
|
|
319
494
|
customerId: params.customerId
|
|
320
495
|
}));
|
|
496
|
+
if (pricingDiagnosticsEnabled) {
|
|
497
|
+
this.logPricingDiagnostics("[VenueBooking] login smart pricing update emitted", {
|
|
498
|
+
customerId: params.customerId,
|
|
499
|
+
cartValidation: this.store.cartValidation
|
|
500
|
+
});
|
|
501
|
+
}
|
|
321
502
|
})();
|
|
322
503
|
this.customerLoginRefreshInFlight = refreshTask;
|
|
323
504
|
try {
|
|
324
505
|
await refreshTask;
|
|
325
506
|
} catch (error) {
|
|
507
|
+
if (pricingDiagnosticsEnabled) {
|
|
508
|
+
this.logPricingDiagnostics("[VenueBooking] login smart pricing refresh failed", {
|
|
509
|
+
customerId: params.customerId,
|
|
510
|
+
error: this.serializeError(error),
|
|
511
|
+
productsLoaded: this.productsLoaded,
|
|
512
|
+
smartPricingProductCatalogCount: this.smartPricingProductCatalog.length,
|
|
513
|
+
resourceProductMapSize: this.resourceProductMap.size,
|
|
514
|
+
orderProducts: this.getOrderPricingSnapshotForDiagnostics()
|
|
515
|
+
});
|
|
516
|
+
}
|
|
326
517
|
throw error;
|
|
327
518
|
} finally {
|
|
328
519
|
if (this.customerLoginRefreshInFlight === refreshTask) {
|
|
@@ -1292,24 +1483,60 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1292
1483
|
throw error;
|
|
1293
1484
|
}
|
|
1294
1485
|
}
|
|
1486
|
+
/**
|
|
1487
|
+
* 接收 pisell2 VenueBooking 登录链路诊断日志。
|
|
1488
|
+
* 实际是否上报仍由 OS 内部 cacheId 白名单统一控制。
|
|
1489
|
+
*/
|
|
1490
|
+
logPricingDiagnosticsFromClient(params) {
|
|
1491
|
+
this.logPricingDiagnostics(
|
|
1492
|
+
`[VenueBooking][pisell2] ${String((params == null ? void 0 : params.title) || "diagnostic")}`,
|
|
1493
|
+
(params == null ? void 0 : params.payload) || {}
|
|
1494
|
+
);
|
|
1495
|
+
}
|
|
1295
1496
|
recalculateOrderPricesFromSmartPricing() {
|
|
1296
1497
|
var _a, _b;
|
|
1297
|
-
if (!this.store.order)
|
|
1498
|
+
if (!this.store.order) {
|
|
1499
|
+
this.logPricingDiagnostics("[VenueBooking] order smart pricing recalculation skipped", {
|
|
1500
|
+
reason: "order module is missing"
|
|
1501
|
+
});
|
|
1298
1502
|
return;
|
|
1503
|
+
}
|
|
1299
1504
|
const tempOrder = this.store.order.getTempOrder();
|
|
1300
|
-
if (!((_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.length))
|
|
1505
|
+
if (!((_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.length)) {
|
|
1506
|
+
this.logPricingDiagnostics("[VenueBooking] order smart pricing recalculation skipped", {
|
|
1507
|
+
reason: "temp order has no products"
|
|
1508
|
+
});
|
|
1301
1509
|
return;
|
|
1510
|
+
}
|
|
1302
1511
|
const now = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
1303
1512
|
const catalog = this.getAllProductsForSmartPricing();
|
|
1304
1513
|
const context = this.buildSmartPricingContext();
|
|
1514
|
+
const productDiagnostics = this.isPricingDiagnosticsEnabled() ? [] : null;
|
|
1305
1515
|
for (const product of tempOrder.products) {
|
|
1306
1516
|
if ((_b = product.metadata) == null ? void 0 : _b.venue_booking) {
|
|
1307
1517
|
const mappings = this.resourceProductMap.get(product.metadata.resource_id);
|
|
1308
|
-
if (!mappings || !mappings.length)
|
|
1518
|
+
if (!mappings || !mappings.length) {
|
|
1519
|
+
productDiagnostics == null ? void 0 : productDiagnostics.push({
|
|
1520
|
+
productId: product.product_id,
|
|
1521
|
+
resourceId: product.metadata.resource_id,
|
|
1522
|
+
originalSellingPrice: product.selling_price,
|
|
1523
|
+
result: "skipped",
|
|
1524
|
+
reason: "resourceProductMap has no mapping for resource"
|
|
1525
|
+
});
|
|
1309
1526
|
continue;
|
|
1527
|
+
}
|
|
1310
1528
|
const mapping = mappings.find((m) => Number(m.productId) === Number(product.product_id)) || mappings[0];
|
|
1311
|
-
if (!mapping)
|
|
1529
|
+
if (!mapping) {
|
|
1530
|
+
productDiagnostics == null ? void 0 : productDiagnostics.push({
|
|
1531
|
+
productId: product.product_id,
|
|
1532
|
+
resourceId: product.metadata.resource_id,
|
|
1533
|
+
originalSellingPrice: product.selling_price,
|
|
1534
|
+
result: "skipped",
|
|
1535
|
+
reason: "no product mapping selected",
|
|
1536
|
+
mappings
|
|
1537
|
+
});
|
|
1312
1538
|
continue;
|
|
1539
|
+
}
|
|
1313
1540
|
const slots = (0, import_slotMerge.expandMergedSlotToIndividual)(
|
|
1314
1541
|
product,
|
|
1315
1542
|
this.store.slotConfig.slotDurationMinutes
|
|
@@ -1340,6 +1567,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1340
1567
|
});
|
|
1341
1568
|
const merged = (0, import_slotMerge.mergeConsecutiveSlots)(updatedSlots);
|
|
1342
1569
|
if (merged.length === 1) {
|
|
1570
|
+
const previousSellingPrice = product == null ? void 0 : product.selling_price;
|
|
1343
1571
|
this.resetProductPriceForSmartPricing({
|
|
1344
1572
|
product,
|
|
1345
1573
|
price: merged[0].totalPrice,
|
|
@@ -1348,8 +1576,37 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1348
1576
|
productId: mapping.productId
|
|
1349
1577
|
})
|
|
1350
1578
|
});
|
|
1579
|
+
productDiagnostics == null ? void 0 : productDiagnostics.push({
|
|
1580
|
+
productId: product.product_id,
|
|
1581
|
+
resourceId: product.metadata.resource_id,
|
|
1582
|
+
result: "price reset",
|
|
1583
|
+
previousSellingPrice,
|
|
1584
|
+
finalSellingPrice: product.selling_price,
|
|
1585
|
+
mapping,
|
|
1586
|
+
slots: updatedSlots,
|
|
1587
|
+
merged,
|
|
1588
|
+
slotPriceMaps: Array.from(slotPriceMaps.entries()).map(([date, priceMap]) => ({
|
|
1589
|
+
date,
|
|
1590
|
+
entries: Array.from(priceMap.entries())
|
|
1591
|
+
}))
|
|
1592
|
+
});
|
|
1593
|
+
} else {
|
|
1594
|
+
productDiagnostics == null ? void 0 : productDiagnostics.push({
|
|
1595
|
+
productId: product.product_id,
|
|
1596
|
+
resourceId: product.metadata.resource_id,
|
|
1597
|
+
originalSellingPrice: product.selling_price,
|
|
1598
|
+
result: "skipped",
|
|
1599
|
+
reason: "expanded slots did not merge into exactly one group",
|
|
1600
|
+
mapping,
|
|
1601
|
+
slots: updatedSlots,
|
|
1602
|
+
merged
|
|
1603
|
+
});
|
|
1351
1604
|
}
|
|
1352
1605
|
} else if (product.product_id != null) {
|
|
1606
|
+
const catalogProduct = productDiagnostics ? catalog == null ? void 0 : catalog.find(
|
|
1607
|
+
(item) => Number(item == null ? void 0 : item.id) === Number(product == null ? void 0 : product.product_id)
|
|
1608
|
+
) : void 0;
|
|
1609
|
+
const previousSellingPrice = product == null ? void 0 : product.selling_price;
|
|
1353
1610
|
const smartPrice = (0, import_smartPricing.getPriceForProductAtDatetime)({
|
|
1354
1611
|
products: catalog,
|
|
1355
1612
|
context,
|
|
@@ -1361,8 +1618,43 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1361
1618
|
product,
|
|
1362
1619
|
price: smartPrice
|
|
1363
1620
|
});
|
|
1621
|
+
productDiagnostics == null ? void 0 : productDiagnostics.push({
|
|
1622
|
+
productId: product.product_id,
|
|
1623
|
+
result: "price reset",
|
|
1624
|
+
previousSellingPrice,
|
|
1625
|
+
resolvedSmartPrice: smartPrice,
|
|
1626
|
+
finalSellingPrice: product.selling_price,
|
|
1627
|
+
catalogProduct: catalogProduct ? {
|
|
1628
|
+
price: catalogProduct.price,
|
|
1629
|
+
sellingPrice: catalogProduct.selling_price,
|
|
1630
|
+
dataVariants: catalogProduct.data_variants
|
|
1631
|
+
} : null
|
|
1632
|
+
});
|
|
1633
|
+
} else {
|
|
1634
|
+
productDiagnostics == null ? void 0 : productDiagnostics.push({
|
|
1635
|
+
productId: product.product_id,
|
|
1636
|
+
originalSellingPrice: product.selling_price,
|
|
1637
|
+
result: "skipped",
|
|
1638
|
+
reason: "product_id is missing"
|
|
1639
|
+
});
|
|
1364
1640
|
}
|
|
1365
1641
|
}
|
|
1642
|
+
if (productDiagnostics) {
|
|
1643
|
+
this.logPricingDiagnostics("[VenueBooking] order smart pricing recalculation detail", {
|
|
1644
|
+
now,
|
|
1645
|
+
context: {
|
|
1646
|
+
customerId: context.customerId,
|
|
1647
|
+
availableWalletIds: context.availableWalletIds,
|
|
1648
|
+
channel: context.channel,
|
|
1649
|
+
businessCode: context.businessCode,
|
|
1650
|
+
orderType: context.orderType,
|
|
1651
|
+
hasEvaluator: !!context.evaluator
|
|
1652
|
+
},
|
|
1653
|
+
catalogCount: catalog.length,
|
|
1654
|
+
resourceProductMapSize: this.resourceProductMap.size,
|
|
1655
|
+
productDiagnostics
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1366
1658
|
}
|
|
1367
1659
|
/**
|
|
1368
1660
|
* DataVariant 重算价格后,同步刷新订单展示、Rules 与 Summary 共用的价格口径。
|
|
@@ -2086,6 +2378,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
2086
2378
|
}
|
|
2087
2379
|
};
|
|
2088
2380
|
var VenueBookingImpl = _VenueBookingImpl;
|
|
2381
|
+
VenueBookingImpl.PRICING_DEBUG_CACHE_ID = "031596279011848516";
|
|
2089
2382
|
VenueBookingImpl.OPEN_DATA_CACHE_TTL = 5 * 60 * 1e3;
|
|
2090
2383
|
VenueBookingImpl.PISELL1_LOGIN_SUCCESS = "pisell1.login.success";
|
|
2091
2384
|
// ─── UI 状态缓存(按 cacheId 分桶,sessionStorage) ───
|