@licklist/design 0.63.1-dev.6 → 0.63.1

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 (142) hide show
  1. package/bitbucket-pipelines.yml +8 -0
  2. package/dist/date-time-button/DateTimeButton.js +1 -1
  3. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  4. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +1 -1
  5. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
  6. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -1
  7. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -1
  8. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -1
  9. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  10. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
  11. package/dist/product-set/control/DateInput.js +1 -1
  12. package/dist/product-set/control/ProductSetControl.d.ts +2 -3
  13. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  14. package/dist/product-set/control/ProductSetControl.js +1 -1
  15. package/dist/product-set/form/ProductCategoriesControl.d.ts +1 -3
  16. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  17. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  18. package/dist/product-set/form/ProductSetForm.d.ts +2 -6
  19. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  20. package/dist/product-set/form/ProductSetForm.js +1 -1
  21. package/dist/product-set/form/ProductsControl.d.ts +1 -3
  22. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  23. package/dist/product-set/form/ProductsControl.js +1 -1
  24. package/dist/product-set/form/StepsControl.d.ts +1 -3
  25. package/dist/product-set/form/StepsControl.d.ts.map +1 -1
  26. package/dist/product-set/form/StepsControl.js +1 -1
  27. package/dist/product-set/product/ProductControl.d.ts +0 -1
  28. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  29. package/dist/product-set/product/ProductControl.js +1 -1
  30. package/dist/product-set/step/StepControl.d.ts +1 -2
  31. package/dist/product-set/step/StepControl.d.ts.map +1 -1
  32. package/dist/product-set/step/StepControl.js +1 -1
  33. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  34. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  35. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -3
  36. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  37. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  38. package/dist/recurring-date-picker-input/utils.d.ts +0 -6
  39. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  40. package/dist/recurring-date-picker-input/utils.js +1 -1
  41. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  42. package/dist/sales/coupon/control/CouponFormControl.d.ts +1 -2
  43. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  44. package/dist/sales/coupon/control/CouponFormControl.js +1 -1
  45. package/dist/sales/coupon/form/CouponFrom.d.ts +2 -2
  46. package/dist/sales/coupon/form/CouponFrom.d.ts.map +1 -1
  47. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  48. package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
  49. package/dist/setting/dashboard/DashboardSettingForm.d.ts +0 -1
  50. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  51. package/dist/setting/dashboard/DashboardSettingForm.js +1 -1
  52. package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
  53. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  54. package/dist/sortable-tree/SortableTreeItem.js +1 -1
  55. package/dist/styles/iframe-page/PageBody.scss +1 -0
  56. package/dist/styles/sales/BookingResults.scss +1 -1
  57. package/dist/typeahead/Typeahead.d.ts +1 -2
  58. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  59. package/dist/typeahead/Typeahead.js +1 -1
  60. package/dist/zone/form/ZoneForm.d.ts +2 -2
  61. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  62. package/dist/zone/form/ZoneForm.js +1 -1
  63. package/dist/zone/form/components/ZoneControl.d.ts +2 -2
  64. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  65. package/dist/zone/form/components/ZoneControl.js +1 -1
  66. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -4
  67. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  68. package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
  69. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  70. package/jest.config.js +29 -0
  71. package/package.json +37 -12
  72. package/src/date-time-button/DateTimeButton.stories.tsx +1 -2
  73. package/src/date-time-button/DateTimeButton.tsx +5 -7
  74. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +9 -14
  75. package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +0 -2
  76. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +0 -1
  77. package/src/product-set/control/DateAndRecurrenceInput.tsx +2 -3
  78. package/src/product-set/control/DateInput.tsx +2 -2
  79. package/src/product-set/control/ProductSetControl.tsx +4 -11
  80. package/src/product-set/form/ProductCategoriesControl.tsx +4 -15
  81. package/src/product-set/form/ProductSetForm.tsx +2 -13
  82. package/src/product-set/form/ProductsControl.tsx +77 -93
  83. package/src/product-set/form/StepsControl.tsx +7 -15
  84. package/src/product-set/product/ProductControl.tsx +39 -39
  85. package/src/product-set/step/StepControl.tsx +3 -4
  86. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +18 -4
  87. package/src/recurring-date-picker-input/RecurringDatePickerInput.stories.tsx +7 -13
  88. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -12
  89. package/src/recurring-date-picker-input/utils.ts +1 -82
  90. package/src/sales/booking/results/components/ResultCard.tsx +3 -0
  91. package/src/sales/coupon/control/CouponFormControl.tsx +51 -28
  92. package/src/sales/coupon/form/CouponFrom.tsx +15 -5
  93. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  94. package/src/setting/dashboard/DashboardSettingForm.tsx +0 -13
  95. package/src/sortable-tree/SortableTreeItem.tsx +3 -0
  96. package/src/static/switch/BooleanSwitch.tsx +1 -1
  97. package/src/styles/iframe-page/PageBody.scss +1 -0
  98. package/src/styles/sales/BookingResults.scss +1 -1
  99. package/src/typeahead/Typeahead.tsx +3 -16
  100. package/src/zone/form/ZoneForm.tsx +2 -3
  101. package/src/zone/form/components/ZoneControl.tsx +3 -3
  102. package/src/zone/form/components/ZoneRecurrencesControl.tsx +5 -7
  103. package/src/zone/form/utils/dates.ts +10 -9
  104. package/tests/Auth/Authorizer.test.tsx +194 -0
  105. package/tests/Auth/Layout/UserNavDropDown.test.tsx +43 -0
  106. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +33 -0
  107. package/tests/Auth/Login/LoginComponent.test.tsx +246 -0
  108. package/tests/Auth/Login/LoginFormComponent.test.tsx +182 -0
  109. package/tests/Auth/Register/RegisterComponent.test.tsx +285 -0
  110. package/tests/Auth/Register/RegisterFormComponent.test.tsx +170 -0
  111. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +130 -0
  112. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +133 -0
  113. package/tests/Auth/Social/SocialFormComponent.test.tsx +118 -0
  114. package/tests/FileUpload/FileUpload.test.tsx +42 -0
  115. package/tests/Notification/EmailTemplate.test.tsx +82 -0
  116. package/tests/ProductSet/ProductSetPopover.test.tsx +40 -0
  117. package/tests/Report/Report.test.tsx +48 -0
  118. package/tests/Sales/Coupon.test.tsx +51 -0
  119. package/tests/Sales/SalesAndVIews.test.tsx +63 -0
  120. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +56 -0
  121. package/tests/Table/FilterHelperComponent.test.tsx +88 -0
  122. package/tests/Table/PaginationHelperComponent.test.tsx +109 -0
  123. package/tests/Table/PerPageHelperComponent.test.tsx +34 -0
  124. package/tests/Table/TableHelperComponent.test.tsx +295 -0
  125. package/tests/TipTapEditor/TipTapEditor.test.tsx +28 -0
  126. package/tests/__mock__/hooks/useAuthApi.ts +13 -0
  127. package/tests/__mock__/hooks/useAuthMock.ts +13 -0
  128. package/tests/__mock__/hooks/useFormMock.ts +27 -0
  129. package/tests/__mock__/hooks/useNotificationMock.ts +13 -0
  130. package/tests/__mock__/hooks/useQueryMock.ts +16 -0
  131. package/tests/__mock__/hooks/useSocialApiMock.ts +20 -0
  132. package/tests/__mock__/hooks/useTranslationMock.ts +17 -0
  133. package/tests/__mock__/hooks/useUserApiMock.ts +18 -0
  134. package/tests/__mock__/hooks/useUserMock.ts +13 -0
  135. package/tests/__mock__/styleMock.js +1 -0
  136. package/tests/__mock__/windowMock.ts +5 -0
  137. package/tests/packages/react-query.tsx +28 -0
  138. package/tests/setupTests.ts +10 -0
  139. package/dist/sales/coupon/utils/index.d.ts +0 -7
  140. package/dist/sales/coupon/utils/index.d.ts.map +0 -1
  141. package/dist/sales/coupon/utils/index.js +0 -1
  142. package/src/sales/coupon/utils/index.ts +0 -13
@@ -35,8 +35,6 @@ interface ProductsControlProps extends WithIsLoading {
35
35
  categoryType: CategoryType;
36
36
  zones?: Zone[];
37
37
  isOverrides?: boolean;
38
- isEventEditProductSet?: boolean;
39
- isCreateNewOverrides?: boolean;
40
38
  }
41
39
 
42
40
  const getDefaultProductValue = (sort: number): Product => ({
@@ -59,7 +57,6 @@ const getDefaultProductValue = (sort: number): Product => ({
59
57
  quantitySelector: 1,
60
58
  hasSpecialNotes: false,
61
59
  weight: 0,
62
- originalProductId: null,
63
60
  type: DEFAULT_PRODUCT_TYPE,
64
61
  tierId: Number(uniqueId()),
65
62
  zoneId: null,
@@ -82,8 +79,6 @@ export function ProductsControl({
82
79
  categoryType,
83
80
  zones,
84
81
  isOverrides,
85
- isEventEditProductSet,
86
- isCreateNewOverrides,
87
82
  }: ProductsControlProps) {
88
83
  const { t } = useTranslation("Design");
89
84
  const form = useFormContext<ProductSetFormValues>();
@@ -208,101 +203,90 @@ export function ProductsControl({
208
203
  onDragEnd={handleDragEnd}
209
204
  sensors={[mouseSensor]}
210
205
  >
211
- {fields.map((product, index) => {
212
- const isOverridesProductSet = isEventEditProductSet
213
- ? !!product.id
214
- : isOverrides && !!product.originalProductId;
215
-
216
- const isNewProductOverrides = isCreateNewOverrides && !!product.id;
217
-
218
- return (
219
- <Controller
220
- key={product._id}
221
- control={control}
222
- name={`${productControlFieldName}.${index}.name` as const}
223
- rules={{
224
- required: t("Validation:fieldRequired", {
225
- attribute: t("name"),
226
- }) as string,
227
- }}
228
- render={({ field: { value, onChange } }) => (
229
- <SortableTree.Item
230
- key={`product-${product._id}`}
231
- id={String(product._id)}
232
- isExpanded={isFirstProductAdded}
233
- isInvalid={!!categoryProductErrors}
234
- title={value}
235
- isOverride={isOverrides}
236
- badge={
237
- <Badge className="product-badge">{t("product")}</Badge>
238
- }
239
- isIconInHeader={false}
240
- cancelChanges={() => cancelChanges(index)}
241
- edit={() => edit(index)}
242
- secondaryBadge={getBadgeConfig(categoryType, t(categoryType))}
243
- subTitle={
244
- <div className="product-set-badges-container">
245
- <div className="product-set-subtitle-dot product-set-subtitle-product-dot" />
246
- <span>
247
- {`£${prices[index]} ${t("each")} - ${t("qty")}:${
248
- !isUnlimitedQuantities[index]
249
- ? ` ${quantities[index]}`
250
- : t(" unlimited")
251
- } ${
252
- !isUnlimitedQuantities[index]
253
- ? ` - ${t("possibleRevenue")} £${
254
- prices[index] * quantities[index]
255
- }`
256
- : ""
257
- } `}
258
- </span>
259
- </div>
260
- }
261
- modalLabel={t("addNewProduct")}
262
- modalClass={ProductSetModalClasses.product}
263
- isNewAdded={showProductModal}
264
- body={
265
- <ProductControl<ProductSetFormValues>
266
- isLoading={isLoading}
267
- quantityType={quantityType}
268
- allowDeposits={allowDeposits}
269
- hasBookingManagement={false}
270
- fieldNamePrefix={
271
- `${productControlFieldName}.${index}` as const
272
- }
273
- productName={value}
274
- onProductNameChange={onChange}
275
- hasTicket={hasTicket}
276
- categoryType={categoryType}
277
- zoneDuration={catergoryZone?.defaultDuration}
278
- isOverrides={
279
- isNewProductOverrides || isOverridesProductSet
280
- }
281
- />
282
- }
283
- onDelete={() => onProductRemove(index)}
284
- validate={() =>
285
- trigger(`${productControlFieldName}.${index}`)
286
- }
287
- saveValidField={saveValidField}
288
- // preItem={<Popover className="d-none d-sm-block" />}
289
- >
290
- <SubProductsControl
206
+ {fields.map((product, index) => (
207
+ <Controller
208
+ key={product._id}
209
+ control={control}
210
+ name={`${productControlFieldName}.${index}.name` as const}
211
+ rules={{
212
+ required: t("Validation:fieldRequired", {
213
+ attribute: t("name"),
214
+ }) as string,
215
+ }}
216
+ render={({ field: { value, onChange } }) => (
217
+ <SortableTree.Item
218
+ key={`product-${product._id}`}
219
+ id={String(product._id)}
220
+ isExpanded={isFirstProductAdded}
221
+ isInvalid={!!categoryProductErrors}
222
+ title={value}
223
+ isOverride={isOverrides}
224
+ badge={<Badge className="product-badge">{t("product")}</Badge>}
225
+ isIconInHeader={false}
226
+ cancelChanges={() => cancelChanges(index)}
227
+ edit={() => edit(index)}
228
+ isProduct
229
+ secondaryBadge={getBadgeConfig(categoryType, t(categoryType))}
230
+ subTitle={
231
+ <div className="product-set-badges-container">
232
+ <div className="product-set-subtitle-dot product-set-subtitle-product-dot" />
233
+ <span>
234
+ {`£${prices[index]} ${t("each")} - ${t("qty")}:${
235
+ !isUnlimitedQuantities[index]
236
+ ? ` ${quantities[index]}`
237
+ : t(" unlimited")
238
+ } ${
239
+ !isUnlimitedQuantities[index]
240
+ ? ` - ${t("possibleRevenue")} £${
241
+ prices[index] * quantities[index]
242
+ }`
243
+ : ""
244
+ } `}
245
+ </span>
246
+ </div>
247
+ }
248
+ modalLabel={t("addNewProduct")}
249
+ modalClass={ProductSetModalClasses.product}
250
+ isNewAdded={showProductModal}
251
+ body={
252
+ <ProductControl<ProductSetFormValues>
291
253
  isLoading={isLoading}
292
254
  quantityType={quantityType}
293
- stepIndex={stepIndex}
294
- productCategoryIndex={productCategoryIndex}
295
- productIndex={index}
255
+ allowDeposits={allowDeposits}
256
+ hasBookingManagement={false}
257
+ fieldNamePrefix={
258
+ `${productControlFieldName}.${index}` as const
259
+ }
260
+ productName={value}
261
+ onProductNameChange={onChange}
262
+ hasTicket={hasTicket}
263
+ categoryType={categoryType}
264
+ zoneDuration={catergoryZone?.defaultDuration}
265
+ isOverrides={isOverrides}
296
266
  />
297
- </SortableTree.Item>
298
- )}
299
- />
300
- );
301
- })}
267
+ }
268
+ onDelete={() => onProductRemove(index)}
269
+ validate={() => trigger(`${productControlFieldName}.${index}`)}
270
+ saveValidField={saveValidField}
271
+ // preItem={<Popover className="d-none d-sm-block" />}
272
+ >
273
+ <SubProductsControl
274
+ isLoading={isLoading}
275
+ quantityType={quantityType}
276
+ stepIndex={stepIndex}
277
+ productCategoryIndex={productCategoryIndex}
278
+ productIndex={index}
279
+ />
280
+ </SortableTree.Item>
281
+ )}
282
+ />
283
+ ))}
302
284
  </SortableTree>
303
285
  <CreateProductSetItem
304
286
  title={t("addProduct")}
287
+ isOverride={isOverrides}
305
288
  onClick={() => {
289
+ if (isOverrides) return;
306
290
  append(getDefaultProductValue(fields.length));
307
291
  setShowProductModal(true);
308
292
 
@@ -19,16 +19,9 @@ import { ProductSetFormValues } from "./ProductSetForm";
19
19
  interface StepsControlProps {
20
20
  isLoading: boolean;
21
21
  isOverrides?: boolean;
22
- isEventEditProductSet?: boolean;
23
- isCreateNewOverrides?: boolean;
24
22
  }
25
23
 
26
- export function StepsControl({
27
- isLoading,
28
- isOverrides,
29
- isEventEditProductSet,
30
- isCreateNewOverrides,
31
- }: StepsControlProps) {
24
+ export function StepsControl({ isLoading, isOverrides }: StepsControlProps) {
32
25
  const form = useFormContext<ProductSetFormValues>();
33
26
  const { t } = useTranslation("Design");
34
27
  const [showStepModal, setShowStepModal] = useState(false);
@@ -75,9 +68,9 @@ export function StepsControl({
75
68
  <>
76
69
  {fields.map((step, index) => {
77
70
  const stepFieldName = `steps.${index}` as const;
71
+
78
72
  const stepData = getValues(stepFieldName);
79
- const isOverrideStep =
80
- (isOverrides || isCreateNewOverrides) && !!step.id;
73
+
81
74
  return (
82
75
  <Controller
83
76
  key={`step-${step._id}`}
@@ -99,9 +92,9 @@ export function StepsControl({
99
92
  modalLabel={t("addNewStep")}
100
93
  modalClass={ProductSetModalClasses.step}
101
94
  isNewAdded={showStepModal}
102
- edit={() => edit(index)}
95
+ edit={() => !isOverrides && edit(index)}
103
96
  cancelChanges={() => cancelChanges(index)}
104
- isOverride={isOverrideStep}
97
+ isOverride={isOverrides}
105
98
  subTitle={
106
99
  <div className="product-set-badges-container">
107
100
  <div className="product-set-subtitle-dot product-set-subtitle-step-dot" />
@@ -117,7 +110,6 @@ export function StepsControl({
117
110
  stepIndex={index}
118
111
  stepName={value}
119
112
  onStepNameChange={onChange}
120
- isOverrides={isOverrideStep}
121
113
  />
122
114
  }
123
115
  onDelete={() => remove(index)}
@@ -148,8 +140,6 @@ export function StepsControl({
148
140
  isLoading={isLoading}
149
141
  stepIndex={index}
150
142
  isOverrides={isOverrides}
151
- isCreateNewOverrides={isCreateNewOverrides}
152
- isEventEditProductSet={isEventEditProductSet}
153
143
  />
154
144
  </SortableTree.Item>
155
145
  )}
@@ -159,7 +149,9 @@ export function StepsControl({
159
149
 
160
150
  <CreateProductSetItem
161
151
  title={t("addStep")}
152
+ isOverride={isOverrides}
162
153
  onClick={() => {
154
+ if (isOverrides) return;
163
155
  append(getDefaultStepsValues());
164
156
  setShowStepModal(true);
165
157
  if (errors.steps?.type === HookFormService.manualErrorType) {
@@ -7,17 +7,14 @@ import {
7
7
  QUANTITY_TYPE_LIST_DTO,
8
8
  QUANTITY_TYPE_RECHARGING,
9
9
  } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
10
- import {
11
- ProductType,
12
- PRODUCT_DEfAULT_COLORS,
13
- } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
10
+ import { ProductType } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
14
11
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
15
- import clsx from "clsx";
16
12
  import {
17
13
  FieldNamePrefixPath,
18
14
  FormValues,
19
15
  } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
20
16
  import { useId } from "@react-aria/utils";
17
+ import clsx from "clsx";
21
18
  import React, {
22
19
  ChangeEvent,
23
20
  useCallback,
@@ -39,7 +36,7 @@ import {
39
36
  } from "react-hook-form";
40
37
  import { useTranslation } from "react-i18next";
41
38
  import { useImages } from "@licklist/plugins/dist/hooks/Media/useImages";
42
-
39
+ import { PRODUCT_DEfAULT_COLORS } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
43
40
  import {
44
41
  Image,
45
42
  IMAGE_TYPE_IMAGE,
@@ -89,7 +86,6 @@ export interface ProductControlValues
89
86
  totalQuantity: number;
90
87
  isAvailable: boolean;
91
88
  isSoldOut: boolean;
92
- originalProductId: number | null;
93
89
  isUnlimited: boolean;
94
90
  isRequired: boolean;
95
91
  quantitySelector: number;
@@ -150,7 +146,7 @@ export function ProductControl<T extends FormValues>({
150
146
  clearErrors,
151
147
  } = useFormContext<T>();
152
148
 
153
- const { setLoading, productGroupList } = useContext(ProductSetLoadingContext);
149
+ const { setLoading } = useContext(ProductSetLoadingContext);
154
150
  const { t } = useTranslation(["Design", "Validation", "ProductSet"]);
155
151
  const [expanded, setExpanded] = useState(false);
156
152
  const [initialImages, setInitialImages] = useState<Image[] | null>(null);
@@ -160,10 +156,11 @@ export function ProductControl<T extends FormValues>({
160
156
  );
161
157
  const capacity = watch(`${fieldNamePrefix}.capacity` as Path<T>);
162
158
  const disabledDuration = capacity === "0" || !capacity;
159
+
163
160
  const advancedId = useId();
164
161
  const nameId = useId();
165
-
166
- const productGroupId = useId();
162
+ // @TODO: no need for v1 release
163
+ // const productGroupId = useId();
167
164
  const descriptionId = useId();
168
165
  const termsAndConditionsId = useId();
169
166
  const isAvailableId = useId();
@@ -403,35 +400,6 @@ export function ProductControl<T extends FormValues>({
403
400
  isRequired={false}
404
401
  defaultColors={PRODUCT_DEfAULT_COLORS}
405
402
  />
406
-
407
- <Form.Group controlId={productGroupId}>
408
- <Form.Label>{t("productGroup")}</Form.Label>
409
- <Form.Control
410
- as="select"
411
- {...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
412
- isInvalid={HookFormService.isInvalid<T>(
413
- `${fieldNamePrefix}.productGroupId` as Path<T>,
414
- errors
415
- )}
416
- disabled={isLoading || isOverrides}
417
- defaultValue=""
418
- >
419
- <option value="">{t("Design:selectProductGroup")}</option>
420
- {productGroupList.map((productGroup) => {
421
- return (
422
- <option value={productGroup.id} key={productGroup.id}>
423
- {productGroup.value}
424
- </option>
425
- );
426
- })}
427
- </Form.Control>
428
- <Form.Control.Feedback type="invalid">
429
- {HookFormService.getErrors<T>(
430
- `${fieldNamePrefix}.productGroupId` as Path<T>,
431
- errors
432
- )}
433
- </Form.Control.Feedback>
434
- </Form.Group>
435
403
  </Col>
436
404
  </Row>
437
405
 
@@ -704,6 +672,38 @@ export function ProductControl<T extends FormValues>({
704
672
  </Collapse>
705
673
 
706
674
  <Row>
675
+ {/* @TODO: no need for v1 release
676
+ <Col xs={12} sm={6}>
677
+ <Form.Group controlId={productGroupId}>
678
+ <Form.Label>{t("productGroup")}</Form.Label>
679
+ <Form.Control
680
+ as="select"
681
+ {...register(`${fieldNamePrefix}.productGroupId` as Path<T>)}
682
+ isInvalid={HookFormService.isInvalid<T>(
683
+ `${fieldNamePrefix}.productGroupId` as Path<T>,
684
+ errors
685
+ )}
686
+ disabled={isLoading}
687
+ defaultValue=""
688
+ >
689
+ <option value="">{t("Design:selectProductGroup")}</option>
690
+ {productGroupList.map((productGroup) => {
691
+ return (
692
+ <option value={productGroup.id} key={productGroup.id}>
693
+ {productGroup.value}
694
+ </option>
695
+ );
696
+ })}
697
+ </Form.Control>
698
+ <Form.Control.Feedback type="invalid">
699
+ {HookFormService.getErrors<T>(
700
+ `${fieldNamePrefix}.productGroupId` as Path<T>,
701
+ errors
702
+ )}
703
+ </Form.Control.Feedback>
704
+ </Form.Group>
705
+ </Col> */}
706
+
707
707
  <Col xs={12}>
708
708
  {hasBookingManagement && (
709
709
  <ProductBookingManagementControl<T>
@@ -26,7 +26,6 @@ export interface StepControlProps extends IsDeletableEvent {
26
26
  stepIndex: number;
27
27
  stepName: string;
28
28
  onStepNameChange: (args: any) => void;
29
- isOverrides?: boolean;
30
29
  }
31
30
 
32
31
  export function StepControl({
@@ -34,7 +33,6 @@ export function StepControl({
34
33
  stepIndex,
35
34
  stepName,
36
35
  onStepNameChange,
37
- isOverrides = false,
38
36
  }: StepControlProps) {
39
37
  const { providerHasMap } = useContext(ProductSetLoadingContext);
40
38
  const {
@@ -44,6 +42,7 @@ export function StepControl({
44
42
  watch,
45
43
  } = useFormContext<ProductSetFormValues>();
46
44
  const { t } = useTranslation("Design");
45
+
47
46
  const fieldName = `steps.${stepIndex}.name` as const;
48
47
  const productCategoriesFieldName =
49
48
  `steps.${stepIndex}.productCategories` as const;
@@ -72,7 +71,7 @@ export function StepControl({
72
71
  fieldName,
73
72
  errors
74
73
  )}
75
- disabled={isLoading || isOverrides}
74
+ disabled={isLoading}
76
75
  />
77
76
  )}
78
77
  control={control}
@@ -115,7 +114,7 @@ export function StepControl({
115
114
  name={name}
116
115
  value={Boolean(value)}
117
116
  onChange={onChange}
118
- disabled={isLoading || isOverrides}
117
+ disabled={isLoading}
119
118
  />
120
119
  )}
121
120
  control={control}
@@ -1,7 +1,9 @@
1
+ import { DateTime } from "luxon";
1
2
  import React from "react";
2
3
  import { Col, Row } from "react-bootstrap";
3
4
  import { useFormContext } from "react-hook-form";
4
5
  import { useTranslation } from "react-i18next";
6
+ import { TIME_FORMAT } from "@licklist/core/dist/Config";
5
7
  import { WorkingHoursInputValues } from ".";
6
8
  import { useWeekdays } from "./utils";
7
9
 
@@ -23,10 +25,22 @@ export function WorkingHoursInputDescription() {
23
25
  <Row key={i}>
24
26
  <Col xs="auto">{weekdays[i]}:</Col>
25
27
  <Col>
26
- {t("timeInterval", {
27
- start: weekday.start,
28
- end: weekday.end,
29
- })}
28
+ {weekday?.end
29
+ ? weekday.start
30
+ ? t("timeInterval", {
31
+ start: DateTime.fromISO(weekday.start).toFormat(
32
+ TIME_FORMAT
33
+ ),
34
+ end: DateTime.fromISO(weekday.start).toFormat(
35
+ TIME_FORMAT
36
+ ),
37
+ })
38
+ : t("timeFrom", {
39
+ start: DateTime.fromISO(weekday.start).toFormat(
40
+ TIME_FORMAT
41
+ ),
42
+ })
43
+ : null}
30
44
  </Col>
31
45
  </Row>
32
46
  );
@@ -1,19 +1,22 @@
1
1
  import React from "react";
2
2
  import { Meta, Story } from "@storybook/react";
3
3
  import { Card } from "react-bootstrap";
4
- import { DateTime } from "luxon";
5
- import { DATE_FORMAT, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
6
4
  import {
7
5
  RecurringDatePickerInput,
8
6
  RecurringDatePickerInputProps,
9
7
  } from "./RecurringDatePickerInput";
8
+ import { DateTime } from "luxon";
9
+ import { DATE_FORMAT, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
10
10
 
11
11
  export default {
12
12
  title: "RecurringDatePickerInput",
13
13
  component: RecurringDatePickerInput,
14
14
  } as Meta;
15
15
 
16
- export const Default: Story<RecurringDatePickerInputProps> = (args) => {
16
+ interface DefaultRecurringDatePickerInputProps
17
+ extends RecurringDatePickerInputProps {}
18
+
19
+ export const Default: Story<DefaultRecurringDatePickerInputProps> = (args) => {
17
20
  return (
18
21
  <Card style={{ maxWidth: "max-content" }}>
19
22
  <Card.Body>
@@ -22,7 +25,7 @@ export const Default: Story<RecurringDatePickerInputProps> = (args) => {
22
25
  </Card>
23
26
  );
24
27
  };
25
- export const Valid: Story<RecurringDatePickerInputProps> = (args) => {
28
+ export const Valid: Story<DefaultRecurringDatePickerInputProps> = (args) => {
26
29
  return (
27
30
  <Card style={{ maxWidth: "max-content" }}>
28
31
  <Card.Body>
@@ -33,15 +36,6 @@ export const Valid: Story<RecurringDatePickerInputProps> = (args) => {
33
36
  };
34
37
  Default.args = {
35
38
  onChange: (data) => console.log("onSubmit", data),
36
- workHours: [
37
- { start: "20:00", end: "04:00", day: 0, description: "" },
38
- { start: "20:00", end: "04:00", day: 1, description: "" },
39
- { start: "20:00", end: "04:00", day: 2, description: "" },
40
- { start: "20:00", end: "12:00", day: 3, description: "" },
41
- { start: "20:00", end: "23:00", day: 4, description: "" },
42
- { start: "08:00", end: "12:00", day: 5, description: "" },
43
- { start: "10:00", end: "16:00", day: 6, description: "" },
44
- ],
45
39
  };
46
40
  Valid.args = {
47
41
  onChange: (data) => console.log("onSubmit", data),
@@ -12,14 +12,9 @@ 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";
16
15
  import RecurrenceIntervalAndFrequencyInput from "./RecurrenceIntervalAndFrequencyInput";
17
16
  import RecurrenceWeekdaysInput from "./RecurrenceWeekdaysInput";
18
- import {
19
- parseAndValidateRRule,
20
- SupportedFrequency,
21
- useWorkHoursValidation,
22
- } from "./utils";
17
+ import { parseAndValidateRRule, SupportedFrequency } from "./utils";
23
18
  import { ConfirmModal } from "../modals";
24
19
  import { DeleteFieldButton } from "../product-set/elements";
25
20
 
@@ -31,7 +26,6 @@ export interface RecurringDatePickerInputProps {
31
26
  initialFrequency?: Frequency;
32
27
  setInitialStartDateAfterSelect?: boolean;
33
28
  minDate?: string;
34
- workHours: WorkHour[] | undefined;
35
29
  }
36
30
 
37
31
  export interface RecurringDatePickerInputValues {
@@ -57,7 +51,6 @@ export function RecurringDatePickerInput({
57
51
  setInitialStartDateAfterSelect = false,
58
52
  children,
59
53
  minDate,
60
- workHours,
61
54
  }: PropsWithChildren<RecurringDatePickerInputProps>) {
62
55
  const { t } = useTranslation(["Design"]);
63
56
 
@@ -91,8 +84,6 @@ export function RecurringDatePickerInput({
91
84
  byWeekDay,
92
85
  });
93
86
 
94
- const validator = useWorkHoursValidation(byWeekDay, workHours);
95
-
96
87
  const onSubmit = (nextState: RecurringDatePickerInputValues) => {
97
88
  const end = getDateTimeObject(endDate, endTime || "23:59:59");
98
89
 
@@ -197,8 +188,6 @@ export function RecurringDatePickerInput({
197
188
  <RecurrenceIntervalAndFrequencyInput
198
189
  disabled={disabled}
199
190
  minDate={minDate}
200
- startTimeRules={validator}
201
- endTimeRules={validator}
202
191
  />
203
192
 
204
193
  {children}