@pisell/private-materials 6.12.356 → 6.12.358

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 (60) 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 +67 -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/saleDetail/Base.js +1 -0
  32. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  33. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  34. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  35. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  36. package/es/plus/saleDetail/index.js +1 -0
  37. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  38. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  39. package/es/plus/salesSdk/index.js +54 -0
  40. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  41. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  42. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  43. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  44. package/es/pro/Login2.0/index.d.ts +2 -2
  45. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  46. package/es/utils/buildCartHolderParams.js +169 -0
  47. package/es/utils/holderConfig.js +6 -0
  48. package/lib/components/appointmentBooking/components/Cart/Item/index.js +66 -11
  49. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +7 -2
  50. package/lib/components/appointmentBooking/components/Content/index.js +6 -4
  51. package/lib/components/appointmentBooking/components/Voucher/index.js +11 -1
  52. package/lib/components/appointmentBooking/hooks.js +33 -18
  53. package/lib/components/appointmentBooking/utils.js +16 -5
  54. package/lib/components/venueBooking/components/Cart/index.js +111 -17
  55. package/lib/components/venueBooking/context.js +14 -3
  56. package/lib/components/venueBooking/locales.js +10 -5
  57. package/lib/utils/buildCartHolderParams.js +175 -0
  58. package/lib/utils/holderConfig.js +7 -0
  59. package/package.json +2 -2
  60. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -0,0 +1,169 @@
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), {}, {
52
+ form_record_id: _id,
53
+ customer_id: customerId
54
+ })
55
+ };
56
+ };
57
+ /**
58
+ * 构建 ProductCard Holder 组件使用的单条 holder 数据。
59
+ * 输出字段需要与购物车 ProductCard 消费格式保持一致。
60
+ */
61
+ const buildCartHolderOption = (holder, utils) => {
62
+ if (!holder) return {};
63
+ return createCartHolderOption(holder, getCurrentCustomerId(utils));
64
+ };
65
+ const buildCartHolderOptions = (records, utils) => {
66
+ const customerId = getCurrentCustomerId(utils);
67
+ return records.map((record) => createCartHolderOption(record, customerId));
68
+ };
69
+ const getCartHolderTitle = (records, holderId) => {
70
+ var _records$find;
71
+ if (!holderId) return "";
72
+ 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;
73
+ };
74
+ /**
75
+ * 根据 holderMap 与购物车行数据,构建 ProductCard 所需的 holder 展示字段。
76
+ * 供 appointmentBooking、venueBooking 等购物车场景复用。
77
+ */
78
+ const buildCartHolderParams = ({ item, holderConfig = {}, formData, translation, enabled = true, utils }) => {
79
+ var _formData$form;
80
+ if (!enabled || !isHolderConfigEnabled(holderConfig)) return {
81
+ isShowChangeHolder: false,
82
+ isErrorHolder: false,
83
+ holders: []
84
+ };
85
+ const records = (formData === null || formData === void 0 ? void 0 : formData.records) || [];
86
+ const holderId = resolveCartItemHolderId(item);
87
+ return {
88
+ holder_id: holderId,
89
+ isErrorHolder: !!(!holderId && isHolderConfigRequired(holderConfig)),
90
+ isShowChangeHolder: true,
91
+ 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),
92
+ holder_title: getCartHolderTitle(records, holderId),
93
+ holders: buildCartHolderOptions(records, utils)
94
+ };
95
+ };
96
+ /**
97
+ * 从 appointmentBooking 购物车行读取 holder_config
98
+ */
99
+ const getAppointmentCartHolderConfig = (item) => {
100
+ var _item$_productInit;
101
+ return (item === null || item === void 0 || (_item$_productInit = item._productInit) === null || _item$_productInit === void 0 ? void 0 : _item$_productInit.holder_config) || {};
102
+ };
103
+ /**
104
+ * 从 venueBooking 购物车行读取 holder_config
105
+ */
106
+ const getVenueCartHolderConfig = (item) => {
107
+ var _item$_origin2;
108
+ 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) || {};
109
+ };
110
+ /**
111
+ * 校验购物车中 holder_config.required 的行是否已选择 holder。
112
+ */
113
+ const validateRequiredCartHolders = ({ items = [], getHolderConfig = getVenueCartHolderConfig }) => {
114
+ const invalidItems = items.filter((item) => {
115
+ if (!isHolderConfigRequired(getHolderConfig(item))) return false;
116
+ return !resolveCartItemHolderId(item);
117
+ });
118
+ return {
119
+ hasError: invalidItems.length > 0,
120
+ invalidItems
121
+ };
122
+ };
123
+ /**
124
+ * 从 holderMap 解析 minors 表单关联的 sku 关系表单 ID(form_to_form 隐藏字段的 linkedTable)。
125
+ */
126
+ const getSkuRelationFormId = (holderMap, formId) => {
127
+ var _formData$form2, _formData$form3, _detail$setting;
128
+ if (!formId) return 0;
129
+ const formData = holderMap === null || holderMap === void 0 ? void 0 : holderMap[formId];
130
+ 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;
131
+ 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");
132
+ return (detail === null || detail === void 0 || (_detail$setting = detail.setting) === null || _detail$setting === void 0 ? void 0 : _detail$setting.linkedTable) || 0;
133
+ };
134
+ /**
135
+ * 从 form_to_form_value 中取最新创建的 form_record_id。
136
+ */
137
+ const getSkuRelationFormRecordId = (res) => {
138
+ var _res$values;
139
+ 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];
140
+ const formDataValue = (formToFormValue === null || formToFormValue === void 0 ? void 0 : formToFormValue.form_data_value) || [];
141
+ return formDataValue[formDataValue.length - 1];
142
+ };
143
+ /**
144
+ * 处理购物车添加 holder 表单提交成功后的公共逻辑。
145
+ * - minors 关联表单:刷新 holder 列表,取 form_to_form_value 中的 record id
146
+ * - 普通表单:appendFormRecord 并直接使用 form_record_id
147
+ */
148
+ const handleCartHolderFormSuccess = ({ res, formId, skuRelationFormId, utils, module }) => {
149
+ var _res$values2, _res$values3, _res$values4;
150
+ let formRecordId = res === null || res === void 0 || (_res$values2 = res.values) === null || _res$values2 === void 0 ? void 0 : _res$values2.form_record_id;
151
+ let resolvedFormId = res === null || res === void 0 || (_res$values3 = res.values) === null || _res$values3 === void 0 ? void 0 : _res$values3.form_id;
152
+ if (formId && skuRelationFormId) {
153
+ var _module$refreshAllHol;
154
+ const customer = getCustomer(utils);
155
+ 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 });
156
+ formRecordId = getSkuRelationFormRecordId(res);
157
+ resolvedFormId = formId;
158
+ } else if (formId) {
159
+ var _module$appendFormRec;
160
+ 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 });
161
+ }
162
+ return {
163
+ formRecordId,
164
+ mainField: res === null || res === void 0 || (_res$values4 = res.values) === null || _res$values4 === void 0 ? void 0 : _res$values4.main_field,
165
+ formId: resolvedFormId
166
+ };
167
+ };
168
+ //#endregion
169
+ 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,35 @@ 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, formId: holderFormId } = 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), {}, {
125
+ formRecordId,
126
+ form_id: holderFormId
127
+ }), utils);
128
+ appointmentBooking.updateCart({
129
+ _id: e === null || e === void 0 ? void 0 : e._id,
130
+ account: result
131
+ });
132
+ return;
133
+ }
91
134
  if (!relationShipFormId) result = yield addAccount(res === null || res === void 0 ? void 0 : res.values, "holder");
92
135
  else result = yield require_utils$1.handleAddHolder({
93
136
  res,
@@ -112,24 +155,36 @@ const CartItem = ({ onNext, renderContactInfo }) => {
112
155
  };
113
156
  const products = (0, react.useMemo)(() => {
114
157
  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);
158
+ const enrichedCarts = carts.map((item) => {
159
+ const isNormalProduct = appointmentBooking.isTargetCartIdNormalProduct(item === null || item === void 0 ? void 0 : item._id);
160
+ const holderConfig = require_buildCartHolderParams.getAppointmentCartHolderConfig(item);
161
+ const holderParams = require_buildCartHolderParams.buildCartHolderParams({
162
+ item,
163
+ holderConfig,
164
+ formData: require_holderConfig.isHolderConfigEnabled(holderConfig) ? holderMap === null || holderMap === void 0 ? void 0 : holderMap[holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id] : {},
165
+ translation,
166
+ enabled: isLoggedIn && isFormSubject && !isNormalProduct,
167
+ utils
168
+ });
169
+ return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), holderParams);
117
170
  });
118
- if ((currentSelectedResources === null || currentSelectedResources === void 0 ? void 0 : currentSelectedResources.length) > 0) return carts.map((item) => {
171
+ if ((currentSelectedResources === null || currentSelectedResources === void 0 ? void 0 : currentSelectedResources.length) > 0) return enrichedCarts.map((item) => {
119
172
  const currentResourceData = currentSelectedResources.find((resource) => (resource === null || resource === void 0 ? void 0 : resource._id) === (item === null || item === void 0 ? void 0 : item._id));
120
173
  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
174
  return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, {
122
175
  isMultipleResource: true,
123
- multiResources,
124
- isErrorHolder: isErrorHolder || false
176
+ multiResources
125
177
  });
126
178
  });
127
- else return carts;
179
+ else return enrichedCarts;
128
180
  }, [
129
181
  carts,
130
182
  currentSelectedResources,
131
183
  currentStepParams === null || currentStepParams === void 0 ? void 0 : currentStepParams.key,
132
- isErrorHolder
184
+ isErrorHolder,
185
+ holderMap,
186
+ isFormSubject,
187
+ isLoggedIn
133
188
  ]);
134
189
  /**
135
190
  * @description: 结算列表数据
@@ -189,8 +244,8 @@ const CartItem = ({ onNext, renderContactInfo }) => {
189
244
  isShowDelete: (currentStep === null || currentStep === void 0 || (_currentStep$step2 = currentStep.step) === null || _currentStep$step2 === void 0 ? void 0 : _currentStep$step2.key) === "select-service",
190
245
  isShowAmountFooter: true,
191
246
  isShowPackageNote: false,
192
- isShowChangeHolder: isLastStep ? false : isFormSubject && isLogin,
193
- isShowHolder: isFormSubject,
247
+ isShowChangeHolder: isLastStep ? false : isFormSubject && isLoggedIn,
248
+ isShowHolder: isFormSubject && isLoggedIn,
194
249
  isShowAddHolderButton: true
195
250
  },
196
251
  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) {