@pisell/private-materials 6.12.356 → 6.12.357

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 (62) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +12 -12
  6. package/build/lowcode/view.js +12 -12
  7. package/es/components/appointmentBooking/components/Cart/Item/index.js +64 -12
  8. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +7 -2
  9. package/es/components/appointmentBooking/components/Content/index.js +6 -4
  10. package/es/components/appointmentBooking/components/Voucher/index.js +11 -1
  11. package/es/components/appointmentBooking/hooks.js +33 -18
  12. package/es/components/appointmentBooking/utils.js +16 -5
  13. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  14. package/es/components/bigSale/components/ProductList/index.js +1 -0
  15. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  16. package/es/components/bigSale/dialog.js +1 -0
  17. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  18. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  19. package/es/components/bigSale/index.js +1 -0
  20. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  21. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  22. package/es/components/venueBooking/components/Cart/index.js +112 -18
  23. package/es/components/venueBooking/context.js +14 -3
  24. package/es/components/venueBooking/locales.js +10 -5
  25. package/es/index.js +2 -0
  26. package/es/plus/multiCurrencySettlement/index.js +1 -1
  27. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  28. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  29. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  30. package/es/plus/pisellReservation/index.js +17 -0
  31. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  32. package/es/plus/saleDetail/Base.js +1 -0
  33. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  34. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  35. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  36. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  37. package/es/plus/saleDetail/index.js +1 -0
  38. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  39. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  40. package/es/plus/salesSdk/index.js +54 -0
  41. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  42. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  43. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  44. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  45. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  46. package/es/pro/Login2.0/index.d.ts +2 -2
  47. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  48. package/es/utils/buildCartHolderParams.js +166 -0
  49. package/es/utils/holderConfig.js +6 -0
  50. package/lib/components/appointmentBooking/components/Cart/Item/index.js +63 -11
  51. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +7 -2
  52. package/lib/components/appointmentBooking/components/Content/index.js +6 -4
  53. package/lib/components/appointmentBooking/components/Voucher/index.js +11 -1
  54. package/lib/components/appointmentBooking/hooks.js +33 -18
  55. package/lib/components/appointmentBooking/utils.js +16 -5
  56. package/lib/components/venueBooking/components/Cart/index.js +111 -17
  57. package/lib/components/venueBooking/context.js +14 -3
  58. package/lib/components/venueBooking/locales.js +10 -5
  59. package/lib/utils/buildCartHolderParams.js +172 -0
  60. package/lib/utils/holderConfig.js +7 -0
  61. package/package.json +2 -2
  62. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -0,0 +1,166 @@
1
+ import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
+ import { isHolderConfigEnabled, isHolderConfigRequired } from "./holderConfig.js";
3
+ import { getCustomer } from "../components/appointmentBooking/utils.js";
4
+ //#region src/utils/buildCartHolderParams.ts
5
+ const toHolderRecordId = (value) => {
6
+ if (value == null || value === "") return void 0;
7
+ const id = Number(value);
8
+ return Number.isNaN(id) ? void 0 : id;
9
+ };
10
+ /**
11
+ * 从 _origin.holder 解析 form_record_id。
12
+ * form_record 可能是 number、number[];不能假定一定是数组下标 [0]。
13
+ */
14
+ const resolveOriginHolderId = (holder) => {
15
+ const formRecord = holder === null || holder === void 0 ? void 0 : holder.form_record;
16
+ if (Array.isArray(formRecord)) for (const value of formRecord) {
17
+ const id = toHolderRecordId(value);
18
+ if (id != null) return id;
19
+ }
20
+ else {
21
+ const id = toHolderRecordId(formRecord);
22
+ if (id != null) return id;
23
+ }
24
+ return toHolderRecordId(holder === null || holder === void 0 ? void 0 : holder.form_record_id);
25
+ };
26
+ /**
27
+ * 从购物车行解析当前选中的 holder form_record_id。
28
+ *
29
+ * venueBooking:以 _origin.holder 为准(SDK 会原地更新 form_record);
30
+ * 顶层 item.holder_id 可能是上一轮 UI 注入或 SDK 回灌的滞后值,不能优先于 _origin.holder。
31
+ */
32
+ const resolveCartItemHolderId = (item) => {
33
+ var _item$_origin;
34
+ const originHolder = item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.holder;
35
+ if (originHolder && typeof originHolder === "object") return resolveOriginHolderId(originHolder);
36
+ return toHolderRecordId(item === null || item === void 0 ? void 0 : item.holder_id);
37
+ };
38
+ const getCurrentCustomerId = (utils) => {
39
+ var _getCustomer;
40
+ return (_getCustomer = getCustomer(utils)) === null || _getCustomer === void 0 ? void 0 : _getCustomer.id;
41
+ };
42
+ const createCartHolderOption = (holder, customerId) => {
43
+ const _id = (holder === null || holder === void 0 ? void 0 : holder.formRecordId) || (holder === null || holder === void 0 ? void 0 : holder.form_record_id);
44
+ return {
45
+ key: _id,
46
+ id: _id,
47
+ label: holder === null || holder === void 0 ? void 0 : holder.main_field,
48
+ name: holder === null || holder === void 0 ? void 0 : holder.main_field,
49
+ username: holder === null || holder === void 0 ? void 0 : holder.main_field,
50
+ type: "holder",
51
+ _origin: _objectSpread2(_objectSpread2({}, holder), {}, { customer_id: customerId })
52
+ };
53
+ };
54
+ /**
55
+ * 构建 ProductCard Holder 组件使用的单条 holder 数据。
56
+ * 输出字段需要与购物车 ProductCard 消费格式保持一致。
57
+ */
58
+ const buildCartHolderOption = (holder, utils) => {
59
+ if (!holder) return {};
60
+ return createCartHolderOption(holder, getCurrentCustomerId(utils));
61
+ };
62
+ const buildCartHolderOptions = (records, utils) => {
63
+ const customerId = getCurrentCustomerId(utils);
64
+ return records.map((record) => createCartHolderOption(record, customerId));
65
+ };
66
+ const getCartHolderTitle = (records, holderId) => {
67
+ var _records$find;
68
+ if (!holderId) return "";
69
+ return (_records$find = records.find((record) => Number(record === null || record === void 0 ? void 0 : record.form_record_id) === holderId)) === null || _records$find === void 0 ? void 0 : _records$find.main_field;
70
+ };
71
+ /**
72
+ * 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
73
+ * 供 appointmentBooking、venueBooking 等购物车场景复用。
74
+ */
75
+ const buildCartHolderParams = ({ item, holderConfig = {}, formData, translation, enabled = true, utils }) => {
76
+ var _formData$form;
77
+ if (!enabled || !isHolderConfigEnabled(holderConfig)) return {
78
+ isShowChangeHolder: false,
79
+ isErrorHolder: false,
80
+ holders: []
81
+ };
82
+ const records = (formData === null || formData === void 0 ? void 0 : formData.records) || [];
83
+ const holderId = resolveCartItemHolderId(item);
84
+ return {
85
+ holder_id: holderId,
86
+ isErrorHolder: !!(!holderId && isHolderConfigRequired(holderConfig)),
87
+ isShowChangeHolder: true,
88
+ addHolderButtonText: translation(formData === null || formData === void 0 || (_formData$form = formData.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.form) === null || _formData$form === void 0 || (_formData$form = _formData$form.setting) === null || _formData$form === void 0 ? void 0 : _formData$form.title),
89
+ holder_title: getCartHolderTitle(records, holderId),
90
+ holders: buildCartHolderOptions(records, utils)
91
+ };
92
+ };
93
+ /**
94
+ * 从 appointmentBooking 购物车行读取 holder_config
95
+ */
96
+ const getAppointmentCartHolderConfig = (item) => {
97
+ var _item$_productInit;
98
+ return (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
99
+ };
100
+ /**
101
+ * 从 venueBooking 购物车行读取 holder_config
102
+ */
103
+ const getVenueCartHolderConfig = (item) => {
104
+ var _item$_origin2;
105
+ return (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 || (_item$_origin2 = _item$_origin2.product) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.holder_config) || {};
106
+ };
107
+ /**
108
+ * 校验购物车中 holder_config.required 的行是否已选择 holder。
109
+ */
110
+ const validateRequiredCartHolders = ({ items = [], getHolderConfig = getVenueCartHolderConfig }) => {
111
+ const invalidItems = items.filter((item) => {
112
+ if (!isHolderConfigRequired(getHolderConfig(item))) return false;
113
+ return !resolveCartItemHolderId(item);
114
+ });
115
+ return {
116
+ hasError: invalidItems.length > 0,
117
+ invalidItems
118
+ };
119
+ };
120
+ /**
121
+ * 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
122
+ */
123
+ const getSkuRelationFormId = (holderMap, formId) => {
124
+ var _formData$form2, _formData$form3, _detail$setting;
125
+ if (!formId) return 0;
126
+ const formData = holderMap === null || holderMap === void 0 ? void 0 : holderMap[formId];
127
+ if ((formData === null || formData === void 0 || (_formData$form2 = formData.form) === null || _formData$form2 === void 0 || (_formData$form2 = _formData$form2.form) === null || _formData$form2 === void 0 ? void 0 : _formData$form2.form_type) !== "minors") return 0;
128
+ const detail = formData === null || formData === void 0 || (_formData$form3 = formData.form) === null || _formData$form3 === void 0 || (_formData$form3 = _formData$form3.field) === null || _formData$form3 === void 0 ? void 0 : _formData$form3.find((item) => (item === null || item === void 0 ? void 0 : item.filed_type) === "form_to_form" && (item === null || item === void 0 ? void 0 : item.status) === "hide");
129
+ return (detail === null || detail === void 0 || (_detail$setting = detail.setting) === null || _detail$setting === void 0 ? void 0 : _detail$setting.linkedTable) || 0;
130
+ };
131
+ /**
132
+ * 从 form_to_form_value 中取最新创建的 form_record_id。
133
+ */
134
+ const getSkuRelationFormRecordId = (res) => {
135
+ var _res$values;
136
+ const formToFormValue = res === null || res === void 0 || (_res$values = res.values) === null || _res$values === void 0 || (_res$values = _res$values.form_to_form_value) === null || _res$values === void 0 ? void 0 : _res$values[0];
137
+ const formDataValue = (formToFormValue === null || formToFormValue === void 0 ? void 0 : formToFormValue.form_data_value) || [];
138
+ return formDataValue[formDataValue.length - 1];
139
+ };
140
+ /**
141
+ * 处理购物车添加 holder 表单提交成功后的公共逻辑。
142
+ * - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
143
+ * - 普通表单:appendFormRecord 并直接使用 form_record_id
144
+ */
145
+ const handleCartHolderFormSuccess = ({ res, formId, skuRelationFormId, utils, module }) => {
146
+ var _res$values2, _res$values3, _res$values4;
147
+ let formRecordId = res === null || res === void 0 || (_res$values2 = res.values) === null || _res$values2 === void 0 ? void 0 : _res$values2.form_record_id;
148
+ let resolvedFormId = res === null || res === void 0 || (_res$values3 = res.values) === null || _res$values3 === void 0 ? void 0 : _res$values3.form_id;
149
+ if (formId && skuRelationFormId) {
150
+ var _module$refreshAllHol;
151
+ const customer = getCustomer(utils);
152
+ module === null || module === void 0 || (_module$refreshAllHol = module.refreshAllHolderFormRecords) === null || _module$refreshAllHol === void 0 || _module$refreshAllHol.call(module, { customer_id: customer === null || customer === void 0 ? void 0 : customer.id });
153
+ formRecordId = getSkuRelationFormRecordId(res);
154
+ resolvedFormId = formId;
155
+ } else if (formId) {
156
+ var _module$appendFormRec;
157
+ module === null || module === void 0 || (_module$appendFormRec = module.appendFormRecord) === null || _module$appendFormRec === void 0 || _module$appendFormRec.call(module, { record: res === null || res === void 0 ? void 0 : res.values });
158
+ }
159
+ return {
160
+ formRecordId,
161
+ mainField: res === null || res === void 0 || (_res$values4 = res.values) === null || _res$values4 === void 0 ? void 0 : _res$values4.main_field,
162
+ formId: resolvedFormId
163
+ };
164
+ };
165
+ //#endregion
166
+ export { buildCartHolderOption, buildCartHolderParams, getAppointmentCartHolderConfig, getSkuRelationFormId, getVenueCartHolderConfig, handleCartHolderFormSuccess, validateRequiredCartHolders };
@@ -0,0 +1,6 @@
1
+ //#region src/utils/holderConfig.ts
2
+ /** Holder selection requires an enabled configuration and a valid form ID. */
3
+ const isHolderConfigEnabled = (config) => (config === null || config === void 0 ? void 0 : config.status) === "enable" && Number.isFinite(Number(config === null || config === void 0 ? void 0 : config.resource_id)) && Number(config === null || config === void 0 ? void 0 : config.resource_id) > 0;
4
+ const isHolderConfigRequired = (config) => isHolderConfigEnabled(config) && Number(config === null || config === void 0 ? void 0 : config.required) === 1;
5
+ //#endregion
6
+ export { isHolderConfigEnabled, isHolderConfigRequired };
@@ -2,6 +2,7 @@ const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
2
2
  const require_objectSpread2 = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
3
  const require_asyncToGenerator = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
4
4
  const require_index = require("../../../../shoppingCart/index.js");
5
+ const require_holderConfig = require("../../../../../utils/holderConfig.js");
5
6
  const require_utils = require("../../../utils.js");
6
7
  const require_index$1 = require("../../../../subTotal/index.js");
7
8
  const require_hooks = require("../../../hooks.js");
@@ -10,6 +11,7 @@ const require_index$2 = require("../../Deposit/index.js");
10
11
  const require_utils$1 = require("../utils.js");
11
12
  const require_index$3 = require("../ContinueButton/index.js");
12
13
  const require_index$4 = require("../../Voucher/index.js");
14
+ const require_buildCartHolderParams = require("../../../../../utils/buildCartHolderParams.js");
13
15
  let react = require("react");
14
16
  react = require_runtime.__toESM(react);
15
17
  let _pisell_utils = require("@pisell/utils");
@@ -23,9 +25,29 @@ const CartItem = ({ onNext, renderContactInfo }) => {
23
25
  const { getResourceList } = require_hooks.useAppointmentBookingResource();
24
26
  const { isFormSubject, bookingSubject, isRetailTemplate } = require_hooks.useAppointmentBookingSetting();
25
27
  const { isLogin } = require_hooks.useAppointmentBookingLogin();
28
+ const isLoggedIn = isLogin();
26
29
  const utils = require_hooks.contextUtils();
27
- const { businessUtils, translation } = utils;
30
+ const { businessUtils, translation, pisellos } = utils;
28
31
  const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = summary;
32
+ const [holderMap, setHolderMap] = (0, react.useState)({});
33
+ (0, react.useEffect)(() => {
34
+ var _pisellos$effects;
35
+ const onHolderChanged = (res) => {
36
+ if ((res === null || res === void 0 ? void 0 : res.path) === "holderMap") {
37
+ var _appointmentBooking$g;
38
+ setHolderMap((appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$g = appointmentBooking.getHolderFormMap) === null || _appointmentBooking$g === void 0 ? void 0 : _appointmentBooking$g.call(appointmentBooking)) || {});
39
+ }
40
+ };
41
+ pisellos === null || pisellos === void 0 || (_pisellos$effects = pisellos.effects) === null || _pisellos$effects === void 0 || _pisellos$effects.on("appointmentBooking_holder:changed", onHolderChanged);
42
+ return () => {
43
+ var _pisellos$effects2;
44
+ pisellos === null || pisellos === void 0 || (_pisellos$effects2 = pisellos.effects) === null || _pisellos$effects2 === void 0 || _pisellos$effects2.off("appointmentBooking_holder:changed", onHolderChanged);
45
+ };
46
+ }, [appointmentBooking, pisellos]);
47
+ (0, react.useEffect)(() => {
48
+ var _appointmentBooking$g2;
49
+ setHolderMap((appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$g2 = appointmentBooking.getHolderFormMap) === null || _appointmentBooking$g2 === void 0 ? void 0 : _appointmentBooking$g2.call(appointmentBooking)) || {});
50
+ }, [appointmentBooking, isLoggedIn]);
29
51
  /**
30
52
  * @title: 当前客户
31
53
  * @description:
@@ -80,14 +102,32 @@ const CartItem = ({ onNext, renderContactInfo }) => {
80
102
  }
81
103
  if (type === "add_holder") {
82
104
  const relationShipFormId = bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.relationship_form_id;
105
+ const holderConfig = require_buildCartHolderParams.getAppointmentCartHolderConfig(e);
106
+ const formId = require_holderConfig.isHolderConfigEnabled(holderConfig) ? holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id : void 0;
107
+ const skuRelationFormId = require_buildCartHolderParams.getSkuRelationFormId(holderMap, formId);
83
108
  return require_utils.openForm({
84
- form_id: relationShipFormId || (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id),
109
+ form_id: skuRelationFormId || formId || relationShipFormId || (bookingSubject === null || bookingSubject === void 0 ? void 0 : bookingSubject.form_id),
85
110
  title: _pisell_utils.locales.getText("pisell2.event.create.form"),
86
111
  utils,
87
112
  callback: function() {
88
113
  var _ref = require_asyncToGenerator._asyncToGenerator(function* (res) {
89
114
  if ((res === null || res === void 0 ? void 0 : res.status) === "success") {
90
115
  let result = void 0;
116
+ if (formId) {
117
+ const { formRecordId, mainField } = require_buildCartHolderParams.handleCartHolderFormSuccess({
118
+ res,
119
+ formId,
120
+ skuRelationFormId,
121
+ utils,
122
+ module: appointmentBooking
123
+ });
124
+ result = require_buildCartHolderParams.buildCartHolderOption(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, res === null || res === void 0 ? void 0 : res.values), {}, { formRecordId }), utils);
125
+ appointmentBooking.updateCart({
126
+ _id: e === null || e === void 0 ? void 0 : e._id,
127
+ account: result
128
+ });
129
+ return;
130
+ }
91
131
  if (!relationShipFormId) result = yield addAccount(res === null || res === void 0 ? void 0 : res.values, "holder");
92
132
  else result = yield require_utils$1.handleAddHolder({
93
133
  res,
@@ -112,24 +152,36 @@ const CartItem = ({ onNext, renderContactInfo }) => {
112
152
  };
113
153
  const products = (0, react.useMemo)(() => {
114
154
  if (!(carts === null || carts === void 0 ? void 0 : carts.length)) return [];
115
- carts.forEach((item) => {
116
- item.isShowChangeHolder = !appointmentBooking.isTargetCartIdNormalProduct(item === null || item === void 0 ? void 0 : item._id);
155
+ const enrichedCarts = carts.map((item) => {
156
+ const isNormalProduct = appointmentBooking.isTargetCartIdNormalProduct(item === null || item === void 0 ? void 0 : item._id);
157
+ const holderConfig = require_buildCartHolderParams.getAppointmentCartHolderConfig(item);
158
+ const holderParams = require_buildCartHolderParams.buildCartHolderParams({
159
+ item,
160
+ holderConfig,
161
+ formData: require_holderConfig.isHolderConfigEnabled(holderConfig) ? holderMap === null || holderMap === void 0 ? void 0 : holderMap[holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id] : {},
162
+ translation,
163
+ enabled: isLoggedIn && isFormSubject && !isNormalProduct,
164
+ utils
165
+ });
166
+ return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), holderParams);
117
167
  });
118
- if ((currentSelectedResources === null || currentSelectedResources === void 0 ? void 0 : currentSelectedResources.length) > 0) return carts.map((item) => {
168
+ if ((currentSelectedResources === null || currentSelectedResources === void 0 ? void 0 : currentSelectedResources.length) > 0) return enrichedCarts.map((item) => {
119
169
  const currentResourceData = currentSelectedResources.find((resource) => (resource === null || resource === void 0 ? void 0 : resource._id) === (item === null || item === void 0 ? void 0 : item._id));
120
170
  const multiResources = require_utils.getMultiResources(item, currentResourceData === null || currentResourceData === void 0 ? void 0 : currentResourceData.currentSelectedResource, currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key);
121
171
  return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, {
122
172
  isMultipleResource: true,
123
- multiResources,
124
- isErrorHolder: isErrorHolder || false
173
+ multiResources
125
174
  });
126
175
  });
127
- else return carts;
176
+ else return enrichedCarts;
128
177
  }, [
129
178
  carts,
130
179
  currentSelectedResources,
131
180
  currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key,
132
- isErrorHolder
181
+ isErrorHolder,
182
+ holderMap,
183
+ isFormSubject,
184
+ isLoggedIn
133
185
  ]);
134
186
  /**
135
187
  * @description: 结算列表数据
@@ -189,8 +241,8 @@ const CartItem = ({ onNext, renderContactInfo }) => {
189
241
  isShowDelete: (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key) === "select-service",
190
242
  isShowAmountFooter: true,
191
243
  isShowPackageNote: false,
192
- isShowChangeHolder: isLastStep ? false : isFormSubject && isLogin,
193
- isShowHolder: isFormSubject,
244
+ isShowChangeHolder: isLastStep ? false : isFormSubject && isLoggedIn,
245
+ isShowHolder: isFormSubject && isLoggedIn,
194
246
  isShowAddHolderButton: true
195
247
  },
196
248
  collapseParams: {
@@ -3,6 +3,7 @@ const require_useEngineContext = require("../../../../hooks/useEngineContext.js"
3
3
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
4
4
  const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
5
5
  const require_ContactInfoContent = require("../../../../plus/contactInfoModal/ContactInfoContent.js");
6
+ const require_holderConfig = require("../../../../utils/holderConfig.js");
6
7
  const require_utils = require("../../utils.js");
7
8
  const require_useLoginUser = require("../../../../hooks/useLoginUser.js");
8
9
  const require_index = require("../../../productStockCheckModal/index.js");
@@ -25,7 +26,7 @@ const ConfirmInformation = (0, react.forwardRef)((props, ref) => {
25
26
  const utils = require_hooks.contextUtils();
26
27
  const { pubsub } = context.appHelper.utils;
27
28
  const { appointmentBooking, summary, isAgreeDepositPolicy, setLoading, carts, setTimes } = require_context.useAppointmentBookingContext();
28
- const { isRetailTemplate, bookingSetting } = require_hooks.useAppointmentBookingSetting();
29
+ const { isRetailTemplate, bookingSetting, isFormSubject } = require_hooks.useAppointmentBookingSetting();
29
30
  console.log(bookingSetting, "bookingSetting");
30
31
  const [form] = antd.Form.useForm();
31
32
  const userInfo = require_useLoginUser.default();
@@ -181,10 +182,14 @@ const ConfirmInformation = (0, react.forwardRef)((props, ref) => {
181
182
  const onCheckout = function() {
182
183
  var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (extraData) {
183
184
  try {
185
+ const _extraData = (carts === null || carts === void 0 ? void 0 : carts.some((item) => {
186
+ var _item$_productInit;
187
+ return require_holderConfig.isHolderConfigEnabled(item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config);
188
+ })) ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, extraData), {}, { is_add_holder_info: isFormSubject }) : extraData;
184
189
  const { deposit } = summary;
185
190
  const customer = require_utils.formatAppointmentCustomerInfo(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, userInfo), extraData === null || extraData === void 0 ? void 0 : extraData.contacts_info));
186
191
  logCheckout("调用 submitOrder", require_objectSpread2._objectSpread2({ products: require_utils.formatAppointmentCartSummary(carts) }, customer));
187
- const { data } = yield appointmentBooking.submitOrder(extraData);
192
+ const { data } = yield appointmentBooking.submitOrder(_extraData);
188
193
  const { is_deposit, deposit_amount, total_amount, order_id } = data || {};
189
194
  logCheckout("submitOrder 返回", require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ products: require_utils.formatAppointmentCartSummary(carts) }, customer), {}, {
190
195
  order_id: order_id || null,
@@ -29,6 +29,7 @@ const Layout = () => {
29
29
  const { currentStep, setResourceOtherParams, resourceOtherParams, setIsAgreeDepositPolicy, appointmentBooking, setLoading, policyParams, closePolicy, currentStepParams, setIsErrorHolder } = require_context.useAppointmentBookingContext();
30
30
  const { isDateSelectedFirst, isFormSubject, isRetailTemplate } = require_hooks.useAppointmentBookingSetting();
31
31
  const { isLogin } = require_hooks.useAppointmentBookingLogin();
32
+ const isLoggedIn = isLogin();
32
33
  const { getHolders } = require_hooks.useAppointmentBookingAccount();
33
34
  const { removeStep } = require_hooks.useAppointmentBookingStep();
34
35
  const { shopDiscount } = require_hooks.useShopDiscount();
@@ -49,7 +50,7 @@ const Layout = () => {
49
50
  const accountLists = yield appointmentBooking.getAccounts();
50
51
  const meAccount = accountLists === null || accountLists === void 0 ? void 0 : accountLists.find((d) => !(d === null || d === void 0 ? void 0 : d.isGuest));
51
52
  appointmentBooking.setLoginAccount(meAccount === null || meAccount === void 0 ? void 0 : meAccount.id, currentUser);
52
- } else if (!isRetailTemplate) getHolders();
53
+ } else if (!isRetailTemplate) yield getHolders();
53
54
  });
54
55
  return function handleLoginSuccess(_x) {
55
56
  return _ref.apply(this, arguments);
@@ -88,11 +89,12 @@ const Layout = () => {
88
89
  } catch (error) {}
89
90
  }, [isFormSubject, isRetailTemplate]);
90
91
  (0, react.useEffect)(() => {
91
- if (isFormSubject && isLogin && !isRetailTemplate) getHolders();
92
+ if (isFormSubject && isLoggedIn && !isRetailTemplate) getHolders();
92
93
  }, [
93
94
  isFormSubject,
94
- isLogin,
95
- isRetailTemplate
95
+ isLoggedIn,
96
+ isRetailTemplate,
97
+ appointmentBooking
96
98
  ]);
97
99
  (0, react.useEffect)(() => {
98
100
  var _currentStep$step;
@@ -3,6 +3,7 @@ const require_useEngineContext = require("../../../../hooks/useEngineContext.js"
3
3
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
4
4
  const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
5
5
  const require_utils = require("../../../booking/utils.js");
6
+ const require_utils$1 = require("../../utils.js");
6
7
  const require_hooks = require("../../hooks.js");
7
8
  const require_context = require("../../context.js");
8
9
  let react = require("react");
@@ -200,7 +201,16 @@ const VoucherCard = (props) => {
200
201
  className: "login-btn",
201
202
  onClick: () => {
202
203
  if (!action) return;
203
- openLoginModal({ callback: (status) => {} });
204
+ openLoginModal({
205
+ data: { type: "plugin" },
206
+ callback: (status) => {
207
+ if (status === "success") {
208
+ var _appointmentBooking$r;
209
+ const customer = require_utils$1.getCustomer(utils);
210
+ appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$r = appointmentBooking.refreshAllHolderFormRecords) === null || _appointmentBooking$r === void 0 || _appointmentBooking$r.call(appointmentBooking, { customer_id: customer === null || customer === void 0 ? void 0 : customer.id });
211
+ }
212
+ }
213
+ });
204
214
  }
205
215
  }, _pisell_utils.locales.getText("pisell2.text.goodpass.login")), /* @__PURE__ */ react.default.createElement("span", null, _pisell_utils.locales.getText("pisell2.text.goodpass.login-tip"))));
206
216
  };
@@ -185,15 +185,19 @@ const useAppointmentBookingStep = () => {
185
185
  const selectedResource = (currentSelectedResources === null || currentSelectedResources === void 0 || (_currentSelectedResou2 = currentSelectedResources[0]) === null || _currentSelectedResou2 === void 0 ? void 0 : _currentSelectedResou2.currentSelectedResource) || {};
186
186
  const renderItem = (selectedResource === null || selectedResource === void 0 ? void 0 : selectedResource.renderItem) || {};
187
187
  const checkHolder = function() {
188
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* () {
188
+ var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (isLoginTrigger = false) {
189
189
  setLoading(false);
190
190
  if (isRetailTemplate || (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) return appointmentBooking.next();
191
191
  let cartLists = carts || [];
192
192
  if (!(carts === null || carts === void 0 ? void 0 : carts.length)) cartLists = (yield appointmentBooking.getCart()) || [];
193
193
  else cartLists = carts || [];
194
- const { hasError } = require_utils.checkAndGoNext(isFormSubject, checkAccount, cartLists.filter((n) => !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))));
194
+ const { hasError, isEnableSkuHolderRule } = require_utils.checkAndGoNext(isFormSubject, checkAccount, cartLists.filter((n) => !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))));
195
195
  setIsErrorHolder(hasError);
196
- if (hasError) return;
196
+ if (hasError) {
197
+ require_utils$1.scrollToFirstErrorCard(".pisell-lowcode-product-card-select-holder-error");
198
+ return;
199
+ }
200
+ if (isLoginTrigger && isEnableSkuHolderRule) return;
197
201
  if (!!(renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id)) openPolicy({ id: renderItem === null || renderItem === void 0 ? void 0 : renderItem.policy_id }, () => {
198
202
  return appointmentBooking.next();
199
203
  });
@@ -205,10 +209,17 @@ const useAppointmentBookingStep = () => {
205
209
  }();
206
210
  const checkLogin = function() {
207
211
  var _ref3 = require_asyncToGenerator._asyncToGenerator(function* () {
208
- if (!isLogin) {
212
+ if (!isLogin()) {
209
213
  const { pubsub } = utils;
210
214
  pubsub.once("pisell1.login.success", (res) => {
211
- if (res === "success") checkHolder();
215
+ if (res === "success") {
216
+ if (isFormSubject && !isRetailTemplate && !(appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.isCartAllNormalProducts())) {
217
+ var _appointmentBooking$r;
218
+ const customer = require_utils.getCustomer(utils);
219
+ appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$r = appointmentBooking.refreshAllHolderFormRecords) === null || _appointmentBooking$r === void 0 || _appointmentBooking$r.call(appointmentBooking, { customer_id: customer === null || customer === void 0 ? void 0 : customer.id });
220
+ }
221
+ checkHolder(true);
222
+ }
212
223
  if (res === "close") setLoading(false);
213
224
  });
214
225
  return openLoginModal({ callback: (status) => {} });
@@ -342,10 +353,10 @@ const useAppointmentBookingLogin = () => {
342
353
  return Boolean(utils === null || utils === void 0 || (_utils$token = utils.token) === null || _utils$token === void 0 || (_utils$token$get = _utils$token.get) === null || _utils$token$get === void 0 ? void 0 : _utils$token$get.call(_utils$token));
343
354
  }, [utils]);
344
355
  const openLoginModal = (params) => {
345
- const { callback } = params || {};
356
+ const { callback, data = {} } = params || {};
346
357
  utils.action({
347
358
  type: "pisell1.login",
348
- data: { type: "plugin" },
359
+ data: require_objectSpread2._objectSpread2({ type: "plugin" }, data),
349
360
  callback
350
361
  });
351
362
  };
@@ -390,19 +401,23 @@ const useAppointmentBookingAccount = () => {
390
401
  }, []);
391
402
  const getHolders = function() {
392
403
  var _ref9 = require_asyncToGenerator._asyncToGenerator(function* () {
393
- var _utils$getStore$getSt;
404
+ var _utils$getStore$getSt, _appointmentBooking$r2;
394
405
  const shop_id = (_utils$getStore$getSt = utils.getStore().getState()) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.shop) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.id;
395
406
  const customer = require_utils.getCustomer(utils);
396
- if (!shop_id || !form_id || !(customer === null || customer === void 0 ? void 0 : customer.id)) return [];
397
- const params = {
398
- url: "/form/data/v1",
399
- query: {
400
- customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
401
- form_id,
402
- shop_id
403
- }
404
- };
405
- const data = yield appointmentBooking.fetchHolderAccountsAsync(params);
407
+ if (!(customer === null || customer === void 0 ? void 0 : customer.id)) return [];
408
+ let data;
409
+ if (shop_id && form_id) {
410
+ const params = {
411
+ url: "/form/data/v1",
412
+ query: {
413
+ customer_id: customer.id,
414
+ form_id,
415
+ shop_id
416
+ }
417
+ };
418
+ data = yield appointmentBooking.fetchHolderAccountsAsync(params);
419
+ }
420
+ yield appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$r2 = appointmentBooking.refreshAllHolderFormRecords) === null || _appointmentBooking$r2 === void 0 ? void 0 : _appointmentBooking$r2.call(appointmentBooking, { customer_id: customer.id });
406
421
  return (data === null || data === void 0 ? void 0 : data.map((item) => {
407
422
  return {
408
423
  id: item === null || item === void 0 ? void 0 : item.form_record_id,
@@ -1,6 +1,7 @@
1
1
  require("../../_virtual/_rolldown/runtime.js");
2
2
  const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
3
  const require_asyncToGenerator = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
4
+ const require_holderConfig = require("../../utils/holderConfig.js");
4
5
  let _pisell_utils = require("@pisell/utils");
5
6
  let _pisell_materials = require("@pisell/materials");
6
7
  //#region src/components/appointmentBooking/utils.ts
@@ -339,10 +340,19 @@ const getFormInsertBeforeKey = (currentKey, stepList) => {
339
340
  * @Date: 2025-05-24 22:46
340
341
  */
341
342
  const checkAndGoNext = (isFormSubject, checkAccount, carts) => {
343
+ if (!isFormSubject) return {
344
+ hasError: false,
345
+ isEnableSkuHolderRule: false,
346
+ updatedCartList: carts
347
+ };
342
348
  let hasError = false;
349
+ let isEnableSkuHolderRule = false;
343
350
  let updatedCartList = [...carts];
344
- if (isFormSubject && !checkAccount("holder")) updatedCartList = carts === null || carts === void 0 ? void 0 : carts.map((item) => {
345
- if (!(item === null || item === void 0 ? void 0 : item.holder_id)) {
351
+ updatedCartList = carts === null || carts === void 0 ? void 0 : carts.map((item) => {
352
+ var _item$_productInit;
353
+ const holderConfig = (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
354
+ if (!(item === null || item === void 0 ? void 0 : item.holder_id) && require_holderConfig.isHolderConfigEnabled(holderConfig) && !require_holderConfig.isHolderConfigRequired(holderConfig)) isEnableSkuHolderRule = true;
355
+ if (!(item === null || item === void 0 ? void 0 : item.holder_id) && require_holderConfig.isHolderConfigRequired(holderConfig)) {
346
356
  hasError = true;
347
357
  return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { isErrorHolder: true });
348
358
  }
@@ -350,7 +360,8 @@ const checkAndGoNext = (isFormSubject, checkAccount, carts) => {
350
360
  });
351
361
  return {
352
362
  hasError,
353
- updatedCartList
363
+ updatedCartList,
364
+ isEnableSkuHolderRule
354
365
  };
355
366
  };
356
367
  const currentAppointmentBoard = (currentKey, resources, appointmentBooking) => {
@@ -412,8 +423,8 @@ const isSessionProduct = function() {
412
423
  var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (appointmentBooking) {
413
424
  const carts = yield appointmentBooking.getCart();
414
425
  return carts === null || carts === void 0 ? void 0 : carts.some((item) => {
415
- var _item$_productInit;
416
- return (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 || (_item$_productInit = _item$_productInit["schedule.ids"]) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.length) > 0;
426
+ var _item$_productInit2;
427
+ return (item === null || item === void 0 || (_item$_productInit2 = item._productInit) === null || _item$_productInit2 === void 0 || (_item$_productInit2 = _item$_productInit2["schedule.ids"]) === null || _item$_productInit2 === void 0 ? void 0 : _item$_productInit2.length) > 0;
417
428
  });
418
429
  });
419
430
  return function isSessionProduct(_x) {