@pisell/pisellos 2.2.323 → 2.2.324
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/dist/modules/BookingContext/utils/productExtend.js +122 -29
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +16 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +54 -11
- package/dist/modules/Order/index.js +2699 -1411
- package/dist/modules/Order/types.d.ts +43 -5
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +6 -2
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +161 -51
- package/dist/modules/ResourcePlanner/planner.js +58 -2
- package/dist/modules/ResourcePlanner/types.d.ts +13 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +58 -39
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1312 -1154
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +4 -0
- package/dist/shared/receipt/small-ticket.js +70 -12
- package/dist/solution/BaseSales/index.d.ts +39 -5
- package/dist/solution/BaseSales/index.js +1828 -1462
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +17 -3
- package/dist/solution/BookingByStep/index.js +676 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +15 -3
- package/dist/solution/BookingTicket/index.js +249 -135
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/OrderInvoicePreview/index.js +14 -8
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +166 -67
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/dist/solution/UnifiedBookingSales/index.js +3374 -1177
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/lib/modules/BookingContext/utils/productExtend.js +96 -7
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +16 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +54 -11
- package/lib/modules/Order/index.js +659 -80
- package/lib/modules/Order/types.d.ts +43 -5
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +6 -2
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +74 -0
- package/lib/modules/ResourcePlanner/planner.js +52 -1
- package/lib/modules/ResourcePlanner/types.d.ts +13 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +25 -9
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +124 -16
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +4 -0
- package/lib/shared/receipt/small-ticket.js +63 -8
- package/lib/solution/BaseSales/index.d.ts +39 -5
- package/lib/solution/BaseSales/index.js +212 -18
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BookingByStep/index.d.ts +17 -3
- package/lib/solution/BookingByStep/index.js +222 -14
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +15 -3
- package/lib/solution/BookingTicket/index.js +47 -4
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/OrderInvoicePreview/index.js +7 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +72 -2
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/lib/solution/UnifiedBookingSales/index.js +1316 -73
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ export declare class AvailabilityRemoteOccupancyCache {
|
|
|
11
11
|
scopeKey: string;
|
|
12
12
|
resourceIds: AvailabilityId[];
|
|
13
13
|
dateRange: AvailabilityDateRange;
|
|
14
|
+
/** Only opt-in preview reads expire cells; legacy reads retain their SWR semantics. */
|
|
15
|
+
maxAgeMs?: number;
|
|
14
16
|
}): Record<string, any>[] | null;
|
|
15
17
|
hasCompleteCoverage(params: {
|
|
16
18
|
scopeKey: string;
|
|
@@ -117,6 +117,7 @@ class AvailabilityRemoteOccupancyCache {
|
|
|
117
117
|
const requestedResourceIds = uniqueIds(params.resourceIds);
|
|
118
118
|
const requestedDates = buildDateList(params.dateRange);
|
|
119
119
|
if (requestedResourceIds.length === 0 || requestedDates.length === 0) return [];
|
|
120
|
+
const now = Date.now();
|
|
120
121
|
const resources = [];
|
|
121
122
|
for (const resourceId of requestedResourceIds) {
|
|
122
123
|
const resourceKey = this.buildResourceKey(params.scopeKey, resourceId);
|
|
@@ -125,6 +126,7 @@ class AvailabilityRemoteOccupancyCache {
|
|
|
125
126
|
const cellKey = this.buildCellKey(resourceKey, date);
|
|
126
127
|
const cell = this.touchCell(cellKey);
|
|
127
128
|
if (!cell) return null;
|
|
129
|
+
if (params.maxAgeMs !== undefined && (now < cell.fetchedAt || now - cell.fetchedAt >= params.maxAgeMs)) return null;
|
|
128
130
|
cell.eventList.forEach(rawEvent => {
|
|
129
131
|
eventList.set(buildEventIdentity(resourceId, rawEvent), (0, _lodashEs.cloneDeep)(rawEvent));
|
|
130
132
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MultipleBookingScheduling } from '../../modules/OpenData';
|
|
2
|
+
export interface ResolveDefaultBookingStartParams {
|
|
3
|
+
/** Product bookings in cart insertion order; unrelated order-level bookings are excluded by the facade. */
|
|
4
|
+
bookings: readonly Record<string, any>[];
|
|
5
|
+
holderIds?: unknown;
|
|
6
|
+
mode?: MultipleBookingScheduling;
|
|
7
|
+
fallback?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Normalize scalar/array holder identities without merging the no-holder group with real holders. */
|
|
10
|
+
export declare function normalizeBookingHolderIds(value: unknown): string[];
|
|
11
|
+
export declare function getBookingHolderIds(booking: Record<string, any>): string[];
|
|
12
|
+
/** Validate input and convert absolute ISO values to the runtime-local date/time used by booking fields. */
|
|
13
|
+
export declare function normalizeBookingDateTime(value: unknown): string | undefined;
|
|
14
|
+
export declare function getBookingBoundary(booking: Record<string, any>, edge: 'start' | 'end'): string | undefined;
|
|
15
|
+
/** Select a default only; availability and resource occupancy remain the commit path's authority. */
|
|
16
|
+
export declare function resolveDefaultBookingStart({ bookings, holderIds, mode, fallback, }: ResolveDefaultBookingStartParams): string | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBookingBoundary = getBookingBoundary;
|
|
7
|
+
exports.getBookingHolderIds = getBookingHolderIds;
|
|
8
|
+
exports.normalizeBookingDateTime = normalizeBookingDateTime;
|
|
9
|
+
exports.normalizeBookingHolderIds = normalizeBookingHolderIds;
|
|
10
|
+
exports.resolveDefaultBookingStart = resolveDefaultBookingStart;
|
|
11
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
12
|
+
var _pickupTiming = require("../../modules/Order/pickupTiming");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
/** Normalize scalar/array holder identities without merging the no-holder group with real holders. */
|
|
15
|
+
function normalizeBookingHolderIds(value) {
|
|
16
|
+
const values = Array.isArray(value) ? value : value == null ? [] : [value];
|
|
17
|
+
return Array.from(new Set(values.flatMap(id => {
|
|
18
|
+
if (typeof id !== 'string' && typeof id !== 'number') return [];
|
|
19
|
+
const text = String(id).trim();
|
|
20
|
+
return text && text !== '0' ? [text] : [];
|
|
21
|
+
})));
|
|
22
|
+
}
|
|
23
|
+
function getBookingHolderIds(booking) {
|
|
24
|
+
return normalizeBookingHolderIds(booking.holder_id ?? booking.metadata?.holder_id ?? booking.holder?.form_record ?? booking.metadata?.holder?.form_record ?? booking._extend?.holder_id ?? booking._extend?.holder?.form_record);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Validate input and convert absolute ISO values to the runtime-local date/time used by booking fields. */
|
|
28
|
+
function normalizeBookingDateTime(value) {
|
|
29
|
+
if (typeof value !== 'string') return undefined;
|
|
30
|
+
const text = value.trim().replace(' ', 'T');
|
|
31
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/.exec(text);
|
|
32
|
+
if (!match) return undefined;
|
|
33
|
+
const [, y, m, d, h, minute, second = '0', zone] = match;
|
|
34
|
+
const calendar = new Date(`${y}-${m}-${d}T00:00:00.000Z`);
|
|
35
|
+
if (!Number.isFinite(calendar.getTime()) || calendar.toISOString().slice(0, 10) !== `${y}-${m}-${d}` || Number(h) > 23 || Number(minute) > 59 || Number(second) > 59 || !(0, _dayjs.default)(text).isValid()) return undefined;
|
|
36
|
+
return zone ? (0, _dayjs.default)(text).format('YYYY-MM-DDTHH:mm:ss') : text;
|
|
37
|
+
}
|
|
38
|
+
function getBookingBoundary(booking, edge) {
|
|
39
|
+
const direct = booking[`${edge}At`] ?? booking[`${edge}_at`];
|
|
40
|
+
const directTime = normalizeBookingDateTime(direct);
|
|
41
|
+
if (directTime) return directTime;
|
|
42
|
+
const date = booking[`${edge}_date`];
|
|
43
|
+
const time = booking[`${edge}_time`];
|
|
44
|
+
if (typeof date !== 'string') return undefined;
|
|
45
|
+
return typeof time === 'string' ? normalizeBookingDateTime(`${date.slice(0, 10)}T${time}`) : normalizeBookingDateTime(date);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Select a default only; availability and resource occupancy remain the commit path's authority. */
|
|
49
|
+
function resolveDefaultBookingStart({
|
|
50
|
+
bookings,
|
|
51
|
+
holderIds,
|
|
52
|
+
mode = 'same_start_time',
|
|
53
|
+
fallback
|
|
54
|
+
}) {
|
|
55
|
+
const holders = new Set(normalizeBookingHolderIds(holderIds));
|
|
56
|
+
const related = bookings.flatMap(booking => {
|
|
57
|
+
if (!booking || (0, _pickupTiming.isFulfillmentTimingBooking)(booking) || booking.deleted_at) return [];
|
|
58
|
+
const previousHolders = getBookingHolderIds(booking);
|
|
59
|
+
const matches = holders.size === 0 ? previousHolders.length === 0 : previousHolders.some(holder => holders.has(holder));
|
|
60
|
+
if (!matches) return [];
|
|
61
|
+
const start = getBookingBoundary(booking, 'start');
|
|
62
|
+
const end = getBookingBoundary(booking, 'end');
|
|
63
|
+
if (!start || !end || !(0, _dayjs.default)(end).isAfter((0, _dayjs.default)(start))) return [];
|
|
64
|
+
return [{
|
|
65
|
+
start,
|
|
66
|
+
end
|
|
67
|
+
}];
|
|
68
|
+
});
|
|
69
|
+
if (!related.length) return normalizeBookingDateTime(fallback);
|
|
70
|
+
if (mode === 'same_start_time') return related[related.length - 1].start;
|
|
71
|
+
return related.reduce((latest, booking) => (0, _dayjs.default)(booking.end).isAfter((0, _dayjs.default)(latest)) ? booking.end : latest, related[0].end);
|
|
72
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AvailabilityDateRange } from '../../modules/ResourcePlanner';
|
|
2
|
+
type ResourceId = number | string;
|
|
3
|
+
type RawResource = Record<string, any>;
|
|
4
|
+
export interface AvailabilitySessionResourceQuery {
|
|
5
|
+
resourceIds: ResourceId[];
|
|
6
|
+
dateRange: AvailabilityDateRange;
|
|
7
|
+
}
|
|
8
|
+
export interface AvailabilitySessionResourceLoadParams extends AvailabilitySessionResourceQuery {
|
|
9
|
+
/** The owner supplies shop/tenant, order cache, business and channel identity. */
|
|
10
|
+
scopeKey: string;
|
|
11
|
+
timezoneName: string;
|
|
12
|
+
/** Must reject transport/business errors; only a successful empty array is negative coverage. */
|
|
13
|
+
fetch: (query: AvailabilitySessionResourceQuery) => Promise<RawResource[]>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Opt-in venue-session snapshots. Unlike the legacy SWR cache, a covered resource/day is never
|
|
17
|
+
* refreshed or evicted during this session. Only missing cells are fetched, including when a new
|
|
18
|
+
* resource set partly overlaps an earlier one. The final backend submission remains authoritative.
|
|
19
|
+
*/
|
|
20
|
+
export declare class AvailabilitySessionResourceCache {
|
|
21
|
+
private readonly cells;
|
|
22
|
+
private readonly pending;
|
|
23
|
+
private generation;
|
|
24
|
+
clear(): void;
|
|
25
|
+
load(params: AvailabilitySessionResourceLoadParams): Promise<RawResource[]>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AvailabilitySessionResourceCache = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
9
|
+
function datesInRange(range) {
|
|
10
|
+
const count = (0, _localClock.dateOrdinalFromLocalDate)(range.endDate) - (0, _localClock.dateOrdinalFromLocalDate)(range.startDate) + 1;
|
|
11
|
+
// A legal 90-business-day projection may include its preceding opening and overnight tail.
|
|
12
|
+
if (count < 1 || count > 92) throw new Error('Resource coverage requires a valid range of at most 92 days.');
|
|
13
|
+
const dates = [];
|
|
14
|
+
let date = (0, _localClock.formatLocalDate)(range.startDate);
|
|
15
|
+
for (let index = 0; index < count; index += 1) {
|
|
16
|
+
dates.push(date);
|
|
17
|
+
date = (0, _localClock.nextDate)(date);
|
|
18
|
+
}
|
|
19
|
+
return dates;
|
|
20
|
+
}
|
|
21
|
+
function resourceIdOf(resource) {
|
|
22
|
+
return resource.resourceId ?? resource.resource_id ?? resource.id;
|
|
23
|
+
}
|
|
24
|
+
function eventTime(event, edge) {
|
|
25
|
+
return String(event[`${edge}_at`] ?? event[`${edge}At`] ?? event[`${edge}_time`] ?? event[`${edge}Time`] ?? '');
|
|
26
|
+
}
|
|
27
|
+
function stableValue(value) {
|
|
28
|
+
if (Array.isArray(value)) return value.map(stableValue);
|
|
29
|
+
if (value && typeof value === 'object') {
|
|
30
|
+
return Object.keys(value).sort().reduce((result, key) => {
|
|
31
|
+
result[key] = stableValue(value[key]);
|
|
32
|
+
return result;
|
|
33
|
+
}, {});
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
function eventIdentity(event) {
|
|
38
|
+
const id = event.schedule_event_id ?? event.scheduleEventId ?? event.server_event_id ?? event.id;
|
|
39
|
+
const isUniqueEvent = id !== undefined && id !== null && id !== '';
|
|
40
|
+
return {
|
|
41
|
+
// A booking/product UID can own several allocations. Only an actual event ID plus its
|
|
42
|
+
// interval identifies one event; otherwise retain the complete payload and its multiplicity.
|
|
43
|
+
key: isUniqueEvent ? `event:${JSON.stringify([String(id), eventTime(event, 'start'), eventTime(event, 'end')])}` : `raw:${JSON.stringify(stableValue(event))}`,
|
|
44
|
+
isUniqueEvent
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function eventsOnDate(events, date) {
|
|
48
|
+
const start = (0, _localClock.localDateToScalarStart)(date);
|
|
49
|
+
const end = (0, _localClock.localDateToScalarStart)((0, _localClock.nextDate)(date));
|
|
50
|
+
return events.filter(event => {
|
|
51
|
+
try {
|
|
52
|
+
const eventStart = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(eventTime(event, 'start')));
|
|
53
|
+
const eventEnd = (0, _localClock.localDateTimeToScalar)((0, _localClock.parseLocalDateTime)(eventTime(event, 'end')));
|
|
54
|
+
return eventStart < eventEnd && eventStart < end && eventEnd > start;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Opt-in venue-session snapshots. Unlike the legacy SWR cache, a covered resource/day is never
|
|
63
|
+
* refreshed or evicted during this session. Only missing cells are fetched, including when a new
|
|
64
|
+
* resource set partly overlaps an earlier one. The final backend submission remains authoritative.
|
|
65
|
+
*/
|
|
66
|
+
class AvailabilitySessionResourceCache {
|
|
67
|
+
cells = new Map();
|
|
68
|
+
pending = new Map();
|
|
69
|
+
generation = 0;
|
|
70
|
+
clear() {
|
|
71
|
+
this.generation += 1;
|
|
72
|
+
this.cells.clear();
|
|
73
|
+
this.pending.clear();
|
|
74
|
+
}
|
|
75
|
+
async load(params) {
|
|
76
|
+
const generation = this.generation;
|
|
77
|
+
const assertCurrent = () => {
|
|
78
|
+
if (generation !== this.generation) {
|
|
79
|
+
throw Object.assign(new Error('Resource session changed while loading. Please prepare again.'), {
|
|
80
|
+
code: 'AVAILABILITY_CONTEXT_NOT_FOUND'
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const resources = Array.from(new Map(params.resourceIds.filter(id => id !== undefined && id !== null && id !== '').map(id => [String(id), id])).values());
|
|
85
|
+
const dates = datesInRange(params.dateRange);
|
|
86
|
+
const key = (resourceId, date) => JSON.stringify([params.scopeKey, params.timezoneName, String(resourceId), date]);
|
|
87
|
+
const waits = new Set();
|
|
88
|
+
const gaps = [];
|
|
89
|
+
let previousIds = '';
|
|
90
|
+
dates.forEach(date => {
|
|
91
|
+
const missing = resources.filter(resourceId => {
|
|
92
|
+
const cellKey = key(resourceId, date);
|
|
93
|
+
if (this.cells.has(cellKey)) return false;
|
|
94
|
+
const pending = this.pending.get(cellKey);
|
|
95
|
+
if (pending) {
|
|
96
|
+
waits.add(pending);
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
}).sort((left, right) => String(left).localeCompare(String(right)));
|
|
101
|
+
const ids = JSON.stringify(missing.map(String));
|
|
102
|
+
const previous = gaps[gaps.length - 1];
|
|
103
|
+
if (missing.length && ids === previousIds && previous && (0, _localClock.nextDate)(previous.dateRange.endDate) === date) {
|
|
104
|
+
previous.dateRange.endDate = date;
|
|
105
|
+
} else if (missing.length) {
|
|
106
|
+
gaps.push({
|
|
107
|
+
resourceIds: missing,
|
|
108
|
+
dateRange: {
|
|
109
|
+
startDate: date,
|
|
110
|
+
endDate: date
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
previousIds = ids;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Reserve every missing cell synchronously before dispatching any request. This also deduplicates
|
|
118
|
+
// partial overlapping in-flight queries, rather than only identical or fully covering requests.
|
|
119
|
+
gaps.forEach(query => {
|
|
120
|
+
const queryDates = datesInRange(query.dateRange);
|
|
121
|
+
const cellKeys = query.resourceIds.flatMap(id => queryDates.map(date => key(id, date)));
|
|
122
|
+
const promise = Promise.resolve().then(async () => {
|
|
123
|
+
assertCurrent();
|
|
124
|
+
const response = await params.fetch((0, _lodashEs.cloneDeep)(query));
|
|
125
|
+
assertCurrent();
|
|
126
|
+
if (!Array.isArray(response)) throw new Error('Booking resources returned an invalid response.');
|
|
127
|
+
const byId = new Map();
|
|
128
|
+
response.forEach(resource => {
|
|
129
|
+
if (!resource || typeof resource !== 'object' || Array.isArray(resource)) {
|
|
130
|
+
throw new Error('Booking resources returned an invalid resource.');
|
|
131
|
+
}
|
|
132
|
+
const id = resourceIdOf(resource);
|
|
133
|
+
if (typeof id !== 'string' && typeof id !== 'number' || id === '' || typeof id === 'number' && !Number.isFinite(id) || resource.event_list != null && !Array.isArray(resource.event_list)) {
|
|
134
|
+
throw new Error('Booking resources returned invalid identity or occupancy data.');
|
|
135
|
+
}
|
|
136
|
+
byId.set(String(id), (0, _lodashEs.cloneDeep)(resource));
|
|
137
|
+
});
|
|
138
|
+
// Assemble the response before publishing any cells, so malformed data cannot mark a
|
|
139
|
+
// partially successful range as covered. Missing resources in a valid response are cached too.
|
|
140
|
+
const updates = new Map();
|
|
141
|
+
query.resourceIds.forEach(id => {
|
|
142
|
+
const raw = byId.get(String(id));
|
|
143
|
+
const events = Array.isArray(raw?.event_list) ? raw.event_list : [];
|
|
144
|
+
const metadata = raw ? (({
|
|
145
|
+
event_list: _events,
|
|
146
|
+
...rest
|
|
147
|
+
}) => rest)(raw) : null;
|
|
148
|
+
queryDates.forEach(date => updates.set(key(id, date), {
|
|
149
|
+
resource: metadata,
|
|
150
|
+
events: eventsOnDate(events, date)
|
|
151
|
+
}));
|
|
152
|
+
});
|
|
153
|
+
assertCurrent();
|
|
154
|
+
updates.forEach((cell, cellKey) => {
|
|
155
|
+
if (!this.cells.has(cellKey)) this.cells.set(cellKey, cell);
|
|
156
|
+
});
|
|
157
|
+
}).finally(() => {
|
|
158
|
+
cellKeys.forEach(cellKey => {
|
|
159
|
+
if (this.pending.get(cellKey) === promise) this.pending.delete(cellKey);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
cellKeys.forEach(cellKey => this.pending.set(cellKey, promise));
|
|
163
|
+
waits.add(promise);
|
|
164
|
+
});
|
|
165
|
+
await Promise.all(Array.from(waits));
|
|
166
|
+
assertCurrent();
|
|
167
|
+
const result = [];
|
|
168
|
+
resources.forEach(id => {
|
|
169
|
+
let metadata = null;
|
|
170
|
+
const events = new Map();
|
|
171
|
+
dates.forEach(date => {
|
|
172
|
+
const cell = this.cells.get(key(id, date));
|
|
173
|
+
if (!cell) throw new Error('Resource session coverage was lost. Please prepare again.');
|
|
174
|
+
if (!metadata && cell.resource) metadata = cell.resource;
|
|
175
|
+
const occurrences = new Map();
|
|
176
|
+
cell.events.forEach(event => {
|
|
177
|
+
const identity = eventIdentity(event);
|
|
178
|
+
const occurrence = identity.isUniqueEvent ? 0 : occurrences.get(identity.key) || 0;
|
|
179
|
+
occurrences.set(identity.key, occurrence + 1);
|
|
180
|
+
const occupancyKey = JSON.stringify([identity.key, occurrence]);
|
|
181
|
+
// Merge the maximum count seen in a day, not a set of booking UIDs: anonymous duplicate
|
|
182
|
+
// allocations must still count twice, while one cross-midnight event counts only once.
|
|
183
|
+
if (!events.has(occupancyKey)) events.set(occupancyKey, {
|
|
184
|
+
...event,
|
|
185
|
+
__availabilitySessionOccupancyKey: occupancyKey
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
if (metadata) {
|
|
190
|
+
result.push((0, _lodashEs.cloneDeep)({
|
|
191
|
+
...metadata,
|
|
192
|
+
event_list: Array.from(events.values()).sort((left, right) => eventTime(left, 'start').localeCompare(eventTime(right, 'start')) || eventTime(left, 'end').localeCompare(eventTime(right, 'end')))
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
exports.AvailabilitySessionResourceCache = AvailabilitySessionResourceCache;
|
|
@@ -6,10 +6,42 @@ import type { AvailabilityDateRange, AvailabilityErrorCode, AvailabilityId, Avai
|
|
|
6
6
|
import type { BookingTicketState } from '../BookingTicket/types';
|
|
7
7
|
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
8
8
|
import type { SalesNoteDraftInput } from '../../modules/Order/types';
|
|
9
|
+
import type { BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult } from '../BaseSales/types';
|
|
9
10
|
export type { ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
10
11
|
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
12
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
12
13
|
}
|
|
14
|
+
/** Read-only preview scope; existing solution queries remain fresh for selection and submission. */
|
|
15
|
+
export interface UnifiedBookingSalesCatalogQueryBatch {
|
|
16
|
+
queryCatalogSnapshot(params: ProductListLoadProductsParams): Promise<ProductData[]>;
|
|
17
|
+
queryCatalogProductDetail(params: ProductListLoadProductsParams & {
|
|
18
|
+
product_id: number;
|
|
19
|
+
}): Promise<ProductData | undefined>;
|
|
20
|
+
/** Releases retained results. A disposed batch cannot be reused. */
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
/** Venue page lifetime pool. Reads/quotes stay local; explicit opening may hydrate a variant once. */
|
|
24
|
+
export interface UnifiedBookingSalesVenueCatalogSession {
|
|
25
|
+
queryCatalogSnapshot(params?: ProductListLoadProductsParams): Promise<ProductData[]>;
|
|
26
|
+
queryCatalogProductDetail(params: ProductListLoadProductsParams & {
|
|
27
|
+
product_id: number;
|
|
28
|
+
}): Promise<ProductData | undefined>;
|
|
29
|
+
/** User-initiated opening only. Non-variant products never load a detail endpoint. */
|
|
30
|
+
prepareProductDetail(params: ProductListLoadProductsParams & {
|
|
31
|
+
product_id: number;
|
|
32
|
+
retry?: boolean;
|
|
33
|
+
}): Promise<ProductData | undefined>;
|
|
34
|
+
calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
|
|
35
|
+
/** Retries failed pool/detail loads; successfully loaded records remain cached. */
|
|
36
|
+
retry(): void;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
39
|
+
export type UnifiedBookingSalesVenueCatalogSessionParams = ProductListLoadProductsParams & {
|
|
40
|
+
/** Stable page/order session identity shared by main and extras pools. */
|
|
41
|
+
sessionKey?: string;
|
|
42
|
+
/** Lets implicit order repricing select the originating pool without guessing by product ID. */
|
|
43
|
+
poolRole?: 'main' | 'extras';
|
|
44
|
+
};
|
|
13
45
|
export interface UnifiedBookingSalesPolicy {
|
|
14
46
|
id?: AvailabilityId;
|
|
15
47
|
title?: unknown;
|
|
@@ -39,6 +71,19 @@ export interface UnifiedBookingSalesLoadOpenDataParams {
|
|
|
39
71
|
channel: string;
|
|
40
72
|
force?: boolean;
|
|
41
73
|
}
|
|
74
|
+
export interface UnifiedBookingSalesQueryBookingResourceDetailsParams {
|
|
75
|
+
/** Explicit booking date, YYYY-MM-DD. No implicit current-date fallback. */
|
|
76
|
+
date: string;
|
|
77
|
+
resourceIds: AvailabilityId[];
|
|
78
|
+
}
|
|
79
|
+
/** Original resource metadata. form_id is its resource type, not an associated customer form. */
|
|
80
|
+
export interface UnifiedBookingSalesResourceDetail extends Record<string, any> {
|
|
81
|
+
id: AvailabilityId;
|
|
82
|
+
resource_form_id?: number | string | null;
|
|
83
|
+
policy_id?: number | string | null;
|
|
84
|
+
form_id?: AvailabilityId;
|
|
85
|
+
main_field?: unknown;
|
|
86
|
+
}
|
|
42
87
|
export interface UnifiedBookingSalesLoadProductsByScheduleDateParams extends Omit<ProductListLoadProductsParams, 'schedule_date' | 'product_ids'> {
|
|
43
88
|
date: string;
|
|
44
89
|
product_ids?: number[];
|
|
@@ -59,6 +104,14 @@ export interface UnifiedBookingSalesPrepareAvailabilityProjectionParams {
|
|
|
59
104
|
dateRange?: Partial<AvailabilityDateRange>;
|
|
60
105
|
catalogScope?: UnifiedBookingSalesCatalogScope;
|
|
61
106
|
rawProducts?: Record<string, any>[];
|
|
107
|
+
/** Keep an independent catalog/projection without replacing the public sales catalog. Defaults to true. */
|
|
108
|
+
publishCatalog?: boolean;
|
|
109
|
+
/** Await remote occupancy refresh instead of stale-while-revalidate. Ignores rawResources; does not lock resources. */
|
|
110
|
+
refreshOccupancies?: boolean;
|
|
111
|
+
/** cache_first: 30-second preview. session: retain resource/date coverage for this venue page, including commit; overrides refreshOccupancies. Omit for legacy SWR. */
|
|
112
|
+
occupancyCachePolicy?: 'cache_first' | 'session';
|
|
113
|
+
/** Enforce configured sale cutoffs and disable manual POS availability overrides for this context. Defaults to false. */
|
|
114
|
+
strictAvailability?: boolean;
|
|
62
115
|
rawResources?: Record<string, any>[];
|
|
63
116
|
rawOccupancies?: AvailabilityOccupancy[];
|
|
64
117
|
editingProductLineUids?: string[];
|
|
@@ -74,8 +127,9 @@ export interface AvailabilityContextRef {
|
|
|
74
127
|
contextId: string;
|
|
75
128
|
/** POS/Kiosk duration protocol capability and business-day default. */
|
|
76
129
|
durationTimeSelection?: {
|
|
77
|
-
version:
|
|
130
|
+
version: 2;
|
|
78
131
|
currentBusinessDate: string;
|
|
132
|
+
orderSessionId: string | null;
|
|
79
133
|
};
|
|
80
134
|
}
|
|
81
135
|
export interface ContextualProductTimeRange extends ProductTimeRange {
|
|
@@ -100,6 +154,8 @@ export type ContextualAvailabilityQuery = (Omit<Extract<AvailabilityQuery, {
|
|
|
100
154
|
})) & {
|
|
101
155
|
/** Automatic remembered selection must not inherit POS manual exceptions. */
|
|
102
156
|
selectionIntent?: 'remembered' | 'manual';
|
|
157
|
+
rememberedTimeByProductId?: GetProductTimeRangesRequest['rememberedTimeByProductId'];
|
|
158
|
+
orderSessionId?: string;
|
|
103
159
|
};
|
|
104
160
|
export type ContextualTimeAvailabilityItem = Omit<TimeAvailabilityItem, keyof ProductTimeRange> & ContextualProductTimeRange;
|
|
105
161
|
export interface ContextualTimeAvailabilityGroup extends Omit<TimeAvailabilityGroup, 'times'> {
|
|
@@ -160,14 +216,26 @@ export interface UnifiedBookingSalesAddRetailProductParams {
|
|
|
160
216
|
productId?: number | string;
|
|
161
217
|
quantity?: number;
|
|
162
218
|
productLoadParams?: ProductListLoadProductsParams;
|
|
219
|
+
salesNotes?: SalesNoteDraftInput[];
|
|
220
|
+
availabilityCommitGuard?: () => void;
|
|
163
221
|
}
|
|
164
222
|
export interface ContextualCommitAvailabilitySelectionParams {
|
|
165
|
-
mode: 'add' | 'edit';
|
|
223
|
+
mode: 'add' | 'edit' | 'replace';
|
|
166
224
|
/** Only POS duration add supports automatic remembered-time commits. */
|
|
167
225
|
selectionIntent?: 'remembered' | 'manual';
|
|
226
|
+
/** v2 remembered commits must still belong to the order that saved the interval. */
|
|
227
|
+
orderSessionId?: string;
|
|
168
228
|
/** Local UI intent guard, checked again immediately before the Order mutation. */
|
|
169
229
|
availabilityCommitGuard?: () => void;
|
|
170
230
|
productLineUid?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Confirmed complete Party extras set (configured, purchase-time-repriced retail source products).
|
|
233
|
+
* Their legacy venue_booking_service_datetime metadata stores the venue-local quote time,
|
|
234
|
+
* independently of the main product's appointment time.
|
|
235
|
+
* Required for replace; edit opts into the same atomic path. Existing extras keep their own
|
|
236
|
+
* metadata.unique_identification_number; new extras omit it. [] explicitly removes all owned extras.
|
|
237
|
+
*/
|
|
238
|
+
relatedRetailProducts?: Record<string, any>[];
|
|
171
239
|
orderProduct: Record<string, any>;
|
|
172
240
|
candidate: ContextualProductTimeRange;
|
|
173
241
|
requirementSelections: AvailabilityRequirementSelection[];
|
|
@@ -242,6 +310,7 @@ export interface UnifiedBookingSalesApi {
|
|
|
242
310
|
loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
|
|
243
311
|
queryProducts: (params?: ProductListStoreQueryParams) => Promise<ProductData[]>;
|
|
244
312
|
stageRetailProducts: (params: UnifiedBookingSalesStageRetailProductsParams) => Promise<Record<string, any> | null>;
|
|
313
|
+
supportsVenueExtraHolders: () => boolean;
|
|
245
314
|
addRetailProduct: (params: UnifiedBookingSalesAddRetailProductParams) => Promise<Record<string, any>[]>;
|
|
246
315
|
prepareAvailabilityProjection: (params: UnifiedBookingSalesPrepareAvailabilityProjectionParams) => Promise<AvailabilityContextRef>;
|
|
247
316
|
getProductTimeRanges: (contextId: string, request?: GetProductTimeRangesRequest) => Promise<ContextualProductTimeRangeGroup[]>;
|
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UnifiedBookingSalesHooks = void 0;
|
|
7
|
+
/** Read-only preview scope; existing solution queries remain fresh for selection and submission. */
|
|
8
|
+
/** Venue page lifetime pool. Reads/quotes stay local; explicit opening may hydrate a variant once. */
|
|
7
9
|
let UnifiedBookingSalesHooks = exports.UnifiedBookingSalesHooks = /*#__PURE__*/function (UnifiedBookingSalesHooks) {
|
|
8
10
|
UnifiedBookingSalesHooks["onAvailabilityProjectionPrepared"] = "unifiedBookingSales:onAvailabilityProjectionPrepared";
|
|
9
11
|
UnifiedBookingSalesHooks["onAvailabilitySelectionCommitted"] = "unifiedBookingSales:onAvailabilitySelectionCommitted";
|
|
10
12
|
UnifiedBookingSalesHooks["onAvailabilityProjectionDiagnostic"] = "unifiedBookingSales:onAvailabilityProjectionDiagnostic";
|
|
11
13
|
return UnifiedBookingSalesHooks;
|
|
12
|
-
}({});
|
|
14
|
+
}({});
|
|
15
|
+
/** Original resource metadata. form_id is its resource type, not an associated customer form. */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
2
|
+
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
3
|
+
import type { BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult } from '../BaseSales/types';
|
|
4
|
+
import type { UnifiedBookingSalesVenueCatalogSession } from './types';
|
|
5
|
+
export type VenueCatalogRecord = Record<string, any>;
|
|
6
|
+
export interface VenueCatalogPool {
|
|
7
|
+
products: ProductData[];
|
|
8
|
+
menus: VenueCatalogRecord[];
|
|
9
|
+
/** Pricing menu_match follows the OS evaluator's full menu-definition contract. */
|
|
10
|
+
pricingMenus: VenueCatalogRecord[];
|
|
11
|
+
}
|
|
12
|
+
export declare function venueCatalogError(code: string, message: string): Error & {
|
|
13
|
+
code: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function readVenueCatalogList(response: any, description: string): VenueCatalogRecord[];
|
|
16
|
+
export declare function validateVenueMenus(records: VenueCatalogRecord[], ids: number[]): VenueCatalogRecord[];
|
|
17
|
+
/** Same ID/collection union as the local OS product query; variant selection stays with SKU validation. */
|
|
18
|
+
export declare function productMatchesVenueMenu(product: VenueCatalogRecord, menu: VenueCatalogRecord): boolean;
|
|
19
|
+
export declare function activeVenueMenus(menus: VenueCatalogRecord[], schedules: VenueCatalogRecord[], datetime: string, dateOnly?: boolean): VenueCatalogRecord[];
|
|
20
|
+
/** Internal loader injection is not exposed to material callers. Rejected loads remain rejected until explicit retry. */
|
|
21
|
+
export declare function createVenueCatalogSessionAdapter(options: {
|
|
22
|
+
assertCurrent(): void;
|
|
23
|
+
load(): Promise<VenueCatalogPool>;
|
|
24
|
+
snapshot(pool: VenueCatalogPool, params: ProductListLoadProductsParams): ProductData[];
|
|
25
|
+
prepareDetail(pool: VenueCatalogPool, params: ProductListLoadProductsParams & {
|
|
26
|
+
product_id: number;
|
|
27
|
+
retry?: boolean;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
quote(pool: VenueCatalogPool, params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
|
|
30
|
+
onDispose?(): void;
|
|
31
|
+
onRetry?(): void;
|
|
32
|
+
}): UnifiedBookingSalesVenueCatalogSession;
|