@pisell/private-materials 3.3.33 → 3.3.35

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 (274) 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/Sales/Cart/index.js +26 -13
  12. package/es/components/Sales/Cart/types.d.ts +12 -0
  13. package/es/components/Sales/Cart/utils.d.ts +23 -0
  14. package/es/components/Sales/Cart/utils.js +161 -0
  15. package/es/components/Sales/Checkout/utils.d.ts +9 -1
  16. package/es/components/Sales/Checkout/utils.js +25 -3
  17. package/es/components/Sales/Event/Detail.d.ts +2 -0
  18. package/es/components/Sales/Event/Detail.js +56 -13
  19. package/es/components/Sales/Event/serve.d.ts +10 -0
  20. package/es/components/Sales/Event/serve.js +26 -1
  21. package/es/components/Sales/Summary/utils.js +1 -0
  22. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +42 -20
  23. package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  24. package/es/components/appointmentBooking/components/Cart/Item/index.js +10 -29
  25. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  26. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +156 -53
  27. package/es/components/appointmentBooking/components/ConfirmInformation/utils.d.ts +12 -0
  28. package/es/components/appointmentBooking/components/ConfirmInformation/utils.js +17 -0
  29. package/es/components/appointmentBooking/components/Content/index.js +28 -44
  30. package/es/components/appointmentBooking/components/Content/index.less +23 -1
  31. package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
  32. package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  33. package/es/components/appointmentBooking/components/Footer/index.js +5 -5
  34. package/es/components/appointmentBooking/components/Form/index.js +161 -61
  35. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  36. package/es/components/appointmentBooking/components/Header/index.js +47 -61
  37. package/es/components/appointmentBooking/components/Resource/index.js +102 -119
  38. package/es/components/appointmentBooking/components/Services/index.js +50 -25
  39. package/es/components/appointmentBooking/components/TimeSlicing/index.js +12 -5
  40. package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
  41. package/es/components/appointmentBooking/context.js +3 -43
  42. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  43. package/es/components/appointmentBooking/deposit/index.d.ts +0 -1
  44. package/es/components/appointmentBooking/hooks.d.ts +3 -1
  45. package/es/components/appointmentBooking/hooks.js +215 -294
  46. package/es/components/appointmentBooking/utils.d.ts +2 -88
  47. package/es/components/appointmentBooking/utils.js +63 -325
  48. package/es/components/booking/addons/model.js +5 -5
  49. package/es/components/booking/components/TabProduct/index.d.ts +0 -1
  50. package/es/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
  51. package/es/components/booking/components/TabProduct/selectProductItem/index.js +4 -4
  52. package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
  53. package/es/components/booking/components/browserSelect/index.js +1 -1
  54. package/es/components/booking/components/voucher/index.d.ts +0 -1
  55. package/es/components/booking/forms/model.js +5 -5
  56. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  57. package/es/components/booking/forms/single/index.d.ts +0 -1
  58. package/es/components/booking/hooks/useClearCart.d.ts +0 -1
  59. package/es/components/booking/info/addServiceVariant/index.d.ts +0 -1
  60. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
  61. package/es/components/booking/info/date/index.d.ts +0 -1
  62. package/es/components/booking/info/dateRange/index.d.ts +0 -1
  63. package/es/components/booking/info/service/actions/index.d.ts +0 -1
  64. package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
  65. package/es/components/booking/info/service/like/index.js +1 -1
  66. package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
  67. package/es/components/booking/info/service/serviceList/index.d.ts +0 -1
  68. package/es/components/booking/info/service2/Lists.d.ts +0 -1
  69. package/es/components/booking/info/utils.js +1 -1
  70. package/es/components/booking/info2/service/actions/index.d.ts +0 -1
  71. package/es/components/booking/info2/service/addTimeModal/index.d.ts +0 -1
  72. package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
  73. package/es/components/booking/info2/service/serviceList/index.d.ts +0 -1
  74. package/es/components/booking/materiels/duration/index.d.ts +0 -1
  75. package/es/components/booking/materiels/holder/index.d.ts +0 -1
  76. package/es/components/booking/materiels/startTime/index.d.ts +0 -1
  77. package/es/components/booking/materiels/startTime/index.js +1 -1
  78. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  79. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  80. package/es/components/booking/notes/model.js +5 -5
  81. package/es/components/booking/payments/model.js +5 -5
  82. package/es/components/booking/utils.d.ts +2 -2
  83. package/es/components/booking/utils.js +19 -11
  84. package/es/components/eftposPay/amount.d.ts +1 -1
  85. package/es/components/eftposPay/device.d.ts +1 -1
  86. package/es/components/eftposPay/hooks.d.ts +1 -1
  87. package/es/components/eftposPay/store/index.d.ts +3 -3
  88. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  89. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +218 -73
  90. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
  91. package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  92. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  93. package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
  94. package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
  95. package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
  96. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  97. package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  98. package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  99. package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
  100. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  101. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  102. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  103. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +3 -2
  104. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +7 -4
  105. package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
  106. package/es/components/eventBooking/components/bookingDetailModal/index.js +70 -13
  107. package/es/components/listComponent/index.js +5 -5
  108. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  109. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  110. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  111. package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
  112. package/es/components/productExtension/card/index.js +3 -3
  113. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  114. package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
  115. package/es/components/productExtension/fields/Forms/index.d.ts +0 -1
  116. package/es/components/productExtension/fields/Forms/index.js +12 -12
  117. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  118. package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
  119. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  120. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  121. package/es/components/productExtension/index.d.ts +0 -1
  122. package/es/components/productExtension/server.js +2 -2
  123. package/es/components/productSelect/components/TabProduct/index.d.ts +0 -1
  124. package/es/components/productSelect/components/TabProduct/index.js +4 -2
  125. package/es/components/productSelect/components/productGroup/index.d.ts +0 -1
  126. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  127. package/es/components/schedules/calendar/index.js +4 -4
  128. package/es/components/schedules/calendar/serve.js +2 -2
  129. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  130. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  131. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  132. package/es/components/schedules/components/ResourceList/index.js +1 -1
  133. package/es/components/schedules/components/Search/index.js +5 -5
  134. package/es/components/schedules/model.js +5 -5
  135. package/es/components/schedules/openHours/index.js +1 -1
  136. package/es/components/schedules/openHours/serve.js +2 -2
  137. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  138. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  139. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  140. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  141. package/es/components/schedules/products/serve.js +2 -2
  142. package/es/components/schedules/products/utils.js +5 -5
  143. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  144. package/es/components/schedules/resources/detail/index.js +10 -10
  145. package/es/components/schedules/resources/list/index.js +2 -2
  146. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  147. package/es/components/schedules/resources/serve.js +2 -2
  148. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  149. package/es/components/schedules/utils.d.ts +1 -1
  150. package/es/components/schedules/utils.js +4 -4
  151. package/es/components/selectModal/index.js +2 -2
  152. package/es/components/shoppingCart/components/Cart/index.d.ts +0 -1
  153. package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  154. package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  155. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  156. package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  157. package/es/components/ticketBooking/index.d.ts +0 -1
  158. package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
  159. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
  160. package/es/hooks/useComponents.js +1 -1
  161. package/es/utils/index.d.ts +1 -1
  162. package/lib/components/Sales/Cart/index.js +30 -18
  163. package/lib/components/Sales/Cart/types.d.ts +12 -0
  164. package/lib/components/Sales/Cart/utils.d.ts +23 -0
  165. package/lib/components/Sales/Cart/utils.js +149 -0
  166. package/lib/components/Sales/Checkout/utils.d.ts +9 -1
  167. package/lib/components/Sales/Checkout/utils.js +18 -4
  168. package/lib/components/Sales/Event/Detail.d.ts +2 -0
  169. package/lib/components/Sales/Event/Detail.js +34 -10
  170. package/lib/components/Sales/Event/serve.d.ts +10 -0
  171. package/lib/components/Sales/Event/serve.js +5 -2
  172. package/lib/components/Sales/Summary/utils.js +1 -0
  173. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +7 -2
  174. package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
  175. package/lib/components/appointmentBooking/components/Cart/Item/index.js +10 -34
  176. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  177. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +43 -6
  178. package/lib/components/appointmentBooking/components/ConfirmInformation/utils.d.ts +12 -0
  179. package/lib/components/appointmentBooking/components/ConfirmInformation/utils.js +37 -0
  180. package/lib/components/appointmentBooking/components/Content/index.js +28 -42
  181. package/lib/components/appointmentBooking/components/Content/index.less +23 -1
  182. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
  183. package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
  184. package/lib/components/appointmentBooking/components/Form/index.js +98 -54
  185. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
  186. package/lib/components/appointmentBooking/components/Header/index.js +19 -36
  187. package/lib/components/appointmentBooking/components/Resource/index.js +59 -41
  188. package/lib/components/appointmentBooking/components/Services/index.js +18 -10
  189. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +7 -1
  190. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
  191. package/lib/components/appointmentBooking/context.js +4 -48
  192. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -1
  193. package/lib/components/appointmentBooking/deposit/index.d.ts +0 -1
  194. package/lib/components/appointmentBooking/hooks.d.ts +3 -1
  195. package/lib/components/appointmentBooking/hooks.js +62 -142
  196. package/lib/components/appointmentBooking/utils.d.ts +2 -88
  197. package/lib/components/appointmentBooking/utils.js +51 -191
  198. package/lib/components/booking/components/TabProduct/index.d.ts +0 -1
  199. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
  200. package/lib/components/booking/components/voucher/index.d.ts +0 -1
  201. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  202. package/lib/components/booking/forms/single/index.d.ts +0 -1
  203. package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
  204. package/lib/components/booking/info/addServiceVariant/index.d.ts +0 -1
  205. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
  206. package/lib/components/booking/info/date/index.d.ts +0 -1
  207. package/lib/components/booking/info/dateRange/index.d.ts +0 -1
  208. package/lib/components/booking/info/service/actions/index.d.ts +0 -1
  209. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
  210. package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -1
  211. package/lib/components/booking/info/service/serviceList/index.d.ts +0 -1
  212. package/lib/components/booking/info/service2/Lists.d.ts +0 -1
  213. package/lib/components/booking/info/utils.js +1 -1
  214. package/lib/components/booking/info2/service/actions/index.d.ts +0 -1
  215. package/lib/components/booking/info2/service/addTimeModal/index.d.ts +0 -1
  216. package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
  217. package/lib/components/booking/info2/service/serviceList/index.d.ts +0 -1
  218. package/lib/components/booking/materiels/duration/index.d.ts +0 -1
  219. package/lib/components/booking/materiels/holder/index.d.ts +0 -1
  220. package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
  221. package/lib/components/booking/utils.d.ts +2 -2
  222. package/lib/components/booking/utils.js +5 -1
  223. package/lib/components/eftposPay/amount.d.ts +1 -1
  224. package/lib/components/eftposPay/device.d.ts +1 -1
  225. package/lib/components/eftposPay/hooks.d.ts +1 -1
  226. package/lib/components/eftposPay/store/index.d.ts +3 -3
  227. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  228. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +128 -42
  229. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
  230. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  231. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
  232. package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
  233. package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
  234. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
  235. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
  236. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
  237. package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
  238. package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
  239. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  240. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  241. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  242. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +3 -2
  243. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +7 -2
  244. package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
  245. package/lib/components/eventBooking/components/bookingDetailModal/index.js +79 -24
  246. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
  247. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
  248. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
  249. package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
  250. package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
  251. package/lib/components/productExtension/fields/Forms/index.d.ts +0 -1
  252. package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
  253. package/lib/components/productExtension/index.d.ts +0 -1
  254. package/lib/components/productSelect/components/TabProduct/index.d.ts +0 -1
  255. package/lib/components/productSelect/components/TabProduct/index.js +6 -2
  256. package/lib/components/productSelect/components/productGroup/index.d.ts +0 -1
  257. package/lib/components/schedules/utils.d.ts +1 -1
  258. package/lib/components/schedules/utils.js +1 -1
  259. package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -1
  260. package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
  261. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
  262. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  263. package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
  264. package/lib/components/ticketBooking/index.d.ts +0 -1
  265. package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
  266. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +0 -1
  267. package/lib/utils/index.d.ts +1 -1
  268. package/package.json +1 -1
  269. package/es/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  270. package/es/components/eventBooking/components/Provider/SelectProduct/index.js +0 -77
  271. package/es/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
  272. package/lib/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  273. package/lib/components/eventBooking/components/Provider/SelectProduct/index.js +0 -69
  274. 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;
@@ -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,20 +82,18 @@ 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;
93
+ const prevStepData = stepList[(currentStep == null ? void 0 : currentStep.index) - 1];
94
+ const currentStepData = stepList[currentStep == null ? void 0 : currentStep.index];
109
95
  if ((currentStepData == null ? void 0 : currentStepData.isSkip) || (prevStepData == null ? void 0 : prevStepData.isSkip)) {
110
96
  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
97
  updateStep(key2, {
115
98
  isSkip: false
116
99
  });
@@ -120,8 +103,8 @@ var Header = () => {
120
103
  var _a2, _b;
121
104
  appointmentBooking.destroy();
122
105
  (_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("/");
106
+ const utils = context.appHelper.utils || {};
107
+ (_b = utils == null ? void 0 : utils.history) == null ? void 0 : _b.replace("/");
125
108
  };
126
109
  return /* @__PURE__ */ import_react.default.createElement(
127
110
  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)
@@ -45,7 +45,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
45
45
  const context = (0, import_useEngineContext.default)();
46
46
  const { utils } = context.appHelper || {};
47
47
  const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
48
- const { isDateSelectedFirst } = (0, import_hooks.useAppointmentBookingSetting)();
48
+ const { isDateSelectedFirst, isRetailTemplate } = (0, import_hooks.useAppointmentBookingSetting)();
49
49
  const { getProducts, checkProductType } = (0, import_hooks.useAppointmentBookingProduct)();
50
50
  const { removeStep, nextStep } = (0, import_hooks.useAppointmentBookingStep)();
51
51
  const { currentStep } = (0, import_context.useAppointmentBookingContext)();
@@ -67,9 +67,12 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
67
67
  });
68
68
  }, [isDateSelectedFirst]);
69
69
  const handleSelectProduct = async (item) => {
70
- const type = await checkProductType(item == null ? void 0 : item.id);
71
- if (type === "session") {
72
- appointmentBooking.openProductDetail(item.id);
70
+ let type = "";
71
+ if (!isRetailTemplate) {
72
+ type = await checkProductType(item == null ? void 0 : item.id);
73
+ if (type === "session") {
74
+ appointmentBooking.openProductDetail(item.id);
75
+ }
73
76
  }
74
77
  utils == null ? void 0 : utils.action({
75
78
  type: "pisell1.productDetail",
@@ -78,6 +81,16 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
78
81
  },
79
82
  callback: async (data) => {
80
83
  var _a, _b;
84
+ const product = {
85
+ ...data,
86
+ options: (data == null ? void 0 : data.option) || []
87
+ };
88
+ delete product.option;
89
+ if (isRetailTemplate) {
90
+ if (data == null ? void 0 : data.isCancel) return;
91
+ appointmentBooking.storeProduct(product);
92
+ return;
93
+ }
81
94
  if (data == null ? void 0 : data.isCancel) {
82
95
  if (type === "session") {
83
96
  appointmentBooking.closeProductDetail();
@@ -86,11 +99,6 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
86
99
  return;
87
100
  }
88
101
  const session = data == null ? void 0 : data.session;
89
- const product = {
90
- ...data,
91
- options: (data == null ? void 0 : data.option) || []
92
- };
93
- delete product.option;
94
102
  if (session) {
95
103
  const startDate = (0, import_dayjs.default)(session == null ? void 0 : session.start_at).format("YYYY-MM-DD");
96
104
  const endDate = (0, import_dayjs.default)(session == null ? void 0 : session.end_at).format("YYYY-MM-DD");
@@ -102,7 +110,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
102
110
  }
103
111
  });
104
112
  appointmentBooking.closeProductDetail();
105
- appointmentBooking.getAvailableDate({
113
+ await appointmentBooking.getAvailableDate({
106
114
  startDate,
107
115
  endDate
108
116
  });
@@ -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;