@pisell/pisellos 2.3.72 → 2.3.73
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/OpenData/types.d.ts +1 -0
- package/dist/modules/Order/utils.js +6 -1
- package/dist/modules/ResourcePlanner/index.d.ts +0 -22
- package/dist/modules/ResourcePlanner/index.js +1 -180
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/ResourcePlanner/localClock.js +183 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
- package/dist/modules/ResourcePlanner/planner.js +2019 -936
- package/dist/modules/ResourcePlanner/types.d.ts +346 -187
- package/dist/modules/ResourcePlanner/types.js +33 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +4 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/dist/solution/UnifiedBookingSales/index.js +3349 -971
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/dist/solution/UnifiedBookingSales/types.js +4 -9
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/OpenData/types.d.ts +1 -0
- package/lib/modules/Order/utils.js +5 -1
- package/lib/modules/ResourcePlanner/index.d.ts +0 -22
- package/lib/modules/ResourcePlanner/index.js +0 -123
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/ResourcePlanner/localClock.js +270 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
- package/lib/modules/ResourcePlanner/planner.js +1903 -798
- package/lib/modules/ResourcePlanner/types.d.ts +346 -187
- package/lib/modules/ResourcePlanner/types.js +19 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/lib/solution/UnifiedBookingSales/index.js +2289 -374
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/lib/solution/UnifiedBookingSales/types.js +3 -2
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { Module } from '../../types';
|
|
1
|
+
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
5
|
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
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, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
8
|
import { BookingTicket } from '../BookingTicket';
|
|
9
9
|
export * from './types';
|
|
10
|
+
export { AvailabilityError } from '../../modules/ResourcePlanner';
|
|
10
11
|
/**
|
|
11
12
|
* Converts Rules/Order discount internals into a small UI-facing diagnostic. The result keeps
|
|
12
13
|
* candidate-card state separate from line-level applications: a selected card is not proof that
|
|
@@ -22,39 +23,37 @@ export declare function buildPlannerDiscountResult(params: {
|
|
|
22
23
|
preferredDiscountId?: number | string;
|
|
23
24
|
preferredDiscountFound?: boolean;
|
|
24
25
|
}): UnifiedBookingSalesDiscountResult;
|
|
25
|
-
/** Converts
|
|
26
|
-
export declare function
|
|
26
|
+
/** Converts ProductList and schedule records into the pure Availability vocabulary. */
|
|
27
|
+
export declare function normalizeProductForAvailability(product: ProductData | Record<string, any>, scheduleList?: ScheduleItem[], fixedOffsetMinutes?: number): AvailabilityProduct;
|
|
27
28
|
/**
|
|
28
29
|
* Materializes resource work windows locally from v2's schedule ids, then keeps its flat
|
|
29
|
-
* event_list as
|
|
30
|
+
* event_list as resource occupancy records. This deliberately avoids the older API's times -> event_list
|
|
30
31
|
* response nesting and lets one resource response serve any requested date range.
|
|
31
32
|
*/
|
|
32
|
-
export declare function
|
|
33
|
+
export declare function buildAvailabilityResourcesFromV2(params: {
|
|
33
34
|
rawResources: Record<string, any>[];
|
|
34
35
|
scheduleList: ScheduleItem[];
|
|
35
|
-
dateRange?:
|
|
36
|
+
dateRange?: AvailabilityDateRange;
|
|
37
|
+
fixedOffsetMinutes?: number;
|
|
36
38
|
}): {
|
|
37
|
-
resources:
|
|
38
|
-
|
|
39
|
+
resources: AvailabilityResource[];
|
|
40
|
+
resourceOccupancies: AvailabilityOccupancy[];
|
|
39
41
|
};
|
|
40
42
|
/** Combines URL-locked resources with every resource referenced by the selected products. */
|
|
41
|
-
export declare function
|
|
42
|
-
|
|
43
|
-
export declare function
|
|
44
|
-
assignment:
|
|
45
|
-
product:
|
|
43
|
+
export declare function collectAvailabilityResourceIds(products: AvailabilityProduct[], explicitResourceIds?: Array<number | string>): Array<number | string>;
|
|
44
|
+
export declare function buildAvailabilityLineIdentity(product: Record<string, any>): Record<string, any>;
|
|
45
|
+
export declare function buildBookingFromAvailabilityAssignment(params: {
|
|
46
|
+
assignment: Record<string, any>;
|
|
47
|
+
product: AvailabilityProduct;
|
|
48
|
+
timezone?: string;
|
|
49
|
+
fixedOffsetMinutes?: number;
|
|
46
50
|
}): Record<string, any>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare function buildBookingFromAssignments(params: {
|
|
53
|
-
assignments: ResourcePlannerAssignment[];
|
|
54
|
-
product: ResourcePlannerProduct;
|
|
51
|
+
export declare function buildBookingFromAvailabilityAssignments(params: {
|
|
52
|
+
assignments: Record<string, any>[];
|
|
53
|
+
product: AvailabilityProduct;
|
|
54
|
+
timezone?: string;
|
|
55
|
+
fixedOffsetMinutes?: number;
|
|
55
56
|
}): Record<string, any>;
|
|
56
|
-
/** Builds the exact identity BaseSales needs to remove only this solution's order lines. */
|
|
57
|
-
export declare function buildPlannerLineIdentity(product: Record<string, any>): Record<string, any>;
|
|
58
57
|
export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
59
58
|
protected defaultName: string;
|
|
60
59
|
protected defaultVersion: string;
|
|
@@ -63,7 +62,52 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
63
62
|
private openDataTarget;
|
|
64
63
|
private loadOpenDataInFlight;
|
|
65
64
|
private loadOpenDataInFlightTarget;
|
|
65
|
+
private availabilityRuntimeOffsetMinutes;
|
|
66
|
+
private availabilityScheduleCatalog;
|
|
67
|
+
private availabilityProjectionSequence;
|
|
68
|
+
private availabilityContextSequence;
|
|
69
|
+
private availabilityLifecycleGeneration;
|
|
70
|
+
private availabilityContextRegistry;
|
|
71
|
+
private availabilityProjectionPool;
|
|
72
|
+
private availabilityPrepareInFlight;
|
|
73
|
+
private availabilityProjectionRefreshInFlight;
|
|
74
|
+
private availabilityRemoteOccupancyCache;
|
|
75
|
+
private availabilityRemoteResourceQueryInFlight;
|
|
76
|
+
private availabilityRemoteResourceQuerySequence;
|
|
77
|
+
private availabilityRemoteResourceEpoch;
|
|
78
|
+
private availabilityCommitLocks;
|
|
79
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
66
80
|
protected getSubmitOrderSalesChannel(): string;
|
|
81
|
+
private createAvailabilityFacadeError;
|
|
82
|
+
private getAvailabilityScopeDescriptor;
|
|
83
|
+
private normalizeAvailabilityIdList;
|
|
84
|
+
private normalizeAvailabilityStringList;
|
|
85
|
+
private normalizeAvailabilityPrepareDescriptor;
|
|
86
|
+
private resolveAvailabilityPrepareDefaults;
|
|
87
|
+
private buildAvailabilityPrepareKey;
|
|
88
|
+
private clearAvailabilityRemoteResourceState;
|
|
89
|
+
private buildAvailabilityRemoteResourceScopeKey;
|
|
90
|
+
private buildAvailabilityRemoteResourceQueryKey;
|
|
91
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
92
|
+
cover?: boolean;
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
destroy(): Promise<void>;
|
|
95
|
+
private createAvailabilityContextId;
|
|
96
|
+
private buildAvailabilityProjectionKey;
|
|
97
|
+
private getAvailabilityRuntimeOffsetMinutes;
|
|
98
|
+
private getAvailabilityRuntimeDateTime;
|
|
99
|
+
private cloneAvailabilityPrepareParams;
|
|
100
|
+
private getAvailabilityDurationCandidateAnchorAt;
|
|
101
|
+
private createAvailabilityContextRef;
|
|
102
|
+
private emitAvailabilityDiagnostic;
|
|
103
|
+
private touchAvailabilityContext;
|
|
104
|
+
private touchAvailabilityProjection;
|
|
105
|
+
private removeAvailabilityProjection;
|
|
106
|
+
private removeAvailabilityContext;
|
|
107
|
+
private evictAvailabilityProjectionPool;
|
|
108
|
+
private evictAvailabilityContextRegistry;
|
|
109
|
+
private invalidateAvailabilityContextsAfterCommit;
|
|
110
|
+
private resetAvailabilityProjectionState;
|
|
67
111
|
protected isSessionStoragePersistEnabled(): boolean;
|
|
68
112
|
protected shouldUseSessionStorageForSubModule(moduleName?: string): boolean;
|
|
69
113
|
/**
|
|
@@ -133,17 +177,10 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
133
177
|
* diagnostic boundary for new booking skins: no pricing logic is duplicated in the planner.
|
|
134
178
|
*/
|
|
135
179
|
applyPlannerDiscounts(params?: UnifiedBookingSalesApplyPlannerDiscountsParams): Promise<UnifiedBookingSalesDiscountResult>;
|
|
136
|
-
/** ResourcePlanner is a required child module; fail early instead of producing partial availability. */
|
|
137
|
-
private getPlanner;
|
|
138
180
|
private buildUnifiedOrderProduct;
|
|
139
181
|
/** Replacing a staged selection is idempotent and never removes unrelated cart lines. */
|
|
140
182
|
private removeExistingStagedLines;
|
|
141
183
|
private stageProducts;
|
|
142
|
-
/**
|
|
143
|
-
* Adds the current product choice to an otherwise clean planner cart without creating bookings.
|
|
144
|
-
* This separates "what the customer wants" from the later time/resource confirmation step.
|
|
145
|
-
*/
|
|
146
|
-
stagePlannerProducts(params: UnifiedBookingSalesStagePlannerProductsParams): Promise<Record<string, any> | null>;
|
|
147
184
|
/**
|
|
148
185
|
* Adds ordinary retail products without asking ResourcePlanner for booking facts.
|
|
149
186
|
* Its staged lines have separate ownership so planner and retail skins can coexist safely.
|
|
@@ -155,50 +192,50 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
155
192
|
* "replace the staged selection" for demo and wizard-like callers.
|
|
156
193
|
*/
|
|
157
194
|
addRetailProduct(params: UnifiedBookingSalesAddRetailProductParams): Promise<Record<string, any>[]>;
|
|
158
|
-
|
|
159
|
-
private
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
*/
|
|
166
|
-
private ensurePlannerSchedulesForResources;
|
|
195
|
+
private normalizeAvailabilityDateRange;
|
|
196
|
+
private assertAvailabilityPrepareParams;
|
|
197
|
+
private captureAvailabilityScheduleCatalog;
|
|
198
|
+
/** Returns the solution-lifetime schedule snapshot captured after initialization. */
|
|
199
|
+
private getAvailabilityScheduleCatalog;
|
|
200
|
+
private buildAvailabilityOperatingHoursSnapshot;
|
|
201
|
+
private loadAvailabilityProducts;
|
|
167
202
|
/**
|
|
168
203
|
* Fetches resource metadata plus flat occupied events. Work windows are intentionally derived
|
|
169
|
-
* locally in
|
|
204
|
+
* locally in buildAvailabilityResourcesFromV2 from /schedule, rather than requested from the legacy
|
|
170
205
|
* resource dates endpoint.
|
|
171
206
|
*/
|
|
172
|
-
private
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
private
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
207
|
+
private fetchAvailabilityResourcesV2;
|
|
208
|
+
private fetchAndPublishAvailabilityResourcesV2;
|
|
209
|
+
private refreshAvailabilityRemoteResourceQuery;
|
|
210
|
+
private loadAvailabilityResources;
|
|
211
|
+
private resolveEditingOccupancyExclusions;
|
|
212
|
+
private occupancyIsExcluded;
|
|
213
|
+
private collectCartResourceOccupancies;
|
|
214
|
+
private getCurrentOrderRevision;
|
|
215
|
+
private getAvailabilityContextEntry;
|
|
216
|
+
private getAvailabilityProjectionByKey;
|
|
217
|
+
private getActiveAvailabilityProjectionEntry;
|
|
218
|
+
private decorateAvailabilityCandidate;
|
|
219
|
+
private assertAvailabilityCandidateFreshness;
|
|
220
|
+
private assertContextualQueryFreshness;
|
|
221
|
+
private storeAvailabilityProjectionEntry;
|
|
222
|
+
private buildAvailabilityProjectionSnapshot;
|
|
223
|
+
private getSharedPreparedAvailabilitySnapshot;
|
|
224
|
+
private refreshAvailabilityContextProjection;
|
|
225
|
+
private ensureAvailabilityContextProjection;
|
|
226
|
+
private tryAcquireAvailabilityCommitLock;
|
|
227
|
+
private releaseAvailabilityCommitLock;
|
|
228
|
+
/** IO boundary: loads catalog, schedules, resources, occupancies, and registers one context. */
|
|
229
|
+
prepareAvailabilityProjection(params: UnifiedBookingSalesPrepareAvailabilityProjectionParams): Promise<AvailabilityContextRef>;
|
|
230
|
+
/** Pure configuration calculation over the current context projection. */
|
|
231
|
+
getProductTimeRanges(contextId: string, request?: GetProductTimeRangesRequest): Promise<ContextualProductTimeRangeGroup[]>;
|
|
232
|
+
/** Thin facade: auto-refresh on cart drift, then delegate to the pure projection query. */
|
|
233
|
+
queryBookingAvailability(contextId: string, request: ContextualAvailabilityQuery): Promise<ContextualAvailabilityQueryResult>;
|
|
234
|
+
releaseAvailabilityContext(contextId: string): void;
|
|
235
|
+
private assertAvailabilityCommitWriteCAS;
|
|
236
|
+
private findProductLineByUid;
|
|
237
|
+
private findLinkedBooking;
|
|
238
|
+
/** Revalidates against the latest landed occupancy cache, then mutates exactly one product line. */
|
|
239
|
+
commitAvailabilitySelection(contextId: string, params: ContextualCommitAvailabilitySelectionParams): Promise<UnifiedBookingSalesCommitAvailabilitySelectionResult>;
|
|
203
240
|
}
|
|
204
241
|
export declare const UnifiedBookingSales: typeof UnifiedBookingSalesImpl;
|