@pisell/pisellos 2.1.119 → 2.1.120
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +7 -0
- package/dist/model/strategy/adapter/index.js +7 -0
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/dist/model/strategy/adapter/promotion/examples.js +166 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/dist/model/strategy/adapter/promotion/type.js +209 -0
- package/dist/model/strategy/adapter/type.d.ts +28 -0
- package/dist/model/strategy/adapter/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +502 -0
- package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/dist/model/strategy/adapter/walletPass/example.js +258 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/index.js +182 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/locales.js +26 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/dist/model/strategy/adapter/walletPass/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +1104 -0
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +3 -0
- package/dist/model/strategy/index.js +8 -0
- package/dist/model/strategy/strategy-example.d.ts +5 -0
- package/dist/model/strategy/strategy-example.js +331 -0
- package/dist/model/strategy/type.d.ts +228 -0
- package/dist/model/strategy/type.js +94 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/OpenData/index.d.ts +23 -0
- package/dist/modules/OpenData/index.js +167 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +58 -1
- package/dist/modules/Order/index.js +780 -29
- package/dist/modules/Order/types.d.ts +144 -12
- package/dist/modules/Order/utils.d.ts +25 -0
- package/dist/modules/Order/utils.js +225 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +245 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.js +4 -1
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +59 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +513 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Summary/utils.d.ts +3 -3
- package/dist/modules/Summary/utils.js +4 -4
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.d.ts +90 -0
- package/dist/solution/ScanOrder/index.js +1853 -0
- package/dist/solution/ScanOrder/types.d.ts +210 -0
- package/dist/solution/ScanOrder/types.js +16 -0
- package/dist/solution/ScanOrder/utils.d.ts +93 -0
- package/dist/solution/ScanOrder/utils.js +397 -0
- package/dist/solution/VenueBooking/index.d.ts +158 -0
- package/dist/solution/VenueBooking/index.js +2873 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +130 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/resource.js +94 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +204 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/index.d.ts +1 -0
- package/lib/model/index.js +23 -0
- package/lib/model/strategy/adapter/index.d.ts +7 -0
- package/lib/model/strategy/adapter/index.js +57 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +58 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/lib/model/strategy/adapter/promotion/examples.js +192 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/lib/model/strategy/adapter/promotion/type.js +51 -0
- package/lib/model/strategy/adapter/type.d.ts +28 -0
- package/lib/model/strategy/adapter/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +424 -0
- package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/lib/model/strategy/adapter/walletPass/example.js +207 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/index.js +142 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/locales.js +54 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/lib/model/strategy/adapter/walletPass/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +791 -0
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +3 -0
- package/lib/model/strategy/index.js +38 -0
- package/lib/model/strategy/strategy-example.d.ts +5 -0
- package/lib/model/strategy/strategy-example.js +318 -0
- package/lib/model/strategy/type.d.ts +228 -0
- package/lib/model/strategy/type.js +44 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -0
- package/lib/modules/OpenData/index.d.ts +23 -0
- package/lib/modules/OpenData/index.js +116 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +58 -1
- package/lib/modules/Order/index.js +423 -1
- package/lib/modules/Order/types.d.ts +144 -12
- package/lib/modules/Order/utils.d.ts +25 -0
- package/lib/modules/Order/utils.js +229 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +149 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.js +4 -1
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +59 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +452 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Summary/utils.d.ts +3 -3
- package/lib/modules/Summary/utils.js +4 -4
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.d.ts +90 -0
- package/lib/solution/ScanOrder/index.js +1071 -0
- package/lib/solution/ScanOrder/types.d.ts +210 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +93 -0
- package/lib/solution/ScanOrder/utils.js +359 -0
- package/lib/solution/VenueBooking/index.d.ts +158 -0
- package/lib/solution/VenueBooking/index.js +1545 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +130 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/resource.js +80 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +209 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/solution/VenueBooking/utils/resource.ts
|
|
20
|
+
var resource_exports = {};
|
|
21
|
+
__export(resource_exports, {
|
|
22
|
+
buildResourceProductMap: () => buildResourceProductMap,
|
|
23
|
+
extractResourceIds: () => extractResourceIds
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(resource_exports);
|
|
26
|
+
function extractResourceIds(products) {
|
|
27
|
+
var _a;
|
|
28
|
+
const ids = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const product of products) {
|
|
30
|
+
const resources = (_a = product.product_resource) == null ? void 0 : _a.resources;
|
|
31
|
+
if (!Array.isArray(resources))
|
|
32
|
+
continue;
|
|
33
|
+
for (const resource of resources) {
|
|
34
|
+
if (resource.status !== 1)
|
|
35
|
+
continue;
|
|
36
|
+
const defaultRes = resource.default_resource || [];
|
|
37
|
+
const optionalRes = resource.optional_resource || [];
|
|
38
|
+
for (const id of [...defaultRes, ...optionalRes]) {
|
|
39
|
+
if (typeof id === "number" && id > 0)
|
|
40
|
+
ids.add(id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return Array.from(ids);
|
|
45
|
+
}
|
|
46
|
+
function buildResourceProductMap(products) {
|
|
47
|
+
var _a;
|
|
48
|
+
const map = /* @__PURE__ */ new Map();
|
|
49
|
+
for (const product of products) {
|
|
50
|
+
const resources = (_a = product.product_resource) == null ? void 0 : _a.resources;
|
|
51
|
+
if (!Array.isArray(resources))
|
|
52
|
+
continue;
|
|
53
|
+
for (const resource of resources) {
|
|
54
|
+
if (resource.status !== 1)
|
|
55
|
+
continue;
|
|
56
|
+
const allResourceIds = [
|
|
57
|
+
...resource.default_resource || [],
|
|
58
|
+
...resource.optional_resource || []
|
|
59
|
+
];
|
|
60
|
+
for (const resId of allResourceIds) {
|
|
61
|
+
if (map.has(resId))
|
|
62
|
+
continue;
|
|
63
|
+
map.set(resId, {
|
|
64
|
+
productId: product.id,
|
|
65
|
+
productTitle: product.title,
|
|
66
|
+
resourceName: resource.title,
|
|
67
|
+
formId: resource.id,
|
|
68
|
+
price: product.price || "0.00",
|
|
69
|
+
resourceType: resource.type || "single"
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return map;
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
buildResourceProductMap,
|
|
79
|
+
extractResourceIds
|
|
80
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { VenueSlotSelection, MergedSlotGroup, PriceBreakdownEntry, ResourceProductMapping, VenueResourceRawData } from '../types';
|
|
2
|
+
import type { ScanOrderOrderProduct } from '../../ScanOrder/types';
|
|
3
|
+
export declare function buildVenueIdentityKey(resourceId: number | string, groupIndex: number): string;
|
|
4
|
+
export declare function mergeConsecutiveSlots(slots: VenueSlotSelection[]): MergedSlotGroup[];
|
|
5
|
+
export declare function buildPriceBreakdown(params: {
|
|
6
|
+
group: MergedSlotGroup;
|
|
7
|
+
productId: number;
|
|
8
|
+
quotation?: {
|
|
9
|
+
getQuotationShelfId: (p: {
|
|
10
|
+
productId: number;
|
|
11
|
+
datetime: string;
|
|
12
|
+
}) => number;
|
|
13
|
+
};
|
|
14
|
+
}): PriceBreakdownEntry[];
|
|
15
|
+
export interface BuildVenueBookingParams {
|
|
16
|
+
group: MergedSlotGroup;
|
|
17
|
+
resourceId: number | string;
|
|
18
|
+
mapping: ResourceProductMapping;
|
|
19
|
+
rawResource: VenueResourceRawData | undefined;
|
|
20
|
+
bookingUuid: string;
|
|
21
|
+
productUid: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
|
|
24
|
+
/**
|
|
25
|
+
* 从一条已合并的订单商品还原出独立的时段列表。
|
|
26
|
+
* 优先使用 metadata.price_breakdown 还原每个时段的精确价格,
|
|
27
|
+
* 回退到按 selling_price / slot_count 均分。
|
|
28
|
+
*/
|
|
29
|
+
export declare function expandMergedSlotToIndividual(product: ScanOrderOrderProduct, slotDurationMinutes: number): VenueSlotSelection[];
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/solution/VenueBooking/utils/slotMerge.ts
|
|
30
|
+
var slotMerge_exports = {};
|
|
31
|
+
__export(slotMerge_exports, {
|
|
32
|
+
buildPriceBreakdown: () => buildPriceBreakdown,
|
|
33
|
+
buildVenueBookingEntry: () => buildVenueBookingEntry,
|
|
34
|
+
buildVenueIdentityKey: () => buildVenueIdentityKey,
|
|
35
|
+
expandMergedSlotToIndividual: () => expandMergedSlotToIndividual,
|
|
36
|
+
mergeConsecutiveSlots: () => mergeConsecutiveSlots
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(slotMerge_exports);
|
|
39
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
40
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
41
|
+
var import_utils = require("../../../modules/Order/utils");
|
|
42
|
+
function buildVenueIdentityKey(resourceId, groupIndex) {
|
|
43
|
+
return `venue:${resourceId}:${groupIndex}:${(0, import_utils.createUuidV4)()}`;
|
|
44
|
+
}
|
|
45
|
+
function mergeConsecutiveSlots(slots) {
|
|
46
|
+
if (!slots.length)
|
|
47
|
+
return [];
|
|
48
|
+
const sorted = [...slots].sort((a, b) => a.startTime.localeCompare(b.startTime));
|
|
49
|
+
const groups = [];
|
|
50
|
+
let currentSlots = [sorted[0]];
|
|
51
|
+
let currentStart = sorted[0].startTime;
|
|
52
|
+
let currentEnd = sorted[0].endTime;
|
|
53
|
+
let totalPrice = new import_decimal.default(sorted[0].price || "0");
|
|
54
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
55
|
+
const slot = sorted[i];
|
|
56
|
+
if (slot.startTime === currentEnd) {
|
|
57
|
+
currentEnd = slot.endTime;
|
|
58
|
+
totalPrice = totalPrice.add(new import_decimal.default(slot.price || "0"));
|
|
59
|
+
currentSlots.push(slot);
|
|
60
|
+
} else {
|
|
61
|
+
groups.push({
|
|
62
|
+
startTime: currentStart,
|
|
63
|
+
endTime: currentEnd,
|
|
64
|
+
totalPrice: totalPrice.toFixed(2),
|
|
65
|
+
slotCount: currentSlots.length,
|
|
66
|
+
slots: currentSlots
|
|
67
|
+
});
|
|
68
|
+
currentSlots = [slot];
|
|
69
|
+
currentStart = slot.startTime;
|
|
70
|
+
currentEnd = slot.endTime;
|
|
71
|
+
totalPrice = new import_decimal.default(slot.price || "0");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
groups.push({
|
|
75
|
+
startTime: currentStart,
|
|
76
|
+
endTime: currentEnd,
|
|
77
|
+
totalPrice: totalPrice.toFixed(2),
|
|
78
|
+
slotCount: currentSlots.length,
|
|
79
|
+
slots: currentSlots
|
|
80
|
+
});
|
|
81
|
+
return groups;
|
|
82
|
+
}
|
|
83
|
+
function buildPriceBreakdown(params) {
|
|
84
|
+
const { group, productId, quotation } = params;
|
|
85
|
+
if (!group.slots.length)
|
|
86
|
+
return [];
|
|
87
|
+
const entries = [];
|
|
88
|
+
for (const slot of group.slots) {
|
|
89
|
+
const unitPrice = Number(slot.price || "0");
|
|
90
|
+
const shelfId = quotation ? quotation.getQuotationShelfId({ productId, datetime: slot.startTime }) : 0;
|
|
91
|
+
const startHm = (0, import_dayjs.default)(slot.startTime, "YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm");
|
|
92
|
+
const endHm = (0, import_dayjs.default)(slot.endTime, "YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm");
|
|
93
|
+
const last = entries[entries.length - 1];
|
|
94
|
+
if (last && last.unit_price === unitPrice && last.quotation_shelf_id === shelfId && last.end_time === startHm) {
|
|
95
|
+
last.end_time = endHm;
|
|
96
|
+
last.quantity += 1;
|
|
97
|
+
} else {
|
|
98
|
+
entries.push({
|
|
99
|
+
start_time: startHm,
|
|
100
|
+
end_time: endHm,
|
|
101
|
+
unit_price: unitPrice,
|
|
102
|
+
quotation_shelf_id: shelfId,
|
|
103
|
+
quantity: 1
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return entries;
|
|
108
|
+
}
|
|
109
|
+
function buildVenueBookingEntry(params) {
|
|
110
|
+
const { group, resourceId, mapping, rawResource, bookingUuid, productUid } = params;
|
|
111
|
+
const startMoment = (0, import_dayjs.default)(group.startTime, "YYYY-MM-DD HH:mm");
|
|
112
|
+
const endMoment = (0, import_dayjs.default)(group.endTime, "YYYY-MM-DD HH:mm");
|
|
113
|
+
const duration = endMoment.diff(startMoment, "minute");
|
|
114
|
+
return {
|
|
115
|
+
schedule_event_id: null,
|
|
116
|
+
appointment_status: "new",
|
|
117
|
+
start_date: startMoment.format("YYYY-MM-DD"),
|
|
118
|
+
start_time: startMoment.format("HH:mm"),
|
|
119
|
+
end_date: endMoment.format("YYYY-MM-DD"),
|
|
120
|
+
end_time: endMoment.format("HH:mm"),
|
|
121
|
+
select_date: startMoment.format("YYYY-MM-DD"),
|
|
122
|
+
duration,
|
|
123
|
+
sub_type: "minutes",
|
|
124
|
+
like_status: "common",
|
|
125
|
+
number: 1,
|
|
126
|
+
is_all: false,
|
|
127
|
+
schedule_id: 0,
|
|
128
|
+
product_uid: productUid,
|
|
129
|
+
resources: [{
|
|
130
|
+
relation_type: "form",
|
|
131
|
+
like_status: "common",
|
|
132
|
+
id: resourceId,
|
|
133
|
+
main_field: mapping.resourceName,
|
|
134
|
+
form_id: (rawResource == null ? void 0 : rawResource.form_id) ?? mapping.formId,
|
|
135
|
+
relation_id: resourceId,
|
|
136
|
+
capacity: 1,
|
|
137
|
+
metadata: {}
|
|
138
|
+
}],
|
|
139
|
+
relation_products: [],
|
|
140
|
+
relation_forms: [],
|
|
141
|
+
holder: null,
|
|
142
|
+
metadata: {
|
|
143
|
+
unique_identification_number: bookingUuid,
|
|
144
|
+
venue_booking: true,
|
|
145
|
+
resource_id: resourceId,
|
|
146
|
+
slot_count: group.slotCount
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function expandMergedSlotToIndividual(product, slotDurationMinutes) {
|
|
151
|
+
const meta = product.metadata || {};
|
|
152
|
+
const resourceId = meta.resource_id;
|
|
153
|
+
if (resourceId == null)
|
|
154
|
+
return [];
|
|
155
|
+
const startTime = meta.start_time;
|
|
156
|
+
const endTime = meta.end_time;
|
|
157
|
+
if (!startTime || !endTime)
|
|
158
|
+
return [];
|
|
159
|
+
const breakdown = meta.price_breakdown;
|
|
160
|
+
const result = [];
|
|
161
|
+
let cursor = (0, import_dayjs.default)(startTime, "YYYY-MM-DD HH:mm");
|
|
162
|
+
const end = (0, import_dayjs.default)(endTime, "YYYY-MM-DD HH:mm");
|
|
163
|
+
if (breakdown == null ? void 0 : breakdown.length) {
|
|
164
|
+
const priceMap = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const entry of breakdown) {
|
|
166
|
+
let entryCursor = (0, import_dayjs.default)(entry.start_time, "YYYY-MM-DD HH:mm");
|
|
167
|
+
const entryEnd = (0, import_dayjs.default)(entry.end_time, "YYYY-MM-DD HH:mm");
|
|
168
|
+
while (entryCursor.isBefore(entryEnd)) {
|
|
169
|
+
priceMap.set(entryCursor.format("HH:mm"), entry.unit_price);
|
|
170
|
+
entryCursor = entryCursor.add(slotDurationMinutes, "minute");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
while (cursor.isBefore(end)) {
|
|
174
|
+
const slotEnd = cursor.add(slotDurationMinutes, "minute");
|
|
175
|
+
const hm = cursor.format("HH:mm");
|
|
176
|
+
const price = priceMap.get(hm) ?? 0;
|
|
177
|
+
result.push({
|
|
178
|
+
resourceId,
|
|
179
|
+
startTime: cursor.format("YYYY-MM-DD HH:mm"),
|
|
180
|
+
endTime: slotEnd.format("YYYY-MM-DD HH:mm"),
|
|
181
|
+
price: new import_decimal.default(price).toFixed(2)
|
|
182
|
+
});
|
|
183
|
+
cursor = slotEnd;
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
const slotCount = meta.slot_count || 1;
|
|
187
|
+
const totalPrice = new import_decimal.default(product.selling_price || "0");
|
|
188
|
+
const perSlotPrice = slotCount > 0 ? totalPrice.div(slotCount).toFixed(2) : totalPrice.toFixed(2);
|
|
189
|
+
while (cursor.isBefore(end)) {
|
|
190
|
+
const slotEnd = cursor.add(slotDurationMinutes, "minute");
|
|
191
|
+
result.push({
|
|
192
|
+
resourceId,
|
|
193
|
+
startTime: cursor.format("YYYY-MM-DD HH:mm"),
|
|
194
|
+
endTime: slotEnd.format("YYYY-MM-DD HH:mm"),
|
|
195
|
+
price: perSlotPrice
|
|
196
|
+
});
|
|
197
|
+
cursor = slotEnd;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
203
|
+
0 && (module.exports = {
|
|
204
|
+
buildPriceBreakdown,
|
|
205
|
+
buildVenueBookingEntry,
|
|
206
|
+
buildVenueIdentityKey,
|
|
207
|
+
expandMergedSlotToIndividual,
|
|
208
|
+
mergeConsecutiveSlots
|
|
209
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import type { VenueBookingSlotConfig, VenueResourceRawData, VenueTimeSlotGrid, ResourceProductMapping } from '../types';
|
|
3
|
+
export declare function isBusinessHoursCrossDay(config: VenueBookingSlotConfig): boolean;
|
|
4
|
+
export declare function generateTimeLabels(config: VenueBookingSlotConfig): string[];
|
|
5
|
+
export declare function isSlotOccupied(slotStart: dayjs.Dayjs, slotEnd: dayjs.Dayjs, occupiedTimes: Array<{
|
|
6
|
+
start_at: string;
|
|
7
|
+
end_at: string;
|
|
8
|
+
}>): boolean;
|
|
9
|
+
interface SlotEvent {
|
|
10
|
+
start_at: string;
|
|
11
|
+
end_at: string;
|
|
12
|
+
pax: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function collectEventsForDate(resource: VenueResourceRawData, date: string, config: VenueBookingSlotConfig): SlotEvent[];
|
|
15
|
+
export declare function computeSlotStatus(params: {
|
|
16
|
+
slotStart: dayjs.Dayjs;
|
|
17
|
+
slotEnd: dayjs.Dayjs;
|
|
18
|
+
events: SlotEvent[];
|
|
19
|
+
resourceType: 'single' | 'multiple' | 'capacity';
|
|
20
|
+
capacity: number;
|
|
21
|
+
}): {
|
|
22
|
+
status: 'available' | 'occupied' | 'partially_occupied';
|
|
23
|
+
remainingCapacity: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function buildTimeSlotGrid(params: {
|
|
26
|
+
date: string;
|
|
27
|
+
config: VenueBookingSlotConfig;
|
|
28
|
+
rawResources: VenueResourceRawData[];
|
|
29
|
+
resourceProductMap: Map<number | string, ResourceProductMapping>;
|
|
30
|
+
quotationPriceMap?: Map<string, string | null>;
|
|
31
|
+
}): VenueTimeSlotGrid;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/solution/VenueBooking/utils/timeSlot.ts
|
|
30
|
+
var timeSlot_exports = {};
|
|
31
|
+
__export(timeSlot_exports, {
|
|
32
|
+
buildTimeSlotGrid: () => buildTimeSlotGrid,
|
|
33
|
+
collectEventsForDate: () => collectEventsForDate,
|
|
34
|
+
computeSlotStatus: () => computeSlotStatus,
|
|
35
|
+
generateTimeLabels: () => generateTimeLabels,
|
|
36
|
+
isBusinessHoursCrossDay: () => isBusinessHoursCrossDay,
|
|
37
|
+
isSlotOccupied: () => isSlotOccupied
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(timeSlot_exports);
|
|
40
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
41
|
+
function isBusinessHoursCrossDay(config) {
|
|
42
|
+
const [startH, startM] = config.businessStartTime.split(":").map(Number);
|
|
43
|
+
const [endH, endM] = config.businessEndTime.split(":").map(Number);
|
|
44
|
+
return endH < startH || endH === startH && endM <= startM;
|
|
45
|
+
}
|
|
46
|
+
function generateTimeLabels(config) {
|
|
47
|
+
const { slotDurationMinutes, businessStartTime, businessEndTime } = config;
|
|
48
|
+
const labels = [];
|
|
49
|
+
const baseDate = "2000-01-01";
|
|
50
|
+
let cursor = (0, import_dayjs.default)(`${baseDate} ${businessStartTime}`);
|
|
51
|
+
const crossDay = isBusinessHoursCrossDay(config);
|
|
52
|
+
const endBase = crossDay ? "2000-01-02" : baseDate;
|
|
53
|
+
const end = (0, import_dayjs.default)(`${endBase} ${businessEndTime}`);
|
|
54
|
+
while (cursor.isBefore(end)) {
|
|
55
|
+
labels.push(cursor.format("HH:mm"));
|
|
56
|
+
cursor = cursor.add(slotDurationMinutes, "minute");
|
|
57
|
+
}
|
|
58
|
+
return labels;
|
|
59
|
+
}
|
|
60
|
+
function isSlotOccupied(slotStart, slotEnd, occupiedTimes) {
|
|
61
|
+
for (const occupied of occupiedTimes) {
|
|
62
|
+
const occStart = (0, import_dayjs.default)(occupied.start_at);
|
|
63
|
+
const occEnd = (0, import_dayjs.default)(occupied.end_at);
|
|
64
|
+
if (slotStart.isBefore(occEnd) && slotEnd.isAfter(occStart)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
function isSlotWithinResourceTimes(slotStart, slotEnd, resourceTimes) {
|
|
71
|
+
for (const t of resourceTimes) {
|
|
72
|
+
const tStart = (0, import_dayjs.default)(t.start_at);
|
|
73
|
+
const tEnd = (0, import_dayjs.default)(t.end_at);
|
|
74
|
+
if (slotStart.isBefore(tEnd) && slotEnd.isAfter(tStart))
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
function getResourceTimesForDate(resource, date, config) {
|
|
80
|
+
const crossDay = isBusinessHoursCrossDay(config);
|
|
81
|
+
const dayStart = (0, import_dayjs.default)(`${date} ${config.businessStartTime}`);
|
|
82
|
+
const dayEnd = crossDay ? (0, import_dayjs.default)(`${date} ${config.businessEndTime}`).add(1, "day") : (0, import_dayjs.default)(`${date} ${config.businessEndTime}`);
|
|
83
|
+
return resource.times.filter((t) => {
|
|
84
|
+
const tStart = (0, import_dayjs.default)(t.start_at);
|
|
85
|
+
const tEnd = (0, import_dayjs.default)(t.end_at);
|
|
86
|
+
return tStart.isBefore(dayEnd) && tEnd.isAfter(dayStart);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function collectEventsForDate(resource, date, config) {
|
|
90
|
+
const timesForDate = getResourceTimesForDate(resource, date, config);
|
|
91
|
+
const events = [];
|
|
92
|
+
for (const t of timesForDate) {
|
|
93
|
+
if (Array.isArray(t.event_list)) {
|
|
94
|
+
for (const evt of t.event_list) {
|
|
95
|
+
events.push({
|
|
96
|
+
start_at: evt.start_at,
|
|
97
|
+
end_at: evt.end_at,
|
|
98
|
+
pax: evt.pax ?? 1
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return events;
|
|
104
|
+
}
|
|
105
|
+
function computeSlotStatus(params) {
|
|
106
|
+
const { slotStart, slotEnd, events, resourceType, capacity } = params;
|
|
107
|
+
const overlapping = events.filter((evt) => {
|
|
108
|
+
const evtStart = (0, import_dayjs.default)(evt.start_at);
|
|
109
|
+
const evtEnd = (0, import_dayjs.default)(evt.end_at);
|
|
110
|
+
return slotStart.isBefore(evtEnd) && slotEnd.isAfter(evtStart);
|
|
111
|
+
});
|
|
112
|
+
if (resourceType === "single") {
|
|
113
|
+
if (overlapping.length > 0)
|
|
114
|
+
return { status: "occupied", remainingCapacity: 0 };
|
|
115
|
+
return { status: "available", remainingCapacity: 1 };
|
|
116
|
+
}
|
|
117
|
+
const usedCapacity = overlapping.reduce((sum, evt) => sum + evt.pax, 0);
|
|
118
|
+
const remaining = Math.max(0, capacity - usedCapacity);
|
|
119
|
+
if (remaining <= 0)
|
|
120
|
+
return { status: "occupied", remainingCapacity: 0 };
|
|
121
|
+
if (remaining < capacity)
|
|
122
|
+
return { status: "partially_occupied", remainingCapacity: remaining };
|
|
123
|
+
return { status: "available", remainingCapacity: remaining };
|
|
124
|
+
}
|
|
125
|
+
function buildTimeSlotGrid(params) {
|
|
126
|
+
const { date, config, rawResources, resourceProductMap, quotationPriceMap } = params;
|
|
127
|
+
const timeLabels = generateTimeLabels(config);
|
|
128
|
+
const now = (0, import_dayjs.default)();
|
|
129
|
+
const crossDay = isBusinessHoursCrossDay(config);
|
|
130
|
+
const resources = [];
|
|
131
|
+
for (const resource of rawResources) {
|
|
132
|
+
const mapping = resourceProductMap.get(resource.resourceId);
|
|
133
|
+
if (!mapping)
|
|
134
|
+
continue;
|
|
135
|
+
const timesForDate = getResourceTimesForDate(resource, date, config);
|
|
136
|
+
const events = collectEventsForDate(resource, date, config);
|
|
137
|
+
const resCapacity = resource.capacity ?? 1;
|
|
138
|
+
const slots = [];
|
|
139
|
+
for (const label of timeLabels) {
|
|
140
|
+
const [h, m] = label.split(":").map(Number);
|
|
141
|
+
const isNextDay = crossDay && h < Number(config.businessStartTime.split(":")[0]);
|
|
142
|
+
const slotDate = isNextDay ? (0, import_dayjs.default)(date).add(1, "day").format("YYYY-MM-DD") : date;
|
|
143
|
+
const slotStart = (0, import_dayjs.default)(`${slotDate} ${label}`);
|
|
144
|
+
const slotEnd = slotStart.add(config.slotDurationMinutes, "minute");
|
|
145
|
+
let status;
|
|
146
|
+
let remainingCapacity = null;
|
|
147
|
+
if (slotStart.isBefore(now)) {
|
|
148
|
+
status = "past";
|
|
149
|
+
} else if (!isSlotWithinResourceTimes(slotStart, slotEnd, timesForDate)) {
|
|
150
|
+
status = "unavailable";
|
|
151
|
+
} else {
|
|
152
|
+
const result = computeSlotStatus({
|
|
153
|
+
slotStart,
|
|
154
|
+
slotEnd,
|
|
155
|
+
events,
|
|
156
|
+
resourceType: mapping.resourceType,
|
|
157
|
+
capacity: resCapacity
|
|
158
|
+
});
|
|
159
|
+
status = result.status;
|
|
160
|
+
remainingCapacity = result.remainingCapacity;
|
|
161
|
+
}
|
|
162
|
+
const isBookable = status === "available" || status === "partially_occupied";
|
|
163
|
+
const slotStartStr = slotStart.format("YYYY-MM-DD HH:mm");
|
|
164
|
+
slots.push({
|
|
165
|
+
startTime: slotStartStr,
|
|
166
|
+
endTime: slotEnd.format("YYYY-MM-DD HH:mm"),
|
|
167
|
+
status,
|
|
168
|
+
price: isBookable ? (quotationPriceMap == null ? void 0 : quotationPriceMap.get(`${mapping.productId}:${slotStartStr}`)) ?? mapping.price : null,
|
|
169
|
+
resourceId: resource.resourceId,
|
|
170
|
+
resourceFormId: resource.formId,
|
|
171
|
+
capacity: status === "past" || status === "unavailable" ? null : resCapacity,
|
|
172
|
+
remainingCapacity
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
resources.push({
|
|
176
|
+
resourceId: resource.resourceId,
|
|
177
|
+
resourceFormId: resource.formId,
|
|
178
|
+
resourceName: resource.main_field || mapping.resourceName,
|
|
179
|
+
productId: mapping.productId,
|
|
180
|
+
productTitle: mapping.productTitle,
|
|
181
|
+
slots
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const productOrder = /* @__PURE__ */ new Map();
|
|
185
|
+
for (const row of resources) {
|
|
186
|
+
if (!productOrder.has(row.productId))
|
|
187
|
+
productOrder.set(row.productId, productOrder.size);
|
|
188
|
+
}
|
|
189
|
+
resources.sort((a, b) => (productOrder.get(a.productId) ?? 0) - (productOrder.get(b.productId) ?? 0));
|
|
190
|
+
return { date, timeLabels, resources };
|
|
191
|
+
}
|
|
192
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
193
|
+
0 && (module.exports = {
|
|
194
|
+
buildTimeSlotGrid,
|
|
195
|
+
collectEventsForDate,
|
|
196
|
+
computeSlotStatus,
|
|
197
|
+
generateTimeLabels,
|
|
198
|
+
isBusinessHoursCrossDay,
|
|
199
|
+
isSlotOccupied
|
|
200
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createEmptySummary, getSafeProductNum, toBoolean, toPositiveString, normalizeEnabledItemRuleIds, extractStrategyModelIdsFromTableConfig, normalizeItemRuleStrategies, toNonNegativeNumber, toNonNegativeInt, toPriceString, buildProductKey, getTopLevelProductId, getTopLevelVariantId, buildQuantityLimitIndex, resolveSkuMatchedQuantityLimits, aggregateItemRuleLimit, buildItemRuleBusinessData, attachItemRuleLimitsToTopLevelProducts, getProductIdentityIndex, isIdentityMatch, normalizeOrderProduct, } from '../ScanOrder/utils';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/solution/VenueBooking/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
aggregateItemRuleLimit: () => import_utils.aggregateItemRuleLimit,
|
|
23
|
+
attachItemRuleLimitsToTopLevelProducts: () => import_utils.attachItemRuleLimitsToTopLevelProducts,
|
|
24
|
+
buildItemRuleBusinessData: () => import_utils.buildItemRuleBusinessData,
|
|
25
|
+
buildProductKey: () => import_utils.buildProductKey,
|
|
26
|
+
buildQuantityLimitIndex: () => import_utils.buildQuantityLimitIndex,
|
|
27
|
+
createEmptySummary: () => import_utils.createEmptySummary,
|
|
28
|
+
extractStrategyModelIdsFromTableConfig: () => import_utils.extractStrategyModelIdsFromTableConfig,
|
|
29
|
+
getProductIdentityIndex: () => import_utils.getProductIdentityIndex,
|
|
30
|
+
getSafeProductNum: () => import_utils.getSafeProductNum,
|
|
31
|
+
getTopLevelProductId: () => import_utils.getTopLevelProductId,
|
|
32
|
+
getTopLevelVariantId: () => import_utils.getTopLevelVariantId,
|
|
33
|
+
isIdentityMatch: () => import_utils.isIdentityMatch,
|
|
34
|
+
normalizeEnabledItemRuleIds: () => import_utils.normalizeEnabledItemRuleIds,
|
|
35
|
+
normalizeItemRuleStrategies: () => import_utils.normalizeItemRuleStrategies,
|
|
36
|
+
normalizeOrderProduct: () => import_utils.normalizeOrderProduct,
|
|
37
|
+
resolveSkuMatchedQuantityLimits: () => import_utils.resolveSkuMatchedQuantityLimits,
|
|
38
|
+
toBoolean: () => import_utils.toBoolean,
|
|
39
|
+
toNonNegativeInt: () => import_utils.toNonNegativeInt,
|
|
40
|
+
toNonNegativeNumber: () => import_utils.toNonNegativeNumber,
|
|
41
|
+
toPositiveString: () => import_utils.toPositiveString,
|
|
42
|
+
toPriceString: () => import_utils.toPriceString
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(utils_exports);
|
|
45
|
+
var import_utils = require("../ScanOrder/utils");
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
aggregateItemRuleLimit,
|
|
49
|
+
attachItemRuleLimitsToTopLevelProducts,
|
|
50
|
+
buildItemRuleBusinessData,
|
|
51
|
+
buildProductKey,
|
|
52
|
+
buildQuantityLimitIndex,
|
|
53
|
+
createEmptySummary,
|
|
54
|
+
extractStrategyModelIdsFromTableConfig,
|
|
55
|
+
getProductIdentityIndex,
|
|
56
|
+
getSafeProductNum,
|
|
57
|
+
getTopLevelProductId,
|
|
58
|
+
getTopLevelVariantId,
|
|
59
|
+
isIdentityMatch,
|
|
60
|
+
normalizeEnabledItemRuleIds,
|
|
61
|
+
normalizeItemRuleStrategies,
|
|
62
|
+
normalizeOrderProduct,
|
|
63
|
+
resolveSkuMatchedQuantityLimits,
|
|
64
|
+
toBoolean,
|
|
65
|
+
toNonNegativeInt,
|
|
66
|
+
toNonNegativeNumber,
|
|
67
|
+
toPositiveString,
|
|
68
|
+
toPriceString
|
|
69
|
+
});
|
package/lib/solution/index.d.ts
CHANGED
package/lib/solution/index.js
CHANGED
|
@@ -22,6 +22,8 @@ __reExport(solution_exports, require("./BookingTicket"), module.exports);
|
|
|
22
22
|
__reExport(solution_exports, require("./ShopDiscount"), module.exports);
|
|
23
23
|
__reExport(solution_exports, require("./RegisterAndLogin"), module.exports);
|
|
24
24
|
__reExport(solution_exports, require("./Checkout"), module.exports);
|
|
25
|
+
__reExport(solution_exports, require("./ScanOrder"), module.exports);
|
|
26
|
+
__reExport(solution_exports, require("./VenueBooking"), module.exports);
|
|
25
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
28
|
0 && (module.exports = {
|
|
27
29
|
...require("./BuyTickets"),
|
|
@@ -29,5 +31,7 @@ __reExport(solution_exports, require("./Checkout"), module.exports);
|
|
|
29
31
|
...require("./BookingTicket"),
|
|
30
32
|
...require("./ShopDiscount"),
|
|
31
33
|
...require("./RegisterAndLogin"),
|
|
32
|
-
...require("./Checkout")
|
|
34
|
+
...require("./Checkout"),
|
|
35
|
+
...require("./ScanOrder"),
|
|
36
|
+
...require("./VenueBooking")
|
|
33
37
|
});
|