@licklist/design 0.63.3-dev.3 → 0.63.3

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 (140) 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/iframe/ryft/RyftPaymentForm.d.ts +1 -4
  9. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  10. package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
  11. package/dist/iframe/ryft/utils/ryft-form.d.ts +2 -5
  12. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  13. package/dist/iframe/ryft/utils/ryft-form.js +1 -1
  14. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -1
  15. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  16. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
  17. package/dist/product-set/control/DateInput.js +1 -1
  18. package/dist/product-set/control/ProductSetControl.d.ts +2 -3
  19. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  20. package/dist/product-set/control/ProductSetControl.js +1 -1
  21. package/dist/product-set/form/ProductCategoriesControl.d.ts +1 -3
  22. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  23. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  24. package/dist/product-set/form/ProductSetForm.d.ts +2 -6
  25. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  26. package/dist/product-set/form/ProductSetForm.js +1 -1
  27. package/dist/product-set/form/ProductsControl.d.ts +1 -3
  28. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  29. package/dist/product-set/form/ProductsControl.js +1 -1
  30. package/dist/product-set/form/StepsControl.d.ts +1 -3
  31. package/dist/product-set/form/StepsControl.d.ts.map +1 -1
  32. package/dist/product-set/form/StepsControl.js +1 -1
  33. package/dist/product-set/product/ProductControl.d.ts +0 -1
  34. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  35. package/dist/product-set/product/ProductControl.js +1 -1
  36. package/dist/product-set/step/StepControl.d.ts +1 -2
  37. package/dist/product-set/step/StepControl.d.ts.map +1 -1
  38. package/dist/product-set/step/StepControl.js +1 -1
  39. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  40. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  41. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
  42. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
  43. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -3
  44. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  45. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  46. package/dist/recurring-date-picker-input/utils.d.ts +0 -5
  47. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  48. package/dist/recurring-date-picker-input/utils.js +1 -1
  49. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  50. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  51. package/dist/setting/admin/AdminSettingForm.d.ts.map +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/date-time-button/DateTimeButton.scss +0 -1
  56. package/dist/styles/iframe-page/PageBody.scss +1 -0
  57. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +0 -8
  58. package/dist/styles/sales/BookingResults.scss +1 -1
  59. package/dist/styles/zones/ZoneForm.scss +1 -2
  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 +39 -14
  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/iframe/ryft/RyftPaymentForm.tsx +2 -11
  78. package/src/iframe/ryft/utils/ryft-form.ts +4 -23
  79. package/src/product-set/control/DateAndRecurrenceInput.tsx +4 -3
  80. package/src/product-set/control/DateInput.tsx +2 -2
  81. package/src/product-set/control/ProductSetControl.tsx +4 -11
  82. package/src/product-set/form/ProductCategoriesControl.tsx +4 -15
  83. package/src/product-set/form/ProductSetForm.tsx +2 -13
  84. package/src/product-set/form/ProductsControl.tsx +77 -93
  85. package/src/product-set/form/StepsControl.tsx +7 -15
  86. package/src/product-set/product/ProductControl.tsx +5 -8
  87. package/src/product-set/step/StepControl.tsx +3 -4
  88. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +18 -4
  89. package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +21 -40
  90. package/src/recurring-date-picker-input/RecurringDatePickerInput.stories.tsx +7 -13
  91. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -12
  92. package/src/recurring-date-picker-input/utils.ts +1 -90
  93. package/src/sales/booking/results/components/ResultCard.tsx +3 -0
  94. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  95. package/src/sortable-tree/SortableTreeItem.tsx +3 -0
  96. package/src/static/switch/BooleanSwitch.tsx +1 -1
  97. package/src/styles/date-time-button/DateTimeButton.scss +0 -1
  98. package/src/styles/iframe-page/PageBody.scss +1 -0
  99. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +0 -8
  100. package/src/styles/sales/BookingResults.scss +1 -1
  101. package/src/styles/zones/ZoneForm.scss +1 -2
  102. package/src/zone/form/ZoneForm.tsx +2 -3
  103. package/src/zone/form/components/ZoneControl.tsx +3 -3
  104. package/src/zone/form/components/ZoneRecurrencesControl.tsx +5 -7
  105. package/src/zone/form/utils/dates.ts +10 -9
  106. package/tests/Auth/Authorizer.test.tsx +194 -0
  107. package/tests/Auth/Layout/UserNavDropDown.test.tsx +43 -0
  108. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +33 -0
  109. package/tests/Auth/Login/LoginComponent.test.tsx +246 -0
  110. package/tests/Auth/Login/LoginFormComponent.test.tsx +182 -0
  111. package/tests/Auth/Register/RegisterComponent.test.tsx +285 -0
  112. package/tests/Auth/Register/RegisterFormComponent.test.tsx +170 -0
  113. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +130 -0
  114. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +133 -0
  115. package/tests/Auth/Social/SocialFormComponent.test.tsx +118 -0
  116. package/tests/FileUpload/FileUpload.test.tsx +42 -0
  117. package/tests/Notification/EmailTemplate.test.tsx +82 -0
  118. package/tests/ProductSet/ProductSetPopover.test.tsx +40 -0
  119. package/tests/Report/Report.test.tsx +48 -0
  120. package/tests/Sales/Coupon.test.tsx +51 -0
  121. package/tests/Sales/SalesAndVIews.test.tsx +63 -0
  122. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +56 -0
  123. package/tests/Table/FilterHelperComponent.test.tsx +88 -0
  124. package/tests/Table/PaginationHelperComponent.test.tsx +109 -0
  125. package/tests/Table/PerPageHelperComponent.test.tsx +34 -0
  126. package/tests/Table/TableHelperComponent.test.tsx +295 -0
  127. package/tests/TipTapEditor/TipTapEditor.test.tsx +28 -0
  128. package/tests/__mock__/hooks/useAuthApi.ts +13 -0
  129. package/tests/__mock__/hooks/useAuthMock.ts +13 -0
  130. package/tests/__mock__/hooks/useFormMock.ts +27 -0
  131. package/tests/__mock__/hooks/useNotificationMock.ts +13 -0
  132. package/tests/__mock__/hooks/useQueryMock.ts +16 -0
  133. package/tests/__mock__/hooks/useSocialApiMock.ts +20 -0
  134. package/tests/__mock__/hooks/useTranslationMock.ts +17 -0
  135. package/tests/__mock__/hooks/useUserApiMock.ts +18 -0
  136. package/tests/__mock__/hooks/useUserMock.ts +13 -0
  137. package/tests/__mock__/styleMock.js +1 -0
  138. package/tests/__mock__/windowMock.ts +5 -0
  139. package/tests/packages/react-query.tsx +28 -0
  140. package/tests/setupTests.ts +10 -0
package/jest.config.js ADDED
@@ -0,0 +1,29 @@
1
+ // For a detailed explanation regarding each configuration property, visit:
2
+ // https://jestjs.io/docs/en/configuration.html
3
+
4
+ module.exports = {
5
+ modulePathIgnorePatterns: ["/dist/"],
6
+ roots: ["<rootDir>/src", "<rootDir>/tests"],
7
+ globals: {
8
+ "ts-jest": {
9
+ isolatedModules: true,
10
+ babelConfig: {
11
+ presets: ["@babel/preset-env", "@babel/preset-react"],
12
+ },
13
+ },
14
+ },
15
+ transform: {
16
+ "^.+\\.(t|j)sx?$": "ts-jest",
17
+ },
18
+ transformIgnorePatterns: [
19
+ "node_modules/(?!(redux-persist)/)",
20
+ "node_modules/(?!(@licklist)/)",
21
+ ],
22
+ testRegex: ["(\\/tests\\/.*.(test|spec))\\.tsx?$"],
23
+ moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
24
+ setupFilesAfterEnv: ["<rootDir>/tests/setupTests.ts"],
25
+ moduleNameMapper: {
26
+ "^.+\\.(css|scss|sass|less)$": "<rootDir>/tests/__mock__/styleMock.js",
27
+ ".+\\.(svg|png|jpg)$": "identity-obj-proxy",
28
+ },
29
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.63.3-dev.3",
3
+ "version": "0.63.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -16,11 +16,14 @@
16
16
  "type-check:watch": "yarn type-check -- --watch",
17
17
  "build": "rollup -c",
18
18
  "watch": "yarn build -- -w",
19
+ "test": "jest --verbose --coverage --watchAll=false",
20
+ "run-test": "jest --verbose --watchAll=false",
19
21
  "lint": "eslint --ext .ts,.tsx .",
20
22
  "lint:fix": "yarn run lint -- --fix",
21
23
  "lint:format": "prettier \"**/*.{md,json,yml,scss}\" --check",
22
24
  "lint:format:fix": "prettier \"**/*.{md,json,yml,scss}\" --write",
23
25
  "prepare": "husky install",
26
+ "test-staged": "CI=true jest --passWithNoTests --findRelatedTests",
24
27
  "tests": "yarn tests-staged",
25
28
  "prettier-write": "prettier --write",
26
29
  "tsc": "bash -c tsc -p tsconfig.json -b"
@@ -40,7 +43,7 @@
40
43
  ]
41
44
  },
42
45
  "dependencies": {
43
- "@babel/core": "7.16.0",
46
+ "@babel/core": "7.13.8",
44
47
  "@babel/plugin-proposal-private-property-in-object": "7.16.7",
45
48
  "@dnd-kit/core": "3.1.1",
46
49
  "@dnd-kit/modifiers": "4.0.0",
@@ -50,9 +53,9 @@
50
53
  "@fortawesome/free-brands-svg-icons": "5.15.2",
51
54
  "@fortawesome/free-solid-svg-icons": "5.15.2",
52
55
  "@fortawesome/react-fontawesome": "0.1.9",
53
- "@licklist/core": ">=0.25.1-dev.2 < 0.25.1",
54
- "@licklist/eslint-config": "0.4.5",
55
- "@licklist/plugins": ">=0.28.0-dev.3 < 0.28.0",
56
+ "@licklist/core": "^0.25.3",
57
+ "@licklist/eslint-config": "0.3.4",
58
+ "@licklist/plugins": "^0.27.2",
56
59
  "@mdx-js/react": "1.6.22",
57
60
  "@popperjs/core": "2.11.8",
58
61
  "@react-aria/utils": "3.9.0",
@@ -70,6 +73,10 @@
70
73
  "@svgr/rollup": "5.5.0",
71
74
  "@svgr/webpack": "5.5.0",
72
75
  "@tanstack/react-table": "8.10.6",
76
+ "@testing-library/jest-dom": "5.16.1",
77
+ "@testing-library/react": "11.2.5",
78
+ "@testing-library/react-hooks": "5.1.0",
79
+ "@testing-library/user-event": "13.5.0",
73
80
  "@tiptap/core": "2.0.0-beta.176",
74
81
  "@tiptap/extension-blockquote": "2.0.0-beta.29",
75
82
  "@tiptap/extension-bold": "2.0.0-beta.28",
@@ -91,11 +98,15 @@
91
98
  "@tiptap/pm": "2.0.0-beta.212",
92
99
  "@tiptap/react": "2.0.0-beta.109",
93
100
  "@tiptap/suggestion": "2.0.0-beta.92",
94
- "@types/babel__core": "7.1.16",
101
+ "@types/babel__core": "7.1.12",
102
+ "@types/enzyme-adapter-react-16": "1.0.6",
103
+ "@types/jest": "26.0.20",
95
104
  "@types/luxon": "1.26.2",
96
105
  "@types/mdx-js__react": "1.5.3",
106
+ "@types/react": "17.0.2",
97
107
  "@types/react-bootstrap": "1.0.1",
98
- "@types/react-date-range": "1.4.9",
108
+ "@types/react-date-range": "^1.4.4",
109
+ "@types/react-dom": "17.0.1",
99
110
  "@types/react-email-editor": "1.1.7",
100
111
  "@types/react-loader": "2.4.4",
101
112
  "@types/react-phone-number-input": "3.0.6",
@@ -105,6 +116,7 @@
105
116
  "@typescript-eslint/eslint-plugin": "5.8.1",
106
117
  "@typescript-eslint/parser": "5.8.1",
107
118
  "@wojtekmaj/react-daterange-picker": "^4.1.0",
119
+ "babel-jest": "26.6.3",
108
120
  "babel-loader": "8.2.2",
109
121
  "babel-plugin-inline-react-svg": "2.0.1",
110
122
  "bootstrap": "4.6.0",
@@ -116,16 +128,21 @@
116
128
  "emojibase": "6.1.0",
117
129
  "emojibase-data": "7.0.1",
118
130
  "emojibase-regex": "6.0.1",
131
+ "enzyme": "3.11.0",
132
+ "enzyme-adapter-react-16": "1.15.6",
119
133
  "eslint": "7.32.0",
120
134
  "eslint-config-airbnb": "18.2.1",
121
135
  "eslint-config-prettier": "8.3.0",
136
+ "eslint-plugin-jest": "25.3.2",
122
137
  "eslint-plugin-jsx-a11y": "6.5.1",
123
138
  "eslint-plugin-prettier": "4.0.0",
124
139
  "eslint-plugin-react-hooks": "4.2.0",
140
+ "eslint-plugin-testing-library": "5.0.1",
125
141
  "framer-motion": "4.1.17",
126
142
  "history": "5.3.0",
127
143
  "husky": "7.0.4",
128
144
  "i18next": "19.4.5",
145
+ "jest": "26.6.0",
129
146
  "klona": "2.0.4",
130
147
  "konva": "6.0.0",
131
148
  "lint-staged": "11.1.2",
@@ -133,18 +150,18 @@
133
150
  "luxon": "1.26.0",
134
151
  "moment": "2.29.1",
135
152
  "prettier": "2.5.1",
136
- "react": "17.0.2",
153
+ "react": "16.14.0",
137
154
  "react-bootstrap": "1.6.1",
138
155
  "react-color": "2.19.3",
139
156
  "react-copy-to-clipboard": "5.0.3",
140
- "react-date-range": "1.4.0",
141
- "react-dom": "17.0.2",
157
+ "react-date-range": "^1.4.0",
158
+ "react-dom": "16.14.0",
142
159
  "react-email-editor": "1.6.1",
143
160
  "react-highlighter": "0.4.3",
144
161
  "react-hook-form": "7.13.0",
145
162
  "react-i18next": "11.8.8",
146
163
  "react-intl": "5.15.8",
147
- "react-konva": "^17.0.2-6",
164
+ "react-konva": "16.13.0-6",
148
165
  "react-loader": "2.4.7",
149
166
  "react-loading-skeleton": "^3.3.1",
150
167
  "react-overlays": "4.1.1",
@@ -169,6 +186,7 @@
169
186
  "sass": "1.32.8",
170
187
  "sass-loader": "10.1.1",
171
188
  "style-loader": "2.0.0",
189
+ "ts-jest": "26.5.2",
172
190
  "twemoji-parser": "14.0.0",
173
191
  "typescript": "4.9.5",
174
192
  "url-loader": "4.1.1",
@@ -176,17 +194,24 @@
176
194
  },
177
195
  "resolutions": {
178
196
  "@types/react": "17.0.2",
179
- "@types/react-dom": "17.0.2"
197
+ "@types/react-dom": "17.0.1"
198
+ },
199
+ "jest": {
200
+ "setupFilesAfterEnv": [
201
+ "./jest.config.js"
202
+ ],
203
+ "snapshotSerializers": [
204
+ "enzyme-to-json/serializer"
205
+ ]
180
206
  },
181
207
  "lint-staged": {
182
208
  "*.{ts,tsx}": [
209
+ "yarn test-staged",
183
210
  "yarn prettier-write",
184
211
  "yarn lint:fix"
185
212
  ]
186
213
  },
187
214
  "devDependencies": {
188
- "@types/react": "17.0.2",
189
- "@types/react-dom": "17.0.2",
190
215
  "identity-obj-proxy": "^3.0.0"
191
216
  },
192
217
  "volta": {
@@ -8,7 +8,7 @@ export default {
8
8
  component: DateTimeButton,
9
9
  } as Meta;
10
10
 
11
- const date = DateTime.now().plus({ hour: 1 });
11
+ const date = DateTime.now();
12
12
 
13
13
  export const Default: Story<DateTimeButtonProps> = (args) => {
14
14
  return <DateTimeButton {...args} />;
@@ -19,7 +19,6 @@ Default.args = {
19
19
  isSelected: false,
20
20
  isDisabled: false,
21
21
  onSelect: () => null,
22
- shouldCalculateResources: false,
23
22
  };
24
23
 
25
24
  export const Selected: Story<DateTimeButtonProps> = (args) => {
@@ -46,7 +46,7 @@ export const DateTimeButton = ({
46
46
 
47
47
  const isTimeVariant = variant === Variant.time;
48
48
 
49
- const isPast = variant === Variant.time ? isPastTime(date) : isPastDate(date);
49
+ const isTimeInPast = isTimeVariant && isDateInPast(date);
50
50
 
51
51
  const noResources =
52
52
  shouldCalculateResources &&
@@ -55,7 +55,7 @@ export const DateTimeButton = ({
55
55
  !has(resources, "bookedResources") ||
56
56
  !has(resources, "totalResources"));
57
57
 
58
- const isDisabled = _isDisabled || isSoldOut || isPast || noResources;
58
+ const isDisabled = _isDisabled || isSoldOut || isTimeInPast || noResources;
59
59
 
60
60
  return (
61
61
  <button
@@ -85,7 +85,7 @@ export const DateTimeButton = ({
85
85
  {showResources && resources && (
86
86
  <AvailabilityIndicator
87
87
  resources={resources}
88
- isUnavailable={_isDisabled || isPast}
88
+ isUnavailable={_isDisabled || isTimeInPast}
89
89
  isSoldOut={isSoldOut}
90
90
  />
91
91
  )}
@@ -93,7 +93,5 @@ export const DateTimeButton = ({
93
93
  );
94
94
  };
95
95
 
96
- const isPastTime = (date: DateTime): boolean => DateTime.now() > date;
97
-
98
- const isPastDate = (date: DateTime): boolean =>
99
- DateTime.now() > date.set({ hour: 23, minute: 59, second: 59 });
96
+ const isDateInPast = (date: DateTime): boolean =>
97
+ date.toUTC() <= DateTime.now().toUTC();
@@ -40,10 +40,6 @@ export const SelectEventProductSet = ({
40
40
  const productSetId = watch("productSetId");
41
41
  const editedProductSet = watch("editedProductSet");
42
42
 
43
- const selectedProductSet = productSets.find(
44
- (productSet) => productSet.id === productSetId
45
- )?.parentMenuId;
46
-
47
43
  const onEditProductSet = useCallback(
48
44
  () => {
49
45
  setEditProductSetId(String(productSetId));
@@ -88,9 +84,6 @@ export const SelectEventProductSet = ({
88
84
  setValue("productSetId", value);
89
85
  };
90
86
 
91
- const showOverrideProductSet =
92
- !showEditProductSet && productSetId && !selectedProductSet;
93
-
94
87
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
88
  const onSubmit = (value: EditEventFormValues["editedProductSet"]) => {
96
89
  setShowEditProductSet(false);
@@ -166,7 +159,7 @@ export const SelectEventProductSet = ({
166
159
  {t("addNewProductSet")}
167
160
  </Button>
168
161
  )}
169
- {showOverrideProductSet && (
162
+ {!showEditProductSet && productSetId && (
170
163
  <Button
171
164
  variant=""
172
165
  className="btn product-set-button "
@@ -206,12 +199,14 @@ export const SelectEventProductSet = ({
206
199
  </Form.Group>
207
200
  </div>
208
201
  {showEditProductSet && productSetId && (
209
- <EditEventProductSet
210
- onSubmit={onSubmit}
211
- defaultValues={
212
- productSetId === editedProductSet?.id && editedProductSet
213
- }
214
- />
202
+ <>
203
+ <EditEventProductSet
204
+ onSubmit={onSubmit}
205
+ defaultValues={
206
+ productSetId === editedProductSet?.id && editedProductSet
207
+ }
208
+ />
209
+ </>
215
210
  )}
216
211
  </>
217
212
  );
@@ -124,8 +124,6 @@ export const EditEventProductSet = ({
124
124
  companyName={selectedCompany?.title}
125
125
  fee={feeInPercent}
126
126
  isEventEditProductSet
127
- isOverrides
128
- workHours={undefined}
129
127
  />
130
128
  <Button
131
129
  disabled={isLoading}
@@ -63,7 +63,6 @@ const processedPaymentSummary = ({
63
63
  const total = calculateTotalPrice(order, externalPaymentDetail);
64
64
 
65
65
  const totalDiscount = calculateTotalDiscount(order.payments);
66
-
67
66
  let summaryItems: SummaryItem[] = [
68
67
  {
69
68
  translateKey: AMOUNT_TOTAL,
@@ -36,9 +36,6 @@ export interface RyftPaymentFormProps {
36
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
37
  accountId: any;
38
38
  isCreateLoading: boolean;
39
- isAppUsingInIframe?: boolean;
40
- onApplePayButtonClick: () => void;
41
- applePayButtonDisabled?: boolean;
42
39
  initRyft: (
43
40
  onSuccess: () => void,
44
41
  onFailure: (error?: string) => void
@@ -51,19 +48,15 @@ export interface RyftPaymentFormProps {
51
48
  export const RyftPaymentForm = ({
52
49
  accountId,
53
50
  isCreateLoading,
54
- isAppUsingInIframe,
55
51
  providerPaymentSettings,
56
- onApplePayButtonClick,
57
52
  initRyft,
58
53
  resetReferrer,
59
54
  onSubmit,
60
55
  }: RyftPaymentFormProps) => {
61
56
  const { t } = useTranslation(["Design", "Validation", "Ryft"]);
62
57
  const formRef = useRef<HTMLFormElement | null>(null);
63
- const showApplePayButton =
64
- isAppUsingInIframe &&
65
- providerPaymentSettings?.additionalPaymentMethodsEnabled;
66
58
  const history = useHistory();
59
+
67
60
  const [isValid, setIsValid] = useState(false);
68
61
  const [isBtnDisabled, setIsBtnDisabled] = useState(false);
69
62
  const [ryftInitFailure, setRyftInitFailure] = useState<boolean>(false);
@@ -140,14 +133,12 @@ export const RyftPaymentForm = ({
140
133
  }
141
134
  injectComponentsInRyftForm({
142
135
  t,
143
- isAppUsingInIframe,
144
- onApplePayButtonClick,
145
136
  additionalPaymentMethodsEnabled:
146
137
  providerPaymentSettings?.additionalPaymentMethodsEnabled,
147
138
  });
148
139
  },
149
140
  // eslint-disable-next-line react-hooks/exhaustive-deps
150
- [formRef.current?.childNodes?.length, showApplePayButton]
141
+ [formRef.current?.childNodes?.length]
151
142
  );
152
143
 
153
144
  useEffect(() => {
@@ -1,21 +1,12 @@
1
1
  import { TFunction } from "react-i18next";
2
- import { RyftPaymentFormProps } from "../RyftPaymentForm";
3
-
4
- interface InjectComponentsInRyftForm
5
- extends Pick<
6
- RyftPaymentFormProps,
7
- "onApplePayButtonClick" | "isAppUsingInIframe"
8
- > {
9
- t: TFunction<string[]>;
10
- additionalPaymentMethodsEnabled?: boolean;
11
- }
12
2
 
13
3
  export const injectComponentsInRyftForm = ({
14
4
  t,
15
5
  additionalPaymentMethodsEnabled,
16
- isAppUsingInIframe,
17
- onApplePayButtonClick,
18
- }: InjectComponentsInRyftForm) => {
6
+ }: {
7
+ t: TFunction<string[]>;
8
+ additionalPaymentMethodsEnabled?: boolean;
9
+ }) => {
19
10
  const cardContainer = document.getElementById("ryft-pay-iframe");
20
11
 
21
12
  if (!cardContainer) {
@@ -43,7 +34,6 @@ export const injectComponentsInRyftForm = ({
43
34
  // Removing of the old mobile title container and divider container
44
35
  document.getElementById("mobile-pay-title")?.remove();
45
36
  document.getElementById("mobile-pay-divider-container")?.remove();
46
- document.getElementById("apple-pay")?.remove();
47
37
 
48
38
  // Adding title and divider for apple and google pay button
49
39
  const mobilePayTitle = document.createElement("div");
@@ -58,15 +48,6 @@ export const injectComponentsInRyftForm = ({
58
48
  divider.id = "mobile-pay-divider";
59
49
  container.id = "mobile-pay-divider-container";
60
50
  container.append(dividerText, divider);
61
- if (isAppUsingInIframe) {
62
- const applePayButton = document.createElement("button");
63
- applePayButton.id = "apple-pay";
64
- applePayButton.type = "button";
65
- applePayButton.className = "bg-dark btn btn-primary apple-pay-button";
66
- applePayButton.textContent = t("Events:payWithApple");
67
- applePayButton.onclick = onApplePayButtonClick;
68
- payGrid.append(applePayButton);
69
- }
70
51
  payGrid.before(mobilePayTitle);
71
52
  payGrid.after(container);
72
53
  };
@@ -28,13 +28,15 @@ import {
28
28
  AvailableTimesControlRef,
29
29
  } from "../../zone/form/components/AvailableTimesControl";
30
30
 
31
+ // eslint-disable-next-line max-len
32
+
31
33
  export interface DateAndRecurrenceInputValues {
32
34
  menuRecurrences?: Partial<ProductSetRecurrence>[];
33
35
  }
34
36
 
35
37
  interface DateAndRecurrenceInputProps {
36
38
  isEventEditProductSet?: boolean;
37
- workHours: WorkHour[] | undefined;
39
+ workHours?: WorkHour[];
38
40
  providerHasBookingManagement: boolean;
39
41
  isLoading?: boolean;
40
42
  }
@@ -88,7 +90,7 @@ export const DateAndRecurrenceInput = ({
88
90
  clearEditState();
89
91
  });
90
92
 
91
- const popoverId = useId();
93
+ const popoverId = useId()!;
92
94
 
93
95
  const { t } = useTranslation("Design");
94
96
 
@@ -226,7 +228,6 @@ export const DateAndRecurrenceInput = ({
226
228
  defaultValues={editState.values}
227
229
  onChange={handleRecurringDateChange}
228
230
  onDelete={handleDelete}
229
- workHours={workHours}
230
231
  >
231
232
  {providerHasBookingManagement && (
232
233
  <AvailableTimesControl
@@ -5,7 +5,7 @@ import { Form, OverlayTrigger, Popover } from "react-bootstrap";
5
5
  import { useFieldArray, useFormContext } from "react-hook-form";
6
6
  import { useTranslation } from "react-i18next";
7
7
  import { useClickAway } from "react-use";
8
- import { UTC_TIMEZONE, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
8
+ import { TIMEZONE, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
9
9
  import { ProductSetRecurrence } from "@licklist/core/dist/DataMapper/Product/ProductSetRecurrenceDataMapper";
10
10
  import { DateTime } from "luxon";
11
11
  import RRule, { Frequency } from "rrule";
@@ -136,7 +136,7 @@ export const DateInput = ({
136
136
  until: (start as DateTime).toJSDate(),
137
137
  byweekday: [],
138
138
  freq: Frequency.DAILY,
139
- tzid: UTC_TIMEZONE,
139
+ tzid: TIMEZONE,
140
140
  interval: 1,
141
141
  }).replace("RRULE:", "");
142
142
 
@@ -85,10 +85,9 @@ export interface ProductSetControlProps {
85
85
  fieldSets?: FieldSet[];
86
86
  showEmailTemplate?: boolean;
87
87
  showSmsTemplate?: boolean;
88
- workHours: WorkHour[] | undefined;
88
+ workHours?: WorkHour[];
89
89
  providerHasBookingManagement?: boolean;
90
90
  isOverrides?: boolean;
91
- isCreateNewOverrides?: boolean;
92
91
  }
93
92
 
94
93
  export function ProductSetControl({
@@ -105,7 +104,6 @@ export function ProductSetControl({
105
104
  workHours,
106
105
  providerHasBookingManagement = false,
107
106
  isOverrides = false,
108
- isCreateNewOverrides = false,
109
107
  }: ProductSetControlProps) {
110
108
  const { t } = useTranslation(["Design", "Validation", "Notification"]);
111
109
  const {
@@ -125,7 +123,7 @@ export function ProductSetControl({
125
123
 
126
124
  const showSmsTemplateSelector = showSmsTemplate && !isOverrides;
127
125
  const showEmailTemplateSelector = showEmailTemplate && !isOverrides;
128
- const showDateSelector = !isEventEditProductSet && isOverrides;
126
+
129
127
  return (
130
128
  <Row
131
129
  className={`product-set-form ${
@@ -167,7 +165,7 @@ export function ProductSetControl({
167
165
  </Form.Control.Feedback>
168
166
  </Form.Group>
169
167
 
170
- {showDateSelector ? (
168
+ {isOverrides ? (
171
169
  <DateInput
172
170
  workHours={workHours}
173
171
  isLoading={isLoading}
@@ -190,12 +188,7 @@ export function ProductSetControl({
190
188
 
191
189
  <TutorialGifCard isOverrides={isOverrides} />
192
190
 
193
- <StepsControl
194
- isLoading={isLoading}
195
- isEventEditProductSet={isEventEditProductSet}
196
- isOverrides={isOverrides}
197
- isCreateNewOverrides={isCreateNewOverrides}
198
- />
191
+ <StepsControl isLoading={isLoading} isOverrides={isOverrides} />
199
192
  </Col>
200
193
  <Col md={6} sm={12}>
201
194
  <div className="second-column">
@@ -36,8 +36,6 @@ import { useSortableTreeFunctions } from "../hooks/useSortableTreeFunctions";
36
36
  interface ProductCategoriesControlProps extends WithIsLoading {
37
37
  stepIndex: number;
38
38
  isOverrides?: boolean;
39
- isEventEditProductSet?: boolean;
40
- isCreateNewOverrides?: boolean;
41
39
  }
42
40
 
43
41
  const getCategoryDefaultValue = (
@@ -69,8 +67,6 @@ export function ProductCategoriesControl({
69
67
  isLoading,
70
68
  stepIndex,
71
69
  isOverrides,
72
- isEventEditProductSet,
73
- isCreateNewOverrides,
74
70
  }: ProductCategoriesControlProps) {
75
71
  const { t } = useTranslation("Design");
76
72
  const {
@@ -218,11 +214,6 @@ export function ProductCategoriesControl({
218
214
  ? String(productCategory.id)
219
215
  : productCategory.uniqueId;
220
216
 
221
- const isOverridesCategory = productCategory.products.some((product) =>
222
- isEventEditProductSet ? !!product.id : !!product.originalProductId
223
- );
224
- const isNewOverridesCategory =
225
- isCreateNewOverrides && !!productCategory.id;
226
217
  const onSetIsExpanded = () => {
227
218
  setIsExpanded(productCategoryId);
228
219
  };
@@ -278,10 +269,7 @@ export function ProductCategoriesControl({
278
269
  categoryName={value}
279
270
  stepIndex={stepIndex}
280
271
  productCategoryIndex={index}
281
- isOverride={
282
- isNewOverridesCategory ||
283
- (isOverrides && isOverridesCategory)
284
- }
272
+ isOverride={isOverrides}
285
273
  />
286
274
  }
287
275
  isOverride={isOverrides}
@@ -308,8 +296,6 @@ export function ProductCategoriesControl({
308
296
  productCategoryIndex={index}
309
297
  categoryType={productCategory.type}
310
298
  isOverrides={isOverrides}
311
- isEventEditProductSet={isEventEditProductSet}
312
- isCreateNewOverrides={isCreateNewOverrides}
313
299
  />
314
300
  </SortableTree.Item>
315
301
  )}
@@ -319,7 +305,9 @@ export function ProductCategoriesControl({
319
305
  </SortableTree>
320
306
  <CreateProductSetItem
321
307
  title={t("addCategory")}
308
+ isOverride={isOverrides}
322
309
  onClick={() => {
310
+ if (isOverrides) return;
323
311
  setIsSelectCategoryVisible(true);
324
312
  }}
325
313
  />
@@ -328,6 +316,7 @@ export function ProductCategoriesControl({
328
316
  isVisible={isSelectCategoryVisible}
329
317
  onHide={() => setIsSelectCategoryVisible(false)}
330
318
  onCategorySelect={(categoryType) => {
319
+ if (isOverrides) return;
331
320
  append(getCategoryDefaultValue(categoryType, fields.length));
332
321
  setShowCategoryModal(true);
333
322
  if (
@@ -26,16 +26,12 @@ 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
-
33
29
  export interface WithId {
34
30
  id: number;
35
31
  }
36
32
  export interface ProductSetFormValues
37
33
  extends FormValues,
38
- WithIdOptional,
34
+ WithId,
39
35
  ProductSetControlValues {
40
36
  steps: Step[];
41
37
  isOverrides?: boolean;
@@ -57,7 +53,6 @@ export interface ProductSetFormProps
57
53
  isCreateAction?: boolean;
58
54
  isOverrides?: boolean;
59
55
  workHours?: WorkHour[];
60
- isCreateNewOverrides?: boolean;
61
56
  }
62
57
 
63
58
  export function ProductSetForm({
@@ -75,7 +70,6 @@ export function ProductSetForm({
75
70
  isCreateAction,
76
71
  workHours,
77
72
  isOverrides,
78
- isCreateNewOverrides,
79
73
  ...shared
80
74
  }: ProductSetFormProps) {
81
75
  const { t } = useTranslation("Design");
@@ -121,11 +115,7 @@ export function ProductSetForm({
121
115
  }, [serverErrors, setError]);
122
116
 
123
117
  useEffect(() => {
124
- window.history.pushState(
125
- null,
126
- "",
127
- window.location.pathname + window.location.search
128
- );
118
+ window.history.pushState(null, "", window.location.pathname);
129
119
  window.addEventListener("beforeunload", onBeforeUnload);
130
120
  window.addEventListener("popstate", onPopState);
131
121
 
@@ -176,7 +166,6 @@ export function ProductSetForm({
176
166
  workHours={workHours}
177
167
  providerHasBookingManagement={providerHasBookingManagement}
178
168
  isOverrides={isOverrides}
179
- isCreateNewOverrides={isCreateNewOverrides}
180
169
  />
181
170
  <Row>
182
171
  <Col md={6} sm={12} />