@pisell/pisellos 2.3.191 → 2.3.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/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/Order/index.d.ts +13 -5
- package/dist/modules/Order/index.js +1053 -554
- package/dist/modules/Order/types.d.ts +20 -1
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +125 -39
- package/dist/modules/ResourcePlanner/planner.js +5 -0
- package/dist/server/index.js +5 -2
- package/dist/solution/BaseSales/index.d.ts +14 -3
- package/dist/solution/BaseSales/index.js +285 -195
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +49 -1
- package/dist/solution/UnifiedBookingSales/index.js +2276 -902
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -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 +64 -1
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- 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/Order/index.d.ts +13 -5
- package/lib/modules/Order/index.js +208 -7
- package/lib/modules/Order/types.d.ts +20 -1
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +56 -0
- package/lib/modules/ResourcePlanner/planner.js +4 -0
- package/lib/server/index.js +5 -1
- package/lib/solution/BaseSales/index.d.ts +14 -3
- package/lib/solution/BaseSales/index.js +67 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +49 -1
- package/lib/solution/UnifiedBookingSales/index.js +872 -55
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -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 +64 -1
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
2
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
3
|
+
import type { UnifiedBookingSalesCatalogQueryBatch } from './types';
|
|
4
|
+
type DetailParams = ProductListLoadProductsParams & {
|
|
5
|
+
product_id: number;
|
|
6
|
+
};
|
|
7
|
+
export interface CatalogQueryRuntime {
|
|
8
|
+
references: unknown[];
|
|
9
|
+
values: unknown;
|
|
10
|
+
/** Late-loaded pricing/schedule data may refresh within the same owner. */
|
|
11
|
+
refreshValues?: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** Internal adapter: membership loaders are never accepted from public callers. */
|
|
14
|
+
export declare function createCatalogQueryBatchAdapter(options: {
|
|
15
|
+
runtime(): CatalogQueryRuntime;
|
|
16
|
+
normalize(params: ProductListLoadProductsParams, now: number): ProductListLoadProductsParams;
|
|
17
|
+
key(params: ProductListLoadProductsParams): string;
|
|
18
|
+
snapshot(params: ProductListLoadProductsParams): Promise<ProductData[]>;
|
|
19
|
+
detail(params: DetailParams, snapshot: UnifiedBookingSalesCatalogQueryBatch['queryCatalogSnapshot']): Promise<ProductData | undefined>;
|
|
20
|
+
}): UnifiedBookingSalesCatalogQueryBatch;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createCatalogQueryBatchAdapter = createCatalogQueryBatchAdapter;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
const BATCH_MAX_AGE_MS = 60 * 1000;
|
|
9
|
+
// Enough for a 42-day calendar with several product details per day, but bounded.
|
|
10
|
+
const BATCH_MAX_ENTRIES = 512;
|
|
11
|
+
|
|
12
|
+
/** Internal adapter: membership loaders are never accepted from public callers. */
|
|
13
|
+
function createCatalogQueryBatchAdapter(options) {
|
|
14
|
+
let disposed = false;
|
|
15
|
+
let epoch;
|
|
16
|
+
const sameOwner = (left, right) => left.references.length === right.references.length && left.references.every((ref, index) => ref === right.references[index]) && (0, _lodashEs.isEqual)(left.values, right.values);
|
|
17
|
+
const fail = code => Object.assign(new Error(code === 'CATALOG_QUERY_BATCH_DISPOSED' ? 'The catalog query batch is closed. Create a new batch before querying.' : 'The catalog context changed while loading. Please retry.'), {
|
|
18
|
+
code
|
|
19
|
+
});
|
|
20
|
+
const current = () => {
|
|
21
|
+
if (disposed) throw fail('CATALOG_QUERY_BATCH_DISPOSED');
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
const runtime = options.runtime();
|
|
24
|
+
if (!epoch || now < epoch.startedAt || now - epoch.startedAt >= BATCH_MAX_AGE_MS || !sameOwner(runtime, epoch.runtime) || !(0, _lodashEs.isEqual)(runtime.refreshValues, epoch.runtime.refreshValues)) {
|
|
25
|
+
epoch?.entries.clear();
|
|
26
|
+
epoch = {
|
|
27
|
+
runtime: {
|
|
28
|
+
references: [...runtime.references],
|
|
29
|
+
values: (0, _lodashEs.cloneDeep)(runtime.values),
|
|
30
|
+
refreshValues: (0, _lodashEs.cloneDeep)(runtime.refreshValues)
|
|
31
|
+
},
|
|
32
|
+
startedAt: now,
|
|
33
|
+
entries: new Map()
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return epoch;
|
|
37
|
+
};
|
|
38
|
+
const assertEpoch = owner => {
|
|
39
|
+
const next = current();
|
|
40
|
+
if (next !== owner) throw Object.assign(fail('CATALOG_QUERY_BATCH_STALE'), {
|
|
41
|
+
retryable: sameOwner(owner.runtime, next.runtime)
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const run = async load => {
|
|
45
|
+
for (let attempt = 0;; attempt++) {
|
|
46
|
+
try {
|
|
47
|
+
return await load(current());
|
|
48
|
+
} catch (error) {
|
|
49
|
+
const failure = error;
|
|
50
|
+
// Drop the old result and reread under the new configuration. Never replay
|
|
51
|
+
// a network error, disposed batch or a request belonging to a different user/store.
|
|
52
|
+
if (attempt >= 2 || failure?.code !== 'CATALOG_QUERY_BATCH_STALE' || !failure.retryable) throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const read = async (owner, key, load) => {
|
|
57
|
+
assertEpoch(owner);
|
|
58
|
+
let promise = owner.entries.get(key);
|
|
59
|
+
if (promise) {
|
|
60
|
+
owner.entries.delete(key);
|
|
61
|
+
owner.entries.set(key, promise);
|
|
62
|
+
} else {
|
|
63
|
+
promise = Promise.resolve().then(() => {
|
|
64
|
+
assertEpoch(owner);
|
|
65
|
+
return load();
|
|
66
|
+
}).then(value => (0, _lodashEs.cloneDeep)(value));
|
|
67
|
+
owner.entries.set(key, promise);
|
|
68
|
+
while (owner.entries.size > BATCH_MAX_ENTRIES) owner.entries.delete(owner.entries.keys().next().value);
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const result = await promise;
|
|
72
|
+
assertEpoch(owner);
|
|
73
|
+
return (0, _lodashEs.cloneDeep)(result);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (owner.entries.get(key) === promise) owner.entries.delete(key);
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const snapshotFor = async (owner, input) => {
|
|
80
|
+
assertEpoch(owner);
|
|
81
|
+
const {
|
|
82
|
+
product_ids,
|
|
83
|
+
...scope
|
|
84
|
+
} = options.normalize((0, _lodashEs.cloneDeep)(input), owner.startedAt);
|
|
85
|
+
// The membership scope is always the whole menu; ID filtering is only a detached view.
|
|
86
|
+
const products = await read(owner, `list:${options.key(scope)}`, () => options.snapshot(scope));
|
|
87
|
+
return product_ids?.length ? products.filter(product => product_ids.some(id => Number(id) === Number(product.id))) : products;
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
queryCatalogSnapshot: params => run(owner => snapshotFor(owner, params)),
|
|
91
|
+
queryCatalogProductDetail: input => run(owner => {
|
|
92
|
+
const {
|
|
93
|
+
product_id,
|
|
94
|
+
product_ids: _ignored,
|
|
95
|
+
...scope
|
|
96
|
+
} = (0, _lodashEs.cloneDeep)(input);
|
|
97
|
+
const params = {
|
|
98
|
+
...options.normalize(scope, owner.startedAt),
|
|
99
|
+
product_id
|
|
100
|
+
};
|
|
101
|
+
return read(owner, `detail:${options.key(params)}`, () => options.detail(params, query => snapshotFor(owner, query)));
|
|
102
|
+
}),
|
|
103
|
+
dispose: () => {
|
|
104
|
+
disposed = true;
|
|
105
|
+
epoch?.entries.clear();
|
|
106
|
+
epoch = undefined;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -6,7 +6,7 @@ import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataCo
|
|
|
6
6
|
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
7
7
|
import type { ProductListLoadProductsParams, ProductListStoreQueryParams } from '../../modules/ProductList';
|
|
8
8
|
import type { AvailabilityDateRange, AvailabilityOccupancy, AvailabilityProduct, AvailabilityResource, GetProductTimeRangesRequest } from '../../modules/ResourcePlanner';
|
|
9
|
-
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
9
|
+
import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAvailabilityQueryResult, ContextualCommitAvailabilitySelectionParams, ContextualProductTimeRangeGroup, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesCatalogQueryBatch, UnifiedBookingSalesVenueCatalogSession, UnifiedBookingSalesVenueCatalogSessionParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesCommitAvailabilitySelectionResult, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesPrepareAvailabilityProjectionParams, UnifiedBookingSalesPolicyResponse, UnifiedBookingSalesQueryBookingResourceDetailsParams, UnifiedBookingSalesResourceDetail, UnifiedBookingSalesResolveProductAllergyRequirementParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
10
10
|
import type { BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
11
11
|
import { BookingTicket } from '../BookingTicket';
|
|
12
12
|
import type { BaseSalesSubmitSalesOrderParams } from '../BaseSales/types';
|
|
@@ -72,8 +72,13 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
72
72
|
private runtimeOpenDataModule;
|
|
73
73
|
private runtimeOpenDataCore;
|
|
74
74
|
private runtimeOpenDataGeneration;
|
|
75
|
+
private runtimeInitializationGeneration;
|
|
75
76
|
private runtimeOpenDataDestroyed;
|
|
76
77
|
private unifiedProductCatalog;
|
|
78
|
+
private venueCatalogSessions;
|
|
79
|
+
private venueCatalogSessionKey?;
|
|
80
|
+
private venueCatalogMenus?;
|
|
81
|
+
private venueVariantDetails;
|
|
77
82
|
private availabilityRuntimeOffsetMinutes;
|
|
78
83
|
private availabilityScheduleCatalog;
|
|
79
84
|
private availabilityProjectionSequence;
|
|
@@ -84,6 +89,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
84
89
|
private availabilityPrepareInFlight;
|
|
85
90
|
private availabilityProjectionRefreshInFlight;
|
|
86
91
|
private availabilityRemoteOccupancyCache;
|
|
92
|
+
private availabilitySessionResourceCache;
|
|
87
93
|
private availabilityRemoteResourceQueryInFlight;
|
|
88
94
|
private availabilityRemoteResourceQuerySequence;
|
|
89
95
|
private availabilityRemoteResourceEpoch;
|
|
@@ -231,6 +237,42 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
231
237
|
callback?: (result: any) => void;
|
|
232
238
|
subscriberId?: string;
|
|
233
239
|
}): Promise<ProductData[]>;
|
|
240
|
+
/**
|
|
241
|
+
* Queries one explicitly configured menu scope without publishing the sales catalog.
|
|
242
|
+
* The returned graph is detached from ProductList's shared ID cache. Callers own its
|
|
243
|
+
* membership and must requery/reprice with the service datetime after a context change.
|
|
244
|
+
* Missing/invalid menu configuration fails closed instead of querying every product.
|
|
245
|
+
*/
|
|
246
|
+
queryCatalogSnapshot(params: ProductListLoadProductsParams): Promise<ProductData[]>;
|
|
247
|
+
/** Full SKU/bundle detail, after verifying membership in the explicit day/menu scope. */
|
|
248
|
+
queryCatalogProductDetail(params: ProductListLoadProductsParams & {
|
|
249
|
+
product_id: number;
|
|
250
|
+
}): Promise<ProductData | undefined>;
|
|
251
|
+
protected isVenueCatalogLocalPricingActive(): boolean;
|
|
252
|
+
protected getVenueCatalogLocalPriceSource(productId: number, selectedProduct?: Record<string, any>): {
|
|
253
|
+
product: Record<string, any>;
|
|
254
|
+
menuList: Record<string, any>[];
|
|
255
|
+
} | undefined;
|
|
256
|
+
getProductByIds(ids: number[], options?: {
|
|
257
|
+
loadMissing?: boolean;
|
|
258
|
+
}): Promise<ProductData[]>;
|
|
259
|
+
private getVenueCatalogHydratedProduct;
|
|
260
|
+
/** Explicit user opening for legacy promotion/gift SKU hosts. Pure readers never call this. */
|
|
261
|
+
prepareVenueCatalogProductDetail(params: {
|
|
262
|
+
product_id: number;
|
|
263
|
+
retry?: boolean;
|
|
264
|
+
}): Promise<ProductData | undefined>;
|
|
265
|
+
private hydrateVenueVariantDetail;
|
|
266
|
+
/** One complete raw product query per explicitly configured pool for this page lifetime. */
|
|
267
|
+
createVenueCatalogSession(params: UnifiedBookingSalesVenueCatalogSessionParams): UnifiedBookingSalesVenueCatalogSession;
|
|
268
|
+
/**
|
|
269
|
+
* Opt-in calendar/card preview batching. Results expire after sixty seconds or a
|
|
270
|
+
* runtime change; the next read starts a fresh clock/cache. Selection and submit
|
|
271
|
+
* must keep using the ordinary fresh query methods. Call dispose on owner cleanup.
|
|
272
|
+
*/
|
|
273
|
+
createCatalogQueryBatch(): UnifiedBookingSalesCatalogQueryBatch;
|
|
274
|
+
private loadCatalogProductDetail;
|
|
275
|
+
private loadCatalogProducts;
|
|
234
276
|
queryProducts(params?: ProductListStoreQueryParams): Promise<ProductData[]>;
|
|
235
277
|
/** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
|
|
236
278
|
loadScheduleAvailableDate(params: LoadScheduleAvailableDateParams): Promise<import("../../modules/Date/types").ITime[]>;
|
|
@@ -263,6 +305,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
263
305
|
* Its staged lines have separate ownership so planner and retail skins can coexist safely.
|
|
264
306
|
*/
|
|
265
307
|
stageRetailProducts(params: UnifiedBookingSalesStageRetailProductsParams): Promise<Record<string, any> | null>;
|
|
308
|
+
/** Explicit capability: order-scoped Tickets extras use guarded writes without implicit SKU merging. */
|
|
309
|
+
supportsVenueTicketExtras(): boolean;
|
|
266
310
|
/**
|
|
267
311
|
* Adds one retail line without replacing the cart's existing retail selection.
|
|
268
312
|
* This is intentionally separate from stageRetailProducts(), whose contract is
|
|
@@ -282,6 +326,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
282
326
|
* resource dates endpoint.
|
|
283
327
|
*/
|
|
284
328
|
private fetchAvailabilityResourcesV2;
|
|
329
|
+
/** Fresh read-only metadata for confirmation forms/policies; does not create a projection or mutate BookingContext. */
|
|
330
|
+
queryBookingResourceDetails(params: UnifiedBookingSalesQueryBookingResourceDetailsParams): Promise<UnifiedBookingSalesResourceDetail[]>;
|
|
285
331
|
private fetchAndPublishAvailabilityResourcesV2;
|
|
286
332
|
private refreshAvailabilityRemoteResourceQuery;
|
|
287
333
|
private loadAvailabilityResources;
|
|
@@ -308,6 +354,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
308
354
|
getProductTimeRanges(contextId: string, request?: GetProductTimeRangesRequest): Promise<ContextualProductTimeRangeGroup[]>;
|
|
309
355
|
/** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
|
|
310
356
|
queryBookingAvailability(contextId: string, request: ContextualAvailabilityQuery): Promise<ContextualAvailabilityQueryResult>;
|
|
357
|
+
/** Reads detached resource metadata from the current context; never refreshes or performs I/O. */
|
|
358
|
+
getAvailabilityResources(contextId: string, expectedVersion?: number): AvailabilityResource[];
|
|
311
359
|
releaseAvailabilityContext(contextId: string): void;
|
|
312
360
|
private assertAvailabilityCommitWriteCAS;
|
|
313
361
|
private findProductLineByUid;
|