@pisell/pisellos 2.3.214 → 2.3.216
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/modules/Order/index.d.ts +2 -0
- package/dist/modules/Order/index.js +12 -0
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +5 -2
- package/dist/modules/SalesSummary/index.d.ts +3 -0
- package/dist/modules/SalesSummary/index.js +104 -56
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +823 -739
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +47 -37
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/dist/solution/UnifiedBookingSales/index.js +84 -69
- package/dist/solution/UnifiedBookingSales/types.d.ts +4 -2
- package/lib/modules/Order/index.d.ts +2 -0
- package/lib/modules/Order/index.js +10 -0
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -1
- package/lib/modules/SalesSummary/index.d.ts +3 -0
- package/lib/modules/SalesSummary/index.js +36 -15
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +39 -0
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +3 -0
- package/lib/solution/UnifiedBookingSales/index.js +19 -7
- package/lib/solution/UnifiedBookingSales/types.d.ts +4 -2
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
11
11
|
private surchargeListModuleName;
|
|
12
12
|
private otherParams;
|
|
13
13
|
private surchargeListChannel;
|
|
14
|
+
private surchargeLoads;
|
|
14
15
|
constructor(name?: string, version?: string);
|
|
15
16
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
17
|
/**
|
|
@@ -22,6 +23,8 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
22
23
|
updateOtherParams(params: Record<string, any>): Promise<void>;
|
|
23
24
|
private resolveChannel;
|
|
24
25
|
getSurchargeList(channel?: string): Promise<void>;
|
|
26
|
+
private loadSurcharges;
|
|
27
|
+
private fetchSurcharges;
|
|
25
28
|
private getAppData;
|
|
26
29
|
private getTaxConfig;
|
|
27
30
|
getSummary(params: {
|
|
@@ -38,6 +38,7 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
38
38
|
surchargeListModuleName = 'surchargeList';
|
|
39
39
|
otherParams = {};
|
|
40
40
|
surchargeListChannel = DEFAULT_SURCHARGE_CHANNEL;
|
|
41
|
+
surchargeLoads = new Map();
|
|
41
42
|
constructor(name, version) {
|
|
42
43
|
super(name, version);
|
|
43
44
|
}
|
|
@@ -47,6 +48,7 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
47
48
|
this.appPlugin = this.core.getPlugin('app');
|
|
48
49
|
this.request = this.core.getPlugin('request');
|
|
49
50
|
this.otherParams = options.otherParams || {};
|
|
51
|
+
this.surchargeLoads = new Map();
|
|
50
52
|
this.store.surchargeList = options.initialState?.surchargeList || [];
|
|
51
53
|
this.store.summary = options.initialState?.summary || (0, _utils.createEmptySalesSummary)();
|
|
52
54
|
this.surchargeListModuleName = this.otherParams?.surchargeListModuleName || 'surchargeList';
|
|
@@ -70,10 +72,11 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
70
72
|
const previousChannel = this.resolveChannel();
|
|
71
73
|
const nextSurchargeListModuleName = params?.surchargeListModuleName || 'surchargeList';
|
|
72
74
|
const nextChannel = this.resolveChannel(params);
|
|
73
|
-
const
|
|
75
|
+
const sourceChanged = nextSurchargeListModuleName !== this.surchargeListModuleName || (params?.shopId ?? params?.shop_id) !== (this.otherParams.shopId ?? this.otherParams.shop_id) || (params?.tenantId ?? params?.tenant_id) !== (this.otherParams.tenantId ?? this.otherParams.tenant_id);
|
|
74
76
|
this.otherParams = params || {};
|
|
75
77
|
this.surchargeListModuleName = nextSurchargeListModuleName;
|
|
76
|
-
if (
|
|
78
|
+
if (sourceChanged) this.surchargeLoads = new Map();
|
|
79
|
+
if (sourceChanged || nextChannel !== previousChannel) {
|
|
77
80
|
await this.getSurchargeList(nextChannel);
|
|
78
81
|
}
|
|
79
82
|
}
|
|
@@ -81,14 +84,33 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
81
84
|
return params?.channel || DEFAULT_SURCHARGE_CHANNEL;
|
|
82
85
|
}
|
|
83
86
|
async getSurchargeList(channel = this.resolveChannel()) {
|
|
87
|
+
await this.loadSurcharges(channel);
|
|
88
|
+
}
|
|
89
|
+
loadSurcharges(channel) {
|
|
90
|
+
this.surchargeListChannel = channel;
|
|
91
|
+
const loads = this.surchargeLoads;
|
|
92
|
+
const pending = loads.get(channel);
|
|
93
|
+
if (pending) return pending;
|
|
94
|
+
|
|
95
|
+
// The core exposes the summary module while initialization is still pending.
|
|
96
|
+
// All calculations for this channel must wait for the same configuration, even when it is empty.
|
|
97
|
+
const load = this.fetchSurcharges(channel).then(list => {
|
|
98
|
+
loads.delete(channel);
|
|
99
|
+
if (loads === this.surchargeLoads && channel === this.surchargeListChannel) {
|
|
100
|
+
this.store.surchargeList = list;
|
|
101
|
+
}
|
|
102
|
+
return list;
|
|
103
|
+
});
|
|
104
|
+
loads.set(channel, load);
|
|
105
|
+
return load;
|
|
106
|
+
}
|
|
107
|
+
async fetchSurcharges(channel) {
|
|
84
108
|
try {
|
|
85
109
|
const surchargeListModule = this.core.getModule(this.surchargeListModuleName);
|
|
86
110
|
if (surchargeListModule?.getSurchargeList) {
|
|
87
|
-
|
|
111
|
+
return await surchargeListModule.getSurchargeList({
|
|
88
112
|
channel
|
|
89
113
|
});
|
|
90
|
-
this.surchargeListChannel = channel;
|
|
91
|
-
return;
|
|
92
114
|
}
|
|
93
115
|
const surchargeList = await this.request.get('/order/custom-surcharge/available/v2', {
|
|
94
116
|
channel,
|
|
@@ -96,12 +118,10 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
96
118
|
is_assemble_schedule_data: 1,
|
|
97
119
|
with: ['relationSchedule']
|
|
98
120
|
});
|
|
99
|
-
|
|
100
|
-
this.surchargeListChannel = channel;
|
|
121
|
+
return surchargeList?.data || [];
|
|
101
122
|
} catch (error) {
|
|
102
123
|
console.warn('[SalesSummaryModule] 加载附加费配置失败', error);
|
|
103
|
-
|
|
104
|
-
this.surchargeListChannel = channel;
|
|
124
|
+
return [];
|
|
105
125
|
}
|
|
106
126
|
}
|
|
107
127
|
getAppData(key) {
|
|
@@ -130,14 +150,13 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
130
150
|
virtualSettlementMode = false
|
|
131
151
|
} = params;
|
|
132
152
|
const summaryChannel = channel || this.resolveChannel();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
153
|
+
const loads = this.surchargeLoads;
|
|
154
|
+
const surchargeList = loads.has(summaryChannel) || summaryChannel !== this.surchargeListChannel ? await this.loadSurcharges(summaryChannel) : this.store.surchargeList;
|
|
136
155
|
const taxConfig = this.getTaxConfig();
|
|
137
156
|
const fatherModuleName = this.otherParams?.fatherModule || this.name.replace(/_salesSummary$/, '');
|
|
138
157
|
const scheduleModuleName = `${fatherModuleName}_schedule`;
|
|
139
158
|
const summarySchedule = this.core.getModule(scheduleModuleName);
|
|
140
|
-
const needScheduleIds = (
|
|
159
|
+
const needScheduleIds = (surchargeList?.map(item => item.available_schedule_ids)?.flat() || []).filter(id => id !== undefined && id !== null && id !== '');
|
|
141
160
|
const scheduleList = needScheduleIds.length > 0 ? summarySchedule?.getScheduleListByIds(needScheduleIds) : [];
|
|
142
161
|
const scheduleById = {};
|
|
143
162
|
if (Array.isArray(scheduleList)) {
|
|
@@ -149,7 +168,7 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
149
168
|
products,
|
|
150
169
|
isPriceIncludeTax: isPriceIncludeTax ?? taxConfig.isPriceIncludeTax ?? 1,
|
|
151
170
|
taxRate: taxRate ?? taxConfig.taxRate,
|
|
152
|
-
surchargeList
|
|
171
|
+
surchargeList,
|
|
153
172
|
scheduleById,
|
|
154
173
|
isInScheduleByDate: _Schedule.ScheduleModule.isInScheduleByDate,
|
|
155
174
|
shopDiscount,
|
|
@@ -161,7 +180,9 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
161
180
|
tax_rate: taxRate ?? taxConfig.taxRate,
|
|
162
181
|
tax_country_code: taxConfig.taxCountryCode || ''
|
|
163
182
|
};
|
|
164
|
-
this.
|
|
183
|
+
if (loads === this.surchargeLoads && summaryChannel === this.surchargeListChannel) {
|
|
184
|
+
this.store.summary = summaryWithTaxMeta;
|
|
185
|
+
}
|
|
165
186
|
return summaryWithTaxMeta;
|
|
166
187
|
}
|
|
167
188
|
}
|
package/lib/server/index.d.ts
CHANGED
|
@@ -289,6 +289,7 @@ declare class Server {
|
|
|
289
289
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
290
290
|
*/
|
|
291
291
|
private handleProductQuery;
|
|
292
|
+
private queryRawKioskProductPool;
|
|
292
293
|
/**
|
|
293
294
|
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
294
295
|
* In that case query against the current local time so menu availability can still be evaluated.
|
package/lib/server/index.js
CHANGED
|
@@ -1727,6 +1727,11 @@ class Server {
|
|
|
1727
1727
|
data,
|
|
1728
1728
|
config
|
|
1729
1729
|
}) => {
|
|
1730
|
+
// Venue previews seed one complete raw Kiosk pool. Quoting or applying the
|
|
1731
|
+
// current schedule here would remove members needed by other preview dates.
|
|
1732
|
+
if (data?.open_quotation === 0 && data?.application_code === 'kiosk') {
|
|
1733
|
+
return this.queryRawKioskProductPool(data);
|
|
1734
|
+
}
|
|
1730
1735
|
const {
|
|
1731
1736
|
menu_list_ids,
|
|
1732
1737
|
customer_id,
|
|
@@ -1795,6 +1800,40 @@ class Server {
|
|
|
1795
1800
|
}
|
|
1796
1801
|
return result;
|
|
1797
1802
|
};
|
|
1803
|
+
async queryRawKioskProductPool(data) {
|
|
1804
|
+
const preload = this.startupModulePreloadInFlight;
|
|
1805
|
+
if (preload) await preload;
|
|
1806
|
+
if (!this.products?.getProducts) {
|
|
1807
|
+
throw new Error('The local product catalog is not ready.');
|
|
1808
|
+
}
|
|
1809
|
+
const products = await this.products.getProducts();
|
|
1810
|
+
if (!Array.isArray(products)) {
|
|
1811
|
+
throw new Error('The local product catalog is unavailable.');
|
|
1812
|
+
}
|
|
1813
|
+
const filterSet = value => Array.isArray(value) && value.length ? new Set(value.filter(item => typeof item === 'string' || typeof item === 'number').map(item => String(item).trim()).filter(Boolean)) : undefined;
|
|
1814
|
+
const ids = filterSet(data.ids);
|
|
1815
|
+
const collections = filterSet(typeof data.collection === 'number' ? [data.collection] : data.collection);
|
|
1816
|
+
const categories = filterSet(data.category_ids);
|
|
1817
|
+
const extensionTypes = filterSet(data.extension_type);
|
|
1818
|
+
const list = products.filter(product => {
|
|
1819
|
+
if ((product.status || 'published') !== 'published' || 'deleted_at' in product && product.deleted_at) return false;
|
|
1820
|
+
if (!Array.isArray(product.channel_application) || !product.channel_application.includes('kiosk')) return false;
|
|
1821
|
+
if (ids && !ids.has(String(product.id))) return false;
|
|
1822
|
+
if (collections && !product.collection?.some(collection => collections.has(String(collection.id)))) return false;
|
|
1823
|
+
if (categories && !product.categories?.some(category => categories.has(String(category.id)) || categories.has(String(category.pivot?.product_category_id)))) return false;
|
|
1824
|
+
return !extensionTypes || extensionTypes.has(String(product.extension_type));
|
|
1825
|
+
});
|
|
1826
|
+
return {
|
|
1827
|
+
code: 200,
|
|
1828
|
+
status: true,
|
|
1829
|
+
message: '',
|
|
1830
|
+
data: {
|
|
1831
|
+
list,
|
|
1832
|
+
count: list.length,
|
|
1833
|
+
schedule_time_points: []
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
1798
1837
|
|
|
1799
1838
|
/**
|
|
1800
1839
|
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
@@ -276,6 +276,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
276
276
|
/** 获取附加费用(运费/服务费/税费等)。 */
|
|
277
277
|
getSurcharges(): ISalesSurcharge[];
|
|
278
278
|
getTempOrder(): OrderTempOrder | null;
|
|
279
|
+
/** 在真实支付前固定创建时间;只更新本地订单,已有时间不覆盖。 */
|
|
280
|
+
ensureOrderCreatedAt(): string;
|
|
279
281
|
getOrderSessionId(): string | null;
|
|
280
282
|
isOrderSessionCurrent(sessionId: string): boolean;
|
|
281
283
|
replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
|
|
@@ -1926,6 +1926,12 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1926
1926
|
const result = this.store.order?.getTempOrder() || null;
|
|
1927
1927
|
return result;
|
|
1928
1928
|
}
|
|
1929
|
+
|
|
1930
|
+
/** 在真实支付前固定创建时间;只更新本地订单,已有时间不覆盖。 */
|
|
1931
|
+
ensureOrderCreatedAt() {
|
|
1932
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1933
|
+
return this.store.order.ensureOrderCreatedAt();
|
|
1934
|
+
}
|
|
1929
1935
|
getOrderSessionId() {
|
|
1930
1936
|
return this.store.order?.getOrderSessionId?.() || null;
|
|
1931
1937
|
}
|
|
@@ -4042,7 +4048,6 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
4042
4048
|
const beforePayments = (0, _lodashEs.cloneDeep)(this.store.order.getOrderPayments());
|
|
4043
4049
|
const beforePaymentStatus = this.store.order.getTempOrder()?.payment_status;
|
|
4044
4050
|
const uniquePaymentNumber = (0, _utils.createUuidV4)();
|
|
4045
|
-
const paymentTimestamp = (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss');
|
|
4046
4051
|
const actualPaidAmount = Number(params.actualPaidAmount ?? amount);
|
|
4047
4052
|
const changeAmount = Number(params.changeAmount || 0);
|
|
4048
4053
|
const shopWalletPassId = this.otherParams?.shop_wallet_pass_id;
|
|
@@ -4052,6 +4057,8 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
4052
4057
|
if (this.isPickupTimingEnabled()) await this.preparePickupTimingForCheckout({
|
|
4053
4058
|
freeze: true
|
|
4054
4059
|
});
|
|
4060
|
+
this.ensureOrderCreatedAt();
|
|
4061
|
+
const paymentTimestamp = (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss');
|
|
4055
4062
|
this.window?.interaction?.utils?.postMessageToApp?.({
|
|
4056
4063
|
module: 'till',
|
|
4057
4064
|
key: 'open_till',
|
|
@@ -4153,6 +4160,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
4153
4160
|
}
|
|
4154
4161
|
const beforePayments = (0, _lodashEs.cloneDeep)(this.store.order.getOrderPayments());
|
|
4155
4162
|
const beforePaymentStatus = this.store.order.getTempOrder()?.payment_status;
|
|
4163
|
+
this.ensureOrderCreatedAt();
|
|
4156
4164
|
const paymentTimestamp = (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss');
|
|
4157
4165
|
const metadata = {
|
|
4158
4166
|
...(params.metadata || {}),
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
389
389
|
};
|
|
390
390
|
setOtherData(key: string, value: any): void;
|
|
391
391
|
getOtherData(key: string): any;
|
|
392
|
-
getProductTypeById(id: number): Promise<"normal" | "
|
|
392
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
393
393
|
/**
|
|
394
394
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
395
395
|
*
|
|
@@ -110,6 +110,9 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
110
110
|
protected getSubModuleHooks(moduleName: string): any;
|
|
111
111
|
private createAvailabilityFacadeError;
|
|
112
112
|
private getAvailabilityScopeDescriptor;
|
|
113
|
+
/** Kiosk keeps its device/channel semantics; only explicit Venue templates opt in. */
|
|
114
|
+
private isVenueKioskPlatform;
|
|
115
|
+
private supportsVenueSelectionSnapshot;
|
|
113
116
|
private usesDurationTimeGrid;
|
|
114
117
|
private getCurrentAvailabilityBusinessDate;
|
|
115
118
|
private getAvailabilityBusinessDateRange;
|
|
@@ -1402,9 +1402,20 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1402
1402
|
businessCode: String(otherParams.businessCode ?? otherParams.business_code ?? ''),
|
|
1403
1403
|
channel: String(otherParams.channel ?? ''),
|
|
1404
1404
|
platform: String(otherParams.platform ?? ''),
|
|
1405
|
-
businessTimezone: String(otherParams.businessTimezone ?? '')
|
|
1405
|
+
businessTimezone: String(otherParams.businessTimezone ?? ''),
|
|
1406
|
+
...(this.isVenueKioskPlatform(otherParams) ? {
|
|
1407
|
+
venueBookingMode: otherParams.venueBookingMode
|
|
1408
|
+
} : {})
|
|
1406
1409
|
};
|
|
1407
1410
|
}
|
|
1411
|
+
|
|
1412
|
+
/** Kiosk keeps its device/channel semantics; only explicit Venue templates opt in. */
|
|
1413
|
+
isVenueKioskPlatform(otherParams = this.otherParams || {}) {
|
|
1414
|
+
return (0, _platform.normalizeRuntimePlatform)(otherParams.platform) === 'kiosk' && (otherParams.venueBookingMode === 'tickets' || otherParams.venueBookingMode === 'party');
|
|
1415
|
+
}
|
|
1416
|
+
supportsVenueSelectionSnapshot() {
|
|
1417
|
+
return (0, _platform.isCustomerUserPlatform)(this.otherParams?.platform) || this.isVenueKioskPlatform();
|
|
1418
|
+
}
|
|
1408
1419
|
usesDurationTimeGrid(projection) {
|
|
1409
1420
|
const platform = String(this.otherParams?.platform ?? '').trim().toLowerCase();
|
|
1410
1421
|
return (platform === 'pos' || platform === 'kiosk') && (!projection || projection.products.some(product => product.kind === 'duration'));
|
|
@@ -1741,7 +1752,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1741
1752
|
if (explicitlySetsOpenData) {
|
|
1742
1753
|
this.openDataTarget = this.otherParams?.openData && nextScope.businessCode && nextScope.channel ? `${nextScope.businessCode}+${nextScope.channel}` : null;
|
|
1743
1754
|
}
|
|
1744
|
-
const shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone;
|
|
1755
|
+
const shouldResetAvailabilityState = previousScope.cacheId !== nextScope.cacheId || previousScope.businessCode !== nextScope.businessCode || previousScope.channel !== nextScope.channel || previousScope.platform !== nextScope.platform || previousScope.businessTimezone !== nextScope.businessTimezone || previousScope.venueBookingMode !== nextScope.venueBookingMode;
|
|
1745
1756
|
if (shouldResetAvailabilityState) {
|
|
1746
1757
|
await this.resetAvailabilityProjectionState('set_other_params_reset');
|
|
1747
1758
|
}
|
|
@@ -2766,7 +2777,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2766
2777
|
|
|
2767
2778
|
/** One complete raw product query per explicitly configured pool for this page lifetime. */
|
|
2768
2779
|
createVenueCatalogSession(params) {
|
|
2769
|
-
if (!
|
|
2780
|
+
if (!this.supportsVenueSelectionSnapshot()) {
|
|
2770
2781
|
throw (0, _venueCatalogSession.venueCatalogError)('VENUE_CATALOG_PLATFORM_UNSUPPORTED', 'Venue catalog sessions require a customer platform.');
|
|
2771
2782
|
}
|
|
2772
2783
|
const ids = params.menu_list_ids;
|
|
@@ -2778,6 +2789,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2778
2789
|
const generation = this.runtimeInitializationGeneration;
|
|
2779
2790
|
const core = this.core;
|
|
2780
2791
|
const request = this.request;
|
|
2792
|
+
const venueKioskMode = this.isVenueKioskPlatform() ? this.otherParams.venueBookingMode : undefined;
|
|
2781
2793
|
const entry = {
|
|
2782
2794
|
scope,
|
|
2783
2795
|
generation,
|
|
@@ -2798,7 +2810,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2798
2810
|
if (!this.venueCatalogSessions.has(entry)) {
|
|
2799
2811
|
throw (0, _venueCatalogSession.venueCatalogError)('VENUE_CATALOG_DISPOSED', 'The venue catalog session is closed.');
|
|
2800
2812
|
}
|
|
2801
|
-
if (this.runtimeOpenDataDestroyed || this.core !== core || this.request !== request || generation !== this.runtimeInitializationGeneration || scope !== this.getRuntimeOpenDataScope()) {
|
|
2813
|
+
if (this.runtimeOpenDataDestroyed || this.core !== core || this.request !== request || generation !== this.runtimeInitializationGeneration || scope !== this.getRuntimeOpenDataScope() || !this.supportsVenueSelectionSnapshot() || venueKioskMode !== (this.isVenueKioskPlatform() ? this.otherParams.venueBookingMode : undefined)) {
|
|
2802
2814
|
throw (0, _venueCatalogSession.venueCatalogError)('VENUE_CATALOG_STALE', 'The venue store context changed. Reopen the booking page.');
|
|
2803
2815
|
}
|
|
2804
2816
|
};
|
|
@@ -2835,7 +2847,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2835
2847
|
const queryPayload = {
|
|
2836
2848
|
schedule_date: datetime.slice(0, 10),
|
|
2837
2849
|
schedule_datetime: datetime,
|
|
2838
|
-
customer_id: input.customer_id ?? this.getTempOrder()?.customer_id ?? user?.get?.()?.id,
|
|
2850
|
+
customer_id: input.customer_id ?? this.getTempOrder()?.customer_id ?? (this.isVenueKioskPlatform() ? undefined : user?.get?.()?.id),
|
|
2839
2851
|
strategy_context: {
|
|
2840
2852
|
...this.getPriceQueryStrategyContext(),
|
|
2841
2853
|
...(input.strategy_context || {})
|
|
@@ -4612,7 +4624,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
4612
4624
|
|
|
4613
4625
|
/** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
|
|
4614
4626
|
async queryBookingAvailability(contextId, request) {
|
|
4615
|
-
const customerSelectionSnapshot = request.target === 'resource' && request.customerSelectionSnapshot === true &&
|
|
4627
|
+
const customerSelectionSnapshot = request.target === 'resource' && request.customerSelectionSnapshot === true && this.supportsVenueSelectionSnapshot();
|
|
4616
4628
|
const {
|
|
4617
4629
|
context,
|
|
4618
4630
|
projectionEntry,
|
|
@@ -4776,7 +4788,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
4776
4788
|
if (isRememberedSelection && (String(this.otherParams?.platform ?? '').trim().toLowerCase() !== 'pos' || params.mode !== 'add')) {
|
|
4777
4789
|
throw new _ResourcePlanner.AvailabilityError('INVALID_TARGET_FILTER', '记忆时间自动提交仅支持 POS 新增 duration 商品');
|
|
4778
4790
|
}
|
|
4779
|
-
const customerSelectionSnapshot = params.customerSelectionSnapshot === true &&
|
|
4791
|
+
const customerSelectionSnapshot = params.customerSelectionSnapshot === true && this.supportsVenueSelectionSnapshot();
|
|
4780
4792
|
const strictAvailability = this.availabilityContextRegistry.get(normalizedContextId)?.prepareParams.strictAvailability === true;
|
|
4781
4793
|
const hasCommitGuard = customerSelectionSnapshot || strictAvailability || isRememberedSelection || isPartyReplacement || Boolean(params.availabilityCommitGuard);
|
|
4782
4794
|
params.availabilityCommitGuard?.();
|
|
@@ -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 {
|
|
@@ -151,7 +153,7 @@ export type ContextualAvailabilityQuery = (Omit<Extract<AvailabilityQuery, {
|
|
|
151
153
|
target: 'resource';
|
|
152
154
|
}>, 'selectedRanges'> & {
|
|
153
155
|
selectedRanges: ContextualProductTimeRange[];
|
|
154
|
-
/** PC/H5
|
|
156
|
+
/** PC/H5 and explicitly enabled Venue Kiosk templates retain the already-selected time. */
|
|
155
157
|
customerSelectionSnapshot?: boolean;
|
|
156
158
|
})) & {
|
|
157
159
|
/** Automatic remembered selection must not inherit POS manual exceptions. */
|
|
@@ -223,7 +225,7 @@ export interface UnifiedBookingSalesAddRetailProductParams {
|
|
|
223
225
|
}
|
|
224
226
|
export interface ContextualCommitAvailabilitySelectionParams {
|
|
225
227
|
mode: 'add' | 'edit' | 'replace';
|
|
226
|
-
/** PC/H5
|
|
228
|
+
/** PC/H5 and enabled Venue Kiosk templates write the selected snapshot; checkout is authoritative. */
|
|
227
229
|
customerSelectionSnapshot?: boolean;
|
|
228
230
|
/** Only POS duration add supports automatic remembered-time commits. */
|
|
229
231
|
selectionIntent?: 'remembered' | 'manual';
|