@pisell/pisellos 0.0.547 → 0.0.551

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 (48) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/Holder/index.d.ts +42 -0
  3. package/dist/modules/Holder/index.js +500 -0
  4. package/dist/modules/Holder/types.d.ts +115 -0
  5. package/dist/modules/Holder/types.js +1 -0
  6. package/dist/modules/Holder/utils.d.ts +9 -0
  7. package/dist/modules/Holder/utils.js +20 -0
  8. package/dist/modules/Order/index.d.ts +1 -0
  9. package/dist/modules/Order/index.js +14 -1
  10. package/dist/modules/Order/types.d.ts +2 -0
  11. package/dist/modules/Order/utils.d.ts +9 -0
  12. package/dist/modules/Order/utils.js +41 -13
  13. package/dist/modules/Product/types.d.ts +7 -0
  14. package/dist/modules/index.d.ts +1 -0
  15. package/dist/modules/index.js +2 -1
  16. package/dist/plugins/window.d.ts +1 -0
  17. package/dist/solution/BookingByStep/index.d.ts +11 -2
  18. package/dist/solution/BookingByStep/index.js +35 -2
  19. package/dist/solution/BookingByStep/types.d.ts +2 -1
  20. package/dist/solution/BookingByStep/types.js +3 -1
  21. package/dist/solution/VenueBooking/index.d.ts +17 -0
  22. package/dist/solution/VenueBooking/index.js +932 -717
  23. package/dist/solution/VenueBooking/types.d.ts +2 -0
  24. package/dist/types/index.d.ts +1 -0
  25. package/lib/modules/Holder/index.d.ts +42 -0
  26. package/lib/modules/Holder/index.js +329 -0
  27. package/lib/modules/Holder/types.d.ts +115 -0
  28. package/lib/modules/Holder/types.js +17 -0
  29. package/lib/modules/Holder/utils.d.ts +9 -0
  30. package/lib/modules/Holder/utils.js +57 -0
  31. package/lib/modules/Order/index.d.ts +1 -0
  32. package/lib/modules/Order/index.js +11 -0
  33. package/lib/modules/Order/types.d.ts +2 -0
  34. package/lib/modules/Order/utils.d.ts +9 -0
  35. package/lib/modules/Order/utils.js +32 -5
  36. package/lib/modules/Product/types.d.ts +7 -0
  37. package/lib/modules/index.d.ts +1 -0
  38. package/lib/modules/index.js +3 -1
  39. package/lib/plugins/window.d.ts +1 -0
  40. package/lib/solution/BookingByStep/index.d.ts +11 -2
  41. package/lib/solution/BookingByStep/index.js +27 -0
  42. package/lib/solution/BookingByStep/types.d.ts +2 -1
  43. package/lib/solution/BookingByStep/types.js +5 -0
  44. package/lib/solution/VenueBooking/index.d.ts +17 -0
  45. package/lib/solution/VenueBooking/index.js +114 -6
  46. package/lib/solution/VenueBooking/types.d.ts +2 -0
  47. package/lib/types/index.d.ts +1 -0
  48. package/package.json +2 -2
@@ -33,8 +33,9 @@ __export(utils_exports, {
33
33
  composeLinePrice: () => composeLinePrice,
34
34
  createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
35
35
  createDefaultTempOrder: () => createDefaultTempOrder,
36
- createEmptySummary: () => import_utils2.createEmptySummary,
36
+ createEmptySummary: () => import_utils3.createEmptySummary,
37
37
  createUuidV4: () => createUuidV4,
38
+ ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
38
39
  filterProductsForScanOrderMore: () => filterProductsForScanOrderMore,
39
40
  formatDateTime: () => formatDateTime,
40
41
  formatV1Product: () => formatV1Product,
@@ -50,8 +51,9 @@ __export(utils_exports, {
50
51
  module.exports = __toCommonJS(utils_exports);
51
52
  var import_dayjs = __toESM(require("dayjs"));
52
53
  var import_decimal = __toESM(require("decimal.js"));
53
- var import_utils = require("../../solution/ScanOrder/utils");
54
+ var import_utils = require("../Holder/utils");
54
55
  var import_utils2 = require("../../solution/ScanOrder/utils");
56
+ var import_utils3 = require("../../solution/ScanOrder/utils");
55
57
  function composeLinePrice(params) {
56
58
  const { mainPrice, bundle, useOriginalBundle } = params;
57
59
  let total = new import_decimal.default(Number(mainPrice) || 0);
@@ -113,7 +115,7 @@ function createDefaultOrderRulesHooks() {
113
115
  // 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
114
116
  // 不透明 identity 契约下,normalizeOrderProduct / restoreTempOrderFromStorage 已保证 identity_key 必存在;
115
117
  // 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
116
- _id: product.identity_key ? `${product.product_id}_${product.product_variant_id}_${product.identity_key}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils.buildProductLineFingerprint)(
118
+ _id: product.identity_key ? `${product.product_id}_${product.product_variant_id}_${product.identity_key}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils2.buildProductLineFingerprint)(
117
119
  product.product_option_item,
118
120
  product.product_bundle
119
121
  )}`,
@@ -196,6 +198,30 @@ var mergeRelationForms = (relationForms) => {
196
198
  }, {})
197
199
  ).filter((item) => item.form_record_ids.length > 0);
198
200
  };
201
+ function resolveCartItemHolderCustomerId(cartItem) {
202
+ var _a, _b, _c;
203
+ const origin = cartItem._origin;
204
+ const account = (_a = origin == null ? void 0 : origin.metadata) == null ? void 0 : _a.account;
205
+ return ((_b = origin == null ? void 0 : origin.holder) == null ? void 0 : _b.customer_id) ?? ((_c = account == null ? void 0 : account._origin) == null ? void 0 : _c.customer_id) ?? (account == null ? void 0 : account.customer_id);
206
+ }
207
+ function ensureCartItemOriginHolder(cartItem) {
208
+ var _a;
209
+ if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
210
+ return;
211
+ }
212
+ const holderConfig = (0, import_utils.getProductHolderConfig)(
213
+ (cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
214
+ );
215
+ const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
216
+ if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
217
+ return;
218
+ }
219
+ cartItem._origin.holder = {
220
+ customer_id: resolveCartItemHolderCustomerId(cartItem),
221
+ form_id: holderConfig.resource_id,
222
+ form_record: [formRecordId]
223
+ };
224
+ }
199
225
  var getAllDiscountList = (cartItem) => {
200
226
  var _a, _b, _c, _d;
201
227
  let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
@@ -378,7 +404,7 @@ function resolveSubmitCollectPax(tempOrder) {
378
404
  return normalizeSubmitCollectPaxValue((_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax);
379
405
  }
380
406
  function createDefaultTempOrder(params) {
381
- const summary = params.summary || (0, import_utils.createEmptySummary)();
407
+ const summary = params.summary || (0, import_utils2.createEmptySummary)();
382
408
  return {
383
409
  order_id: null,
384
410
  relation_id: void 0,
@@ -437,7 +463,7 @@ function buildSubmitPayload(params) {
437
463
  enhance
438
464
  } = params;
439
465
  const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
440
- const summary = tempOrder.summary || (0, import_utils.createEmptySummary)();
466
+ const summary = tempOrder.summary || (0, import_utils2.createEmptySummary)();
441
467
  const relationId = tempOrder.relation_id;
442
468
  const tableFormId = tempOrder.table_form_id;
443
469
  const bookingUuid = createUuidV4();
@@ -540,6 +566,7 @@ function formatV1Product(products) {
540
566
  createDefaultTempOrder,
541
567
  createEmptySummary,
542
568
  createUuidV4,
569
+ ensureCartItemOriginHolder,
543
570
  filterProductsForScanOrderMore,
544
571
  formatDateTime,
545
572
  formatV1Product,
@@ -210,6 +210,13 @@ export interface ProductData {
210
210
  option_group_count: number;
211
211
  /** 服务时长 */
212
212
  service_times?: any;
213
+ /** holder 表单配置 */
214
+ holder_config?: {
215
+ required?: number;
216
+ resource_id?: number;
217
+ status?: string;
218
+ [key: string]: any;
219
+ };
213
220
  }
214
221
  /**
215
222
  * 商品媒体信息接口
@@ -16,3 +16,4 @@ export * from './Schedule';
16
16
  export * from './Quotation';
17
17
  export * from './ScanOrderLogger';
18
18
  export * from './OpenData';
19
+ export * from './Holder';
@@ -34,6 +34,7 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
34
34
  __reExport(modules_exports, require("./Quotation"), module.exports);
35
35
  __reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
36
36
  __reExport(modules_exports, require("./OpenData"), module.exports);
37
+ __reExport(modules_exports, require("./Holder"), module.exports);
37
38
  // Annotate the CommonJS export names for ESM import in node:
38
39
  0 && (module.exports = {
39
40
  ...require("./Product"),
@@ -53,5 +54,6 @@ __reExport(modules_exports, require("./OpenData"), module.exports);
53
54
  ...require("./Schedule"),
54
55
  ...require("./Quotation"),
55
56
  ...require("./ScanOrderLogger"),
56
- ...require("./OpenData")
57
+ ...require("./OpenData"),
58
+ ...require("./Holder")
57
59
  });
@@ -16,6 +16,7 @@ export interface WindowPlugin extends Plugin {
16
16
  history: History;
17
17
  interaction?: any;
18
18
  getWalletPassEvaluator?: () => WalletPassEvaluator;
19
+ getLocalStorage?: (key: string) => string | null;
19
20
  }
20
21
  /**
21
22
  * 简单的 Storage 接口实现
@@ -10,6 +10,7 @@ import { ITime } from '../../modules/Date/types';
10
10
  import dayjs from 'dayjs';
11
11
  import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
12
12
  import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
13
+ import { IAppendFormRecordParams } from '../../modules/Holder/types';
13
14
  export declare class BookingByStepImpl extends BaseModule implements Module {
14
15
  protected defaultName: string;
15
16
  protected defaultVersion: string;
@@ -126,6 +127,14 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
126
127
  * @param params
127
128
  */
128
129
  fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
130
+ /**
131
+ * 获取 holder 表单 map
132
+ */
133
+ getHolderFormMap(): import("../../modules").HolderFormMap;
134
+ /**
135
+ * 添加表单记录
136
+ */
137
+ appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
129
138
  setDateRange(dateRange: ITime[]): Promise<void>;
130
139
  clearDateRange(): void;
131
140
  getDateRange(): Promise<ITime[]>;
@@ -311,7 +320,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
320
  date: string;
312
321
  status: string;
313
322
  week: string;
314
- weekNum: 0 | 1 | 4 | 2 | 3 | 5 | 6;
323
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
324
  }[]>;
316
325
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
326
  private getScheduleDataByIds;
@@ -358,7 +367,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
358
367
  };
359
368
  setOtherData(key: string, value: any): void;
360
369
  getOtherData(key: string): any;
361
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
370
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
362
371
  /**
363
372
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
364
373
  *
@@ -89,6 +89,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
89
89
  }
90
90
  const moduleArr = [
91
91
  "accountList",
92
+ "holder",
92
93
  "cart",
93
94
  "schedule",
94
95
  "summary",
@@ -379,6 +380,18 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
379
380
  }
380
381
  return this.store.accountList.fetchHolderAccounts(params);
381
382
  }
383
+ /**
384
+ * 获取 holder 表单 map
385
+ */
386
+ getHolderFormMap() {
387
+ return this.store.holder.getHolderFormMap();
388
+ }
389
+ /**
390
+ * 添加表单记录
391
+ */
392
+ appendFormRecord(params) {
393
+ return this.store.holder.appendFormRecord(params);
394
+ }
382
395
  // 设置日期范围,注入到日期模块中
383
396
  async setDateRange(dateRange) {
384
397
  this.store.date.setDateRange(dateRange);
@@ -599,6 +612,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
599
612
  date,
600
613
  account
601
614
  }) {
615
+ var _a, _b;
602
616
  const {
603
617
  bundle,
604
618
  options,
@@ -630,6 +644,19 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
630
644
  account = activeAccount;
631
645
  }
632
646
  }
647
+ try {
648
+ const customer = JSON.parse(((_b = (_a = this.window) == null ? void 0 : _a.getLocalStorage) == null ? void 0 : _b.call(_a, "customer")) || "{}");
649
+ if (customer == null ? void 0 : customer.id) {
650
+ this.store.holder.ensureFormByProduct({
651
+ product: productData,
652
+ customer_id: Number(customer.id),
653
+ shop_id: (productData == null ? void 0 : productData.shop_id) || "",
654
+ useCache: true
655
+ });
656
+ }
657
+ } catch (error) {
658
+ console.error("[BookingByStep] 加载 holder 表单失败", error);
659
+ }
633
660
  const flag = this.store.cart.mergeCartItemByRowKey({
634
661
  rowKey,
635
662
  quantity,
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
1
+ import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from '../../modules';
2
2
  export interface BookingByStepState {
3
3
  cart: CartModule;
4
4
  summary: SummaryModule;
@@ -16,6 +16,7 @@ export interface BookingByStepState {
16
16
  schedule: ScheduleModule;
17
17
  salesSummary?: SalesSummaryModule;
18
18
  scanOrderLogger?: ScanOrderLoggerModule;
19
+ holder: HolderModule;
19
20
  }
20
21
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
21
22
  export declare enum BookingByStepHooks {
@@ -81,6 +81,11 @@ function createModule(moduleName, solutionName, name, version) {
81
81
  `${solutionName}_${name || moduleName}`,
82
82
  version
83
83
  );
84
+ case "holder":
85
+ return new import_modules.HolderModule(
86
+ `${solutionName}_${name || moduleName}`,
87
+ version
88
+ );
84
89
  default:
85
90
  throw new Error(`Unknown module type: ${moduleName}`);
86
91
  }
@@ -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 } from '../../modules/Holder/types';
10
11
  export * from './types';
11
12
  interface VenueBookingItemRuleRuntimeConfig {
12
13
  strategyConfigs?: StrategyConfig[];
@@ -52,6 +53,13 @@ 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
+ private ensureProductHolderForm;
58
+ /**
59
+ * 按商品 holder_config 预加载表单数据到 holderMap。
60
+ * appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
61
+ */
62
+ private preloadHolderForms;
55
63
  private clearLoginEffectListeners;
56
64
  private registerLoginEffect;
57
65
  private registerCustomerLoginListeners;
@@ -193,6 +201,15 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
193
201
  setUIState(key: string, value: any): void;
194
202
  getUIState<T = any>(key: string): T | undefined;
195
203
  deleteUIState(key: string): void;
204
+ setBookingHolder(bookingUid: string, holder: any): void;
205
+ /**
206
+ * 获取 holder 表单 map
207
+ */
208
+ getHolderFormMap(): import("../../modules/Holder").HolderFormMap;
209
+ /**
210
+ * 添加表单记录
211
+ */
212
+ appendFormRecord(params: IAppendFormRecordParams): import("../../modules/Holder").IFormRecord;
196
213
  checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
197
214
  setOtherParams(params: Record<string, any>, { cover }?: {
198
215
  cover?: boolean;
@@ -54,6 +54,8 @@ var import_utils3 = require("../../modules/Order/utils");
54
54
  var import_Order = require("../../modules/Order");
55
55
  var import_types4 = require("../RegisterAndLogin/types");
56
56
  var import_decimal = __toESM(require("decimal.js"));
57
+ var import_Holder = require("../../modules/Holder");
58
+ var import_utils4 = require("../../modules/Holder/utils");
57
59
  __reExport(VenueBooking_exports, require("./types"), module.exports);
58
60
  var OPEN_DATA_SECTION_CODES = [
59
61
  "basic",
@@ -253,6 +255,46 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
253
255
  }
254
256
  return null;
255
257
  }
258
+ resolveHolderCustomerId() {
259
+ var _a, _b;
260
+ const customer = JSON.parse(((_b = (_a = this.window) == null ? void 0 : _a.getLocalStorage) == null ? void 0 : _b.call(_a, "customer")) || "{}");
261
+ if (customer == null ? void 0 : customer.id)
262
+ return Number(customer.id);
263
+ return void 0;
264
+ }
265
+ async ensureProductHolderForm(product) {
266
+ if (!product)
267
+ return;
268
+ await this.preloadHolderForms([product]);
269
+ }
270
+ /**
271
+ * 按商品 holder_config 预加载表单数据到 holderMap。
272
+ * appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
273
+ */
274
+ async preloadHolderForms(products) {
275
+ if (!this.store.holder || !products.length)
276
+ return;
277
+ const seenFormIds = /* @__PURE__ */ new Set();
278
+ for (const product of products) {
279
+ const holderConfig = (0, import_utils4.getProductHolderConfig)(product);
280
+ if (!holderConfig)
281
+ continue;
282
+ const formId = (0, import_utils4.getFormIdFromHolderConfig)(holderConfig);
283
+ if (seenFormIds.has(formId))
284
+ continue;
285
+ seenFormIds.add(formId);
286
+ try {
287
+ await this.store.holder.ensureFormByProduct({
288
+ product,
289
+ customer_id: this.resolveHolderCustomerId(),
290
+ shop_id: product.shop_id,
291
+ useCache: true
292
+ });
293
+ } catch (error) {
294
+ console.error("[VenueBooking] 预加载 holder 表单失败", { formId, error });
295
+ }
296
+ }
297
+ }
256
298
  clearLoginEffectListeners() {
257
299
  for (const dispose of this.loginEffectDisposers) {
258
300
  dispose();
@@ -326,7 +368,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
326
368
  }
327
369
  }
328
370
  async initialize(core, options = {}) {
329
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
371
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
330
372
  this.logMethodStart("initialize");
331
373
  this.core = core;
332
374
  this.initializeOptions = options || {};
@@ -451,20 +493,42 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
451
493
  cacheId: (_g = this.otherParams) == null ? void 0 : _g.cacheId
452
494
  }
453
495
  });
496
+ let holderCacheState;
497
+ if ((_h = this.otherParams) == null ? void 0 : _h.cacheId) {
498
+ const sessionData = this.window.sessionStorage.getItem(this.name);
499
+ if (sessionData) {
500
+ try {
501
+ const data = JSON.parse(sessionData);
502
+ holderCacheState = (_i = data[this.otherParams.cacheId]) == null ? void 0 : _i[`${this.name}_holder`];
503
+ } catch {
504
+ }
505
+ }
506
+ }
507
+ const holderModule = new import_Holder.HolderModule(`${this.name}_holder`);
508
+ this.store.holder = holderModule;
509
+ this.core.registerModule(holderModule, {
510
+ initialState: holderCacheState,
511
+ otherParams: {
512
+ ...this.otherParams,
513
+ fatherModule: this.name,
514
+ openCache: !!((_j = this.otherParams) == null ? void 0 : _j.cacheId),
515
+ cacheId: (_k = this.otherParams) == null ? void 0 : _k.cacheId
516
+ }
517
+ });
454
518
  if (this.store.scanOrderLogger) {
455
519
  this.store.scanOrderLogger.setContext(this.getLoggerContext());
456
520
  }
457
521
  this.registerCustomerLoginListeners();
458
522
  console.log("[VenueBooking] 初始化开始");
459
523
  try {
460
- await ((_h = this.store.order) == null ? void 0 : _h.recalculateSummary({ createIfMissing: false }));
461
- (_i = this.store.order) == null ? void 0 : _i.persistTempOrder();
524
+ await ((_l = this.store.order) == null ? void 0 : _l.recalculateSummary({ createIfMissing: false }));
525
+ (_m = this.store.order) == null ? void 0 : _m.persistTempOrder();
462
526
  await this.loadRuntimeConfigs();
463
527
  if (this.store.schedule) {
464
528
  await this.store.schedule.loadAllSchedule();
465
529
  this.injectScheduleResolverToQuotation();
466
- (_k = this.store.quotation) == null ? void 0 : _k.loadQuotations({
467
- channel: (_j = this.otherParams) == null ? void 0 : _j.channel
530
+ (_o = this.store.quotation) == null ? void 0 : _o.loadQuotations({
531
+ channel: (_n = this.otherParams) == null ? void 0 : _n.channel
468
532
  });
469
533
  }
470
534
  await this.refreshItemRuleQuantityLimits();
@@ -580,6 +644,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
580
644
  }
581
645
  this.store.addonProducts.addProduct(addonList);
582
646
  this.resourceProductMap = (0, import_resource.buildResourceProductMap)(venueList);
647
+ await this.preloadHolderForms(venueList);
583
648
  this.productsLoaded = true;
584
649
  this.logMethodSuccess("loadAllProducts", {
585
650
  total: list.length,
@@ -1009,6 +1074,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1009
1074
  const childRawResources = this.getCombinedChildRawResources(rawResource);
1010
1075
  const venueProduct = this.getVenueProducts().find((p) => p.id === mapping.productId);
1011
1076
  tempOrder.bookings = tempOrder.bookings || [];
1077
+ await this.ensureProductHolderForm(venueProduct);
1012
1078
  for (let i = 0; i < merged.length; i++) {
1013
1079
  const group = merged[i];
1014
1080
  const identityKey = (0, import_slotMerge.buildVenueIdentityKey)(resourceId, i);
@@ -1080,7 +1146,9 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1080
1146
  product_option_item: [],
1081
1147
  discount_list: [],
1082
1148
  custom_deposit_data: customDepositData,
1083
- metadata: {}
1149
+ metadata: {},
1150
+ holder_config: venueProduct == null ? void 0 : venueProduct.holder_config,
1151
+ bookingUuid
1084
1152
  },
1085
1153
  sub_type: "minutes",
1086
1154
  duration,
@@ -1896,6 +1964,46 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1896
1964
  this.writeUIStateBucket(bucket);
1897
1965
  }
1898
1966
  }
1967
+ setBookingHolder(bookingUid, holder) {
1968
+ var _a, _b, _c, _d;
1969
+ if (!this.store.order)
1970
+ return;
1971
+ const tempOrder = this.store.order.ensureTempOrder();
1972
+ const booking = (_a = tempOrder.bookings) == null ? void 0 : _a.find(
1973
+ (b) => {
1974
+ var _a2;
1975
+ return ((_a2 = b.metadata) == null ? void 0 : _a2.unique_identification_number) === bookingUid;
1976
+ }
1977
+ );
1978
+ if (booking) {
1979
+ booking.holder = holder;
1980
+ }
1981
+ for (const product of tempOrder.products) {
1982
+ const productBookingUid = ((_b = product.metadata) == null ? void 0 : _b.booking_uid) ?? ((_d = (_c = product._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.bookingUuid);
1983
+ if (String(productBookingUid) !== String(bookingUid))
1984
+ continue;
1985
+ const origin = product._origin && typeof product._origin === "object" ? product._origin : {};
1986
+ origin.holder = holder;
1987
+ product._origin = origin;
1988
+ }
1989
+ this.store.order.notifyTempOrderChanged();
1990
+ }
1991
+ /**
1992
+ * 获取 holder 表单 map
1993
+ */
1994
+ getHolderFormMap() {
1995
+ if (!this.store.holder)
1996
+ throw new Error("[VenueBooking] holder 模块未初始化");
1997
+ return this.store.holder.getHolderFormMap();
1998
+ }
1999
+ /**
2000
+ * 添加表单记录
2001
+ */
2002
+ appendFormRecord(params) {
2003
+ if (!this.store.holder)
2004
+ throw new Error("[VenueBooking] holder 模块未初始化");
2005
+ return this.store.holder.appendFormRecord(params);
2006
+ }
1899
2007
  // ─── OpenData 可用性 ───
1900
2008
  async checkOpenDataAvailability() {
1901
2009
  if (!this.store.openData)
@@ -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",
@@ -145,6 +146,7 @@ export interface VenueBookingState {
145
146
  passed: boolean | null;
146
147
  failures: QuantityCheckResult[];
147
148
  };
149
+ holder?: HolderModule;
148
150
  }
149
151
  export interface VenueBookingLoggerRuntimeConfig {
150
152
  provider?: ScanOrderLoggerProviderType;
@@ -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[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.547",
4
+ "version": "0.0.551",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
19
19
  "changeset": "changeset",
20
20
  "version": "changeset version",
21
- "release": "changeset publish --registry=https://registry.npmjs.com/ && npm run sync && git push",
21
+ "release": "changeset publish && npm run sync && git push",
22
22
  "example": "npx parcel-bundler examples/index.html",
23
23
  "docs": "typedoc --out docs src/index.ts",
24
24
  "sync": "node sync.js",