@pisell/pisellos 2.3.37 → 2.3.39
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 +11 -28
- package/dist/modules/Order/index.js +513 -747
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +40 -11
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +49 -78
- package/dist/modules/Payment/types.d.ts +24 -26
- package/dist/modules/Payment/types.js +0 -2
- 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 +48 -15
- 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 -16
- package/dist/server/index.js +1162 -1943
- package/dist/server/modules/order/index.d.ts +4 -49
- package/dist/server/modules/order/index.js +695 -1574
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +10 -33
- package/dist/solution/BaseSales/index.js +385 -676
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- 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 +1 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1140 -737
- 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 +1871 -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 +1177 -850
- 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 +11 -28
- package/lib/modules/Order/index.js +83 -187
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -10
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +12 -33
- package/lib/modules/Payment/types.d.ts +24 -26
- 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 +34 -18
- 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 -16
- package/lib/server/index.js +88 -678
- package/lib/server/modules/order/index.d.ts +4 -49
- package/lib/server/modules/order/index.js +66 -657
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +10 -33
- package/lib/solution/BaseSales/index.js +33 -201
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- 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 +1 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- 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 +1076 -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 +328 -115
- 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 +2 -2
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -36,8 +36,9 @@ __export(utils_exports, {
|
|
|
36
36
|
composeLinePrice: () => composeLinePrice,
|
|
37
37
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
38
38
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
39
|
-
createEmptySummary: () =>
|
|
39
|
+
createEmptySummary: () => import_utils3.createEmptySummary,
|
|
40
40
|
createUuidV4: () => import_orderCollectionIdentity.createUuidV4,
|
|
41
|
+
ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
|
|
41
42
|
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
42
43
|
ensureProductSku: () => ensureProductSku,
|
|
43
44
|
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
@@ -85,9 +86,10 @@ __export(utils_exports, {
|
|
|
85
86
|
module.exports = __toCommonJS(utils_exports);
|
|
86
87
|
var import_dayjs = __toESM(require("dayjs"));
|
|
87
88
|
var import_decimal = __toESM(require("decimal.js"));
|
|
88
|
-
var import_utils = require("
|
|
89
|
-
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
89
|
+
var import_utils = require("../Holder/utils");
|
|
90
90
|
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
91
|
+
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
92
|
+
var import_utils3 = require("../../solution/ScanOrder/utils");
|
|
91
93
|
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
92
94
|
function composeLinePrice(params) {
|
|
93
95
|
const { mainPrice, bundle, useOriginalBundle } = params;
|
|
@@ -541,7 +543,7 @@ function createDefaultOrderRulesHooks() {
|
|
|
541
543
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
542
544
|
// 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
|
|
543
545
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
544
|
-
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0,
|
|
546
|
+
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils2.buildProductLineFingerprint)(
|
|
545
547
|
getProductSkuOptions(product),
|
|
546
548
|
product.product_bundle
|
|
547
549
|
)}`,
|
|
@@ -633,6 +635,34 @@ var mergeRelationForms = (relationForms) => {
|
|
|
633
635
|
}, {})
|
|
634
636
|
).filter((item) => item.form_record_ids.length > 0);
|
|
635
637
|
};
|
|
638
|
+
function getCustomerIdFromStorage(window) {
|
|
639
|
+
var _a;
|
|
640
|
+
try {
|
|
641
|
+
const customer = JSON.parse(((_a = window == null ? void 0 : window.getLocalStorage) == null ? void 0 : _a.call(window, "customer")) || "{}");
|
|
642
|
+
const customerId = Number(customer == null ? void 0 : customer.id);
|
|
643
|
+
return Number.isFinite(customerId) && customerId > 0 ? customerId : void 0;
|
|
644
|
+
} catch {
|
|
645
|
+
return void 0;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function ensureCartItemOriginHolder(cartItem, window) {
|
|
649
|
+
var _a;
|
|
650
|
+
if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const holderConfig = (0, import_utils.getProductHolderConfig)(
|
|
654
|
+
(cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
|
|
655
|
+
);
|
|
656
|
+
const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
|
|
657
|
+
if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
cartItem._origin.holder = {
|
|
661
|
+
customer_id: getCustomerIdFromStorage(window),
|
|
662
|
+
form_id: holderConfig.resource_id,
|
|
663
|
+
form_record: [formRecordId]
|
|
664
|
+
};
|
|
665
|
+
}
|
|
636
666
|
var getAllDiscountList = (cartItem) => {
|
|
637
667
|
var _a, _b, _c, _d;
|
|
638
668
|
let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
|
|
@@ -965,9 +995,6 @@ function buildSubmitPayload(params) {
|
|
|
965
995
|
...tempOrderRest,
|
|
966
996
|
customer_id: tempOrder.customer_id ?? 1,
|
|
967
997
|
customer_name: tempOrder.customer_name || "Walk-In",
|
|
968
|
-
country_calling_code: String(tempOrder.country_calling_code ?? ""),
|
|
969
|
-
phone: String(tempOrder.phone ?? ""),
|
|
970
|
-
email: String(tempOrder.email ?? ""),
|
|
971
998
|
order_number: tempOrder.order_number ?? null,
|
|
972
999
|
shop_order_number: tempOrder.shop_order_number ?? null,
|
|
973
1000
|
shop_full_order_number: tempOrder.shop_full_order_number ?? null,
|
|
@@ -998,7 +1025,7 @@ function buildSubmitPayload(params) {
|
|
|
998
1025
|
// contacts: tempOrder.contacts || [],
|
|
999
1026
|
contacts_info: tempOrder.contacts_info && !Array.isArray(tempOrder.contacts_info) ? tempOrder.contacts_info : null,
|
|
1000
1027
|
// holder: tempOrder.holder || null,
|
|
1001
|
-
summary: summary || tempOrder.summary || (0,
|
|
1028
|
+
summary: summary || tempOrder.summary || (0, import_utils2.createEmptySummary)(),
|
|
1002
1029
|
metadata: (() => {
|
|
1003
1030
|
const {
|
|
1004
1031
|
collect_pax: _collectPax,
|
|
@@ -1023,7 +1050,9 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1023
1050
|
const item = paymentItem;
|
|
1024
1051
|
const customPaymentId = item.custom_payment_id ?? item.id;
|
|
1025
1052
|
const metadata = item.metadata && typeof item.metadata === "object" ? { ...item.metadata } : {};
|
|
1026
|
-
|
|
1053
|
+
if (item.uuid && !metadata.unique_payment_number) {
|
|
1054
|
+
metadata.unique_payment_number = String(item.uuid);
|
|
1055
|
+
}
|
|
1027
1056
|
const paymentMetadataKeys = [
|
|
1028
1057
|
"rounding_rule",
|
|
1029
1058
|
"shop_wallet_pass_id",
|
|
@@ -1040,7 +1069,6 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1040
1069
|
const createdAt = item.created_at ?? timestamp;
|
|
1041
1070
|
return {
|
|
1042
1071
|
...item.order_payment_id !== void 0 ? { order_payment_id: item.order_payment_id } : {},
|
|
1043
|
-
...paymentNumber !== void 0 && paymentNumber !== null && paymentNumber !== "" ? { payment_number: String(paymentNumber) } : {},
|
|
1044
1072
|
amount: String(item.amount ?? "0.00"),
|
|
1045
1073
|
code: String(item.code || ""),
|
|
1046
1074
|
custom_payment_id: Number(customPaymentId ?? 0),
|
|
@@ -1247,6 +1275,7 @@ function indexOrderProductsByUid(products) {
|
|
|
1247
1275
|
createDefaultTempOrder,
|
|
1248
1276
|
createEmptySummary,
|
|
1249
1277
|
createUuidV4,
|
|
1278
|
+
ensureCartItemOriginHolder,
|
|
1250
1279
|
ensureManualProductDiscountList,
|
|
1251
1280
|
ensureProductSku,
|
|
1252
1281
|
findManualProductDiscountItem,
|
|
@@ -20,7 +20,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
20
20
|
protected defaultVersion: string;
|
|
21
21
|
request: RequestPlugin;
|
|
22
22
|
private app;
|
|
23
|
-
private appPlugin;
|
|
24
23
|
private store;
|
|
25
24
|
window: WindowPlugin;
|
|
26
25
|
private dbManager;
|
|
@@ -41,7 +40,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
41
40
|
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
42
41
|
*/
|
|
43
42
|
updateOtherParams(params: Record<string, any>): void;
|
|
44
|
-
private getPaymentNumberAppData;
|
|
45
43
|
/**
|
|
46
44
|
* 记录信息日志
|
|
47
45
|
*/
|
|
@@ -31,9 +31,6 @@ var import_cash = require("./cash");
|
|
|
31
31
|
var import_eftpos = require("./eftpos");
|
|
32
32
|
var import_walletpass = require("./walletpass");
|
|
33
33
|
var import_decimal = require("decimal.js");
|
|
34
|
-
var import_payment_utils = require("../Order/payment-utils");
|
|
35
|
-
var import_utils2 = require("../Order/utils");
|
|
36
|
-
var import_payment_number = require("../../utils/payment-number");
|
|
37
34
|
__reExport(Payment_exports, require("./types"), module.exports);
|
|
38
35
|
function formatAmount(amount) {
|
|
39
36
|
try {
|
|
@@ -115,15 +112,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
115
112
|
this.store = options.store;
|
|
116
113
|
this.otherParams = options.otherParams || {};
|
|
117
114
|
this.request = core.getPlugin("request");
|
|
118
|
-
|
|
115
|
+
const appPlugin = core.getPlugin("app");
|
|
119
116
|
this.window = core.getPlugin("window");
|
|
120
117
|
if (!this.request) {
|
|
121
118
|
throw new Error("支付模块需要 request 插件支持");
|
|
122
119
|
}
|
|
123
|
-
if (!
|
|
120
|
+
if (!appPlugin) {
|
|
124
121
|
throw new Error("支付模块需要 app 插件支持");
|
|
125
122
|
}
|
|
126
|
-
this.app =
|
|
123
|
+
this.app = appPlugin.getApp();
|
|
127
124
|
this.dbManager = this.app.dbManager;
|
|
128
125
|
this.logger = this.app.logger;
|
|
129
126
|
this.registerNetworkHandlers();
|
|
@@ -139,14 +136,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
139
136
|
updateOtherParams(params) {
|
|
140
137
|
this.otherParams = params || {};
|
|
141
138
|
}
|
|
142
|
-
getPaymentNumberAppData(key) {
|
|
143
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
-
const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
|
|
145
|
-
if (typeof getData === "function")
|
|
146
|
-
return getData(key);
|
|
147
|
-
const coreData = (_g = (_e = (_d = (_c = this.app) == null ? void 0 : _c.models) == null ? void 0 : _d.getStore) == null ? void 0 : (_f = _e.call(_d)).getDataByModel) == null ? void 0 : _g.call(_f, "core", "core");
|
|
148
|
-
return coreData == null ? void 0 : coreData[key];
|
|
149
|
-
}
|
|
150
139
|
/**
|
|
151
140
|
* 记录信息日志
|
|
152
141
|
*/
|
|
@@ -532,20 +521,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
532
521
|
});
|
|
533
522
|
throw new Error(warningMessage);
|
|
534
523
|
}
|
|
535
|
-
|
|
524
|
+
let paymentUuid;
|
|
525
|
+
if ((_a = paymentItem.metadata) == null ? void 0 : _a.unique_payment_number) {
|
|
526
|
+
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
527
|
+
} else {
|
|
528
|
+
paymentUuid = (0, import_utils.getUniqueId)("payment_");
|
|
529
|
+
}
|
|
536
530
|
const currentTime = formatDateTime(/* @__PURE__ */ new Date());
|
|
537
|
-
const hasPaymentNumber = String(paymentItem.payment_number || "").trim() !== "";
|
|
538
|
-
const paymentNumberDevicePrefix = hasPaymentNumber ? "LOCAL" : await (0, import_payment_number.resolvePaymentNumberDevicePrefix)(
|
|
539
|
-
(key) => this.getPaymentNumberAppData(key)
|
|
540
|
-
);
|
|
541
|
-
const paymentNumber = (0, import_payment_utils.ensureOrderPaymentNumber)(
|
|
542
|
-
paymentItem,
|
|
543
|
-
paymentNumberDevicePrefix,
|
|
544
|
-
import_utils2.createUuidV4
|
|
545
|
-
).payment_number;
|
|
546
531
|
const newPaymentItem = {
|
|
547
532
|
uuid: paymentUuid,
|
|
548
|
-
payment_number: paymentNumber,
|
|
549
533
|
custom_payment_id: normalizeCustomPaymentId(paymentItem),
|
|
550
534
|
name: paymentItem.name,
|
|
551
535
|
code: paymentItem.code,
|
|
@@ -565,8 +549,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
565
549
|
updated_at: currentTime,
|
|
566
550
|
// 更新时间
|
|
567
551
|
metadata: {
|
|
568
|
-
...paymentItem.metadata
|
|
552
|
+
...paymentItem.metadata,
|
|
569
553
|
// 保留传入的所有 metadata 字段
|
|
554
|
+
unique_payment_number: paymentUuid
|
|
555
|
+
// 设置唯一支付号为支付项的 uuid
|
|
570
556
|
}
|
|
571
557
|
};
|
|
572
558
|
order.payment.push(newPaymentItem);
|
|
@@ -781,12 +767,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
781
767
|
if ("amount" in formattedParams && formattedParams.amount !== void 0) {
|
|
782
768
|
formattedParams.amount = formatAmount(formattedParams.amount);
|
|
783
769
|
}
|
|
784
|
-
if (formattedParams.metadata && typeof formattedParams.metadata === "object") {
|
|
785
|
-
formattedParams.metadata = {
|
|
786
|
-
...paymentItem.metadata || {},
|
|
787
|
-
...formattedParams.metadata
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
770
|
Object.assign(paymentItem, formattedParams);
|
|
791
771
|
this.recalculateOrderAmount(order);
|
|
792
772
|
await this.dbManager.update("order", order);
|
|
@@ -844,7 +824,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
844
824
|
const paymentData = {
|
|
845
825
|
payments: order.payment.map((payment) => ({
|
|
846
826
|
uuid: payment.uuid,
|
|
847
|
-
payment_number: payment.payment_number,
|
|
848
827
|
amount: payment.amount,
|
|
849
828
|
code: payment.code,
|
|
850
829
|
custom_payment_id: payment.custom_payment_id,
|
|
@@ -87,30 +87,12 @@ export interface PaymentMethod {
|
|
|
87
87
|
/** 其他配置信息 */
|
|
88
88
|
[key: string]: any;
|
|
89
89
|
}
|
|
90
|
-
/** 支付项扩展元数据 */
|
|
91
|
-
export interface PaymentItemMetadata {
|
|
92
|
-
/** 钱箱 ID */
|
|
93
|
-
shop_wallet_pass_id?: string;
|
|
94
|
-
/** 三方支付交易流水号 */
|
|
95
|
-
unique_payment_number?: string;
|
|
96
|
-
/** 刷卡机设备快照;PaymentModule 不解析内部字段 */
|
|
97
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
98
|
-
/** rounding 规则 */
|
|
99
|
-
rounding_rule?: any;
|
|
100
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
101
|
-
actual_paid_amount?: number;
|
|
102
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
103
|
-
change_given_amount?: number;
|
|
104
|
-
[key: string]: unknown;
|
|
105
|
-
}
|
|
106
90
|
/**
|
|
107
91
|
* 支付项
|
|
108
92
|
*/
|
|
109
93
|
export interface PaymentItem {
|
|
110
94
|
/** 当前支付项的唯一 ID */
|
|
111
95
|
uuid: string;
|
|
112
|
-
/** 支付项稳定唯一号 */
|
|
113
|
-
payment_number?: string;
|
|
114
96
|
/** 当前支付方式付出去多少钱 */
|
|
115
97
|
amount: string;
|
|
116
98
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -128,7 +110,18 @@ export interface PaymentItem {
|
|
|
128
110
|
/** Wallet Pass 本次使用值 */
|
|
129
111
|
wallet_pass_use_value?: string | number | null;
|
|
130
112
|
/** 拓展参数字段 */
|
|
131
|
-
metadata?:
|
|
113
|
+
metadata?: {
|
|
114
|
+
/** 钱箱 ID */
|
|
115
|
+
shop_wallet_pass_id?: string;
|
|
116
|
+
/** 唯一支付号 */
|
|
117
|
+
unique_payment_number?: string;
|
|
118
|
+
/** rouding规则 */
|
|
119
|
+
rounding_rule?: any;
|
|
120
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
121
|
+
actual_paid_amount?: number;
|
|
122
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
123
|
+
change_given_amount?: number;
|
|
124
|
+
};
|
|
132
125
|
/** rouding金额 */
|
|
133
126
|
rounding_amount?: string;
|
|
134
127
|
/** 三方支付手续费 */
|
|
@@ -235,10 +228,6 @@ export interface UpdateOrderParams {
|
|
|
235
228
|
* 支付项输入类型(允许 amount 为数字)
|
|
236
229
|
*/
|
|
237
230
|
export interface PaymentItemInput {
|
|
238
|
-
/** 调用方已有的支付项运行态 UUID;存在时复用为 payment_number 的唯一号段 */
|
|
239
|
-
uuid?: string;
|
|
240
|
-
/** 支付项稳定唯一号 */
|
|
241
|
-
payment_number?: string;
|
|
242
231
|
/** 当前支付方式付出去多少钱 */
|
|
243
232
|
amount: string | number;
|
|
244
233
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -267,7 +256,18 @@ export interface PaymentItemInput {
|
|
|
267
256
|
/** 订单支付类型 */
|
|
268
257
|
order_payment_type?: 'normal' | 'deposit';
|
|
269
258
|
/** 扩展参数字段 */
|
|
270
|
-
metadata?:
|
|
259
|
+
metadata?: {
|
|
260
|
+
/** 钱箱 ID */
|
|
261
|
+
shop_wallet_pass_id?: string;
|
|
262
|
+
/** 唯一支付号 */
|
|
263
|
+
unique_payment_number?: string;
|
|
264
|
+
/** rounding规则 */
|
|
265
|
+
rounding_rule?: any;
|
|
266
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
267
|
+
actual_paid_amount?: number;
|
|
268
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
269
|
+
change_given_amount?: number;
|
|
270
|
+
};
|
|
271
271
|
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
272
272
|
created_at?: string;
|
|
273
273
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
@@ -302,8 +302,6 @@ export interface PaymentUpdateFields {
|
|
|
302
302
|
voucher_id?: string;
|
|
303
303
|
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
304
304
|
isSynced?: boolean;
|
|
305
|
-
/** 支付项扩展元数据;更新时与原 metadata 浅合并 */
|
|
306
|
-
metadata?: PaymentItemMetadata;
|
|
307
305
|
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
308
306
|
syncError?: {
|
|
309
307
|
error: string;
|
|
@@ -106,39 +106,48 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
106
106
|
} catch (error) {
|
|
107
107
|
console.error(error);
|
|
108
108
|
}
|
|
109
|
+
const channelMap = {
|
|
110
|
+
online_store: "online-store",
|
|
111
|
+
scan_to_order: "online-store",
|
|
112
|
+
"scan-to-order": "online-store",
|
|
113
|
+
scan_to_order_2: "mobile_order",
|
|
114
|
+
scan_to_order_3: "scantoorder3"
|
|
115
|
+
};
|
|
116
|
+
const rawApplicationCode = (_b = this.otherParams) == null ? void 0 : _b.channel;
|
|
117
|
+
const mappedApplicationCode = typeof rawApplicationCode === "string" ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
118
|
+
const queryPayload = {
|
|
119
|
+
open_quotation: 1,
|
|
120
|
+
open_bundle: 0,
|
|
121
|
+
exclude_extension_type: [
|
|
122
|
+
"product_party",
|
|
123
|
+
"product_event",
|
|
124
|
+
"product_series_event",
|
|
125
|
+
"product_package_ticket",
|
|
126
|
+
"ticket",
|
|
127
|
+
"event_item"
|
|
128
|
+
],
|
|
129
|
+
with: ["category", "collection", "resourceRelation"],
|
|
130
|
+
status,
|
|
131
|
+
num: 500,
|
|
132
|
+
skip: 1,
|
|
133
|
+
customer_id,
|
|
134
|
+
...Array.isArray(category_ids) && category_ids.length ? { category_ids } : {},
|
|
135
|
+
...Array.isArray(product_ids) && product_ids.length ? { ids: product_ids } : {},
|
|
136
|
+
...Array.isArray(collection) && collection.length ? { collection } : {},
|
|
137
|
+
front_end_cache_id: cacheId,
|
|
138
|
+
...Array.isArray(menu_list_ids) && menu_list_ids.length ? { menu_list_ids } : {},
|
|
139
|
+
with_count,
|
|
140
|
+
// client_schedule_ids: schedule_ids,
|
|
141
|
+
schedule_date,
|
|
142
|
+
application_code: mappedApplicationCode,
|
|
143
|
+
is_eject: 1,
|
|
144
|
+
with_schedule,
|
|
145
|
+
schedule_datetime,
|
|
146
|
+
extension_type
|
|
147
|
+
};
|
|
109
148
|
const productsData = await this.request.post(
|
|
110
149
|
`/product/query`,
|
|
111
|
-
|
|
112
|
-
open_quotation: 1,
|
|
113
|
-
open_bundle: 0,
|
|
114
|
-
exclude_extension_type: [
|
|
115
|
-
"product_party",
|
|
116
|
-
"product_event",
|
|
117
|
-
"product_series_event",
|
|
118
|
-
"product_package_ticket",
|
|
119
|
-
"ticket",
|
|
120
|
-
"event_item"
|
|
121
|
-
],
|
|
122
|
-
with: ["category", "collection", "resourceRelation"],
|
|
123
|
-
status,
|
|
124
|
-
num: 500,
|
|
125
|
-
skip: 1,
|
|
126
|
-
customer_id,
|
|
127
|
-
category_ids,
|
|
128
|
-
ids: product_ids,
|
|
129
|
-
collection,
|
|
130
|
-
front_end_cache_id: cacheId,
|
|
131
|
-
menu_list_ids,
|
|
132
|
-
with_count,
|
|
133
|
-
// client_schedule_ids: schedule_ids,
|
|
134
|
-
schedule_date,
|
|
135
|
-
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
136
|
-
is_eject: 1,
|
|
137
|
-
with_schedule,
|
|
138
|
-
schedule_datetime,
|
|
139
|
-
extension_type,
|
|
140
|
-
strategy_context
|
|
141
|
-
},
|
|
150
|
+
queryPayload,
|
|
142
151
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
143
152
|
} }
|
|
144
153
|
);
|
|
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
21
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
22
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
23
23
|
*
|
|
24
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
24
|
+
* Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
|
|
25
25
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
26
26
|
* the requested productId wins.
|
|
27
27
|
*/
|
|
@@ -52,7 +52,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
52
52
|
{ useCache: false, osServer: true }
|
|
53
53
|
);
|
|
54
54
|
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
55
|
-
list.sort((a, b) =>
|
|
55
|
+
list.sort((a, b) => b.sort - a.sort);
|
|
56
56
|
this.store.list = list;
|
|
57
57
|
}
|
|
58
58
|
getQuotationList() {
|
|
@@ -96,7 +96,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
97
97
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
98
98
|
*
|
|
99
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
99
|
+
* Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
|
|
100
100
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
101
101
|
* the requested productId wins.
|
|
102
102
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|