@pisell/pisellos 2.3.48 → 2.3.50
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/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +54 -25
- package/dist/modules/Order/types.d.ts +9 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +47 -13
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -0
- package/dist/server/index.js +907 -793
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +0 -16
- package/dist/server/modules/order/index.js +776 -964
- package/dist/server/modules/order/types.d.ts +0 -14
- package/dist/server/modules/order/types.js +0 -6
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +64 -42
- package/dist/solution/BookingByStep/index.d.ts +16 -1
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1142 -739
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1891 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1167 -841
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +26 -10
- package/lib/modules/Order/types.d.ts +9 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +33 -16
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -0
- package/lib/server/index.js +72 -15
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +0 -16
- package/lib/server/modules/order/index.js +4 -140
- package/lib/server/modules/order/types.d.ts +0 -14
- package/lib/server/modules/order/types.js +0 -1
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +24 -8
- package/lib/solution/BookingByStep/index.d.ts +16 -1
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.js +10 -2
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1084 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +322 -110
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ export interface ScanOrderOrderProductIdentity {
|
|
|
35
35
|
/** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
|
|
36
36
|
product_sku?: ScanOrderProductSku;
|
|
37
37
|
product_bundle?: any[];
|
|
38
|
+
shop_id?: number | string;
|
|
38
39
|
}
|
|
39
40
|
export interface ScanOrderProductSku {
|
|
40
41
|
option: any[];
|
|
@@ -207,7 +208,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
|
|
|
207
208
|
}>;
|
|
208
209
|
products: ScanOrderSubmitProduct[];
|
|
209
210
|
}
|
|
210
|
-
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
211
|
+
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'multiple_orders' | 'additional_order_with_code' | 'additional_order';
|
|
211
212
|
export interface ScanOrderTableFormRecord {
|
|
212
213
|
policy?: string | null;
|
|
213
214
|
partyroom_booking?: string | null;
|
|
@@ -250,6 +251,10 @@ export interface ScanOrderResourceOccupyDetail {
|
|
|
250
251
|
form_id?: number | string | null;
|
|
251
252
|
order_id?: number | string | null;
|
|
252
253
|
last_order_id?: number | string | null;
|
|
254
|
+
order_list?: Array<{
|
|
255
|
+
id?: number | string | null;
|
|
256
|
+
[key: string]: any;
|
|
257
|
+
}> | null;
|
|
253
258
|
resource_capacity?: ScanOrderResourceCapacity[] | null;
|
|
254
259
|
form_record?: ScanOrderTableFormRecord | null;
|
|
255
260
|
[key: string]: any;
|
|
@@ -263,6 +268,21 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
|
|
|
263
268
|
} | null;
|
|
264
269
|
}
|
|
265
270
|
export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
|
|
271
|
+
export interface ScanOrderReservationResourceSelectInfo {
|
|
272
|
+
resourceSelectType?: ScanOrderResourceSelectType;
|
|
273
|
+
isSingleReservation: boolean;
|
|
274
|
+
isMultipleReservation: boolean;
|
|
275
|
+
isCapacityReservation: boolean;
|
|
276
|
+
}
|
|
277
|
+
export interface ScanOrderAllowAddItemsInfo {
|
|
278
|
+
enabled: boolean;
|
|
279
|
+
}
|
|
280
|
+
export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'add_items_disabled' | 'invalid_order_id';
|
|
281
|
+
export interface ScanOrderSyncAdditionalOrderResult {
|
|
282
|
+
matched: boolean;
|
|
283
|
+
order_id?: string;
|
|
284
|
+
reason?: ScanOrderSyncAdditionalOrderReason;
|
|
285
|
+
}
|
|
266
286
|
export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
|
|
267
287
|
relationId?: string;
|
|
268
288
|
tableFormId?: string;
|
|
@@ -2,6 +2,7 @@ import { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderResource
|
|
|
2
2
|
import type { CartItemSummary, ItemRuleBusinessData, PaxInfo, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
3
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
4
4
|
import type { ProductData } from '../../modules/Product/types';
|
|
5
|
+
import type { OrderSubmitProduct } from '../../modules/Order/types';
|
|
5
6
|
/**
|
|
6
7
|
* 构建金额全为 0 的空 summary。
|
|
7
8
|
* 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
|
|
@@ -42,6 +43,8 @@ export declare function toNonNegativeNumber(value: unknown): number;
|
|
|
42
43
|
export declare function toNonNegativeInt(value: unknown): number;
|
|
43
44
|
export declare function toPriceString(value: unknown, fallback?: string): string;
|
|
44
45
|
export declare function buildProductKey(productId: number, productVariantId: number): string;
|
|
46
|
+
/** 加餐接口只提交本次新增商品,过滤掉首单预约占位规则行。 */
|
|
47
|
+
export declare function filterProductsForScanOrderMore<T extends OrderSubmitProduct>(products?: T[]): T[];
|
|
45
48
|
export declare function getTopLevelProductId(product: Record<string, any>): number | null;
|
|
46
49
|
export declare function getTopLevelVariantId(product: Record<string, any>): number | null;
|
|
47
50
|
export declare function buildQuantityLimitIndex(limits: QuantityLimitResult[]): {
|
|
@@ -134,6 +137,11 @@ export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderPro
|
|
|
134
137
|
* 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
|
|
135
138
|
*/
|
|
136
139
|
export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
|
|
140
|
+
/**
|
|
141
|
+
* 找到第一个归属指定桌台的预约规则商品。
|
|
142
|
+
* 归属判断基于商品资源中的 default_resource / optional_resource。
|
|
143
|
+
*/
|
|
144
|
+
export declare function findReservationRuleProductByResourceId(products: ProductData[], resourceId: string | number | null | undefined): ProductData | undefined;
|
|
137
145
|
/**
|
|
138
146
|
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
139
147
|
*/
|
|
@@ -39,6 +39,8 @@ __export(utils_exports, {
|
|
|
39
39
|
computeResourceIsFull: () => computeResourceIsFull,
|
|
40
40
|
createEmptySummary: () => createEmptySummary,
|
|
41
41
|
extractStrategyModelIdsFromTableConfig: () => extractStrategyModelIdsFromTableConfig,
|
|
42
|
+
filterProductsForScanOrderMore: () => filterProductsForScanOrderMore,
|
|
43
|
+
findReservationRuleProductByResourceId: () => findReservationRuleProductByResourceId,
|
|
42
44
|
getProductIdentityIndex: () => getProductIdentityIndex,
|
|
43
45
|
getSafeProductNum: () => getSafeProductNum,
|
|
44
46
|
getTopLevelProductId: () => getTopLevelProductId,
|
|
@@ -165,6 +167,12 @@ function toPriceString(value, fallback = "0.00") {
|
|
|
165
167
|
function buildProductKey(productId, productVariantId) {
|
|
166
168
|
return `${productId}_${productVariantId}`;
|
|
167
169
|
}
|
|
170
|
+
function filterProductsForScanOrderMore(products = []) {
|
|
171
|
+
return products.filter((product) => {
|
|
172
|
+
var _a;
|
|
173
|
+
return ((_a = product.metadata) == null ? void 0 : _a.is_rule) !== true;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
168
176
|
function getTopLevelProductId(product) {
|
|
169
177
|
const rawProductId = product.product_id ?? product.id;
|
|
170
178
|
const productId = Number(rawProductId);
|
|
@@ -580,6 +588,27 @@ function collectLinkProductIdsFromReservationRules(rules) {
|
|
|
580
588
|
}
|
|
581
589
|
return [...new Set(ids)];
|
|
582
590
|
}
|
|
591
|
+
function findReservationRuleProductByResourceId(products, resourceId) {
|
|
592
|
+
var _a;
|
|
593
|
+
const numericResourceId = Number(resourceId);
|
|
594
|
+
if (!Number.isFinite(numericResourceId) || numericResourceId <= 0)
|
|
595
|
+
return void 0;
|
|
596
|
+
for (const product of products) {
|
|
597
|
+
const resources = (_a = product == null ? void 0 : product.product_resource) == null ? void 0 : _a.resources;
|
|
598
|
+
if (!Array.isArray(resources))
|
|
599
|
+
continue;
|
|
600
|
+
const hasMatchedResource = resources.some((resource) => {
|
|
601
|
+
const defaultResources = Array.isArray(resource == null ? void 0 : resource.default_resource) ? resource.default_resource : [];
|
|
602
|
+
const optionalResources = Array.isArray(resource == null ? void 0 : resource.optional_resource) ? resource.optional_resource : [];
|
|
603
|
+
return [...defaultResources, ...optionalResources].some(
|
|
604
|
+
(id) => Number(id) === numericResourceId
|
|
605
|
+
);
|
|
606
|
+
});
|
|
607
|
+
if (hasMatchedResource)
|
|
608
|
+
return product;
|
|
609
|
+
}
|
|
610
|
+
return void 0;
|
|
611
|
+
}
|
|
583
612
|
function pickFirstDurationMinutesFromProducts(products) {
|
|
584
613
|
var _a;
|
|
585
614
|
for (const product of products) {
|
|
@@ -683,6 +712,8 @@ function pickFirstCustomCapacityDimensionId(products) {
|
|
|
683
712
|
computeResourceIsFull,
|
|
684
713
|
createEmptySummary,
|
|
685
714
|
extractStrategyModelIdsFromTableConfig,
|
|
715
|
+
filterProductsForScanOrderMore,
|
|
716
|
+
findReservationRuleProductByResourceId,
|
|
686
717
|
getProductIdentityIndex,
|
|
687
718
|
getSafeProductNum,
|
|
688
719
|
getTopLevelProductId,
|
|
@@ -40,6 +40,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
40
40
|
discountList: Discount[];
|
|
41
41
|
};
|
|
42
42
|
setProductList(productList: Record<string, any>[]): void;
|
|
43
|
+
batchSearchByProductIds(productIds: number[]): Promise<Discount[]>;
|
|
43
44
|
scanCode(code: string, customerId?: number): Promise<{
|
|
44
45
|
isAvailable: boolean;
|
|
45
46
|
productList: Record<string, any>[];
|
|
@@ -270,6 +270,20 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
270
270
|
setProductList(productList) {
|
|
271
271
|
this.store.productList = productList;
|
|
272
272
|
}
|
|
273
|
+
async batchSearchByProductIds(productIds) {
|
|
274
|
+
var _a;
|
|
275
|
+
let resultDiscountList = await ((_a = this.store.discount) == null ? void 0 : _a.batchSearchByProductIds(productIds)) || [];
|
|
276
|
+
resultDiscountList = resultDiscountList.map((item) => {
|
|
277
|
+
return {
|
|
278
|
+
...item,
|
|
279
|
+
discount_rule_uncheck_flag: true
|
|
280
|
+
};
|
|
281
|
+
});
|
|
282
|
+
const currentDiscountList = this.getDiscountList() || [];
|
|
283
|
+
const newDiscountList = [...currentDiscountList, ...resultDiscountList];
|
|
284
|
+
this.setDiscountList(newDiscountList);
|
|
285
|
+
return newDiscountList;
|
|
286
|
+
}
|
|
273
287
|
// 扫码输入code
|
|
274
288
|
async scanCode(code, customerId) {
|
|
275
289
|
var _a, _b, _c;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { Module } from '../../types';
|
|
2
|
+
import type { ProductData } from '../../modules';
|
|
3
|
+
import type { OpenDataConfig } from '../../modules/OpenData';
|
|
4
|
+
import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
|
|
5
|
+
import type { ProductListLoadProductsParams } from '../../modules/ProductList';
|
|
6
|
+
import type { ResourcePlannerAssignment, ResourcePlannerAssignableSlotResult, ResourcePlannerEvent, ResourcePlannerProduct, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerResource, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from '../../modules/ResourcePlanner';
|
|
7
|
+
import type { UnifiedBookingSalesCommitPlannerSelectionParams, UnifiedBookingSalesCommitResult, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadPlannerContextParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesStagePlannerProductsParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
|
|
8
|
+
import { BookingTicket } from '../BookingTicket';
|
|
9
|
+
export * from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Converts Rules/Order discount internals into a small UI-facing diagnostic. The result keeps
|
|
12
|
+
* candidate-card state separate from line-level applications: a selected card is not proof that
|
|
13
|
+
* it actually discounted a planner product.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildPlannerDiscountResult(params: {
|
|
16
|
+
customerId: number | null;
|
|
17
|
+
discountList: Record<string, any>[];
|
|
18
|
+
products: Record<string, any>[];
|
|
19
|
+
summaryBefore?: unknown;
|
|
20
|
+
summaryAfter?: unknown;
|
|
21
|
+
status: UnifiedBookingSalesDiscountResult['status'];
|
|
22
|
+
preferredDiscountId?: number | string;
|
|
23
|
+
preferredDiscountFound?: boolean;
|
|
24
|
+
}): UnifiedBookingSalesDiscountResult;
|
|
25
|
+
/** Converts a ProductList record into the pure input shape consumed by ResourcePlanner. */
|
|
26
|
+
export declare function normalizeProductForPlanner(product: ProductData | Record<string, any>): ResourcePlannerProduct;
|
|
27
|
+
/**
|
|
28
|
+
* Materializes resource work windows locally from v2's schedule ids, then keeps its flat
|
|
29
|
+
* event_list as planner events. This deliberately avoids the older API's times -> event_list
|
|
30
|
+
* response nesting and lets one resource response serve any requested date range.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildPlannerResourcesFromV2(params: {
|
|
33
|
+
rawResources: Record<string, any>[];
|
|
34
|
+
scheduleList: ScheduleItem[];
|
|
35
|
+
dateRange?: ResourcePlannerQuery['dateRange'];
|
|
36
|
+
}): {
|
|
37
|
+
resources: ResourcePlannerResource[];
|
|
38
|
+
externalEvents: ResourcePlannerEvent[];
|
|
39
|
+
};
|
|
40
|
+
/** Combines URL-locked resources with every resource referenced by the selected products. */
|
|
41
|
+
export declare function collectPlannerResourceIds(products: ResourcePlannerProduct[], explicitResourceIds?: Array<number | string>): Array<number | string>;
|
|
42
|
+
/** Convenience wrapper for the usual one-resource booking case. */
|
|
43
|
+
export declare function buildBookingFromAssignment(params: {
|
|
44
|
+
assignment: ResourcePlannerAssignment;
|
|
45
|
+
product: ResourcePlannerProduct;
|
|
46
|
+
}): Record<string, any>;
|
|
47
|
+
/**
|
|
48
|
+
* Converts all resources needed by one product/time interval into the one booking expected by
|
|
49
|
+
* OrderModule. Callers must group assignments before this function so a multi-form booking does
|
|
50
|
+
* not become several competing bookings.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildBookingFromAssignments(params: {
|
|
53
|
+
assignments: ResourcePlannerAssignment[];
|
|
54
|
+
product: ResourcePlannerProduct;
|
|
55
|
+
}): 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
|
+
export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
59
|
+
protected defaultName: string;
|
|
60
|
+
protected defaultVersion: string;
|
|
61
|
+
protected store: UnifiedBookingSalesState;
|
|
62
|
+
private unifiedProductCatalog;
|
|
63
|
+
private openDataTarget;
|
|
64
|
+
private loadOpenDataInFlight;
|
|
65
|
+
private loadOpenDataInFlightTarget;
|
|
66
|
+
/**
|
|
67
|
+
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
68
|
+
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
69
|
+
*/
|
|
70
|
+
protected shouldUseCheckoutSyncTask(): boolean;
|
|
71
|
+
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
72
|
+
protected getDefaultCheckoutSmallTicketDataFlag(): number;
|
|
73
|
+
protected getRegisteredModuleNames(): readonly string[];
|
|
74
|
+
protected createSubModule(moduleName: string): Module | null;
|
|
75
|
+
/**
|
|
76
|
+
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
77
|
+
* business/channel target so a reused solution instance cannot leak another entry's menus.
|
|
78
|
+
*/
|
|
79
|
+
loadOpenData(params: UnifiedBookingSalesLoadOpenDataParams): Promise<OpenDataConfig>;
|
|
80
|
+
getOpenData(): Promise<OpenDataConfig | null>;
|
|
81
|
+
/**
|
|
82
|
+
* Loads the product catalog used by both UI and Planner. Schedule data is requested with each
|
|
83
|
+
* product because session products carry their fixed intervals there.
|
|
84
|
+
*/
|
|
85
|
+
loadProducts(params?: ProductListLoadProductsParams, options?: {
|
|
86
|
+
callback?: (result: any) => void;
|
|
87
|
+
subscriberId?: string;
|
|
88
|
+
}): Promise<ProductData[]>;
|
|
89
|
+
/** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
|
|
90
|
+
loadScheduleAvailableDate(params: LoadScheduleAvailableDateParams): Promise<import("../../modules/Date/types").ITime[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Implements the date-first product pool: the chosen date's product ids plus globally sellable
|
|
93
|
+
* other_product_ids. If a batch product query is unexpectedly empty, retry one id at a time so
|
|
94
|
+
* a partial backend incompatibility does not hide the entire date's catalog.
|
|
95
|
+
*/
|
|
96
|
+
loadProductsByScheduleDate(params: UnifiedBookingSalesLoadProductsByScheduleDateParams): Promise<ProductData[]>;
|
|
97
|
+
/** Returns a copy so UI consumers cannot accidentally mutate the solution's product cache. */
|
|
98
|
+
getProductCatalog(): {
|
|
99
|
+
products: ProductData[];
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
103
|
+
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
104
|
+
*/
|
|
105
|
+
getCart(): {
|
|
106
|
+
items: any[];
|
|
107
|
+
bookings: any[];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
111
|
+
* then optionally lets the existing Rules engine select the best valid combination. This is a
|
|
112
|
+
* diagnostic boundary for new booking skins: no pricing logic is duplicated in the planner.
|
|
113
|
+
*/
|
|
114
|
+
applyPlannerDiscounts(params?: UnifiedBookingSalesApplyPlannerDiscountsParams): Promise<UnifiedBookingSalesDiscountResult>;
|
|
115
|
+
/** ResourcePlanner is a required child module; fail early instead of producing partial availability. */
|
|
116
|
+
private getPlanner;
|
|
117
|
+
private buildUnifiedOrderProduct;
|
|
118
|
+
/** Replacing a staged selection is idempotent and never removes unrelated cart lines. */
|
|
119
|
+
private removeExistingStagedLines;
|
|
120
|
+
private stageProducts;
|
|
121
|
+
/**
|
|
122
|
+
* Adds the current product choice to an otherwise clean planner cart without creating bookings.
|
|
123
|
+
* This separates "what the customer wants" from the later time/resource confirmation step.
|
|
124
|
+
*/
|
|
125
|
+
stagePlannerProducts(params: UnifiedBookingSalesStagePlannerProductsParams): Promise<Record<string, any> | null>;
|
|
126
|
+
/**
|
|
127
|
+
* Adds ordinary retail products without asking ResourcePlanner for booking facts.
|
|
128
|
+
* Its staged lines have separate ownership so planner and retail skins can coexist safely.
|
|
129
|
+
*/
|
|
130
|
+
stageRetailProducts(params: UnifiedBookingSalesStageRetailProductsParams): Promise<Record<string, any> | null>;
|
|
131
|
+
/**
|
|
132
|
+
* Adds one retail line without replacing the cart's existing retail selection.
|
|
133
|
+
* This is intentionally separate from stageRetailProducts(), whose contract is
|
|
134
|
+
* "replace the staged selection" for demo and wizard-like callers.
|
|
135
|
+
*/
|
|
136
|
+
addRetailProduct(params: UnifiedBookingSalesAddRetailProductParams): Promise<Record<string, any>[]>;
|
|
137
|
+
/** Normalizes caller-provided products or loads the catalog before any resource request is made. */
|
|
138
|
+
private loadPlannerProducts;
|
|
139
|
+
/** Loads the reusable store-level schedule catalog on demand. */
|
|
140
|
+
private ensurePlannerSchedulesLoaded;
|
|
141
|
+
/**
|
|
142
|
+
* v2 resources reference schedule ids rather than expanded work times. Refresh once when the
|
|
143
|
+
* cached schedule catalog cannot materialize all referenced ids.
|
|
144
|
+
*/
|
|
145
|
+
private ensurePlannerSchedulesForResources;
|
|
146
|
+
/**
|
|
147
|
+
* Fetches resource metadata plus flat occupied events. Work windows are intentionally derived
|
|
148
|
+
* locally in buildPlannerResourcesFromV2 from /schedule, rather than requested from the legacy
|
|
149
|
+
* resource dates endpoint.
|
|
150
|
+
*/
|
|
151
|
+
private fetchPlannerResourcesV2;
|
|
152
|
+
/**
|
|
153
|
+
* Resolves the Planner context in precedence order: explicit normalized context, test raw data,
|
|
154
|
+
* then the v2 resource API inferred from selected product requirements and any URL lock.
|
|
155
|
+
*/
|
|
156
|
+
private loadPlannerResources;
|
|
157
|
+
/**
|
|
158
|
+
* Boundary between IO and pure planning. Once this returns, all later availability/slot calls
|
|
159
|
+
* operate on the ResourcePlanner snapshot and do not issue resource requests themselves.
|
|
160
|
+
*/
|
|
161
|
+
loadPlannerContext(params?: UnifiedBookingSalesLoadPlannerContextParams): Promise<ResourcePlannerSnapshot>;
|
|
162
|
+
/** Returns cells, date summaries and a derived grid; cells are continuous ranges, not UI slots. */
|
|
163
|
+
queryPlannerAvailability(query?: ResourcePlannerQuery): Promise<ResourcePlannerProjection>;
|
|
164
|
+
/** Turns compatible availability ranges into user-selectable intervals and ready-to-commit assignments. */
|
|
165
|
+
resolveAssignableSlots(query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
|
|
166
|
+
/** Stores a UI choice only. It is deliberately side-effect free with respect to tempOrder. */
|
|
167
|
+
setPlannerSelection(patch: ResourcePlannerSelectionPatch): ResourcePlannerSnapshot;
|
|
168
|
+
/**
|
|
169
|
+
* Legacy-friendly automatic assignment for already fixed intervals. Duration products without a
|
|
170
|
+
* start time intentionally remain unresolved; callers offering a picker should use slots.
|
|
171
|
+
*/
|
|
172
|
+
autoAssignPlanner(query?: ResourcePlannerQuery): Promise<ResourcePlannerSnapshot>;
|
|
173
|
+
/** Rechecks remote events, capacity and conflicts among the current selection before committing. */
|
|
174
|
+
validatePlannerSelection(): ResourcePlannerValidationResult;
|
|
175
|
+
/** Read-only snapshot for UI diagnostics and progressive flow steps. */
|
|
176
|
+
getPlannerSnapshot(): ResourcePlannerSnapshot;
|
|
177
|
+
/**
|
|
178
|
+
* Validates then writes assignments to tempOrder. Real order submission is opt-in so UI callers
|
|
179
|
+
* can safely preview the cart; pass submitAfterCommit only after an explicit confirmation.
|
|
180
|
+
*/
|
|
181
|
+
commitPlannerSelection(params?: UnifiedBookingSalesCommitPlannerSelectionParams): Promise<UnifiedBookingSalesCommitResult>;
|
|
182
|
+
}
|
|
183
|
+
export declare const UnifiedBookingSales: typeof UnifiedBookingSalesImpl;
|