@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
|
@@ -59,6 +59,8 @@ export declare enum UnifiedBookingSalesHooks {
|
|
|
59
59
|
}
|
|
60
60
|
export interface UnifiedBookingSalesOtherParams extends Record<string, any> {
|
|
61
61
|
enableSessionStoragePersist?: boolean;
|
|
62
|
+
/** Explicitly opts the real Kiosk host into the Tickets/Party self-service contracts. */
|
|
63
|
+
venueBookingMode?: 'tickets' | 'party';
|
|
62
64
|
}
|
|
63
65
|
export type UnifiedBookingSalesAllergyRequirement = AllergyRequirement;
|
|
64
66
|
export interface UnifiedBookingSalesResolveProductAllergyRequirementParams {
|
|
@@ -145,6 +147,8 @@ export type ContextualAvailabilityQuery = Omit<Extract<AvailabilityQuery, {
|
|
|
145
147
|
target: 'resource';
|
|
146
148
|
}>, 'selectedRanges'> & {
|
|
147
149
|
selectedRanges: ContextualProductTimeRange[];
|
|
150
|
+
/** PC/H5 and explicitly enabled Venue Kiosk templates retain the already-selected time. */
|
|
151
|
+
customerSelectionSnapshot?: boolean;
|
|
148
152
|
});
|
|
149
153
|
export type ContextualTimeAvailabilityItem = Omit<TimeAvailabilityItem, keyof ProductTimeRange> & ContextualProductTimeRange;
|
|
150
154
|
export interface ContextualTimeAvailabilityGroup extends Omit<TimeAvailabilityGroup, 'times'> {
|
|
@@ -210,6 +214,8 @@ export interface UnifiedBookingSalesAddRetailProductParams {
|
|
|
210
214
|
}
|
|
211
215
|
export interface ContextualCommitAvailabilitySelectionParams {
|
|
212
216
|
mode: 'add' | 'edit' | 'replace';
|
|
217
|
+
/** PC/H5 and enabled Venue Kiosk templates write the selected snapshot; checkout is authoritative. */
|
|
218
|
+
customerSelectionSnapshot?: boolean;
|
|
213
219
|
/** Local UI intent guard, checked again immediately before the Order mutation. */
|
|
214
220
|
availabilityCommitGuard?: () => void;
|
|
215
221
|
productLineUid?: string;
|
|
@@ -34,6 +34,7 @@ import { BaseSalesImpl } from "../BaseSales";
|
|
|
34
34
|
import { DEFAULT_SLOT_CONFIG, VenueBookingHooks } from "./types";
|
|
35
35
|
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, createEmptySummary, getProductIdentityIndex, getSafeProductNum, normalizeOrderProduct, normalizeItemRuleStrategies, toNonNegativeInt, toPriceString } from "./utils";
|
|
36
36
|
import { createModule } from "../BookingByStep/types";
|
|
37
|
+
import { writeHostLog } from "../../utils/hostLogger";
|
|
37
38
|
import { ProductList } from "../../modules/ProductList";
|
|
38
39
|
import { DateModule } from "../../modules/Date";
|
|
39
40
|
import { ScheduleModule } from "../../modules/Schedule";
|
|
@@ -121,10 +122,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
121
122
|
_createClass(VenueBookingImpl, [{
|
|
122
123
|
key: "getLoggerContext",
|
|
123
124
|
value: function getLoggerContext() {
|
|
125
|
+
var _this$window, _this$otherParams, _this$otherParams2, _this$otherParams3;
|
|
124
126
|
return {
|
|
125
127
|
cacheId: this.cacheId,
|
|
126
128
|
solutionName: this.name,
|
|
127
|
-
moduleName: 'venueBooking'
|
|
129
|
+
moduleName: 'venueBooking',
|
|
130
|
+
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,
|
|
131
|
+
platform: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform,
|
|
132
|
+
channel: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel,
|
|
133
|
+
businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode
|
|
128
134
|
};
|
|
129
135
|
}
|
|
130
136
|
}, {
|
|
@@ -180,7 +186,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
180
186
|
key: "addVenueBookingLog",
|
|
181
187
|
value: function () {
|
|
182
188
|
var _addVenueBookingLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
183
|
-
var payload
|
|
189
|
+
var _params$payload;
|
|
190
|
+
var payload, extra;
|
|
184
191
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
185
192
|
while (1) switch (_context.prev = _context.next) {
|
|
186
193
|
case 0:
|
|
@@ -188,25 +195,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
188
195
|
cacheId: this.cacheId
|
|
189
196
|
}, params.payload || {});
|
|
190
197
|
extra = _objectSpread({}, params.extra || {});
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
writeHostLog(this.core, _objectSpread(_objectSpread({
|
|
199
|
+
type: params.level || 'info',
|
|
200
|
+
title: params.title
|
|
201
|
+
}, params.timestamp ? {
|
|
202
|
+
date: params.timestamp
|
|
203
|
+
} : {}), {}, {
|
|
204
|
+
metadata: {
|
|
205
|
+
module: 'venueBooking',
|
|
206
|
+
action: ((_params$payload = params.payload) === null || _params$payload === void 0 ? void 0 : _params$payload.method) || 'addLog',
|
|
198
207
|
payload: payload,
|
|
199
|
-
extra: extra
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
return _context.abrupt("return");
|
|
203
|
-
case 6:
|
|
204
|
-
_context.next = 8;
|
|
205
|
-
return logger.addLog(_objectSpread(_objectSpread({}, params), {}, {
|
|
206
|
-
payload: payload,
|
|
207
|
-
extra: extra
|
|
208
|
+
extra: extra,
|
|
209
|
+
context: this.getLoggerContext()
|
|
210
|
+
}
|
|
208
211
|
}));
|
|
209
|
-
case
|
|
212
|
+
case 3:
|
|
210
213
|
case "end":
|
|
211
214
|
return _context.stop();
|
|
212
215
|
}
|
|
@@ -282,14 +285,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
282
285
|
}, {
|
|
283
286
|
key: "getRegisteredModuleNames",
|
|
284
287
|
value: function getRegisteredModuleNames() {
|
|
285
|
-
return ['
|
|
288
|
+
return ['products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
|
|
286
289
|
}
|
|
287
290
|
}, {
|
|
288
291
|
key: "createSubModule",
|
|
289
292
|
value: function createSubModule(moduleName) {
|
|
290
293
|
switch (moduleName) {
|
|
291
|
-
case 'scanOrderLogger':
|
|
292
|
-
return createModule('scanOrderLogger', this.name);
|
|
293
294
|
case 'venueProducts':
|
|
294
295
|
return new ProductList("".concat(this.name, "_venueProducts"));
|
|
295
296
|
case 'addonProducts':
|
|
@@ -371,12 +372,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
371
372
|
}, {
|
|
372
373
|
key: "resolveHolderCustomerId",
|
|
373
374
|
value: function resolveHolderCustomerId() {
|
|
374
|
-
var _this$
|
|
375
|
+
var _this$window2, _this$window2$getLoca;
|
|
375
376
|
if (this.smartPricingCustomerId !== undefined) {
|
|
376
377
|
var _this$smartPricingCus;
|
|
377
378
|
return (_this$smartPricingCus = this.smartPricingCustomerId) !== null && _this$smartPricingCus !== void 0 ? _this$smartPricingCus : undefined;
|
|
378
379
|
}
|
|
379
|
-
var customer = JSON.parse(((_this$
|
|
380
|
+
var customer = JSON.parse(((_this$window2 = this.window) === null || _this$window2 === void 0 || (_this$window2$getLoca = _this$window2.getLocalStorage) === null || _this$window2$getLoca === void 0 ? void 0 : _this$window2$getLoca.call(_this$window2, 'customer')) || '{}');
|
|
380
381
|
if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
|
|
381
382
|
return undefined;
|
|
382
383
|
}
|
|
@@ -438,9 +439,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
438
439
|
case 20:
|
|
439
440
|
_context3.prev = 20;
|
|
440
441
|
_context3.t0 = _context3["catch"](15);
|
|
441
|
-
|
|
442
|
-
formId: formId
|
|
443
|
-
error: _context3.t0
|
|
442
|
+
this.logMethodError('preloadHolderForms', _context3.t0, {
|
|
443
|
+
formId: formId
|
|
444
444
|
});
|
|
445
445
|
case 23:
|
|
446
446
|
_context3.next = 6;
|
|
@@ -674,9 +674,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
674
674
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
|
|
675
675
|
var _options$otherParams,
|
|
676
676
|
_options$otherParams2,
|
|
677
|
-
_this$
|
|
678
|
-
_this$
|
|
679
|
-
_this$otherParams3,
|
|
677
|
+
_this$otherParams4,
|
|
678
|
+
_this$otherParams5,
|
|
680
679
|
_this4 = this,
|
|
681
680
|
_this$otherParams6,
|
|
682
681
|
_this$otherParams7,
|
|
@@ -684,8 +683,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
684
683
|
_this$otherParams9,
|
|
685
684
|
_this$otherParams10;
|
|
686
685
|
var options,
|
|
687
|
-
_this$otherParams4,
|
|
688
|
-
_this$otherParams5,
|
|
689
686
|
baseModules,
|
|
690
687
|
venueProductsModule,
|
|
691
688
|
addonProductsModule,
|
|
@@ -706,6 +703,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
706
703
|
while (1) switch (_context7.prev = _context7.next) {
|
|
707
704
|
case 0:
|
|
708
705
|
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
706
|
+
this.core = core;
|
|
707
|
+
this.otherParams = options.otherParams || {};
|
|
708
|
+
this.cacheId = this.otherParams.cacheId;
|
|
709
709
|
this.logMethodStart('initialize');
|
|
710
710
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
711
711
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
@@ -720,9 +720,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
720
720
|
this.slotPriceMapCache.clear();
|
|
721
721
|
this.baseSlotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
|
|
722
722
|
this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
|
|
723
|
-
this.otherParams =
|
|
724
|
-
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
725
|
-
this.itemRuleRuntimeConfig = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.venueBookingItemRule) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.itemRule) || {};
|
|
723
|
+
this.itemRuleRuntimeConfig = ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.venueBookingItemRule) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.itemRule) || {};
|
|
726
724
|
this.itemRuleConfigs = [];
|
|
727
725
|
this.itemRuleConfigsPromise = null;
|
|
728
726
|
this.itemRulePrefillApplied = false;
|
|
@@ -731,46 +729,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
731
729
|
passed: null,
|
|
732
730
|
failures: []
|
|
733
731
|
};
|
|
734
|
-
_context7.next =
|
|
732
|
+
_context7.next = 26;
|
|
735
733
|
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
|
|
736
|
-
case
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
|
|
740
|
-
feishu: {
|
|
741
|
-
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
742
|
-
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
746
|
-
}
|
|
747
|
-
// 注册基础模块(order, salesSummary, products, logger)
|
|
748
|
-
baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
|
|
734
|
+
case 26:
|
|
735
|
+
// 注册基础业务模块;日志统一使用 app 插件提供的宿主 logger。
|
|
736
|
+
baseModules = ['products', 'order', 'salesSummary'];
|
|
749
737
|
baseModules.forEach(function (step) {
|
|
750
738
|
var targetModule = createModule(step, _this4.name);
|
|
751
739
|
if (targetModule) {
|
|
752
|
-
var _this4$store$order, _this4$otherParams, _this4$otherParams2
|
|
740
|
+
var _this4$store$order, _this4$otherParams, _this4$otherParams2;
|
|
753
741
|
_this4.store[step] = targetModule;
|
|
754
742
|
var initialState = step === 'salesSummary' ? {
|
|
755
743
|
summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
|
|
756
744
|
} : {};
|
|
757
|
-
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
|
|
758
|
-
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
|
|
759
|
-
// feishu: {
|
|
760
|
-
// webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
761
|
-
// errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
|
|
762
|
-
// },
|
|
763
|
-
};
|
|
764
745
|
_this4.core.registerModule(targetModule, {
|
|
765
746
|
initialState: initialState,
|
|
766
747
|
otherParams: _objectSpread(_objectSpread({}, _this4.otherParams), {}, {
|
|
767
748
|
fatherModule: _this4.name,
|
|
768
|
-
openCache: (_this4$
|
|
769
|
-
cacheId: (_this4$
|
|
770
|
-
salesSummaryModuleName: "".concat(_this4.name, "_salesSummary")
|
|
771
|
-
provider: loggerProvider,
|
|
772
|
-
providerConfig: loggerConfig,
|
|
773
|
-
context: _this4.getLoggerContext()
|
|
749
|
+
openCache: (_this4$otherParams = _this4.otherParams) !== null && _this4$otherParams !== void 0 && _this4$otherParams.cacheId ? true : false,
|
|
750
|
+
cacheId: (_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.cacheId,
|
|
751
|
+
salesSummaryModuleName: "".concat(_this4.name, "_salesSummary")
|
|
774
752
|
})
|
|
775
753
|
});
|
|
776
754
|
} else {
|
|
@@ -891,19 +869,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
891
869
|
this.logMethodSuccess('initialize', {
|
|
892
870
|
status: this.store.status
|
|
893
871
|
});
|
|
894
|
-
_context7.next =
|
|
872
|
+
_context7.next = 76;
|
|
895
873
|
break;
|
|
896
874
|
case 70:
|
|
897
875
|
_context7.prev = 70;
|
|
898
876
|
_context7.t0 = _context7["catch"](51);
|
|
899
877
|
this.store.status = 'error';
|
|
900
878
|
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
901
|
-
console.error('[VenueBooking] 初始化失败', _context7.t0);
|
|
902
879
|
this.logMethodError('initialize', _context7.t0, {
|
|
903
880
|
status: this.store.status
|
|
904
881
|
});
|
|
905
882
|
throw _context7.t0;
|
|
906
|
-
case
|
|
883
|
+
case 76:
|
|
907
884
|
case "end":
|
|
908
885
|
return _context7.stop();
|
|
909
886
|
}
|
|
@@ -1061,13 +1038,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1061
1038
|
}, {
|
|
1062
1039
|
key: "buildSmartPricingContext",
|
|
1063
1040
|
value: function buildSmartPricingContext() {
|
|
1064
|
-
var _this$otherParams12,
|
|
1041
|
+
var _this$otherParams12,
|
|
1042
|
+
_this$store$order3,
|
|
1043
|
+
_this$store$order3$ge,
|
|
1044
|
+
_ref5,
|
|
1045
|
+
_ref6,
|
|
1046
|
+
_this$otherParams$ava,
|
|
1047
|
+
_this$otherParams13,
|
|
1048
|
+
_this$otherParams14,
|
|
1049
|
+
_this$core3,
|
|
1050
|
+
_this5 = this,
|
|
1051
|
+
_this$store$schedule,
|
|
1052
|
+
_this$store$schedule$,
|
|
1053
|
+
_this$otherParams15,
|
|
1054
|
+
_this$otherParams16,
|
|
1055
|
+
_this$core4,
|
|
1056
|
+
_this$otherParams$cha,
|
|
1057
|
+
_this$otherParams17,
|
|
1058
|
+
_ref7,
|
|
1059
|
+
_this$otherParams$bus,
|
|
1060
|
+
_this$otherParams18,
|
|
1061
|
+
_this$otherParams19,
|
|
1062
|
+
_this$otherParams20;
|
|
1065
1063
|
var strategyContext = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.strategy_context) || {};
|
|
1066
1064
|
var orderWalletIds = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getAvailableWalletIds) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1067
1065
|
var fallbackWalletIds = (_ref5 = (_ref6 = (_this$otherParams$ava = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.available_wallet_ids) !== null && _this$otherParams$ava !== void 0 ? _this$otherParams$ava : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.availableWalletIds) !== null && _ref6 !== void 0 ? _ref6 : strategyContext.available_wallet_ids) !== null && _ref5 !== void 0 ? _ref5 : strategyContext.availableWalletIds;
|
|
1068
1066
|
var walletIds = this.smartPricingCustomerId === null ? [] : orderWalletIds !== null && orderWalletIds !== void 0 && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
|
|
1069
1067
|
return {
|
|
1070
1068
|
evaluator: (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator,
|
|
1069
|
+
reportWarning: function reportWarning(title) {
|
|
1070
|
+
void _this5.addVenueBookingLog({
|
|
1071
|
+
level: 'warning',
|
|
1072
|
+
title: title,
|
|
1073
|
+
payload: {
|
|
1074
|
+
method: 'smartPricing'
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
},
|
|
1071
1078
|
scheduleList: ((_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || (_this$store$schedule$ = _this$store$schedule.getScheduleList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule)) || [],
|
|
1072
1079
|
menuList: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.menuList) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.menuList) || ((_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.menuList) || [],
|
|
1073
1080
|
customerId: this.resolveCustomerIdForSmartPricing(),
|
|
@@ -1175,7 +1182,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1175
1182
|
key: "loadAllProducts",
|
|
1176
1183
|
value: function () {
|
|
1177
1184
|
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1178
|
-
var
|
|
1185
|
+
var _this6 = this;
|
|
1179
1186
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1180
1187
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1181
1188
|
case 0:
|
|
@@ -1186,7 +1193,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1186
1193
|
return _context12.abrupt("return", this.loadAllProductsInFlight);
|
|
1187
1194
|
case 2:
|
|
1188
1195
|
this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
|
|
1189
|
-
|
|
1196
|
+
_this6.loadAllProductsInFlight = null;
|
|
1190
1197
|
});
|
|
1191
1198
|
return _context12.abrupt("return", this.loadAllProductsInFlight);
|
|
1192
1199
|
case 4:
|
|
@@ -1204,7 +1211,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1204
1211
|
key: "_doLoadAllProducts",
|
|
1205
1212
|
value: function () {
|
|
1206
1213
|
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1207
|
-
var
|
|
1214
|
+
var _this7 = this;
|
|
1208
1215
|
var _this$otherParams21, _this$store$venueProd2, associatedMenus, menuListIds, pricingContext, allProducts, loadedList, rawProducts, list, venueList, addonList, venueStore, _this$store$order4, _this$store$order4$ge, products;
|
|
1209
1216
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1210
1217
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -1270,7 +1277,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1270
1277
|
_context14.next = 25;
|
|
1271
1278
|
return Promise.all(loadedList.map( /*#__PURE__*/function () {
|
|
1272
1279
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(product) {
|
|
1273
|
-
var _ref9, _rawProducts$get,
|
|
1280
|
+
var _ref9, _rawProducts$get, _this7$core$server, _this7$core$server$ge;
|
|
1274
1281
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1275
1282
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1276
1283
|
case 0:
|
|
@@ -1283,7 +1290,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1283
1290
|
break;
|
|
1284
1291
|
case 4:
|
|
1285
1292
|
_context13.next = 6;
|
|
1286
|
-
return (
|
|
1293
|
+
return (_this7$core$server = _this7.core.server) === null || _this7$core$server === void 0 || (_this7$core$server$ge = _this7$core$server.getProducts) === null || _this7$core$server$ge === void 0 || (_this7$core$server$ge = _this7$core$server$ge.call(_this7$core$server)) === null || _this7$core$server$ge === void 0 ? void 0 : _this7$core$server$ge.getProductById(product.id);
|
|
1287
1294
|
case 6:
|
|
1288
1295
|
_context13.t1 = _context13.sent;
|
|
1289
1296
|
case 7:
|
|
@@ -1470,9 +1477,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1470
1477
|
}, {
|
|
1471
1478
|
key: "preloadQuotations",
|
|
1472
1479
|
value: function preloadQuotations(params) {
|
|
1473
|
-
var
|
|
1480
|
+
var _this8 = this;
|
|
1474
1481
|
void this.ensureQuotationsLoaded(params).catch(function (error) {
|
|
1475
|
-
|
|
1482
|
+
_this8.logMethodError('preloadQuotations', error, {
|
|
1476
1483
|
channel: params === null || params === void 0 ? void 0 : params.channel
|
|
1477
1484
|
});
|
|
1478
1485
|
});
|
|
@@ -1720,7 +1727,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1720
1727
|
}, {
|
|
1721
1728
|
key: "getDateRangeSummary",
|
|
1722
1729
|
value: function getDateRangeSummary(params) {
|
|
1723
|
-
var
|
|
1730
|
+
var _this9 = this;
|
|
1724
1731
|
return buildDateRangeSummary({
|
|
1725
1732
|
startDate: params.startDate,
|
|
1726
1733
|
endDate: params.endDate,
|
|
@@ -1728,10 +1735,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1728
1735
|
rawResources: this.store.rawResourceData,
|
|
1729
1736
|
resourceProductMap: this.resourceProductMap,
|
|
1730
1737
|
resolveConfig: function resolveConfig(date) {
|
|
1731
|
-
return
|
|
1738
|
+
return _this9.resolveSlotConfigForDate(date);
|
|
1732
1739
|
},
|
|
1733
1740
|
buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
|
|
1734
|
-
return
|
|
1741
|
+
return _this9.buildSlotPriceMapForDate(date, config, productIds);
|
|
1735
1742
|
}
|
|
1736
1743
|
});
|
|
1737
1744
|
}
|
|
@@ -1915,7 +1922,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1915
1922
|
}, {
|
|
1916
1923
|
key: "isSlotDisabledBySelection",
|
|
1917
1924
|
value: function isSlotDisabledBySelection(params) {
|
|
1918
|
-
var
|
|
1925
|
+
var _this10 = this;
|
|
1919
1926
|
var resourceId = params.resourceId,
|
|
1920
1927
|
productId = params.productId,
|
|
1921
1928
|
startTime = params.startTime;
|
|
@@ -1937,7 +1944,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1937
1944
|
|
|
1938
1945
|
// 组合资源字段缓存
|
|
1939
1946
|
var getCombinedChildIds = function getCombinedChildIds(resId) {
|
|
1940
|
-
var raw =
|
|
1947
|
+
var raw = _this10.store.rawResourceData.find(function (r) {
|
|
1941
1948
|
return String(r.resourceId) === String(resId);
|
|
1942
1949
|
});
|
|
1943
1950
|
var combined = raw === null || raw === void 0 ? void 0 : raw.combined_resource;
|
|
@@ -2276,7 +2283,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2276
2283
|
}, {
|
|
2277
2284
|
key: "getCombinedChildRawResources",
|
|
2278
2285
|
value: function getCombinedChildRawResources(rawResource) {
|
|
2279
|
-
var
|
|
2286
|
+
var _this11 = this;
|
|
2280
2287
|
if (!rawResource) return undefined;
|
|
2281
2288
|
var combined = rawResource.combined_resource;
|
|
2282
2289
|
if (!combined || combined.status !== 1 || !Array.isArray(combined.resource_ids) || !combined.resource_ids.length) {
|
|
@@ -2288,7 +2295,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2288
2295
|
try {
|
|
2289
2296
|
var _loop3 = function _loop3() {
|
|
2290
2297
|
var id = _step12.value;
|
|
2291
|
-
var child =
|
|
2298
|
+
var child = _this11.store.rawResourceData.find(function (r) {
|
|
2292
2299
|
return String(r.resourceId) === String(id);
|
|
2293
2300
|
});
|
|
2294
2301
|
if (child) children.push(child);
|
|
@@ -2364,10 +2371,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2364
2371
|
}, {
|
|
2365
2372
|
key: "injectScheduleResolverToQuotation",
|
|
2366
2373
|
value: function injectScheduleResolverToQuotation() {
|
|
2367
|
-
var
|
|
2374
|
+
var _this12 = this;
|
|
2368
2375
|
if (this.store.quotation && this.store.schedule) {
|
|
2369
2376
|
this.store.quotation.setScheduleResolver(function (id) {
|
|
2370
|
-
return
|
|
2377
|
+
return _this12.store.schedule.getScheduleListByIds([id])[0];
|
|
2371
2378
|
});
|
|
2372
2379
|
}
|
|
2373
2380
|
}
|
|
@@ -2468,7 +2475,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2468
2475
|
key: "recalculateOrderPricesFromSmartPricing",
|
|
2469
2476
|
value: function recalculateOrderPricesFromSmartPricing() {
|
|
2470
2477
|
var _tempOrder$products,
|
|
2471
|
-
|
|
2478
|
+
_this13 = this;
|
|
2472
2479
|
if (!this.store.order) return;
|
|
2473
2480
|
var tempOrder = this.store.order.getTempOrder();
|
|
2474
2481
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
@@ -2480,22 +2487,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2480
2487
|
var _product$metadata2;
|
|
2481
2488
|
var product = _step13.value;
|
|
2482
2489
|
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
2483
|
-
var mappings =
|
|
2490
|
+
var mappings = _this13.resourceProductMap.get(product.metadata.resource_id);
|
|
2484
2491
|
if (!mappings || !mappings.length) return 0; // continue
|
|
2485
2492
|
var mapping = mappings.find(function (m) {
|
|
2486
2493
|
return Number(m.productId) === Number(product.product_id);
|
|
2487
2494
|
}) || mappings[0];
|
|
2488
2495
|
if (!mapping) return 0; // continue
|
|
2489
|
-
var slots = expandMergedSlotToIndividual(product,
|
|
2496
|
+
var slots = expandMergedSlotToIndividual(product, _this13.store.slotConfig.slotDurationMinutes);
|
|
2490
2497
|
var updatedSlots = slots.map(function (slot) {
|
|
2491
2498
|
var slotStart = dayjs(slot.startTime);
|
|
2492
2499
|
var date = slotStart.format('YYYY-MM-DD');
|
|
2493
2500
|
var previousDate = slotStart.subtract(1, 'day').format('YYYY-MM-DD');
|
|
2494
|
-
var previousConfig =
|
|
2501
|
+
var previousConfig = _this13.resolveSlotConfigForDate(previousDate);
|
|
2495
2502
|
if (isBusinessHoursCrossDay(previousConfig) && slotStart.format('HH:mm') < previousConfig.businessStartTime) {
|
|
2496
2503
|
date = previousDate;
|
|
2497
2504
|
}
|
|
2498
|
-
var slotPriceMap =
|
|
2505
|
+
var slotPriceMap = _this13.buildSlotPriceMapForDate(date, _this13.resolveSlotConfigForDate(date), [mapping.productId]);
|
|
2499
2506
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
2500
2507
|
productId: mapping.productId,
|
|
2501
2508
|
price: getSlotPriceFromMap({
|
|
@@ -2508,7 +2515,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2508
2515
|
});
|
|
2509
2516
|
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
2510
2517
|
if (merged.length === 1) {
|
|
2511
|
-
|
|
2518
|
+
_this13.resetProductPriceForSmartPricing(product, merged[0].totalPrice);
|
|
2512
2519
|
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
2513
2520
|
group: merged[0],
|
|
2514
2521
|
productId: mapping.productId
|
|
@@ -2517,14 +2524,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2517
2524
|
} else if (product.product_id != null) {
|
|
2518
2525
|
var _product$product_vari, _product$metadata$sou, _product$metadata3;
|
|
2519
2526
|
var price = getPriceForProductAtDatetime({
|
|
2520
|
-
products:
|
|
2521
|
-
context:
|
|
2527
|
+
products: _this13.smartPricingProductCatalog,
|
|
2528
|
+
context: _this13.buildSmartPricingContext(),
|
|
2522
2529
|
productId: product.product_id,
|
|
2523
2530
|
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
2524
2531
|
datetime: now,
|
|
2525
2532
|
fallbackPrice: (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : product.original_price
|
|
2526
2533
|
});
|
|
2527
|
-
|
|
2534
|
+
_this13.resetProductPriceForSmartPricing(product, price);
|
|
2528
2535
|
}
|
|
2529
2536
|
},
|
|
2530
2537
|
_ret;
|
|
@@ -3426,7 +3433,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3426
3433
|
key: "ensureItemRuleConfigsLoaded",
|
|
3427
3434
|
value: function () {
|
|
3428
3435
|
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3429
|
-
var
|
|
3436
|
+
var _this14 = this;
|
|
3430
3437
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3431
3438
|
while (1) switch (_context39.prev = _context39.next) {
|
|
3432
3439
|
case 0:
|
|
@@ -3447,19 +3454,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3447
3454
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3448
3455
|
while (1) switch (_context38.prev = _context38.next) {
|
|
3449
3456
|
case 0:
|
|
3450
|
-
runtimeConfig =
|
|
3457
|
+
runtimeConfig = _this14.getItemRuleRuntimeConfig();
|
|
3451
3458
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3452
3459
|
if (!(staticConfigs.length > 0)) {
|
|
3453
3460
|
_context38.next = 6;
|
|
3454
3461
|
break;
|
|
3455
3462
|
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
return _context38.abrupt("return",
|
|
3463
|
+
_this14.itemRuleConfigs = staticConfigs;
|
|
3464
|
+
_this14.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3465
|
+
return _context38.abrupt("return", _this14.itemRuleConfigs);
|
|
3459
3466
|
case 6:
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
return _context38.abrupt("return",
|
|
3467
|
+
_this14.itemRuleConfigs = [];
|
|
3468
|
+
_this14.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3469
|
+
return _context38.abrupt("return", _this14.itemRuleConfigs);
|
|
3463
3470
|
case 9:
|
|
3464
3471
|
case "end":
|
|
3465
3472
|
return _context38.stop();
|
|
@@ -3920,9 +3927,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3920
3927
|
}, {
|
|
3921
3928
|
key: "readUIStateBucket",
|
|
3922
3929
|
value: function readUIStateBucket() {
|
|
3923
|
-
var _this$
|
|
3930
|
+
var _this$window3;
|
|
3924
3931
|
var key = this.getUIStateBucketKey();
|
|
3925
|
-
if (!key || !((_this$
|
|
3932
|
+
if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.sessionStorage)) return {};
|
|
3926
3933
|
try {
|
|
3927
3934
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3928
3935
|
var parsed = JSON.parse(raw);
|
|
@@ -3934,9 +3941,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3934
3941
|
}, {
|
|
3935
3942
|
key: "writeUIStateBucket",
|
|
3936
3943
|
value: function writeUIStateBucket(bucket) {
|
|
3937
|
-
var _this$
|
|
3944
|
+
var _this$window4;
|
|
3938
3945
|
var key = this.getUIStateBucketKey();
|
|
3939
|
-
if (!key || !((_this$
|
|
3946
|
+
if (!key || !((_this$window4 = this.window) !== null && _this$window4 !== void 0 && _this$window4.sessionStorage)) return;
|
|
3940
3947
|
this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
|
|
3941
3948
|
}
|
|
3942
3949
|
}, {
|
|
@@ -133,6 +133,7 @@ export interface VenueBookingState {
|
|
|
133
133
|
products?: ProductList;
|
|
134
134
|
order?: OrderModule;
|
|
135
135
|
salesSummary?: SalesSummaryModule;
|
|
136
|
+
/** @deprecated Retained for compatibility; solution logs use app.getApp().logger. */
|
|
136
137
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
137
138
|
venueProducts?: ProductList;
|
|
138
139
|
addonProducts?: ProductList;
|
|
@@ -149,6 +150,7 @@ export interface VenueBookingState {
|
|
|
149
150
|
};
|
|
150
151
|
holder?: HolderModule;
|
|
151
152
|
}
|
|
153
|
+
/** @deprecated Configure the host app logger; VenueBooking no longer selects a provider. */
|
|
152
154
|
export interface VenueBookingLoggerRuntimeConfig {
|
|
153
155
|
provider?: ScanOrderLoggerProviderType;
|
|
154
156
|
providerConfig?: ScanOrderLoggerProviderConfig;
|
|
@@ -16,6 +16,7 @@ export interface VenueBookingSmartPricingContext {
|
|
|
16
16
|
orderType?: string;
|
|
17
17
|
strategy_context?: Record<string, any>;
|
|
18
18
|
strategyConfigs?: StrategyConfig[];
|
|
19
|
+
reportWarning?: (message: string) => void;
|
|
19
20
|
}
|
|
20
21
|
/** 从商品上读取展示/算价用的 price 字段 */
|
|
21
22
|
export declare function extractProductPrice(product: DataVariantProduct): string | null;
|
|
@@ -46,7 +46,12 @@ export function buildDataVariantBusinessData(products, context, scheduleDateTime
|
|
|
46
46
|
export function formatProductsWithDataVariant(products, context, scheduleDateTime) {
|
|
47
47
|
var evaluator = context.evaluator;
|
|
48
48
|
if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
|
|
49
|
-
|
|
49
|
+
var _message = '[VenueBooking][smartPricing] dataVariantEvaluator 未注入,跳过智能定价格式化';
|
|
50
|
+
try {
|
|
51
|
+
if (context.reportWarning) context.reportWarning(_message);else console.warn(_message);
|
|
52
|
+
} catch (_unused) {
|
|
53
|
+
console.warn(_message);
|
|
54
|
+
}
|
|
50
55
|
return products;
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LogConsoleType } from '../plugins/app-types/logger';
|
|
2
|
+
import type { PisellCore } from '../types';
|
|
3
|
+
export interface HostLogItem {
|
|
4
|
+
type: LogConsoleType;
|
|
5
|
+
title: string;
|
|
6
|
+
date?: string;
|
|
7
|
+
metadata?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
/** Use the same host logger as Order, without letting diagnostics interrupt sales. */
|
|
10
|
+
export declare function writeHostLog(core: PisellCore | undefined, log: HostLogItem): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Use the same host logger as Order, without letting diagnostics interrupt sales. */
|
|
2
|
+
export function writeHostLog(core, log) {
|
|
3
|
+
var fallback = function fallback() {
|
|
4
|
+
var method = log.type === 'warning' ? 'warn' : log.type;
|
|
5
|
+
};
|
|
6
|
+
try {
|
|
7
|
+
var _core$getPlugin, _core$getPlugin$getAp;
|
|
8
|
+
var logger = core === null || core === void 0 || (_core$getPlugin = core.getPlugin('app')) === null || _core$getPlugin === void 0 || (_core$getPlugin$getAp = _core$getPlugin.getApp) === null || _core$getPlugin$getAp === void 0 || (_core$getPlugin$getAp = _core$getPlugin$getAp.call(_core$getPlugin)) === null || _core$getPlugin$getAp === void 0 ? void 0 : _core$getPlugin$getAp.logger;
|
|
9
|
+
if (typeof (logger === null || logger === void 0 ? void 0 : logger.addLog) !== 'function') {
|
|
10
|
+
fallback();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
var result = logger.addLog(log);
|
|
14
|
+
if (result && typeof result.then === 'function') {
|
|
15
|
+
void Promise.resolve(result).catch(fallback);
|
|
16
|
+
}
|
|
17
|
+
} catch (_unused) {
|
|
18
|
+
fallback();
|
|
19
|
+
}
|
|
20
|
+
}
|