@pisell/pisellos 2.2.293 → 2.2.295
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/itemRule/adapter.d.ts +1 -4
- package/dist/model/strategy/adapter/itemRule/adapter.js +35 -135
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
- package/dist/model/strategy/adapter/itemRule/evaluator.js +1 -25
- package/dist/model/strategy/adapter/itemRule/type.d.ts +0 -44
- package/dist/model/strategy/adapter/itemRule/type.js +1 -19
- package/dist/modules/Order/index.d.ts +3 -18
- package/dist/modules/Order/index.js +485 -885
- package/dist/modules/Order/types.d.ts +5 -91
- package/dist/modules/Order/types.js +0 -5
- package/dist/modules/Order/utils.js +10 -22
- package/dist/modules/ProductList/index.d.ts +1 -2
- package/dist/modules/ProductList/index.js +20 -100
- package/dist/modules/ProductList/types.d.ts +0 -10
- package/dist/server/index.d.ts +0 -6
- package/dist/server/index.js +3 -43
- package/dist/solution/BaseSales/index.d.ts +1 -9
- package/dist/solution/BaseSales/index.js +706 -894
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/orderCustomer.js +2 -3
- package/dist/solution/RegisterAndLogin/config.d.ts +3 -9
- package/dist/solution/RegisterAndLogin/config.js +40 -95
- package/dist/solution/RegisterAndLogin/index.js +1 -4
- package/dist/solution/ScanOrder/index.d.ts +0 -1
- package/dist/solution/ScanOrder/index.js +27 -31
- package/dist/solution/ScanOrder/utils.d.ts +0 -1
- package/dist/solution/ScanOrder/utils.js +0 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +4 -17
- package/dist/solution/UnifiedBookingSales/index.js +489 -755
- package/dist/solution/UnifiedBookingSales/types.d.ts +1 -14
- package/dist/solution/VenueBooking/index.d.ts +0 -1
- package/dist/solution/VenueBooking/index.js +4 -8
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +1 -4
- package/lib/model/strategy/adapter/itemRule/adapter.js +4 -73
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +1 -8
- package/lib/model/strategy/adapter/itemRule/evaluator.js +1 -23
- package/lib/model/strategy/adapter/itemRule/type.d.ts +0 -44
- package/lib/model/strategy/adapter/itemRule/type.js +1 -19
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Order/index.d.ts +3 -18
- package/lib/modules/Order/index.js +28 -325
- package/lib/modules/Order/types.d.ts +5 -91
- package/lib/modules/Order/types.js +0 -4
- package/lib/modules/Order/utils.js +1 -13
- package/lib/modules/ProductList/index.d.ts +1 -2
- package/lib/modules/ProductList/index.js +2 -47
- package/lib/modules/ProductList/types.d.ts +0 -10
- package/lib/server/index.d.ts +0 -6
- package/lib/server/index.js +3 -37
- package/lib/solution/BaseSales/index.d.ts +1 -9
- package/lib/solution/BaseSales/index.js +1 -105
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/orderCustomer.js +1 -2
- package/lib/solution/RegisterAndLogin/config.d.ts +3 -9
- package/lib/solution/RegisterAndLogin/config.js +8 -49
- package/lib/solution/RegisterAndLogin/index.js +1 -4
- package/lib/solution/ScanOrder/index.d.ts +0 -1
- package/lib/solution/ScanOrder/index.js +1 -5
- package/lib/solution/ScanOrder/utils.d.ts +0 -1
- package/lib/solution/ScanOrder/utils.js +0 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +4 -17
- package/lib/solution/UnifiedBookingSales/index.js +6 -128
- package/lib/solution/UnifiedBookingSales/types.d.ts +1 -14
- package/lib/solution/VenueBooking/index.d.ts +0 -1
- package/lib/solution/VenueBooking/index.js +1 -5
- package/package.json +1 -1
- package/dist/modules/Order/salesNotes.d.ts +0 -31
- package/dist/modules/Order/salesNotes.js +0 -492
- package/lib/modules/Order/salesNotes.d.ts +0 -31
- package/lib/modules/Order/salesNotes.js +0 -382
|
@@ -2,11 +2,10 @@ import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import type { ProductData } from '../../modules';
|
|
3
3
|
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
4
4
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
|
-
import type { ProductListLoadProductsParams
|
|
5
|
+
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
6
6
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
7
|
-
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse,
|
|
7
|
+
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
8
|
import { BookingTicket } from '../BookingTicket';
|
|
9
|
-
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
10
9
|
export * from './types';
|
|
11
10
|
export { AvailabilityError } from '../../modules/ResourcePlanner';
|
|
12
11
|
/**
|
|
@@ -77,9 +76,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
77
76
|
private availabilityRemoteResourceQuerySequence;
|
|
78
77
|
private availabilityRemoteResourceEpoch;
|
|
79
78
|
private availabilityCommitLocks;
|
|
80
|
-
private allergyItemRuleEvaluator;
|
|
81
|
-
private allergyItemRuleConfigs;
|
|
82
|
-
private allergyItemRuleConfigsPromise;
|
|
83
79
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
84
80
|
protected getSubmitOrderSalesChannel(): string;
|
|
85
81
|
private createAvailabilityFacadeError;
|
|
@@ -130,8 +126,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
130
126
|
*/
|
|
131
127
|
clearSessionStorageOrderSnapshot(): void;
|
|
132
128
|
/**
|
|
133
|
-
* Kiosk
|
|
134
|
-
*
|
|
129
|
+
* H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
|
|
130
|
+
* 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
|
|
135
131
|
*/
|
|
136
132
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
137
133
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -151,14 +147,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
151
147
|
*/
|
|
152
148
|
loadOpenData(params: UnifiedBookingSalesLoadOpenDataParams): Promise<OpenDataConfig>;
|
|
153
149
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
154
|
-
private resetAllergyItemRuleState;
|
|
155
|
-
private fetchAllergyItemRuleConfigs;
|
|
156
|
-
private ensureAllergyItemRuleConfigsLoaded;
|
|
157
|
-
/**
|
|
158
|
-
* 评估当前渠道与商品是否命中 ALLERGY_CHECK。
|
|
159
|
-
* 只返回优先级最高 Action 中当前商品 Target 的 dataSource,不跨商品或 Action 合并。
|
|
160
|
-
*/
|
|
161
|
-
resolveProductAllergyRequirement(params: UnifiedBookingSalesResolveProductAllergyRequirementParams): Promise<AllergyRequirement | null>;
|
|
162
150
|
/**
|
|
163
151
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
164
152
|
*/
|
|
@@ -171,7 +159,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
171
159
|
callback?: (result: any) => void;
|
|
172
160
|
subscriberId?: string;
|
|
173
161
|
}): Promise<ProductData[]>;
|
|
174
|
-
queryProducts(params?: ProductListStoreQueryParams): Promise<ProductData[]>;
|
|
175
162
|
/** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
|
|
176
163
|
loadScheduleAvailableDate(params: LoadScheduleAvailableDateParams): Promise<import("../../modules/Date/types").ITime[]>;
|
|
177
164
|
/**
|
|
@@ -51,7 +51,6 @@ var _remoteOccupancyCache = require("./remoteOccupancyCache");
|
|
|
51
51
|
var _BookingTicket = require("../BookingTicket");
|
|
52
52
|
var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
53
53
|
var _platform = require("../../utils/platform");
|
|
54
|
-
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
55
54
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
56
55
|
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
|
|
57
56
|
const OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
@@ -84,22 +83,6 @@ function getCandidateStartTime(candidate) {
|
|
|
84
83
|
return undefined;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
function normalizePositiveIntegerList(value) {
|
|
88
|
-
if (!Array.isArray(value)) return [];
|
|
89
|
-
return Array.from(new Set(value.map(item => normalizePositiveInteger(item)).filter(item => item !== undefined)));
|
|
90
|
-
}
|
|
91
|
-
function toConfiguredBoolean(value) {
|
|
92
|
-
if (typeof value === 'boolean') return value;
|
|
93
|
-
if (typeof value === 'number') return value !== 0;
|
|
94
|
-
if (typeof value === 'string') {
|
|
95
|
-
return ['1', 'true', 'yes', 'y', 'on'].includes(value.trim().toLowerCase());
|
|
96
|
-
}
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
function normalizeItemRuleStrategyConfigs(value) {
|
|
100
|
-
if (!Array.isArray(value)) return [];
|
|
101
|
-
return value.filter(config => Boolean(config && typeof config === 'object' && config.metadata?.type === 'item_rule'));
|
|
102
|
-
}
|
|
103
86
|
function isRecord(value) {
|
|
104
87
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
105
88
|
}
|
|
@@ -1181,15 +1164,11 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1181
1164
|
availabilityRemoteResourceQuerySequence = 0;
|
|
1182
1165
|
availabilityRemoteResourceEpoch = 0;
|
|
1183
1166
|
availabilityCommitLocks = new Set();
|
|
1184
|
-
allergyItemRuleEvaluator = new _itemRule.ItemRuleEvaluator();
|
|
1185
|
-
allergyItemRuleConfigs = [];
|
|
1186
|
-
allergyItemRuleConfigsPromise = null;
|
|
1187
1167
|
async initialize(core, options = {}) {
|
|
1188
1168
|
this.availabilityScheduleCatalog = null;
|
|
1189
1169
|
this.openDataTarget = null;
|
|
1190
1170
|
this.availabilityRuntimeOffsetMinutes = (0, _localClock.captureRuntimeOffsetMinutes)();
|
|
1191
1171
|
this.clearAvailabilityRemoteResourceState();
|
|
1192
|
-
this.resetAllergyItemRuleState();
|
|
1193
1172
|
await super.initialize(core, options);
|
|
1194
1173
|
const openDataBusinessCode = String(this.otherParams?.businessCode ?? this.otherParams?.business_code ?? '').trim();
|
|
1195
1174
|
const openDataChannel = String(this.otherParams?.channel ?? '').trim();
|
|
@@ -1334,7 +1313,6 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1334
1313
|
cover = false
|
|
1335
1314
|
} = {}) {
|
|
1336
1315
|
const previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1337
|
-
const previousItemRuleConfig = this.otherParams?.itemRule;
|
|
1338
1316
|
const explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1339
1317
|
await super.setOtherParams(params, {
|
|
1340
1318
|
cover
|
|
@@ -1347,15 +1325,11 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1347
1325
|
if (shouldResetAvailabilityState) {
|
|
1348
1326
|
await this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1349
1327
|
}
|
|
1350
|
-
if (shouldResetAvailabilityState || explicitlySetsOpenData || previousItemRuleConfig !== this.otherParams?.itemRule) {
|
|
1351
|
-
this.resetAllergyItemRuleState();
|
|
1352
|
-
}
|
|
1353
1328
|
}
|
|
1354
1329
|
async destroy() {
|
|
1355
1330
|
this.availabilityScheduleCatalog = null;
|
|
1356
1331
|
this.availabilityRuntimeOffsetMinutes = null;
|
|
1357
1332
|
await this.resetAvailabilityProjectionState('destroy');
|
|
1358
|
-
this.resetAllergyItemRuleState();
|
|
1359
1333
|
await super.destroy();
|
|
1360
1334
|
}
|
|
1361
1335
|
createAvailabilityContextId() {
|
|
@@ -1548,12 +1522,14 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1548
1522
|
}
|
|
1549
1523
|
|
|
1550
1524
|
/**
|
|
1551
|
-
* Kiosk
|
|
1552
|
-
*
|
|
1525
|
+
* H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
|
|
1526
|
+
* 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
|
|
1553
1527
|
*/
|
|
1554
1528
|
shouldUseCheckoutSyncTask() {
|
|
1555
1529
|
const configured = this.otherParams?.checkoutSyncTaskEnabled;
|
|
1556
|
-
|
|
1530
|
+
if (configured === true) return true;
|
|
1531
|
+
const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
|
|
1532
|
+
return platform !== 'h5' && platform !== 'kiosk';
|
|
1557
1533
|
}
|
|
1558
1534
|
|
|
1559
1535
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -1707,98 +1683,6 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1707
1683
|
channel
|
|
1708
1684
|
});
|
|
1709
1685
|
}
|
|
1710
|
-
resetAllergyItemRuleState() {
|
|
1711
|
-
this.allergyItemRuleConfigs = [];
|
|
1712
|
-
this.allergyItemRuleConfigsPromise = null;
|
|
1713
|
-
this.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
1714
|
-
}
|
|
1715
|
-
async fetchAllergyItemRuleConfigs(strategyModelIds) {
|
|
1716
|
-
if (!strategyModelIds.length) return [];
|
|
1717
|
-
try {
|
|
1718
|
-
const response = await this.request.get('/promotion', {
|
|
1719
|
-
skip: 1,
|
|
1720
|
-
num: 99,
|
|
1721
|
-
status: 'active',
|
|
1722
|
-
ids: strategyModelIds
|
|
1723
|
-
});
|
|
1724
|
-
if (response?.code !== 200 || !Array.isArray(response?.data?.list)) {
|
|
1725
|
-
throw new Error('[UnifiedBookingSales] 商品过敏策略加载失败');
|
|
1726
|
-
}
|
|
1727
|
-
const list = response.data.list;
|
|
1728
|
-
return normalizeItemRuleStrategyConfigs(list.map(item => item?.metadata));
|
|
1729
|
-
} catch (error) {
|
|
1730
|
-
// this.logMethodError('fetchAllergyItemRuleConfigs', error, {
|
|
1731
|
-
// strategyModelIds,
|
|
1732
|
-
// });
|
|
1733
|
-
throw error;
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
async ensureAllergyItemRuleConfigsLoaded() {
|
|
1737
|
-
if (this.allergyItemRuleConfigs.length > 0) {
|
|
1738
|
-
return this.allergyItemRuleConfigs;
|
|
1739
|
-
}
|
|
1740
|
-
if (this.allergyItemRuleConfigsPromise) {
|
|
1741
|
-
return this.allergyItemRuleConfigsPromise;
|
|
1742
|
-
}
|
|
1743
|
-
this.allergyItemRuleConfigsPromise = (async () => {
|
|
1744
|
-
const staticConfigs = normalizeItemRuleStrategyConfigs(this.otherParams?.itemRule?.strategyConfigs);
|
|
1745
|
-
if (staticConfigs.length > 0) {
|
|
1746
|
-
this.allergyItemRuleConfigs = staticConfigs;
|
|
1747
|
-
this.allergyItemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
1748
|
-
return staticConfigs;
|
|
1749
|
-
}
|
|
1750
|
-
const openData = await this.getOpenData();
|
|
1751
|
-
const enabled = toConfiguredBoolean(openData?.['sale.enable_item_rules']);
|
|
1752
|
-
const strategyModelIds = normalizePositiveIntegerList(openData?.['sale.enabled_item_rules']);
|
|
1753
|
-
if (!enabled || !strategyModelIds.length) {
|
|
1754
|
-
this.allergyItemRuleEvaluator.setStrategyConfigs([]);
|
|
1755
|
-
return [];
|
|
1756
|
-
}
|
|
1757
|
-
const loaded = await this.fetchAllergyItemRuleConfigs(strategyModelIds);
|
|
1758
|
-
this.allergyItemRuleConfigs = loaded;
|
|
1759
|
-
this.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
|
|
1760
|
-
return loaded;
|
|
1761
|
-
})();
|
|
1762
|
-
return this.allergyItemRuleConfigsPromise;
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
/**
|
|
1766
|
-
* 评估当前渠道与商品是否命中 ALLERGY_CHECK。
|
|
1767
|
-
* 只返回优先级最高 Action 中当前商品 Target 的 dataSource,不跨商品或 Action 合并。
|
|
1768
|
-
*/
|
|
1769
|
-
async resolveProductAllergyRequirement(params) {
|
|
1770
|
-
const productId = normalizePositiveInteger(params.productId);
|
|
1771
|
-
if (!productId) return null;
|
|
1772
|
-
const strategyConfigs = await this.ensureAllergyItemRuleConfigsLoaded();
|
|
1773
|
-
if (!strategyConfigs.length) return null;
|
|
1774
|
-
const productVariantId = normalizePositiveInteger(params.productVariantId);
|
|
1775
|
-
const runtimeConfig = this.otherParams?.itemRule || {};
|
|
1776
|
-
const runtimePax = runtimeConfig.pax || {};
|
|
1777
|
-
const cartItems = (this.getOrderProducts?.() || []).map(item => ({
|
|
1778
|
-
product_id: Number(item?.product_id ?? item?.id),
|
|
1779
|
-
product_variant_id: Number(item?.product_variant_id ?? 0) || undefined,
|
|
1780
|
-
quantity: Number(item?.num ?? item?.quantity ?? 0)
|
|
1781
|
-
})).filter(item => Number.isFinite(item.product_id) && item.product_id > 0 && Number.isFinite(item.quantity) && item.quantity > 0);
|
|
1782
|
-
return this.allergyItemRuleEvaluator.getAllergyRequirement({
|
|
1783
|
-
pax: {
|
|
1784
|
-
total: Number(runtimePax.total ?? 0) || 0,
|
|
1785
|
-
adult: Number(runtimePax.adult ?? 0) || 0,
|
|
1786
|
-
child: Number(runtimePax.child ?? 0) || 0
|
|
1787
|
-
},
|
|
1788
|
-
cartItems,
|
|
1789
|
-
serviceType: String(runtimeConfig.serviceType ?? this.otherParams?.serviceType ?? ''),
|
|
1790
|
-
channel: String(params.channel ?? this.otherParams?.channel ?? this.otherParams?.platform ?? ''),
|
|
1791
|
-
currentProduct: {
|
|
1792
|
-
product_id: productId,
|
|
1793
|
-
...(productVariantId ? {
|
|
1794
|
-
product_variant_id: productVariantId
|
|
1795
|
-
} : {})
|
|
1796
|
-
},
|
|
1797
|
-
submissionIndex: Number(runtimeConfig.submissionIndex ?? 0) || 0,
|
|
1798
|
-
strategyConfigs,
|
|
1799
|
-
custom: runtimeConfig.custom
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
1686
|
|
|
1803
1687
|
/**
|
|
1804
1688
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
@@ -1835,10 +1719,6 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1835
1719
|
await this.core.effects.emit(`${this.name}:onProductsLoaded`, result);
|
|
1836
1720
|
return result;
|
|
1837
1721
|
}
|
|
1838
|
-
async queryProducts(params = {}) {
|
|
1839
|
-
if (!this.store.products) throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
1840
|
-
return this.store.products.queryProducts(params);
|
|
1841
|
-
}
|
|
1842
1722
|
|
|
1843
1723
|
/** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
|
|
1844
1724
|
async loadScheduleAvailableDate(params) {
|
|
@@ -3354,9 +3234,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
3354
3234
|
} else {
|
|
3355
3235
|
const beforeProductLineUids = new Set((this.getTempOrder()?.products || []).map(line => getProductLineUid(line)).filter(Boolean));
|
|
3356
3236
|
const beforeBookingUids = new Set((this.getTempOrder()?.bookings || []).map(item => getBookingUid(item)).filter(Boolean));
|
|
3357
|
-
const products = await this.addProductToOrder(transformed, booking
|
|
3358
|
-
salesNotes: params.salesNotes
|
|
3359
|
-
} : undefined);
|
|
3237
|
+
const products = await this.addProductToOrder(transformed, booking);
|
|
3360
3238
|
const addedLines = products.filter(line => sameAvailabilityId(line.product_id ?? line.id, refreshedCandidate.productId) && line.metadata?.availability_candidate_key === refreshedCandidate.key && !beforeProductLineUids.has(getProductLineUid(line)));
|
|
3361
3239
|
productLineUids = addedLines.map(line => getProductLineUid(line)).filter(Boolean);
|
|
3362
3240
|
const addedBookings = (this.getTempOrder()?.bookings || []).filter(item => item.metadata?.availability_candidate_key === refreshedCandidate.key && !beforeBookingUids.has(getBookingUid(item)));
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
2
|
-
import type { ProductListLoadProductsParams
|
|
3
|
-
import type { ProductData } from '../../modules/Product/types';
|
|
2
|
+
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
4
3
|
import type { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
5
4
|
import type { AvailabilityDateRange, AvailabilityErrorCode, AvailabilityId, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProjection, AvailabilityQuery, AvailabilityRequirementSelection, AvailabilityResource, AvailabilitySelectionValidationResult, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, ResourceAvailabilityGroup, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem } from '../../modules/ResourcePlanner';
|
|
6
5
|
import type { BookingTicketState } from '../BookingTicket/types';
|
|
7
|
-
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
8
|
-
import type { SalesNoteDraftInput } from '../../modules/Order/types';
|
|
9
|
-
export type { ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
10
6
|
export type { AvailabilityAbsoluteRange, AvailabilityAssignment, AvailabilityCell, AvailabilityDateRange, AvailabilityDisplayRange, AvailabilityErrorCode, AvailabilityId, AvailabilityMode, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProductKind, AvailabilityProjection, AvailabilityProjectionInput, AvailabilityProjectionMeta, AvailabilityQuery, AvailabilityQueryResult, AvailabilityRequirementGroup, AvailabilityRequirementGroupResult, AvailabilityRequirementSelection, AvailabilityResource, AvailabilityResourceOption, AvailabilityResourceType, AvailabilityResourceWindow, AvailabilityScheduleMode, AvailabilityScheduleRef, AvailabilityScheduleRule, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, AvailabilitySessionRange, AvailabilityStatus, DateAvailabilityGroup, DateAvailabilityItem, DateAvailabilityQuery, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityGroup, ProductAvailabilityItem, ProductAvailabilityQuery, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, QueryAvailabilityBaseRequest, ResourceAvailabilityGroup, ResourceAvailabilityQuery, ResourceAvailabilityQueryResult, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem, TimeAvailabilityQuery, TimeAvailabilityQueryResult, } from '../../modules/ResourcePlanner';
|
|
11
7
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
12
8
|
}
|
|
@@ -28,12 +24,6 @@ export declare enum UnifiedBookingSalesHooks {
|
|
|
28
24
|
export interface UnifiedBookingSalesOtherParams extends Record<string, any> {
|
|
29
25
|
enableSessionStoragePersist?: boolean;
|
|
30
26
|
}
|
|
31
|
-
export type UnifiedBookingSalesAllergyRequirement = AllergyRequirement;
|
|
32
|
-
export interface UnifiedBookingSalesResolveProductAllergyRequirementParams {
|
|
33
|
-
productId: number | string;
|
|
34
|
-
productVariantId?: number | string;
|
|
35
|
-
channel?: string;
|
|
36
|
-
}
|
|
37
27
|
export interface UnifiedBookingSalesLoadOpenDataParams {
|
|
38
28
|
businessCode: string;
|
|
39
29
|
channel: string;
|
|
@@ -161,8 +151,6 @@ export interface ContextualCommitAvailabilitySelectionParams {
|
|
|
161
151
|
requirementSelections: AvailabilityRequirementSelection[];
|
|
162
152
|
partySize: number;
|
|
163
153
|
bookingCount?: number;
|
|
164
|
-
/** 新增商品行时与商品、预约在同一次 Order mutation 内写入的 Sales Notes。 */
|
|
165
|
-
salesNotes?: SalesNoteDraftInput[];
|
|
166
154
|
/** 编辑预约时,允许本次显式报价覆盖已落库订单行的历史价格。 */
|
|
167
155
|
allowBookingReprice?: boolean;
|
|
168
156
|
/** 编辑预约重报价后,允许订单模块重新应用已选编辑态折扣。 */
|
|
@@ -220,7 +208,6 @@ export interface UnifiedBookingSalesApi {
|
|
|
220
208
|
getOpenData: () => Promise<OpenDataConfig | null>;
|
|
221
209
|
loadScheduleAvailableDate: (params: LoadScheduleAvailableDateParams) => Promise<unknown>;
|
|
222
210
|
loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
|
|
223
|
-
queryProducts: (params?: ProductListStoreQueryParams) => Promise<ProductData[]>;
|
|
224
211
|
stageRetailProducts: (params: UnifiedBookingSalesStageRetailProductsParams) => Promise<Record<string, any> | null>;
|
|
225
212
|
addRetailProduct: (params: UnifiedBookingSalesAddRetailProductParams) => Promise<Record<string, any>[]>;
|
|
226
213
|
prepareAvailabilityProjection: (params: UnifiedBookingSalesPrepareAvailabilityProjectionParams) => Promise<AvailabilityContextRef>;
|
|
@@ -1758,11 +1758,7 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1758
1758
|
return sourceMap;
|
|
1759
1759
|
}
|
|
1760
1760
|
getItemRuleRuntimeConfig() {
|
|
1761
|
-
|
|
1762
|
-
return {
|
|
1763
|
-
...runtimeConfig,
|
|
1764
|
-
channel: runtimeConfig.channel ?? runtimeConfig.custom?.channel ?? this.otherParams?.channel
|
|
1765
|
-
};
|
|
1761
|
+
return this.itemRuleRuntimeConfig || {};
|
|
1766
1762
|
}
|
|
1767
1763
|
async ensureItemRuleConfigsLoaded() {
|
|
1768
1764
|
if (this.itemRuleConfigs.length > 0) return this.itemRuleConfigs;
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { SalesNote, SalesNoteProtocol, SalesNoteTextInput } from './types';
|
|
2
|
-
export interface SalesNotePolicy {
|
|
3
|
-
note_type: string;
|
|
4
|
-
importance: string;
|
|
5
|
-
uniquePerPrimaryTarget: boolean;
|
|
6
|
-
primary_relation_type: 'about';
|
|
7
|
-
secondary_order_relation_type: 'related_to';
|
|
8
|
-
}
|
|
9
|
-
export declare function getSalesNotePolicy(note_type: string): SalesNotePolicy | null;
|
|
10
|
-
export declare function buildSalesNoteText(input: SalesNoteTextInput): Record<string, string>;
|
|
11
|
-
export interface SalesNoteValidationOptions {
|
|
12
|
-
allowUnresolvedOrderTarget?: boolean;
|
|
13
|
-
expectedOrderTargetUuid?: string;
|
|
14
|
-
productTargetUuids?: ReadonlySet<string>;
|
|
15
|
-
}
|
|
16
|
-
export type EncodeSalesNotesOptions = SalesNoteValidationOptions;
|
|
17
|
-
export declare function encodeSalesNotes(notes: SalesNote[], options?: EncodeSalesNotesOptions): SalesNoteProtocol[];
|
|
18
|
-
export interface DecodedSalesNotesSnapshot {
|
|
19
|
-
notes: SalesNote[];
|
|
20
|
-
complete: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface DecodeSalesNotesOptions {
|
|
23
|
-
allowUnresolvedOrderTarget?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export declare function decodeSalesNotesSnapshot(value: unknown, options?: DecodeSalesNotesOptions): DecodedSalesNotesSnapshot;
|
|
26
|
-
export declare function decodeSalesNotes(value: unknown, options?: DecodeSalesNotesOptions): SalesNote[];
|
|
27
|
-
export declare function finalizeSalesNotesForCheckout(params: {
|
|
28
|
-
notes: unknown;
|
|
29
|
-
shopOrderNumber: unknown;
|
|
30
|
-
productTargetUuids: string[];
|
|
31
|
-
}): SalesNoteProtocol[];
|