@pisell/pisellos 2.2.278 → 2.2.280

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 (188) hide show
  1. package/dist/modules/BaseModule.d.ts +1 -0
  2. package/dist/modules/BaseModule.js +24 -28
  3. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  4. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  5. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  6. package/dist/modules/Customer/index.d.ts +4 -0
  7. package/dist/modules/Customer/index.js +91 -59
  8. package/dist/modules/Customer/types.d.ts +2 -0
  9. package/dist/modules/Discount/index.d.ts +1 -0
  10. package/dist/modules/Discount/index.js +40 -11
  11. package/dist/modules/Discount/types.d.ts +1 -0
  12. package/dist/modules/Holder/index.d.ts +48 -0
  13. package/dist/modules/Holder/index.js +640 -0
  14. package/dist/modules/Holder/types.d.ts +123 -0
  15. package/dist/modules/Holder/types.js +1 -0
  16. package/dist/modules/Holder/utils.d.ts +13 -0
  17. package/dist/modules/Holder/utils.js +34 -0
  18. package/dist/modules/OpenData/index.js +2 -2
  19. package/dist/modules/Order/index.d.ts +32 -4
  20. package/dist/modules/Order/index.js +868 -675
  21. package/dist/modules/Order/types.d.ts +22 -1
  22. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  23. package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
  24. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
  26. package/dist/modules/Order/utils.d.ts +10 -0
  27. package/dist/modules/Order/utils.js +71 -34
  28. package/dist/modules/Payment/index.d.ts +4 -0
  29. package/dist/modules/Payment/index.js +14 -4
  30. package/dist/modules/Payment/walletpass.js +21 -7
  31. package/dist/modules/Product/types.d.ts +1 -0
  32. package/dist/modules/ProductList/index.js +33 -13
  33. package/dist/modules/Quotation/index.d.ts +1 -1
  34. package/dist/modules/Quotation/index.js +2 -2
  35. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  36. package/dist/modules/ResourcePlanner/index.js +181 -0
  37. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  38. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  39. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  40. package/dist/modules/ResourcePlanner/types.js +1 -0
  41. package/dist/modules/Rules/index.js +153 -56
  42. package/dist/modules/SalesSummary/index.js +12 -13
  43. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  44. package/dist/modules/ScanOrderLogger/index.js +15 -2
  45. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  46. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  47. package/dist/modules/Schedule/index.d.ts +3 -1
  48. package/dist/modules/Schedule/index.js +21 -16
  49. package/dist/modules/Summary/utils.js +38 -13
  50. package/dist/modules/index.d.ts +2 -0
  51. package/dist/modules/index.js +3 -1
  52. package/dist/plugins/window.d.ts +1 -0
  53. package/dist/server/index.d.ts +20 -0
  54. package/dist/server/index.js +1101 -909
  55. package/dist/server/modules/order/index.d.ts +2 -0
  56. package/dist/server/modules/order/index.js +261 -96
  57. package/dist/server/modules/order/types.d.ts +1 -1
  58. package/dist/solution/BaseSales/index.d.ts +20 -1
  59. package/dist/solution/BaseSales/index.js +989 -881
  60. package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
  61. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  62. package/dist/solution/BaseSales/utils.js +31 -20
  63. package/dist/solution/BookingByStep/index.d.ts +17 -2
  64. package/dist/solution/BookingByStep/index.js +294 -215
  65. package/dist/solution/BookingByStep/types.d.ts +2 -1
  66. package/dist/solution/BookingByStep/types.js +3 -1
  67. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  68. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  69. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  70. package/dist/solution/BookingTicket/index.d.ts +21 -3
  71. package/dist/solution/BookingTicket/index.js +312 -226
  72. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  73. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  74. package/dist/solution/ScanOrder/index.d.ts +26 -14
  75. package/dist/solution/ScanOrder/index.js +1142 -739
  76. package/dist/solution/ScanOrder/types.d.ts +21 -1
  77. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  78. package/dist/solution/ScanOrder/utils.js +97 -45
  79. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  80. package/dist/solution/ShopDiscount/index.js +125 -87
  81. package/dist/solution/UnifiedBookingSales/index.d.ts +204 -0
  82. package/dist/solution/UnifiedBookingSales/index.js +2211 -0
  83. package/dist/solution/UnifiedBookingSales/types.d.ts +150 -0
  84. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  85. package/dist/solution/VenueBooking/index.d.ts +39 -11
  86. package/dist/solution/VenueBooking/index.js +1167 -841
  87. package/dist/solution/VenueBooking/types.d.ts +3 -0
  88. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  89. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  90. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  91. package/dist/solution/index.d.ts +1 -0
  92. package/dist/solution/index.js +2 -1
  93. package/dist/types/index.d.ts +1 -0
  94. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  95. package/lib/modules/BaseModule.d.ts +1 -0
  96. package/lib/modules/BaseModule.js +24 -37
  97. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  98. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  99. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  100. package/lib/modules/Customer/index.d.ts +4 -0
  101. package/lib/modules/Customer/index.js +11 -0
  102. package/lib/modules/Customer/types.d.ts +2 -0
  103. package/lib/modules/Discount/index.d.ts +1 -0
  104. package/lib/modules/Discount/index.js +9 -0
  105. package/lib/modules/Discount/types.d.ts +1 -0
  106. package/lib/modules/Holder/index.d.ts +48 -0
  107. package/lib/modules/Holder/index.js +402 -0
  108. package/lib/modules/Holder/types.d.ts +123 -0
  109. package/lib/modules/Holder/types.js +17 -0
  110. package/lib/modules/Holder/utils.d.ts +13 -0
  111. package/lib/modules/Holder/utils.js +71 -0
  112. package/lib/modules/OpenData/index.js +1 -1
  113. package/lib/modules/Order/index.d.ts +32 -4
  114. package/lib/modules/Order/index.js +372 -156
  115. package/lib/modules/Order/types.d.ts +22 -1
  116. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  117. package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
  118. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  119. package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
  120. package/lib/modules/Order/utils.d.ts +10 -0
  121. package/lib/modules/Order/utils.js +39 -6
  122. package/lib/modules/Payment/index.d.ts +4 -0
  123. package/lib/modules/Payment/index.js +7 -0
  124. package/lib/modules/Payment/walletpass.js +12 -0
  125. package/lib/modules/Product/types.d.ts +1 -0
  126. package/lib/modules/ProductList/index.js +49 -31
  127. package/lib/modules/Quotation/index.d.ts +1 -1
  128. package/lib/modules/Quotation/index.js +2 -2
  129. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  130. package/lib/modules/ResourcePlanner/index.js +148 -0
  131. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  132. package/lib/modules/ResourcePlanner/planner.js +933 -0
  133. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  134. package/lib/modules/ResourcePlanner/types.js +17 -0
  135. package/lib/modules/Rules/index.js +117 -25
  136. package/lib/modules/SalesSummary/index.js +6 -7
  137. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  138. package/lib/modules/ScanOrderLogger/index.js +13 -1
  139. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  140. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  141. package/lib/modules/Schedule/index.d.ts +3 -1
  142. package/lib/modules/Schedule/index.js +10 -8
  143. package/lib/modules/Summary/utils.js +21 -1
  144. package/lib/modules/index.d.ts +2 -0
  145. package/lib/modules/index.js +5 -1
  146. package/lib/plugins/window.d.ts +1 -0
  147. package/lib/server/index.d.ts +20 -0
  148. package/lib/server/index.js +124 -19
  149. package/lib/server/modules/order/index.d.ts +2 -0
  150. package/lib/server/modules/order/index.js +75 -5
  151. package/lib/server/modules/order/types.d.ts +1 -1
  152. package/lib/solution/BaseSales/index.d.ts +20 -1
  153. package/lib/solution/BaseSales/index.js +105 -31
  154. package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
  156. package/lib/solution/BaseSales/utils.js +29 -18
  157. package/lib/solution/BookingByStep/index.d.ts +17 -2
  158. package/lib/solution/BookingByStep/index.js +60 -18
  159. package/lib/solution/BookingByStep/types.d.ts +2 -1
  160. package/lib/solution/BookingByStep/types.js +5 -0
  161. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  162. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  163. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  164. package/lib/solution/BookingTicket/index.d.ts +21 -3
  165. package/lib/solution/BookingTicket/index.js +75 -16
  166. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  167. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  168. package/lib/solution/ScanOrder/index.d.ts +26 -14
  169. package/lib/solution/ScanOrder/index.js +449 -182
  170. package/lib/solution/ScanOrder/types.d.ts +21 -1
  171. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  172. package/lib/solution/ScanOrder/utils.js +60 -18
  173. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  174. package/lib/solution/ShopDiscount/index.js +14 -0
  175. package/lib/solution/UnifiedBookingSales/index.d.ts +204 -0
  176. package/lib/solution/UnifiedBookingSales/index.js +1273 -0
  177. package/lib/solution/UnifiedBookingSales/types.d.ts +150 -0
  178. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  179. package/lib/solution/VenueBooking/index.d.ts +39 -11
  180. package/lib/solution/VenueBooking/index.js +322 -110
  181. package/lib/solution/VenueBooking/types.d.ts +3 -0
  182. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  183. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  184. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  185. package/lib/solution/index.d.ts +1 -0
  186. package/lib/solution/index.js +3 -1
  187. package/lib/types/index.d.ts +1 -0
  188. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
2
2
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
3
+ import { HolderModule } from '../../modules/Holder';
3
4
  export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
4
5
  export declare enum VenueBookingHooks {
5
6
  onInited = "venueBooking:onInited",
@@ -96,6 +97,7 @@ export interface VenueResourceRawData {
96
97
  export interface ResourceProductMapping {
97
98
  productId: number;
98
99
  productTitle: string;
100
+ formName?: string;
99
101
  resourceName: string;
100
102
  formId: number | string;
101
103
  price: string;
@@ -144,6 +146,7 @@ export interface VenueBookingState {
144
146
  passed: boolean | null;
145
147
  failures: QuantityCheckResult[];
146
148
  };
149
+ holder?: HolderModule;
147
150
  }
148
151
  export interface VenueBookingLoggerRuntimeConfig {
149
152
  provider?: ScanOrderLoggerProviderType;
@@ -93,6 +93,7 @@ export function buildResourceProductMap(products) {
93
93
  var mapping = {
94
94
  productId: product.id,
95
95
  productTitle: product.title,
96
+ formName: resource.title,
96
97
  resourceName: resource.title,
97
98
  formId: resource.id,
98
99
  price: product.price || '0.00',
@@ -12,10 +12,6 @@ export declare function buildPriceBreakdown(params: {
12
12
  }) => number;
13
13
  };
14
14
  }): PriceBreakdownEntry[];
15
- export declare function buildVenueResourceMetadata(params: {
16
- mapping: ResourceProductMapping;
17
- rawResource: VenueResourceRawData | undefined;
18
- }): Record<string, any>;
19
15
  export interface BuildVenueBookingParams {
20
16
  group: MergedSlotGroup;
21
17
  resourceId: number | string;
@@ -29,6 +25,10 @@ export interface BuildVenueBookingParams {
29
25
  */
30
26
  childResources?: VenueResourceRawData[];
31
27
  }
28
+ export declare function buildVenueResourceMetadata(params: {
29
+ mapping: ResourceProductMapping;
30
+ rawResource: VenueResourceRawData | undefined;
31
+ }): Record<string, any>;
32
32
  export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
33
33
  /**
34
34
  * 从一条已合并的订单商品还原出独立的时段列表。
@@ -90,13 +90,15 @@ export function buildPriceBreakdown(params) {
90
90
  return entries;
91
91
  }
92
92
  export function buildVenueResourceMetadata(params) {
93
- var _rawResource$form_nam, _ref, _rawResource$main_fie, _rawResource$combined;
93
+ var _mapping$formName, _rawResource$main_fie;
94
94
  var mapping = params.mapping,
95
95
  rawResource = params.rawResource;
96
+ var combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource;
97
+ var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
96
98
  return {
97
- form_name: (_rawResource$form_nam = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_name) !== null && _rawResource$form_nam !== void 0 ? _rawResource$form_nam : '',
98
- resource_name: (_ref = (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName) !== null && _ref !== void 0 ? _ref : '',
99
- combined_resource: (_rawResource$combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource) !== null && _rawResource$combined !== void 0 ? _rawResource$combined : null
99
+ form_name: (_mapping$formName = mapping.formName) !== null && _mapping$formName !== void 0 ? _mapping$formName : mapping.resourceName,
100
+ resource_name: (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName,
101
+ combined_resource: isCombined ? combined : null
100
102
  };
101
103
  }
102
104
  export function buildVenueBookingEntry(params) {
@@ -119,7 +121,10 @@ export function buildVenueBookingEntry(params) {
119
121
  form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
120
122
  relation_id: resourceId,
121
123
  capacity: 1,
122
- metadata: {}
124
+ metadata: buildVenueResourceMetadata({
125
+ mapping: mapping,
126
+ rawResource: rawResource
127
+ })
123
128
  };
124
129
  if (childResources && childResources.length) {
125
130
  resourceEntry.children = childResources.map(function (child) {
@@ -8,3 +8,4 @@ export * from './Sales';
8
8
  export * from './ScanOrder';
9
9
  export * from './BaseSales';
10
10
  export * from './VenueBooking';
11
+ export * from './UnifiedBookingSales';
@@ -7,4 +7,5 @@ export * from "./Checkout";
7
7
  export * from "./Sales";
8
8
  export * from "./ScanOrder";
9
9
  export * from "./BaseSales";
10
- export * from "./VenueBooking";
10
+ export * from "./VenueBooking";
11
+ export * from "./UnifiedBookingSales";
@@ -6,6 +6,7 @@ export interface Plugin {
6
6
  version: string;
7
7
  initialize: () => Promise<void> | void;
8
8
  destroy?: () => Promise<void> | void;
9
+ getLocalStorage?: (key: string) => string | null;
9
10
  }
10
11
  export interface PluginOptions {
11
12
  dependencies?: string[];
@@ -1,51 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/model/strategy/adapter/promotion/index.ts
30
- var promotion_exports = {};
31
- __export(promotion_exports, {
32
- BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
34
- PromotionAdapter: () => import_adapter.PromotionAdapter,
35
- PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
36
- X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
37
- default: () => import_adapter2.default
38
- });
39
- module.exports = __toCommonJS(promotion_exports);
40
- var import_evaluator = require("./evaluator");
41
- var import_adapter = require("./adapter");
42
- var import_adapter2 = __toESM(require("./adapter"));
43
- var import_examples = require("./examples");
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- BUY_X_GET_Y_FREE_STRATEGY,
47
- ITEM_REWARD_STRATEGY,
48
- PromotionAdapter,
49
- PromotionEvaluator,
50
- X_ITEMS_FOR_Y_PRICE_STRATEGY
51
- });
@@ -8,6 +8,7 @@ export declare class BaseModule {
8
8
  protected core: PisellCore;
9
9
  constructor(name?: string, version?: string);
10
10
  destroy(): void;
11
+ private isRecord;
11
12
  checkSaveCache({ cacheId, fatherModule, store, cacheKey, }: {
12
13
  cacheId: string | undefined;
13
14
  fatherModule: string | undefined;
@@ -34,6 +34,9 @@ var BaseModule = class {
34
34
  this.core.effects.offByModuleDestroy(this.name);
35
35
  this.core.unregisterModule(this);
36
36
  }
37
+ isRecord(value) {
38
+ return !!value && typeof value === "object" && !Array.isArray(value);
39
+ }
37
40
  // 提供统一的缓存 module 里的数据的方法
38
41
  checkSaveCache({
39
42
  cacheId,
@@ -41,45 +44,29 @@ var BaseModule = class {
41
44
  store,
42
45
  cacheKey
43
46
  }) {
44
- const window = this.core.getPlugin("window");
45
- if (cacheId) {
47
+ if (!cacheId)
48
+ return;
49
+ try {
50
+ const window = this.core.getPlugin("window");
51
+ const sessionStorage = window == null ? void 0 : window.sessionStorage;
52
+ if (!sessionStorage)
53
+ return;
54
+ const storageKey = fatherModule || cacheId;
55
+ const rawCacheData = sessionStorage.getItem(storageKey);
56
+ const parsedCacheData = rawCacheData ? JSON.parse(rawCacheData) : {};
57
+ if (!this.isRecord(parsedCacheData))
58
+ return;
59
+ const cacheBucket = fatherModule ? this.isRecord(parsedCacheData[cacheId]) ? parsedCacheData[cacheId] : {} : parsedCacheData;
60
+ const moduleBucket = this.isRecord(cacheBucket[this.name]) ? cacheBucket[this.name] : {};
61
+ cacheKey.forEach((key) => {
62
+ moduleBucket[key] = store == null ? void 0 : store[key];
63
+ });
64
+ cacheBucket[this.name] = moduleBucket;
46
65
  if (fatherModule) {
47
- const currentCacheData = window.sessionStorage.getItem(fatherModule);
48
- let currentCacheDataObj = JSON.parse(currentCacheData || "{}");
49
- if (!currentCacheData || !currentCacheDataObj[cacheId]) {
50
- currentCacheDataObj = {
51
- [cacheId]: {
52
- [this.name]: {}
53
- }
54
- };
55
- }
56
- if (!currentCacheDataObj[cacheId][this.name]) {
57
- currentCacheDataObj[cacheId][this.name] = {};
58
- }
59
- cacheKey.forEach((key) => {
60
- currentCacheDataObj[cacheId][this.name][key] = store == null ? void 0 : store[key];
61
- });
62
- window.sessionStorage.setItem(
63
- fatherModule,
64
- JSON.stringify(currentCacheDataObj)
65
- );
66
- } else {
67
- let currentCacheData = window.sessionStorage.getItem(cacheId);
68
- let currentCacheDataObj = JSON.parse(currentCacheData || "{}");
69
- if (!currentCacheDataObj) {
70
- currentCacheDataObj = {};
71
- }
72
- if (!currentCacheDataObj[this.name]) {
73
- currentCacheDataObj[this.name] = {};
74
- }
75
- cacheKey.forEach((key) => {
76
- currentCacheDataObj[this.name][key] = store[key];
77
- });
78
- window.sessionStorage.setItem(
79
- cacheId,
80
- JSON.stringify(currentCacheDataObj)
81
- );
66
+ parsedCacheData[cacheId] = cacheBucket;
82
67
  }
68
+ sessionStorage.setItem(storageKey, JSON.stringify(parsedCacheData));
69
+ } catch {
83
70
  }
84
71
  }
85
72
  effectsOn(eventType, callback) {
@@ -202,6 +202,8 @@ function buildCacheItemFromOrderLine(input) {
202
202
  const productTitle = resolveProductTitle(product, booking, sourceProduct);
203
203
  const productCover = resolveProductCover(product, booking, sourceProduct);
204
204
  const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
205
+ const hasBundle = Array.isArray(product.product_bundle) && product.product_bundle.length > 0;
206
+ const bundleEdit = product.bundle_edit ?? (hasBundle ? 0 : void 0);
205
207
  const other = {
206
208
  product_variant_id: product.product_variant_id ?? 0,
207
209
  option: (0, import_utils.getProductSkuOptions)(product),
@@ -234,6 +236,7 @@ function buildCacheItemFromOrderLine(input) {
234
236
  product.discount_list,
235
237
  (_c = product.metadata) == null ? void 0 : _c.product_discount_reason
236
238
  ) || void 0,
239
+ ...bundleEdit !== void 0 ? { bundle_edit: bundleEdit } : {},
237
240
  ...productOptionString ? { product_option_string: productOptionString } : {}
238
241
  };
239
242
  const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
@@ -83,12 +83,13 @@ function getTimeObj(params) {
83
83
  const { cacheItem, useStartTime, useDuration, ctx } = params;
84
84
  const isMultiDay = (0, import_serviceTimes.isMultiDayProduct)(cacheItem);
85
85
  const flexibleOption = getFlexibleOption({ cacheItem, useStartTime, ctx });
86
- const baseSlices = (0, import_timeSlices.sliceDayIntoFiveMinutes)(
86
+ const {
87
+ timeSlices,
88
+ durationSlicesBasedOnTime
89
+ } = (0, import_timeSlices.sliceDayIntoFiveMinutes)(
87
90
  (_c = (_b = (_a = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.service_time,
88
91
  isMultiDay
89
92
  );
90
- const timeSlices = [...baseSlices.timeSlices];
91
- const durationSlicesBasedOnTime = [...baseSlices.durationSlicesBasedOnTime];
92
93
  if (flexibleOption) {
93
94
  durationSlicesBasedOnTime.unshift(flexibleOption);
94
95
  }
@@ -38,10 +38,21 @@ __export(timeSlices_exports, {
38
38
  module.exports = __toCommonJS(timeSlices_exports);
39
39
  var import_dayjs = __toESM(require("dayjs"));
40
40
  var import_flexible = require("./flexible");
41
+ var timeSlicesCache = /* @__PURE__ */ new Map();
42
+ function copyTimeSlices(result) {
43
+ return {
44
+ timeSlices: [...result.timeSlices],
45
+ durationSlicesBasedOnTime: [...result.durationSlicesBasedOnTime]
46
+ };
47
+ }
41
48
  function sliceDayIntoFiveMinutes(config, isDay) {
49
+ const timeSlice = config && config.value || 5;
50
+ const cacheKey = isDay ? "days" : `minutes:${timeSlice}`;
51
+ const cached = timeSlicesCache.get(cacheKey);
52
+ if (cached)
53
+ return copyTimeSlices(cached);
42
54
  const startTime = (0, import_dayjs.default)().startOf("day");
43
55
  const endTime = (0, import_dayjs.default)().endOf("day");
44
- const timeSlice = config && config.value || 5;
45
56
  const timeSlices = [];
46
57
  const durationSlicesBasedOnTime = [];
47
58
  let currentTime = startTime;
@@ -58,7 +69,9 @@ function sliceDayIntoFiveMinutes(config, isDay) {
58
69
  });
59
70
  currentDay += 1;
60
71
  }
61
- return { timeSlices, durationSlicesBasedOnTime };
72
+ const result2 = { timeSlices, durationSlicesBasedOnTime };
73
+ timeSlicesCache.set(cacheKey, result2);
74
+ return copyTimeSlices(result2);
62
75
  }
63
76
  while (currentTime.isBefore(endTime)) {
64
77
  timeSlices.push({
@@ -73,7 +86,9 @@ function sliceDayIntoFiveMinutes(config, isDay) {
73
86
  });
74
87
  currentTime = nextTime;
75
88
  }
76
- return { timeSlices, durationSlicesBasedOnTime };
89
+ const result = { timeSlices, durationSlicesBasedOnTime };
90
+ timeSlicesCache.set(cacheKey, result);
91
+ return copyTimeSlices(result);
77
92
  }
78
93
  function findNextDuration(current, array, defaultValue) {
79
94
  if (defaultValue !== void 0 && defaultValue !== null)
@@ -44,6 +44,10 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
44
44
  * 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
45
45
  */
46
46
  queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
47
+ /**
48
+ * 查询单个客户详情,不写入 customerList / pagination 状态。
49
+ */
50
+ queryCustomerDetail(id: string | number): Promise<ShopCustomer | null>;
47
51
  /**
48
52
  * 获取客户列表
49
53
  * @param params 查询参数
@@ -201,6 +201,17 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
201
201
  pageSize
202
202
  };
203
203
  }
204
+ /**
205
+ * 查询单个客户详情,不写入 customerList / pagination 状态。
206
+ */
207
+ async queryCustomerDetail(id) {
208
+ var _a;
209
+ const result = await this.request.get(`/customer/info/${id}`, {
210
+ with_trashed: 1
211
+ });
212
+ const customer = ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.customer) || (result == null ? void 0 : result.data) || (result == null ? void 0 : result.customer) || null;
213
+ return customer && typeof customer === "object" ? customer : null;
214
+ }
204
215
  /**
205
216
  * 获取客户列表
206
217
  * @param params 查询参数
@@ -112,6 +112,8 @@ export interface CustomerModuleAPI {
112
112
  getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
113
113
  /** 查询客户列表但不更新列表分页状态 */
114
114
  queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
115
+ /** 查询单个客户详情但不修改客户列表状态 */
116
+ queryCustomerDetail: (id: string | number) => Promise<ShopCustomer | null>;
115
117
  /** 设置客户列表 */
116
118
  setCustomerList: (customers: ShopCustomer[], total?: number) => void;
117
119
  /** 设置当前选择的客户 */
@@ -32,6 +32,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
32
32
  customerId?: number;
33
33
  orderId?: number;
34
34
  }): Promise<DiscountWithReason>;
35
+ batchSearchByProductIds(productIds: number[]): Promise<any>;
35
36
  filterEnabledDiscountList(discountList: Discount[]): Discount[];
36
37
  private checkUsageCreditsLimit;
37
38
  filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
@@ -147,6 +147,15 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
147
147
  const resultDiscountWithReason = this.filterEnabledDiscountListWithReason((result == null ? void 0 : result.data) || []) || [];
148
148
  return resultDiscountWithReason;
149
149
  }
150
+ async batchSearchByProductIds(productIds) {
151
+ const result = await this.request.get(`/machinecode/batch-search`, {
152
+ ids: productIds,
153
+ translate_flag: 1,
154
+ tags: ["good_pass", "product_discount_card"],
155
+ relation_product: 1
156
+ });
157
+ return (result == null ? void 0 : result.data) || [];
158
+ }
150
159
  filterEnabledDiscountList(discountList) {
151
160
  return discountList.filter(
152
161
  (discount) => discount.limit_status === "enable" && new import_decimal.default((discount == null ? void 0 : discount.par_value) || 0).minus(new import_decimal.default((discount == null ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && this.checkUsageCreditsLimit(discount)
@@ -157,6 +157,7 @@ export interface Discount {
157
157
  num?: number;
158
158
  start_date?: string;
159
159
  start_time?: string;
160
+ discount_rule_uncheck_flag?: boolean;
160
161
  usageLimitFailKey?: string | null;
161
162
  unified_available_status?: number | undefined | null;
162
163
  }
@@ -0,0 +1,48 @@
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
+ import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
4
+ export * from './types';
5
+ export * from './utils';
6
+ export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
7
+ protected defaultName: string;
8
+ protected defaultVersion: string;
9
+ private store;
10
+ private request;
11
+ private cacheId;
12
+ private openCache;
13
+ private fatherModule;
14
+ private isLoading;
15
+ private error;
16
+ /** 已加载过表单数据的 form_id 缓存标记 */
17
+ private loadedFormIds;
18
+ private window;
19
+ constructor(name?: string, version?: string);
20
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
21
+ /** 统一提交 formMap,仅此处触发 store changed */
22
+ private commitFormMap;
23
+ /** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
24
+ private notifyFormMapChanged;
25
+ getHolderFormMap(): HolderFormMap;
26
+ getHolderFormData(formId: number | string): IFormItemData | undefined;
27
+ setFormData(formId: number | string, data: Partial<IFormItemData>): void;
28
+ private ensureFormItem;
29
+ private hasFormData;
30
+ private patchFormMap;
31
+ fetchFormInfo(params: IFetchFormInfoParams): Promise<IFormInfo | IFormInfo[]>;
32
+ fetchRecords(params: IFetchFormRecordsParams): Promise<any>;
33
+ ensureFormData(params: IEnsureFormDataParams): Promise<IFormItemData>;
34
+ ensureFormByProduct(params: IEnsureFormByProductParams): Promise<IFormItemData | null>;
35
+ addFormRecord(params: IAddFormRecordParams): Promise<any>;
36
+ /**
37
+ * UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
38
+ */
39
+ appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
40
+ removeFormRecord(formId: number | string, formRecordId: number): void;
41
+ clearFormData(formId?: number | string): void;
42
+ /**
43
+ * 登录后按当前 holderMap 批量刷新所有表单的 records。
44
+ * 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
45
+ */
46
+ refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
47
+ storeChange(path?: string): void;
48
+ }