@pisell/pisellos 2.3.40 → 2.3.42
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/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +751 -510
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +8 -4
- package/dist/solution/BookingTicket/index.js +134 -51
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +197 -87
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +8 -4
- package/lib/solution/BookingTicket/index.js +64 -19
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { ProductData } from '../Product/types';
|
|
2
|
-
/**
|
|
3
|
-
* 商品 holder 配置
|
|
4
|
-
*/
|
|
5
|
-
export interface IHolderConfig {
|
|
6
|
-
required?: number;
|
|
7
|
-
resource_id: number;
|
|
8
|
-
status?: string;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 表单记录
|
|
13
|
-
*/
|
|
14
|
-
export interface IFormRecord {
|
|
15
|
-
form_id: number;
|
|
16
|
-
form_record_id: number;
|
|
17
|
-
main_field: string;
|
|
18
|
-
customer_cover?: string;
|
|
19
|
-
created_at?: string;
|
|
20
|
-
customer_id?: number;
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 表单配置/定义
|
|
25
|
-
*/
|
|
26
|
-
export interface IFormInfo {
|
|
27
|
-
form_id: number;
|
|
28
|
-
name: string;
|
|
29
|
-
fields?: Record<string, any>[];
|
|
30
|
-
[key: string]: any;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 单个 form_id 下的数据结构
|
|
34
|
-
*/
|
|
35
|
-
export interface IFormItemData {
|
|
36
|
-
records: IFormRecord[];
|
|
37
|
-
form: IFormInfo | Record<string, any>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* form_id 为 key 的 map 结构,如 948: { records: [], form: {} }
|
|
41
|
-
*/
|
|
42
|
-
export type HolderFormMap = Record<string, IFormItemData>;
|
|
43
|
-
/**
|
|
44
|
-
* Holder 模块 reactive store,仅 holderMap 会触发 changed 事件
|
|
45
|
-
*/
|
|
46
|
-
export interface HolderState {
|
|
47
|
-
holderMap: HolderFormMap;
|
|
48
|
-
}
|
|
49
|
-
export interface IFetchFormInfoParams {
|
|
50
|
-
url?: string;
|
|
51
|
-
query: {
|
|
52
|
-
form_id: string | number;
|
|
53
|
-
};
|
|
54
|
-
useCache?: boolean;
|
|
55
|
-
}
|
|
56
|
-
export interface IFetchFormRecordsParams {
|
|
57
|
-
url?: string;
|
|
58
|
-
query: {
|
|
59
|
-
customer_id?: number;
|
|
60
|
-
form_id: string | number;
|
|
61
|
-
shop_id: string | number;
|
|
62
|
-
num?: number;
|
|
63
|
-
skip?: number;
|
|
64
|
-
[key: string]: any;
|
|
65
|
-
};
|
|
66
|
-
useCache?: boolean;
|
|
67
|
-
}
|
|
68
|
-
export interface IAddFormRecordParams {
|
|
69
|
-
url?: string;
|
|
70
|
-
body: {
|
|
71
|
-
form_id: number;
|
|
72
|
-
shop_id: number | string;
|
|
73
|
-
customer_id?: number;
|
|
74
|
-
[key: string]: any;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* UI 层自行调用添加接口后,将返回记录写入 holderMap
|
|
79
|
-
*/
|
|
80
|
-
export interface IAppendFormRecordParams {
|
|
81
|
-
/** 接口返回的 data,或完整响应 { data: {...} } */
|
|
82
|
-
record: IFormRecord | Record<string, any>;
|
|
83
|
-
/** 可选,未传则从 record.form_id 读取 */
|
|
84
|
-
form_id?: number | string;
|
|
85
|
-
}
|
|
86
|
-
export interface IEnsureFormDataParams {
|
|
87
|
-
form_id: number | string;
|
|
88
|
-
shop_id: number | string;
|
|
89
|
-
customer_id?: number;
|
|
90
|
-
useCache?: boolean;
|
|
91
|
-
forceRefresh?: boolean;
|
|
92
|
-
formInfoUrl?: string;
|
|
93
|
-
recordsUrl?: string;
|
|
94
|
-
skip?: number;
|
|
95
|
-
num?: number;
|
|
96
|
-
}
|
|
97
|
-
export interface IEnsureFormByProductParams {
|
|
98
|
-
product: ProductData | Record<string, any>;
|
|
99
|
-
customer_id?: number;
|
|
100
|
-
shop_id?: number | string;
|
|
101
|
-
useCache?: boolean;
|
|
102
|
-
}
|
|
103
|
-
export interface IRefreshAllFormRecordsParams {
|
|
104
|
-
customer_id?: number;
|
|
105
|
-
useCache?: boolean;
|
|
106
|
-
recordsUrl?: string;
|
|
107
|
-
num?: number;
|
|
108
|
-
skip?: number;
|
|
109
|
-
}
|
|
110
|
-
export interface HolderModuleAPI {
|
|
111
|
-
getHolderFormMap: () => HolderFormMap;
|
|
112
|
-
getHolderFormData: (formId: number | string) => IFormItemData | undefined;
|
|
113
|
-
setFormData: (formId: number | string, data: Partial<IFormItemData>) => void;
|
|
114
|
-
fetchFormInfo: (params: IFetchFormInfoParams) => Promise<IFormInfo | IFormInfo[]>;
|
|
115
|
-
fetchRecords: (params: IFetchFormRecordsParams) => Promise<IFormRecord[]>;
|
|
116
|
-
ensureFormData: (params: IEnsureFormDataParams) => Promise<IFormItemData>;
|
|
117
|
-
ensureFormByProduct: (params: IEnsureFormByProductParams) => Promise<IFormItemData | null>;
|
|
118
|
-
addFormRecord: (params: IAddFormRecordParams) => Promise<IFormRecord>;
|
|
119
|
-
appendFormRecord: (params: IAppendFormRecordParams) => IFormRecord;
|
|
120
|
-
removeFormRecord: (formId: number | string, formRecordId: number) => void;
|
|
121
|
-
clearFormData: (formId?: number | string) => void;
|
|
122
|
-
refreshAllFormRecords: (params?: IRefreshAllFormRecordsParams) => Promise<HolderFormMap>;
|
|
123
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
|
|
15
|
-
// src/modules/Holder/types.ts
|
|
16
|
-
var types_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ProductData } from '../Product/types';
|
|
2
|
-
import { IFormItemData, IHolderConfig } from './types';
|
|
3
|
-
export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
|
|
4
|
-
export declare function getFormIdFromHolderConfig(config: IHolderConfig): number;
|
|
5
|
-
export declare function normalizeFormId(formId: number | string): number;
|
|
6
|
-
export declare function createEmptyFormItemData(): {
|
|
7
|
-
records: any[];
|
|
8
|
-
form: Record<string, any>;
|
|
9
|
-
};
|
|
10
|
-
export declare function resolveFormMetaFromHolderItem(mapKey: string, item: IFormItemData): {
|
|
11
|
-
form_id: string | number;
|
|
12
|
-
shop_id: number | string;
|
|
13
|
-
} | null;
|
|
@@ -1,71 +0,0 @@
|
|
|
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/modules/Holder/utils.ts
|
|
20
|
-
var utils_exports = {};
|
|
21
|
-
__export(utils_exports, {
|
|
22
|
-
createEmptyFormItemData: () => createEmptyFormItemData,
|
|
23
|
-
getFormIdFromHolderConfig: () => getFormIdFromHolderConfig,
|
|
24
|
-
getProductHolderConfig: () => getProductHolderConfig,
|
|
25
|
-
normalizeFormId: () => normalizeFormId,
|
|
26
|
-
resolveFormMetaFromHolderItem: () => resolveFormMetaFromHolderItem
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(utils_exports);
|
|
29
|
-
function getProductHolderConfig(product) {
|
|
30
|
-
var _a;
|
|
31
|
-
if (!product)
|
|
32
|
-
return null;
|
|
33
|
-
const config = (product == null ? void 0 : product.holder_config) ?? ((_a = product == null ? void 0 : product.origin) == null ? void 0 : _a.holder_config);
|
|
34
|
-
if ((config == null ? void 0 : config.status) && (config == null ? void 0 : config.status) !== "enable")
|
|
35
|
-
return null;
|
|
36
|
-
if (!(config == null ? void 0 : config.resource_id))
|
|
37
|
-
return null;
|
|
38
|
-
return config;
|
|
39
|
-
}
|
|
40
|
-
function getFormIdFromHolderConfig(config) {
|
|
41
|
-
return Number(config == null ? void 0 : config.resource_id);
|
|
42
|
-
}
|
|
43
|
-
function normalizeFormId(formId) {
|
|
44
|
-
return Number(formId);
|
|
45
|
-
}
|
|
46
|
-
function createEmptyFormItemData() {
|
|
47
|
-
return {
|
|
48
|
-
records: [],
|
|
49
|
-
form: {}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function resolveFormMetaFromHolderItem(mapKey, item) {
|
|
53
|
-
const formInfo = item.form || {};
|
|
54
|
-
const nestedForm = formInfo.form || {};
|
|
55
|
-
const form_id = normalizeFormId(
|
|
56
|
-
nestedForm.id ?? formInfo.form_id ?? formInfo.id ?? mapKey
|
|
57
|
-
);
|
|
58
|
-
const shop_id = nestedForm.shop_id ?? formInfo.shop_id;
|
|
59
|
-
if (shop_id === void 0 || shop_id === null || shop_id === "") {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
return { form_id, shop_id };
|
|
63
|
-
}
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
createEmptyFormItemData,
|
|
67
|
-
getFormIdFromHolderConfig,
|
|
68
|
-
getProductHolderConfig,
|
|
69
|
-
normalizeFormId,
|
|
70
|
-
resolveFormMetaFromHolderItem
|
|
71
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
export * from './types';
|
|
5
|
-
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
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/modules/ResourcePlanner/index.ts
|
|
21
|
-
var ResourcePlanner_exports = {};
|
|
22
|
-
__export(ResourcePlanner_exports, {
|
|
23
|
-
ResourcePlannerHooks: () => ResourcePlannerHooks,
|
|
24
|
-
ResourcePlannerModule: () => ResourcePlannerModule
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(ResourcePlanner_exports);
|
|
27
|
-
var import_BaseModule = require("../BaseModule");
|
|
28
|
-
var import_planner = require("./planner");
|
|
29
|
-
__reExport(ResourcePlanner_exports, require("./types"), module.exports);
|
|
30
|
-
__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
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
-
0 && (module.exports = {
|
|
144
|
-
ResourcePlannerHooks,
|
|
145
|
-
ResourcePlannerModule,
|
|
146
|
-
...require("./types"),
|
|
147
|
-
...require("./planner")
|
|
148
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerAvailabilityCell, ResourcePlannerContextInput, ResourcePlannerDemandInterval, ResourcePlannerProduct, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerResource, ResourcePlannerSelection, ResourcePlannerValidationResult } from './types';
|
|
2
|
-
export declare const DEFAULT_RESOURCE_PLANNER_CONTEXT: Required<ResourcePlannerContextInput>;
|
|
3
|
-
export declare const DEFAULT_RESOURCE_PLANNER_SELECTION: ResourcePlannerSelection;
|
|
4
|
-
export declare function normalizePlannerContext(input?: ResourcePlannerContextInput): Required<ResourcePlannerContextInput>;
|
|
5
|
-
export declare function buildDemandIntervals(products: ResourcePlannerProduct[], query: ResourcePlannerQuery, context?: Required<ResourcePlannerContextInput>): ResourcePlannerDemandInterval[];
|
|
6
|
-
export declare function evaluateResourceForInterval(params: {
|
|
7
|
-
resource: ResourcePlannerResource;
|
|
8
|
-
interval: ResourcePlannerDemandInterval;
|
|
9
|
-
context: Required<ResourcePlannerContextInput>;
|
|
10
|
-
}): ResourcePlannerAvailabilityCell;
|
|
11
|
-
export declare function queryPlannerAvailability(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerProjection;
|
|
12
|
-
export declare function resolveAssignableSlots(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
|
|
13
|
-
export declare function autoAssignResources(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
|
|
14
|
-
export declare function validateAssignments(contextInput: ResourcePlannerContextInput, selection: ResourcePlannerSelection): ResourcePlannerValidationResult;
|