@pisell/pisellos 2.1.155 → 2.1.158

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 (57) hide show
  1. package/dist/modules/Holder/index.d.ts +48 -0
  2. package/dist/modules/Holder/index.js +640 -0
  3. package/dist/modules/Holder/types.d.ts +123 -0
  4. package/dist/modules/Holder/types.js +1 -0
  5. package/dist/modules/Holder/utils.d.ts +13 -0
  6. package/dist/modules/Holder/utils.js +34 -0
  7. package/dist/modules/Order/index.d.ts +1 -0
  8. package/dist/modules/Order/index.js +18 -1
  9. package/dist/modules/Order/types.d.ts +2 -0
  10. package/dist/modules/Order/utils.d.ts +10 -0
  11. package/dist/modules/Order/utils.js +35 -3
  12. package/dist/modules/Product/types.d.ts +7 -0
  13. package/dist/modules/index.d.ts +1 -0
  14. package/dist/modules/index.js +2 -1
  15. package/dist/plugins/window.d.ts +1 -0
  16. package/dist/solution/BookingByStep/index.d.ts +16 -1
  17. package/dist/solution/BookingByStep/index.js +276 -204
  18. package/dist/solution/BookingByStep/types.d.ts +2 -1
  19. package/dist/solution/BookingByStep/types.js +3 -1
  20. package/dist/solution/ScanOrder/index.d.ts +2 -6
  21. package/dist/solution/ScanOrder/index.js +62 -259
  22. package/dist/solution/ScanOrder/types.d.ts +2 -20
  23. package/dist/solution/ScanOrder/utils.d.ts +0 -5
  24. package/dist/solution/ScanOrder/utils.js +23 -55
  25. package/dist/solution/VenueBooking/index.d.ts +19 -0
  26. package/dist/solution/VenueBooking/index.js +963 -733
  27. package/dist/solution/VenueBooking/types.d.ts +2 -0
  28. package/dist/types/index.d.ts +1 -0
  29. package/lib/modules/Holder/index.d.ts +48 -0
  30. package/lib/modules/Holder/index.js +402 -0
  31. package/lib/modules/Holder/types.d.ts +123 -0
  32. package/lib/modules/Holder/types.js +17 -0
  33. package/lib/modules/Holder/utils.d.ts +13 -0
  34. package/lib/modules/Holder/utils.js +71 -0
  35. package/lib/modules/Order/index.d.ts +1 -0
  36. package/lib/modules/Order/index.js +14 -0
  37. package/lib/modules/Order/types.d.ts +2 -0
  38. package/lib/modules/Order/utils.d.ts +10 -0
  39. package/lib/modules/Order/utils.js +36 -5
  40. package/lib/modules/Product/types.d.ts +7 -0
  41. package/lib/modules/index.d.ts +1 -0
  42. package/lib/modules/index.js +3 -1
  43. package/lib/plugins/window.d.ts +1 -0
  44. package/lib/solution/BookingByStep/index.d.ts +16 -1
  45. package/lib/solution/BookingByStep/index.js +39 -0
  46. package/lib/solution/BookingByStep/types.d.ts +2 -1
  47. package/lib/solution/BookingByStep/types.js +5 -0
  48. package/lib/solution/ScanOrder/index.d.ts +2 -6
  49. package/lib/solution/ScanOrder/index.js +51 -221
  50. package/lib/solution/ScanOrder/types.d.ts +2 -20
  51. package/lib/solution/ScanOrder/utils.d.ts +0 -5
  52. package/lib/solution/ScanOrder/utils.js +0 -23
  53. package/lib/solution/VenueBooking/index.d.ts +19 -0
  54. package/lib/solution/VenueBooking/index.js +134 -16
  55. package/lib/solution/VenueBooking/types.d.ts +2 -0
  56. package/lib/types/index.d.ts +1 -0
  57. package/package.json +2 -2
@@ -134,11 +134,6 @@ export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderPro
134
134
  * 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
135
135
  */
136
136
  export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
137
- /**
138
- * 找到第一个归属指定桌台的预约规则商品。
139
- * 归属判断基于商品资源中的 default_resource / optional_resource。
140
- */
141
- export declare function findReservationRuleProductByResourceId(products: ProductData[], resourceId: string | number | null | undefined): ProductData | undefined;
142
137
  /**
143
138
  * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
144
139
  */
@@ -629,55 +629,23 @@ export function collectLinkProductIdsFromReservationRules(rules) {
629
629
  }
630
630
 
631
631
  /**
632
- * 找到第一个归属指定桌台的预约规则商品。
633
- * 归属判断基于商品资源中的 default_resource / optional_resource。
632
+ * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
634
633
  */
635
- export function findReservationRuleProductByResourceId(products, resourceId) {
636
- var numericResourceId = Number(resourceId);
637
- if (!Number.isFinite(numericResourceId) || numericResourceId <= 0) return undefined;
634
+ export function pickFirstDurationMinutesFromProducts(products) {
638
635
  var _iterator7 = _createForOfIteratorHelper(products),
639
636
  _step7;
640
637
  try {
641
638
  for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
642
- var _product$product_reso;
643
- var product = _step7.value;
644
- var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
645
- if (!Array.isArray(resources)) continue;
646
- var hasMatchedResource = resources.some(function (resource) {
647
- var defaultResources = Array.isArray(resource === null || resource === void 0 ? void 0 : resource.default_resource) ? resource.default_resource : [];
648
- var optionalResources = Array.isArray(resource === null || resource === void 0 ? void 0 : resource.optional_resource) ? resource.optional_resource : [];
649
- return [].concat(_toConsumableArray(defaultResources), _toConsumableArray(optionalResources)).some(function (id) {
650
- return Number(id) === numericResourceId;
651
- });
652
- });
653
- if (hasMatchedResource) return product;
654
- }
655
- } catch (err) {
656
- _iterator7.e(err);
657
- } finally {
658
- _iterator7.f();
659
- }
660
- return undefined;
661
- }
662
-
663
- /**
664
- * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
665
- */
666
- export function pickFirstDurationMinutesFromProducts(products) {
667
- var _iterator8 = _createForOfIteratorHelper(products),
668
- _step8;
669
- try {
670
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
671
639
  var _product$duration;
672
- var product = _step8.value;
640
+ var product = _step7.value;
673
641
  var value = product === null || product === void 0 || (_product$duration = product.duration) === null || _product$duration === void 0 ? void 0 : _product$duration.value;
674
642
  var n = Number(value);
675
643
  if (Number.isFinite(n) && n > 0) return Math.floor(n);
676
644
  }
677
645
  } catch (err) {
678
- _iterator8.e(err);
646
+ _iterator7.e(err);
679
647
  } finally {
680
- _iterator8.f();
648
+ _iterator7.f();
681
649
  }
682
650
  return undefined;
683
651
  }
@@ -707,11 +675,11 @@ export function computeResourceIsFull(params) {
707
675
  if (!Number.isFinite(totalCapacity) || totalCapacity <= 0) return false;
708
676
  var now = dayjs();
709
677
  var occupied = 0;
710
- var _iterator9 = _createForOfIteratorHelper(capacityList || []),
711
- _step9;
678
+ var _iterator8 = _createForOfIteratorHelper(capacityList || []),
679
+ _step8;
712
680
  try {
713
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
714
- var slot = _step9.value;
681
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
682
+ var slot = _step8.value;
715
683
  var start = dayjs(slot === null || slot === void 0 ? void 0 : slot.start_at);
716
684
  var end = dayjs(slot === null || slot === void 0 ? void 0 : slot.end_at);
717
685
  if (!start.isValid() || !end.isValid()) continue;
@@ -721,9 +689,9 @@ export function computeResourceIsFull(params) {
721
689
  }
722
690
  }
723
691
  } catch (err) {
724
- _iterator9.e(err);
692
+ _iterator8.e(err);
725
693
  } finally {
726
- _iterator9.f();
694
+ _iterator8.f();
727
695
  }
728
696
  return occupied >= totalCapacity;
729
697
  }
@@ -733,11 +701,11 @@ export function computeResourceIsFull(params) {
733
701
  * 仅返回有限数字字段;若均无法解析则返回 `undefined`。
734
702
  */
735
703
  export function pickFirstCustomCapacityPaxBounds(products) {
736
- var _iterator10 = _createForOfIteratorHelper(products),
737
- _step10;
704
+ var _iterator9 = _createForOfIteratorHelper(products),
705
+ _step9;
738
706
  try {
739
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
740
- var p = _step10.value;
707
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
708
+ var p = _step9.value;
741
709
  var cap = p === null || p === void 0 ? void 0 : p.capacity;
742
710
  if (!cap || cap.type !== 'custom') continue;
743
711
  if (!Array.isArray(cap.custom) || cap.custom.length === 0) continue;
@@ -756,9 +724,9 @@ export function pickFirstCustomCapacityPaxBounds(products) {
756
724
  if (out.min !== undefined || out.max !== undefined) return out;
757
725
  }
758
726
  } catch (err) {
759
- _iterator10.e(err);
727
+ _iterator9.e(err);
760
728
  } finally {
761
- _iterator10.f();
729
+ _iterator9.f();
762
730
  }
763
731
  return undefined;
764
732
  }
@@ -768,11 +736,11 @@ export function pickFirstCustomCapacityPaxBounds(products) {
768
736
  * 无匹配时返回 `undefined`,调用方应回退为 `0`。
769
737
  */
770
738
  export function pickFirstCustomCapacityDimensionId(products) {
771
- var _iterator11 = _createForOfIteratorHelper(products),
772
- _step11;
739
+ var _iterator10 = _createForOfIteratorHelper(products),
740
+ _step10;
773
741
  try {
774
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
775
- var p = _step11.value;
742
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
743
+ var p = _step10.value;
776
744
  var cap = p === null || p === void 0 ? void 0 : p.capacity;
777
745
  if (!cap || cap.type !== 'custom') continue;
778
746
  if (!Array.isArray(cap.custom) || cap.custom.length === 0) continue;
@@ -788,9 +756,9 @@ export function pickFirstCustomCapacityDimensionId(products) {
788
756
  }
789
757
  }
790
758
  } catch (err) {
791
- _iterator11.e(err);
759
+ _iterator10.e(err);
792
760
  } finally {
793
- _iterator11.f();
761
+ _iterator10.f();
794
762
  }
795
763
  return undefined;
796
764
  }
@@ -7,6 +7,7 @@ import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
7
7
  import type { ProductData } from '../../modules/Product/types';
8
8
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
9
9
  import type { StrategyConfig } from '../../model/strategy/type';
10
+ import type { IAppendFormRecordParams, IRefreshAllFormRecordsParams } from '../../modules/Holder/types';
10
11
  export * from './types';
11
12
  interface VenueBookingItemRuleRuntimeConfig {
12
13
  strategyConfigs?: StrategyConfig[];
@@ -52,6 +53,12 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
52
53
  constructor(name?: string, version?: string);
53
54
  private normalizeCustomerId;
54
55
  private resolveCustomerIdFromLoginPayload;
56
+ private resolveHolderCustomerId;
57
+ /**
58
+ * 按商品 holder_config 预加载表单数据到 holderMap。
59
+ * appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
60
+ */
61
+ private preloadHolderForms;
55
62
  private clearLoginEffectListeners;
56
63
  private registerLoginEffect;
57
64
  private registerCustomerLoginListeners;
@@ -194,6 +201,18 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
194
201
  getUIState<T = any>(key: string): T | undefined;
195
202
  deleteUIState(key: string): void;
196
203
  setBookingHolder(bookingUid: string, holder: any): void;
204
+ /**
205
+ * 获取 holder 表单 map
206
+ */
207
+ getHolderFormMap(): import("../../modules/Holder").HolderFormMap;
208
+ /**
209
+ * UI 层触发:按当前 holderMap 批量刷新所有表单的 records
210
+ */
211
+ refreshAllHolderFormRecords(params?: Pick<IRefreshAllFormRecordsParams, 'customer_id' | 'useCache' | 'recordsUrl' | 'num' | 'skip'>): Promise<import("../../modules/Holder").HolderFormMap>;
212
+ /**
213
+ * 添加表单记录
214
+ */
215
+ appendFormRecord(params: IAppendFormRecordParams): import("../../modules/Holder").IFormRecord;
197
216
  checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
198
217
  setOtherParams(params: Record<string, any>, { cover }?: {
199
218
  cover?: boolean;