@licklist/design 0.62.3 → 0.63.0-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 (170) hide show
  1. package/bitbucket-pipelines.yml +0 -8
  2. package/dist/date-time-button/DateTimeButton.js +1 -1
  3. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +3 -1
  4. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
  5. package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
  6. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +3 -1
  7. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
  8. package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +1 -1
  9. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +3 -1
  10. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
  11. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -1
  12. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
  13. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  14. package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
  15. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  16. package/dist/iframe/ryft/utils/ryft-form.js +1 -1
  17. package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -5
  18. package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
  19. package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
  20. package/dist/product-set/control/DateInput.d.ts.map +1 -1
  21. package/dist/product-set/control/DateInput.js +1 -1
  22. package/dist/product-set/control/ProductSetControl.d.ts +4 -3
  23. package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
  24. package/dist/product-set/control/ProductSetControl.js +1 -1
  25. package/dist/product-set/control/utils.d.ts +5 -0
  26. package/dist/product-set/control/utils.d.ts.map +1 -0
  27. package/dist/product-set/control/utils.js +1 -0
  28. package/dist/product-set/form/ProductCategoriesControl.d.ts +2 -1
  29. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  30. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  31. package/dist/product-set/form/ProductSetForm.d.ts +4 -1
  32. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  33. package/dist/product-set/form/ProductsControl.d.ts +2 -1
  34. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  35. package/dist/product-set/form/ProductsControl.js +1 -1
  36. package/dist/product-set/form/StepsControl.d.ts +2 -1
  37. package/dist/product-set/form/StepsControl.d.ts.map +1 -1
  38. package/dist/product-set/form/StepsControl.js +1 -1
  39. package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
  40. package/dist/product-set/product/ProductControl.d.ts +1 -0
  41. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  42. package/dist/product-set/product/ProductControl.js +1 -1
  43. package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
  44. package/dist/product-set/step/StepControl.d.ts +2 -1
  45. package/dist/product-set/step/StepControl.d.ts.map +1 -1
  46. package/dist/product-set/step/StepControl.js +1 -1
  47. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  48. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  49. package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -1
  50. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +3 -1
  51. package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
  52. package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
  53. package/dist/recurring-date-picker-input/utils.d.ts +12 -0
  54. package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
  55. package/dist/recurring-date-picker-input/utils.js +1 -1
  56. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  57. package/dist/sales/booking/results/components/ResultCard.js +1 -1
  58. package/dist/sales/coupon/control/CouponFormControl.d.ts +2 -1
  59. package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
  60. package/dist/sales/coupon/control/CouponFormControl.js +1 -1
  61. package/dist/sales/coupon/form/CouponFrom.d.ts +2 -2
  62. package/dist/sales/coupon/form/CouponFrom.d.ts.map +1 -1
  63. package/dist/sales/coupon/utils/index.d.ts +7 -0
  64. package/dist/sales/coupon/utils/index.d.ts.map +1 -0
  65. package/dist/sales/coupon/utils/index.js +1 -0
  66. package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
  67. package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
  68. package/dist/setting/dashboard/DashboardSettingForm.d.ts +1 -0
  69. package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
  70. package/dist/setting/dashboard/DashboardSettingForm.js +1 -1
  71. package/dist/sortable-tree/SortableTreeItem.d.ts +1 -2
  72. package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
  73. package/dist/sortable-tree/SortableTreeItem.js +1 -1
  74. package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +99 -113
  75. package/dist/styles/sales/BookingResults.scss +1 -1
  76. package/dist/typeahead/Typeahead.d.ts +2 -1
  77. package/dist/typeahead/Typeahead.d.ts.map +1 -1
  78. package/dist/typeahead/Typeahead.js +1 -1
  79. package/dist/zone/form/ZoneForm.d.ts +2 -2
  80. package/dist/zone/form/ZoneForm.d.ts.map +1 -1
  81. package/dist/zone/form/ZoneForm.js +1 -1
  82. package/dist/zone/form/components/AvailableTimesControl.d.ts +0 -2
  83. package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
  84. package/dist/zone/form/components/ZoneControl.d.ts +2 -2
  85. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  86. package/dist/zone/form/components/ZoneControl.js +1 -1
  87. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -4
  88. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  89. package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
  90. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  91. package/package.json +10 -35
  92. package/src/date-time-button/DateTimeButton.stories.tsx +2 -1
  93. package/src/date-time-button/DateTimeButton.tsx +7 -5
  94. package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +4 -0
  95. package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +18 -9
  96. package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +5 -0
  97. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
  98. package/src/iframe/ryft/RyftPaymentForm.tsx +12 -4
  99. package/src/iframe/ryft/utils/ryft-form.ts +8 -4
  100. package/src/product-set/control/DateAndRecurrenceInput.tsx +48 -14
  101. package/src/product-set/control/DateInput.tsx +2 -4
  102. package/src/product-set/control/ProductSetControl.stories.tsx +1 -1
  103. package/src/product-set/control/ProductSetControl.tsx +12 -11
  104. package/src/product-set/control/utils.ts +25 -0
  105. package/src/product-set/form/ProductCategoriesControl.tsx +8 -4
  106. package/src/product-set/form/ProductSetForm.stories.tsx +1 -2
  107. package/src/product-set/form/ProductSetForm.tsx +5 -1
  108. package/src/product-set/form/ProductsControl.tsx +87 -77
  109. package/src/product-set/form/StepsControl.tsx +11 -6
  110. package/src/product-set/hooks/useSortableTreeFunctions.ts +2 -0
  111. package/src/product-set/product/ProductControl.tsx +39 -39
  112. package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +0 -2
  113. package/src/product-set/step/StepControl.tsx +4 -3
  114. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +4 -18
  115. package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +0 -1
  116. package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +11 -1
  117. package/src/recurring-date-picker-input/utils.ts +77 -0
  118. package/src/sales/booking/results/BookingResults.stories.tsx +3 -2
  119. package/src/sales/booking/results/components/ResultCard.tsx +2 -5
  120. package/src/sales/coupon/control/CouponFormControl.tsx +28 -51
  121. package/src/sales/coupon/form/CouponFrom.tsx +5 -15
  122. package/src/sales/coupon/utils/index.ts +13 -0
  123. package/src/setting/admin/AdminSettingForm.tsx +2 -2
  124. package/src/setting/dashboard/DashboardSettingForm.tsx +13 -0
  125. package/src/sortable-tree/SortableTreeItem.tsx +1 -4
  126. package/src/static/switch/BooleanSwitch.tsx +1 -1
  127. package/src/styles/ryft-payment-form/RyftPaymentForm.scss +99 -113
  128. package/src/styles/sales/BookingResults.scss +1 -1
  129. package/src/typeahead/Typeahead.tsx +16 -3
  130. package/src/zone/form/ZoneForm.tsx +3 -2
  131. package/src/zone/form/components/AvailableTimesControl.tsx +0 -2
  132. package/src/zone/form/components/ZoneControl.tsx +3 -3
  133. package/src/zone/form/components/ZoneRecurrencesControl.tsx +7 -5
  134. package/src/zone/form/utils/dates.ts +9 -10
  135. package/jest.config.js +0 -29
  136. package/tests/Auth/Authorizer.test.tsx +0 -194
  137. package/tests/Auth/Layout/UserNavDropDown.test.tsx +0 -43
  138. package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +0 -33
  139. package/tests/Auth/Login/LoginComponent.test.tsx +0 -246
  140. package/tests/Auth/Login/LoginFormComponent.test.tsx +0 -182
  141. package/tests/Auth/Register/RegisterComponent.test.tsx +0 -285
  142. package/tests/Auth/Register/RegisterFormComponent.test.tsx +0 -170
  143. package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +0 -130
  144. package/tests/Auth/Social/SocialCallbackComponent.test.tsx +0 -133
  145. package/tests/Auth/Social/SocialFormComponent.test.tsx +0 -118
  146. package/tests/FileUpload/FileUpload.test.tsx +0 -42
  147. package/tests/Notification/EmailTemplate.test.tsx +0 -82
  148. package/tests/ProductSet/ProductSetPopover.test.tsx +0 -40
  149. package/tests/Report/Report.test.tsx +0 -48
  150. package/tests/Sales/Coupon.test.tsx +0 -51
  151. package/tests/Sales/SalesAndVIews.test.tsx +0 -63
  152. package/tests/SnippetTemplates/SnippetTemplates.test.tsx +0 -56
  153. package/tests/Table/FilterHelperComponent.test.tsx +0 -88
  154. package/tests/Table/PaginationHelperComponent.test.tsx +0 -109
  155. package/tests/Table/PerPageHelperComponent.test.tsx +0 -34
  156. package/tests/Table/TableHelperComponent.test.tsx +0 -295
  157. package/tests/TipTapEditor/TipTapEditor.test.tsx +0 -28
  158. package/tests/__mock__/hooks/useAuthApi.ts +0 -13
  159. package/tests/__mock__/hooks/useAuthMock.ts +0 -13
  160. package/tests/__mock__/hooks/useFormMock.ts +0 -27
  161. package/tests/__mock__/hooks/useNotificationMock.ts +0 -13
  162. package/tests/__mock__/hooks/useQueryMock.ts +0 -16
  163. package/tests/__mock__/hooks/useSocialApiMock.ts +0 -20
  164. package/tests/__mock__/hooks/useTranslationMock.ts +0 -17
  165. package/tests/__mock__/hooks/useUserApiMock.ts +0 -18
  166. package/tests/__mock__/hooks/useUserMock.ts +0 -13
  167. package/tests/__mock__/styleMock.js +0 -1
  168. package/tests/__mock__/windowMock.ts +0 -5
  169. package/tests/packages/react-query.tsx +0 -28
  170. package/tests/setupTests.ts +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.62.3",
3
+ "version": "0.63.0-dev.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -16,14 +16,11 @@
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",
21
19
  "lint": "eslint --ext .ts,.tsx .",
22
20
  "lint:fix": "yarn run lint -- --fix",
23
21
  "lint:format": "prettier \"**/*.{md,json,yml,scss}\" --check",
24
22
  "lint:format:fix": "prettier \"**/*.{md,json,yml,scss}\" --write",
25
23
  "prepare": "husky install",
26
- "test-staged": "CI=true jest --passWithNoTests --findRelatedTests",
27
24
  "tests": "yarn tests-staged",
28
25
  "prettier-write": "prettier --write",
29
26
  "tsc": "bash -c tsc -p tsconfig.json -b"
@@ -53,9 +50,9 @@
53
50
  "@fortawesome/free-brands-svg-icons": "5.15.2",
54
51
  "@fortawesome/free-solid-svg-icons": "5.15.2",
55
52
  "@fortawesome/react-fontawesome": "0.1.9",
56
- "@licklist/core": "^0.23.1",
57
- "@licklist/eslint-config": "0.3.4",
58
- "@licklist/plugins": "^0.27.2",
53
+ "@licklist/core": ">=0.25.1-dev.1 < 0.25.1",
54
+ "@licklist/eslint-config": "0.4.5",
55
+ "@licklist/plugins": ">=0.28.0-dev.2 < 0.28.0",
59
56
  "@mdx-js/react": "1.6.22",
60
57
  "@popperjs/core": "2.11.8",
61
58
  "@react-aria/utils": "3.9.0",
@@ -73,10 +70,6 @@
73
70
  "@svgr/rollup": "5.5.0",
74
71
  "@svgr/webpack": "5.5.0",
75
72
  "@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",
80
73
  "@tiptap/core": "2.0.0-beta.176",
81
74
  "@tiptap/extension-blockquote": "2.0.0-beta.29",
82
75
  "@tiptap/extension-bold": "2.0.0-beta.28",
@@ -99,14 +92,10 @@
99
92
  "@tiptap/react": "2.0.0-beta.109",
100
93
  "@tiptap/suggestion": "2.0.0-beta.92",
101
94
  "@types/babel__core": "7.1.12",
102
- "@types/enzyme-adapter-react-16": "1.0.6",
103
- "@types/jest": "26.0.20",
104
95
  "@types/luxon": "1.26.2",
105
96
  "@types/mdx-js__react": "1.5.3",
106
- "@types/react": "17.0.2",
107
97
  "@types/react-bootstrap": "1.0.1",
108
98
  "@types/react-date-range": "^1.4.4",
109
- "@types/react-dom": "17.0.1",
110
99
  "@types/react-email-editor": "1.1.7",
111
100
  "@types/react-loader": "2.4.4",
112
101
  "@types/react-phone-number-input": "3.0.6",
@@ -116,7 +105,6 @@
116
105
  "@typescript-eslint/eslint-plugin": "5.8.1",
117
106
  "@typescript-eslint/parser": "5.8.1",
118
107
  "@wojtekmaj/react-daterange-picker": "^4.1.0",
119
- "babel-jest": "26.6.3",
120
108
  "babel-loader": "8.2.2",
121
109
  "babel-plugin-inline-react-svg": "2.0.1",
122
110
  "bootstrap": "4.6.0",
@@ -128,21 +116,16 @@
128
116
  "emojibase": "6.1.0",
129
117
  "emojibase-data": "7.0.1",
130
118
  "emojibase-regex": "6.0.1",
131
- "enzyme": "3.11.0",
132
- "enzyme-adapter-react-16": "1.15.6",
133
119
  "eslint": "7.32.0",
134
120
  "eslint-config-airbnb": "18.2.1",
135
121
  "eslint-config-prettier": "8.3.0",
136
- "eslint-plugin-jest": "25.3.2",
137
122
  "eslint-plugin-jsx-a11y": "6.5.1",
138
123
  "eslint-plugin-prettier": "4.0.0",
139
124
  "eslint-plugin-react-hooks": "4.2.0",
140
- "eslint-plugin-testing-library": "5.0.1",
141
125
  "framer-motion": "4.1.17",
142
126
  "history": "5.3.0",
143
127
  "husky": "7.0.4",
144
128
  "i18next": "19.4.5",
145
- "jest": "26.6.0",
146
129
  "klona": "2.0.4",
147
130
  "konva": "6.0.0",
148
131
  "lint-staged": "11.1.2",
@@ -150,18 +133,18 @@
150
133
  "luxon": "1.26.0",
151
134
  "moment": "2.29.1",
152
135
  "prettier": "2.5.1",
153
- "react": "16.14.0",
136
+ "react": "17.0.2",
154
137
  "react-bootstrap": "1.6.1",
155
138
  "react-color": "2.19.3",
156
139
  "react-copy-to-clipboard": "5.0.3",
157
140
  "react-date-range": "^1.4.0",
158
- "react-dom": "16.14.0",
141
+ "react-dom": "17.0.2",
159
142
  "react-email-editor": "1.6.1",
160
143
  "react-highlighter": "0.4.3",
161
144
  "react-hook-form": "7.13.0",
162
145
  "react-i18next": "11.8.8",
163
146
  "react-intl": "5.15.8",
164
- "react-konva": "16.13.0-6",
147
+ "react-konva": "^17.0.2-6",
165
148
  "react-loader": "2.4.7",
166
149
  "react-loading-skeleton": "^3.3.1",
167
150
  "react-overlays": "4.1.1",
@@ -186,7 +169,6 @@
186
169
  "sass": "1.32.8",
187
170
  "sass-loader": "10.1.1",
188
171
  "style-loader": "2.0.0",
189
- "ts-jest": "26.5.2",
190
172
  "twemoji-parser": "14.0.0",
191
173
  "typescript": "4.9.5",
192
174
  "url-loader": "4.1.1",
@@ -194,24 +176,17 @@
194
176
  },
195
177
  "resolutions": {
196
178
  "@types/react": "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
- ]
179
+ "@types/react-dom": "17.0.2"
206
180
  },
207
181
  "lint-staged": {
208
182
  "*.{ts,tsx}": [
209
- "yarn test-staged",
210
183
  "yarn prettier-write",
211
184
  "yarn lint:fix"
212
185
  ]
213
186
  },
214
187
  "devDependencies": {
188
+ "@types/react": "17.0.2",
189
+ "@types/react-dom": "17.0.2",
215
190
  "identity-obj-proxy": "^3.0.0"
216
191
  },
217
192
  "volta": {
@@ -8,7 +8,7 @@ export default {
8
8
  component: DateTimeButton,
9
9
  } as Meta;
10
10
 
11
- const date = DateTime.now();
11
+ const date = DateTime.now().plus({ hour: 1 });
12
12
 
13
13
  export const Default: Story<DateTimeButtonProps> = (args) => {
14
14
  return <DateTimeButton {...args} />;
@@ -19,6 +19,7 @@ Default.args = {
19
19
  isSelected: false,
20
20
  isDisabled: false,
21
21
  onSelect: () => null,
22
+ shouldCalculateResources: false,
22
23
  };
23
24
 
24
25
  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 isTimeInPast = isTimeVariant && isDateInPast(date);
49
+ const isPast = variant === Variant.time ? isPastTime(date) : isPastDate(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 || isTimeInPast || noResources;
58
+ const isDisabled = _isDisabled || isSoldOut || isPast || 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 || isTimeInPast}
88
+ isUnavailable={_isDisabled || isPast}
89
89
  isSoldOut={isSoldOut}
90
90
  />
91
91
  )}
@@ -93,5 +93,7 @@ export const DateTimeButton = ({
93
93
  );
94
94
  };
95
95
 
96
- const isDateInPast = (date: DateTime): boolean =>
97
- date.toUTC() <= DateTime.now().toUTC();
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 });
@@ -19,6 +19,7 @@ import { scrollToError } from "@licklist/plugins/dist/utils/ScrollUtils";
19
19
  import { getFirstErrorKey } from "@licklist/plugins/dist/utils/FormValues";
20
20
 
21
21
  import { ProductSet } from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
22
+ import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
22
23
  import { CategoryGroup } from "../../../../types/categories";
23
24
  import { SaleDeadline } from "../SaleDeadline/SaleDeadline";
24
25
  import {
@@ -64,6 +65,7 @@ export interface EditEventFormProps extends HasPermissionProp {
64
65
  createProductSet: (props: EditEventFormValues) => void;
65
66
  setEditProductSetId: (value: string) => void;
66
67
  isExternalPaymentLinkEnabled?: boolean;
68
+ workHours: WorkHour[] | undefined;
67
69
  }
68
70
 
69
71
  const eventImageTypes = {
@@ -83,6 +85,7 @@ export const EditEventForm = ({
83
85
  createProductSet,
84
86
  setEditProductSetId,
85
87
  isExternalPaymentLinkEnabled,
88
+ workHours,
86
89
  }: EditEventFormProps) => {
87
90
  const { t } = useTranslation(["Design", "Validation"]);
88
91
 
@@ -403,6 +406,7 @@ export const EditEventForm = ({
403
406
  setEditProductSetId={setEditProductSetId}
404
407
  setShowEditProductSet={setShowEditProductSet}
405
408
  showEditProductSet={showEditProductSet}
409
+ workHours={workHours}
406
410
  />
407
411
 
408
412
  {hasPermission && !showEditProductSet && (
@@ -5,6 +5,7 @@ import { useId } from "@react-aria/utils";
5
5
  import { Controller, useFormContext } from "react-hook-form";
6
6
  import { HasPermissionProp } from "@licklist/plugins/dist/types/permission/Permission";
7
7
  import { ProductSet } from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
8
+ import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
8
9
  import { ConfirmModal } from "../../../../modals/confirmation/ConfirmModal";
9
10
  import { EditEventFormValues } from "../EditEventForm/EditEventForm";
10
11
  import { EditEventProductSet } from "./component/EditEventProductSet";
@@ -15,6 +16,7 @@ interface SelectEventProductSetProps extends HasPermissionProp {
15
16
  setShowEditProductSet: (value: boolean) => void;
16
17
  createProductSet: (props: EditEventFormValues) => void;
17
18
  setEditProductSetId: (value: string) => void;
19
+ workHours: WorkHour[] | undefined;
18
20
  }
19
21
 
20
22
  export const SelectEventProductSet = ({
@@ -23,6 +25,7 @@ export const SelectEventProductSet = ({
23
25
  setEditProductSetId,
24
26
  showEditProductSet,
25
27
  setShowEditProductSet,
28
+ workHours,
26
29
  }: SelectEventProductSetProps) => {
27
30
  const { t } = useTranslation(["Design"]);
28
31
  const form = useFormContext<EditEventFormValues>();
@@ -40,6 +43,10 @@ export const SelectEventProductSet = ({
40
43
  const productSetId = watch("productSetId");
41
44
  const editedProductSet = watch("editedProductSet");
42
45
 
46
+ const selectedProductSet = productSets.find(
47
+ (productSet) => productSet.id === productSetId
48
+ )?.parentMenuId;
49
+
43
50
  const onEditProductSet = useCallback(
44
51
  () => {
45
52
  setEditProductSetId(String(productSetId));
@@ -84,6 +91,9 @@ export const SelectEventProductSet = ({
84
91
  setValue("productSetId", value);
85
92
  };
86
93
 
94
+ const showOverrideProductSet =
95
+ !showEditProductSet && productSetId && !selectedProductSet;
96
+
87
97
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
98
  const onSubmit = (value: EditEventFormValues["editedProductSet"]) => {
89
99
  setShowEditProductSet(false);
@@ -159,7 +169,7 @@ export const SelectEventProductSet = ({
159
169
  {t("addNewProductSet")}
160
170
  </Button>
161
171
  )}
162
- {!showEditProductSet && productSetId && (
172
+ {showOverrideProductSet && (
163
173
  <Button
164
174
  variant=""
165
175
  className="btn product-set-button "
@@ -199,14 +209,13 @@ export const SelectEventProductSet = ({
199
209
  </Form.Group>
200
210
  </div>
201
211
  {showEditProductSet && productSetId && (
202
- <>
203
- <EditEventProductSet
204
- onSubmit={onSubmit}
205
- defaultValues={
206
- productSetId === editedProductSet?.id && editedProductSet
207
- }
208
- />
209
- </>
212
+ <EditEventProductSet
213
+ onSubmit={onSubmit}
214
+ defaultValues={
215
+ productSetId === editedProductSet?.id && editedProductSet
216
+ }
217
+ workHours={workHours}
218
+ />
210
219
  )}
211
220
  </>
212
221
  );
@@ -5,6 +5,7 @@ import { isEqual } from "lodash";
5
5
  import { useParams } from "react-router-dom";
6
6
  import { useEventEditProductSetContext } from "@licklist/plugins/dist/context/event/EventEditProductSetContext";
7
7
  import { useTranslation } from "react-i18next";
8
+ import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
8
9
  import { BlockLoader } from "../../../../../static/loader/BlockLoader";
9
10
  import { ProductSetControl } from "../../../../../product-set";
10
11
  import { ProductSetContextProvider } from "../../../../../product-set/form/context";
@@ -22,11 +23,13 @@ export interface EventDates {
22
23
  interface EditEventProductSetProps {
23
24
  onSubmit: (value: EditEventFormValues["editedProductSet"]) => void;
24
25
  defaultValues?: EditEventFormValues["editedProductSet"];
26
+ workHours: WorkHour[] | undefined;
25
27
  }
26
28
 
27
29
  export const EditEventProductSet = ({
28
30
  onSubmit,
29
31
  defaultValues,
32
+ workHours,
30
33
  }: EditEventProductSetProps) => {
31
34
  const { companyId } = useParams<{
32
35
  companyId: string;
@@ -124,6 +127,8 @@ export const EditEventProductSet = ({
124
127
  companyName={selectedCompany?.title}
125
128
  fee={feeInPercent}
126
129
  isEventEditProductSet
130
+ isOverrides
131
+ workHours={workHours}
127
132
  />
128
133
  <Button
129
134
  disabled={isLoading}
@@ -63,7 +63,7 @@ const processedPaymentSummary = ({
63
63
  const total = calculateTotalPrice(order, externalPaymentDetail);
64
64
 
65
65
  const totalDiscount = calculateTotalDiscount(order.payments);
66
- const totalWithDiscount = total - Number(totalDiscount);
66
+
67
67
  let summaryItems: SummaryItem[] = [
68
68
  {
69
69
  translateKey: AMOUNT_TOTAL,
@@ -74,7 +74,7 @@ const processedPaymentSummary = ({
74
74
  if (totalDiscount) {
75
75
  summaryItems.push({
76
76
  translateKey: AMOUNT_WITH_DISCOUNT,
77
- price: totalWithDiscount < 0 ? 0 : totalWithDiscount,
77
+ price: order.totalToPayAmount,
78
78
  });
79
79
  }
80
80
 
@@ -84,17 +84,17 @@ const processedPaymentSummary = ({
84
84
 
85
85
  summaryItems.push({
86
86
  translateKey: TOTAL_PAID,
87
- price: totalWithDiscount <= 0 ? 0 : order.totalAmount,
87
+ price: order.paidAmount,
88
88
  });
89
- if (totalWithDiscount <= 0) {
89
+ if (order.totalToPayAmount <= 0) {
90
90
  return summaryItems;
91
91
  }
92
92
  summaryItems = [...summaryItems, ...externalPaymentDetail];
93
93
 
94
- if (totalWithDiscount > order.totalAmount) {
94
+ if (order.remainingToPay) {
95
95
  summaryItems.push({
96
96
  translateKey: REMAINING_TO_PAY,
97
- price: totalWithDiscount - order.totalAmount,
97
+ price: order.remainingToPay,
98
98
  });
99
99
  }
100
100
  return summaryItems;
@@ -123,18 +123,26 @@ export const RyftPaymentForm = ({
123
123
  };
124
124
 
125
125
  useEffect(
126
- () =>
126
+ () => {
127
+ if (
128
+ !formRef.current?.childNodes?.length ||
129
+ formRef.current?.childNodes?.length < 3 ||
130
+ !accountId.data?.account_id
131
+ ) {
132
+ return;
133
+ }
127
134
  injectComponentsInRyftForm({
128
135
  t,
129
136
  additionalPaymentMethodsEnabled:
130
137
  providerPaymentSettings?.additionalPaymentMethodsEnabled,
131
- }),
138
+ });
139
+ },
132
140
  // eslint-disable-next-line react-hooks/exhaustive-deps
133
141
  [formRef.current?.childNodes?.length]
134
142
  );
135
143
 
136
144
  useEffect(() => {
137
- if (!accountId.data || accountId.isError) return;
145
+ if (!accountId.data?.account_id || accountId.isError) return;
138
146
 
139
147
  initRyft(
140
148
  () => {
@@ -148,7 +156,7 @@ export const RyftPaymentForm = ({
148
156
  );
149
157
 
150
158
  // eslint-disable-next-line react-hooks/exhaustive-deps
151
- }, [accountId.data]);
159
+ }, [accountId.data?.account_id]);
152
160
 
153
161
  if (accountId.isLoading || accountId.isFetching || isCreateLoading)
154
162
  return (
@@ -8,13 +8,12 @@ export const injectComponentsInRyftForm = ({
8
8
  additionalPaymentMethodsEnabled?: boolean;
9
9
  }) => {
10
10
  const cardContainer = document.getElementById("ryft-pay-iframe");
11
- const oldCardDividerContainer = document.getElementById(
12
- "card-title-container"
13
- );
14
11
 
15
- if (!cardContainer || oldCardDividerContainer) {
12
+ if (!cardContainer) {
16
13
  return;
17
14
  }
15
+ // Removing of the old title container
16
+ document.getElementById("card-title-container")?.remove();
18
17
 
19
18
  const cardTitle = document.createElement("div");
20
19
  const cardText = document.createElement("div");
@@ -32,6 +31,10 @@ export const injectComponentsInRyftForm = ({
32
31
  return;
33
32
  }
34
33
 
34
+ // Removing of the old mobile title container and divider container
35
+ document.getElementById("mobile-pay-title")?.remove();
36
+ document.getElementById("mobile-pay-divider-container")?.remove();
37
+
35
38
  // Adding title and divider for apple and google pay button
36
39
  const mobilePayTitle = document.createElement("div");
37
40
  const dividerText = document.createElement("div");
@@ -39,6 +42,7 @@ export const injectComponentsInRyftForm = ({
39
42
  const container = document.createElement("div");
40
43
  mobilePayTitle.className = "mobile-pay-title";
41
44
  mobilePayTitle.innerText = t("Design:expressCheckoutWith");
45
+ mobilePayTitle.id = "mobile-pay-title";
42
46
  dividerText.id = "mobile-pay-divider-text";
43
47
  dividerText.innerText = "or";
44
48
  divider.id = "mobile-pay-divider";
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
2
2
  import { Modifier } from "@popperjs/core";
3
3
  import { useId } from "@react-aria/utils";
4
4
  import { Form, OverlayTrigger, Popover } from "react-bootstrap";
5
- import { useFieldArray, useFormContext } from "react-hook-form";
5
+ import { useFieldArray, useFormContext, useWatch } from "react-hook-form";
6
6
  import { useTranslation } from "react-i18next";
7
7
  import { useClickAway } from "react-use";
8
8
  import { DateTime } from "luxon";
@@ -14,7 +14,6 @@ import {
14
14
  SortableContext,
15
15
  verticalListSortingStrategy,
16
16
  } from "@dnd-kit/sortable";
17
-
18
17
  import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
19
18
  import { CONFIRM_MODAL_ACTIONS } from "../../modals/confirmation/ConfirmModal";
20
19
  import { Icon } from "../../static";
@@ -27,16 +26,15 @@ import {
27
26
  AvailableTimesControl,
28
27
  AvailableTimesControlRef,
29
28
  } from "../../zone/form/components/AvailableTimesControl";
30
-
31
- // eslint-disable-next-line max-len
32
-
33
- export interface DateAndRecurrenceInputValues {
34
- menuRecurrences?: Partial<ProductSetRecurrence>[];
35
- }
29
+ import { ProductSetControlValues } from "..";
30
+ import {
31
+ getProductWithSmallestDuration,
32
+ getLatestAvailableDateTime,
33
+ } from "./utils";
36
34
 
37
35
  interface DateAndRecurrenceInputProps {
38
36
  isEventEditProductSet?: boolean;
39
- workHours?: WorkHour[];
37
+ workHours: WorkHour[] | undefined;
40
38
  providerHasBookingManagement: boolean;
41
39
  isLoading?: boolean;
42
40
  }
@@ -54,7 +52,9 @@ export const DateAndRecurrenceInput = ({
54
52
  getValues,
55
53
  setValue,
56
54
  clearErrors,
57
- } = useFormContext<DateAndRecurrenceInputValues>();
55
+ } = useFormContext<ProductSetControlValues>();
56
+
57
+ const steps = useWatch({ control, name: "steps" });
58
58
 
59
59
  const [availableTimes, setAvailableTimes] = useState<string[]>([]);
60
60
  const availableTimesFormRef = useRef<AvailableTimesControlRef>();
@@ -90,7 +90,7 @@ export const DateAndRecurrenceInput = ({
90
90
  clearEditState();
91
91
  });
92
92
 
93
- const popoverId = useId()!;
93
+ const popoverId = useId();
94
94
 
95
95
  const { t } = useTranslation("Design");
96
96
 
@@ -101,11 +101,13 @@ export const DateAndRecurrenceInput = ({
101
101
  const isAvailableTimesFormValid =
102
102
  await availableTimesFormRef.current?.trigger();
103
103
 
104
+ const { availableTimes } = availableTimesFormRef.current.getValues();
105
+
104
106
  if (next?.startTime && next?.endTime && isAvailableTimesFormValid) {
105
107
  const startTime = DateTime.fromISO(next.startTime);
106
108
  const endTime = DateTime.fromISO(next.endTime);
107
- const { availableTimes } = availableTimesFormRef.current.getValues();
108
- const validAvalilableTimes = availableTimes.every((time) => {
109
+
110
+ const areAvailableTimesValid = availableTimes.every((time) => {
109
111
  const currentAvailableTime = DateTime.fromFormat(time, TIME_FORMAT);
110
112
 
111
113
  return (
@@ -113,7 +115,8 @@ export const DateAndRecurrenceInput = ({
113
115
  currentAvailableTime.diff(endTime, "minutes").minutes <= 0
114
116
  );
115
117
  });
116
- if (!validAvalilableTimes) {
118
+
119
+ if (!areAvailableTimesValid) {
117
120
  availableTimesFormRef.current.setError("availableTimes", {
118
121
  message: t("Validation:fieldTimeBetween", {
119
122
  attribute: t("Design:startTimesSmall"),
@@ -126,6 +129,36 @@ export const DateAndRecurrenceInput = ({
126
129
  }
127
130
  }
128
131
 
132
+ // this check is required to prevent user from adding available time
133
+ // less than the lowest duration product, e.g. if lowest duration product
134
+ // is 1 hour and user tries to add time 15 minutes before end time,
135
+ // such time can never be booked
136
+ const lowestDurationProduct = getProductWithSmallestDuration(steps);
137
+
138
+ if (lowestDurationProduct) {
139
+ const endTime = next?.endTime
140
+ ? DateTime.fromFormat(next?.endTime, TIME_FORMAT)
141
+ : // this is to allow user to add 23:00 if end is at 23:59
142
+ DateTime.fromFormat("23:59", TIME_FORMAT).plus({ minutes: 1 });
143
+
144
+ const latestAvailableTime = getLatestAvailableDateTime(availableTimes);
145
+
146
+ const latestAllowedTime = endTime.minus({
147
+ minutes: lowestDurationProduct.duration,
148
+ });
149
+
150
+ if (latestAvailableTime > latestAllowedTime) {
151
+ availableTimesFormRef.current.setError("availableTimes", {
152
+ message: t("Validation:fieldTimeBefore", {
153
+ attribute: t("Design:timeLowercase"),
154
+ time: latestAllowedTime.toFormat(TIME_FORMAT),
155
+ }),
156
+ });
157
+
158
+ return;
159
+ }
160
+ }
161
+
129
162
  const availableTime =
130
163
  availableTimesFormRef?.current?.getValues()?.availableTimes || null;
131
164
 
@@ -228,6 +261,7 @@ export const DateAndRecurrenceInput = ({
228
261
  defaultValues={editState.values}
229
262
  onChange={handleRecurringDateChange}
230
263
  onDelete={handleDelete}
264
+ workHours={workHours}
231
265
  >
232
266
  {providerHasBookingManagement && (
233
267
  <AvailableTimesControl
@@ -5,9 +5,8 @@ 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 { TIMEZONE } from "@licklist/core/dist/Config/Date";
8
+ import { UTC_TIMEZONE, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
9
9
  import { ProductSetRecurrence } from "@licklist/core/dist/DataMapper/Product/ProductSetRecurrenceDataMapper";
10
- import { TIME_FORMAT } from "@licklist/core/dist/Config/Date";
11
10
  import { DateTime } from "luxon";
12
11
  import RRule, { Frequency } from "rrule";
13
12
  import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
@@ -27,7 +26,6 @@ import {
27
26
  import { ProductSetRecurrenceOverridesControl } from "./ProductSetRecurrenceOverridesControl";
28
27
  import { MAX_QUANTITY_RECURRENCE_DATE_IN_OVERRIDE } from "../product/constants";
29
28
 
30
-
31
29
  export interface DateAndRecurrenceInputValues {
32
30
  menuRecurrences?: Partial<ProductSetRecurrence>[];
33
31
  }
@@ -138,7 +136,7 @@ export const DateInput = ({
138
136
  until: (start as DateTime).toJSDate(),
139
137
  byweekday: [],
140
138
  freq: Frequency.DAILY,
141
- tzid: TIMEZONE,
139
+ tzid: UTC_TIMEZONE,
142
140
  interval: 1,
143
141
  }).replace("RRULE:", "");
144
142
 
@@ -2,12 +2,12 @@ import { Meta, Story } from "@storybook/react";
2
2
  import React from "react";
3
3
  import Form from "react-bootstrap/Form";
4
4
  import { FormProvider, useForm } from "react-hook-form";
5
+ import { OPERATIONAL_COST_CUSTOMER } from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
5
6
  import {
6
7
  ProductSetControl,
7
8
  ProductSetControlProps,
8
9
  ProductSetControlValues,
9
10
  } from "./ProductSetControl";
10
- import { OPERATIONAL_COST_CUSTOMER } from "@licklist/core/dist/DataMapper/Product/ProductSetDataMapper";
11
11
 
12
12
  export default {
13
13
  title: "Product Set/Control",