@pisell/private-materials 3.3.76 → 3.3.78

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 (356) 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 +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/businessModel/SalesModel/Sales/index.js +37 -4
  12. package/es/components/Sales/Resource/index.js +2 -2
  13. package/es/components/Sales/Resource/serve.d.ts +7 -0
  14. package/es/components/Sales/Resource/serve.js +10 -0
  15. package/es/components/Sales/Summary/utils.d.ts +1 -1
  16. package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
  17. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  18. package/es/components/appointmentBooking/components/Cart/Item/index.js +4 -2
  19. package/es/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  20. package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
  21. package/es/components/appointmentBooking/components/Content/index.less +1 -1
  22. package/es/components/appointmentBooking/components/Date/index.js +24 -14
  23. package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
  24. package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  25. package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
  26. package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
  27. package/es/components/appointmentBooking/components/Header/index.js +8 -14
  28. package/es/components/appointmentBooking/components/Services/index.js +38 -36
  29. package/es/components/appointmentBooking/components/Voucher/index.d.ts +1 -0
  30. package/es/components/appointmentBooking/components/Voucher/index.js +13 -0
  31. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
  32. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +6 -7
  33. package/es/components/appointmentBooking/deposit/index.d.ts +1 -0
  34. package/es/components/appointmentBooking/index.d.ts +1 -0
  35. package/es/components/appointmentBooking/index.js +14 -0
  36. package/es/components/appointmentBooking/index.less +1 -1
  37. package/es/components/appointmentBooking/locales.js +3 -3
  38. package/es/components/booking/addons/index.js +12 -3
  39. package/es/components/booking/addons/model.js +5 -0
  40. package/es/components/booking/components/TabProduct/selectProductItem/index.d.ts +1 -0
  41. package/es/components/booking/components/TabProduct/selectProductItem/index.js +3 -1
  42. package/es/components/booking/components/TabProduct/selectProductItem/index.less +6 -0
  43. package/es/components/booking/components/TabProduct/tabs/index.js +5 -1
  44. package/es/components/booking/components/browserSelect/index.js +1 -1
  45. package/es/components/booking/components/footer/amount.js +2 -1
  46. package/es/components/booking/components/footer/index.d.ts +1 -0
  47. package/es/components/booking/components/footer/index.js +9 -3
  48. package/es/components/booking/components/footer/utils.js +74 -36
  49. package/es/components/booking/components/voucher/index.d.ts +1 -0
  50. package/es/components/booking/components/voucher/index.js +110 -66
  51. package/es/components/booking/components/voucher/utils.d.ts +4 -0
  52. package/es/components/booking/components/voucher/utils.js +15 -0
  53. package/es/components/booking/forms/footer.d.ts +1 -0
  54. package/es/components/booking/forms/model.js +5 -5
  55. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  56. package/es/components/booking/hooks/useClearCart.d.ts +1 -0
  57. package/es/components/booking/hooks/useQuotation.d.ts +1 -0
  58. package/es/components/booking/hooks/useQuotation.js +16 -1
  59. package/es/components/booking/info/client/index.js +12 -3
  60. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  61. package/es/components/booking/info/service/Lists.d.ts +1 -0
  62. package/es/components/booking/info/service/Lists.js +1 -1
  63. package/es/components/booking/info/service/addService/index.d.ts +1 -0
  64. package/es/components/booking/info/service/addService/index.js +3 -1
  65. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  66. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  67. package/es/components/booking/info/service/like/index.js +1 -1
  68. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  69. package/es/components/booking/info/service2/utils.js +6 -2
  70. package/es/components/booking/info/utils.js +1 -1
  71. package/es/components/booking/info2/index.js +9 -4
  72. package/es/components/booking/info2/serve.d.ts +1 -1
  73. package/es/components/booking/info2/serve.js +12 -8
  74. package/es/components/booking/info2/service/addService/index.d.ts +1 -0
  75. package/es/components/booking/info2/service/addService/index.js +5 -3
  76. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  77. package/es/components/booking/info2/service/editService/index.js +5 -2
  78. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  79. package/es/components/booking/info2/utils.d.ts +1 -1
  80. package/es/components/booking/info2/utils.js +3 -2
  81. package/es/components/booking/info2/utilsByBooking.d.ts +1 -1
  82. package/es/components/booking/info2/utilsByBooking.js +5 -3
  83. package/es/components/booking/locales.d.ts +3 -0
  84. package/es/components/booking/locales.js +6 -3
  85. package/es/components/booking/materiels/startTime/index.js +1 -1
  86. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  87. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  88. package/es/components/booking/notes/model.js +5 -5
  89. package/es/components/booking/payments/model.js +5 -5
  90. package/es/components/booking/utils.d.ts +1 -0
  91. package/es/components/booking/utils.js +4 -0
  92. package/es/components/eftposPay/amount.d.ts +1 -1
  93. package/es/components/eftposPay/device.d.ts +1 -1
  94. package/es/components/eftposPay/hooks.d.ts +1 -1
  95. package/es/components/eftposPay/store/index.d.ts +3 -3
  96. package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  97. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  98. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  99. package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
  100. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  101. package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
  102. package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
  103. package/es/components/eventBooking/components/Provider/Event/index.js +13 -4
  104. package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
  105. package/es/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
  106. package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
  107. package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
  108. package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
  109. package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
  110. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  111. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  112. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  113. package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
  114. package/es/components/eventBooking/components/bookingDetailModal/index.js +19 -3
  115. package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  116. package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
  117. package/es/components/eventBooking/index.d.ts +1 -0
  118. package/es/components/eventBooking/index.js +21 -7
  119. package/es/components/eventBooking/locales.js +3 -3
  120. package/es/components/index.d.ts +2 -1
  121. package/es/components/index.js +2 -1
  122. package/es/components/listComponent/index.js +5 -5
  123. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
  124. package/es/components/pay/toC/PaymentMethods/index.js +5 -4
  125. package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
  126. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
  127. package/es/components/pisellSelectCustomerModal/index.d.ts +1 -0
  128. package/es/components/productExtension/card/index.js +3 -3
  129. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  130. package/es/components/productExtension/fields/Forms/index.js +12 -12
  131. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  132. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  133. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  134. package/es/components/productExtension/server.js +2 -2
  135. package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
  136. package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
  137. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  138. package/es/components/schedules/calendar/index.js +4 -4
  139. package/es/components/schedules/calendar/serve.js +2 -2
  140. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  141. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  142. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  143. package/es/components/schedules/components/ResourceList/index.js +1 -1
  144. package/es/components/schedules/components/Search/index.js +5 -5
  145. package/es/components/schedules/model.js +5 -5
  146. package/es/components/schedules/openHours/index.js +1 -1
  147. package/es/components/schedules/openHours/serve.js +2 -2
  148. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  149. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  150. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  151. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  152. package/es/components/schedules/products/serve.js +2 -2
  153. package/es/components/schedules/products/utils.js +5 -5
  154. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  155. package/es/components/schedules/resources/detail/index.js +10 -10
  156. package/es/components/schedules/resources/list/index.js +2 -2
  157. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  158. package/es/components/schedules/resources/serve.js +2 -2
  159. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  160. package/es/components/schedules/utils.d.ts +1 -1
  161. package/es/components/schedules/utils.js +4 -4
  162. package/es/components/selectModal/index.js +2 -2
  163. package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  164. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  165. package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  166. package/es/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
  167. package/es/components/stepController/components/Content/index.d.ts +7 -0
  168. package/es/components/stepController/components/Content/index.js +9 -0
  169. package/es/components/stepController/components/Content/index.less +8 -0
  170. package/es/components/stepController/components/Footer/index.d.ts +8 -0
  171. package/es/components/stepController/components/Footer/index.js +15 -0
  172. package/es/components/stepController/components/Footer/index.less +39 -0
  173. package/es/components/stepController/components/Header/index.d.ts +20 -0
  174. package/es/components/stepController/components/Header/index.js +97 -0
  175. package/es/components/stepController/components/Header/index.less +21 -0
  176. package/es/components/stepController/index.d.ts +5 -0
  177. package/es/components/stepController/index.js +64 -0
  178. package/es/components/stepController/index.less +11 -0
  179. package/es/components/stepController/locales.d.ts +27 -0
  180. package/es/components/stepController/locales.js +32 -0
  181. package/es/components/stepController/types.d.ts +23 -0
  182. package/es/components/stepController/types.js +1 -0
  183. package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +1 -0
  184. package/es/components/ticketBooking/components/addServiceVariant/addService.js +46 -8
  185. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  186. package/es/components/ticketBooking/components/ticketBooking/index.js +124 -3
  187. package/es/components/ticketBooking/components/timeBar/index.d.ts +1 -0
  188. package/es/components/ticketBooking/locales.d.ts +164 -146
  189. package/es/components/ticketBooking/locales.js +195 -147
  190. package/es/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
  191. package/es/components/ticketBooking/utils/formatProductMessage.js +62 -0
  192. package/es/components/ticketBooking/utils/formatTime.d.ts +31 -0
  193. package/es/components/ticketBooking/utils/formatTime.js +144 -0
  194. package/es/components/ticketBooking/utils/index.d.ts +5 -1
  195. package/es/components/ticketBooking/utils/index.js +58 -6
  196. package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
  197. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  198. package/es/hooks/useComponents.js +1 -1
  199. package/es/hooks/useWindowSize.d.ts +5 -0
  200. package/es/hooks/useWindowSize.js +26 -0
  201. package/es/index.d.ts +1 -0
  202. package/es/index.js +2 -1
  203. package/es/utils/index.d.ts +1 -1
  204. package/lib/businessModel/SalesModel/Sales/index.js +22 -8
  205. package/lib/components/Sales/Resource/index.js +1 -1
  206. package/lib/components/Sales/Resource/serve.d.ts +7 -0
  207. package/lib/components/Sales/Resource/serve.js +9 -2
  208. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  209. package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
  210. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -0
  211. package/lib/components/appointmentBooking/components/Cart/Item/index.js +5 -4
  212. package/lib/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  213. package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
  214. package/lib/components/appointmentBooking/components/Content/index.less +1 -1
  215. package/lib/components/appointmentBooking/components/Date/index.js +12 -5
  216. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
  217. package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
  218. package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
  219. package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
  220. package/lib/components/appointmentBooking/components/Header/index.js +2 -3
  221. package/lib/components/appointmentBooking/components/Services/index.js +19 -18
  222. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +1 -0
  223. package/lib/components/appointmentBooking/components/Voucher/index.js +9 -0
  224. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
  225. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +0 -1
  226. package/lib/components/appointmentBooking/deposit/index.d.ts +1 -0
  227. package/lib/components/appointmentBooking/index.d.ts +1 -0
  228. package/lib/components/appointmentBooking/index.js +11 -0
  229. package/lib/components/appointmentBooking/index.less +1 -1
  230. package/lib/components/appointmentBooking/locales.js +3 -3
  231. package/lib/components/booking/addons/index.js +12 -2
  232. package/lib/components/booking/addons/model.js +3 -0
  233. package/lib/components/booking/components/TabProduct/selectProductItem/index.d.ts +1 -0
  234. package/lib/components/booking/components/TabProduct/selectProductItem/index.js +5 -1
  235. package/lib/components/booking/components/TabProduct/selectProductItem/index.less +6 -0
  236. package/lib/components/booking/components/footer/amount.js +2 -1
  237. package/lib/components/booking/components/footer/index.d.ts +1 -0
  238. package/lib/components/booking/components/footer/index.js +10 -5
  239. package/lib/components/booking/components/footer/utils.js +48 -12
  240. package/lib/components/booking/components/voucher/index.d.ts +1 -0
  241. package/lib/components/booking/components/voucher/index.js +111 -67
  242. package/lib/components/booking/components/voucher/utils.d.ts +4 -0
  243. package/lib/components/booking/components/voucher/utils.js +43 -0
  244. package/lib/components/booking/forms/footer.d.ts +1 -0
  245. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
  246. package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
  247. package/lib/components/booking/hooks/useQuotation.d.ts +1 -0
  248. package/lib/components/booking/hooks/useQuotation.js +19 -1
  249. package/lib/components/booking/info/client/index.js +10 -3
  250. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  251. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  252. package/lib/components/booking/info/service/Lists.js +1 -1
  253. package/lib/components/booking/info/service/addService/index.d.ts +1 -0
  254. package/lib/components/booking/info/service/addService/index.js +2 -0
  255. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  256. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  257. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  258. package/lib/components/booking/info/service2/utils.js +3 -1
  259. package/lib/components/booking/info/utils.js +1 -3
  260. package/lib/components/booking/info2/index.js +9 -9
  261. package/lib/components/booking/info2/serve.d.ts +1 -1
  262. package/lib/components/booking/info2/serve.js +1 -1
  263. package/lib/components/booking/info2/service/addService/index.d.ts +1 -0
  264. package/lib/components/booking/info2/service/addService/index.js +4 -2
  265. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  266. package/lib/components/booking/info2/service/editService/index.js +5 -2
  267. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  268. package/lib/components/booking/info2/utils.d.ts +1 -1
  269. package/lib/components/booking/info2/utils.js +2 -2
  270. package/lib/components/booking/info2/utilsByBooking.d.ts +1 -1
  271. package/lib/components/booking/info2/utilsByBooking.js +3 -2
  272. package/lib/components/booking/locales.d.ts +3 -0
  273. package/lib/components/booking/locales.js +6 -3
  274. package/lib/components/booking/utils.d.ts +1 -0
  275. package/lib/components/booking/utils.js +6 -0
  276. package/lib/components/eftposPay/amount.d.ts +1 -1
  277. package/lib/components/eftposPay/device.d.ts +1 -1
  278. package/lib/components/eftposPay/hooks.d.ts +1 -1
  279. package/lib/components/eftposPay/store/index.d.ts +3 -3
  280. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
  281. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  282. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  283. package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
  284. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
  285. package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
  286. package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
  287. package/lib/components/eventBooking/components/Provider/Event/index.js +10 -3
  288. package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
  289. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
  290. package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
  291. package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
  292. package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
  293. package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
  294. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  295. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
  296. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
  297. package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
  298. package/lib/components/eventBooking/components/bookingDetailModal/index.js +9 -3
  299. package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  300. package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
  301. package/lib/components/eventBooking/index.d.ts +1 -0
  302. package/lib/components/eventBooking/index.js +11 -7
  303. package/lib/components/eventBooking/locales.js +3 -3
  304. package/lib/components/index.d.ts +2 -1
  305. package/lib/components/index.js +3 -0
  306. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
  307. package/lib/components/pay/toC/PaymentMethods/index.js +10 -9
  308. package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
  309. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
  310. package/lib/components/pisellSelectCustomerModal/index.d.ts +1 -0
  311. package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
  312. package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
  313. package/lib/components/schedules/utils.d.ts +1 -1
  314. package/lib/components/schedules/utils.js +1 -1
  315. package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  316. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  317. package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  318. package/lib/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
  319. package/lib/components/stepController/components/Content/index.d.ts +7 -0
  320. package/lib/components/stepController/components/Content/index.js +40 -0
  321. package/lib/components/stepController/components/Content/index.less +8 -0
  322. package/lib/components/stepController/components/Footer/index.d.ts +8 -0
  323. package/lib/components/stepController/components/Footer/index.js +49 -0
  324. package/lib/components/stepController/components/Footer/index.less +39 -0
  325. package/lib/components/stepController/components/Header/index.d.ts +20 -0
  326. package/lib/components/stepController/components/Header/index.js +104 -0
  327. package/lib/components/stepController/components/Header/index.less +21 -0
  328. package/lib/components/stepController/index.d.ts +5 -0
  329. package/lib/components/stepController/index.js +89 -0
  330. package/lib/components/stepController/index.less +11 -0
  331. package/lib/components/stepController/locales.d.ts +27 -0
  332. package/lib/components/stepController/locales.js +50 -0
  333. package/lib/components/stepController/types.d.ts +23 -0
  334. package/lib/components/stepController/types.js +17 -0
  335. package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +1 -0
  336. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +42 -5
  337. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  338. package/lib/components/ticketBooking/components/ticketBooking/index.js +124 -3
  339. package/lib/components/ticketBooking/components/timeBar/index.d.ts +1 -0
  340. package/lib/components/ticketBooking/locales.d.ts +164 -146
  341. package/lib/components/ticketBooking/locales.js +22 -4
  342. package/lib/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
  343. package/lib/components/ticketBooking/utils/formatProductMessage.js +84 -0
  344. package/lib/components/ticketBooking/utils/formatTime.d.ts +31 -0
  345. package/lib/components/ticketBooking/utils/formatTime.js +139 -0
  346. package/lib/components/ticketBooking/utils/index.d.ts +5 -1
  347. package/lib/components/ticketBooking/utils/index.js +48 -5
  348. package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
  349. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  350. package/lib/hooks/useWindowSize.d.ts +5 -0
  351. package/lib/hooks/useWindowSize.js +51 -0
  352. package/lib/index.d.ts +1 -0
  353. package/lib/index.js +3 -0
  354. package/lib/utils/index.d.ts +1 -1
  355. package/lowcode/step-controller/meta.ts +88 -0
  356. package/package.json +2 -2
@@ -3,7 +3,7 @@
3
3
  flex-direction: column;
4
4
  align-items: center;
5
5
  background: #ffffff;
6
- height: 100vh;
6
+ height: calc(var(--vh, 1vh) * 100);
7
7
  overflow-y: auto;
8
8
 
9
9
  .pisell-section-headers {
@@ -132,7 +132,7 @@ var locales_default = {
132
132
  "pisell2.appointment.policy.confirm": "Confirm",
133
133
  "pisell2.appointment.resource.tip": (val) => `Tip: Change ${val || "resource"} using the dropdown in the cart.`,
134
134
  "pisell2.text.apply": "Apply",
135
- "pisell2.text.goodpass": "GoodPass",
135
+ "pisell2.text.goodpass": "Promotion",
136
136
  "pisell2.text.goodpass.product-vouchers": "Product Vouchers",
137
137
  "pisell2.text.goodpass.view-more": "View More",
138
138
  "pisell2.text.goodpass.code": "Code",
@@ -250,7 +250,7 @@ var locales_default = {
250
250
  "pisell2.appointment.policy.confirm": "确定",
251
251
  "pisell2.appointment.resource.tip": (val) => `提示:在右侧购物车中,通过下拉框修改“${val || "资源"}”`,
252
252
  "pisell2.text.apply": "应用",
253
- "pisell2.text.goodpass": "商品券",
253
+ "pisell2.text.goodpass": "促销",
254
254
  "pisell2.text.goodpass.product-vouchers": "商品兑换券",
255
255
  "pisell2.text.goodpass.view-more": "查看更多",
256
256
  "pisell2.text.goodpass.code": "券码",
@@ -368,7 +368,7 @@ var locales_default = {
368
368
  "pisell2.appointment.policy.confirm": "確定",
369
369
  "pisell2.appointment.resource.tip": (val) => `提示:在右側購物車中,透過下拉框修改“${val || "資源"}”`,
370
370
  "pisell2.text.apply": "應用",
371
- "pisell2.text.goodpass": "商品券",
371
+ "pisell2.text.goodpass": "促銷",
372
372
  "pisell2.text.goodpass.product-vouchers": "商品兌換券",
373
373
  "pisell2.text.goodpass.view-more": "查看更多",
374
374
  "pisell2.text.goodpass.code": "券碼",
@@ -106,11 +106,13 @@ var formatProductValues = (data) => {
106
106
  ...d,
107
107
  id: d.product_id,
108
108
  title: d.product_title,
109
+ isAddons: true,
109
110
  quantity: d.product_quantity,
110
111
  cover: d.product_cover,
111
112
  price: Number(d.source_product_price),
112
113
  _extend: {
113
114
  total: Number(d.selling_price),
115
+ origin_total: Number(d.selling_price),
114
116
  payment_price: Number(d.payment_price),
115
117
  price: Number(d.source_product_price),
116
118
  quantity: d.product_quantity,
@@ -214,6 +216,7 @@ var Addons = (0, import_model.Provider)((props) => {
214
216
  let _list = [...state.addons.value];
215
217
  const isSession = (0, import_utils2.isSessionProduct)(item);
216
218
  const isEject = (0, import_utils2.getIsEject)(item, type);
219
+ const isOnlySession = (0, import_utils2.getIsOnlySession)(item);
217
220
  state.action({
218
221
  type: "pisell1.handleOpenProductModal",
219
222
  data: {
@@ -226,6 +229,7 @@ var Addons = (0, import_model.Provider)((props) => {
226
229
  package: true,
227
230
  number: true
228
231
  },
232
+ isOnlySession,
229
233
  is_eject: isEject ? 1 : 0,
230
234
  isOS: isSession
231
235
  },
@@ -234,6 +238,7 @@ var Addons = (0, import_model.Provider)((props) => {
234
238
  let product = {
235
239
  ..._detail,
236
240
  _id: (0, import_utils3.getUniqueId)(),
241
+ isAddons: true,
237
242
  _key: e.key,
238
243
  _extend: {
239
244
  price: _detail.price,
@@ -244,7 +249,11 @@ var Addons = (0, import_model.Provider)((props) => {
244
249
  };
245
250
  let _total = (0, import_utils2.getProductTotalPrice)(product);
246
251
  product._extend.total = _total;
247
- let _item = _list.find((d) => d._extend.other.rowKey === e.rowKey);
252
+ product._extend.origin_total = _total;
253
+ let _item = _list.find((d) => {
254
+ var _a2;
255
+ return d._extend.other.rowKey === e.rowKey && !d.booking_id && !((_a2 = d.discount_list) == null ? void 0 : _a2.length);
256
+ });
248
257
  if (_item) {
249
258
  _item._extend.quantity = _item._extend.quantity + product.quantity;
250
259
  } else {
@@ -390,6 +399,7 @@ var Addons = (0, import_model.Provider)((props) => {
390
399
  let product = {
391
400
  ...item,
392
401
  ..._detail,
402
+ isAddons: true,
393
403
  // 编辑商品时清除折扣信息
394
404
  discount_list: [],
395
405
  _extend: {
@@ -403,8 +413,8 @@ var Addons = (0, import_model.Provider)((props) => {
403
413
  }
404
414
  let _total = (0, import_utils2.getProductTotalPrice)(product);
405
415
  product._extend.total = _total;
416
+ product._extend.origin_total = _total;
406
417
  let _list = [...state.addons.value];
407
- console.log("cacheItem", product);
408
418
  _list = _list.map((d) => d._id === product._id ? product : d);
409
419
  dispatch({
410
420
  type: "setAddons",
@@ -34,6 +34,9 @@ var { Provider, Context } = (0, import_utils.miniRedux)({
34
34
  },
35
35
  setAddons(state, payload) {
36
36
  state.setGlobalState({ addons: { ...state.addons, ...payload } });
37
+ },
38
+ setService(state, payload) {
39
+ state.setGlobalState({ service: { ...state.service, ...payload } });
37
40
  }
38
41
  }
39
42
  });
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  declare const SelectProductItem: ({ item, onClick, onChangeQuantity, amountSymbol, style, className, disabled, }: any) => JSX.Element;
3
4
  export default SelectProductItem;
@@ -101,7 +101,11 @@ var SelectProductItem = ({
101
101
  disabled
102
102
  }
103
103
  ),
104
- /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, (0, import_utils.formatAmount)(
104
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, item._extend.origin_total !== item._extend.total && /* @__PURE__ */ import_react.default.createElement("span", { className: "server-select-product-origin-total" }, (0, import_utils.formatAmount)(
105
+ item._extend.origin_total * item._extend.quantity,
106
+ 2,
107
+ amountSymbol
108
+ )), (0, import_utils.formatAmount)(
105
109
  item._extend.total * item._extend.quantity,
106
110
  2,
107
111
  amountSymbol
@@ -66,6 +66,7 @@
66
66
  font-style: normal;
67
67
  font-weight: 400;
68
68
 
69
+
69
70
  .server-select-product-total {
70
71
  color: var(--Base-Black, #000);
71
72
  font-size: 16px;
@@ -73,6 +74,11 @@
73
74
  font-weight: 500;
74
75
  line-height: 24px;
75
76
  }
77
+ .server-select-product-origin-total {
78
+ text-decoration: line-through;
79
+ color: #4e4e4e;
80
+ margin-right: 12px;
81
+ }
76
82
  }
77
83
 
78
84
 
@@ -50,7 +50,8 @@ var getProductAmount = (state, isEdit) => {
50
50
  const _duration = (0, import_utils3.isDayBookingProduct)(item, state) ? item._extend.duration : 0;
51
51
  duration += _duration;
52
52
  } else {
53
- price += Number(item._extend.total);
53
+ const quantity = item._extend.quantity || 1;
54
+ price += Number(item._extend.total) * Number(quantity);
54
55
  price += getRelationDetailsTotal(item._extend.relation_details || []);
55
56
  duration += import_utils.flexibleObj.getValue(item._extend.duration);
56
57
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  /**
3
4
  * @title: 底部
@@ -54,7 +54,7 @@ var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
54
54
  var import_utils4 = require("@pisell/utils");
55
55
  var import_dayjs = __toESM(require("dayjs"));
56
56
  var Footer = (props) => {
57
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
58
58
  const { state, buttons, dispatch, source } = props;
59
59
  const [showDetail, setShowDetail] = (0, import_react.useState)(false);
60
60
  const [loading, setLoading] = (0, import_react.useState)(false);
@@ -194,6 +194,7 @@ var Footer = (props) => {
194
194
  return false;
195
195
  }, [state, params]);
196
196
  const hasGoodPassApp = !!((_h = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _h.call(businessUtils, "goodpass"));
197
+ const hasDiscountCardApp = !!((_i = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _i.call(businessUtils, "discountcard"));
197
198
  console.log("has goodpass app:", hasGoodPassApp);
198
199
  const goCheckout = async (order_id) => {
199
200
  var _a2, _b2;
@@ -798,7 +799,7 @@ var Footer = (props) => {
798
799
  }, [
799
800
  state.bookingId,
800
801
  state.bookingDetail,
801
- (_i = state.addons) == null ? void 0 : _i.load,
802
+ (_j = state.addons) == null ? void 0 : _j.load,
802
803
  state.renderType
803
804
  ]);
804
805
  const menuChange = (e) => {
@@ -881,7 +882,7 @@ var Footer = (props) => {
881
882
  label: import_utils.locales.getText("pisell1.text.rounding")
882
883
  }
883
884
  ];
884
- }, [total, (_j = state.bookingDetail) == null ? void 0 : _j.surcharge, state, state.bookingId]);
885
+ }, [total, (_k = state.bookingDetail) == null ? void 0 : _k.surcharge, state, state.bookingId]);
885
886
  const orderTotalList = (0, import_react.useMemo)(() => {
886
887
  return [
887
888
  // 订单已付金额
@@ -915,8 +916,12 @@ var Footer = (props) => {
915
916
  label: import_utils.locales.getText("pisell2.text.refunded-amount")
916
917
  }
917
918
  ];
918
- }, [total, (_k = state.bookingDetail) == null ? void 0 : _k.surcharge, state, state.bookingId]);
919
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, hasGoodPassApp && source === "info" ? /* @__PURE__ */ import_react.default.createElement(import_voucher.default, { state, dispatch }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-total" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-total" }, totalText), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-arrears" }, arrearsText)), /* @__PURE__ */ import_react.default.createElement(
919
+ }, [total, (_l = state.bookingDetail) == null ? void 0 : _l.surcharge, state, state.bookingId]);
920
+ const paymentRefundedStatus = (0, import_react.useMemo)(() => {
921
+ var _a2;
922
+ return ["partially_refunded", "refunded"].includes((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payment_status);
923
+ }, [state == null ? void 0 : state.bookingDetail]);
924
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, (hasGoodPassApp || hasDiscountCardApp) && ["addons", "info"].includes(source) && !paymentRefundedStatus ? /* @__PURE__ */ import_react.default.createElement(import_voucher.default, { state, dispatch, source }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-total" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-total" }, totalText), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-arrears" }, arrearsText)), /* @__PURE__ */ import_react.default.createElement(
920
925
  "span",
921
926
  {
922
927
  className: "pisell-lowcode__booking-footer-right",
@@ -148,7 +148,7 @@ var checkResourcesFormat = (resources, service, isChild) => {
148
148
  return resources.map((resource) => {
149
149
  var _a;
150
150
  if (!isChild) {
151
- resource.capacity = (0, import_utilsByBooking.getSumCapacity)({ cacheItem: service });
151
+ resource.capacity = (0, import_utilsByBooking.getSumCapacity)({ cacheItem: service }, false);
152
152
  }
153
153
  checkSubResourcesCapacity(resource);
154
154
  return {
@@ -177,12 +177,16 @@ var formatResource = (service) => {
177
177
  }
178
178
  };
179
179
  var formatHolders = (state, item, values) => {
180
- var _a, _b, _c, _d, _e, _f;
180
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
181
181
  const form_id = ((_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
182
+ let form_record = ((_e = item._extend) == null ? void 0 : _e.holder_id) ? [(_f = item._extend) == null ? void 0 : _f.holder_id] : [];
183
+ if (((_g = item._extend) == null ? void 0 : _g.holder_id) && (0, import_utils5.isArr)((_h = item._extend) == null ? void 0 : _h.holder_id)) {
184
+ form_record = (_i = item._extend) == null ? void 0 : _i.holder_id;
185
+ }
182
186
  let obj = {
183
187
  customer_id: values.customer_id,
184
188
  form_id,
185
- form_record: ((_e = item._extend) == null ? void 0 : _e.holder_id) ? [(_f = item._extend) == null ? void 0 : _f.holder_id] : []
189
+ form_record
186
190
  };
187
191
  if (state.isFranchisee) {
188
192
  obj.is_source_shop = 1;
@@ -217,7 +221,7 @@ var formatMetaData = (item) => {
217
221
  }
218
222
  return metadata;
219
223
  };
220
- var formatProducts = (item) => {
224
+ var formatProducts = (item, quantity) => {
221
225
  var _a, _b, _c, _d, _e, _f, _g;
222
226
  const total = Number(item._extend.total);
223
227
  const origin_total = Number(item._extend.origin_total);
@@ -226,7 +230,7 @@ var formatProducts = (item) => {
226
230
  const discount_type = discount_amount < 0 ? "change_price" : "discount";
227
231
  const notManualDiscount = discount_list.filter((item2) => item2.type !== "product");
228
232
  return {
229
- "num": item._extend.quantity,
233
+ "num": quantity || item._extend.quantity,
230
234
  "price": formatProductPrice(item),
231
235
  "source_product_price": (_a = item._extend) == null ? void 0 : _a.price,
232
236
  "product_id": (item == null ? void 0 : item.product_id) || item.id,
@@ -268,6 +272,13 @@ var formatAppointmentProductLists = (data) => {
268
272
  } catch (error) {
269
273
  }
270
274
  };
275
+ var getHolderByIndex = (holder, index) => {
276
+ var _a;
277
+ return {
278
+ ...holder,
279
+ form_record: [(_a = holder == null ? void 0 : holder.form_record) == null ? void 0 : _a[index]].filter(Boolean)
280
+ };
281
+ };
271
282
  var formatBookings = (data, values) => {
272
283
  const isDay = (0, import_utils4.isDaysBooking)(data);
273
284
  const isEvent = (0, import_utils4.isEventBooking)(data);
@@ -287,7 +298,7 @@ var formatBookings = (data, values) => {
287
298
  let dayParams = {};
288
299
  const eventOtherParams = data.eventOtherParams;
289
300
  let bookings = [];
290
- bookings = list.map((item) => {
301
+ list.forEach((item) => {
291
302
  var _a, _b, _c, _d;
292
303
  let start_date = item._extend.startDate.format("YYYY-MM-DD");
293
304
  let end_date = item._extend.endDate.format("YYYY-MM-DD");
@@ -309,7 +320,7 @@ var formatBookings = (data, values) => {
309
320
  dayParams.holder = formatHolders(data, item, values);
310
321
  dayParams.duration = (0, import_utils3.getDays)({ _extend: { start_date: startDateTime, end_date: endDateTime } }, "minutes");
311
322
  }
312
- return {
323
+ const booking = {
313
324
  "product": formatProducts(item),
314
325
  "relation_products": formatRelationDetails(item._extend.relation_details),
315
326
  "id": item.booking_id || 0,
@@ -331,6 +342,18 @@ var formatBookings = (data, values) => {
331
342
  ...eventOtherParams || {},
332
343
  ...dayParams
333
344
  };
345
+ if (isDay) {
346
+ bookings.push(booking);
347
+ return;
348
+ }
349
+ for (let i = 0; i < (item._extend.quantity || 1); i++) {
350
+ bookings.push({
351
+ ...booking,
352
+ "product": formatProducts(item, 1),
353
+ "number": item._extend.capacity ? (0, import_utilsByBooking.getSumCapacity)({ cacheItem: item }, false) : item._extend.number || 1,
354
+ "holder": getHolderByIndex(booking.holder, i)
355
+ });
356
+ }
334
357
  });
335
358
  return bookings;
336
359
  };
@@ -375,7 +398,7 @@ var formatHolder = (state, values) => {
375
398
  return obj;
376
399
  };
377
400
  var formatValues = (state) => {
378
- var _a, _b, _c, _d, _e, _f;
401
+ var _a, _b, _c, _d, _e, _f, _g;
379
402
  let values = {
380
403
  type: state.renderType === "eventBooking" ? "event_booking_v2" : "appointment_booking",
381
404
  platform: "shop",
@@ -409,17 +432,20 @@ var formatValues = (state) => {
409
432
  values.relation_products = formatRelationProducts(state);
410
433
  } else {
411
434
  values.relation_products = formatNormalProducts(state);
435
+ if (!((_b = values.relation_products) == null ? void 0 : _b.length)) {
436
+ values.relation_products = void 0;
437
+ }
412
438
  }
413
439
  values.bookings = formatBookings(state, values);
414
- if (((_c = (_b = values == null ? void 0 : values.bookings) == null ? void 0 : _b[0]) == null ? void 0 : _c.select_date) && !(state == null ? void 0 : state.bookingId)) {
415
- let startTime = `${(_e = (_d = values == null ? void 0 : values.bookings) == null ? void 0 : _d[0]) == null ? void 0 : _e.start_time}`;
440
+ if (((_d = (_c = values == null ? void 0 : values.bookings) == null ? void 0 : _c[0]) == null ? void 0 : _d.select_date) && !(state == null ? void 0 : state.bookingId)) {
441
+ let startTime = `${(_f = (_e = values == null ? void 0 : values.bookings) == null ? void 0 : _e[0]) == null ? void 0 : _f.start_time}`;
416
442
  startTime = `${startTime || "00:00"}:00`;
417
443
  values.schedule_date = `${values.bookings[0].select_date} ${startTime}`;
418
444
  }
419
445
  if (isDay) {
420
446
  values.metadata.is_multiday_appointment = 1;
421
447
  }
422
- if (!((_f = values == null ? void 0 : values.bookings) == null ? void 0 : _f.length)) {
448
+ if (!((_g = values == null ? void 0 : values.bookings) == null ? void 0 : _g.length)) {
423
449
  values.type = "virtual";
424
450
  }
425
451
  return values;
@@ -427,7 +453,17 @@ var formatValues = (state) => {
427
453
  var checkHolderIsError = (state) => {
428
454
  var _a, _b;
429
455
  const holderError = state.service.value.some((item) => {
430
- return !item._extend.holder_id && !(0, import_utils4.isNormalProductByDurationSchedule)(item);
456
+ var _a2, _b2;
457
+ if ((0, import_utils4.isNormalProductByDurationSchedule)(item)) {
458
+ return false;
459
+ }
460
+ if (item._extend.quantity === 1 && !item._extend.holder_id) {
461
+ return true;
462
+ }
463
+ if (item._extend.quantity > 1 && ((_b2 = (_a2 = item._extend) == null ? void 0 : _a2.holder_id) == null ? void 0 : _b2.length) !== item._extend.quantity) {
464
+ return true;
465
+ }
466
+ return false;
431
467
  });
432
468
  const clientId = (_b = (_a = state.client) == null ? void 0 : _a.value) == null ? void 0 : _b.id;
433
469
  if (holderError && (!clientId || clientId === 0 || clientId === 1)) {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const VoucherCard: (props: any) => JSX.Element | null;
3
4
  export default VoucherCard;
@@ -42,6 +42,7 @@ var import_materials = require("@pisell/materials");
42
42
  var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
43
43
  var import_index = require("./index.less");
44
44
  var import_ahooks = require("ahooks");
45
+ var import_utils2 = require("./utils");
45
46
  var ShopDiscountHooks = {
46
47
  onInited: "shopDiscount:onInited",
47
48
  onDestroy: "shopDiscount:onDestroy",
@@ -54,37 +55,33 @@ var ShopDiscountHooks = {
54
55
  };
55
56
  var services = {};
56
57
  var VoucherCard = (props) => {
57
- var _a, _b;
58
+ var _a, _b, _c, _d;
58
59
  const context = (0, import_useEngineContext.default)();
59
- const { state, dispatch } = props;
60
+ const { state, dispatch, source } = props;
60
61
  const [showDetail, setShowDetail] = (0, import_react.useState)(false);
61
62
  const { pisellos } = (_a = context.appHelper) == null ? void 0 : _a.utils;
62
63
  const [code, setCode] = (0, import_react.useState)("");
63
64
  const [discountList, setDisCountList] = (0, import_react.useState)([]);
64
- const productRef = (0, import_react.useRef)(state.service.value);
65
+ const serviceValueRef = (0, import_react.useRef)(state.service.value);
66
+ const addonsValueRef = (0, import_react.useRef)(state.addons.value);
65
67
  const isBooking4Shop = (0, import_useIsBooking4Shop.useIsBooking4Shop)(state);
66
68
  const shopDiscount = pisellos.getModule("shopDiscount");
67
69
  services = state.service;
68
- const availableData = (0, import_react.useMemo)(() => {
69
- if (!isBooking4Shop) return [];
70
- const shopDiscount2 = pisellos.getModule("shopDiscount");
71
- return discountList.filter((item) => !!item.isAvailable).map((discount) => {
72
- return {
73
- ...discount,
74
- savedAmount: shopDiscount2.calcDiscountApplicableProductTotalPrice(discount)
75
- };
76
- });
77
- }, [discountList, isBooking4Shop]);
78
- (0, import_react.useEffect)(() => {
70
+ (0, import_ahooks.useDebounceEffect)(() => {
79
71
  if (isBooking4Shop) {
80
72
  shopDiscount.setCustomer(state.client.value);
81
73
  }
82
- }, [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop]);
74
+ }, [(_b = state.client.value) == null ? void 0 : _b.id, isBooking4Shop], {
75
+ wait: 200
76
+ });
83
77
  (0, import_react.useEffect)(() => {
84
78
  if (isBooking4Shop) {
85
- shopDiscount.setProductList(state.service.value);
79
+ shopDiscount.setProductList([
80
+ ...state.service.value,
81
+ ...state.addons.value
82
+ ]);
86
83
  }
87
- }, [state.service.value, isBooking4Shop]);
84
+ }, [state.service.value, state.addons.value, isBooking4Shop]);
88
85
  const serviceMemo = (0, import_react.useMemo)(() => {
89
86
  var _a2;
90
87
  const val = (_a2 = state.service.value || []) == null ? void 0 : _a2.map((value) => {
@@ -92,7 +89,6 @@ var VoucherCard = (props) => {
92
89
  return {
93
90
  booking_id: value.booking_id,
94
91
  id: value.id,
95
- _id: value._id,
96
92
  price: value.price,
97
93
  total: (_a3 = value == null ? void 0 : value._extend) == null ? void 0 : _a3.total,
98
94
  discount_list: value.discount_list,
@@ -101,89 +97,141 @@ var VoucherCard = (props) => {
101
97
  });
102
98
  return val;
103
99
  }, [state.service.value]);
100
+ const addonsMemo = (0, import_react.useMemo)(() => {
101
+ var _a2;
102
+ const val = (_a2 = state.addons.value || []) == null ? void 0 : _a2.map((value) => {
103
+ var _a3, _b2;
104
+ return {
105
+ booking_id: value.booking_id,
106
+ id: value.id,
107
+ _id: value._id,
108
+ price: value.price,
109
+ total: (_a3 = value == null ? void 0 : value._extend) == null ? void 0 : _a3.total,
110
+ discount_list: value.discount_list,
111
+ _key: value._key,
112
+ num: (_b2 = value == null ? void 0 : value._extend) == null ? void 0 : _b2.quantity
113
+ };
114
+ });
115
+ return val;
116
+ }, [state.addons.value]);
117
+ const disabled = (0, import_react.useMemo)(() => {
118
+ var _a2;
119
+ if (["paid", "partially_paid"].includes((_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_status) && [...addonsMemo, ...serviceMemo].every((item) => item.booking_id)) {
120
+ return true;
121
+ }
122
+ return false;
123
+ }, [state, addonsMemo, serviceMemo]);
104
124
  const { run } = (0, import_ahooks.useDebounceFn)(
105
125
  () => {
106
126
  var _a2, _b2;
107
- if (productRef.current === state.service.value || !((_b2 = (_a2 = state.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length)) {
127
+ if (serviceValueRef.current === state.service.value && addonsValueRef.current === state.addons.value || !((_b2 = (_a2 = state.service) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length)) {
108
128
  return;
109
129
  }
110
130
  if (isBooking4Shop) {
111
- const val = shopDiscount.calcDiscount(state.service.value);
112
- productRef.current = val.productList;
113
- dispatch({
114
- type: "setService",
115
- payload: {
116
- ...services,
117
- value: ((val == null ? void 0 : val.productList) || []).filter(Boolean)
118
- }
119
- });
131
+ const val = shopDiscount.calcDiscount([
132
+ ...state.service.value,
133
+ ...state.addons.value
134
+ ]);
135
+ console.log("input: ", state.service.value);
136
+ console.log("output: ", val);
137
+ productListToValue(val.productList);
120
138
  }
121
139
  },
122
140
  { wait: 500 }
123
141
  );
124
142
  (0, import_react.useEffect)(() => {
125
143
  run();
126
- }, [JSON.stringify(serviceMemo), isBooking4Shop]);
144
+ }, [JSON.stringify(serviceMemo), JSON.stringify(addonsMemo), isBooking4Shop]);
127
145
  const fn = (0, import_ahooks.useMemoizedFn)((result) => {
128
146
  var _a2;
129
147
  if (!(result == null ? void 0 : result.productList) || ((_a2 = result == null ? void 0 : result.productList) == null ? void 0 : _a2.some((item) => !item))) {
130
148
  return;
131
149
  }
132
- dispatch({
133
- type: "setService",
134
- payload: {
135
- ...services,
136
- value: result.productList
137
- }
138
- });
150
+ productListToValue(result.productList);
139
151
  });
140
152
  (0, import_react.useEffect)(() => {
141
153
  if (!isBooking4Shop) return;
154
+ const onScanCustomerChange = (customer) => {
155
+ dispatch({
156
+ type: "setClient",
157
+ payload: {
158
+ value: customer
159
+ }
160
+ });
161
+ };
162
+ const onDiscountListChange = (discount) => {
163
+ setDisCountList(discount);
164
+ };
142
165
  pisellos.effects.on(
143
166
  ShopDiscountHooks.onScanCustomerChange,
144
- (customer) => {
145
- dispatch({
146
- type: "setClient",
147
- payload: {
148
- value: customer
149
- }
150
- });
151
- }
167
+ onScanCustomerChange
152
168
  );
153
169
  pisellos.effects.on(ShopDiscountHooks.onLoadPrepareCalcResult, fn);
154
170
  pisellos.effects.on(
155
171
  ShopDiscountHooks.onDiscountListChange,
156
- (discount) => {
157
- setDisCountList(discount);
158
- }
172
+ onDiscountListChange
159
173
  );
160
174
  return () => {
161
175
  shopDiscount.clear();
162
- pisellos.effects.off(ShopDiscountHooks.onCustomerChange);
163
- pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult);
164
- pisellos.effects.off(ShopDiscountHooks.onDiscountListChange);
176
+ pisellos.effects.off(ShopDiscountHooks.onCustomerChange, onScanCustomerChange);
177
+ pisellos.effects.off(ShopDiscountHooks.onLoadPrepareCalcResult, fn);
178
+ pisellos.effects.off(ShopDiscountHooks.onDiscountListChange, onDiscountListChange);
165
179
  };
166
180
  }, [state.bookingId, isBooking4Shop, fn]);
181
+ const productListToValue = (0, import_ahooks.useMemoizedFn)((list, edit) => {
182
+ const { serviceList, addonsList } = (0, import_utils2.getServiceAddons)(list);
183
+ serviceValueRef.current = serviceList;
184
+ addonsValueRef.current = addonsList;
185
+ let other = {};
186
+ if (edit) {
187
+ other = {
188
+ edit: true
189
+ };
190
+ }
191
+ dispatch({
192
+ type: "setService",
193
+ payload: {
194
+ value: serviceList,
195
+ ...other
196
+ }
197
+ });
198
+ dispatch({
199
+ type: "setAddons",
200
+ payload: {
201
+ value: addonsList,
202
+ ...other
203
+ }
204
+ });
205
+ });
167
206
  const onScanCode = async () => {
168
207
  const val = await shopDiscount.scanCode(code);
169
208
  console.log(val);
170
209
  if (val == null ? void 0 : val.isAvailable) {
171
- productRef.current = val.productList;
172
- dispatch({
173
- type: "setService",
174
- payload: {
175
- value: val.productList,
176
- edit: true
177
- }
178
- });
210
+ productListToValue(val.productList, true);
179
211
  setCode("");
180
212
  } else {
181
213
  (0, import_materials.PisellToast)({
182
- content: import_utils.locales.getText("pisell2.text.goodpass.code-invalid")
214
+ content: val.type === "server" ? import_utils.locales.getText("pisell2.text.goodpass.code-invalid") : import_utils.locales.getText("pisell2.text.goodpass.code-invalid-cart")
183
215
  });
184
216
  }
185
217
  };
218
+ const availableData = (0, import_react.useMemo)(() => {
219
+ if (!isBooking4Shop) return [];
220
+ const shopDiscount2 = pisellos.getModule("shopDiscount");
221
+ return discountList.filter((item) => !!item.isAvailable).map((discount) => {
222
+ return {
223
+ ...discount,
224
+ isDisabled: discount.isDisabled || discount.isDisabledForProductUsed || disabled,
225
+ savedAmount: shopDiscount2.calcDiscountApplicableProductTotalPrice(discount)
226
+ };
227
+ });
228
+ }, [discountList, isBooking4Shop, disabled]);
186
229
  if (!isBooking4Shop) return null;
230
+ const mixedSort = (val) => {
231
+ return [...val].sort((a, b) => {
232
+ return Number(b == null ? void 0 : b.isSelected) - Number(a == null ? void 0 : a.isSelected);
233
+ });
234
+ };
187
235
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-voucher-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-title" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "voucher-title-left" }, import_utils.locales.getText("pisell2.text.goodpass")), /* @__PURE__ */ import_react.default.createElement(
188
236
  "span",
189
237
  {
@@ -214,7 +262,8 @@ var VoucherCard = (props) => {
214
262
  import_materials.PisellGoodPassCard,
215
263
  {
216
264
  style: { width: "100%" },
217
- dataSource: availableData,
265
+ dataSource: ((_d = (_c = state.service) == null ? void 0 : _c.value) == null ? void 0 : _d.length) ? availableData : [],
266
+ mixedSort,
218
267
  onChange: (val) => {
219
268
  const shopDiscount2 = pisellos.getModule("shopDiscount");
220
269
  const detail = shopDiscount2.setDiscountSelected({
@@ -222,13 +271,7 @@ var VoucherCard = (props) => {
222
271
  isSelected: val.isSelected
223
272
  });
224
273
  console.log("setDiscountSelected:", detail);
225
- dispatch({
226
- type: "setService",
227
- payload: {
228
- edit: true,
229
- value: detail.productList
230
- }
231
- });
274
+ productListToValue(detail.productList, true);
232
275
  }
233
276
  }
234
277
  ) : null,
@@ -241,6 +284,7 @@ var VoucherCard = (props) => {
241
284
  setCode((_a2 = e.target) == null ? void 0 : _a2.value);
242
285
  },
243
286
  size: "small",
287
+ allowClear: true,
244
288
  placeholder: import_utils.locales.getText("pisell2.text.goodpass.enter-code")
245
289
  }
246
290
  )), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { size: "small", onClick: onScanCode, disabled: !code }, import_utils.locales.getText("pisell2.text.apply")))
@@ -0,0 +1,4 @@
1
+ export declare const getServiceAddons: (list: any[]) => {
2
+ serviceList: any[];
3
+ addonsList: any[];
4
+ };