@licklist/design 0.67.2 → 0.67.3-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 (270) 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.js +2 -1
  11. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.d.ts.map +1 -1
  12. package/dist/events/edit-event-modal/component/SaleDeadline/SaleDeadline.js +5 -3
  13. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  14. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +3 -6
  15. package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
  16. package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +0 -1
  17. package/dist/iframe/event/event-card/IframeEventCard.d.ts +1 -1
  18. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  19. package/dist/iframe/event/event-card/IframeEventCard.js +9 -3
  20. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  21. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +2 -0
  22. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  23. package/dist/layout/DropDown.d.ts +2 -1
  24. package/dist/layout/DropDown.d.ts.map +1 -1
  25. package/dist/layout/DropDownToggle.d.ts.map +1 -1
  26. package/dist/layout/DropDownToggle.js +1 -0
  27. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -1
  28. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  29. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -0
  30. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  31. package/dist/product-set/control/DateInput.js +2 -2
  32. package/dist/product-set/control/ProductSetControl.d.ts +1 -1
  33. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  34. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  35. package/dist/product-set/form/ProductCategoriesControl.js +48 -2
  36. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  37. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  38. package/dist/product-set/form/ProductSetForm.js +60 -2
  39. package/dist/product-set/form/ProductZonesControl.d.ts.map +1 -1
  40. package/dist/product-set/form/ProductZonesControl.js +0 -2
  41. package/dist/product-set/form/SelectCategoryModal.d.ts +12 -0
  42. package/dist/product-set/form/SelectCategoryModal.d.ts.map +1 -1
  43. package/dist/product-set/form/SelectCategoryModal.js +1 -1
  44. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  45. package/dist/product-set/form/SubProductsControl.js +0 -3
  46. package/dist/product-set/form/VenueMapsControl.d.ts.map +1 -1
  47. package/dist/product-set/form/VenueMapsControl.js +0 -3
  48. package/dist/provider/location-input/LocationInput.d.ts +4 -1
  49. package/dist/provider/location-input/LocationInput.d.ts.map +1 -1
  50. package/dist/provider/location-input/LocationInput.js +41 -2
  51. package/dist/provider/location-input/LocationInputDescription.d.ts +4 -1
  52. package/dist/provider/location-input/LocationInputDescription.d.ts.map +1 -1
  53. package/dist/provider/location-input/LocationInputDescription.js +27 -12
  54. package/dist/provider/location-input/index.d.ts +1 -0
  55. package/dist/provider/location-input/index.d.ts.map +1 -1
  56. package/dist/provider/provider-form/ProviderForm.d.ts +3 -1
  57. package/dist/provider/provider-form/ProviderForm.d.ts.map +1 -1
  58. package/dist/provider/provider-form/ProviderForm.js +7 -3
  59. package/dist/provider/venue-form/VenueForm.d.ts +3 -1
  60. package/dist/provider/venue-form/VenueForm.d.ts.map +1 -1
  61. package/dist/provider/venue-form/VenueForm.js +7 -3
  62. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  63. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +4 -8
  64. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +3 -1
  65. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  66. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +6 -3
  67. package/dist/recurring-date-picker-input/utils.d.ts +5 -0
  68. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  69. package/dist/recurring-date-picker-input/utils.js +75 -3
  70. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  71. package/dist/sales/booking/results/components/ResultCard.js +4 -7
  72. package/dist/sales/guest-profile/previous-bookings/PreviousBookings.js +1 -1
  73. package/dist/sales/manual-booking/formatDays.js +3 -3
  74. package/dist/sales/manual-booking/select-event/SelectEvent.d.ts.map +1 -1
  75. package/dist/sales/manual-booking/select-event/SelectEvent.js +3 -3
  76. package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
  77. package/dist/sales/manual-booking/summary/ManualBookingSummary.js +2 -2
  78. package/dist/sales/notes/NotesTableRow.js +3 -4
  79. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  80. package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
  81. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  82. package/dist/snippet/snippet-template/preview/Preview.js +6 -0
  83. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  84. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  85. package/dist/sortable-tree/SortableTreeItem.js +10 -4
  86. package/dist/styles/auth/AccessDenied.scss +1 -1
  87. package/dist/styles/back-button/BackButton.scss +25 -24
  88. package/dist/styles/back-button/_index.scss +1 -1
  89. package/dist/styles/company-user-form/UserForm.scss +4 -7
  90. package/dist/styles/company-user-form/_index.scss +1 -1
  91. package/dist/styles/custom-fields/CreateSortableListItem.scss +2 -1
  92. package/dist/styles/custom-fields/_index.scss +1 -1
  93. package/dist/styles/customers/Filter.scss +5 -5
  94. package/dist/styles/events/EditEventModal.scss +1 -3
  95. package/dist/styles/events/EventVenueMap.scss +7 -7
  96. package/dist/styles/form/Input.scss +1 -1
  97. package/dist/styles/header/Header.scss +1 -1
  98. package/dist/styles/header/elements/CompanySelector.scss +2 -2
  99. package/dist/styles/iframe-events/Calendar.scss +0 -1
  100. package/dist/styles/iframe-events/CalendarSelect.scss +1 -1
  101. package/dist/styles/iframe-events/CategoryStepsForm.scss +6 -7
  102. package/dist/styles/iframe-events/Event.scss +2 -4
  103. package/dist/styles/iframe-events/EventForm.scss +54 -54
  104. package/dist/styles/iframe-events/EventNavigationFooter.scss +1 -0
  105. package/dist/styles/iframe-events/TicketDescription.scss +1 -1
  106. package/dist/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  107. package/dist/styles/iframe-payments/PaymentForm.scss +1 -1
  108. package/dist/styles/layout/BackgroundVideoContainer.scss +2 -2
  109. package/dist/styles/notification/Notification.scss +1 -1
  110. package/dist/styles/order-items-table/OrderItemsTable.scss +1 -2
  111. package/dist/styles/product-set/CreateProductSetItem.scss +15 -13
  112. package/dist/styles/product-set/DateAndRecurrenceInput.scss +6 -8
  113. package/dist/styles/product-set/EditCategoryModal.scss +4 -4
  114. package/dist/styles/product-set/EditProductModal.scss +3 -3
  115. package/dist/styles/product-set/EditStepModal.scss +4 -4
  116. package/dist/styles/product-set/EditVenueMapSetModal.scss +6 -6
  117. package/dist/styles/product-set/ProductSetForm.scss +25 -2
  118. package/dist/styles/product-set/TutorialGifCard.scss +1 -1
  119. package/dist/styles/product-set/_index.scss +2 -2
  120. package/dist/styles/report/ReportCard.scss +1 -0
  121. package/dist/styles/report/_index.scss +1 -1
  122. package/dist/styles/resources-blocking/_index.scss +4 -0
  123. package/dist/styles/sales/BookingFilter.scss +2 -2
  124. package/dist/styles/sales/BookingResults.scss +1 -1
  125. package/dist/styles/sales/BookingTabs.scss +7 -5
  126. package/dist/styles/sales/Filters.scss +5 -4
  127. package/dist/styles/sales/GuestProfile.scss +170 -175
  128. package/dist/styles/sales/LifeTimeSales.scss +1 -1
  129. package/dist/styles/sales/ManualBooking.scss +4 -2
  130. package/dist/styles/snippet-templates/_snippetVariables.scss +63 -244
  131. package/dist/styles/sortable-field/SortableField.scss +16 -16
  132. package/dist/styles/sortable-field/_index.scss +1 -1
  133. package/dist/styles/sortable-tree/Item.scss +4 -4
  134. package/dist/styles/table/Table.scss +1 -1
  135. package/dist/styles/themes/bookedit/_variables.scss +10 -32
  136. package/dist/styles/themes/licklist/_variables.scss +1 -1
  137. package/dist/styles/tiptap-editor/TiptapEditor.scss +9 -10
  138. package/dist/styles/tiptap-editor/_index.scss +1 -1
  139. package/dist/styles/venue-map-sets/VenueMapSetForm.scss +5 -4
  140. package/dist/styles/virtualized/_index.scss +1 -1
  141. package/dist/styles/zones/ZoneForm.scss +1 -0
  142. package/dist/styles/zones/ZoneRecurrencesControl.scss +6 -8
  143. package/dist/zone/form/ZoneForm.d.ts +2 -2
  144. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  145. package/dist/zone/form/ZoneForm.js +3 -2
  146. package/dist/zone/form/components/ZoneControl.d.ts +2 -2
  147. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  148. package/dist/zone/form/components/ZoneControl.js +4 -2
  149. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -4
  150. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  151. package/dist/zone/form/components/ZoneRecurrencesControl.js +4 -2
  152. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  153. package/package.json +11 -11
  154. package/src/auth/ChangePassword/ChangePassword.stories.tsx +1 -1
  155. package/src/auth/Login/LoginComponent.tsx +1 -1
  156. package/src/auth/ResetPassword/ResetPassword.stories.tsx +1 -1
  157. package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +31 -28
  158. package/src/calendar/utils/index.ts +26 -4
  159. package/src/events/edit-event-modal/component/SaleDeadline/SaleDeadline.tsx +3 -5
  160. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +0 -4
  161. package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +0 -1
  162. package/src/header/elements/Elements.stories.tsx +1 -1
  163. package/src/help/popover/Popover.stories.tsx +1 -1
  164. package/src/iframe/event/event-card/IframeEventCard.tsx +16 -2
  165. package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +3 -3
  166. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -0
  167. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +1 -0
  168. package/src/layout/DropDown.tsx +2 -1
  169. package/src/layout/DropDownToggle.tsx +2 -0
  170. package/src/product-set/card/ProductSetCard.stories.tsx +3 -1
  171. package/src/product-set/control/DateAndRecurrenceInput.tsx +3 -4
  172. package/src/product-set/control/DateInput.tsx +2 -1
  173. package/src/product-set/control/ProductSetControl.tsx +1 -1
  174. package/src/product-set/control/ProductSetRecurrenceControl.stories.tsx +2 -2
  175. package/src/product-set/form/ProductCategoriesControl.tsx +37 -1
  176. package/src/product-set/form/ProductSetForm.tsx +22 -3
  177. package/src/product-set/form/ProductZonesControl.tsx +4 -7
  178. package/src/product-set/form/SelectCategoryModal.stories.tsx +1 -1
  179. package/src/product-set/form/SelectCategoryModal.tsx +2 -2
  180. package/src/product-set/form/SubProductsControl.tsx +0 -3
  181. package/src/product-set/form/VenueMapsControl.tsx +0 -3
  182. package/src/product-set/product/advanced-options/AdvancedOptions.tsx +5 -5
  183. package/src/product-set/product/booking-management/ProductBookingManagement.stories.tsx +1 -1
  184. package/src/product-set/product/quantity/ProductQuantity.stories.tsx +1 -1
  185. package/src/product-set/product-zone/ProductZoneControl.tsx +9 -9
  186. package/src/provider/location-input/LocationInput.tsx +36 -1
  187. package/src/provider/location-input/LocationInputDescription.tsx +23 -11
  188. package/src/provider/location-input/index.ts +1 -0
  189. package/src/provider/provider-form/ProviderForm.tsx +7 -2
  190. package/src/provider/venue-form/VenueForm.tsx +5 -2
  191. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +4 -18
  192. package/src/recurring-date-picker-input/RecurringDatePickerInput.stories.tsx +11 -4
  193. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +12 -1
  194. package/src/recurring-date-picker-input/utils.ts +91 -1
  195. package/src/sales/booking/results/components/ResultCard.tsx +4 -10
  196. package/src/sales/guest-profile/previous-bookings/PreviousBookings.tsx +1 -1
  197. package/src/sales/manual-booking/formatDays.ts +3 -3
  198. package/src/sales/manual-booking/select-event/SelectEvent.tsx +2 -2
  199. package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +2 -2
  200. package/src/sales/notes/NotesTableRow.tsx +3 -3
  201. package/src/setting/admin/AdminSetting.stories.tsx +1 -0
  202. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  203. package/src/setting/system/SystemSetting.stories.tsx +1 -1
  204. package/src/snippet/snippet-template/preview/Preview.tsx +6 -0
  205. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  206. package/src/styles/auth/AccessDenied.scss +1 -1
  207. package/src/styles/back-button/BackButton.scss +25 -24
  208. package/src/styles/back-button/_index.scss +1 -1
  209. package/src/styles/company-user-form/UserForm.scss +4 -7
  210. package/src/styles/company-user-form/_index.scss +1 -1
  211. package/src/styles/custom-fields/CreateSortableListItem.scss +2 -1
  212. package/src/styles/custom-fields/_index.scss +1 -1
  213. package/src/styles/customers/Filter.scss +5 -5
  214. package/src/styles/events/EditEventModal.scss +1 -3
  215. package/src/styles/events/EventVenueMap.scss +7 -7
  216. package/src/styles/form/Input.scss +1 -1
  217. package/src/styles/header/Header.scss +1 -1
  218. package/src/styles/header/elements/CompanySelector.scss +2 -2
  219. package/src/styles/iframe-events/Calendar.scss +0 -1
  220. package/src/styles/iframe-events/CalendarSelect.scss +1 -1
  221. package/src/styles/iframe-events/CategoryStepsForm.scss +6 -7
  222. package/src/styles/iframe-events/Event.scss +2 -4
  223. package/src/styles/iframe-events/EventForm.scss +54 -54
  224. package/src/styles/iframe-events/EventNavigationFooter.scss +1 -0
  225. package/src/styles/iframe-events/TicketDescription.scss +1 -1
  226. package/src/styles/iframe-external-modal/IframeExternalModal.scss +2 -2
  227. package/src/styles/iframe-payments/PaymentForm.scss +1 -1
  228. package/src/styles/layout/BackgroundVideoContainer.scss +2 -2
  229. package/src/styles/notification/Notification.scss +1 -1
  230. package/src/styles/order-items-table/OrderItemsTable.scss +1 -2
  231. package/src/styles/product-set/CreateProductSetItem.scss +15 -13
  232. package/src/styles/product-set/DateAndRecurrenceInput.scss +6 -8
  233. package/src/styles/product-set/EditCategoryModal.scss +4 -4
  234. package/src/styles/product-set/EditProductModal.scss +3 -3
  235. package/src/styles/product-set/EditStepModal.scss +4 -4
  236. package/src/styles/product-set/EditVenueMapSetModal.scss +6 -6
  237. package/src/styles/product-set/ProductSetForm.scss +25 -2
  238. package/src/styles/product-set/TutorialGifCard.scss +1 -1
  239. package/src/styles/product-set/_index.scss +2 -2
  240. package/src/styles/report/ReportCard.scss +1 -0
  241. package/src/styles/report/_index.scss +1 -1
  242. package/src/styles/resources-blocking/_index.scss +4 -0
  243. package/src/styles/sales/BookingFilter.scss +2 -2
  244. package/src/styles/sales/BookingResults.scss +1 -1
  245. package/src/styles/sales/BookingTabs.scss +7 -5
  246. package/src/styles/sales/Filters.scss +5 -4
  247. package/src/styles/sales/GuestProfile.scss +170 -175
  248. package/src/styles/sales/LifeTimeSales.scss +1 -1
  249. package/src/styles/sales/ManualBooking.scss +4 -2
  250. package/src/styles/snippet-templates/_snippetVariables.scss +63 -244
  251. package/src/styles/sortable-field/SortableField.scss +16 -16
  252. package/src/styles/sortable-field/_index.scss +1 -1
  253. package/src/styles/sortable-tree/Item.scss +4 -4
  254. package/src/styles/table/Table.scss +1 -1
  255. package/src/styles/themes/bookedit/_variables.scss +10 -32
  256. package/src/styles/themes/licklist/_variables.scss +1 -1
  257. package/src/styles/tiptap-editor/TiptapEditor.scss +9 -10
  258. package/src/styles/tiptap-editor/_index.scss +1 -1
  259. package/src/styles/venue-map-sets/VenueMapSetForm.scss +5 -4
  260. package/src/styles/virtualized/_index.scss +1 -1
  261. package/src/styles/zones/ZoneForm.scss +1 -0
  262. package/src/styles/zones/ZoneRecurrencesControl.scss +6 -8
  263. package/src/tiptap-editor/TipTapEditor.stories.tsx +6 -4
  264. package/src/tiptap-editor/TipTapMenu/TipTapMenu.stories.tsx +5 -2
  265. package/src/zone/form/ZoneForm.tsx +3 -2
  266. package/src/zone/form/components/ZoneControl.tsx +3 -3
  267. package/src/zone/form/components/ZoneRecurrencesControl.tsx +7 -5
  268. package/src/zone/form/utils/dates.ts +9 -10
  269. package/yarn.lock +187 -201
  270. package/dist/assets/iframe/selectArrow.svg.js +0 -17
@@ -8,6 +8,7 @@ import {
8
8
  useFormContext,
9
9
  useWatch,
10
10
  } from "react-hook-form";
11
+ import { FaBars, FaBowlingBall, FaCalendar, FaTicketAlt } from "react-icons/fa";
11
12
  import { useTranslation } from "react-i18next";
12
13
  import { useSensor, MouseSensor } from "@dnd-kit/core";
13
14
  import {
@@ -25,7 +26,11 @@ import { ProductCategoryControl } from "../product-category";
25
26
  import { ProductCategory } from "../types";
26
27
  import { ProductsControl } from "./ProductsControl";
27
28
  import { ProductSetFormValues, WithIsLoading } from "./ProductSetForm";
28
- import { SelectCategoryModal } from "./SelectCategoryModal";
29
+ import {
30
+ SelectCategoryModal,
31
+ CATEGORY_TYPES_NAMES,
32
+ CategoryConfig,
33
+ } from "./SelectCategoryModal";
29
34
  import { ProductSetLoadingContext } from "./context";
30
35
  import { VenueMapSetModal } from "./VenueMapSetModal";
31
36
  import { moveArrayElements, sortArrayByIndex } from "../utils";
@@ -33,6 +38,29 @@ import { useSortableTreeFunctions } from "../hooks/useSortableTreeFunctions";
33
38
  // @TODO not for first release
34
39
  // import Popover from "./ProductSetFormPopover";
35
40
 
41
+ const CATEGORIES_TYPE: Partial<Record<CategoryType, CategoryConfig>> = {
42
+ [CATEGORY_TYPES_NAMES.tickets]: {
43
+ label: "tickets",
44
+ icon: <FaTicketAlt color="#0e8ce2" size={10} />,
45
+ },
46
+ [CATEGORY_TYPES_NAMES.bookings]: {
47
+ label: "bookings",
48
+ icon: <FaCalendar color="#0e8ce2" size={10} />,
49
+ },
50
+ [CATEGORY_TYPES_NAMES.menuItems]: {
51
+ label: "menuItems",
52
+ icon: <FaBars color="#0e8ce2" size={10} />,
53
+ },
54
+ [CATEGORY_TYPES_NAMES.game]: {
55
+ label: "game",
56
+ icon: <FaBowlingBall color="#0e8ce2" size={10} />,
57
+ },
58
+ [CATEGORY_TYPES_NAMES.fixedDuration]: {
59
+ label: "fixedDuration",
60
+ icon: <FaCalendar color="#0e8ce2" size={10} />,
61
+ },
62
+ };
63
+
36
64
  interface ProductCategoriesControlProps extends WithIsLoading {
37
65
  stepIndex: number;
38
66
  isOverrides?: boolean;
@@ -228,6 +256,8 @@ export function ProductCategoriesControl({
228
256
  setIsExpanded(productCategoryId);
229
257
  };
230
258
 
259
+ const categoryType = CATEGORIES_TYPE[productCategory.type];
260
+
231
261
  return (
232
262
  <Controller
233
263
  key={`product-category-${productCategory._id}`}
@@ -272,6 +302,12 @@ export function ProductCategoriesControl({
272
302
  )}
273
303
  modalClass={ProductSetModalClasses.category}
274
304
  isNewAdded={showCategoryModal}
305
+ itemButton={
306
+ <div className="btn-outline-primary item-icon sm border border-primary rounded-sm">
307
+ {categoryType.icon}
308
+ <span className="ml-2">{t(categoryType.label)}</span>
309
+ </div>
310
+ }
275
311
  body={
276
312
  <ProductCategoryControl
277
313
  isLoading={isLoading}
@@ -1,4 +1,4 @@
1
- import { useEffect } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import { FormValues } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
3
3
  import { Button, Form, Col, Row } from "react-bootstrap";
4
4
  import { FormProvider, useForm } from "react-hook-form";
@@ -22,16 +22,21 @@ import { Step } from "../types";
22
22
  import { ProductSetContextProvider, ProductSetLoadingContext } from "./context";
23
23
  import { SelectItem } from "../../types/generic/SelectItem";
24
24
  import { checkAvailableTimesErrors, getFilteredTemplates } from "../utils";
25
+ import { ErrorModal } from "../../iframe/order-process/components/ErrorModal";
25
26
 
26
27
  export interface WithIsLoading {
27
28
  isLoading: boolean;
28
29
  }
30
+ export interface WithIdOptional {
31
+ id?: number;
32
+ }
33
+
29
34
  export interface WithId {
30
35
  id: number;
31
36
  }
32
37
  export interface ProductSetFormValues
33
38
  extends FormValues,
34
- WithId,
39
+ WithIdOptional,
35
40
  ProductSetControlValues {
36
41
  steps: Step[];
37
42
  isOverrides?: boolean;
@@ -82,6 +87,7 @@ export function ProductSetForm({
82
87
  onApproveDialog,
83
88
  onDeclineDialog,
84
89
  } = useDialogContext();
90
+ const [errorMessage, setErrorMessage] = useState("");
85
91
 
86
92
  const form = useForm<ProductSetFormValues>({
87
93
  defaultValues,
@@ -119,11 +125,18 @@ export function ProductSetForm({
119
125
  if (!serverErrors) {
120
126
  return;
121
127
  }
128
+ if (Array.isArray(serverErrors) && serverErrors[0]) {
129
+ setErrorMessage(serverErrors[0]);
130
+ }
122
131
  FormErrorService.handleServerErrors(serverErrors, setError);
123
132
  }, [serverErrors, setError]);
124
133
 
125
134
  useEffect(() => {
126
- window.history.pushState(null, "", window.location.pathname);
135
+ window.history.pushState(
136
+ null,
137
+ "",
138
+ window.location.pathname + window.location.search,
139
+ );
127
140
  window.addEventListener("beforeunload", onBeforeUnload);
128
141
  window.addEventListener("popstate", onPopState);
129
142
 
@@ -150,6 +163,12 @@ export function ProductSetForm({
150
163
  onDecline={onDeclineDialog}
151
164
  />
152
165
 
166
+ <ErrorModal
167
+ message={errorMessage}
168
+ isOpen={!!errorMessage}
169
+ onClose={() => setErrorMessage("")}
170
+ />
171
+
153
172
  <FormProvider {...form}>
154
173
  <Form onSubmit={form.handleSubmit(submitHandler(onSubmitAndRedirect))}>
155
174
  <ProductSetLoadingContext.Consumer>
@@ -1,7 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-nocheck
3
- import React, { useContext, useState } from "react";
4
-
1
+ import { useContext, useState } from "react";
5
2
  import {
6
3
  ArrayPath,
7
4
  Controller,
@@ -82,14 +79,14 @@ export const ProductZonesControl = <T extends FormValues>({
82
79
 
83
80
  const productZonesError = HookFormService.getErrors<T>(
84
81
  `${productZonesFieldName}.root` as Path<T>,
85
- errors
82
+ errors,
86
83
  );
87
84
 
88
85
  const zoneCapacity = useWatch({
89
86
  control,
90
87
  name: [
91
88
  ...fields.map(
92
- (_, index) => `${productZonesFieldName}.${index}.capacity` as const
89
+ (_, index) => `${productZonesFieldName}.${index}.capacity` as const,
93
90
  ),
94
91
  ],
95
92
  });
@@ -98,7 +95,7 @@ export const ProductZonesControl = <T extends FormValues>({
98
95
  control,
99
96
  name: [
100
97
  ...fields.map(
101
- (_, index) => `${productZonesFieldName}.${index}.duration` as const
98
+ (_, index) => `${productZonesFieldName}.${index}.duration` as const,
102
99
  ),
103
100
  ],
104
101
  });
@@ -29,7 +29,7 @@ Default.args = {
29
29
  };
30
30
 
31
31
  export const WithBookingManagement: Story<SelectCategoryModalProps> = (
32
- args,
32
+ args
33
33
  ) => (
34
34
  <ProductSetLoadingContext.Provider value={contextValue}>
35
35
  <SelectCategoryModal {...args} />
@@ -25,7 +25,7 @@ import {
25
25
  } from "react-icons/fa";
26
26
  import { ProductSetLoadingContext } from "./context";
27
27
 
28
- const CATEGORY_TYPES_NAMES = {
28
+ export const CATEGORY_TYPES_NAMES = {
29
29
  menuItems: CATEGORY_TYPE_MENU_ITEMS,
30
30
  tickets: CATEGORY_TYPE_TICKETS,
31
31
  bookings: CATEGORY_TYPE_BOOKINGS,
@@ -33,7 +33,7 @@ const CATEGORY_TYPES_NAMES = {
33
33
  fixedDuration: CATEGORY_TYPE_FIXED_DURATION,
34
34
  } as const;
35
35
 
36
- type CategoryConfig = { label: string; icon: ReactElement };
36
+ export type CategoryConfig = { label: string; icon: ReactElement };
37
37
 
38
38
  const MAIN_CATEGORIES: Partial<Record<CategoryType, CategoryConfig>> = {
39
39
  [CATEGORY_TYPES_NAMES.tickets]: {
@@ -71,9 +71,6 @@ export function SubProductsControl({
71
71
  images: subProducts[index]?.images as Image[],
72
72
  };
73
73
  // @ts-expect-error TS2345
74
- // @TODO fix prod type error
75
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
76
- // @ts-ignore
77
74
  append(subProductCopy);
78
75
  }}
79
76
  />
@@ -47,9 +47,6 @@ export const VenueMapsControl = ({
47
47
  url={image.url}
48
48
  name={name}
49
49
  points={points}
50
- // @TODO fix prod type error
51
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
52
- // @ts-ignore
53
50
  products={products}
54
51
  pointProducts={pointProducts}
55
52
  onPointProductsChange={onPointProductsChange}
@@ -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>
@@ -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"
@@ -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
 
@@ -24,22 +22,10 @@ export function WorkingHoursInputDescription() {
24
22
  <Row key={i}>
25
23
  <Col xs="auto">{weekdays[i]}:</Col>
26
24
  <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}
25
+ {t("timeInterval", {
26
+ start: weekday.start,
27
+ end: weekday.end,
28
+ })}
43
29
  </Col>
44
30
  </Row>
45
31
  );
@@ -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),