@pisell/private-materials 3.4.4 → 3.4.6

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 (65) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +3 -3
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/appointmentBooking/components/Cart/Item/index.js +1 -0
  12. package/es/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  13. package/es/components/appointmentBooking/components/Cart/utils.js +8 -13
  14. package/es/components/appointmentBooking/components/Content/index.js +105 -19
  15. package/es/components/appointmentBooking/components/Content/index.less +1 -1
  16. package/es/components/appointmentBooking/components/Resource/index.js +1 -0
  17. package/es/components/appointmentBooking/components/Services/index.js +7 -2
  18. package/es/components/appointmentBooking/components/TimeSlicing/index.js +7 -3
  19. package/es/components/appointmentBooking/components/Voucher/index.js +10 -10
  20. package/es/components/appointmentBooking/hooks.js +28 -30
  21. package/es/components/appointmentBooking/index.js +14 -0
  22. package/es/components/appointmentBooking/index.less +1 -1
  23. package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -1
  24. package/es/components/booking/hooks/useIsBooking4Shop.js +4 -3
  25. package/es/components/booking/info/addServiceVariant/index.js +2 -2
  26. package/es/components/booking/info/index.js +4 -4
  27. package/es/components/booking/info/utils.d.ts +1 -1
  28. package/es/components/booking/info/utils.js +4 -2
  29. package/es/components/booking/info2/service/addService/utils.js +38 -9
  30. package/es/components/booking/info2/service/addTimeModal/index.js +2 -2
  31. package/es/components/eventBooking/index.js +14 -0
  32. package/es/components/eventBooking/index.less +1 -1
  33. package/es/components/productSelect/components/TabProduct/index.js +103 -39
  34. package/es/components/productSelect/components/TabProduct/tabs/index.less +1 -0
  35. package/es/components/productSelect/index.d.ts +2 -0
  36. package/es/components/ticketBooking/components/addServiceVariant/addService.js +4 -4
  37. package/es/components/walletList/index.js +4 -4
  38. package/lib/components/appointmentBooking/components/Cart/Item/index.js +1 -0
  39. package/lib/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  40. package/lib/components/appointmentBooking/components/Cart/utils.js +0 -10
  41. package/lib/components/appointmentBooking/components/Content/index.js +49 -7
  42. package/lib/components/appointmentBooking/components/Content/index.less +1 -1
  43. package/lib/components/appointmentBooking/components/Resource/index.js +1 -0
  44. package/lib/components/appointmentBooking/components/Services/index.js +6 -1
  45. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +7 -3
  46. package/lib/components/appointmentBooking/components/Voucher/index.js +0 -11
  47. package/lib/components/appointmentBooking/hooks.js +5 -16
  48. package/lib/components/appointmentBooking/index.js +11 -0
  49. package/lib/components/appointmentBooking/index.less +1 -1
  50. package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -1
  51. package/lib/components/booking/hooks/useIsBooking4Shop.js +6 -4
  52. package/lib/components/booking/info/addServiceVariant/index.js +3 -2
  53. package/lib/components/booking/info/index.js +4 -3
  54. package/lib/components/booking/info/utils.d.ts +1 -1
  55. package/lib/components/booking/info/utils.js +2 -2
  56. package/lib/components/booking/info2/service/addService/utils.js +31 -10
  57. package/lib/components/booking/info2/service/addTimeModal/index.js +3 -2
  58. package/lib/components/eventBooking/index.js +11 -0
  59. package/lib/components/eventBooking/index.less +1 -1
  60. package/lib/components/productSelect/components/TabProduct/index.js +74 -37
  61. package/lib/components/productSelect/components/TabProduct/tabs/index.less +1 -0
  62. package/lib/components/productSelect/index.d.ts +2 -0
  63. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +7 -6
  64. package/lib/components/walletList/index.js +3 -3
  65. package/package.json +3 -3
@@ -46,10 +46,14 @@ var import_Form = __toESM(require("../Form"));
46
46
  var import_ConfirmInformation = __toESM(require("../ConfirmInformation"));
47
47
  var import_context = require("../../context");
48
48
  var import_PolicyModal = __toESM(require("../../deposit/components/PolicyModal"));
49
+ var import_utils2 = require("../Resource/utils");
49
50
  var import_hooks = require("../../hooks");
50
51
  var import_index = require("./index.less");
52
+ var import_useComponents = __toESM(require("../../../../hooks/useComponents"));
53
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
54
+ var import_utils3 = require("../../utils");
51
55
  var Layout = () => {
52
- var _a, _b, _c, _d, _e;
56
+ var _a, _b, _c, _d, _e, _f;
53
57
  const stepRef = (0, import_react.useRef)();
54
58
  const {
55
59
  currentStep,
@@ -68,9 +72,37 @@ var Layout = () => {
68
72
  const { getHolders } = (0, import_hooks.useAppointmentBookingAccount)();
69
73
  const { removeStep } = (0, import_hooks.useAppointmentBookingStep)();
70
74
  const { shopDiscount } = (0, import_hooks.useShopDiscount)();
75
+ const { customPageData } = (_a = (0, import_useEngineContext.default)().engine) == null ? void 0 : _a.props;
76
+ const [CustomComponent] = (0, import_useComponents.default)({
77
+ components: ["CustomComponent"]
78
+ });
79
+ console.log("CustomComponent:", CustomComponent, typeof CustomComponent, CustomComponent == null ? void 0 : CustomComponent.$$typeof);
71
80
  (0, import_hooks.useAppointmentBookingCart)();
72
81
  (0, import_hooks.useAppointmentBookingStep)();
73
82
  const [params, setParams] = (0, import_react.useState)({});
83
+ const utils = (0, import_hooks.contextUtils)();
84
+ const context = (0, import_useEngineContext.default)();
85
+ const { pubsub } = context.appHelper.utils;
86
+ (0, import_react.useEffect)(() => {
87
+ const handleLoginSuccess = async () => {
88
+ var _a2;
89
+ if (!isFormSubject) {
90
+ const user = JSON.parse(((_a2 = utils == null ? void 0 : utils.storage) == null ? void 0 : _a2.get("customer")) || "{}");
91
+ const currentUser = (0, import_utils3.formatCustomer)(user);
92
+ const accountLists = await appointmentBooking.getAccounts();
93
+ const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
94
+ appointmentBooking.setLoginAccount(meAccount == null ? void 0 : meAccount.id, currentUser);
95
+ } else {
96
+ if (!isRetailTemplate) {
97
+ getHolders();
98
+ }
99
+ }
100
+ };
101
+ pubsub.subscribe("pisell1.login.success", handleLoginSuccess);
102
+ return () => {
103
+ pubsub.unsubscribe("pisell1.login.success");
104
+ };
105
+ }, []);
74
106
  (0, import_react.useEffect)(() => {
75
107
  appointmentBooking.removeStep("fill-form");
76
108
  return () => {
@@ -115,6 +147,7 @@ var Layout = () => {
115
147
  }
116
148
  }, [isFormSubject, isLogin, isRetailTemplate]);
117
149
  (0, import_react.useEffect)(() => {
150
+ var _a2;
118
151
  if (!(currentStep == null ? void 0 : currentStep.step)) return;
119
152
  setLoading(false);
120
153
  setResourceOtherParams({
@@ -126,7 +159,10 @@ var Layout = () => {
126
159
  top: 0,
127
160
  behavior: "smooth"
128
161
  });
129
- }, [(_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key]);
162
+ if (((_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key) === "confirm-information") {
163
+ (0, import_utils2.scrollToFirstErrorCard)(".pisell-lowcode-product-card-error");
164
+ }
165
+ }, [(_b = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _b.key]);
130
166
  const components = {
131
167
  // 选择服务
132
168
  "select-service": import_Services.default,
@@ -151,8 +187,14 @@ var Layout = () => {
151
187
  } else {
152
188
  Com2 = components[key];
153
189
  }
154
- return /* @__PURE__ */ import_react.default.createElement(Com2, { onChange: setParams, params, ref: stepRef });
155
- }, [(_b = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _b.key]);
190
+ if (key === "select-service") {
191
+ return /* @__PURE__ */ import_react.default.createElement(CustomComponent, { block: customPageData == null ? void 0 : customPageData.block, customComponents: {
192
+ product_list: /* @__PURE__ */ import_react.default.createElement(Com2, { onChange: setParams, params, ref: stepRef })
193
+ } });
194
+ } else {
195
+ return /* @__PURE__ */ import_react.default.createElement(Com2, { onChange: setParams, params, ref: stepRef });
196
+ }
197
+ }, [(_c = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _c.key]);
156
198
  (0, import_react.useEffect)(() => {
157
199
  var _a2, _b2;
158
200
  if ((0, import_utils.isMobile)()) {
@@ -170,7 +212,7 @@ var Layout = () => {
170
212
  content.style.overflowY = "auto";
171
213
  }
172
214
  }
173
- }, [(_c = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _c.key]);
215
+ }, [(_d = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _d.key]);
174
216
  const isShowCartCom = (0, import_react.useMemo)(() => {
175
217
  var _a2;
176
218
  const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
@@ -182,14 +224,14 @@ var Layout = () => {
182
224
  var _a3, _b2;
183
225
  return (_b2 = (_a3 = stepRef == null ? void 0 : stepRef.current) == null ? void 0 : _a3.next) == null ? void 0 : _b2.call(_a3);
184
226
  } }));
185
- }, [isDateSelectedFirst, (_d = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _d.key]);
227
+ }, [isDateSelectedFirst, (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key]);
186
228
  const isFooter = (0, import_react.useMemo)(() => {
187
229
  var _a2;
188
230
  if (!(0, import_utils.isMobile)()) return false;
189
231
  const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
190
232
  if (isDateSelectedFirst && key === "select-date") return false;
191
233
  return key !== "confirm-information";
192
- }, [isDateSelectedFirst, (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key]);
234
+ }, [isDateSelectedFirst, (_f = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _f.key]);
193
235
  const depositProtocolRequest = (id) => {
194
236
  var _a2;
195
237
  return (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.getProtocol) == null ? void 0 : _a2.call(appointmentBooking, id);
@@ -107,7 +107,7 @@
107
107
  margin-top: 0;
108
108
 
109
109
  .appointment-cart-item-wrap {
110
- height: calc(100vh - 16px) !important;
110
+ height: calc(var(--vh, 1vh) * 100 - 16px) !important;
111
111
  }
112
112
  }
113
113
  }
@@ -154,6 +154,7 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
154
154
  const index = carts.findIndex(
155
155
  (n) => !(appointmentBooking == null ? void 0 : appointmentBooking.isTargetCartIdNormalProduct(n._id))
156
156
  );
157
+ e.like_status = "like";
157
158
  return appointmentBooking.updateCart({
158
159
  _id: (_a = carts == null ? void 0 : carts[index]) == null ? void 0 : _a._id,
159
160
  resources: (0, import_utils.updateCartResources)(carts == null ? void 0 : carts[index], e)
@@ -171,12 +171,17 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
171
171
  }
172
172
  return (productListBlock == null ? void 0 : productListBlock.setting) || {};
173
173
  }, [context]);
174
+ const _isMobile = (0, import_react.useMemo)(() => {
175
+ if (typeof import_utils.isMobile === "function") return (0, import_utils.isMobile)();
176
+ return import_utils.isMobile;
177
+ }, import_utils.isMobile);
174
178
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(
175
179
  import_productSelect.default,
176
180
  {
177
181
  dataSource: products,
178
182
  onChange: handleSelectProduct,
179
- scrollDom: (0, import_utils.isMobile)() ? ".parallel-content-wrap" : ".parallel-booking-wrap",
183
+ scrollDom: _isMobile ? ".parallel-content-wrap" : ".parallel-booking-wrap",
184
+ offsetDom: _isMobile ? "" : ".pisell-section-headers",
180
185
  loading: productLoading,
181
186
  emptyDescription: import_utils.locales.getText(
182
187
  "pisell2.appointment.booking.empty.service"
@@ -36,8 +36,9 @@ var import_react = __toESM(require("react"));
36
36
  var import_materials = require("@pisell/materials");
37
37
  var import_utils = require("@pisell/utils");
38
38
  var import_context = require("../../context");
39
+ var import_utils2 = require("../Resource/utils");
39
40
  var import_hooks = require("../../hooks");
40
- var import_utils2 = require("../../utils");
41
+ var import_utils3 = require("../../utils");
41
42
  var import_index = require("./index.less");
42
43
  var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
43
44
  const [selectedResource, setSelectedResource] = (0, import_react.useState)("");
@@ -54,7 +55,7 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
54
55
  next: () => {
55
56
  const isUnSelectedTimes = appointmentBooking.checkCartItems("date");
56
57
  if ((isUnSelectedTimes == null ? void 0 : isUnSelectedTimes.length) > 0) {
57
- (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unselect.time"));
58
+ (0, import_utils3.Toast)(import_utils.locales.getText("pisell2.appointment.unselect.time"));
58
59
  return;
59
60
  }
60
61
  nextStep();
@@ -65,11 +66,14 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
65
66
  }, []);
66
67
  const getAutoSelect = async (val) => {
67
68
  setSelectedTime(val);
69
+ (0, import_utils2.scrollToFirstErrorCard)(".pisell-lowcode-product-card-error");
68
70
  const result = await appointmentBooking.submitTimeSlot(val);
69
71
  };
70
72
  (0, import_react.useEffect)(() => {
71
73
  var _a, _b, _c;
72
- let appoimentBookingProductCart = carts.filter((item) => !appointmentBooking.isTargetCartIdNormalProduct(item == null ? void 0 : item._id));
74
+ let appoimentBookingProductCart = carts.filter(
75
+ (item) => !appointmentBooking.isTargetCartIdNormalProduct(item == null ? void 0 : item._id)
76
+ );
73
77
  if ((times == null ? void 0 : times.length) > 0 && (appoimentBookingProductCart == null ? void 0 : appoimentBookingProductCart.length) > 0) {
74
78
  const startTime = ((_a = appoimentBookingProductCart == null ? void 0 : appoimentBookingProductCart[0]) == null ? void 0 : _a.start_time) || ((_b = times == null ? void 0 : times[0]) == null ? void 0 : _b.start_time);
75
79
  setSelectedResource(startTime);
@@ -41,7 +41,6 @@ var import_utils = require("@pisell/utils");
41
41
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
42
42
  var import_materials = require("@pisell/materials");
43
43
  var import_hooks = require("../../hooks");
44
- var import_utils2 = require("../../utils");
45
44
  var import_voucher = require("../../../booking/components/voucher/index.less");
46
45
  var import_index = require("./index.less");
47
46
  var ShopDiscountHooks = {
@@ -154,16 +153,6 @@ var VoucherCard = (props) => {
154
153
  if (!action) return;
155
154
  openLoginModal({
156
155
  callback: (status) => {
157
- var _a2, _b2, _c;
158
- const user = (_c = (_b2 = (_a2 = utils.store) == null ? void 0 : _a2.getState()) == null ? void 0 : _b2.global) == null ? void 0 : _c.userInfo;
159
- const currentUser2 = (0, import_utils2.formatCustomer)(user);
160
- const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
161
- if (status === "success") {
162
- appointmentBooking.setLoginAccount(
163
- meAccount == null ? void 0 : meAccount.id,
164
- currentUser2
165
- );
166
- }
167
156
  }
168
157
  });
169
158
  }
@@ -265,23 +265,12 @@ var useAppointmentBookingStep = () => {
265
265
  };
266
266
  const checkLogin = async () => {
267
267
  if (!isLogin) {
268
- const accountLists = await appointmentBooking.getAccounts();
268
+ const { pubsub } = utils;
269
+ pubsub.once("pisell1.login.success", () => {
270
+ checkHolder();
271
+ });
269
272
  return openLoginModal({
270
273
  callback: (status) => {
271
- var _a3;
272
- if (status === "success") {
273
- if (!isFormSubject) {
274
- const user = JSON.parse(((_a3 = utils == null ? void 0 : utils.storage) == null ? void 0 : _a3.get("customer")) || "{}");
275
- const currentUser = (0, import_utils2.formatCustomer)(user);
276
- const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
277
- appointmentBooking.setLoginAccount(meAccount == null ? void 0 : meAccount.id, currentUser);
278
- } else {
279
- if (!isRetailTemplate) {
280
- getHolders();
281
- }
282
- }
283
- checkHolder();
284
- }
285
274
  }
286
275
  });
287
276
  } else {
@@ -390,7 +379,7 @@ var useAppointmentBookingLogin = () => {
390
379
  utils.action({
391
380
  type: "pisell1.login",
392
381
  data: {
393
- type: "plugin"
382
+ // type: 'plugin'
394
383
  },
395
384
  callback
396
385
  });
@@ -58,6 +58,17 @@ var AppointmentBooking = () => {
58
58
  }
59
59
  });
60
60
  }, []);
61
+ (0, import_react.useEffect)(() => {
62
+ const setRealVH = () => {
63
+ const vh = window.innerHeight * 0.01;
64
+ document.documentElement.style.setProperty("--vh", `${vh}px`);
65
+ };
66
+ setRealVH();
67
+ window.addEventListener("resize", setRealVH);
68
+ return () => {
69
+ window.removeEventListener("resize", setRealVH);
70
+ };
71
+ }, []);
61
72
  return /* @__PURE__ */ import_react.default.createElement(
62
73
  "div",
63
74
  {
@@ -3,7 +3,7 @@
3
3
  flex-direction: column;
4
4
  align-items: center;
5
5
  background: #ffffff;
6
- height: 100vh;
6
+ height: calc(var(--vh, 1vh) * 100);
7
7
  overflow-y: auto;
8
8
 
9
9
  .pisell-section-headers {
@@ -1 +1 @@
1
- export declare const useIsBooking4Shop: (state: any) => boolean;
1
+ export declare const useIsBooking4Shop: (state: any) => any;
@@ -36,14 +36,16 @@ var import_react = require("react");
36
36
  var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
37
37
  var import_utils = require("../info/utils");
38
38
  var useIsBooking4Shop = (state) => {
39
+ var _a;
39
40
  const context = (0, import_useEngineContext.default)();
40
41
  return (0, import_react.useMemo)(() => {
41
- var _a, _b, _c, _d, _e;
42
+ var _a2, _b, _c, _d, _e, _f;
42
43
  return (0, import_utils.isBooking4Shop)(
43
- (_e = (_d = (_c = (_b = (_a = context.appHelper.utils.store) == null ? void 0 : _a.getState) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.global) == null ? void 0 : _d.globalConfig) == null ? void 0 : _e.id,
44
- state.renderType
44
+ (_e = (_d = (_c = (_b = (_a2 = context.appHelper.utils.store) == null ? void 0 : _a2.getState) == null ? void 0 : _b.call(_a2)) == null ? void 0 : _c.global) == null ? void 0 : _d.globalConfig) == null ? void 0 : _e.id,
45
+ state.renderType,
46
+ (_f = context.appHelper.utils) == null ? void 0 : _f.businessUtils
45
47
  );
46
- }, [state.renderType]);
48
+ }, [state.renderType, (_a = context.appHelper.utils) == null ? void 0 : _a.businessUtils]);
47
49
  };
48
50
  // Annotate the CommonJS export names for ESM import in node:
49
51
  0 && (module.exports = {
@@ -38,7 +38,7 @@ var import_addService2 = __toESM(require("../../info2/service/addService"));
38
38
  var import_utils = require("../utils");
39
39
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
40
40
  var AddServiceVariant = (props) => {
41
- var _a, _b, _c, _d, _e, _f;
41
+ var _a, _b, _c, _d, _e, _f, _g;
42
42
  const { globalState, setGlobalState } = props;
43
43
  const context = (0, import_useEngineContext.default)();
44
44
  const stateRef = (0, import_react.useRef)(globalState);
@@ -58,7 +58,8 @@ var AddServiceVariant = (props) => {
58
58
  let Cpt = import_addService.default;
59
59
  if ((0, import_utils.isBooking4Shop)(
60
60
  (_e = (_d = (_c = (_b = (_a = context.appHelper.utils.store) == null ? void 0 : _a.getState) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.global) == null ? void 0 : _d.globalConfig) == null ? void 0 : _e.id,
61
- (_f = props == null ? void 0 : props.globalState) == null ? void 0 : _f.renderType
61
+ (_f = props == null ? void 0 : props.globalState) == null ? void 0 : _f.renderType,
62
+ (_g = context.appHelper.utils) == null ? void 0 : _g.businessUtils
62
63
  )) {
63
64
  Cpt = import_addService2.default;
64
65
  }
@@ -39,14 +39,15 @@ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext")
39
39
  var import_utils = require("./utils");
40
40
  var import_antd = require("antd");
41
41
  var APP = (props) => {
42
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
42
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
43
43
  const context = (0, import_useEngineContext.default)();
44
44
  const { globalState } = props;
45
45
  const isBooking4 = (0, import_utils.isBooking4Shop)(
46
46
  (_e = (_d = (_c = (_b = (_a = context.appHelper.utils.store) == null ? void 0 : _a.getState) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.global) == null ? void 0 : _d.globalConfig) == null ? void 0 : _e.id,
47
- globalState == null ? void 0 : globalState.renderType
47
+ globalState == null ? void 0 : globalState.renderType,
48
+ (_f = context.appHelper.utils) == null ? void 0 : _f.businessUtils
48
49
  );
49
- if (!((_j = (_i = (_h = (_g = (_f = context.appHelper.utils.store) == null ? void 0 : _f.getState) == null ? void 0 : _g.call(_f)) == null ? void 0 : _h.global) == null ? void 0 : _i.globalConfig) == null ? void 0 : _j.id)) {
50
+ if (!((_k = (_j = (_i = (_h = (_g = context.appHelper.utils.store) == null ? void 0 : _g.getState) == null ? void 0 : _h.call(_g)) == null ? void 0 : _i.global) == null ? void 0 : _j.globalConfig) == null ? void 0 : _k.id)) {
50
51
  return /* @__PURE__ */ import_react.default.createElement("div", { style: { padding: 16 } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, null));
51
52
  }
52
53
  if (isBooking4 && (!(globalState == null ? void 0 : globalState.bookingId) || (globalState == null ? void 0 : globalState.isParallelResourcesBooking))) {
@@ -21,7 +21,7 @@ export declare const isInterval: (time1: number, time2: number, interval?: numbe
21
21
  * @Date: 2024-08-13 19:36
22
22
  */
23
23
  export declare const formatServiceListByTime: (list: any[]) => any[];
24
- export declare const isBooking4Shop: (shopId: number, renderType?: string) => boolean;
24
+ export declare const isBooking4Shop: (shopId: number, renderType?: string, businessUtils?: any) => any;
25
25
  declare type DataEntry = {
26
26
  total: number;
27
27
  origin_total: number;
@@ -100,7 +100,7 @@ var formatServiceListByTime = (list) => {
100
100
  return list;
101
101
  }
102
102
  };
103
- var isBooking4Shop = (shopId, renderType) => {
103
+ var isBooking4Shop = (shopId, renderType, businessUtils) => {
104
104
  if (renderType === "eventBooking") {
105
105
  return false;
106
106
  }
@@ -147,7 +147,7 @@ var isBooking4Shop = (shopId, renderType) => {
147
147
  8918,
148
148
  6413
149
149
  ];
150
- return booking4Shops.includes(shopId);
150
+ return booking4Shops.includes(shopId) || (businessUtils == null ? void 0 : businessUtils.getAppByModal("resourcekit"));
151
151
  };
152
152
  function generateDateRange(start, end) {
153
153
  const dateRange = [];
@@ -286,15 +286,25 @@ var setDefaultCapacitys = ({ capacitys, cacheItem }) => {
286
286
  return [{ id: 0, value: 1, name: "" }];
287
287
  };
288
288
  var getResourceByIds = (resourcesOriginMap, cacheItem, extraParams) => {
289
- var _a;
289
+ var _a, _b;
290
290
  let _resources = [...((_a = cacheItem == null ? void 0 : cacheItem.product_resource) == null ? void 0 : _a.resources) || []];
291
- const { extraResources = [] } = extraParams || {};
291
+ const {
292
+ extraResources = [],
293
+ resourcesOrigin = [],
294
+ resourceTab = {}
295
+ } = extraParams || {};
292
296
  _resources = _resources.filter((d) => d.status == 1);
293
297
  for (let item of _resources) {
294
298
  const form_id = item.id;
295
- let extraResourceIds = extraResources.filter((_extraItem) => {
296
- return _extraItem.form_id === form_id && !item.optional_resource.includes(_extraItem.id) && !item.default_resource.includes(_extraItem.id);
297
- }).map((_extraItem) => _extraItem.id);
299
+ const isAllResource = ((_b = resourceTab == null ? void 0 : resourceTab[item.code]) == null ? void 0 : _b.resource_display_scope) === "all";
300
+ let extraResourceIds = [];
301
+ if (isAllResource) {
302
+ extraResourceIds = (resourcesOrigin || []).filter((d) => d.form_code === item.code).map((d) => d.id);
303
+ } else {
304
+ extraResourceIds = extraResources.filter((_extraItem) => {
305
+ return _extraItem.form_id === form_id && !item.optional_resource.includes(_extraItem.id) && !item.default_resource.includes(_extraItem.id);
306
+ }).map((_extraItem) => _extraItem.id);
307
+ }
298
308
  extraResourceIds = Array.from(new Set(extraResourceIds));
299
309
  item.optional_resource = (item.optional_resource || []).filter(
300
310
  (d) => item.default_resource.indexOf(d) == -1
@@ -304,11 +314,11 @@ var getResourceByIds = (resourcesOriginMap, cacheItem, extraParams) => {
304
314
  if (resourcesOriginMap[d].combined_resource && resourcesOriginMap[d].combined_resource.status === 1) {
305
315
  resourcesOriginMap[d].combined_resource.resource_ids.forEach(
306
316
  (id) => {
307
- var _a2, _b;
317
+ var _a2, _b2;
308
318
  if (resourcesOriginMap[id]) {
309
319
  combiningResources.push({
310
320
  ...resourcesOriginMap[id],
311
- relation_id: ((_a2 = resourcesOriginMap[id]) == null ? void 0 : _a2.relation_id) || ((_b = resourcesOriginMap[id]) == null ? void 0 : _b.id)
321
+ relation_id: ((_a2 = resourcesOriginMap[id]) == null ? void 0 : _a2.relation_id) || ((_b2 = resourcesOriginMap[id]) == null ? void 0 : _b2.id)
312
322
  });
313
323
  }
314
324
  }
@@ -322,7 +332,9 @@ var getResourceByIds = (resourcesOriginMap, cacheItem, extraParams) => {
322
332
  }
323
333
  };
324
334
  };
325
- let optional_resource = [...item.optional_resource, ...extraResourceIds].map((d) => {
335
+ let optional_resource = Array.from(
336
+ /* @__PURE__ */ new Set([...item.optional_resource, ...extraResourceIds])
337
+ ).map((d) => {
326
338
  if (!resourcesOriginMap[d]) {
327
339
  return null;
328
340
  }
@@ -370,6 +382,7 @@ var getIsAutoClose = (cacheItem) => {
370
382
  );
371
383
  };
372
384
  var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
385
+ var _a, _b, _c, _d;
373
386
  const isNew = cacheItem.new || !cacheItem._extend.endDate;
374
387
  let _cacheItem = { ...cacheItem };
375
388
  const resourcesOriginMap = state.service.resourcesOriginMap || {};
@@ -388,7 +401,12 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
388
401
  _cacheItem._data.capacitys = cacheItem.capacity;
389
402
  _cacheItem._data.resourcesOrigin = getResourceByIds(
390
403
  resourcesOriginMap,
391
- cacheItem
404
+ cacheItem,
405
+ {
406
+ // 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
407
+ resourceTab: (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.resource_tab,
408
+ resourcesOrigin: state.service.resourcesOrigin
409
+ }
392
410
  );
393
411
  _cacheItem._extend.capacity = setDefaultCapacitys({
394
412
  capacitys: _cacheItem._data.capacitys,
@@ -444,7 +462,10 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
444
462
  resourcesOriginMap,
445
463
  cacheItem,
446
464
  {
447
- extraResources
465
+ extraResources,
466
+ // 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
467
+ resourceTab: (_d = (_c = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c.config) == null ? void 0 : _d.resource_tab,
468
+ resourcesOrigin: state.service.resourcesOrigin
448
469
  }
449
470
  );
450
471
  }
@@ -389,7 +389,7 @@ var AddTimeModal = () => {
389
389
  goCheckout();
390
390
  };
391
391
  const handleSave = async (loadingType = "save") => {
392
- var _a2, _b2, _c2, _d2, _e2;
392
+ var _a2, _b2, _c2, _d2, _e2, _f2;
393
393
  if (currentTime === null) {
394
394
  return;
395
395
  }
@@ -400,7 +400,8 @@ var AddTimeModal = () => {
400
400
  setLoading(loadingType);
401
401
  const api = (0, import_utils4.isBooking4Shop)(
402
402
  (_e2 = (_d2 = (_c2 = (_b2 = (_a2 = context.appHelper.utils.store) == null ? void 0 : _a2.getState) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c2.global) == null ? void 0 : _d2.globalConfig) == null ? void 0 : _e2.id,
403
- state.renderType
403
+ state.renderType,
404
+ (_f2 = context.appHelper.utils) == null ? void 0 : _f2.businessUtils
404
405
  ) ? import_serve.saveAddTimeProduct2 : import_serve.saveAddTimeProduct;
405
406
  try {
406
407
  await api({
@@ -66,6 +66,17 @@ var Content = () => {
66
66
  }
67
67
  getResourceList.run(params);
68
68
  }, []);
69
+ (0, import_react.useEffect)(() => {
70
+ const setRealVH = () => {
71
+ const vh = window.innerHeight * 0.01;
72
+ document.documentElement.style.setProperty("--vh", `${vh}px`);
73
+ };
74
+ setRealVH();
75
+ window.addEventListener("resize", setRealVH);
76
+ return () => {
77
+ window.removeEventListener("resize", setRealVH);
78
+ };
79
+ }, []);
69
80
  return /* @__PURE__ */ import_react.default.createElement(
70
81
  "div",
71
82
  {
@@ -15,7 +15,7 @@
15
15
 
16
16
  .event-booking-mobile-wrap {
17
17
  background: #ffffff;
18
- min-height: 100vh;
18
+ min-height: calc(var(--vh, 1vh) * 100);
19
19
  .pisell-section-headers-content {
20
20
  width: 100%;
21
21
  }