@pisell/pisellos 2.3.71 → 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/server/index.js +2 -1
- package/dist/solution/BookingTicket/index.d.ts +13 -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/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/server/index.js +2 -1
- package/lib/solution/BookingTicket/index.d.ts +13 -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,91 +1,163 @@
|
|
|
1
|
-
import type { ResourcePlannerModule } from '../../modules';
|
|
2
1
|
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
3
|
-
import type { ResourcePlannerAssignment, ResourcePlannerAssignableSlotResult, ResourcePlannerContextInput, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from '../../modules/ResourcePlanner';
|
|
4
2
|
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
5
3
|
import type { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
4
|
+
import type { AvailabilityDateRange, AvailabilityErrorCode, AvailabilityId, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProjection, AvailabilityQuery, AvailabilityRequirementSelection, AvailabilityResource, AvailabilitySelectionValidationResult, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, ResourceAvailabilityGroup, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem } from '../../modules/ResourcePlanner';
|
|
6
5
|
import type { BookingTicketState } from '../BookingTicket/types';
|
|
7
|
-
export
|
|
8
|
-
onPlannerContextLoaded = "unifiedBookingSales:onPlannerContextLoaded",
|
|
9
|
-
onPlannerCommitted = "unifiedBookingSales:onPlannerCommitted"
|
|
10
|
-
}
|
|
6
|
+
export type { AvailabilityAbsoluteRange, AvailabilityAssignment, AvailabilityCell, AvailabilityDateRange, AvailabilityDisplayRange, AvailabilityErrorCode, AvailabilityId, AvailabilityMode, AvailabilityOccupancy, AvailabilityProduct, AvailabilityProductKind, AvailabilityProjection, AvailabilityProjectionInput, AvailabilityProjectionMeta, AvailabilityQuery, AvailabilityQueryResult, AvailabilityRequirementGroup, AvailabilityRequirementGroupResult, AvailabilityRequirementSelection, AvailabilityResource, AvailabilityResourceOption, AvailabilityResourceType, AvailabilityResourceWindow, AvailabilityScheduleMode, AvailabilityScheduleRef, AvailabilityScheduleRule, AvailabilitySelectionValidationParams, AvailabilitySelectionValidationResult, AvailabilitySessionRange, AvailabilityStatus, DateAvailabilityGroup, DateAvailabilityItem, DateAvailabilityQuery, DateAvailabilityQueryResult, GetProductTimeRangesRequest, ProductAvailabilityGroup, ProductAvailabilityItem, ProductAvailabilityQuery, ProductAvailabilityQueryResult, ProductTimeRange, ProductTimeRangeGroup, QueryAvailabilityBaseRequest, ResourceAvailabilityGroup, ResourceAvailabilityQuery, ResourceAvailabilityQueryResult, ResourceAvailabilityRangeGroup, TimeAvailabilityGroup, TimeAvailabilityItem, TimeAvailabilityQuery, TimeAvailabilityQueryResult, } from '../../modules/ResourcePlanner';
|
|
11
7
|
export interface UnifiedBookingSalesState extends BookingTicketState {
|
|
12
|
-
|
|
8
|
+
}
|
|
9
|
+
export declare enum UnifiedBookingSalesHooks {
|
|
10
|
+
onAvailabilityProjectionPrepared = "unifiedBookingSales:onAvailabilityProjectionPrepared",
|
|
11
|
+
onAvailabilitySelectionCommitted = "unifiedBookingSales:onAvailabilitySelectionCommitted",
|
|
12
|
+
onAvailabilityProjectionDiagnostic = "unifiedBookingSales:onAvailabilityProjectionDiagnostic"
|
|
13
13
|
}
|
|
14
14
|
export interface UnifiedBookingSalesOtherParams extends Record<string, any> {
|
|
15
|
-
/**
|
|
16
|
-
* Persist the active order workspace in sessionStorage, partitioned by cacheId.
|
|
17
|
-
* Disabled by default and ignored when cacheId is missing.
|
|
18
|
-
*/
|
|
19
15
|
enableSessionStoragePersist?: boolean;
|
|
20
16
|
}
|
|
21
|
-
/** Explicit OpenData target used by page-level UnifiedBookingSales skins. */
|
|
22
17
|
export interface UnifiedBookingSalesLoadOpenDataParams {
|
|
23
18
|
businessCode: string;
|
|
24
19
|
channel: string;
|
|
25
|
-
/** Bypasses the target-scoped in-memory cache. */
|
|
26
20
|
force?: boolean;
|
|
27
21
|
}
|
|
28
|
-
export interface UnifiedBookingSalesLoadPlannerContextParams extends ResourcePlannerQuery {
|
|
29
|
-
/** ProductList request options used only when products are not supplied as raw/context data. */
|
|
30
|
-
productLoadParams?: ProductListLoadProductsParams;
|
|
31
|
-
/** Escape hatch for tests or callers that already own raw ProductList records. */
|
|
32
|
-
rawProducts?: Record<string, any>[];
|
|
33
|
-
/** Escape hatch for tests or callers that already own raw resource records. */
|
|
34
|
-
rawResources?: Record<string, any>[];
|
|
35
|
-
/** Fully normalized Planner context; takes precedence over API loading for supplied fields. */
|
|
36
|
-
context?: ResourcePlannerContextInput;
|
|
37
|
-
/** Enables the v2 resource API + schedule materialization path. */
|
|
38
|
-
useResourceDateApi?: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface UnifiedBookingSalesCommitPlannerSelectionParams {
|
|
41
|
-
/** Optional selection patch applied before validation and order mutation. */
|
|
42
|
-
selection?: ResourcePlannerSelectionPatch;
|
|
43
|
-
/** Directly supplies selected resource/time facts, usually from resolveAssignableSlots(). */
|
|
44
|
-
assignments?: ResourcePlannerAssignment[];
|
|
45
|
-
/** Defaults to false. True performs the real BaseSales / OrderModule submit after tempOrder is written. */
|
|
46
|
-
submitAfterCommit?: boolean;
|
|
47
|
-
}
|
|
48
22
|
export interface UnifiedBookingSalesLoadProductsByScheduleDateParams extends Omit<ProductListLoadProductsParams, 'schedule_date' | 'product_ids'> {
|
|
49
|
-
/** The chosen calendar date, used for both availability lookup and ProductList schedule_date. */
|
|
50
23
|
date: string;
|
|
51
|
-
/** Optional caller-side filter applied after the availability result produces its product pool. */
|
|
52
24
|
product_ids?: number[];
|
|
53
|
-
/** Required by the availability API; this is not the low-code page id. */
|
|
54
25
|
custom_page_id?: number;
|
|
55
|
-
/** Availability API channel, commonly pc. ProductList keeps its own sales application channel. */
|
|
56
26
|
channel?: string;
|
|
57
27
|
}
|
|
58
|
-
export
|
|
59
|
-
|
|
28
|
+
export type UnifiedBookingSalesCatalogScope = {
|
|
29
|
+
type: 'schedule';
|
|
30
|
+
customPageId: number;
|
|
31
|
+
channel: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'productList';
|
|
34
|
+
params: ProductListLoadProductsParams;
|
|
35
|
+
};
|
|
36
|
+
export interface UnifiedBookingSalesPrepareAvailabilityProjectionParams {
|
|
37
|
+
productIds?: number[];
|
|
38
|
+
resourceIds?: AvailabilityId[];
|
|
39
|
+
dateRange?: Partial<AvailabilityDateRange>;
|
|
40
|
+
catalogScope?: UnifiedBookingSalesCatalogScope;
|
|
41
|
+
rawProducts?: Record<string, any>[];
|
|
42
|
+
rawResources?: Record<string, any>[];
|
|
43
|
+
rawOccupancies?: AvailabilityOccupancy[];
|
|
44
|
+
editingProductLineUids?: string[];
|
|
45
|
+
timezone?: string;
|
|
46
|
+
slotStepMinutes?: number;
|
|
47
|
+
businessHours?: {
|
|
48
|
+
startTime: string;
|
|
49
|
+
endTime: string;
|
|
50
|
+
};
|
|
51
|
+
mode?: 'appointment' | 'scan_order' | 'venue_grid';
|
|
52
|
+
}
|
|
53
|
+
export interface AvailabilityContextRef {
|
|
54
|
+
contextId: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ContextualProductTimeRange extends ProductTimeRange {
|
|
57
|
+
availabilityContextId: string;
|
|
58
|
+
availabilityContextVersion: number;
|
|
59
|
+
}
|
|
60
|
+
export interface ContextualProductTimeRangeGroup extends Omit<ProductTimeRangeGroup, 'ranges'> {
|
|
61
|
+
ranges: ContextualProductTimeRange[];
|
|
62
|
+
}
|
|
63
|
+
export type ContextualAvailabilityQuery = Omit<Extract<AvailabilityQuery, {
|
|
64
|
+
target: 'product';
|
|
65
|
+
}>, never> | Omit<Extract<AvailabilityQuery, {
|
|
66
|
+
target: 'date';
|
|
67
|
+
}>, never> | (Omit<Extract<AvailabilityQuery, {
|
|
68
|
+
target: 'time';
|
|
69
|
+
}>, 'candidates'> & {
|
|
70
|
+
candidates: ContextualProductTimeRange[];
|
|
71
|
+
}) | (Omit<Extract<AvailabilityQuery, {
|
|
72
|
+
target: 'resource';
|
|
73
|
+
}>, 'selectedRanges'> & {
|
|
74
|
+
selectedRanges: ContextualProductTimeRange[];
|
|
75
|
+
});
|
|
76
|
+
export type ContextualTimeAvailabilityItem = Omit<TimeAvailabilityItem, keyof ProductTimeRange> & ContextualProductTimeRange;
|
|
77
|
+
export interface ContextualTimeAvailabilityGroup extends Omit<TimeAvailabilityGroup, 'times'> {
|
|
78
|
+
times: ContextualTimeAvailabilityItem[];
|
|
79
|
+
}
|
|
80
|
+
export interface ContextualResourceAvailabilityRangeGroup extends Omit<ResourceAvailabilityRangeGroup, 'range'> {
|
|
81
|
+
range: ContextualProductTimeRange;
|
|
82
|
+
}
|
|
83
|
+
export interface ContextualResourceAvailabilityGroup extends Omit<ResourceAvailabilityGroup, 'ranges'> {
|
|
84
|
+
ranges: ContextualResourceAvailabilityRangeGroup[];
|
|
85
|
+
}
|
|
86
|
+
type ContextualAvailabilityQueryResultMeta = {
|
|
87
|
+
contextId: string;
|
|
88
|
+
contextVersion: number;
|
|
89
|
+
refreshed: boolean;
|
|
90
|
+
};
|
|
91
|
+
export type ContextualAvailabilityQueryResult = (ProductAvailabilityQueryResult & ContextualAvailabilityQueryResultMeta) | (DateAvailabilityQueryResult & ContextualAvailabilityQueryResultMeta) | ({
|
|
92
|
+
target: 'time';
|
|
93
|
+
evaluatedAt: string;
|
|
94
|
+
snapshotId: string;
|
|
95
|
+
data: ContextualTimeAvailabilityGroup[];
|
|
96
|
+
} & ContextualAvailabilityQueryResultMeta) | ({
|
|
97
|
+
target: 'resource';
|
|
98
|
+
evaluatedAt: string;
|
|
99
|
+
snapshotId: string;
|
|
100
|
+
data: ContextualResourceAvailabilityGroup[];
|
|
101
|
+
} & ContextualAvailabilityQueryResultMeta);
|
|
102
|
+
export type UnifiedBookingSalesAvailabilityCandidate = ContextualProductTimeRange;
|
|
103
|
+
export type UnifiedBookingSalesProductTimeRangeGroup = ContextualProductTimeRangeGroup;
|
|
104
|
+
export type UnifiedBookingSalesAvailabilityQueryResult = ContextualAvailabilityQueryResult;
|
|
105
|
+
export interface UnifiedBookingSalesAvailabilityPreparedPayload {
|
|
106
|
+
context: AvailabilityContextRef;
|
|
107
|
+
contextVersion: number;
|
|
108
|
+
projection: AvailabilityProjection;
|
|
109
|
+
refreshed: boolean;
|
|
110
|
+
reason?: string;
|
|
111
|
+
previousOrderRevision?: AvailabilityId;
|
|
112
|
+
}
|
|
113
|
+
export interface UnifiedBookingSalesAvailabilityDiagnosticPayload {
|
|
114
|
+
contextId: string | null;
|
|
115
|
+
contextVersion: number | null;
|
|
116
|
+
reason: string;
|
|
117
|
+
projection: AvailabilityProjection | null;
|
|
118
|
+
action: 'prepare' | 'refresh' | 'release' | 'destroy' | 'set_other_params_reset' | 'commit_lock_wait' | 'commit_lock_acquired' | 'commit_lock_released';
|
|
119
|
+
snapshotId?: string;
|
|
120
|
+
orderRevision?: AvailabilityId;
|
|
121
|
+
previousOrderRevision?: AvailabilityId;
|
|
122
|
+
registrySize: number;
|
|
123
|
+
projectionPoolSize: number;
|
|
124
|
+
}
|
|
125
|
+
export interface UnifiedBookingSalesStageRetailProductsParams {
|
|
60
126
|
productIds: Array<number | string>;
|
|
61
127
|
productLoadParams?: ProductListLoadProductsParams;
|
|
62
128
|
rawProducts?: Record<string, any>[];
|
|
63
129
|
}
|
|
64
|
-
/** Ordinary retail product staging. No resource, time, or booking facts are required. */
|
|
65
|
-
export type UnifiedBookingSalesStageRetailProductsParams = UnifiedBookingSalesStagePlannerProductsParams;
|
|
66
|
-
/** Adds one ordinary retail product without replacing other retail lines already in the cart. */
|
|
67
130
|
export interface UnifiedBookingSalesAddRetailProductParams {
|
|
68
|
-
/** Prefer a supplied catalog record when the UI has already loaded it. */
|
|
69
131
|
product?: Record<string, any>;
|
|
70
|
-
/** Used to resolve a product from the current catalog or load it on demand. */
|
|
71
132
|
productId?: number | string;
|
|
72
|
-
/** Defaults to one. */
|
|
73
133
|
quantity?: number;
|
|
74
|
-
/** Only used when the product is not already present in the solution catalog. */
|
|
75
134
|
productLoadParams?: ProductListLoadProductsParams;
|
|
76
135
|
}
|
|
77
|
-
export interface
|
|
136
|
+
export interface ContextualCommitAvailabilitySelectionParams {
|
|
137
|
+
mode: 'add' | 'edit';
|
|
138
|
+
productLineUid?: string;
|
|
139
|
+
orderProduct: Record<string, any>;
|
|
140
|
+
candidate: ContextualProductTimeRange;
|
|
141
|
+
requirementSelections: AvailabilityRequirementSelection[];
|
|
142
|
+
partySize: number;
|
|
143
|
+
bookingCount?: number;
|
|
144
|
+
}
|
|
145
|
+
export type UnifiedBookingSalesCommitAvailabilitySelectionParams = ContextualCommitAvailabilitySelectionParams;
|
|
146
|
+
export interface UnifiedBookingSalesCommitAvailabilitySelectionResult {
|
|
147
|
+
contextId: string;
|
|
148
|
+
contextVersion: number;
|
|
78
149
|
tempOrder: Record<string, any> | null;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
150
|
+
validation: AvailabilitySelectionValidationResult;
|
|
151
|
+
candidate: ContextualProductTimeRange;
|
|
152
|
+
productLineUid?: string;
|
|
153
|
+
bookingUid?: string;
|
|
154
|
+
productLineUids?: string[];
|
|
155
|
+
bookingUids?: string[];
|
|
82
156
|
}
|
|
157
|
+
export type UnifiedBookingSalesAvailabilityErrorCode = AvailabilityErrorCode;
|
|
83
158
|
export interface UnifiedBookingSalesApplyPlannerDiscountsParams {
|
|
84
|
-
/** Customer whose cards/coupons should be loaded. Defaults to tempOrder.customer_id. */
|
|
85
159
|
customerId?: number | string;
|
|
86
|
-
/** Optional explicit card/coupon id. When provided, Rules applies this card instead of auto-picking another card. */
|
|
87
160
|
preferredDiscountId?: number | string;
|
|
88
|
-
/** Defaults to true: after loading eligible cards, let Rules choose the best valid combination. */
|
|
89
161
|
applyBestDiscount?: boolean;
|
|
90
162
|
}
|
|
91
163
|
export interface UnifiedBookingSalesDiscountItem {
|
|
@@ -110,7 +182,6 @@ export interface UnifiedBookingSalesDiscountResult {
|
|
|
110
182
|
status: 'applied' | 'loaded' | 'no_customer';
|
|
111
183
|
customerId: number | null;
|
|
112
184
|
preferredDiscountFound?: boolean;
|
|
113
|
-
/** True only when the requested card is both selected and written into a planner product line. */
|
|
114
185
|
preferredDiscountApplied?: boolean;
|
|
115
186
|
availableDiscounts: UnifiedBookingSalesDiscountItem[];
|
|
116
187
|
selectedDiscounts: UnifiedBookingSalesDiscountItem[];
|
|
@@ -119,32 +190,18 @@ export interface UnifiedBookingSalesDiscountResult {
|
|
|
119
190
|
summaryAfter?: unknown;
|
|
120
191
|
}
|
|
121
192
|
export interface UnifiedBookingSalesApi {
|
|
122
|
-
/** Loads board OpenData for a concrete business + channel target. */
|
|
123
193
|
loadOpenData: (params: UnifiedBookingSalesLoadOpenDataParams) => Promise<OpenDataConfig>;
|
|
124
|
-
|
|
125
|
-
getOpenData: () => OpenDataConfig | null;
|
|
126
|
-
/** Date-first calendar availability backed by ScheduleModule. */
|
|
194
|
+
getOpenData: () => Promise<OpenDataConfig | null>;
|
|
127
195
|
loadScheduleAvailableDate: (params: LoadScheduleAvailableDateParams) => Promise<unknown>;
|
|
128
|
-
/** Date-first product pool derived from schedule date ids and globally sellable products. */
|
|
129
196
|
loadProductsByScheduleDate: (params: UnifiedBookingSalesLoadProductsByScheduleDateParams) => Promise<unknown[]>;
|
|
130
|
-
/** Adds product lines only; booking creation is intentionally deferred. */
|
|
131
|
-
stagePlannerProducts: (params: UnifiedBookingSalesStagePlannerProductsParams) => Promise<Record<string, any> | null>;
|
|
132
|
-
/** Adds ordinary product lines only. It never creates bookings or invokes ResourcePlanner. */
|
|
133
197
|
stageRetailProducts: (params: UnifiedBookingSalesStageRetailProductsParams) => Promise<Record<string, any> | null>;
|
|
134
|
-
/** Adds one ordinary retail line while preserving all existing cart lines. */
|
|
135
198
|
addRetailProduct: (params: UnifiedBookingSalesAddRetailProductParams) => Promise<Record<string, any>[]>;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
resolveAssignableSlots: (query?: ResourcePlannerQuery) => ResourcePlannerAssignableSlotResult;
|
|
142
|
-
setPlannerSelection: (patch: ResourcePlannerSelectionPatch) => ResourcePlannerSnapshot;
|
|
143
|
-
autoAssignPlanner: (query?: ResourcePlannerQuery) => Promise<ResourcePlannerSnapshot>;
|
|
144
|
-
validatePlannerSelection: () => ResourcePlannerValidationResult;
|
|
145
|
-
/** Validates, writes to tempOrder, and only optionally makes a real submit request. */
|
|
146
|
-
commitPlannerSelection: (params?: UnifiedBookingSalesCommitPlannerSelectionParams) => Promise<UnifiedBookingSalesCommitResult>;
|
|
147
|
-
/** Loads the current customer's cards/coupons, optionally applies the best one, and reports line applications. */
|
|
199
|
+
prepareAvailabilityProjection: (params: UnifiedBookingSalesPrepareAvailabilityProjectionParams) => Promise<AvailabilityContextRef>;
|
|
200
|
+
getProductTimeRanges: (contextId: string, request?: GetProductTimeRangesRequest) => Promise<ContextualProductTimeRangeGroup[]>;
|
|
201
|
+
queryBookingAvailability: (contextId: string, request: ContextualAvailabilityQuery) => Promise<ContextualAvailabilityQueryResult>;
|
|
202
|
+
commitAvailabilitySelection: (contextId: string, params: ContextualCommitAvailabilitySelectionParams) => Promise<UnifiedBookingSalesCommitAvailabilitySelectionResult>;
|
|
203
|
+
releaseAvailabilityContext: (contextId: string) => void;
|
|
148
204
|
applyPlannerDiscounts: (params?: UnifiedBookingSalesApplyPlannerDiscountsParams) => Promise<UnifiedBookingSalesDiscountResult>;
|
|
149
|
-
getPlannerSnapshot: () => ResourcePlannerSnapshot;
|
|
150
205
|
}
|
|
206
|
+
export type UnifiedBookingSalesNormalizedProduct = AvailabilityProduct;
|
|
207
|
+
export type UnifiedBookingSalesNormalizedResource = AvailabilityResource;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export var UnifiedBookingSalesHooks = /*#__PURE__*/function (UnifiedBookingSalesHooks) {
|
|
2
|
-
UnifiedBookingSalesHooks["
|
|
3
|
-
UnifiedBookingSalesHooks["
|
|
2
|
+
UnifiedBookingSalesHooks["onAvailabilityProjectionPrepared"] = "unifiedBookingSales:onAvailabilityProjectionPrepared";
|
|
3
|
+
UnifiedBookingSalesHooks["onAvailabilitySelectionCommitted"] = "unifiedBookingSales:onAvailabilitySelectionCommitted";
|
|
4
|
+
UnifiedBookingSalesHooks["onAvailabilityProjectionDiagnostic"] = "unifiedBookingSales:onAvailabilityProjectionDiagnostic";
|
|
4
5
|
return UnifiedBookingSalesHooks;
|
|
5
|
-
}({});
|
|
6
|
-
|
|
7
|
-
/** Explicit OpenData target used by page-level UnifiedBookingSales skins. */
|
|
8
|
-
|
|
9
|
-
/** Ordinary retail product staging. No resource, time, or booking facts are required. */
|
|
10
|
-
|
|
11
|
-
/** Adds one ordinary retail product without replacing other retail lines already in the cart. */
|
|
6
|
+
}({});
|
|
@@ -23,6 +23,7 @@ export interface OpenDataConfig {
|
|
|
23
23
|
'reservation.auto_confirm'?: boolean;
|
|
24
24
|
'reservation.auto_confirm_mode'?: string;
|
|
25
25
|
'reservation.auto_confirm_delay_seconds'?: number;
|
|
26
|
+
'reservation.time_slice'?: number | string;
|
|
26
27
|
'sale.allow_item_notes'?: boolean;
|
|
27
28
|
'sale.allow_order_notes'?: boolean;
|
|
28
29
|
'sale.enable_item_rules'?: boolean;
|
|
@@ -994,7 +994,11 @@ function buildSubmitPayload(params) {
|
|
|
994
994
|
let submitType = type ?? tempOrder.type;
|
|
995
995
|
if (!submitType) {
|
|
996
996
|
if ((_a = tempOrder == null ? void 0 : tempOrder.bookings) == null ? void 0 : _a.length) {
|
|
997
|
-
|
|
997
|
+
if (businessCode === "dine_in") {
|
|
998
|
+
submitType = "table-order";
|
|
999
|
+
} else {
|
|
1000
|
+
submitType = "appointment_booking";
|
|
1001
|
+
}
|
|
998
1002
|
} else {
|
|
999
1003
|
submitType = "virtual";
|
|
1000
1004
|
}
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import { BaseModule } from '../BaseModule';
|
|
2
|
-
import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
3
|
-
import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerContextInput, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from './types';
|
|
4
1
|
export * from './types';
|
|
5
2
|
export * from './planner';
|
|
6
|
-
export declare enum ResourcePlannerHooks {
|
|
7
|
-
onContextChanged = "resourcePlanner:onContextChanged",
|
|
8
|
-
onSelectionChanged = "resourcePlanner:onSelectionChanged",
|
|
9
|
-
onProjectionChanged = "resourcePlanner:onProjectionChanged"
|
|
10
|
-
}
|
|
11
|
-
export declare class ResourcePlannerModule extends BaseModule implements Module {
|
|
12
|
-
protected defaultName: string;
|
|
13
|
-
protected defaultVersion: string;
|
|
14
|
-
private store;
|
|
15
|
-
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
|
-
setContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
|
|
17
|
-
mergeContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
|
|
18
|
-
setSelectionPatch(patch: ResourcePlannerSelectionPatch): ResourcePlannerSnapshot;
|
|
19
|
-
queryAvailability(query?: ResourcePlannerQuery): ResourcePlannerProjection;
|
|
20
|
-
autoAssign(query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
|
|
21
|
-
resolveAssignableSlots(query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
|
|
22
|
-
validateSelection(): ResourcePlannerValidationResult;
|
|
23
|
-
getSnapshot(): ResourcePlannerSnapshot;
|
|
24
|
-
}
|
|
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
5
|
var __copyProps = (to, from, except, desc) => {
|
|
10
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
7
|
for (let key of __getOwnPropNames(from))
|
|
@@ -19,130 +15,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
15
|
|
|
20
16
|
// src/modules/ResourcePlanner/index.ts
|
|
21
17
|
var ResourcePlanner_exports = {};
|
|
22
|
-
__export(ResourcePlanner_exports, {
|
|
23
|
-
ResourcePlannerHooks: () => ResourcePlannerHooks,
|
|
24
|
-
ResourcePlannerModule: () => ResourcePlannerModule
|
|
25
|
-
});
|
|
26
18
|
module.exports = __toCommonJS(ResourcePlanner_exports);
|
|
27
|
-
var import_BaseModule = require("../BaseModule");
|
|
28
|
-
var import_planner = require("./planner");
|
|
29
19
|
__reExport(ResourcePlanner_exports, require("./types"), module.exports);
|
|
30
20
|
__reExport(ResourcePlanner_exports, require("./planner"), module.exports);
|
|
31
|
-
var ResourcePlannerHooks = /* @__PURE__ */ ((ResourcePlannerHooks2) => {
|
|
32
|
-
ResourcePlannerHooks2["onContextChanged"] = "resourcePlanner:onContextChanged";
|
|
33
|
-
ResourcePlannerHooks2["onSelectionChanged"] = "resourcePlanner:onSelectionChanged";
|
|
34
|
-
ResourcePlannerHooks2["onProjectionChanged"] = "resourcePlanner:onProjectionChanged";
|
|
35
|
-
return ResourcePlannerHooks2;
|
|
36
|
-
})(ResourcePlannerHooks || {});
|
|
37
|
-
var ResourcePlannerModule = class extends import_BaseModule.BaseModule {
|
|
38
|
-
constructor() {
|
|
39
|
-
super(...arguments);
|
|
40
|
-
this.defaultName = "resourcePlanner";
|
|
41
|
-
this.defaultVersion = "1.0.0";
|
|
42
|
-
}
|
|
43
|
-
async initialize(core, options) {
|
|
44
|
-
this.core = core;
|
|
45
|
-
const initialState = options.initialState;
|
|
46
|
-
this.store = {
|
|
47
|
-
context: (0, import_planner.normalizePlannerContext)((initialState == null ? void 0 : initialState.context) || import_planner.DEFAULT_RESOURCE_PLANNER_CONTEXT),
|
|
48
|
-
selection: (initialState == null ? void 0 : initialState.selection) || { ...import_planner.DEFAULT_RESOURCE_PLANNER_SELECTION },
|
|
49
|
-
projection: (initialState == null ? void 0 : initialState.projection) || null,
|
|
50
|
-
version: (initialState == null ? void 0 : initialState.version) || 0
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
setContext(input) {
|
|
54
|
-
this.store.context = (0, import_planner.normalizePlannerContext)(input);
|
|
55
|
-
this.store.version += 1;
|
|
56
|
-
this.store.projection = null;
|
|
57
|
-
const snapshot = this.getSnapshot();
|
|
58
|
-
void this.core.effects.emit(`${this.name}:contextChanged`, snapshot);
|
|
59
|
-
return snapshot;
|
|
60
|
-
}
|
|
61
|
-
mergeContext(input) {
|
|
62
|
-
return this.setContext({
|
|
63
|
-
...this.store.context,
|
|
64
|
-
...input,
|
|
65
|
-
products: input.products || this.store.context.products,
|
|
66
|
-
resources: input.resources || this.store.context.resources,
|
|
67
|
-
externalEvents: input.externalEvents || this.store.context.externalEvents
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
setSelectionPatch(patch) {
|
|
71
|
-
const assignments = patch.assignments ? patch.replaceAssignments === false ? [...this.store.selection.assignments, ...patch.assignments] : patch.assignments : this.store.selection.assignments;
|
|
72
|
-
this.store.selection = {
|
|
73
|
-
...this.store.selection,
|
|
74
|
-
...patch,
|
|
75
|
-
productIds: patch.productIds || this.store.selection.productIds,
|
|
76
|
-
resourceIds: patch.resourceIds || this.store.selection.resourceIds,
|
|
77
|
-
assignments
|
|
78
|
-
};
|
|
79
|
-
this.store.version += 1;
|
|
80
|
-
const snapshot = this.getSnapshot();
|
|
81
|
-
void this.core.effects.emit(`${this.name}:selectionChanged`, snapshot);
|
|
82
|
-
return snapshot;
|
|
83
|
-
}
|
|
84
|
-
queryAvailability(query = {}) {
|
|
85
|
-
const mergedQuery = {
|
|
86
|
-
mode: this.store.selection.mode,
|
|
87
|
-
productIds: this.store.selection.productIds,
|
|
88
|
-
date: this.store.selection.date,
|
|
89
|
-
startTime: this.store.selection.startTime,
|
|
90
|
-
endTime: this.store.selection.endTime,
|
|
91
|
-
resourceIds: this.store.selection.resourceIds,
|
|
92
|
-
...query
|
|
93
|
-
};
|
|
94
|
-
const projection = (0, import_planner.queryPlannerAvailability)(this.store.context, mergedQuery);
|
|
95
|
-
this.store.projection = projection;
|
|
96
|
-
this.store.version += 1;
|
|
97
|
-
void this.core.effects.emit(`${this.name}:projectionChanged`, this.getSnapshot());
|
|
98
|
-
return projection;
|
|
99
|
-
}
|
|
100
|
-
autoAssign(query = {}) {
|
|
101
|
-
const result = (0, import_planner.autoAssignResources)(this.store.context, {
|
|
102
|
-
mode: this.store.selection.mode,
|
|
103
|
-
productIds: this.store.selection.productIds,
|
|
104
|
-
date: this.store.selection.date,
|
|
105
|
-
startTime: this.store.selection.startTime,
|
|
106
|
-
endTime: this.store.selection.endTime,
|
|
107
|
-
resourceIds: this.store.selection.resourceIds,
|
|
108
|
-
...query
|
|
109
|
-
});
|
|
110
|
-
const resourceIds = Array.from(new Map(
|
|
111
|
-
result.assignments.map((assignment) => [String(assignment.resourceId), assignment.resourceId])
|
|
112
|
-
).values());
|
|
113
|
-
this.setSelectionPatch({
|
|
114
|
-
assignments: result.assignments,
|
|
115
|
-
...resourceIds.length ? { resourceIds } : {}
|
|
116
|
-
});
|
|
117
|
-
return result;
|
|
118
|
-
}
|
|
119
|
-
resolveAssignableSlots(query = {}) {
|
|
120
|
-
return (0, import_planner.resolveAssignableSlots)(this.store.context, {
|
|
121
|
-
mode: this.store.selection.mode,
|
|
122
|
-
productIds: this.store.selection.productIds,
|
|
123
|
-
date: this.store.selection.date,
|
|
124
|
-
startTime: this.store.selection.startTime,
|
|
125
|
-
endTime: this.store.selection.endTime,
|
|
126
|
-
resourceIds: this.store.selection.resourceIds,
|
|
127
|
-
...query
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
validateSelection() {
|
|
131
|
-
return (0, import_planner.validateAssignments)(this.store.context, this.store.selection);
|
|
132
|
-
}
|
|
133
|
-
getSnapshot() {
|
|
134
|
-
return {
|
|
135
|
-
context: this.store.context,
|
|
136
|
-
selection: this.store.selection,
|
|
137
|
-
projection: this.store.projection,
|
|
138
|
-
version: this.store.version
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
143
22
|
0 && (module.exports = {
|
|
144
|
-
ResourcePlannerHooks,
|
|
145
|
-
ResourcePlannerModule,
|
|
146
23
|
...require("./types"),
|
|
147
24
|
...require("./planner")
|
|
148
25
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface LocalDateParts {
|
|
2
|
+
year: number;
|
|
3
|
+
month: number;
|
|
4
|
+
day: number;
|
|
5
|
+
}
|
|
6
|
+
export interface LocalDateTimeParts extends LocalDateParts {
|
|
7
|
+
hour: number;
|
|
8
|
+
minute: number;
|
|
9
|
+
second: number;
|
|
10
|
+
}
|
|
11
|
+
type LocalDateInput = string | LocalDateParts;
|
|
12
|
+
type LocalDateTimeInput = string | number | LocalDateTimeParts;
|
|
13
|
+
export declare function parseLocalDate(value: string): LocalDateParts;
|
|
14
|
+
export declare function parseLocalDateTime(value: string): LocalDateTimeParts;
|
|
15
|
+
export declare function extractFixedOffsetMinutes(value: string | null | undefined): number | null;
|
|
16
|
+
export declare function captureRuntimeOffsetMinutes(value?: Date): number;
|
|
17
|
+
export declare function formatFixedOffset(offsetMinutes: number | null | undefined): string;
|
|
18
|
+
export declare function localDateTimeToScalar(value: LocalDateTimeParts): number;
|
|
19
|
+
export declare function localDateToScalar(value: Date): number;
|
|
20
|
+
export declare function localDateToScalarStart(value: LocalDateInput): number;
|
|
21
|
+
export declare function scalarToLocalDateParts(value: number): LocalDateParts;
|
|
22
|
+
export declare function scalarToLocalDateTimeParts(value: number): LocalDateTimeParts;
|
|
23
|
+
export declare function dateOrdinalFromLocalDate(value: LocalDateInput): number;
|
|
24
|
+
export declare function weekdayFromLocalDate(value: LocalDateInput): number;
|
|
25
|
+
export declare function formatLocalDate(value: LocalDateInput | number): string;
|
|
26
|
+
export declare function formatLocalTime(value: LocalDateTimeInput, includeSeconds?: boolean): string;
|
|
27
|
+
export declare function formatLocalDateTime(value: LocalDateTimeInput, fixedOffsetMinutes?: number | null): string;
|
|
28
|
+
export declare function addLocalMinutes(value: number, minutes: number): number;
|
|
29
|
+
export declare function addLocalHours(value: number, hours: number): number;
|
|
30
|
+
export declare function addLocalCalendarDays(value: number, days: number): number;
|
|
31
|
+
export declare function nextDate(value: LocalDateInput): string;
|
|
32
|
+
export declare function ceilLocalScalarToTenMinutes(value: number): number;
|
|
33
|
+
export {};
|