@pisell/pisellos 2.3.76 → 2.3.77

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.
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
348
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -334,7 +334,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
334
334
  * 获取当前的客户搜索条件
335
335
  * @returns 当前搜索条件
336
336
  */
337
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
337
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
338
338
  /**
339
339
  * 获取客户列表状态(包含滚动加载相关状态)
340
340
  * @returns 客户状态
@@ -453,19 +453,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
453
453
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
454
454
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
455
455
  */
456
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
457
- action: "reloadCatalog";
458
- } | {
459
- action: "add";
460
- cacheItem: any;
461
- } | {
462
- action: "requiresDetail";
463
- payload: AddProductRequiresDetailPayload;
464
- } | {
465
- action: "requiresBookingEdit";
466
- cacheItem: any;
467
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
468
- };
456
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
469
457
  /** 规格弹窗 callback 后的第二段决策。 */
470
458
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
471
459
  /**
@@ -987,7 +987,9 @@ function buildBookingFromAvailabilitySelection(params) {
987
987
  product = params.product,
988
988
  _params$resources = params.resources,
989
989
  resources = _params$resources === void 0 ? [] : _params$resources,
990
- bookingUid = params.bookingUid;
990
+ bookingUid = params.bookingUid,
991
+ holder = params.holder,
992
+ holderIds = params.holderIds;
991
993
  var bookingStartAt = candidate.bookingStartAt || candidate.startAt;
992
994
  var bookingEndAt = candidate.bookingEndAt || candidate.endAt;
993
995
  var startScalar = localDateTimeToScalar(parseLocalDateTime(bookingStartAt));
@@ -1005,14 +1007,19 @@ function buildBookingFromAvailabilitySelection(params) {
1005
1007
  scheduleRefs: candidate.scheduleRefs
1006
1008
  });
1007
1009
  }
1008
- return {
1010
+ var normalizedHolder = holder && _typeof(holder) === 'object' ? cloneDeep(holder) : undefined;
1011
+ var normalizedHolderIds = Array.isArray(holderIds) ? cloneDeep(holderIds) : holderIds;
1012
+ return _objectSpread(_objectSpread({
1009
1013
  start_date: bookingStartAt.slice(0, 10),
1010
1014
  start_time: bookingStartAt.slice(11, 16),
1011
1015
  end_date: bookingEndAt.slice(0, 10),
1012
1016
  end_time: bookingEndAt.slice(11, 16),
1013
1017
  duration: Math.max(1, Math.trunc((endScalar - startScalar) / (60 * 1000))),
1014
1018
  like_status: 'common',
1015
- schedule_id: scheduleId !== null && scheduleId !== void 0 ? scheduleId : 0,
1019
+ schedule_id: scheduleId !== null && scheduleId !== void 0 ? scheduleId : 0
1020
+ }, normalizedHolder ? {
1021
+ holder: normalizedHolder
1022
+ } : {}), {}, {
1016
1023
  resources: assignments.map(function (assignment) {
1017
1024
  // requirementSelections 的提交协议只携带资源 ID;购物车展示则需要名称。
1018
1025
  // commit 此时仍持有本次不可变 projection,因此直接按 ID 取回名称并
@@ -1035,7 +1042,7 @@ function buildBookingFromAvailabilitySelection(params) {
1035
1042
  }
1036
1043
  } : {});
1037
1044
  }),
1038
- metadata: _objectSpread(_objectSpread(_objectSpread({}, bookingUid ? {
1045
+ metadata: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bookingUid ? {
1039
1046
  unique_identification_number: bookingUid
1040
1047
  } : {}), {}, {
1041
1048
  unified_booking_sales: true,
@@ -1048,8 +1055,12 @@ function buildBookingFromAvailabilitySelection(params) {
1048
1055
  time_slot_id: timeSlotId
1049
1056
  }), {}, {
1050
1057
  product_kind: product.kind
1051
- })
1052
- };
1058
+ }, normalizedHolderIds === undefined ? {} : {
1059
+ holder_id: normalizedHolderIds
1060
+ }), normalizedHolder ? {
1061
+ holder: cloneDeep(normalizedHolder)
1062
+ } : {})
1063
+ });
1053
1064
  }
1054
1065
  export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1055
1066
  _inherits(UnifiedBookingSalesImpl, _BookingTicket);
@@ -4137,7 +4148,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4137
4148
  key: "commitAvailabilitySelection",
4138
4149
  value: (function () {
4139
4150
  var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(contextId, params) {
4140
- var normalizedContextId, _params$bookingCount, _ref45, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, refreshedRanges, refreshedCandidateBase, validation, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, product, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref46, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4151
+ var normalizedContextId, _params$bookingCount, _ref45, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _ref46, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref47, _ref48, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, refreshedRanges, refreshedCandidateBase, validation, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, product, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref49, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
4141
4152
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4142
4153
  while (1) switch (_context36.prev = _context36.next) {
4143
4154
  case 0:
@@ -4464,7 +4475,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4464
4475
  candidate: refreshedCandidate,
4465
4476
  product: product,
4466
4477
  resources: refreshedProjection.resources,
4467
- bookingUid: existingBookingUid || undefined
4478
+ bookingUid: existingBookingUid || undefined,
4479
+ holder: (_ref46 = (_params$orderProduct$3 = (_params$orderProduct6 = params.orderProduct) === null || _params$orderProduct6 === void 0 || (_params$orderProduct6 = _params$orderProduct6._extend) === null || _params$orderProduct6 === void 0 ? void 0 : _params$orderProduct6.holder) !== null && _params$orderProduct$3 !== void 0 ? _params$orderProduct$3 : existingBooking === null || existingBooking === void 0 ? void 0 : existingBooking.holder) !== null && _ref46 !== void 0 ? _ref46 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta = existingBooking.metadata) === null || _existingBooking$meta === void 0 ? void 0 : _existingBooking$meta.holder,
4480
+ holderIds: (_ref47 = (_ref48 = (_params$orderProduct$4 = (_params$orderProduct7 = params.orderProduct) === null || _params$orderProduct7 === void 0 || (_params$orderProduct7 = _params$orderProduct7._extend) === null || _params$orderProduct7 === void 0 ? void 0 : _params$orderProduct7.holder_id) !== null && _params$orderProduct$4 !== void 0 ? _params$orderProduct$4 : (_params$orderProduct8 = params.orderProduct) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8._extend) === null || _params$orderProduct8 === void 0 || (_params$orderProduct8 = _params$orderProduct8.holder) === null || _params$orderProduct8 === void 0 ? void 0 : _params$orderProduct8.form_record) !== null && _ref48 !== void 0 ? _ref48 : existingBooking === null || existingBooking === void 0 || (_existingBooking$meta2 = existingBooking.metadata) === null || _existingBooking$meta2 === void 0 ? void 0 : _existingBooking$meta2.holder_id) !== null && _ref47 !== void 0 ? _ref47 : existingBooking === null || existingBooking === void 0 || (_existingBooking$hold = existingBooking.holder) === null || _existingBooking$hold === void 0 ? void 0 : _existingBooking$hold.form_record
4468
4481
  });
4469
4482
  transformed = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, params.orderProduct), {}, {
4470
4483
  num: bookingCount,
@@ -4503,7 +4516,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4503
4516
  _context36.next = 107;
4504
4517
  return this.updateOrderProduct({
4505
4518
  product_id: (_transformed$product_3 = transformed.product_id) !== null && _transformed$product_3 !== void 0 ? _transformed$product_3 : editingLine.product_id,
4506
- product_variant_id: (_ref46 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref46 !== void 0 ? _ref46 : 0,
4519
+ product_variant_id: (_ref49 = (_transformed$product_4 = transformed.product_variant_id) !== null && _transformed$product_4 !== void 0 ? _transformed$product_4 : editingLine.product_variant_id) !== null && _ref49 !== void 0 ? _ref49 : 0,
4507
4520
  unique_identification_number: params.productLineUid,
4508
4521
  updates: transformed,
4509
4522
  booking: booking
@@ -4542,8 +4555,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
4542
4555
  }).filter(Boolean);
4543
4556
  if (bookingUids.length === 0) {
4544
4557
  bookingUids = addedLines.map(function (line) {
4545
- var _ref47, _line$booking_uid, _line$metadata2;
4546
- return String((_ref47 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref47 !== void 0 ? _ref47 : '');
4558
+ var _ref50, _line$booking_uid, _line$metadata2;
4559
+ return String((_ref50 = (_line$booking_uid = line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) !== null && _ref50 !== void 0 ? _ref50 : '');
4547
4560
  }).filter(Boolean);
4548
4561
  }
4549
4562
  productLineUid = productLineUids[productLineUids.length - 1] || '';
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
348
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -334,7 +334,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
334
334
  * 获取当前的客户搜索条件
335
335
  * @returns 当前搜索条件
336
336
  */
337
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
337
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
338
338
  /**
339
339
  * 获取客户列表状态(包含滚动加载相关状态)
340
340
  * @returns 客户状态
@@ -453,19 +453,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
453
453
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
454
454
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
455
455
  */
456
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
457
- action: "reloadCatalog";
458
- } | {
459
- action: "add";
460
- cacheItem: any;
461
- } | {
462
- action: "requiresDetail";
463
- payload: AddProductRequiresDetailPayload;
464
- } | {
465
- action: "requiresBookingEdit";
466
- cacheItem: any;
467
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
468
- };
456
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
469
457
  /** 规格弹窗 callback 后的第二段决策。 */
470
458
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
471
459
  /**
@@ -906,7 +906,9 @@ function buildBookingFromAvailabilitySelection(params) {
906
906
  candidate,
907
907
  product,
908
908
  resources = [],
909
- bookingUid
909
+ bookingUid,
910
+ holder,
911
+ holderIds
910
912
  } = params;
911
913
  const bookingStartAt = candidate.bookingStartAt || candidate.startAt;
912
914
  const bookingEndAt = candidate.bookingEndAt || candidate.endAt;
@@ -921,6 +923,8 @@ function buildBookingFromAvailabilitySelection(params) {
921
923
  scheduleRefs: candidate.scheduleRefs
922
924
  });
923
925
  }
926
+ const normalizedHolder = holder && typeof holder === 'object' ? (0, _lodashEs.cloneDeep)(holder) : undefined;
927
+ const normalizedHolderIds = Array.isArray(holderIds) ? (0, _lodashEs.cloneDeep)(holderIds) : holderIds;
924
928
  return {
925
929
  start_date: bookingStartAt.slice(0, 10),
926
930
  start_time: bookingStartAt.slice(11, 16),
@@ -929,6 +933,9 @@ function buildBookingFromAvailabilitySelection(params) {
929
933
  duration: Math.max(1, Math.trunc((endScalar - startScalar) / (60 * 1000))),
930
934
  like_status: 'common',
931
935
  schedule_id: scheduleId ?? 0,
936
+ ...(normalizedHolder ? {
937
+ holder: normalizedHolder
938
+ } : {}),
932
939
  resources: assignments.map(assignment => {
933
940
  // requirementSelections 的提交协议只携带资源 ID;购物车展示则需要名称。
934
941
  // commit 此时仍持有本次不可变 projection,因此直接按 ID 取回名称并
@@ -963,7 +970,13 @@ function buildBookingFromAvailabilitySelection(params) {
963
970
  ...(timeSlotId == null ? {} : {
964
971
  time_slot_id: timeSlotId
965
972
  }),
966
- product_kind: product.kind
973
+ product_kind: product.kind,
974
+ ...(normalizedHolderIds === undefined ? {} : {
975
+ holder_id: normalizedHolderIds
976
+ }),
977
+ ...(normalizedHolder ? {
978
+ holder: (0, _lodashEs.cloneDeep)(normalizedHolder)
979
+ } : {})
967
980
  }
968
981
  };
969
982
  }
@@ -2939,7 +2952,9 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
2939
2952
  candidate: refreshedCandidate,
2940
2953
  product,
2941
2954
  resources: refreshedProjection.resources,
2942
- bookingUid: existingBookingUid || undefined
2955
+ bookingUid: existingBookingUid || undefined,
2956
+ holder: params.orderProduct?._extend?.holder ?? existingBooking?.holder ?? existingBooking?.metadata?.holder,
2957
+ holderIds: params.orderProduct?._extend?.holder_id ?? params.orderProduct?._extend?.holder?.form_record ?? existingBooking?.metadata?.holder_id ?? existingBooking?.holder?.form_record
2943
2958
  });
2944
2959
  const transformed = this.buildUnifiedOrderProduct({
2945
2960
  ...params.orderProduct,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.76",
4
+ "version": "2.3.77",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",