@licklist/design 0.58.5 → 0.58.6-dev.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 (169) hide show
  1. package/bitbucket-pipelines.yml +0 -8
  2. package/dist/iframe/event/event-card/IframeEventCard.d.ts +2 -1
  3. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  4. package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
  5. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
  6. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
  7. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
  8. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/product-set/card/ProductSetCard.d.ts +2 -1
  11. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  12. package/dist/product-set/card/ProductSetCard.js +1 -1
  13. package/dist/product-set/control/DateInput.d.ts +17 -0
  14. package/dist/product-set/control/DateInput.d.ts.map +1 -0
  15. package/dist/product-set/control/DateInput.js +1 -0
  16. package/dist/product-set/control/ProductSetControl.d.ts +2 -1
  17. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  18. package/dist/product-set/control/ProductSetControl.js +1 -1
  19. package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts +11 -0
  20. package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts.map +1 -0
  21. package/dist/product-set/control/ProductSetRecurrenceOverridesControl.js +1 -0
  22. package/dist/product-set/control/TutorialGifCard.d.ts +2 -1
  23. package/dist/product-set/control/TutorialGifCard.d.ts.map +1 -1
  24. package/dist/product-set/control/TutorialGifCard.js +1 -1
  25. package/dist/product-set/form/ProductCategoriesControl.d.ts +2 -1
  26. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  27. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  28. package/dist/product-set/form/ProductSetForm.d.ts +7 -2
  29. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  30. package/dist/product-set/form/ProductSetForm.js +1 -1
  31. package/dist/product-set/form/ProductsControl.d.ts +2 -1
  32. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  33. package/dist/product-set/form/ProductsControl.js +1 -1
  34. package/dist/product-set/form/StepsControl.d.ts +2 -1
  35. package/dist/product-set/form/StepsControl.d.ts.map +1 -1
  36. package/dist/product-set/form/StepsControl.js +1 -1
  37. package/dist/product-set/form/SubProductsControl.d.ts +2 -1
  38. package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
  39. package/dist/product-set/form/SubProductsControl.js +1 -1
  40. package/dist/product-set/hooks/useSortableTreeFunctions.d.ts +2 -1
  41. package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
  42. package/dist/product-set/hooks/useSortableTreeFunctions.js +1 -1
  43. package/dist/product-set/item/CreateProductSetItem.d.ts +2 -1
  44. package/dist/product-set/item/CreateProductSetItem.d.ts.map +1 -1
  45. package/dist/product-set/item/CreateProductSetItem.js +1 -1
  46. package/dist/product-set/product/ProductControl.d.ts +2 -1
  47. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  48. package/dist/product-set/product/ProductControl.js +1 -1
  49. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts +4 -2
  50. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
  51. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -1
  52. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts +1 -0
  53. package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
  54. package/dist/product-set/product/quantity/ProductQuantityControl.js +1 -1
  55. package/dist/product-set/product-category/ProductCategoryControl.d.ts +2 -1
  56. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  57. package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
  58. package/dist/recurring-date-picker-input/DatePickerInput.d.ts +19 -0
  59. package/dist/recurring-date-picker-input/DatePickerInput.d.ts.map +1 -0
  60. package/dist/recurring-date-picker-input/DatePickerInput.js +1 -0
  61. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts +15 -0
  62. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -0
  63. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.js +1 -0
  64. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +2 -0
  65. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  66. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  67. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  68. package/dist/sales/booking/results/components/ResultCard.js +1 -1
  69. package/dist/sortable-list/SortableList.d.ts +2 -1
  70. package/dist/sortable-list/SortableList.d.ts.map +1 -1
  71. package/dist/sortable-list/SortableList.js +1 -1
  72. package/dist/sortable-tree/SortableTreeItem.d.ts +3 -1
  73. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  74. package/dist/sortable-tree/SortableTreeItem.js +1 -1
  75. package/dist/static/manual-date-picker/ManualDatePicker.js +1 -1
  76. package/dist/static/manual-date-picker/constants/index.d.ts +4 -1
  77. package/dist/static/manual-date-picker/constants/index.d.ts.map +1 -1
  78. package/dist/static/manual-date-picker/constants/index.js +1 -1
  79. package/dist/static/manual-date-picker/utils/index.d.ts +4 -0
  80. package/dist/static/manual-date-picker/utils/index.d.ts.map +1 -1
  81. package/dist/static/manual-date-picker/utils/index.js +1 -1
  82. package/dist/styles/availability-indicator/AvailabilityIndicator.scss +10 -0
  83. package/dist/styles/iframe-events/Card.scss +24 -8
  84. package/dist/styles/iframe-events/PoweredBy.scss +2 -2
  85. package/dist/styles/iframe-order-process/IframeOrderProcess.scss +0 -2
  86. package/dist/styles/iframe-page/Page.scss +1 -0
  87. package/dist/styles/iframe-page/PageBody.scss +32 -11
  88. package/dist/styles/iframe-page/PageHeader.scss +41 -39
  89. package/dist/styles/product-set/EditVenueMapSetModal.scss +1 -1
  90. package/dist/styles/sales/BookingResults.scss +1 -1
  91. package/package.json +10 -33
  92. package/src/calendar/Calendar.stories.tsx +9 -2
  93. package/src/iframe/event/event-card/IframeEventCard.stories.tsx +1 -0
  94. package/src/iframe/event/event-card/IframeEventCard.tsx +7 -8
  95. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
  96. package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +3 -1
  97. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
  98. package/src/product-set/card/ProductSetCard.tsx +10 -1
  99. package/src/product-set/control/DateInput.tsx +309 -0
  100. package/src/product-set/control/ProductSetControl.tsx +46 -24
  101. package/src/product-set/control/ProductSetRecurrenceOverridesControl.tsx +63 -0
  102. package/src/product-set/control/TutorialGifCard.tsx +11 -3
  103. package/src/product-set/form/ProductCategoriesControl.tsx +12 -1
  104. package/src/product-set/form/ProductSetForm.tsx +10 -1
  105. package/src/product-set/form/ProductsControl.tsx +10 -0
  106. package/src/product-set/form/StepsControl.tsx +8 -2
  107. package/src/product-set/form/SubProductsControl.tsx +3 -0
  108. package/src/product-set/hooks/useSortableTreeFunctions.ts +6 -0
  109. package/src/product-set/item/CreateProductSetItem.tsx +3 -0
  110. package/src/product-set/product/ProductControl.tsx +23 -12
  111. package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +8 -2
  112. package/src/product-set/product/quantity/ProductQuantityControl.tsx +4 -3
  113. package/src/product-set/product-category/ProductCategoryControl.tsx +12 -8
  114. package/src/recurring-date-picker-input/DatePickerInput.tsx +93 -0
  115. package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +136 -0
  116. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +4 -1
  117. package/src/sales/booking/results/BookingResults.stories.tsx +3 -2
  118. package/src/sales/booking/results/components/ResultCard.tsx +2 -5
  119. package/src/sortable-list/SortableList.tsx +3 -0
  120. package/src/sortable-tree/SortableTreeItem.tsx +6 -0
  121. package/src/static/manual-date-picker/ManualDatePicker.tsx +3 -3
  122. package/src/static/manual-date-picker/constants/index.ts +6 -2
  123. package/src/static/manual-date-picker/utils/index.ts +11 -0
  124. package/src/static/switch/BooleanSwitch.tsx +1 -1
  125. package/src/styles/availability-indicator/AvailabilityIndicator.scss +10 -0
  126. package/src/styles/iframe-events/Card.scss +24 -8
  127. package/src/styles/iframe-events/PoweredBy.scss +2 -2
  128. package/src/styles/iframe-order-process/IframeOrderProcess.scss +0 -2
  129. package/src/styles/iframe-page/Page.scss +1 -0
  130. package/src/styles/iframe-page/PageBody.scss +32 -11
  131. package/src/styles/iframe-page/PageHeader.scss +41 -39
  132. package/src/styles/product-set/EditVenueMapSetModal.scss +1 -1
  133. package/src/styles/sales/BookingResults.scss +1 -1
  134. package/jest.config.js +0 -29
  135. package/tests/Auth/Authorizer.test.tsx +0 -194
  136. package/tests/Auth/Layout/UserNavDropDown.test.tsx +0 -43
  137. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +0 -33
  138. package/tests/Auth/Login/LoginComponent.test.tsx +0 -246
  139. package/tests/Auth/Login/LoginFormComponent.test.tsx +0 -182
  140. package/tests/Auth/Register/RegisterComponent.test.tsx +0 -285
  141. package/tests/Auth/Register/RegisterFormComponent.test.tsx +0 -170
  142. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +0 -130
  143. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +0 -133
  144. package/tests/Auth/Social/SocialFormComponent.test.tsx +0 -118
  145. package/tests/FileUpload/FileUpload.test.tsx +0 -42
  146. package/tests/Notification/EmailTemplate.test.tsx +0 -82
  147. package/tests/ProductSet/ProductSetPopover.test.tsx +0 -40
  148. package/tests/Report/Report.test.tsx +0 -48
  149. package/tests/Sales/Coupon.test.tsx +0 -51
  150. package/tests/Sales/SalesAndVIews.test.tsx +0 -63
  151. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +0 -56
  152. package/tests/Table/FilterHelperComponent.test.tsx +0 -88
  153. package/tests/Table/PaginationHelperComponent.test.tsx +0 -109
  154. package/tests/Table/PerPageHelperComponent.test.tsx +0 -34
  155. package/tests/Table/TableHelperComponent.test.tsx +0 -295
  156. package/tests/TipTapEditor/TipTapEditor.test.tsx +0 -28
  157. package/tests/__mock__/hooks/useAuthApi.ts +0 -13
  158. package/tests/__mock__/hooks/useAuthMock.ts +0 -13
  159. package/tests/__mock__/hooks/useFormMock.ts +0 -27
  160. package/tests/__mock__/hooks/useNotificationMock.ts +0 -13
  161. package/tests/__mock__/hooks/useQueryMock.ts +0 -16
  162. package/tests/__mock__/hooks/useSocialApiMock.ts +0 -20
  163. package/tests/__mock__/hooks/useTranslationMock.ts +0 -17
  164. package/tests/__mock__/hooks/useUserApiMock.ts +0 -18
  165. package/tests/__mock__/hooks/useUserMock.ts +0 -13
  166. package/tests/__mock__/styleMock.js +0 -1
  167. package/tests/__mock__/windowMock.ts +0 -5
  168. package/tests/packages/react-query.tsx +0 -28
  169. package/tests/setupTests.ts +0 -10
@@ -9,10 +9,14 @@ import { Icon, Image } from "../../static";
9
9
 
10
10
  export interface TutorialGifCardProps {
11
11
  tutorialAsset?: string;
12
+ isOverrides?: boolean;
12
13
  }
13
14
 
14
15
  // @TODO: Tutorial GIF asset should be passed as context, which is better
15
- const TutorialGifCard = ({ tutorialAsset }: TutorialGifCardProps) => {
16
+ const TutorialGifCard = ({
17
+ tutorialAsset,
18
+ isOverrides,
19
+ }: TutorialGifCardProps) => {
16
20
  const { pathname } = useLocation();
17
21
  const [isVisible, setIsVisible] = useState(pathname?.includes("/create"));
18
22
  const { t } = useTranslation(["Design"]);
@@ -46,8 +50,12 @@ const TutorialGifCard = ({ tutorialAsset }: TutorialGifCardProps) => {
46
50
  </button>
47
51
  </Card.Header>
48
52
  <Card.Body className="tutorial-card-body">
49
- <p>{t("buildProductSet")}</p>
50
- <span>{t("buildProductSetDesc")}</span>
53
+ <p>
54
+ {t(isOverrides ? "buildOverrideProductSet" : "buildProductSet")}
55
+ </p>
56
+ <span>
57
+ {t(isOverrides ? "buildOverrideRules" : "buildProductSetDesc")}
58
+ </span>
51
59
  {tutorialAsset && <Image src={tutorialAsset} alt="Tutorial Gif" />}
52
60
  </Card.Body>
53
61
  </Card>
@@ -35,6 +35,7 @@ import { useSortableTreeFunctions } from "../hooks/useSortableTreeFunctions";
35
35
 
36
36
  interface ProductCategoriesControlProps extends WithIsLoading {
37
37
  stepIndex: number;
38
+ isOverrides?: boolean;
38
39
  }
39
40
 
40
41
  const getCategoryDefaultValue = (
@@ -65,6 +66,7 @@ const getCategoryDefaultValue = (
65
66
  export function ProductCategoriesControl({
66
67
  isLoading,
67
68
  stepIndex,
69
+ isOverrides,
68
70
  }: ProductCategoriesControlProps) {
69
71
  const { t } = useTranslation("Design");
70
72
  const {
@@ -105,6 +107,7 @@ export function ProductCategoriesControl({
105
107
  const { edit, saveValidField, cancelChanges } = useSortableTreeFunctions({
106
108
  fieldName: productCategoriesFieldName,
107
109
  remove,
110
+ isOverrides,
108
111
  });
109
112
 
110
113
  const productCategories: ProductCategory[] = useWatch({
@@ -129,7 +132,7 @@ export function ProductCategoriesControl({
129
132
  });
130
133
 
131
134
  const handleDragEnd = (event) => {
132
- // @TODO uncomment when will be fix for change sort index
135
+ if (isOverrides) return;
133
136
  const { active, over } = event;
134
137
 
135
138
  if (!active || !over || !active?.id || !over?.id) return;
@@ -266,8 +269,10 @@ export function ProductCategoriesControl({
266
269
  categoryName={value}
267
270
  stepIndex={stepIndex}
268
271
  productCategoryIndex={index}
272
+ isOverride={isOverrides}
269
273
  />
270
274
  }
275
+ isOverride={isOverrides}
271
276
  onDelete={() => remove(index)}
272
277
  validate={() =>
273
278
  trigger(`steps.${stepIndex}.productCategories.${index}`)
@@ -290,6 +295,7 @@ export function ProductCategoriesControl({
290
295
  zones={zones}
291
296
  productCategoryIndex={index}
292
297
  categoryType={productCategory.type}
298
+ isOverrides={isOverrides}
293
299
  />
294
300
  </SortableTree.Item>
295
301
  )}
@@ -299,7 +305,9 @@ export function ProductCategoriesControl({
299
305
  </SortableTree>
300
306
  <CreateProductSetItem
301
307
  title={t("addCategory")}
308
+ isOverride={isOverrides}
302
309
  onClick={() => {
310
+ if (isOverrides) return;
303
311
  setIsSelectCategoryVisible(true);
304
312
  }}
305
313
  />
@@ -308,6 +316,7 @@ export function ProductCategoriesControl({
308
316
  isVisible={isSelectCategoryVisible}
309
317
  onHide={() => setIsSelectCategoryVisible(false)}
310
318
  onCategorySelect={(categoryType) => {
319
+ if (isOverrides) return;
311
320
  append(getCategoryDefaultValue(categoryType, fields.length));
312
321
  setShowCategoryModal(true);
313
322
  if (
@@ -321,7 +330,9 @@ export function ProductCategoriesControl({
321
330
  <>
322
331
  <CreateProductSetItem
323
332
  title={t("editMap")}
333
+ isOverride={isOverrides}
324
334
  onClick={() => {
335
+ if (isOverrides) return;
325
336
  setIsVenueMapSetModalVisible(true);
326
337
  }}
327
338
  className={clsx(
@@ -26,14 +26,19 @@ import { checkAvailableTimesErrors, getFilteredTemplates } from "../utils";
26
26
  export interface WithIsLoading {
27
27
  isLoading: boolean;
28
28
  }
29
+ export interface WithIdOptional {
30
+ id?: number;
31
+ }
32
+
29
33
  export interface WithId {
30
34
  id: number;
31
35
  }
32
36
  export interface ProductSetFormValues
33
37
  extends FormValues,
34
- WithId,
38
+ WithIdOptional,
35
39
  ProductSetControlValues {
36
40
  steps: Step[];
41
+ isOverrides?: boolean;
37
42
  }
38
43
 
39
44
  export interface ProductSetFormProps
@@ -50,6 +55,7 @@ export interface ProductSetFormProps
50
55
  providerHasBookingManagement?: ProviderBookingManagementSetting["hasBookingManagement"];
51
56
  zones?: Zone[] | null;
52
57
  isCreateAction?: boolean;
58
+ isOverrides?: boolean;
53
59
  workHours?: WorkHour[];
54
60
  }
55
61
 
@@ -67,6 +73,7 @@ export function ProductSetForm({
67
73
  zones,
68
74
  isCreateAction,
69
75
  workHours,
76
+ isOverrides,
70
77
  ...shared
71
78
  }: ProductSetFormProps) {
72
79
  const { t } = useTranslation("Design");
@@ -84,6 +91,7 @@ export function ProductSetForm({
84
91
  });
85
92
 
86
93
  const { setError, reset } = form;
94
+
87
95
  const formValues = form.watch();
88
96
 
89
97
  const submitHandler = (onSubmit: (values: ProductSetFormValues) => void) => {
@@ -161,6 +169,7 @@ export function ProductSetForm({
161
169
  companyName={companyName}
162
170
  workHours={workHours}
163
171
  providerHasBookingManagement={providerHasBookingManagement}
172
+ isOverrides={isOverrides}
164
173
  />
165
174
  <Row>
166
175
  <Col md={6} sm={12} />
@@ -34,6 +34,7 @@ interface ProductsControlProps extends WithIsLoading {
34
34
  hasTicket?: boolean;
35
35
  categoryType: CategoryType;
36
36
  zones?: Zone[];
37
+ isOverrides?: boolean;
37
38
  }
38
39
 
39
40
  const getDefaultProductValue = (sort: number): Product => ({
@@ -77,6 +78,7 @@ export function ProductsControl({
77
78
  hasTicket,
78
79
  categoryType,
79
80
  zones,
81
+ isOverrides,
80
82
  }: ProductsControlProps) {
81
83
  const { t } = useTranslation("Design");
82
84
  const form = useFormContext<ProductSetFormValues>();
@@ -112,6 +114,7 @@ export function ProductsControl({
112
114
  const { edit, saveValidField, cancelChanges } = useSortableTreeFunctions({
113
115
  fieldName: productControlFieldName,
114
116
  remove,
117
+ isOverrides,
115
118
  });
116
119
 
117
120
  const allowDeposits = watch(
@@ -159,6 +162,7 @@ export function ProductsControl({
159
162
  });
160
163
 
161
164
  const handleDragEnd = (_event) => {
165
+ if (isOverrides) return;
162
166
  const { active, over } = _event;
163
167
 
164
168
  if (!active || !over || !active?.id || !over?.id) return;
@@ -176,6 +180,7 @@ export function ProductsControl({
176
180
  };
177
181
 
178
182
  const onProductRemove = (index: number) => {
183
+ if (isOverrides) return;
179
184
  const currentProduct = getValues(
180
185
  `${productControlFieldName}.${index}` as const
181
186
  );
@@ -215,10 +220,12 @@ export function ProductsControl({
215
220
  isExpanded={isFirstProductAdded}
216
221
  isInvalid={!!categoryProductErrors}
217
222
  title={value}
223
+ isOverride={isOverrides}
218
224
  badge={<Badge className="product-badge">{t("product")}</Badge>}
219
225
  isIconInHeader={false}
220
226
  cancelChanges={() => cancelChanges(index)}
221
227
  edit={() => edit(index)}
228
+ isProduct
222
229
  secondaryBadge={getBadgeConfig(categoryType, t(categoryType))}
223
230
  subTitle={
224
231
  <div className="product-set-badges-container">
@@ -255,6 +262,7 @@ export function ProductsControl({
255
262
  hasTicket={hasTicket}
256
263
  categoryType={categoryType}
257
264
  zoneDuration={catergoryZone?.defaultDuration}
265
+ isOverrides={isOverrides}
258
266
  />
259
267
  }
260
268
  onDelete={() => onProductRemove(index)}
@@ -276,7 +284,9 @@ export function ProductsControl({
276
284
  </SortableTree>
277
285
  <CreateProductSetItem
278
286
  title={t("addProduct")}
287
+ isOverride={isOverrides}
279
288
  onClick={() => {
289
+ if (isOverrides) return;
280
290
  append(getDefaultProductValue(fields.length));
281
291
  setShowProductModal(true);
282
292
 
@@ -18,9 +18,10 @@ import { ProductSetFormValues } from "./ProductSetForm";
18
18
 
19
19
  interface StepsControlProps {
20
20
  isLoading: boolean;
21
+ isOverrides?: boolean;
21
22
  }
22
23
 
23
- export function StepsControl({ isLoading }: StepsControlProps) {
24
+ export function StepsControl({ isLoading, isOverrides }: StepsControlProps) {
24
25
  const form = useFormContext<ProductSetFormValues>();
25
26
  const { t } = useTranslation("Design");
26
27
  const [showStepModal, setShowStepModal] = useState(false);
@@ -42,6 +43,7 @@ export function StepsControl({ isLoading }: StepsControlProps) {
42
43
  const { edit, saveValidField, cancelChanges } = useSortableTreeFunctions({
43
44
  fieldName: "steps",
44
45
  remove,
46
+ isOverrides,
45
47
  });
46
48
 
47
49
  useEffect(() => {
@@ -90,8 +92,9 @@ export function StepsControl({ isLoading }: StepsControlProps) {
90
92
  modalLabel={t("addNewStep")}
91
93
  modalClass={ProductSetModalClasses.step}
92
94
  isNewAdded={showStepModal}
93
- edit={() => edit(index)}
95
+ edit={() => !isOverrides && edit(index)}
94
96
  cancelChanges={() => cancelChanges(index)}
97
+ isOverride={isOverrides}
95
98
  subTitle={
96
99
  <div className="product-set-badges-container">
97
100
  <div className="product-set-subtitle-dot product-set-subtitle-step-dot" />
@@ -136,6 +139,7 @@ export function StepsControl({ isLoading }: StepsControlProps) {
136
139
  <ProductCategoriesControl
137
140
  isLoading={isLoading}
138
141
  stepIndex={index}
142
+ isOverrides={isOverrides}
139
143
  />
140
144
  </SortableTree.Item>
141
145
  )}
@@ -145,7 +149,9 @@ export function StepsControl({ isLoading }: StepsControlProps) {
145
149
 
146
150
  <CreateProductSetItem
147
151
  title={t("addStep")}
152
+ isOverride={isOverrides}
148
153
  onClick={() => {
154
+ if (isOverrides) return;
149
155
  append(getDefaultStepsValues());
150
156
  setShowStepModal(true);
151
157
  if (errors.steps?.type === HookFormService.manualErrorType) {
@@ -15,6 +15,7 @@ interface SubProductsControlProps {
15
15
  productCategoryIndex: number;
16
16
  productIndex: number;
17
17
  isLoading: boolean;
18
+ isOverrides?: boolean;
18
19
  }
19
20
 
20
21
  export function SubProductsControl({
@@ -23,6 +24,7 @@ export function SubProductsControl({
23
24
  stepIndex,
24
25
  productCategoryIndex,
25
26
  productIndex,
27
+ isOverrides,
26
28
  }: SubProductsControlProps) {
27
29
  const form = useFormContext<ProductSetFormValues>();
28
30
  const { fields, append } = useFieldArray({
@@ -49,6 +51,7 @@ export function SubProductsControl({
49
51
  key={`sub-product-${subProduct.id}-${index}`}
50
52
  id={subProduct.id}
51
53
  title={subProduct.name}
54
+ isOverride={isOverrides}
52
55
  body={
53
56
  <ProductControl<ProductSetFormValues>
54
57
  isLoading={isLoading}
@@ -4,24 +4,30 @@ import { useFormContext } from "react-hook-form";
4
4
  interface useSortableTreeFunctionsProps {
5
5
  fieldName: string;
6
6
  remove: (index?: number | number[]) => void;
7
+ isOverrides?: boolean;
7
8
  }
8
9
  export const useSortableTreeFunctions = ({
9
10
  fieldName,
10
11
  remove,
12
+ isOverrides,
11
13
  }: useSortableTreeFunctionsProps) => {
12
14
  const { getValues, setValue } = useFormContext();
13
15
  const [previousValue, setEditValue] = useState(null);
14
16
 
15
17
  const edit = (index: number) => {
18
+ if (isOverrides) return;
16
19
  const currentCategoryProduct = getValues(`${fieldName}.${index}` as const);
17
20
  const cloneCategoryProduct = structuredClone(currentCategoryProduct);
18
21
  setEditValue(cloneCategoryProduct);
19
22
  };
20
23
 
21
24
  const cancelChanges = (index: number) => {
25
+ if (isOverrides) return;
22
26
  if (!previousValue) {
27
+ // eslint-disable-next-line consistent-return
23
28
  return remove(index);
24
29
  }
30
+ // eslint-disable-next-line consistent-return
25
31
  return setValue(`${fieldName}.${index}` as const, previousValue);
26
32
  };
27
33
 
@@ -6,18 +6,21 @@ interface CreateProductSetItemProps {
6
6
  onClick: () => void;
7
7
  title: string;
8
8
  className?: string;
9
+ isOverride?: boolean;
9
10
  }
10
11
 
11
12
  export function CreateProductSetItem({
12
13
  onClick,
13
14
  title,
14
15
  className,
16
+ isOverride,
15
17
  }: CreateProductSetItemProps) {
16
18
  return (
17
19
  <button
18
20
  className={clsx(
19
21
  "product-set-item-wrapper w-100",
20
22
  `product-set-item-wrapper-${title.toLowerCase().split(" ")[1]}`,
23
+ isOverride && "bg-light",
21
24
  className
22
25
  )}
23
26
  onClick={onClick}
@@ -113,6 +113,7 @@ export interface ProductControlProps<T>
113
113
  productName: string;
114
114
  hasTicket?: boolean;
115
115
  categoryType?: CategoryType;
116
+ isOverrides?: boolean;
116
117
  zoneDuration?: number;
117
118
  }
118
119
 
@@ -128,6 +129,7 @@ export function ProductControl<T extends FormValues>({
128
129
  hasTicket,
129
130
  categoryType,
130
131
  zoneDuration,
132
+ isOverrides = false,
131
133
  }: ProductControlProps<T>) {
132
134
  const {
133
135
  register,
@@ -260,7 +262,7 @@ export function ProductControl<T extends FormValues>({
260
262
  `${fieldNamePrefix}.name` as Path<T>,
261
263
  errors
262
264
  )}
263
- disabled={isLoading}
265
+ disabled={isLoading || isOverrides}
264
266
  placeholder={t("name")}
265
267
  />
266
268
  <Form.Control.Feedback type="invalid">
@@ -280,7 +282,7 @@ export function ProductControl<T extends FormValues>({
280
282
  viewMode={false}
281
283
  onUpdate={onChange}
282
284
  content={value as string}
283
- disabled={isLoading}
285
+ disabled={isLoading || isOverrides}
284
286
  />
285
287
  )}
286
288
  rules={{
@@ -326,6 +328,7 @@ export function ProductControl<T extends FormValues>({
326
328
  <ProductQuantityControl<T>
327
329
  isLoading={isLoading}
328
330
  fieldNamePrefix={fieldNamePrefix}
331
+ isOverrides={isOverrides}
329
332
  onFocus={onFocus}
330
333
  />
331
334
 
@@ -370,7 +373,7 @@ export function ProductControl<T extends FormValues>({
370
373
  `${fieldNamePrefix}.quantitySelector` as Path<T>,
371
374
  errors
372
375
  )}
373
- disabled={isLoading || hasTicket}
376
+ disabled={isLoading || hasTicket || isOverrides}
374
377
  >
375
378
  {quantitySelectorList.map((selector) => (
376
379
  <option value={selector.id} key={selector.id}>
@@ -392,13 +395,14 @@ export function ProductControl<T extends FormValues>({
392
395
  <Row className="align-items-start duration-capacity-container">
393
396
  <ProductDurationControl
394
397
  fieldNamePrefix={fieldNamePrefix}
395
- disabled={disabledDuration}
398
+ disabled={disabledDuration || isOverrides}
396
399
  />
397
400
 
398
401
  <Col lg={4} md={4}>
399
402
  <FormNumberInput
400
403
  fieldName={`${fieldNamePrefix}.capacity`}
401
404
  label={t("capacity")}
405
+ disabled={isOverrides}
402
406
  rules={{
403
407
  min: {
404
408
  value: 0,
@@ -426,6 +430,7 @@ export function ProductControl<T extends FormValues>({
426
430
  fieldName={`${fieldNamePrefix}.capacity`}
427
431
  label={t("capacity")}
428
432
  onChange={onChangeGameCapacity}
433
+ disabled={isOverrides}
429
434
  rules={{
430
435
  min: {
431
436
  value: 0,
@@ -441,7 +446,7 @@ export function ProductControl<T extends FormValues>({
441
446
  <FormNumberInput
442
447
  fieldName={`${fieldNamePrefix}.duration`}
443
448
  label={t("durationMinutes")}
444
- disabled={disabledDuration}
449
+ disabled={disabledDuration || isOverrides}
445
450
  rules={{
446
451
  min: {
447
452
  value: 0,
@@ -487,7 +492,7 @@ export function ProductControl<T extends FormValues>({
487
492
  `${fieldNamePrefix}.termsAndConditions` as Path<T>,
488
493
  errors
489
494
  )}
490
- disabled={isLoading}
495
+ disabled={isLoading || isOverrides}
491
496
  name={name}
492
497
  />
493
498
  )}
@@ -513,6 +518,7 @@ export function ProductControl<T extends FormValues>({
513
518
  onFileRemove={onImageRemove}
514
519
  defaultFiles={images}
515
520
  isLoading={isImageUploading}
521
+ disabled={isOverrides}
516
522
  withIcon
517
523
  title={t("addImage")}
518
524
  />
@@ -533,7 +539,7 @@ export function ProductControl<T extends FormValues>({
533
539
  name={name}
534
540
  value={Boolean(value)}
535
541
  onChange={onChange}
536
- disabled={isLoading}
542
+ disabled={isLoading || isOverrides}
537
543
  />
538
544
  );
539
545
  }}
@@ -568,7 +574,7 @@ export function ProductControl<T extends FormValues>({
568
574
  custom
569
575
  type="checkbox"
570
576
  name={advancedId}
571
- disabled={isLoading}
577
+ disabled={isLoading || isOverrides}
572
578
  >
573
579
  <Form.Check.Input
574
580
  checked={expanded}
@@ -595,7 +601,7 @@ export function ProductControl<T extends FormValues>({
595
601
  name={name}
596
602
  value={Boolean(value)}
597
603
  onChange={onChange}
598
- disabled={isLoading}
604
+ disabled={isLoading || isOverrides}
599
605
  />
600
606
  )}
601
607
  control={control}
@@ -615,7 +621,7 @@ export function ProductControl<T extends FormValues>({
615
621
  name={name}
616
622
  value={Boolean(value)}
617
623
  onChange={onChange}
618
- disabled={isLoading}
624
+ disabled={isLoading || isOverrides}
619
625
  />
620
626
  )}
621
627
  control={control}
@@ -624,7 +630,12 @@ export function ProductControl<T extends FormValues>({
624
630
  </Form.Group>
625
631
  {[CATEGORY_TYPE_GAME, CATEGORY_TYPE_FIXED_DURATION].includes(
626
632
  categoryType
627
- ) && <FixedDurationOptions fieldNamePrefix={fieldNamePrefix} />}
633
+ ) && (
634
+ <FixedDurationOptions
635
+ fieldNamePrefix={fieldNamePrefix}
636
+ isOverrides={isOverrides}
637
+ />
638
+ )}
628
639
  <Form.Group
629
640
  controlId={minSpendId}
630
641
  className="advanced-switch-container"
@@ -634,7 +645,7 @@ export function ProductControl<T extends FormValues>({
634
645
  isRequired={false}
635
646
  isMoreThanZero
636
647
  allowDeposits={false}
637
- isLoading={isLoading}
648
+ isLoading={isLoading || isOverrides}
638
649
  fieldNamePrefix={`${fieldNamePrefix}.minSpend` as Path<T>}
639
650
  />
640
651
  </Form.Group>
@@ -5,10 +5,13 @@ import { FieldNamePrefixPath } from "@licklist/plugins/dist/types/services/Form/
5
5
  import { useWatch } from "react-hook-form";
6
6
  import { FormNumberInput } from "../../../static";
7
7
 
8
- type FixedDurationOptionsProps<T> = FieldNamePrefixPath<T>;
8
+ interface FixedDurationOptionsProps<T> extends FieldNamePrefixPath<T> {
9
+ isOverrides?: boolean;
10
+ }
9
11
 
10
12
  export const FixedDurationOptions = <T,>({
11
13
  fieldNamePrefix,
14
+ isOverrides,
12
15
  }: FixedDurationOptionsProps<T>) => {
13
16
  const { t } = useTranslation("Design");
14
17
 
@@ -21,6 +24,7 @@ export const FixedDurationOptions = <T,>({
21
24
  <FormNumberInput
22
25
  fieldName={`${fieldNamePrefix}.subSlots`}
23
26
  label={t("subSlotsInMin")}
27
+ disabled={isOverrides}
24
28
  />
25
29
  </Col>
26
30
 
@@ -28,7 +32,7 @@ export const FixedDurationOptions = <T,>({
28
32
  <FormNumberInput
29
33
  fieldName={`${fieldNamePrefix}.pause`}
30
34
  label={t("pauseInMin")}
31
- disabled={!subSlotsFieldValue}
35
+ disabled={!subSlotsFieldValue || isOverrides}
32
36
  />
33
37
  </Col>
34
38
  </Row>
@@ -38,6 +42,7 @@ export const FixedDurationOptions = <T,>({
38
42
  <FormNumberInput
39
43
  fieldName={`${fieldNamePrefix}.offset`}
40
44
  label={t("offsetInMin")}
45
+ disabled={isOverrides}
41
46
  />
42
47
  </Col>
43
48
 
@@ -45,6 +50,7 @@ export const FixedDurationOptions = <T,>({
45
50
  <FormNumberInput
46
51
  fieldName={`${fieldNamePrefix}.serviceTime`}
47
52
  label={t("serviceTimeInMin")}
53
+ disabled={isOverrides}
48
54
  />
49
55
  </Col>
50
56
  </Row>
@@ -22,12 +22,13 @@ export interface ProductQuantityControlValues extends FormValues {
22
22
  export interface ProductQuantityControlProps<T> extends FieldNamePrefixPath<T> {
23
23
  isLoading: boolean;
24
24
  onFocus?: (e: React.SyntheticEvent) => void;
25
+ isOverrides?: boolean;
25
26
  }
26
27
 
27
28
  export function ProductQuantityControl<T extends FormValues>(
28
29
  props: ProductQuantityControlProps<T>
29
30
  ) {
30
- const { isLoading = false, fieldNamePrefix, onFocus } = props;
31
+ const { isLoading = false, fieldNamePrefix, onFocus, isOverrides } = props;
31
32
  const {
32
33
  control,
33
34
  formState: { errors },
@@ -90,7 +91,7 @@ export function ProductQuantityControl<T extends FormValues>(
90
91
  isInvalid={
91
92
  Number(minQuantityValue) > Number(maxQuantityValue)
92
93
  }
93
- disabled={isLoading}
94
+ disabled={isLoading || isOverrides}
94
95
  />
95
96
  )}
96
97
  control={control}
@@ -148,7 +149,7 @@ export function ProductQuantityControl<T extends FormValues>(
148
149
  isInvalid={
149
150
  Number(minQuantityValue) > Number(maxQuantityValue)
150
151
  }
151
- disabled={isLoading}
152
+ disabled={isLoading || isOverrides}
152
153
  />
153
154
  )}
154
155
  control={control}