@pisell/private-materials 3.3.33 → 3.3.34

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 (209) 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 +13 -13
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +6 -6
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +25 -4
  12. package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  13. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  14. package/es/components/appointmentBooking/components/Cart/Item/index.js +25 -45
  15. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  16. package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
  17. package/es/components/appointmentBooking/components/Content/index.js +36 -53
  18. package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
  19. package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  20. package/es/components/appointmentBooking/components/Form/index.js +161 -61
  21. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  22. package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
  23. package/es/components/appointmentBooking/components/Header/index.js +50 -64
  24. package/es/components/appointmentBooking/components/Resource/index.js +102 -119
  25. package/es/components/appointmentBooking/components/TimeSlicing/index.js +12 -5
  26. package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
  27. package/es/components/appointmentBooking/context.js +3 -43
  28. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  29. package/es/components/appointmentBooking/deposit/index.d.ts +0 -1
  30. package/es/components/appointmentBooking/hooks.d.ts +3 -2
  31. package/es/components/appointmentBooking/hooks.js +209 -293
  32. package/es/components/appointmentBooking/index.d.ts +1 -0
  33. package/es/components/appointmentBooking/utils.d.ts +2 -88
  34. package/es/components/appointmentBooking/utils.js +63 -325
  35. package/es/components/booking/addons/model.js +5 -5
  36. package/es/components/booking/components/TabProduct/selectProductItem/index.js +4 -4
  37. package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
  38. package/es/components/booking/components/browserSelect/index.js +1 -1
  39. package/es/components/booking/components/footer/index.d.ts +1 -0
  40. package/es/components/booking/components/voucher/index.d.ts +0 -1
  41. package/es/components/booking/deposit/index.d.ts +1 -0
  42. package/es/components/booking/forms/model.js +5 -5
  43. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  44. package/es/components/booking/hooks/useClearCart.d.ts +0 -1
  45. package/es/components/booking/info/dateRange/index.d.ts +0 -1
  46. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  47. package/es/components/booking/info/index.d.ts +1 -0
  48. package/es/components/booking/info/service/Lists.d.ts +1 -0
  49. package/es/components/booking/info/service/addService/index.d.ts +1 -0
  50. package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  51. package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
  52. package/es/components/booking/info/service/like/index.js +1 -1
  53. package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
  54. package/es/components/booking/info/utils.js +1 -1
  55. package/es/components/booking/info2/service/addService/index.d.ts +1 -0
  56. package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
  57. package/es/components/booking/materiels/startTime/index.js +1 -1
  58. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  59. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  60. package/es/components/booking/notes/model.js +5 -5
  61. package/es/components/booking/payments/model.js +5 -5
  62. package/es/components/eftposPay/amount.d.ts +1 -1
  63. package/es/components/eftposPay/device.d.ts +1 -1
  64. package/es/components/eftposPay/hooks.d.ts +1 -1
  65. package/es/components/eftposPay/store/index.d.ts +3 -3
  66. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  67. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
  68. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  69. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  70. package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
  71. package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
  72. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  73. package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  74. package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  75. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  76. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  77. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  78. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
  79. package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  80. package/es/components/eventBooking/index.d.ts +1 -0
  81. package/es/components/listComponent/index.js +5 -5
  82. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  83. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  84. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  85. package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
  86. package/es/components/productExtension/card/index.js +3 -3
  87. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  88. package/es/components/productExtension/fields/Forms/index.js +12 -12
  89. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  90. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  91. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  92. package/es/components/productExtension/server.js +2 -2
  93. package/es/components/productSelect/components/TabProduct/index.d.ts +0 -1
  94. package/es/components/productSelect/components/productGroup/index.d.ts +0 -1
  95. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  96. package/es/components/schedules/calendar/index.js +4 -4
  97. package/es/components/schedules/calendar/serve.js +2 -2
  98. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  99. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  100. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  101. package/es/components/schedules/components/ResourceList/index.js +1 -1
  102. package/es/components/schedules/components/Search/index.js +5 -5
  103. package/es/components/schedules/model.js +5 -5
  104. package/es/components/schedules/openHours/index.js +1 -1
  105. package/es/components/schedules/openHours/serve.js +2 -2
  106. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  107. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  108. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  109. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  110. package/es/components/schedules/products/serve.js +2 -2
  111. package/es/components/schedules/products/utils.js +5 -5
  112. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  113. package/es/components/schedules/resources/detail/index.js +10 -10
  114. package/es/components/schedules/resources/list/index.js +2 -2
  115. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  116. package/es/components/schedules/resources/serve.js +2 -2
  117. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  118. package/es/components/schedules/utils.d.ts +1 -1
  119. package/es/components/schedules/utils.js +4 -4
  120. package/es/components/selectModal/index.js +2 -2
  121. package/es/components/shoppingCart/components/Cart/index.d.ts +0 -1
  122. package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  123. package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  124. package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  125. package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
  126. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
  127. package/es/hooks/useComponents.js +1 -1
  128. package/es/utils/index.d.ts +1 -1
  129. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +5 -0
  130. package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  131. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  132. package/lib/components/appointmentBooking/components/Cart/Item/index.js +9 -33
  133. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  134. package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
  135. package/lib/components/appointmentBooking/components/Content/index.js +21 -35
  136. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
  137. package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  138. package/lib/components/appointmentBooking/components/Form/index.js +98 -54
  139. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  140. package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
  141. package/lib/components/appointmentBooking/components/Header/index.js +20 -39
  142. package/lib/components/appointmentBooking/components/Resource/index.js +59 -41
  143. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +7 -1
  144. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
  145. package/lib/components/appointmentBooking/context.js +4 -48
  146. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  147. package/lib/components/appointmentBooking/deposit/index.d.ts +0 -1
  148. package/lib/components/appointmentBooking/hooks.d.ts +3 -2
  149. package/lib/components/appointmentBooking/hooks.js +57 -143
  150. package/lib/components/appointmentBooking/index.d.ts +1 -0
  151. package/lib/components/appointmentBooking/utils.d.ts +2 -88
  152. package/lib/components/appointmentBooking/utils.js +51 -191
  153. package/lib/components/booking/components/footer/index.d.ts +1 -0
  154. package/lib/components/booking/components/voucher/index.d.ts +0 -1
  155. package/lib/components/booking/deposit/index.d.ts +1 -0
  156. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  157. package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
  158. package/lib/components/booking/info/dateRange/index.d.ts +0 -1
  159. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  160. package/lib/components/booking/info/index.d.ts +1 -0
  161. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  162. package/lib/components/booking/info/service/addService/index.d.ts +1 -0
  163. package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  164. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
  165. package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -1
  166. package/lib/components/booking/info/utils.js +1 -1
  167. package/lib/components/booking/info2/service/addService/index.d.ts +1 -0
  168. package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
  169. package/lib/components/eftposPay/amount.d.ts +1 -1
  170. package/lib/components/eftposPay/device.d.ts +1 -1
  171. package/lib/components/eftposPay/hooks.d.ts +1 -1
  172. package/lib/components/eftposPay/store/index.d.ts +3 -3
  173. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  174. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
  175. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  176. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  177. package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
  178. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
  179. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  180. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  181. package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  182. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  183. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  184. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  185. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
  186. package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
  187. package/lib/components/eventBooking/index.d.ts +1 -0
  188. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  189. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  190. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  191. package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
  192. package/lib/components/productSelect/components/TabProduct/index.d.ts +0 -1
  193. package/lib/components/productSelect/components/productGroup/index.d.ts +0 -1
  194. package/lib/components/schedules/utils.d.ts +1 -1
  195. package/lib/components/schedules/utils.js +1 -1
  196. package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -1
  197. package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  198. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  199. package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  200. package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
  201. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
  202. package/lib/utils/index.d.ts +1 -1
  203. package/package.json +4 -4
  204. package/es/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  205. package/es/components/eventBooking/components/Provider/SelectProduct/index.js +0 -77
  206. package/es/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
  207. package/lib/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  208. package/lib/components/eventBooking/components/Provider/SelectProduct/index.js +0 -69
  209. package/lib/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
@@ -37,58 +37,81 @@ var import_useComponents = __toESM(require("../../../../hooks/useComponents"));
37
37
  var import_utils = require("../../utils");
38
38
  var import_context = require("../../context");
39
39
  var import_hooks = require("../../hooks");
40
+ var import_PolicyModal = __toESM(require("../../deposit/components/PolicyModal"));
40
41
  var import_index = require("./index.less");
41
42
  var Form = (0, import_react.forwardRef)((props, ref) => {
42
43
  const manualRef = (0, import_react.useRef)();
44
+ const [currentFormIndex, setCurrentFormIndex] = (0, import_react.useState)(0);
45
+ const [showAgreement, setShowAgreement] = (0, import_react.useState)(false);
46
+ const [agreementContent, setAgreementContent] = (0, import_react.useState)({});
47
+ const [formStatus, setFormStatus] = (0, import_react.useState)([]);
43
48
  const [isClearData, setIsClearData] = (0, import_react.useState)(false);
44
- const {
45
- appointmentBooking,
46
- setLoading,
47
- currentStepParams,
48
- currentSelectedResourcesRef
49
- } = (0, import_context.useAppointmentBookingContext)();
49
+ const [formId, setFormId] = (0, import_react.useState)(0);
50
+ const { carts, appointmentBooking, setLoading } = (0, import_context.useAppointmentBookingContext)();
50
51
  const { getResourceList } = (0, import_hooks.useAppointmentBookingResource)();
51
52
  const { setOtherData, getOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
52
53
  const { nextStep } = (0, import_hooks.useAppointmentBookingStep)();
54
+ const utils = (0, import_hooks.contextUtils)();
53
55
  (0, import_react.useImperativeHandle)(ref, () => ({
54
56
  next: () => {
55
57
  var _a, _b;
56
- debugger;
57
58
  setLoading(true);
58
59
  (_b = (_a = manualRef.current) == null ? void 0 : _a.submit) == null ? void 0 : _b.call(_a);
59
60
  }
60
61
  }));
62
+ const key = "booking_form";
63
+ const formStorage = getOtherData("booking_form") || {};
64
+ const resources = (0, import_react.useMemo)(() => {
65
+ const _resource = getResourceList();
66
+ return (_resource == null ? void 0 : _resource.resources) || [];
67
+ }, []);
68
+ const forms = (0, import_react.useMemo)(() => {
69
+ const newCarts = (0, import_utils.formatCarts)(carts, resources, utils);
70
+ if (!(newCarts == null ? void 0 : newCarts.length) || !(resources == null ? void 0 : resources.length)) return [];
71
+ return (0, import_utils.formatForms)(newCarts) || [];
72
+ }, [carts, resources]);
73
+ (0, import_react.useEffect)(() => {
74
+ var _a;
75
+ if (!(forms == null ? void 0 : forms.length)) return;
76
+ setFormId(((_a = forms == null ? void 0 : forms[currentFormIndex]) == null ? void 0 : _a.form_id) || 0);
77
+ }, [forms, currentFormIndex]);
61
78
  const [FormCard] = (0, import_useComponents.default)({
62
79
  components: ["FormCard"]
63
80
  });
64
- const key = "booking_form";
65
- const formStorage = getOtherData("booking_form") || {};
66
- const appointmentBoard = (0, import_react.useMemo)(() => {
67
- const { resources } = getResourceList();
68
- return (0, import_utils.currentAppointmentBoard)(
69
- currentStepParams.key,
70
- resources,
71
- appointmentBooking
72
- );
73
- }, [currentStepParams.key]);
74
- const formId = (0, import_react.useMemo)(() => {
75
- return (appointmentBoard == null ? void 0 : appointmentBoard.resource_form_id) || 0;
76
- }, [appointmentBoard == null ? void 0 : appointmentBoard.resource_form_id]);
81
+ const goToNextForm = () => {
82
+ var _a, _b, _c;
83
+ const nextIndex = currentFormIndex + 1;
84
+ if (nextIndex < forms.length) {
85
+ setIsClearData(true);
86
+ setCurrentFormIndex(nextIndex);
87
+ if (!((_a = forms == null ? void 0 : forms[nextIndex]) == null ? void 0 : _a.form_id) && ((_b = forms == null ? void 0 : forms[nextIndex]) == null ? void 0 : _b.policy_id)) {
88
+ setLoading(true);
89
+ setAgreementContent({ id: (_c = forms == null ? void 0 : forms[nextIndex]) == null ? void 0 : _c.policy_id });
90
+ setShowAgreement(true);
91
+ } else {
92
+ setLoading(false);
93
+ }
94
+ } else {
95
+ nextStep();
96
+ }
97
+ };
77
98
  const updateFormStatus = (status) => {
78
99
  if (status === "error") {
79
100
  setLoading(false);
80
101
  }
102
+ const newFormStatus = (0, import_utils.updateLists)(formStatus, "id", formId, {
103
+ status
104
+ });
105
+ setFormStatus(newFormStatus);
81
106
  };
82
107
  const setFormStorage = (values) => {
108
+ var _a;
109
+ const cart_id = (_a = forms == null ? void 0 : forms[currentFormIndex]) == null ? void 0 : _a.cart_id;
83
110
  const oldData = getOtherData(key);
84
- const newData = (0, import_utils.updateBookingFormStorage)(
85
- oldData,
86
- currentStepParams == null ? void 0 : currentStepParams.key,
87
- values
88
- );
111
+ const newData = (0, import_utils.updateBookingFormStorage)(oldData, cart_id, values);
89
112
  setOtherData(key, { ...newData });
90
113
  appointmentBooking.updateCart({
91
- _id: appointmentBoard == null ? void 0 : appointmentBoard.cart_id,
114
+ _id: cart_id,
92
115
  relationForms: [
93
116
  {
94
117
  form_id: formId,
@@ -98,38 +121,59 @@ var Form = (0, import_react.forwardRef)((props, ref) => {
98
121
  });
99
122
  };
100
123
  const handleFormFinish = (status, values) => {
101
- try {
102
- setIsClearData(false);
103
- updateFormStatus(status);
104
- if (status === "success") {
105
- setFormStorage(values);
106
- nextStep();
124
+ var _a, _b;
125
+ setIsClearData(false);
126
+ updateFormStatus(status);
127
+ if (status === "success") {
128
+ setFormStorage(values);
129
+ if ((_a = forms == null ? void 0 : forms[currentFormIndex]) == null ? void 0 : _a.policy_id) {
130
+ setAgreementContent({ id: (_b = forms == null ? void 0 : forms[currentFormIndex]) == null ? void 0 : _b.policy_id });
131
+ setShowAgreement(true);
132
+ } else {
133
+ goToNextForm();
107
134
  }
108
- } catch (error) {
109
- setLoading(false);
110
135
  }
111
136
  };
112
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-form-wrap" }, /* @__PURE__ */ import_react.default.createElement(
113
- FormCard,
137
+ const handleAgreementOk = () => {
138
+ setShowAgreement(false);
139
+ goToNextForm();
140
+ };
141
+ const formCom = (0, import_react.useMemo)(() => {
142
+ var _a;
143
+ if (!formId) return;
144
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-form-wrap" }, /* @__PURE__ */ import_react.default.createElement(
145
+ FormCard,
146
+ {
147
+ id: formId,
148
+ ref: manualRef,
149
+ isGetLastData: false,
150
+ setting: { isHidden: 1 },
151
+ formWrapStyle: { padding: "16px" },
152
+ isV2API: true,
153
+ isShowSkeleton: true,
154
+ onSubmit: (status, values) => {
155
+ handleFormFinish(status, values);
156
+ },
157
+ onFinishFailed: (e) => {
158
+ updateFormStatus("error");
159
+ },
160
+ onFormValueChange: (values) => {
161
+ },
162
+ defaultValues: (formStorage == null ? void 0 : formStorage[(_a = forms == null ? void 0 : forms[currentFormIndex]) == null ? void 0 : _a.cart_id]) || {},
163
+ isClearData: false
164
+ }
165
+ ));
166
+ }, [currentFormIndex, formId]);
167
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, formCom, showAgreement ? /* @__PURE__ */ import_react.default.createElement(
168
+ import_PolicyModal.default,
114
169
  {
115
- id: formId,
116
- ref: manualRef,
117
- isGetLastData: false,
118
- setting: { isHidden: 1 },
119
- formWrapStyle: { padding: "16px" },
120
- isV2API: true,
121
- isShowSkeleton: true,
122
- onSubmit: (status, values) => {
123
- handleFormFinish(status, values);
124
- },
125
- onFinishFailed: (e) => {
126
- updateFormStatus("error");
127
- },
128
- onFormValueChange: (values) => {
129
- },
130
- defaultValues: (formStorage == null ? void 0 : formStorage[currentStepParams == null ? void 0 : currentStepParams.key]) || {},
131
- isClearData: false
170
+ open: showAgreement,
171
+ onCancel: () => setShowAgreement(false),
172
+ onConfirm: () => handleAgreementOk(),
173
+ item: agreementContent,
174
+ onChange: () => setLoading(false),
175
+ isHideCheckout: false
132
176
  }
133
- )));
177
+ ) : null);
134
178
  });
135
179
  var Form_default = Form;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const GuestOptionsModal: (props: any) => JSX.Element;
4
3
  export default GuestOptionsModal;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Header: () => JSX.Element;
3
4
  export default Header;
@@ -38,41 +38,26 @@ var import_progressBar = __toESM(require("../../../eventBooking/components/progr
38
38
  var import_context = require("../../context");
39
39
  var import_hooks = require("../../hooks");
40
40
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
41
- var import_utils2 = require("../../utils");
42
41
  var import_index = require("./index.less");
43
42
  var Header = () => {
44
43
  var _a;
45
- const {
46
- currentStep,
47
- appointmentBooking,
48
- setTimes,
49
- carts,
50
- currentStepParams,
51
- currentSelectedResourcesRef
52
- } = (0, import_context.useAppointmentBookingContext)();
44
+ const { currentStep, appointmentBooking, resources, setTimes, carts } = (0, import_context.useAppointmentBookingContext)();
53
45
  const shopDiscount = (0, import_hooks.useShopDiscount)();
54
46
  const context = (0, import_useEngineContext.default)();
55
- const { stepList, updateStep } = (0, import_hooks.useAppointmentBookingStep)();
56
- const { setOtherData, getOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
47
+ const { checkSkipResourceStep } = (0, import_hooks.useIsSkipResourceStep)();
48
+ const { getStepIndex, stepList, updateStep } = (0, import_hooks.useAppointmentBookingStep)();
49
+ const { setOtherData } = (0, import_hooks.useAppointmentBookingSetting)();
57
50
  const { checkProductType } = (0, import_hooks.useAppointmentBookingProduct)();
58
- const utils = (0, import_hooks.contextUtils)();
59
51
  const stepName = (0, import_react.useMemo)(() => {
60
- var _a2, _b, _c, _d;
52
+ var _a2, _b, _c, _d, _e;
61
53
  const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
62
54
  if (!key) return "";
63
- if (key.startsWith("select-resource")) {
64
- const currentResource = (_c = (_b = currentSelectedResourcesRef.current) == null ? void 0 : _b[0]) == null ? void 0 : _c.currentSelectedResource;
65
- const resourceItem = (currentResource == null ? void 0 : currentResource.resourceItem) || {};
66
- const name = (0, import_utils2.getResourceTitle)(
67
- appointmentBooking,
68
- resourceItem == null ? void 0 : resourceItem.code,
69
- utils,
70
- resourceItem
71
- );
55
+ if (key === "select-resource") {
56
+ const name = ((_d = (_c = (_b = resources == null ? void 0 : resources[0]) == null ? void 0 : _b.resources) == null ? void 0 : _c[0]) == null ? void 0 : _d.title) || "";
72
57
  return import_utils.locales.getText("pisell2.event.select.category")(name);
73
58
  }
74
- return ((_d = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _d.description) || "";
75
- }, [(_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key, currentSelectedResourcesRef.current]);
59
+ return ((_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.description) || "";
60
+ }, [(_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key, resources]);
76
61
  const handleBack = async () => {
77
62
  var _a2, _b;
78
63
  const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
@@ -97,21 +82,17 @@ var Header = () => {
97
82
  if (key === "select-time") {
98
83
  setTimes([]);
99
84
  }
100
- if (key.startsWith("fill-form")) {
101
- const form_key = "booking_form";
102
- let booking_form = getOtherData(form_key);
103
- setOtherData(form_key, { ...booking_form, [key]: {} });
85
+ if (key === "fill-form") {
86
+ setOtherData("booking_form", {});
87
+ }
88
+ const resourceStep = stepList[(currentStep == null ? void 0 : currentStep.index) - 1];
89
+ if ((resourceStep == null ? void 0 : resourceStep.isSkip) && (resourceStep == null ? void 0 : resourceStep.key) === "select-resource") {
90
+ appointmentBooking.deleteCartItemInfo("resource");
104
91
  }
105
92
  appointmentBooking.back();
106
- const prevStepData = stepList[(currentStepParams == null ? void 0 : currentStepParams.index) - 1];
107
- const currentStepData = stepList[currentStepParams == null ? void 0 : currentStepParams.index];
108
- debugger;
109
- if ((currentStepData == null ? void 0 : currentStepData.isSkip) || (prevStepData == null ? void 0 : prevStepData.isSkip)) {
110
- const key2 = (currentStepData == null ? void 0 : currentStepData.isSkip) ? currentStepData == null ? void 0 : currentStepData.key : prevStepData == null ? void 0 : prevStepData.key;
111
- if (key2 === "select-resource") {
112
- appointmentBooking.deleteCartItemInfo("resource");
113
- }
114
- updateStep(key2, {
93
+ if ((resourceStep == null ? void 0 : resourceStep.isSkip) && ((resourceStep == null ? void 0 : resourceStep.key) === "select-resource" || (resourceStep == null ? void 0 : resourceStep.key) === "select-service")) {
94
+ updateStep(resourceStep == null ? void 0 : resourceStep.key, {
95
+ index: currentStep == null ? void 0 : currentStep.index,
115
96
  isSkip: false
116
97
  });
117
98
  }
@@ -120,8 +101,8 @@ var Header = () => {
120
101
  var _a2, _b;
121
102
  appointmentBooking.destroy();
122
103
  (_a2 = shopDiscount == null ? void 0 : shopDiscount.destroy) == null ? void 0 : _a2.call(shopDiscount);
123
- const utils2 = context.appHelper.utils || {};
124
- (_b = utils2 == null ? void 0 : utils2.history) == null ? void 0 : _b.replace("/");
104
+ const utils = context.appHelper.utils || {};
105
+ (_b = utils == null ? void 0 : utils.history) == null ? void 0 : _b.replace("/");
125
106
  };
126
107
  return /* @__PURE__ */ import_react.default.createElement(
127
108
  import_progressBar.default,
@@ -39,8 +39,10 @@ var import_materials = require("@pisell/materials");
39
39
  var import_hooks = require("../../hooks");
40
40
  var import_context = require("../../context");
41
41
  var import_utils = require("../../utils");
42
+ var import_utils2 = require("../../components/Cart/utils");
43
+ var import_utils3 = require("./utils");
42
44
  var import_guests = __toESM(require("../../assets/guests.svg"));
43
- var import_utils2 = require("@pisell/utils");
45
+ var import_utils4 = require("@pisell/utils");
44
46
  var import_index = require("./index.less");
45
47
  var Resource = (0, import_react.forwardRef)((props, ref) => {
46
48
  const [selectedResource, setSelectedResource] = (0, import_react.useState)(0);
@@ -48,12 +50,17 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
48
50
  appointmentBooking,
49
51
  carts,
50
52
  resourceOtherParams,
53
+ setCarts,
51
54
  currentStep,
52
55
  setResourceOtherParams,
53
- setPolicyIds,
54
- currentStepParams
56
+ setIsErrorHolder,
57
+ setPolicyIds
55
58
  } = (0, import_context.useAppointmentBookingContext)();
56
- const { getResourceList, getResourceTimeSlot } = (0, import_hooks.useAppointmentBookingResource)();
59
+ const {
60
+ getResourceList,
61
+ autoSelectAllProductResources,
62
+ getResourceTimeSlot
63
+ } = (0, import_hooks.useAppointmentBookingResource)();
57
64
  const { checkSkipResourceStep } = (0, import_hooks.useIsSkipResourceStep)();
58
65
  const { updateStep, nextStep } = (0, import_hooks.useAppointmentBookingStep)();
59
66
  const { openLoginModal, isLogin } = (0, import_hooks.useAppointmentBookingLogin)();
@@ -63,13 +70,42 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
63
70
  (0, import_react.useImperativeHandle)(ref, () => ({
64
71
  next: async () => {
65
72
  var _a, _b, _c;
73
+ const result = (0, import_utils2.checkResource)({ carts, resources });
74
+ if (result) {
75
+ setCarts(result);
76
+ }
77
+ setIsErrorHolder(!!result);
78
+ if (!!result) {
79
+ (0, import_utils3.scrollToFirstErrorCard)();
80
+ return;
81
+ }
66
82
  const resultCarts = (0, import_utils.formatCartsResources)(carts, resources, setPolicyIds);
67
83
  const stepList = ((_c = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.step) == null ? void 0 : _b.store) == null ? void 0 : _c.stepList) || [];
68
84
  const accountLists = await appointmentBooking.getAccounts();
85
+ const checkResult = (0, import_utils.checkHasFormStep)({
86
+ nextStep,
87
+ hasResourceFormId: (resultCarts == null ? void 0 : resultCarts.length) > 0,
88
+ currentStep,
89
+ stepList,
90
+ appointmentBooking,
91
+ locales: import_utils4.locales,
92
+ openLoginModal,
93
+ utils,
94
+ accountLists,
95
+ getHolders,
96
+ checkHolder: import_utils2.checkHolder,
97
+ checkAccount,
98
+ setCarts,
99
+ carts,
100
+ isFormSubject,
101
+ isLogin
102
+ });
103
+ if (checkResult) return;
69
104
  setResourceOtherParams({
70
105
  ...resourceOtherParams,
71
106
  errorList: null
72
107
  });
108
+ getResourceTimeSlot();
73
109
  nextStep();
74
110
  }
75
111
  }));
@@ -82,6 +118,8 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
82
118
  var _a;
83
119
  try {
84
120
  const _resources = getResourceList();
121
+ await autoSelectAllProductResources();
122
+ getResourceList();
85
123
  const skipResourceStep = await checkSkipResourceStep();
86
124
  const key = (_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key;
87
125
  updateStep(key, {
@@ -101,52 +139,32 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
101
139
  {
102
140
  id: 0,
103
141
  image: import_guests.default,
104
- title: import_utils2.locales.getText("pisell2.appointment.any.professional"),
105
- subtitle: import_utils2.locales.getText("pisell2.appointment.for.maximum.availability")
142
+ title: import_utils4.locales.getText("pisell2.appointment.any.professional"),
143
+ subtitle: import_utils4.locales.getText("pisell2.appointment.for.maximum.availability")
106
144
  }
107
145
  ];
108
- const appointmentBoard = (0, import_react.useMemo)(() => {
109
- return (0, import_utils.currentAppointmentBoard)(
110
- currentStepParams.key,
111
- resources,
112
- appointmentBooking
113
- );
114
- }, [currentStepParams.key, resources]);
115
- const renderLists = (0, import_react.useMemo)(() => {
116
- return (0, import_utils.currentRenderLists)(resources, appointmentBoard == null ? void 0 : appointmentBoard.form_code);
117
- }, [resources, appointmentBoard == null ? void 0 : appointmentBoard.form_code]);
118
- (0, import_react.useEffect)(() => {
119
- const autoSelectResources = async () => {
120
- if ((appointmentBoard == null ? void 0 : appointmentBoard.isRequired) || !(appointmentBoard == null ? void 0 : appointmentBoard.form_code)) {
121
- return;
146
+ const currentResource = (0, import_react.useMemo)(() => {
147
+ var _a, _b;
148
+ if (resources.length && carts.length) {
149
+ if (carts.length === 1) {
150
+ return (_b = (_a = resources[0]) == null ? void 0 : _a.resources) == null ? void 0 : _b[0];
151
+ } else {
152
+ return {
153
+ renderList: []
154
+ };
122
155
  }
123
- const res = await appointmentBooking.autoSelectAllProductResources(
124
- appointmentBoard == null ? void 0 : appointmentBoard.form_code
125
- );
126
- setResourceOtherParams({
127
- ...resourceOtherParams,
128
- ...res
129
- });
130
- getResourceList();
131
- const cartItem = carts == null ? void 0 : carts[0];
132
- appointmentBooking.updateCart({
133
- _id: cartItem == null ? void 0 : cartItem._id,
134
- ...cartItem
135
- });
136
- };
137
- autoSelectResources();
138
- }, [appointmentBoard]);
156
+ }
157
+ }, [resources, carts]);
139
158
  const resourcesResult = (0, import_react.useMemo)(() => {
140
- let _anyResource = (appointmentBoard == null ? void 0 : appointmentBoard.isRequired) ? [] : [...anyResource];
141
- return _anyResource.concat(renderLists || []);
142
- }, [renderLists, appointmentBoard]);
159
+ return anyResource.concat((currentResource == null ? void 0 : currentResource.renderList) || []);
160
+ }, [currentResource]);
143
161
  const onClick = (e) => {
144
162
  var _a;
145
163
  setSelectedResource(e.id);
146
164
  if (e.id) {
147
165
  return appointmentBooking.updateCart({
148
166
  _id: (_a = carts == null ? void 0 : carts[0]) == null ? void 0 : _a._id,
149
- resources: (0, import_utils.updateCartResources)(carts == null ? void 0 : carts[0], e)
167
+ resources: [e]
150
168
  });
151
169
  }
152
170
  };
@@ -169,7 +187,7 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
169
187
  }
170
188
  );
171
189
  },
172
- columns: (0, import_utils2.isMobile)() ? 2 : 3,
190
+ columns: (0, import_utils4.isMobile)() ? 2 : 3,
173
191
  horizontalGap: 16,
174
192
  verticalGap: 16,
175
193
  onClick: (e) => onClick && onClick(e)
@@ -65,7 +65,13 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
65
65
  }, []);
66
66
  const getAutoSelect = async (val) => {
67
67
  setSelectedTime(val);
68
+ const { resourceCodes } = getResourceList();
69
+ const { errorList } = await appointmentBooking.autoSelectAllProductResources(
70
+ resourceCodes == null ? void 0 : resourceCodes[1],
71
+ val
72
+ );
68
73
  const result = await appointmentBooking.submitTimeSlot(val);
74
+ console.log(errorList, result, "wh9896788");
69
75
  };
70
76
  (0, import_react.useEffect)(() => {
71
77
  var _a, _b, _c;
@@ -75,7 +81,7 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
75
81
  if ((_c = carts == null ? void 0 : carts[0]) == null ? void 0 : _c.start_time) return;
76
82
  getAutoSelect(times == null ? void 0 : times[0]);
77
83
  }
78
- }, [times, carts]);
84
+ }, [times]);
79
85
  const onClick = async (e) => {
80
86
  setSelectedResource(e == null ? void 0 : e.start_time);
81
87
  getAutoSelect(e);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import '../../../booking/components/voucher/index.less';
3
2
  import './index.less';
4
3
  declare const VoucherCard: (props: any) => JSX.Element;
@@ -37,13 +37,11 @@ var import_react = __toESM(require("react"));
37
37
  var import_hooks = require("./hooks");
38
38
  var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
39
39
  var import_tasks = require("../../utils/tasks");
40
- var import_utils = require("./utils");
41
40
  var AppointmentBookingContext = (0, import_react.createContext)(void 0);
42
41
  var AppointmentBookingProvider = ({
43
42
  children
44
43
  }) => {
45
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46
- const currentSelectedResourcesRef = (0, import_react.useRef)(null);
44
+ var _a, _b, _c, _d, _e;
47
45
  const policyIdsRef = (0, import_react.useRef)([]);
48
46
  const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
49
47
  const [summary, setSummary] = (0, import_react.useState)({});
@@ -77,54 +75,14 @@ var AppointmentBookingProvider = ({
77
75
  policyParams.callback();
78
76
  }
79
77
  };
80
- const stepLists = (0, import_react.useMemo)(() => {
81
- var _a2, _b2, _c2;
82
- return ((_c2 = (_b2 = (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a2.step) == null ? void 0 : _b2.store) == null ? void 0 : _c2.stepList) || [];
83
- }, [(_d = (_c = (_b = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _b.step) == null ? void 0 : _c.store) == null ? void 0 : _d.stepList]);
84
78
  const isLastStep = (0, import_react.useMemo)(() => {
85
79
  var _a2;
86
80
  const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
87
81
  return key === "confirm-information";
88
82
  }, [
89
- (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key,
90
- (_h = (_g = (_f = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _f.step) == null ? void 0 : _g.store) == null ? void 0 : _h.stepList
83
+ (_b = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _b.key,
84
+ (_e = (_d = (_c = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _c.step) == null ? void 0 : _d.store) == null ? void 0 : _e.stepList
91
85
  ]);
92
- const currentStepParams = (0, import_react.useMemo)(() => {
93
- var _a2;
94
- const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
95
- const index = stepLists.findIndex((item) => item.key === key);
96
- return {
97
- key,
98
- index,
99
- stepLists
100
- };
101
- }, [(_i = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _i.key, stepLists]);
102
- (0, import_react.useEffect)(() => {
103
- var _a2;
104
- if ((_a2 = currentStepParams == null ? void 0 : currentStepParams.key) == null ? void 0 : _a2.startsWith("select-resource")) {
105
- const currentSelectedResources = carts.map((item) => {
106
- return {
107
- _id: item == null ? void 0 : item._id,
108
- currentSelectedResource: (0, import_utils.getCartCurrentResourceData)(
109
- item,
110
- currentStepParams == null ? void 0 : currentStepParams.key,
111
- resources
112
- )
113
- };
114
- });
115
- currentSelectedResourcesRef.current = currentSelectedResources;
116
- appointmentBooking.setOtherData(
117
- "current_selected_resources",
118
- currentSelectedResources
119
- );
120
- }
121
- }, [currentStepParams == null ? void 0 : currentStepParams.key, resources, carts]);
122
- (0, import_react.useEffect)(() => {
123
- const currentSelectedResources = appointmentBooking.getOtherData(
124
- "current_selected_resources"
125
- );
126
- currentSelectedResourcesRef.current = currentSelectedResources || [];
127
- }, []);
128
86
  const value = {
129
87
  appointmentBooking,
130
88
  times,
@@ -158,9 +116,7 @@ var AppointmentBookingProvider = ({
158
116
  policyIdsRef,
159
117
  setPolicyIds,
160
118
  openPolicy,
161
- closePolicy,
162
- currentStepParams,
163
- currentSelectedResourcesRef
119
+ closePolicy
164
120
  };
165
121
  return /* @__PURE__ */ import_react.default.createElement(AppointmentBookingContext.Provider, { value }, children);
166
122
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const DepositModal: (props: any) => JSX.Element;
4
3
  export default DepositModal;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const Deposit: (props: any) => JSX.Element;
4
3
  export default Deposit;
@@ -14,7 +14,7 @@ export declare const useAppointmentBookingStep: () => {
14
14
  removeStep: (key: string) => any;
15
15
  addStep: (props: any, stepKey?: string) => any;
16
16
  updateStep: (key: string, step: any) => void;
17
- nextStep: () => any;
17
+ nextStep: () => void;
18
18
  };
19
19
  /**
20
20
  * @title: 获取商品数据
@@ -75,6 +75,7 @@ export declare const useAppointmentBookingResource: () => {
75
75
  resources: any;
76
76
  resourceCodes: any;
77
77
  };
78
+ autoSelectAllProductResources: (index?: number) => Promise<any>;
78
79
  };
79
80
  /**
80
81
  * @title: 是否跳过资源选择步骤
@@ -84,7 +85,7 @@ export declare const useAppointmentBookingResource: () => {
84
85
  * @Date: 2025-04-21 11:47
85
86
  */
86
87
  export declare const useIsSkipResourceStep: () => {
87
- checkSkipResourceStep: () => Promise<boolean>;
88
+ checkSkipResourceStep: (isSkipUpdateFormStep?: boolean) => Promise<boolean>;
88
89
  };
89
90
  /**
90
91
  * @title: 获取预约配置