@pisell/pisellos 0.10.81 → 0.10.83
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/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +5 -0
- package/dist/modules/ResourcePlanner/planner.js +2 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/BookingTicket/index.js +36 -31
- package/dist/solution/ScanOrder/index.d.ts +0 -1
- package/dist/solution/ScanOrder/index.js +62 -59
- package/dist/solution/ScanOrder/types.d.ts +2 -0
- package/dist/solution/ScanOrder/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +12 -1
- package/dist/solution/UnifiedBookingSales/index.js +1471 -1143
- package/dist/solution/UnifiedBookingSales/types.d.ts +6 -0
- package/dist/solution/VenueBooking/index.js +111 -104
- package/dist/solution/VenueBooking/types.d.ts +2 -0
- package/dist/solution/VenueBooking/types.js +3 -1
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +6 -1
- package/dist/utils/hostLogger.d.ts +10 -0
- package/dist/utils/hostLogger.js +20 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -0
- package/lib/modules/ResourcePlanner/planner.js +2 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/BookingTicket/index.js +5 -4
- package/lib/solution/ScanOrder/index.d.ts +0 -1
- package/lib/solution/ScanOrder/index.js +47 -41
- package/lib/solution/ScanOrder/types.d.ts +2 -0
- package/lib/solution/ScanOrder/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +12 -1
- package/lib/solution/UnifiedBookingSales/index.js +249 -29
- package/lib/solution/UnifiedBookingSales/types.d.ts +6 -0
- package/lib/solution/VenueBooking/index.js +38 -47
- package/lib/solution/VenueBooking/types.d.ts +2 -0
- package/lib/solution/VenueBooking/types.js +3 -1
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +6 -1
- package/lib/utils/hostLogger.d.ts +10 -0
- package/lib/utils/hostLogger.js +25 -0
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -440,9 +440,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
440
440
|
channel = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel;
|
|
441
441
|
_context7.next = 5;
|
|
442
442
|
return this.request.post('/product/query', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
443
|
+
// Bypass the endpoint cache when seeding this pool; subsequent reads still
|
|
444
|
+
// reuse the venue catalog session's single local snapshot.
|
|
445
|
+
force_ignore_cache_flag: 1,
|
|
443
446
|
// The customer endpoint otherwise filters out future/variant members.
|
|
444
447
|
open_quotation: 0,
|
|
445
448
|
open_bundle: 1,
|
|
449
|
+
// Preserve the same deposit source data used by the existing sales flow.
|
|
450
|
+
open_deposit: 1,
|
|
446
451
|
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
|
|
447
452
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
448
453
|
with_schedule: 1,
|
|
@@ -171,6 +171,7 @@ function resolveCutOffPolicyIssue(policy) {
|
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
function addLeadWindow(base, unit, unitType, _timezoneName) {
|
|
174
|
+
// Calendar-day lead times retain the current local hour, minute and second.
|
|
174
175
|
if (unitType === 'days') return addLocalCalendarDays(base, unit);
|
|
175
176
|
if (unitType === 'hours') return addLocalHours(base, unit);
|
|
176
177
|
return addLocalMinutes(base, unit);
|
|
@@ -1925,7 +1926,7 @@ export function queryAvailabilityProjection(projection, request) {
|
|
|
1925
1926
|
var _extractFixedOffsetMi6, _request$productIds2;
|
|
1926
1927
|
var runtimeOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1927
1928
|
var normalizedPartySize = normalizePartySize(request.partySize);
|
|
1928
|
-
var evaluatedAt = formatDateTime(localDateToScalar(new Date()), projection.meta.timezone, (_extractFixedOffsetMi6 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi6 !== void 0 ? _extractFixedOffsetMi6 : captureRuntimeOffsetMinutes());
|
|
1929
|
+
var evaluatedAt = runtimeOptions.evaluatedAt || formatDateTime(localDateToScalar(new Date()), projection.meta.timezone, (_extractFixedOffsetMi6 = extractFixedOffsetMinutes(projection.meta.now)) !== null && _extractFixedOffsetMi6 !== void 0 ? _extractFixedOffsetMi6 : captureRuntimeOffsetMinutes());
|
|
1929
1930
|
if (request.target === 'time') {
|
|
1930
1931
|
assertTimeCandidates(request);
|
|
1931
1932
|
assertRangesWithinProjection(projection, request.candidates);
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -373,7 +373,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
373
373
|
};
|
|
374
374
|
setOtherData(key: string, value: any): void;
|
|
375
375
|
getOtherData(key: string): any;
|
|
376
|
-
getProductTypeById(id: number): Promise<"
|
|
376
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
377
377
|
/**
|
|
378
378
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
379
379
|
*
|
|
@@ -479,19 +479,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
479
479
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
480
480
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
481
481
|
*/
|
|
482
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
483
|
-
action: "reloadCatalog";
|
|
484
|
-
} | {
|
|
485
|
-
action: "add";
|
|
486
|
-
cacheItem: any;
|
|
487
|
-
} | {
|
|
488
|
-
action: "requiresDetail";
|
|
489
|
-
payload: AddProductRequiresDetailPayload;
|
|
490
|
-
} | {
|
|
491
|
-
action: "requiresBookingEdit";
|
|
492
|
-
cacheItem: any;
|
|
493
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
494
|
-
};
|
|
482
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
495
483
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
496
484
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
497
485
|
/**
|
|
@@ -594,35 +594,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
594
594
|
key: "configureIdGeneratorFromOpenData",
|
|
595
595
|
value: function () {
|
|
596
596
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
597
|
-
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
597
|
+
var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
598
598
|
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
599
599
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
600
600
|
while (1) switch (_context9.prev = _context9.next) {
|
|
601
601
|
case 0:
|
|
602
|
+
if (!isCustomerUserPlatform((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform)) {
|
|
603
|
+
_context9.next = 2;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
return _context9.abrupt("return");
|
|
607
|
+
case 2:
|
|
602
608
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
603
609
|
this.setPaymentNumberDevicePrefix(null);
|
|
604
|
-
idGenerator = this.getIdGeneratorPlugin();
|
|
605
|
-
if (idGenerator
|
|
606
|
-
_context9.next =
|
|
610
|
+
idGenerator = this.getIdGeneratorPlugin(); // Optional host capability. Do not warn or cache absence: POS may register it later.
|
|
611
|
+
if (!(typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.configure) !== 'function')) {
|
|
612
|
+
_context9.next = 6;
|
|
607
613
|
break;
|
|
608
614
|
}
|
|
609
|
-
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
610
615
|
return _context9.abrupt("return");
|
|
611
|
-
case
|
|
616
|
+
case 6:
|
|
612
617
|
openDataConfig = null;
|
|
613
|
-
_context9.prev =
|
|
614
|
-
_context9.next =
|
|
618
|
+
_context9.prev = 7;
|
|
619
|
+
_context9.next = 10;
|
|
615
620
|
return this.loadOpenDataConfig();
|
|
616
|
-
case
|
|
621
|
+
case 10:
|
|
617
622
|
openDataConfig = _context9.sent;
|
|
618
|
-
_context9.next =
|
|
623
|
+
_context9.next = 17;
|
|
619
624
|
break;
|
|
620
|
-
case
|
|
621
|
-
_context9.prev =
|
|
622
|
-
_context9.t0 = _context9["catch"](
|
|
625
|
+
case 13:
|
|
626
|
+
_context9.prev = 13;
|
|
627
|
+
_context9.t0 = _context9["catch"](7);
|
|
623
628
|
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context9.t0);
|
|
624
629
|
return _context9.abrupt("return");
|
|
625
|
-
case
|
|
630
|
+
case 17:
|
|
626
631
|
// if (!openDataConfig) return;
|
|
627
632
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
628
633
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
@@ -633,21 +638,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
633
638
|
"type": "start_time",
|
|
634
639
|
"time": "00:00"
|
|
635
640
|
};
|
|
636
|
-
_context9.next =
|
|
641
|
+
_context9.next = 25;
|
|
637
642
|
return this.getShortNumberOrDeviceId();
|
|
638
|
-
case
|
|
643
|
+
case 25:
|
|
639
644
|
deviceId = _context9.sent;
|
|
640
645
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
641
646
|
businessCode = this.getBookingTicketBusinessCode();
|
|
642
647
|
if (businessCode) {
|
|
643
|
-
_context9.next =
|
|
648
|
+
_context9.next = 31;
|
|
644
649
|
break;
|
|
645
650
|
}
|
|
646
651
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
647
652
|
return _context9.abrupt("return");
|
|
648
|
-
case
|
|
649
|
-
_context9.prev =
|
|
650
|
-
_context9.next =
|
|
653
|
+
case 31:
|
|
654
|
+
_context9.prev = 31;
|
|
655
|
+
_context9.next = 34;
|
|
651
656
|
return idGenerator.configure({
|
|
652
657
|
biz: businessCode,
|
|
653
658
|
config: {
|
|
@@ -662,18 +667,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
662
667
|
shopOrderPrefix: shopOrderPrefix
|
|
663
668
|
}
|
|
664
669
|
});
|
|
665
|
-
case
|
|
666
|
-
_context9.next =
|
|
670
|
+
case 34:
|
|
671
|
+
_context9.next = 39;
|
|
667
672
|
break;
|
|
668
|
-
case
|
|
669
|
-
_context9.prev =
|
|
670
|
-
_context9.t1 = _context9["catch"](
|
|
673
|
+
case 36:
|
|
674
|
+
_context9.prev = 36;
|
|
675
|
+
_context9.t1 = _context9["catch"](31);
|
|
671
676
|
console.warn('[BookingTicket] idGenerator 配置失败', _context9.t1);
|
|
672
|
-
case
|
|
677
|
+
case 39:
|
|
673
678
|
case "end":
|
|
674
679
|
return _context9.stop();
|
|
675
680
|
}
|
|
676
|
-
}, _callee9, this, [[
|
|
681
|
+
}, _callee9, this, [[7, 13], [31, 36]]);
|
|
677
682
|
}));
|
|
678
683
|
function configureIdGeneratorFromOpenData() {
|
|
679
684
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -1838,8 +1843,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1838
1843
|
}, {
|
|
1839
1844
|
key: "getCustomerContactScope",
|
|
1840
1845
|
value: function getCustomerContactScope() {
|
|
1841
|
-
var _this$
|
|
1842
|
-
return JSON.stringify([this.getPickupTimingScope(), (_this$
|
|
1846
|
+
var _this$otherParams6, _this$otherParams7, _this$otherParams8;
|
|
1847
|
+
return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.shop_id, (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.tenantId]);
|
|
1843
1848
|
}
|
|
1844
1849
|
}, {
|
|
1845
1850
|
key: "getCustomerContactOrderKey",
|
|
@@ -1906,7 +1911,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1906
1911
|
key: "prefillOrderCustomerContactInfo",
|
|
1907
1912
|
value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
|
|
1908
1913
|
var _order$_extend2,
|
|
1909
|
-
_this$
|
|
1914
|
+
_this$otherParams9,
|
|
1910
1915
|
_this4 = this;
|
|
1911
1916
|
var order = this.getTempOrder();
|
|
1912
1917
|
var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
|
|
@@ -1922,7 +1927,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1922
1927
|
}
|
|
1923
1928
|
// A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
|
|
1924
1929
|
if (customer.contacts_info !== undefined) return;
|
|
1925
|
-
var userPlatform = isCustomerUserPlatform((_this$
|
|
1930
|
+
var userPlatform = isCustomerUserPlatform((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform);
|
|
1926
1931
|
var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
|
|
1927
1932
|
var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
|
|
1928
1933
|
return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
|
|
@@ -56,7 +56,6 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
|
|
|
56
56
|
private refreshOrderMarketingAfterLogin;
|
|
57
57
|
constructor(name?: string, version?: string);
|
|
58
58
|
protected getRegisteredModuleNames(): readonly string[];
|
|
59
|
-
protected createSubModule(moduleName: string): Module | null;
|
|
60
59
|
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
61
60
|
getCacheId(): string | undefined;
|
|
62
61
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
@@ -33,7 +33,7 @@ import { AccountHooks } from "../../modules/Account/types";
|
|
|
33
33
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
34
34
|
import Decimal from 'decimal.js';
|
|
35
35
|
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, filterProductsForScanOrderMore, findReservationRuleProductByResourceId, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
|
|
36
|
-
import {
|
|
36
|
+
import { writeHostLog } from "../../utils/hostLogger";
|
|
37
37
|
import { ProductList } from "../../modules/ProductList";
|
|
38
38
|
import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
|
|
39
39
|
import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
@@ -89,10 +89,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
89
89
|
_createClass(ScanOrderImpl, [{
|
|
90
90
|
key: "getScanOrderLoggerContext",
|
|
91
91
|
value: function getScanOrderLoggerContext() {
|
|
92
|
+
var _this$window, _this$otherParams, _this$otherParams2, _this$otherParams3;
|
|
92
93
|
return {
|
|
93
94
|
cacheId: this.cacheId,
|
|
94
95
|
solutionName: this.name,
|
|
95
|
-
moduleName: 'scanOrder'
|
|
96
|
+
moduleName: 'scanOrder',
|
|
97
|
+
host: (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.location) === null || _this$window === void 0 ? void 0 : _this$window.host,
|
|
98
|
+
platform: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform,
|
|
99
|
+
channel: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel,
|
|
100
|
+
businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode
|
|
96
101
|
};
|
|
97
102
|
}
|
|
98
103
|
}, {
|
|
@@ -148,7 +153,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
148
153
|
key: "addScanOrderLog",
|
|
149
154
|
value: function () {
|
|
150
155
|
var _addScanOrderLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
151
|
-
var payload
|
|
156
|
+
var _params$payload;
|
|
157
|
+
var payload, extra;
|
|
152
158
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
153
159
|
while (1) switch (_context.prev = _context.next) {
|
|
154
160
|
case 0:
|
|
@@ -156,25 +162,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
156
162
|
cacheId: this.cacheId
|
|
157
163
|
}, params.payload || {});
|
|
158
164
|
extra = _objectSpread({}, params.extra || {});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
writeHostLog(this.core, _objectSpread(_objectSpread({
|
|
166
|
+
type: params.level || 'info',
|
|
167
|
+
title: params.title
|
|
168
|
+
}, params.timestamp ? {
|
|
169
|
+
date: params.timestamp
|
|
170
|
+
} : {}), {}, {
|
|
171
|
+
metadata: {
|
|
172
|
+
module: 'scanOrder',
|
|
173
|
+
action: ((_params$payload = params.payload) === null || _params$payload === void 0 ? void 0 : _params$payload.method) || 'addLog',
|
|
166
174
|
payload: payload,
|
|
167
|
-
extra: extra
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return _context.abrupt("return");
|
|
171
|
-
case 6:
|
|
172
|
-
_context.next = 8;
|
|
173
|
-
return logger.addLog(_objectSpread(_objectSpread({}, params), {}, {
|
|
174
|
-
payload: payload,
|
|
175
|
-
extra: extra
|
|
175
|
+
extra: extra,
|
|
176
|
+
context: this.getScanOrderLoggerContext()
|
|
177
|
+
}
|
|
176
178
|
}));
|
|
177
|
-
case
|
|
179
|
+
case 3:
|
|
178
180
|
case "end":
|
|
179
181
|
return _context.stop();
|
|
180
182
|
}
|
|
@@ -434,15 +436,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
434
436
|
}, {
|
|
435
437
|
key: "getRegisteredModuleNames",
|
|
436
438
|
value: function getRegisteredModuleNames() {
|
|
437
|
-
return ['
|
|
438
|
-
}
|
|
439
|
-
}, {
|
|
440
|
-
key: "createSubModule",
|
|
441
|
-
value: function createSubModule(moduleName) {
|
|
442
|
-
if (moduleName === 'scanOrderLogger') {
|
|
443
|
-
return createModule('scanOrderLogger', this.name);
|
|
444
|
-
}
|
|
445
|
-
return _get(_getPrototypeOf(ScanOrderImpl.prototype), "createSubModule", this).call(this, moduleName);
|
|
439
|
+
return ['products', 'order', 'salesSummary', 'schedule'];
|
|
446
440
|
}
|
|
447
441
|
|
|
448
442
|
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
@@ -455,10 +449,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
455
449
|
key: "initialize",
|
|
456
450
|
value: function () {
|
|
457
451
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
|
|
458
|
-
var _options$otherParams, _this$
|
|
452
|
+
var _options$otherParams, _this$otherParams4, _this$otherParams5;
|
|
459
453
|
var options,
|
|
460
|
-
_this$otherParams4,
|
|
461
|
-
_this$otherParams5,
|
|
462
454
|
_this$store$order,
|
|
463
455
|
_this$store$order2,
|
|
464
456
|
_args6 = arguments;
|
|
@@ -466,14 +458,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
466
458
|
while (1) switch (_context6.prev = _context6.next) {
|
|
467
459
|
case 0:
|
|
468
460
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
461
|
+
this.core = core;
|
|
462
|
+
this.otherParams = options.otherParams || {};
|
|
463
|
+
this.cacheId = this.otherParams.cacheId;
|
|
469
464
|
this.logMethodStart('initialize');
|
|
470
465
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
471
466
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
472
467
|
this.store.status = 'initializing';
|
|
473
468
|
this.store.error = null;
|
|
474
|
-
this.otherParams =
|
|
475
|
-
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
476
|
-
this.itemRuleRuntimeConfig = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.scanOrderItemRule) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.itemRule) || {};
|
|
469
|
+
this.itemRuleRuntimeConfig = ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderItemRule) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.itemRule) || {};
|
|
477
470
|
this.itemRuleConfigs = [];
|
|
478
471
|
this.itemRuleConfigsPromise = null;
|
|
479
472
|
this.itemRulePrefillApplied = false;
|
|
@@ -482,19 +475,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
482
475
|
passed: null,
|
|
483
476
|
failures: []
|
|
484
477
|
};
|
|
485
|
-
_context6.next =
|
|
478
|
+
_context6.next = 17;
|
|
486
479
|
return _get(_getPrototypeOf(ScanOrderImpl.prototype), "initialize", this).call(this, core, options);
|
|
487
|
-
case
|
|
488
|
-
if (this.store.scanOrderLogger) {
|
|
489
|
-
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderLoggerProvider) || 'feishu');
|
|
490
|
-
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.scanOrderLoggerConfig) || {
|
|
491
|
-
feishu: {
|
|
492
|
-
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
|
|
493
|
-
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
|
|
497
|
-
}
|
|
480
|
+
case 17:
|
|
498
481
|
this.registerCustomerLoginListeners();
|
|
499
482
|
_context6.prev = 18;
|
|
500
483
|
_context6.next = 21;
|
|
@@ -519,7 +502,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
519
502
|
case 30:
|
|
520
503
|
_context6.prev = 30;
|
|
521
504
|
_context6.t0 = _context6["catch"](25);
|
|
522
|
-
|
|
505
|
+
void this.addScanOrderLog({
|
|
506
|
+
level: 'warning',
|
|
507
|
+
title: '[ScanOrder] loadAllSchedule failed; operating_hours check skipped',
|
|
508
|
+
payload: {
|
|
509
|
+
method: 'loadAllSchedule',
|
|
510
|
+
error: this.serializeError(_context6.t0)
|
|
511
|
+
}
|
|
512
|
+
});
|
|
523
513
|
case 33:
|
|
524
514
|
_context6.next = 35;
|
|
525
515
|
return this.refreshItemRuleQuantityLimits();
|
|
@@ -533,19 +523,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
533
523
|
this.logMethodSuccess('initialize', {
|
|
534
524
|
status: this.store.status
|
|
535
525
|
});
|
|
536
|
-
_context6.next =
|
|
526
|
+
_context6.next = 47;
|
|
537
527
|
break;
|
|
538
528
|
case 41:
|
|
539
529
|
_context6.prev = 41;
|
|
540
530
|
_context6.t1 = _context6["catch"](18);
|
|
541
531
|
this.store.status = 'error';
|
|
542
532
|
this.store.error = _context6.t1 instanceof Error ? _context6.t1.message : '初始化失败';
|
|
543
|
-
console.error('[ScanOrder] 初始化失败', _context6.t1);
|
|
544
533
|
this.logMethodError('initialize', _context6.t1, {
|
|
545
534
|
status: this.store.status
|
|
546
535
|
});
|
|
547
536
|
throw _context6.t1;
|
|
548
|
-
case
|
|
537
|
+
case 47:
|
|
549
538
|
case "end":
|
|
550
539
|
return _context6.stop();
|
|
551
540
|
}
|
|
@@ -3244,9 +3233,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3244
3233
|
}, {
|
|
3245
3234
|
key: "readUIStateBucket",
|
|
3246
3235
|
value: function readUIStateBucket() {
|
|
3247
|
-
var _this$
|
|
3236
|
+
var _this$window2;
|
|
3248
3237
|
var key = this.getUIStateBucketKey();
|
|
3249
|
-
if (!key || !((_this$
|
|
3238
|
+
if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.localStorage)) return {};
|
|
3250
3239
|
try {
|
|
3251
3240
|
var raw = this.window.localStorage.getItem(key) || '{}';
|
|
3252
3241
|
var parsed = JSON.parse(raw);
|
|
@@ -3258,13 +3247,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3258
3247
|
}, {
|
|
3259
3248
|
key: "writeUIStateBucket",
|
|
3260
3249
|
value: function writeUIStateBucket(bucket) {
|
|
3261
|
-
var _this$
|
|
3250
|
+
var _this$window3;
|
|
3262
3251
|
var key = this.getUIStateBucketKey();
|
|
3263
|
-
if (!key || !((_this$
|
|
3252
|
+
if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.localStorage)) return;
|
|
3264
3253
|
try {
|
|
3265
3254
|
this.window.localStorage.setItem(key, JSON.stringify(bucket));
|
|
3266
3255
|
} catch (error) {
|
|
3267
|
-
|
|
3256
|
+
void this.addScanOrderLog({
|
|
3257
|
+
level: 'warning',
|
|
3258
|
+
title: '[ScanOrder] writeUIStateBucket failed',
|
|
3259
|
+
payload: {
|
|
3260
|
+
method: 'writeUIStateBucket',
|
|
3261
|
+
error: this.serializeError(error)
|
|
3262
|
+
}
|
|
3263
|
+
});
|
|
3268
3264
|
}
|
|
3269
3265
|
}
|
|
3270
3266
|
}, {
|
|
@@ -3297,13 +3293,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3297
3293
|
}, {
|
|
3298
3294
|
key: "clearUIState",
|
|
3299
3295
|
value: function clearUIState() {
|
|
3300
|
-
var _this$
|
|
3296
|
+
var _this$window4;
|
|
3301
3297
|
var key = this.getUIStateBucketKey();
|
|
3302
|
-
if (!key || !((_this$
|
|
3298
|
+
if (!key || !((_this$window4 = this.window) !== null && _this$window4 !== void 0 && _this$window4.localStorage)) return;
|
|
3303
3299
|
try {
|
|
3304
3300
|
this.window.localStorage.removeItem(key);
|
|
3305
3301
|
} catch (error) {
|
|
3306
|
-
|
|
3302
|
+
void this.addScanOrderLog({
|
|
3303
|
+
level: 'warning',
|
|
3304
|
+
title: '[ScanOrder] clearUIState failed',
|
|
3305
|
+
payload: {
|
|
3306
|
+
method: 'clearUIState',
|
|
3307
|
+
error: this.serializeError(error)
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3307
3310
|
}
|
|
3308
3311
|
}
|
|
3309
3312
|
}, {
|
|
@@ -308,6 +308,7 @@ export interface ScanOrderState {
|
|
|
308
308
|
products?: ProductList;
|
|
309
309
|
order?: OrderModule;
|
|
310
310
|
salesSummary?: SalesSummaryModule;
|
|
311
|
+
/** @deprecated Retained for compatibility; solution logs use app.getApp().logger. */
|
|
311
312
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
312
313
|
schedule?: ScheduleModule;
|
|
313
314
|
itemRuleQuantityLimits: QuantityLimitResult[];
|
|
@@ -317,6 +318,7 @@ export interface ScanOrderState {
|
|
|
317
318
|
};
|
|
318
319
|
entryPaxNumber: number | null;
|
|
319
320
|
}
|
|
321
|
+
/** @deprecated Configure the host app logger; ScanOrder no longer selects a provider. */
|
|
320
322
|
export interface ScanOrderLoggerRuntimeConfig {
|
|
321
323
|
provider?: ScanOrderLoggerProviderType;
|
|
322
324
|
providerConfig?: ScanOrderLoggerProviderConfig;
|
|
@@ -31,4 +31,6 @@ export var ScanOrderHooks = /*#__PURE__*/function (ScanOrderHooks) {
|
|
|
31
31
|
|
|
32
32
|
/** `/order/resource/occupy-detail` 单条 `occupy_details[i]` */
|
|
33
33
|
|
|
34
|
+
/** @deprecated Configure the host app logger; ScanOrder no longer selects a provider. */
|
|
35
|
+
|
|
34
36
|
/** ScanOrder.scanCode 对外的轻量结果(不含 discountList,UI 在 resolve 后调 getDiscountList) */
|
|
@@ -97,6 +97,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
97
97
|
private allergyItemRuleConfigs;
|
|
98
98
|
private allergyItemRuleConfigsPromise;
|
|
99
99
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
100
|
+
private initializeUnifiedSalesRuntime;
|
|
100
101
|
protected getSubmitOrderSalesChannel(): string;
|
|
101
102
|
/** Only the explicit Kiosk Sales consumer entry enables this policy; POS stays unchanged. */
|
|
102
103
|
protected isBusinessAvailabilityEnabled(): boolean;
|
|
@@ -108,6 +109,9 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
108
109
|
protected getSubModuleHooks(moduleName: string): any;
|
|
109
110
|
private createAvailabilityFacadeError;
|
|
110
111
|
private getAvailabilityScopeDescriptor;
|
|
112
|
+
/** Kiosk keeps its device/channel semantics; only explicit Venue templates opt in. */
|
|
113
|
+
private isVenueKioskPlatform;
|
|
114
|
+
private supportsVenueSelectionSnapshot;
|
|
111
115
|
private normalizeAvailabilityIdList;
|
|
112
116
|
private normalizeAvailabilityStringList;
|
|
113
117
|
private normalizeAvailabilityPrepareDescriptor;
|
|
@@ -127,6 +131,9 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
127
131
|
private cloneAvailabilityPrepareParams;
|
|
128
132
|
private getAvailabilityDurationCandidateAnchorAt;
|
|
129
133
|
private createAvailabilityContextRef;
|
|
134
|
+
private getSolutionLogContext;
|
|
135
|
+
private writeSolutionLog;
|
|
136
|
+
private logSolutionFailure;
|
|
130
137
|
private emitAvailabilityDiagnostic;
|
|
131
138
|
private touchAvailabilityContext;
|
|
132
139
|
private touchAvailabilityProjection;
|
|
@@ -329,11 +336,14 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
329
336
|
private buildAvailabilityProjectionSnapshot;
|
|
330
337
|
private getSharedPreparedAvailabilitySnapshot;
|
|
331
338
|
private refreshAvailabilityContextProjection;
|
|
339
|
+
/** Read an existing customer selection without refreshing its clock or occupancy snapshot. */
|
|
340
|
+
private getCustomerSelectionProjection;
|
|
332
341
|
private ensureAvailabilityContextProjection;
|
|
333
342
|
private tryAcquireAvailabilityCommitLock;
|
|
334
343
|
private releaseAvailabilityCommitLock;
|
|
335
344
|
/** IO boundary: loads catalog, schedules, resources, occupancies, and registers one context. */
|
|
336
345
|
prepareAvailabilityProjection(params: UnifiedBookingSalesPrepareAvailabilityProjectionParams): Promise<AvailabilityContextRef>;
|
|
346
|
+
private prepareAvailabilityContext;
|
|
337
347
|
/** Candidate calculation over the current context projection and runtime minute. */
|
|
338
348
|
getProductTimeRanges(contextId: string, request?: GetProductTimeRangesRequest): Promise<ContextualProductTimeRangeGroup[]>;
|
|
339
349
|
/** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
|
|
@@ -344,7 +354,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
344
354
|
private assertAvailabilityCommitWriteCAS;
|
|
345
355
|
private findProductLineByUid;
|
|
346
356
|
private findLinkedBooking;
|
|
347
|
-
/**
|
|
357
|
+
/** Customer snapshot writes defer availability to checkout; other callers retain cache revalidation. */
|
|
348
358
|
commitAvailabilitySelection(contextId: string, params: ContextualCommitAvailabilitySelectionParams): Promise<UnifiedBookingSalesCommitAvailabilitySelectionResult>;
|
|
359
|
+
private commitAvailabilitySelectionWithLock;
|
|
349
360
|
}
|
|
350
361
|
export declare const UnifiedBookingSales: typeof UnifiedBookingSalesImpl;
|