@pisell/pisellos 2.2.256 → 2.2.258

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.
Files changed (52) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
  3. package/dist/modules/Order/index.d.ts +29 -1
  4. package/dist/modules/Order/index.js +508 -241
  5. package/dist/modules/Order/types.d.ts +20 -2
  6. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  7. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  8. package/dist/modules/Order/utils.d.ts +4 -0
  9. package/dist/modules/Order/utils.js +114 -28
  10. package/dist/modules/Product/index.d.ts +1 -1
  11. package/dist/modules/Product/types.d.ts +6 -0
  12. package/dist/modules/Rules/index.d.ts +3 -3
  13. package/dist/modules/Rules/index.js +8 -3
  14. package/dist/modules/Rules/types.d.ts +2 -1
  15. package/dist/server/index.d.ts +12 -2
  16. package/dist/server/index.js +1227 -923
  17. package/dist/server/modules/order/index.d.ts +22 -3
  18. package/dist/server/modules/order/index.js +397 -314
  19. package/dist/solution/BaseSales/index.d.ts +16 -2
  20. package/dist/solution/BaseSales/index.js +484 -314
  21. package/dist/solution/BaseSales/types.d.ts +1 -0
  22. package/dist/solution/BaseSales/types.js +2 -1
  23. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -2
  24. package/dist/solution/BookingByStep/index.d.ts +1 -1
  25. package/dist/solution/BookingTicket/index.d.ts +9 -1
  26. package/dist/solution/BookingTicket/index.js +162 -6
  27. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
  28. package/lib/modules/Order/index.d.ts +29 -1
  29. package/lib/modules/Order/index.js +340 -57
  30. package/lib/modules/Order/types.d.ts +20 -2
  31. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  32. package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
  33. package/lib/modules/Order/utils.d.ts +4 -0
  34. package/lib/modules/Order/utils.js +84 -2
  35. package/lib/modules/Product/index.d.ts +1 -1
  36. package/lib/modules/Product/types.d.ts +6 -0
  37. package/lib/modules/Rules/index.d.ts +3 -3
  38. package/lib/modules/Rules/index.js +4 -3
  39. package/lib/modules/Rules/types.d.ts +2 -1
  40. package/lib/server/index.d.ts +12 -2
  41. package/lib/server/index.js +218 -12
  42. package/lib/server/modules/order/index.d.ts +22 -3
  43. package/lib/server/modules/order/index.js +102 -51
  44. package/lib/solution/BaseSales/index.d.ts +16 -2
  45. package/lib/solution/BaseSales/index.js +143 -31
  46. package/lib/solution/BaseSales/types.d.ts +1 -0
  47. package/lib/solution/BaseSales/types.js +2 -1
  48. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -5
  49. package/lib/solution/BookingByStep/index.d.ts +1 -1
  50. package/lib/solution/BookingTicket/index.d.ts +9 -1
  51. package/lib/solution/BookingTicket/index.js +112 -0
  52. package/package.json +1 -1
@@ -491,7 +491,7 @@ export interface OrderPaymentData {
491
491
  voucher_id?: string | number;
492
492
  origin_amount?: string;
493
493
  service_fee?: string;
494
- status?: 'active' | 'voided' | string;
494
+ status?: 'active' | 'paid' | 'voided' | 'payment_pending' | string;
495
495
  /** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
496
496
  payment_time?: string;
497
497
  wallet_pass_usage_unit?: unknown;
@@ -537,9 +537,15 @@ export interface SyncPaymentsToOrderParams {
537
537
  smallTicketDataFlag?: number;
538
538
  businessCode?: string;
539
539
  channel?: string;
540
+ confirmPendingVoucherPayments?: boolean;
540
541
  }
541
542
  export interface SyncPaymentsToOrderResult<T = any> {
542
543
  isFullyPaid: boolean;
544
+ isOrderFullyPaid: boolean;
545
+ isDepositFullyPaid: boolean;
546
+ paymentStage: 'deposit' | 'normal';
547
+ depositAmount: string;
548
+ orderExpectedAmount: string;
543
549
  submitResult?: T;
544
550
  }
545
551
  export interface OrderIdentitySnapshot {
@@ -691,6 +697,7 @@ export interface OrderModuleAPI {
691
697
  payments?: OrderPaymentSource[];
692
698
  paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
693
699
  smallTicketDataFlag?: number;
700
+ confirmPendingVoucherPayments?: boolean;
694
701
  enhancePayload?: SubmitPayloadEnhancer;
695
702
  }) => Promise<T>;
696
703
  submitTempOrderAsync: <T = any>(params?: {
@@ -702,6 +709,7 @@ export interface OrderModuleAPI {
702
709
  payments?: OrderPaymentSource[];
703
710
  paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
704
711
  smallTicketDataFlag?: number;
712
+ confirmPendingVoucherPayments?: boolean;
705
713
  enhancePayload?: SubmitPayloadEnhancer;
706
714
  }) => Promise<T>;
707
715
  getOrderPayments: () => OrderPaymentData[];
@@ -709,7 +717,17 @@ export interface OrderModuleAPI {
709
717
  addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
710
718
  updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
711
719
  deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
712
- updateVoucherOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
720
+ updateVoucherOrderPayments: (payments: OrderPaymentSource[], options?: {
721
+ status?: 'paid' | 'payment_pending';
722
+ }) => OrderPaymentData[];
723
+ confirmPendingVoucherPayments: (options?: {
724
+ persist?: boolean;
725
+ recalculateSummary?: boolean;
726
+ }) => OrderPaymentData[];
727
+ discardPendingVoucherPayments: (options?: {
728
+ persist?: boolean;
729
+ recalculateSummary?: boolean;
730
+ }) => OrderPaymentData[];
713
731
  sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
714
732
  saveDraft: () => Promise<void>;
715
733
  hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
@@ -0,0 +1,5 @@
1
+ import type { OrderProductDiscountItem } from '../types';
2
+ type NormalizeDiscountList = (discountList?: unknown[] | null) => OrderProductDiscountItem[];
3
+ export declare function restoreHydratedBundleDiscounts<T extends Record<string, any>>(product: T, normalizeDiscountList: NormalizeDiscountList): T;
4
+ export declare function expandHydratedProductsForDiscountCollection(products: any[] | undefined | null): any[];
5
+ export {};
@@ -0,0 +1,139 @@
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/Order/utils/bundleDiscountHydration.ts
20
+ var bundleDiscountHydration_exports = {};
21
+ __export(bundleDiscountHydration_exports, {
22
+ expandHydratedProductsForDiscountCollection: () => expandHydratedProductsForDiscountCollection,
23
+ restoreHydratedBundleDiscounts: () => restoreHydratedBundleDiscounts
24
+ });
25
+ module.exports = __toCommonJS(bundleDiscountHydration_exports);
26
+ var BUNDLE_MAP_ID_KEY = "custom_product_bundle_map_id";
27
+ function getBundleMapId(bundle) {
28
+ var _a;
29
+ const metadataMapId = (_a = bundle == null ? void 0 : bundle.metadata) == null ? void 0 : _a[BUNDLE_MAP_ID_KEY];
30
+ if (metadataMapId !== void 0 && metadataMapId !== null && metadataMapId !== "") {
31
+ return String(metadataMapId);
32
+ }
33
+ if ((bundle == null ? void 0 : bundle._id) !== void 0 && bundle._id !== null && bundle._id !== "") {
34
+ return String(bundle._id);
35
+ }
36
+ return null;
37
+ }
38
+ function getDiscountBundleMapId(discount) {
39
+ var _a;
40
+ const mapId = (_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a[BUNDLE_MAP_ID_KEY];
41
+ if (mapId === void 0 || mapId === null || mapId === "")
42
+ return null;
43
+ return String(mapId);
44
+ }
45
+ function hasSameBundleDiscount(discountList, discount) {
46
+ var _a;
47
+ const targetOrderDiscountId = discount.order_discount_id;
48
+ if (targetOrderDiscountId !== void 0 && targetOrderDiscountId !== null) {
49
+ return discountList.some((item) => (item == null ? void 0 : item.order_discount_id) === targetOrderDiscountId);
50
+ }
51
+ const targetResourceId = ((_a = discount == null ? void 0 : discount.discount) == null ? void 0 : _a.resource_id) ?? (discount == null ? void 0 : discount.resource_id) ?? (discount == null ? void 0 : discount.discount_id);
52
+ const targetMapId = getDiscountBundleMapId(discount);
53
+ return discountList.some((item) => {
54
+ var _a2;
55
+ const resourceId = ((_a2 = item == null ? void 0 : item.discount) == null ? void 0 : _a2.resource_id) ?? (item == null ? void 0 : item.resource_id) ?? (item == null ? void 0 : item.discount_id);
56
+ return resourceId === targetResourceId && String((item == null ? void 0 : item.amount) ?? "") === String((discount == null ? void 0 : discount.amount) ?? "") && getDiscountBundleMapId(item) === targetMapId;
57
+ });
58
+ }
59
+ function restoreHydratedBundleDiscounts(product, normalizeDiscountList) {
60
+ if (!Array.isArray(product.product_bundle) || !Array.isArray(product.discount_list)) {
61
+ return product;
62
+ }
63
+ const bundleByMapId = /* @__PURE__ */ new Map();
64
+ product.product_bundle.forEach((bundle) => {
65
+ if (!bundle || typeof bundle !== "object")
66
+ return;
67
+ const mapId = getBundleMapId(bundle);
68
+ if (mapId)
69
+ bundleByMapId.set(mapId, bundle);
70
+ });
71
+ if (!bundleByMapId.size)
72
+ return product;
73
+ const mainDiscountList = [];
74
+ const bundleDiscounts = [];
75
+ product.discount_list.forEach((discount) => {
76
+ const mapId = getDiscountBundleMapId(discount);
77
+ if (mapId && bundleByMapId.has(mapId)) {
78
+ bundleDiscounts.push({ mapId, discount });
79
+ } else {
80
+ mainDiscountList.push(discount);
81
+ }
82
+ });
83
+ if (!bundleDiscounts.length)
84
+ return product;
85
+ return {
86
+ ...product,
87
+ discount_list: normalizeDiscountList(mainDiscountList),
88
+ product_bundle: product.product_bundle.map((bundle) => {
89
+ if (!bundle || typeof bundle !== "object")
90
+ return bundle;
91
+ const mapId = getBundleMapId(bundle);
92
+ if (!mapId)
93
+ return bundle;
94
+ const matchedDiscounts = bundleDiscounts.filter((item) => item.mapId === mapId).map((item) => item.discount);
95
+ if (!matchedDiscounts.length)
96
+ return bundle;
97
+ const currentDiscountList = Array.isArray(bundle.discount_list) ? [...bundle.discount_list] : [];
98
+ for (const discount of matchedDiscounts) {
99
+ if (!hasSameBundleDiscount(currentDiscountList, discount)) {
100
+ currentDiscountList.push(discount);
101
+ }
102
+ }
103
+ return {
104
+ ...bundle,
105
+ discount_list: normalizeDiscountList(currentDiscountList),
106
+ metadata: {
107
+ ...bundle.metadata || {},
108
+ [BUNDLE_MAP_ID_KEY]: mapId
109
+ }
110
+ };
111
+ })
112
+ };
113
+ }
114
+ function expandHydratedProductsForDiscountCollection(products) {
115
+ const expanded = [];
116
+ for (const product of products || []) {
117
+ expanded.push(product);
118
+ for (const bundle of (product == null ? void 0 : product.product_bundle) || []) {
119
+ if (!Array.isArray(bundle == null ? void 0 : bundle.discount_list) || bundle.discount_list.length === 0)
120
+ continue;
121
+ expanded.push({
122
+ ...product,
123
+ product_id: bundle.bundle_product_id ?? bundle._bundle_product_id ?? bundle.product_id ?? (product == null ? void 0 : product.product_id),
124
+ num: bundle.num ?? bundle.quantity ?? (product == null ? void 0 : product.num),
125
+ product_quantity: bundle.quantity ?? bundle.num ?? (product == null ? void 0 : product.product_quantity),
126
+ original_price: bundle.original_price ?? bundle.product_price ?? bundle.price,
127
+ selling_price: bundle.bundle_selling_price ?? bundle.price,
128
+ is_charge_tax: bundle.is_charge_tax ?? (product == null ? void 0 : product.is_charge_tax),
129
+ discount_list: bundle.discount_list
130
+ });
131
+ }
132
+ }
133
+ return expanded;
134
+ }
135
+ // Annotate the CommonJS export names for ESM import in node:
136
+ 0 && (module.exports = {
137
+ expandHydratedProductsForDiscountCollection,
138
+ restoreHydratedBundleDiscounts
139
+ });
@@ -254,6 +254,10 @@ export declare function clearTempOrderHolderAssignments(tempOrder: OrderTempOrde
254
254
  * getOrderProductLineUid({ metadata: { unique_identification_number: 'line-1' } }); // 'line-1'
255
255
  */
256
256
  export declare function getOrderProductLineUid(product: Record<string, any> | null | undefined): string | null;
257
+ export declare function getRuntimeProductOrigin(tempOrder: OrderTempOrder | null | undefined, product: any): Record<string, any> | null;
258
+ export declare function isHolderConfigRequired(holderConfig: any): boolean;
259
+ export declare function productRequiresFormSubject(tempOrder: OrderTempOrder | null | undefined, product: any): boolean;
260
+ export declare function resolveIsFormSubject(tempOrder: OrderTempOrder | null | undefined, product?: any): boolean;
257
261
  /**
258
262
  * 判断展示字段是否为空(含 i18n 对象全空)。
259
263
  *
@@ -49,9 +49,11 @@ __export(utils_exports, {
49
49
  getBundleSignedUnit: () => getBundleSignedUnit,
50
50
  getOrderProductLineUid: () => getOrderProductLineUid,
51
51
  getProductSkuOptions: () => getProductSkuOptions,
52
+ getRuntimeProductOrigin: () => getRuntimeProductOrigin,
52
53
  hasAssignedHolderId: () => hasAssignedHolderId,
53
54
  indexOrderProductsByUid: () => indexOrderProductsByUid,
54
55
  isEmptyOrderProductDisplayValue: () => isEmptyOrderProductDisplayValue,
56
+ isHolderConfigRequired: () => isHolderConfigRequired,
55
57
  isMarkdownBundle: () => isMarkdownBundle,
56
58
  isTempOrder: () => isTempOrder,
57
59
  mapPaymentItemToOrderPayment: () => mapPaymentItemToOrderPayment,
@@ -65,7 +67,9 @@ __export(utils_exports, {
65
67
  normalizeProductSkuOptions: () => normalizeProductSkuOptions,
66
68
  normalizeSubmitBooking: () => normalizeSubmitBooking,
67
69
  normalizeSubmitCollectPaxValue: () => normalizeSubmitCollectPaxValue,
70
+ productRequiresFormSubject: () => productRequiresFormSubject,
68
71
  resolveEffectivePerUnitDiscount: () => resolveEffectivePerUnitDiscount,
72
+ resolveIsFormSubject: () => resolveIsFormSubject,
69
73
  resolveManualDiscountMessage: () => import_manualProductDiscount.resolveManualDiscountMessage,
70
74
  resolveManualDiscountOriginTotal: () => import_manualProductDiscount.resolveManualDiscountOriginTotal,
71
75
  resolveManualDiscountReasonFromSources: () => import_manualProductDiscount.resolveManualDiscountReasonFromSources,
@@ -376,6 +380,42 @@ function normalizeOrderProductDiscountList(discountList) {
376
380
  return normalized;
377
381
  });
378
382
  }
383
+ function resolveSubmitBundleMapId(bundle) {
384
+ var _a;
385
+ const metadataMapId = (_a = bundle.metadata) == null ? void 0 : _a.custom_product_bundle_map_id;
386
+ if (metadataMapId !== void 0 && metadataMapId !== null && metadataMapId !== "") {
387
+ return metadataMapId;
388
+ }
389
+ if (bundle._id !== void 0 && bundle._id !== null && bundle._id !== "") {
390
+ return bundle._id;
391
+ }
392
+ return void 0;
393
+ }
394
+ function collectSubmitProductDiscountList(product) {
395
+ const submitDiscountList = Array.isArray(product == null ? void 0 : product.discount_list) ? [...product.discount_list] : [];
396
+ for (const bundle of (product == null ? void 0 : product.product_bundle) || []) {
397
+ if (!bundle || typeof bundle !== "object")
398
+ continue;
399
+ const bundleMapId = resolveSubmitBundleMapId(bundle);
400
+ const bundleDiscountList = Array.isArray(bundle.discount_list) ? bundle.discount_list : [];
401
+ for (const discount of bundleDiscountList) {
402
+ if (!discount || typeof discount !== "object")
403
+ continue;
404
+ const discountMetadata = discount.metadata && typeof discount.metadata === "object" ? discount.metadata : {};
405
+ const discountMapId = discountMetadata.custom_product_bundle_map_id !== void 0 && discountMetadata.custom_product_bundle_map_id !== null && discountMetadata.custom_product_bundle_map_id !== "" ? discountMetadata.custom_product_bundle_map_id : bundleMapId;
406
+ submitDiscountList.push({
407
+ ...discount,
408
+ ...discountMapId !== void 0 ? {
409
+ metadata: {
410
+ ...discountMetadata,
411
+ custom_product_bundle_map_id: discountMapId
412
+ }
413
+ } : {}
414
+ });
415
+ }
416
+ }
417
+ return normalizeOrderProductDiscountList(submitDiscountList);
418
+ }
379
419
  function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
380
420
  var _a, _b;
381
421
  const metadata = params.metadata || {};
@@ -671,6 +711,10 @@ function formatSubmitBundleItems(bundle) {
671
711
  return bundle.map((b) => {
672
712
  const rawBundle = b && typeof b === "object" ? b : {};
673
713
  const existedMetadata = rawBundle.metadata && typeof rawBundle.metadata === "object" ? rawBundle.metadata : {};
714
+ const {
715
+ custom_product_bundle_map_id: _customProductBundleMapId,
716
+ ...submitMetadata
717
+ } = existedMetadata;
674
718
  const sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
675
719
  const paymentPrice = rawBundle.bundle_payment_price !== void 0 && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== "" ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
676
720
  const priceValue = rawBundle.price ?? rawBundle.custom_price ?? rawBundle.bundle_selling_price;
@@ -683,6 +727,8 @@ function formatSubmitBundleItems(bundle) {
683
727
  0
684
728
  );
685
729
  const num = toBundleNumber(rawBundle.num ?? rawBundle.quantity, 1);
730
+ const bundleMapId = resolveSubmitBundleMapId(rawBundle);
731
+ const hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
686
732
  return {
687
733
  is_charge_tax: rawBundle.is_charge_tax ?? 0,
688
734
  bundle_variant_id: rawBundle.bundle_variant_id ?? 0,
@@ -700,7 +746,8 @@ function formatSubmitBundleItems(bundle) {
700
746
  bundle_id: (rawBundle == null ? void 0 : rawBundle.bundle_id) ?? (rawBundle == null ? void 0 : rawBundle.id),
701
747
  bundle_product_id: (rawBundle == null ? void 0 : rawBundle.bundle_product_id) ?? (rawBundle == null ? void 0 : rawBundle._bundle_product_id),
702
748
  metadata: {
703
- ...existedMetadata,
749
+ ...submitMetadata,
750
+ ...hasSubmitBundleDiscounts && bundleMapId !== void 0 ? { custom_product_bundle_map_id: bundleMapId } : {},
704
751
  surcharge_fee: surchargeFee,
705
752
  relation_surcharge_ids: relationSurchargeIds,
706
753
  product_discount_difference: productDiscountDifference
@@ -765,7 +812,7 @@ function normalizeSubmitProduct(product) {
765
812
  ...bookingUid ? { booking_uid: bookingUid } : {},
766
813
  product_quantity: toBundleNumber(num ?? submitProduct.product_quantity, 1),
767
814
  product_sku: productSku,
768
- discount_list: normalizeOrderProductDiscountList(submitProduct.discount_list),
815
+ discount_list: collectSubmitProductDiscountList(submitProduct),
769
816
  product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
770
817
  metadata: cleanMetadata,
771
818
  // 出站兼容:后端消费 payment_price 字段(行 composite 已减整单折扣均摊)。
@@ -1094,6 +1141,37 @@ function getOrderProductLineUid(product) {
1094
1141
  return null;
1095
1142
  return String(uid);
1096
1143
  }
1144
+ function getRuntimeProductOrigin(tempOrder, product) {
1145
+ var _a, _b, _c, _d, _e, _f;
1146
+ const uid = getOrderProductLineUid(product);
1147
+ if (uid && ((_c = (_b = (_a = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _a.productsByUid) == null ? void 0 : _b[uid]) == null ? void 0 : _c.origin)) {
1148
+ return tempOrder._extend.productsByUid[uid].origin;
1149
+ }
1150
+ const matchedProduct = ((tempOrder == null ? void 0 : tempOrder.products) || []).find((item) => item === product || getOrderProductLineUid(item) === uid || String((item == null ? void 0 : item.product_id) ?? (item == null ? void 0 : item.id) ?? "") === String((product == null ? void 0 : product.product_id) ?? (product == null ? void 0 : product.id) ?? ""));
1151
+ const matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : "";
1152
+ return matchedUid ? ((_f = (_e = (_d = tempOrder == null ? void 0 : tempOrder._extend) == null ? void 0 : _d.productsByUid) == null ? void 0 : _e[matchedUid]) == null ? void 0 : _f.origin) || null : null;
1153
+ }
1154
+ function isHolderConfigRequired(holderConfig) {
1155
+ if (!holderConfig || typeof holderConfig !== "object")
1156
+ return false;
1157
+ if (holderConfig.status === "disable")
1158
+ return false;
1159
+ return Number(holderConfig.required) === 1;
1160
+ }
1161
+ function productRequiresFormSubject(tempOrder, product) {
1162
+ const runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
1163
+ return isHolderConfigRequired(product == null ? void 0 : product.holder_config) || isHolderConfigRequired(runtimeOrigin == null ? void 0 : runtimeOrigin.holder_config);
1164
+ }
1165
+ function resolveIsFormSubject(tempOrder, product) {
1166
+ var _a;
1167
+ if (((_a = tempOrder == null ? void 0 : tempOrder.holder) == null ? void 0 : _a.type) === "form")
1168
+ return true;
1169
+ if (product)
1170
+ return productRequiresFormSubject(tempOrder, product);
1171
+ return ((tempOrder == null ? void 0 : tempOrder.products) || []).some(
1172
+ (item) => productRequiresFormSubject(tempOrder, item)
1173
+ );
1174
+ }
1097
1175
  function isEmptyOrderProductDisplayValue(value) {
1098
1176
  if (value === void 0 || value === null)
1099
1177
  return true;
@@ -1174,9 +1252,11 @@ function indexOrderProductsByUid(products) {
1174
1252
  getBundleSignedUnit,
1175
1253
  getOrderProductLineUid,
1176
1254
  getProductSkuOptions,
1255
+ getRuntimeProductOrigin,
1177
1256
  hasAssignedHolderId,
1178
1257
  indexOrderProductsByUid,
1179
1258
  isEmptyOrderProductDisplayValue,
1259
+ isHolderConfigRequired,
1180
1260
  isMarkdownBundle,
1181
1261
  isTempOrder,
1182
1262
  mapPaymentItemToOrderPayment,
@@ -1190,7 +1270,9 @@ function indexOrderProductsByUid(products) {
1190
1270
  normalizeProductSkuOptions,
1191
1271
  normalizeSubmitBooking,
1192
1272
  normalizeSubmitCollectPaxValue,
1273
+ productRequiresFormSubject,
1193
1274
  resolveEffectivePerUnitDiscount,
1275
+ resolveIsFormSubject,
1194
1276
  resolveManualDiscountMessage,
1195
1277
  resolveManualDiscountOriginTotal,
1196
1278
  resolveManualDiscountReasonFromSources,
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "session" | "normal";
53
53
  }
@@ -168,6 +168,12 @@ export interface ProductData {
168
168
  product_resource?: {
169
169
  resources?: ProductResourceItem[];
170
170
  };
171
+ /** 商品级持有人配置,resource_id 对应 holder 表单 id */
172
+ holder_config?: {
173
+ status?: string;
174
+ required?: number | string | boolean;
175
+ resource_id?: number | string | null;
176
+ };
171
177
  /** 组合商品id,动态附加 */
172
178
  product_variant_id?: number;
173
179
  /** 套餐信息 */
@@ -1,6 +1,6 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Rules, RulesModuleAPI, DiscountResult, UnavailableReason } from './types';
3
+ import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, UnavailableReason } from './types';
4
4
  import { Discount } from '../Discount/types';
5
5
  import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
6
6
  import { WindowPlugin } from '../../plugins';
@@ -24,7 +24,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
24
24
  holders: {
25
25
  form_record_id: number;
26
26
  }[];
27
- isFormSubject: boolean;
27
+ isFormSubject: RulesFormSubject;
28
28
  }): {
29
29
  isAvailable: boolean;
30
30
  discountList: Discount[];
@@ -43,7 +43,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
43
43
  holders: {
44
44
  form_record_id: number;
45
45
  }[];
46
- isFormSubject: boolean;
46
+ isFormSubject: RulesFormSubject;
47
47
  orderTotalAmount: number;
48
48
  }, options?: {
49
49
  isSelected?: boolean;
@@ -70,7 +70,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
70
70
  var _a;
71
71
  if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form")
72
72
  return true;
73
- const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : void 0;
73
+ const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id || holders[0] : void 0;
74
74
  const productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
75
75
  if (!product.isNeedHolder)
76
76
  return true;
@@ -207,6 +207,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
207
207
  orderTotalAmount
208
208
  }, options) {
209
209
  var _a;
210
+ const resolveIsFormSubject = (product) => typeof isFormSubject === "function" ? Boolean(isFormSubject(product)) : Boolean(isFormSubject);
210
211
  const isEditModeAddNewProduct = productList.find((n) => n.booking_id) && productList.find((n) => !n.booking_id);
211
212
  const editModeDiscount = [];
212
213
  const addModeDiscount = [];
@@ -596,7 +597,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
596
597
  const isHolderMatch = this.checkHolderMatch(
597
598
  discount,
598
599
  {
599
- isNeedHolder: isFormSubject && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
600
+ isNeedHolder: resolveIsFormSubject(_tempVar) && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
600
601
  holder_id: (_tempVar == null ? void 0 : _tempVar.holder_id) || product.holder_id
601
602
  },
602
603
  holders
@@ -767,7 +768,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
767
768
  const isHolderMatch = this.checkHolderMatch(
768
769
  discount,
769
770
  {
770
- isNeedHolder: isFormSubject && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
771
+ isNeedHolder: resolveIsFormSubject(_tempVar) && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
771
772
  holder_id: (_tempVar == null ? void 0 : _tempVar.holder_id) || product.holder_id
772
773
  },
773
774
  holders
@@ -22,6 +22,7 @@ export interface DiscountResult {
22
22
  productList: any[];
23
23
  discountList: any[];
24
24
  }
25
+ export type RulesFormSubject = boolean | ((product: any) => boolean);
25
26
  export interface RulesModuleAPI {
26
27
  setRulesList: (rulesList: Rules[]) => Promise<void>;
27
28
  clear: () => Promise<void>;
@@ -31,7 +32,7 @@ export interface RulesModuleAPI {
31
32
  holders: {
32
33
  form_record_id: number;
33
34
  }[];
34
- isFormSubject: boolean;
35
+ isFormSubject: RulesFormSubject;
35
36
  orderTotalAmount: number;
36
37
  }) => DiscountResult;
37
38
  }
@@ -318,6 +318,13 @@ declare class Server {
318
318
  * this.extractQueryDate('2026-04-15 09:58:00') // => '2026-04-15'
319
319
  */
320
320
  private extractQueryDate;
321
+ /**
322
+ * 判断时间范围是否完整落在今天。
323
+ *
324
+ * @example
325
+ * this.isRangeFullyToday('2026-04-15', '2026-04-15') // => true
326
+ */
327
+ private isRangeFullyToday;
321
328
  /**
322
329
  * 判断时间范围是否「开始和结束都不是今天」。
323
330
  *
@@ -327,8 +334,8 @@ declare class Server {
327
334
  private isRangeBothNotToday;
328
335
  /**
329
336
  * 订单查询是否走本地:
330
- * - start_time 与 end_time 都不是今天时,走远端;
331
- * - 其余情况走本地。
337
+ * - 仅当 start_time 与 end_time 都是今天时,走本地;
338
+ * - 任意一端不是今天时,走云端,确保跨天查询能拉取非本地窗口数据。
332
339
  */
333
340
  private shouldUseLocalOrderQuery;
334
341
  /**
@@ -424,6 +431,9 @@ declare class Server {
424
431
  private shouldLookupLocalPrintOrder;
425
432
  private getLocalPrintOrderLookup;
426
433
  private handleLocalPrintOrder;
434
+ private handleMachinecodeBatchMetadata;
435
+ private resolveMachinecodeBatchMetadataLookup;
436
+ private syncMachinecodeBatchMetadataToLocalOrder;
427
437
  private handleOrderCheckoutSubmit;
428
438
  private handleSyncCheckoutSubmit;
429
439
  private handlePendingSyncCheckoutOrder;