@licklist/design 0.67.6 → 0.68.0-dev.0

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 (300) hide show
  1. package/.storybook/main.cjs +15 -12
  2. package/dist/auth/Login/LoginComponent.js +2 -1
  3. package/dist/calendar/Calendar.d.ts +1 -1
  4. package/dist/calendar/Calendar.d.ts.map +1 -1
  5. package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
  6. package/dist/calendar/components/CalendarButtons/CalendarButtons.js +35 -40
  7. package/dist/calendar/utils/index.d.ts +2 -2
  8. package/dist/calendar/utils/index.d.ts.map +1 -1
  9. package/dist/calendar/utils/index.js +20 -4
  10. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +2 -1
  11. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  12. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +4 -4
  13. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -2
  14. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  15. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +27 -26
  16. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -2
  17. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
  18. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +3 -3
  19. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  20. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  21. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  22. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
  23. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  24. package/dist/index.js +1 -0
  25. package/dist/layout/DropDown.d.ts +2 -1
  26. package/dist/layout/DropDown.d.ts.map +1 -1
  27. package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
  28. package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
  29. package/dist/modals/confirmation/ConfirmModal.js +172 -8
  30. package/dist/product-set/card/ProductSetCard.d.ts +6 -2
  31. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  32. package/dist/product-set/card/ProductSetCard.js +30 -11
  33. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +3 -2
  34. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  35. package/dist/product-set/control/DateAndRecurrenceInput.js +3 -1
  36. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  37. package/dist/product-set/control/DateInput.js +2 -2
  38. package/dist/product-set/control/ProductSetControl.d.ts +3 -3
  39. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  40. package/dist/product-set/control/ProductSetControl.js +4 -16
  41. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  42. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  43. package/dist/product-set/form/ProductSetForm.d.ts +6 -2
  44. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  45. package/dist/product-set/form/ProductSetForm.js +65 -5
  46. package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
  47. package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
  48. package/dist/product-set/form/ProductSetNameControl.js +35 -0
  49. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  50. package/dist/product-set/form/ProductZonesControl.js +0 -2
  51. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  52. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  53. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  54. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  55. package/dist/product-set/form/SubProductsControl.js +0 -3
  56. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  57. package/dist/product-set/form/VenueMapsControl.js +0 -3
  58. package/dist/product-set/form/index.d.ts +1 -0
  59. package/dist/product-set/form/index.d.ts.map +1 -1
  60. package/dist/product-set/utils/index.d.ts +7 -0
  61. package/dist/product-set/utils/index.d.ts.map +1 -1
  62. package/dist/product-set/utils/index.js +10 -1
  63. package/dist/provider/location-input/LocationInput.d.ts +4 -1
  64. package/dist/provider/location-input/LocationInput.d.ts.map +1 -1
  65. package/dist/provider/location-input/LocationInput.js +41 -2
  66. package/dist/provider/location-input/LocationInputDescription.d.ts +4 -1
  67. package/dist/provider/location-input/LocationInputDescription.d.ts.map +1 -1
  68. package/dist/provider/location-input/LocationInputDescription.js +27 -12
  69. package/dist/provider/location-input/index.d.ts +1 -0
  70. package/dist/provider/location-input/index.d.ts.map +1 -1
  71. package/dist/provider/provider-form/ProviderForm.d.ts +3 -1
  72. package/dist/provider/provider-form/ProviderForm.d.ts.map +1 -1
  73. package/dist/provider/provider-form/ProviderForm.js +7 -3
  74. package/dist/provider/venue-form/VenueForm.d.ts +3 -1
  75. package/dist/provider/venue-form/VenueForm.d.ts.map +1 -1
  76. package/dist/provider/venue-form/VenueForm.js +7 -3
  77. package/dist/provider/working-hours-input/WorkingHoursInput.d.ts.map +1 -1
  78. package/dist/provider/working-hours-input/WorkingHoursInput.js +2 -2
  79. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  80. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +8 -14
  81. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +2 -1
  82. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
  83. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +7 -13
  84. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +4 -1
  85. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  86. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +7 -3
  87. package/dist/recurring-date-picker-input/utils.d.ts +5 -0
  88. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  89. package/dist/recurring-date-picker-input/utils.js +83 -3
  90. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  91. package/dist/sales/booking/results/components/ResultCard.js +4 -7
  92. package/dist/sales/guest-profile/previous-bookings/PreviousBookings.js +1 -1
  93. package/dist/sales/manual-booking/formatDays.js +3 -3
  94. package/dist/sales/manual-booking/select-event/SelectEvent.d.ts.map +1 -1
  95. package/dist/sales/manual-booking/select-event/SelectEvent.js +3 -3
  96. package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
  97. package/dist/sales/manual-booking/summary/ManualBookingSummary.js +2 -2
  98. package/dist/sales/notes/NotesTableRow.js +3 -4
  99. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  100. package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
  101. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  102. package/dist/snippet/snippet-template/preview/Preview.js +6 -0
  103. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  104. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  105. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  106. package/dist/styles/auth/AccessDenied.scss +1 -1
  107. package/dist/styles/back-button/BackButton.scss +25 -24
  108. package/dist/styles/back-button/_index.scss +1 -1
  109. package/dist/styles/company-user-form/UserForm.scss +4 -7
  110. package/dist/styles/company-user-form/_index.scss +1 -1
  111. package/dist/styles/custom-fields/CreateSortableListItem.scss +2 -1
  112. package/dist/styles/custom-fields/_index.scss +1 -1
  113. package/dist/styles/customers/Filter.scss +5 -5
  114. package/dist/styles/events/EditEventModal.scss +1 -3
  115. package/dist/styles/events/EventVenueMap.scss +7 -7
  116. package/dist/styles/form/Input.scss +1 -1
  117. package/dist/styles/header/Header.scss +1 -1
  118. package/dist/styles/header/elements/CompanySelector.scss +2 -2
  119. package/dist/styles/iframe-events/Calendar.scss +0 -1
  120. package/dist/styles/iframe-events/CalendarSelect.scss +1 -1
  121. package/dist/styles/iframe-events/CategoryStepsForm.scss +6 -7
  122. package/dist/styles/iframe-events/Event.scss +2 -4
  123. package/dist/styles/iframe-events/EventForm.scss +54 -54
  124. package/dist/styles/iframe-events/EventNavigationFooter.scss +1 -0
  125. package/dist/styles/iframe-events/TicketDescription.scss +1 -1
  126. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  127. package/dist/styles/iframe-payments/PaymentForm.scss +1 -1
  128. package/dist/styles/layout/BackgroundVideoContainer.scss +2 -2
  129. package/dist/styles/notification/Notification.scss +1 -1
  130. package/dist/styles/order-items-table/OrderItemsTable.scss +1 -2
  131. package/dist/styles/product-set/CreateProductSetItem.scss +15 -13
  132. package/dist/styles/product-set/DateAndRecurrenceInput.scss +6 -8
  133. package/dist/styles/product-set/EditCategoryModal.scss +4 -4
  134. package/dist/styles/product-set/EditProductModal.scss +3 -3
  135. package/dist/styles/product-set/EditStepModal.scss +4 -4
  136. package/dist/styles/product-set/EditVenueMapSetModal.scss +6 -6
  137. package/dist/styles/product-set/ProductSetForm.scss +25 -2
  138. package/dist/styles/product-set/TutorialGifCard.scss +1 -1
  139. package/dist/styles/product-set/_index.scss +2 -2
  140. package/dist/styles/report/ReportCard.scss +1 -0
  141. package/dist/styles/report/_index.scss +1 -1
  142. package/dist/styles/resources-blocking/_index.scss +4 -0
  143. package/dist/styles/sales/BookingFilter.scss +2 -2
  144. package/dist/styles/sales/BookingResults.scss +1 -1
  145. package/dist/styles/sales/BookingTabs.scss +7 -5
  146. package/dist/styles/sales/Filters.scss +5 -4
  147. package/dist/styles/sales/GuestProfile.scss +170 -175
  148. package/dist/styles/sales/LifeTimeSales.scss +1 -1
  149. package/dist/styles/sales/ManualBooking.scss +4 -2
  150. package/dist/styles/snippet-templates/_snippetVariables.scss +63 -244
  151. package/dist/styles/sortable-field/SortableField.scss +16 -16
  152. package/dist/styles/sortable-field/_index.scss +1 -1
  153. package/dist/styles/sortable-tree/Item.scss +4 -4
  154. package/dist/styles/table/Table.scss +1 -1
  155. package/dist/styles/themes/bookedit/_variables.scss +10 -32
  156. package/dist/styles/themes/licklist/_variables.scss +1 -1
  157. package/dist/styles/tiptap-editor/TiptapEditor.scss +9 -10
  158. package/dist/styles/tiptap-editor/_index.scss +1 -1
  159. package/dist/styles/venue-map-sets/VenueMapSetForm.scss +5 -4
  160. package/dist/styles/virtualized/_index.scss +1 -1
  161. package/dist/styles/zones/ZoneForm.scss +1 -0
  162. package/dist/styles/zones/ZoneRecurrencesControl.scss +6 -8
  163. package/dist/typeahead/Typeahead.d.ts +5 -1
  164. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  165. package/dist/typeahead/Typeahead.js +9 -2
  166. package/dist/zone/form/ZoneForm.d.ts +3 -2
  167. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  168. package/dist/zone/form/ZoneForm.js +4 -2
  169. package/dist/zone/form/components/ZoneControl.d.ts +3 -2
  170. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  171. package/dist/zone/form/components/ZoneControl.js +5 -2
  172. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +5 -4
  173. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  174. package/dist/zone/form/components/ZoneRecurrencesControl.js +5 -2
  175. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  176. package/package.json +11 -11
  177. package/src/auth/ChangePassword/ChangePassword.stories.tsx +1 -1
  178. package/src/auth/Login/LoginComponent.tsx +1 -1
  179. package/src/auth/ResetPassword/ResetPassword.stories.tsx +1 -1
  180. package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +31 -28
  181. package/src/calendar/utils/index.ts +26 -4
  182. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -2
  183. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +35 -37
  184. package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +3 -3
  185. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  186. package/src/header/elements/Elements.stories.tsx +1 -1
  187. package/src/help/popover/Popover.stories.tsx +1 -1
  188. package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +3 -3
  189. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
  190. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  191. package/src/layout/DropDown.tsx +2 -1
  192. package/src/modals/confirmation/ConfirmModal.tsx +19 -3
  193. package/src/product-set/card/ProductSetCard.stories.tsx +3 -1
  194. package/src/product-set/card/ProductSetCard.tsx +47 -8
  195. package/src/product-set/control/DateAndRecurrenceInput.tsx +6 -4
  196. package/src/product-set/control/DateInput.tsx +2 -1
  197. package/src/product-set/control/ProductSetControl.tsx +4 -15
  198. package/src/product-set/control/ProductSetRecurrenceControl.stories.tsx +2 -2
  199. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  200. package/src/product-set/form/ProductSetForm.tsx +25 -3
  201. package/src/product-set/form/ProductSetNameControl.tsx +27 -0
  202. package/src/product-set/form/ProductZonesControl.tsx +4 -7
  203. package/src/product-set/form/SelectCategoryModal.stories.tsx +1 -1
  204. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  205. package/src/product-set/form/SubProductsControl.tsx +0 -3
  206. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  207. package/src/product-set/form/index.ts +1 -0
  208. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +5 -5
  209. package/src/product-set/product/booking-management/ProductBookingManagement.stories.tsx +1 -1
  210. package/src/product-set/product/quantity/ProductQuantity.stories.tsx +1 -1
  211. package/src/product-set/product-zone/ProductZoneControl.tsx +9 -9
  212. package/src/product-set/utils/index.ts +11 -0
  213. package/src/provider/location-input/LocationInput.tsx +36 -1
  214. package/src/provider/location-input/LocationInputDescription.tsx +23 -11
  215. package/src/provider/location-input/index.ts +1 -0
  216. package/src/provider/provider-form/ProviderForm.tsx +7 -2
  217. package/src/provider/venue-form/VenueForm.tsx +5 -2
  218. package/src/provider/working-hours-input/WorkingHoursInput.tsx +15 -6
  219. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +11 -30
  220. package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +8 -22
  221. package/src/recurring-date-picker-input/RecurringDatePickerInput.stories.tsx +11 -4
  222. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +17 -3
  223. package/src/recurring-date-picker-input/utils.ts +97 -1
  224. package/src/sales/booking/results/components/ResultCard.tsx +4 -10
  225. package/src/sales/guest-profile/previous-bookings/PreviousBookings.tsx +1 -1
  226. package/src/sales/manual-booking/formatDays.ts +3 -3
  227. package/src/sales/manual-booking/select-event/SelectEvent.tsx +2 -2
  228. package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +2 -2
  229. package/src/sales/notes/NotesTableRow.tsx +3 -3
  230. package/src/setting/admin/AdminSetting.stories.tsx +1 -0
  231. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  232. package/src/setting/system/SystemSetting.stories.tsx +1 -1
  233. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  234. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  235. package/src/styles/auth/AccessDenied.scss +1 -1
  236. package/src/styles/back-button/BackButton.scss +25 -24
  237. package/src/styles/back-button/_index.scss +1 -1
  238. package/src/styles/company-user-form/UserForm.scss +4 -7
  239. package/src/styles/company-user-form/_index.scss +1 -1
  240. package/src/styles/custom-fields/CreateSortableListItem.scss +2 -1
  241. package/src/styles/custom-fields/_index.scss +1 -1
  242. package/src/styles/customers/Filter.scss +5 -5
  243. package/src/styles/events/EditEventModal.scss +1 -3
  244. package/src/styles/events/EventVenueMap.scss +7 -7
  245. package/src/styles/form/Input.scss +1 -1
  246. package/src/styles/header/Header.scss +1 -1
  247. package/src/styles/header/elements/CompanySelector.scss +2 -2
  248. package/src/styles/iframe-events/Calendar.scss +0 -1
  249. package/src/styles/iframe-events/CalendarSelect.scss +1 -1
  250. package/src/styles/iframe-events/CategoryStepsForm.scss +6 -7
  251. package/src/styles/iframe-events/Event.scss +2 -4
  252. package/src/styles/iframe-events/EventForm.scss +54 -54
  253. package/src/styles/iframe-events/EventNavigationFooter.scss +1 -0
  254. package/src/styles/iframe-events/TicketDescription.scss +1 -1
  255. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  256. package/src/styles/iframe-payments/PaymentForm.scss +1 -1
  257. package/src/styles/layout/BackgroundVideoContainer.scss +2 -2
  258. package/src/styles/notification/Notification.scss +1 -1
  259. package/src/styles/order-items-table/OrderItemsTable.scss +1 -2
  260. package/src/styles/product-set/CreateProductSetItem.scss +15 -13
  261. package/src/styles/product-set/DateAndRecurrenceInput.scss +6 -8
  262. package/src/styles/product-set/EditCategoryModal.scss +4 -4
  263. package/src/styles/product-set/EditProductModal.scss +3 -3
  264. package/src/styles/product-set/EditStepModal.scss +4 -4
  265. package/src/styles/product-set/EditVenueMapSetModal.scss +6 -6
  266. package/src/styles/product-set/ProductSetForm.scss +25 -2
  267. package/src/styles/product-set/TutorialGifCard.scss +1 -1
  268. package/src/styles/product-set/_index.scss +2 -2
  269. package/src/styles/report/ReportCard.scss +1 -0
  270. package/src/styles/report/_index.scss +1 -1
  271. package/src/styles/resources-blocking/_index.scss +4 -0
  272. package/src/styles/sales/BookingFilter.scss +2 -2
  273. package/src/styles/sales/BookingResults.scss +1 -1
  274. package/src/styles/sales/BookingTabs.scss +7 -5
  275. package/src/styles/sales/Filters.scss +5 -4
  276. package/src/styles/sales/GuestProfile.scss +170 -175
  277. package/src/styles/sales/LifeTimeSales.scss +1 -1
  278. package/src/styles/sales/ManualBooking.scss +4 -2
  279. package/src/styles/snippet-templates/_snippetVariables.scss +63 -244
  280. package/src/styles/sortable-field/SortableField.scss +16 -16
  281. package/src/styles/sortable-field/_index.scss +1 -1
  282. package/src/styles/sortable-tree/Item.scss +4 -4
  283. package/src/styles/table/Table.scss +1 -1
  284. package/src/styles/themes/bookedit/_variables.scss +10 -32
  285. package/src/styles/themes/licklist/_variables.scss +1 -1
  286. package/src/styles/tiptap-editor/TiptapEditor.scss +9 -10
  287. package/src/styles/tiptap-editor/_index.scss +1 -1
  288. package/src/styles/venue-map-sets/VenueMapSetForm.scss +5 -4
  289. package/src/styles/virtualized/_index.scss +1 -1
  290. package/src/styles/zones/ZoneForm.scss +1 -0
  291. package/src/styles/zones/ZoneRecurrencesControl.scss +6 -8
  292. package/src/tiptap-editor/TipTapEditor.stories.tsx +6 -4
  293. package/src/tiptap-editor/TipTapMenu/TipTapMenu.stories.tsx +5 -2
  294. package/src/typeahead/Typeahead.tsx +15 -1
  295. package/src/zone/form/ZoneForm.tsx +9 -2
  296. package/src/zone/form/components/ZoneControl.tsx +8 -3
  297. package/src/zone/form/components/ZoneRecurrencesControl.tsx +10 -5
  298. package/src/zone/form/utils/dates.ts +9 -10
  299. package/yarn.lock +55 -68
  300. package/dist/assets/iframe/selectArrow.svg.js +0 -17
@@ -1,4 +1,4 @@
1
- import React, { useContext } from "react";
1
+ import { useContext } from "react";
2
2
  import { Col, Form } from "react-bootstrap";
3
3
  import { Controller, Path, useFormContext } from "react-hook-form";
4
4
  import { HookFormService } from "@licklist/plugins";
@@ -98,7 +98,7 @@ export const AdvancedOptions = <T extends FormValues>({
98
98
  {...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
99
99
  isInvalid={HookFormService.isInvalid<T>(
100
100
  `${fieldNamePrefix}.productGroupId` as Path<T>,
101
- errors
101
+ errors,
102
102
  )}
103
103
  disabled={isLoading || isOverrides}
104
104
  defaultValue=""
@@ -115,7 +115,7 @@ export const AdvancedOptions = <T extends FormValues>({
115
115
  <Form.Control.Feedback type="invalid">
116
116
  {HookFormService.getErrors<T>(
117
117
  `${fieldNamePrefix}.productGroupId` as Path<T>,
118
- errors
118
+ errors,
119
119
  )}
120
120
  </Form.Control.Feedback>
121
121
  </Form.Group>
@@ -134,7 +134,7 @@ export const AdvancedOptions = <T extends FormValues>({
134
134
  onChange={onChange}
135
135
  isInvalid={HookFormService.isInvalid<T>(
136
136
  `${fieldNamePrefix}.termsAndConditions` as Path<T>,
137
- errors
137
+ errors,
138
138
  )}
139
139
  disabled={isLoading || isOverrides}
140
140
  name={name}
@@ -147,7 +147,7 @@ export const AdvancedOptions = <T extends FormValues>({
147
147
  <Form.Control.Feedback type="invalid">
148
148
  {HookFormService.getErrors<T>(
149
149
  `${fieldNamePrefix}.termsAndConditions` as Path<T>,
150
- errors
150
+ errors,
151
151
  )}
152
152
  </Form.Control.Feedback>
153
153
  </Form.Group>
@@ -12,7 +12,7 @@ export default {
12
12
  } as Meta;
13
13
 
14
14
  export const Default: Story<ProductBookingManagementControlProps<{}>> = (
15
- args,
15
+ args
16
16
  ) => {
17
17
  const form = useForm<ProductBookingManagementControlValues>({
18
18
  mode: "onChange",
@@ -42,7 +42,7 @@ export const Default: Story<ProductQuantityControlProps<{}>> = (args) => {
42
42
  };
43
43
 
44
44
  export const ConstantForm: Story<ProductQuantityConstantControlProps<{}>> = (
45
- args,
45
+ args
46
46
  ) => {
47
47
  const form = useForm<ProductQuantityConstantControlValues>({
48
48
  mode: "onChange",
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect, useMemo } from "react";
1
+ import { useContext, useEffect, useMemo } from "react";
2
2
  import { Col, Form, Row } from "react-bootstrap";
3
3
  import {
4
4
  ArrayPath,
@@ -63,7 +63,7 @@ export const ProductZoneControl = <T extends FormValues>({
63
63
  const disabledDuration = capacity === "0" || !capacity;
64
64
 
65
65
  const { providerHasBookingManagement, zones = [] } = useContext(
66
- ProductSetLoadingContext
66
+ ProductSetLoadingContext,
67
67
  );
68
68
 
69
69
  const currentZoneData = zones.find((zone) => zone.id === Number(zoneId));
@@ -75,10 +75,10 @@ export const ProductZoneControl = <T extends FormValues>({
75
75
  !productZones.find(
76
76
  (productZone) =>
77
77
  Number(productZone.zoneId) === zone.id &&
78
- productZone.zoneId !== zoneId
79
- )
78
+ productZone.zoneId !== zoneId,
79
+ ),
80
80
  ),
81
- [zones, productZones, zoneId]
81
+ [zones, productZones, zoneId],
82
82
  );
83
83
 
84
84
  useEffect(() => {
@@ -89,7 +89,7 @@ export const ProductZoneControl = <T extends FormValues>({
89
89
  setValue(
90
90
  `${fieldNamePrefix}.duration` as Path<T>,
91
91
  /* @ts-expect-error 6385 */
92
- 0 as UnpackNestedValue<PathValue<T, Path<T>>>
92
+ 0 as UnpackNestedValue<PathValue<T, Path<T>>>,
93
93
  );
94
94
  clearErrors(`${fieldNamePrefix}.duration` as Path<T>);
95
95
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -104,7 +104,7 @@ export const ProductZoneControl = <T extends FormValues>({
104
104
  /* @ts-expect-error 6385 */
105
105
  (value * currentZoneData?.defaultDuration) as UnpackNestedValue<
106
106
  PathValue<T, Path<T>>
107
- >
107
+ >,
108
108
  );
109
109
  };
110
110
  return (
@@ -123,7 +123,7 @@ export const ProductZoneControl = <T extends FormValues>({
123
123
  disabled={isOverrides}
124
124
  isInvalid={HookFormService.isInvalid(
125
125
  `${fieldNamePrefix}.zoneId`,
126
- errors
126
+ errors,
127
127
  )}
128
128
  {...field}
129
129
  >
@@ -147,7 +147,7 @@ export const ProductZoneControl = <T extends FormValues>({
147
147
  <Form.Control.Feedback type="invalid">
148
148
  {HookFormService.getErrors(
149
149
  `${fieldNamePrefix}.zoneId` as Path<T>,
150
- errors
150
+ errors,
151
151
  )}
152
152
  </Form.Control.Feedback>
153
153
  </Form.Group>
@@ -3,6 +3,7 @@ import { SmsTemplate } from "@licklist/core/dist/DataMapper/Notification/SmsTemp
3
3
  import { TFunction } from "react-i18next";
4
4
  import { UseFormSetError } from "react-hook-form";
5
5
  import { checkIfZoneCategory } from "@licklist/plugins";
6
+ import { ProductSet } from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
6
7
  import { TemplateItem } from "../control/ProductSetControl";
7
8
  import { ProductSetFormValues } from "../form/ProductSetForm";
8
9
 
@@ -12,6 +13,11 @@ interface CheckAvailableTimesErrors {
12
13
  t: TFunction;
13
14
  }
14
15
 
16
+ export interface MenuTypeheadItem {
17
+ id: number;
18
+ label: string;
19
+ value: number;
20
+ }
15
21
  export const moveArrayElements = <T>(
16
22
  array: T[],
17
23
  prevIndex: number,
@@ -84,3 +90,8 @@ export const checkAvailableTimesErrors = ({
84
90
  });
85
91
  return hasError;
86
92
  };
93
+
94
+ export const getTypeHeadItemsFromMenus = (
95
+ menus?: (ProductSet | ProductSetFormValues)[],
96
+ ): MenuTypeheadItem[] =>
97
+ menus?.map((menu) => ({ id: menu.id, value: menu.id, label: menu.name }));
@@ -2,17 +2,21 @@ import { useId } from "@react-aria/utils";
2
2
  import { Form } from "react-bootstrap";
3
3
  import { useFormContext } from "react-hook-form";
4
4
  import { useTranslation } from "react-i18next";
5
+ import { TimeZonePath, useTimeZoneApi } from "@licklist/plugins";
6
+ import { BlockLoader } from "src/static";
5
7
  import CountryCodeSelect from "../../static/CountryCodeSelect";
6
8
  import { LocationInputValues } from ".";
7
9
  import { FormGroupControll } from "./components";
8
10
 
9
- export function LocationInput() {
11
+ export function LocationInput({ path }: { path: TimeZonePath }) {
10
12
  const {
11
13
  register,
12
14
  formState: { errors },
13
15
  } = useFormContext<LocationInputValues>();
14
16
  const { t } = useTranslation("Design");
15
17
 
18
+ const { data, isLoading } = useTimeZoneApi(path).useAll();
19
+
16
20
  const countryId = useId();
17
21
 
18
22
  return (
@@ -39,6 +43,7 @@ export function LocationInput() {
39
43
  name="location.postcode"
40
44
  label={t("locationPostcode")}
41
45
  />
46
+
42
47
  <Form.Group controlId={countryId}>
43
48
  <Form.Label>{t("locationCountry")}</Form.Label>
44
49
  <CountryCodeSelect
@@ -47,6 +52,36 @@ export function LocationInput() {
47
52
  error={errors?.location?.country?.message}
48
53
  />
49
54
  </Form.Group>
55
+
56
+ {isLoading ? (
57
+ <BlockLoader />
58
+ ) : (
59
+ <Form.Group controlId="timeZoneId">
60
+ <Form.Label>{t("locationTimeZone")}</Form.Label>
61
+ <Form.Control
62
+ {...register("timeZoneId", {
63
+ required: t("Validation:fieldRequired", {
64
+ attribute: t("locationTimeZone"),
65
+ }) as string,
66
+ })}
67
+ as="select"
68
+ custom
69
+ isInvalid={Boolean(errors?.timeZoneId?.message)}
70
+ >
71
+ <option key="" value="" disabled>
72
+ {t("chooseTimeZone")}
73
+ </option>
74
+ {data.map((zone) => (
75
+ <option key={zone.id} value={zone.id.toString()}>
76
+ {zone.name}
77
+ </option>
78
+ ))}
79
+ </Form.Control>
80
+ <Form.Control.Feedback type="invalid">
81
+ {errors?.timeZoneId?.message}
82
+ </Form.Control.Feedback>
83
+ </Form.Group>
84
+ )}
50
85
  </>
51
86
  );
52
87
  }
@@ -1,20 +1,19 @@
1
1
  import { ReactElement } from "react";
2
2
  import { useFormContext } from "react-hook-form";
3
3
  import en from "react-phone-number-input/locale/en.json";
4
+ import { TimeZonePath, useTimeZoneApi } from "@licklist/plugins";
4
5
  import { LocationInputValues } from ".";
5
6
 
6
- export function LocationInputDescription() {
7
+ const fieldNames = ["street", "city", "state", "postcode", "country"] as const;
8
+
9
+ export function LocationInputDescription({ path }: { path: TimeZonePath }) {
7
10
  const { watch } = useFormContext<LocationInputValues>();
8
- const values = watch("location");
9
- const fieldNames = [
10
- "street",
11
- "city",
12
- "state",
13
- "postcode",
14
- "country",
15
- ] as const;
11
+ const location = watch("location");
12
+
13
+ const { data } = useTimeZoneApi(path).useAll();
14
+
16
15
  const fields = fieldNames.reduce<ReactElement[]>((acc, field) => {
17
- const value = values?.[field];
16
+ const value = location?.[field];
18
17
  if (!value) return acc;
19
18
 
20
19
  return [
@@ -22,5 +21,18 @@ export function LocationInputDescription() {
22
21
  <div key={field}>{field === "country" ? en[value] : value}</div>,
23
22
  ];
24
23
  }, []);
25
- return <div>{fields}</div>;
24
+
25
+ const timeZoneId = watch("timeZoneId");
26
+ const timeZoneName = data?.find(
27
+ (timeZone) => timeZone.id === +timeZoneId,
28
+ )?.name;
29
+
30
+ return (
31
+ <div>
32
+ <>
33
+ {fields}
34
+ {timeZoneName && <div key="timeZone">{timeZoneName}</div>}
35
+ </>
36
+ </div>
37
+ );
26
38
  }
@@ -11,4 +11,5 @@ export type LocationInputValues = {
11
11
  latitude: string;
12
12
  longitude: string;
13
13
  };
14
+ timeZoneId: string;
14
15
  };
@@ -10,6 +10,7 @@ import {
10
10
  } from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
11
11
  import { useMultipleImages } from "@licklist/plugins/dist/hooks/Media/useMultipleImages";
12
12
  import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
13
+ import { TimeZonePath } from "@licklist/plugins";
13
14
  import { CollapsibleInputGroup } from "../../collapsible-input-group";
14
15
  import {
15
16
  CategoriesInput,
@@ -41,6 +42,7 @@ export interface ProviderFormProps extends HasPermissionProp {
41
42
  companiesOptions?: TypeaheadOptions[];
42
43
  onSubmit: (values: ProviderFormValues) => void;
43
44
  intent?: "create" | "update";
45
+ path: TimeZonePath;
44
46
  }
45
47
 
46
48
  const providerImageTypes = {
@@ -56,14 +58,17 @@ export function ProviderForm({
56
58
  onSubmit,
57
59
  intent = "update",
58
60
  hasPermission = true,
61
+ path,
59
62
  }: ProviderFormProps) {
60
63
  const form = useForm<ProviderFormValues>({ defaultValues });
64
+
61
65
  const {
62
66
  setValue,
63
67
  handleSubmit,
64
68
  formState: { isSubmitting, errors },
65
69
  getValues,
66
70
  } = form;
71
+
67
72
  const { t } = useTranslation("Design");
68
73
  const [initialImages, setInitialImages] = useState<Image[] | null>(null);
69
74
 
@@ -101,10 +106,10 @@ export function ProviderForm({
101
106
  <CollapsibleInputGroup
102
107
  eventKey="location"
103
108
  label={t("location")}
104
- description={<LocationInputDescription />}
109
+ description={<LocationInputDescription path={path} />}
105
110
  error={errors?.location?.country?.message}
106
111
  >
107
- <LocationInput />
112
+ <LocationInput path={path} />
108
113
  </CollapsibleInputGroup>
109
114
  {categories && categories.length > 0 && (
110
115
  <CollapsibleInputGroup
@@ -11,6 +11,7 @@ import {
11
11
  import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
12
12
  import { useMultipleImages } from "@licklist/plugins/dist/hooks/Media/useMultipleImages";
13
13
  import { parseServerErrorForFormValidation } from "@licklist/plugins/dist/utils/parseError";
14
+ import { TimeZonePath } from "@licklist/plugins";
14
15
  import { CollapsibleInputGroup } from "../../collapsible-input-group";
15
16
  import {
16
17
  CategoriesInput,
@@ -50,6 +51,7 @@ export interface VenueFormProps extends HasPermissionProp {
50
51
  intent?: "create" | "update";
51
52
  isLoading?: boolean;
52
53
  errorResponse?: unknown;
54
+ path: TimeZonePath;
53
55
  }
54
56
 
55
57
  const providerImageTypes = {
@@ -67,6 +69,7 @@ export function VenueForm({
67
69
  hasPermission = true,
68
70
  isLoading,
69
71
  errorResponse,
72
+ path,
70
73
  }: VenueFormProps) {
71
74
  const form = useForm<VenueFormValues>({ defaultValues, mode: "onChange" });
72
75
  const {
@@ -134,7 +137,7 @@ export function VenueForm({
134
137
  <CollapsibleInputGroup
135
138
  eventKey="location"
136
139
  label={t("location")}
137
- description={<LocationInputDescription />}
140
+ description={<LocationInputDescription path={path} />}
138
141
  error={
139
142
  errors?.location?.message ||
140
143
  (errors?.location &&
@@ -143,7 +146,7 @@ export function VenueForm({
143
146
  }))
144
147
  }
145
148
  >
146
- <LocationInput />
149
+ <LocationInput path={path} />
147
150
  </CollapsibleInputGroup>
148
151
  <CollapsibleInputGroup
149
152
  eventKey="workingHours"
@@ -24,8 +24,9 @@ export function WorkingHoursInput() {
24
24
  <Col>{t("Design:until")}</Col>
25
25
  <Col>{t("Design:description")}</Col>
26
26
  </Form.Row>
27
+
27
28
  <Form.Control
28
- {...register(`workingHours` as const, {
29
+ {...register(`workingHours`, {
29
30
  validate: (value) => {
30
31
  const oneOfDaysFilled = value?.some(
31
32
  (workingDay) => workingDay.start,
@@ -42,6 +43,7 @@ export function WorkingHoursInput() {
42
43
  })}
43
44
  type="hidden"
44
45
  />
46
+
45
47
  {weekdays.map((name, i) => (
46
48
  /*
47
49
  * The only reason inputs have placeholders here is to fix
@@ -49,14 +51,19 @@ export function WorkingHoursInput() {
49
51
  * which miscalculates alignment for empty inputs.
50
52
  * Otherwise placeholders should not be used.
51
53
  */
52
- <Form.Row key={i} className="align-items-baseline">
53
- <Col className="h5 text-lg-right mb-4 mb-lg-0" xs="12" lg="2">
54
+ <Form.Row key={name} className="align-items-baseline">
55
+ <Col
56
+ className="h5 text-lg-right text-nowrap mb-4 mb-lg-0"
57
+ xs="12"
58
+ lg="2"
59
+ >
54
60
  {name}
55
61
  </Col>
62
+
56
63
  <Form.Group as={Col}>
57
64
  <Form.Label className="d-lg-none">{t("Design:from")}</Form.Label>
58
65
  <Form.Control
59
- {...register(`workingHours.${i}.start` as const, {
66
+ {...register(`workingHours.${i}.start`, {
60
67
  validate: (nextStartValue) => {
61
68
  if (nextStartValue) {
62
69
  clearErrors("workingHours");
@@ -69,20 +76,22 @@ export function WorkingHoursInput() {
69
76
  placeholder={t("Design:from")}
70
77
  />
71
78
  </Form.Group>
79
+
72
80
  <Form.Group as={Col}>
73
81
  <Form.Label className="d-lg-none">{t("Design:until")}</Form.Label>
74
82
  <Form.Control
75
- {...register(`workingHours.${i}.end` as const)}
83
+ {...register(`workingHours.${i}.end`)}
76
84
  type="time"
77
85
  placeholder={t("Design:until")}
78
86
  />
79
87
  </Form.Group>
88
+
80
89
  <Form.Group as={Col} xs="12" lg>
81
90
  <Form.Label className="d-lg-none">
82
91
  {t("Design:description")}
83
92
  </Form.Label>
84
93
  <Form.Control
85
- {...register(`workingHours.${i}.description` as const)}
94
+ {...register(`workingHours.${i}.description`)}
86
95
  placeholder={t("Design:description")}
87
96
  />
88
97
  </Form.Group>
@@ -1,8 +1,6 @@
1
- import { DateTime } from "luxon";
2
1
  import { Col, Row } from "react-bootstrap";
3
2
  import { useFormContext } from "react-hook-form";
4
3
  import { useTranslation } from "react-i18next";
5
- import { TIME_FORMAT } from "@licklist/core/dist/Config";
6
4
  import { WorkingHoursInputValues } from ".";
7
5
  import { useWeekdays } from "./utils";
8
6
 
@@ -16,34 +14,17 @@ export function WorkingHoursInputDescription() {
16
14
 
17
15
  return (
18
16
  <>
19
- {Array.from({ length: weekdays.length }, (_, i) => i)
20
- .filter((i) => values?.[i]?.start)
21
- .map((i) => {
22
- const weekday = values?.[i];
23
- return (
24
- <Row key={i}>
25
- <Col xs="auto">{weekdays[i]}:</Col>
26
- <Col>
27
- {weekday?.end
28
- ? weekday.start
29
- ? t("timeInterval", {
30
- start: DateTime.fromISO(weekday.start).toFormat(
31
- TIME_FORMAT,
32
- ),
33
- end: DateTime.fromISO(weekday.start).toFormat(
34
- TIME_FORMAT,
35
- ),
36
- })
37
- : t("timeFrom", {
38
- start: DateTime.fromISO(weekday.start).toFormat(
39
- TIME_FORMAT,
40
- ),
41
- })
42
- : null}
43
- </Col>
44
- </Row>
45
- );
46
- })}
17
+ {Array.from({ length: weekdays.length }, (_, i) => i).map((i) => (
18
+ <Row key={i}>
19
+ <Col xs="auto">{weekdays[i]}:</Col>
20
+ <Col>
21
+ {t("timeInterval", {
22
+ start: values?.[i]?.start ?? "00:00",
23
+ end: values?.[i]?.end ?? "23:59",
24
+ })}
25
+ </Col>
26
+ </Row>
27
+ ))}
47
28
  </>
48
29
  );
49
30
  }
@@ -8,12 +8,8 @@ import {
8
8
  useWatch,
9
9
  Validate,
10
10
  } from "react-hook-form";
11
- import {
12
- DATE_FORMAT,
13
- TIME_FORMAT,
14
- TIME_FULL_FORMAT,
15
- } from "@licklist/core/dist/Config";
16
- import { fromFormat } from "@licklist/plugins/dist/utils/dateTime";
11
+ import { TIME_FORMAT } from "@licklist/core/dist/Config";
12
+ import { fromIso } from "@licklist/core/dist/Services";
17
13
  import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
18
14
 
19
15
  interface RecurrenceIntervalAndFrequencyInputProps {
@@ -31,17 +27,9 @@ interface RecurrenceIntervalAndFrequencyInputProps {
31
27
  RegisterOptions,
32
28
  "max" | "min" | "validate" | "required" | "pattern"
33
29
  >;
30
+ timeZone: string;
34
31
  }
35
32
 
36
- const fromTimeFormat = fromFormat(TIME_FORMAT);
37
- const fromTimeFullFormat = fromFormat(TIME_FULL_FORMAT);
38
-
39
- // default values and entered values are in different formats
40
- const fromTimeFormats = (time: string) =>
41
- fromTimeFormat(time).isValid
42
- ? fromTimeFormat(time)
43
- : fromTimeFullFormat(time);
44
-
45
33
  function RecurrenceIntervalAndFrequencyInput({
46
34
  disabled = false,
47
35
  minDate,
@@ -51,6 +39,7 @@ function RecurrenceIntervalAndFrequencyInput({
51
39
  endTimeLabel,
52
40
  startTimeRules,
53
41
  endTimeRules,
42
+ timeZone,
54
43
  }: RecurrenceIntervalAndFrequencyInputProps) {
55
44
  const { t } = useTranslation(["Design", "Notification", "App"]);
56
45
 
@@ -66,10 +55,10 @@ function RecurrenceIntervalAndFrequencyInput({
66
55
 
67
56
  const _startTime = useWatch({ control, name: "startTime" });
68
57
  const startTime =
69
- _startTime && fromTimeFormats(_startTime).toFormat(TIME_FORMAT);
58
+ _startTime && fromIso(_startTime, timeZone).toFormat(TIME_FORMAT);
70
59
 
71
60
  const _endTime = useWatch({ control, name: "endTime" });
72
- const endTime = _endTime && fromTimeFormats(_endTime).toFormat(TIME_FORMAT);
61
+ const endTime = _endTime && fromIso(_endTime, timeZone).toFormat(TIME_FORMAT);
73
62
 
74
63
  useEffect(() => {
75
64
  if (!startDate || !endDate) {
@@ -119,11 +108,8 @@ function RecurrenceIntervalAndFrequencyInput({
119
108
  if (!startDate || !date) {
120
109
  return true;
121
110
  }
122
- const currentStartDate = DateTime.fromFormat(
123
- startDate,
124
- DATE_FORMAT,
125
- );
126
- const currentEndDate = DateTime.fromFormat(date, DATE_FORMAT);
111
+ const currentStartDate = fromIso(startDate, timeZone);
112
+ const currentEndDate = fromIso(date, timeZone);
127
113
  return currentEndDate.diff(currentStartDate, ["days"]).days >=
128
114
  0
129
115
  ? true
@@ -12,9 +12,7 @@ export default {
12
12
  component: RecurringDatePickerInput,
13
13
  } as Meta;
14
14
 
15
- type DefaultRecurringDatePickerInputProps = RecurringDatePickerInputProps;
16
-
17
- export const Default: Story<DefaultRecurringDatePickerInputProps> = (args) => {
15
+ export const Default: Story<RecurringDatePickerInputProps> = (args) => {
18
16
  return (
19
17
  <Card style={{ maxWidth: "max-content" }}>
20
18
  <Card.Body>
@@ -23,7 +21,7 @@ export const Default: Story<DefaultRecurringDatePickerInputProps> = (args) => {
23
21
  </Card>
24
22
  );
25
23
  };
26
- export const Valid: Story<DefaultRecurringDatePickerInputProps> = (args) => {
24
+ export const Valid: Story<RecurringDatePickerInputProps> = (args) => {
27
25
  return (
28
26
  <Card style={{ maxWidth: "max-content" }}>
29
27
  <Card.Body>
@@ -34,6 +32,15 @@ export const Valid: Story<DefaultRecurringDatePickerInputProps> = (args) => {
34
32
  };
35
33
  Default.args = {
36
34
  onChange: (data) => console.log("onSubmit", data),
35
+ workHours: [
36
+ { start: "20:00", end: "04:00", day: 0, description: "" },
37
+ { start: "20:00", end: "04:00", day: 1, description: "" },
38
+ { start: "20:00", end: "04:00", day: 2, description: "" },
39
+ { start: "20:00", end: "12:00", day: 3, description: "" },
40
+ { start: "20:00", end: "23:00", day: 4, description: "" },
41
+ { start: "08:00", end: "12:00", day: 5, description: "" },
42
+ { start: "10:00", end: "16:00", day: 6, description: "" },
43
+ ],
37
44
  };
38
45
  Valid.args = {
39
46
  onChange: (data) => console.log("onSubmit", data),
@@ -2,7 +2,7 @@ import { useEffect, useMemo, PropsWithChildren } from "react";
2
2
  import RRule, { Frequency, Weekday } from "rrule";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import Button from "react-bootstrap/Button";
5
- import { DateTime, Interval } from "luxon";
5
+ import { DateTime, Interval, WeekdayNumbers } from "luxon";
6
6
  import { useIntl } from "react-intl";
7
7
  import {
8
8
  DATE_TIME_FORMAT,
@@ -12,9 +12,14 @@ import {
12
12
  import { usePreviousValue } from "@licklist/plugins/dist/hooks/Value/usePreviousValue";
13
13
  import { FormProvider, useForm } from "react-hook-form";
14
14
  import { Form } from "react-bootstrap";
15
+ import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
15
16
  import RecurrenceIntervalAndFrequencyInput from "./RecurrenceIntervalAndFrequencyInput";
16
17
  import RecurrenceWeekdaysInput from "./RecurrenceWeekdaysInput";
17
- import { parseAndValidateRRule, SupportedFrequency } from "./utils";
18
+ import {
19
+ parseAndValidateRRule,
20
+ SupportedFrequency,
21
+ useWorkHoursValidation,
22
+ } from "./utils";
18
23
  import { ConfirmModal } from "../modals";
19
24
  import { DeleteFieldButton } from "../product-set/elements";
20
25
 
@@ -26,6 +31,8 @@ export interface RecurringDatePickerInputProps {
26
31
  initialFrequency?: Frequency;
27
32
  setInitialStartDateAfterSelect?: boolean;
28
33
  minDate?: string;
34
+ workHours: WorkHour[] | undefined;
35
+ timeZone: string;
29
36
  }
30
37
 
31
38
  export interface RecurringDatePickerInputValues {
@@ -51,6 +58,8 @@ export function RecurringDatePickerInput({
51
58
  setInitialStartDateAfterSelect = false,
52
59
  children,
53
60
  minDate,
61
+ workHours,
62
+ timeZone,
54
63
  }: PropsWithChildren<RecurringDatePickerInputProps>) {
55
64
  const { t } = useTranslation(["Design"]);
56
65
 
@@ -84,6 +93,8 @@ export function RecurringDatePickerInput({
84
93
  byWeekDay,
85
94
  });
86
95
 
96
+ const validator = useWorkHoursValidation(byWeekDay, workHours, timeZone);
97
+
87
98
  const onSubmit = (nextState: RecurringDatePickerInputValues) => {
88
99
  const end = getDateTimeObject(endDate, endTime || "23:59:59");
89
100
 
@@ -149,7 +160,7 @@ export function RecurringDatePickerInput({
149
160
  // Luxon use standard ISO calendar but in that case
150
161
  // first weekday from weekdays array start from 0 index.
151
162
  // We need to add 1 to it to show correct data
152
- const currentWeekDay = byWeekDay[0]?.weekday + 1;
163
+ const currentWeekDay = (byWeekDay[0]?.weekday + 1) as WeekdayNumbers;
153
164
 
154
165
  const currentDate = DateTime.local();
155
166
 
@@ -188,6 +199,9 @@ export function RecurringDatePickerInput({
188
199
  <RecurrenceIntervalAndFrequencyInput
189
200
  disabled={disabled}
190
201
  minDate={minDate}
202
+ startTimeRules={validator}
203
+ endTimeRules={validator}
204
+ timeZone={timeZone}
191
205
  />
192
206
 
193
207
  {children}