@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.
- package/bitbucket-pipelines.yml +0 -8
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +3 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +3 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +3 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +1 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
- package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
- package/dist/iframe/ryft/utils/ryft-form.js +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts +1 -5
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.js +1 -1
- package/dist/product-set/control/DateInput.d.ts.map +1 -1
- package/dist/product-set/control/DateInput.js +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts +4 -3
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +1 -1
- package/dist/product-set/control/utils.d.ts +5 -0
- package/dist/product-set/control/utils.d.ts.map +1 -0
- package/dist/product-set/control/utils.js +1 -0
- package/dist/product-set/form/ProductCategoriesControl.d.ts +2 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductSetForm.d.ts +4 -1
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +2 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/form/StepsControl.d.ts +2 -1
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.d.ts +1 -0
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
- package/dist/product-set/step/StepControl.d.ts +2 -1
- package/dist/product-set/step/StepControl.d.ts.map +1 -1
- package/dist/product-set/step/StepControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +3 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
- package/dist/recurring-date-picker-input/utils.d.ts +12 -0
- package/dist/recurring-date-picker-input/utils.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/utils.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/sales/coupon/control/CouponFormControl.d.ts +2 -1
- package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
- package/dist/sales/coupon/control/CouponFormControl.js +1 -1
- package/dist/sales/coupon/form/CouponFrom.d.ts +2 -2
- package/dist/sales/coupon/form/CouponFrom.d.ts.map +1 -1
- package/dist/sales/coupon/utils/index.d.ts +7 -0
- package/dist/sales/coupon/utils/index.d.ts.map +1 -0
- package/dist/sales/coupon/utils/index.js +1 -0
- package/dist/setting/admin/AdminSettingForm.d.ts +2 -2
- package/dist/setting/admin/AdminSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/DashboardSettingForm.d.ts +1 -0
- package/dist/setting/dashboard/DashboardSettingForm.d.ts.map +1 -1
- package/dist/setting/dashboard/DashboardSettingForm.js +1 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts +1 -2
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +1 -1
- package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +99 -113
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/typeahead/Typeahead.d.ts +2 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +1 -1
- package/dist/zone/form/ZoneForm.d.ts +2 -2
- package/dist/zone/form/ZoneForm.d.ts.map +1 -1
- package/dist/zone/form/ZoneForm.js +1 -1
- package/dist/zone/form/components/AvailableTimesControl.d.ts +0 -2
- package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.d.ts +2 -2
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts +4 -4
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/package.json +10 -35
- package/src/date-time-button/DateTimeButton.stories.tsx +2 -1
- package/src/date-time-button/DateTimeButton.tsx +7 -5
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +4 -0
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +18 -9
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +5 -0
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
- package/src/iframe/ryft/RyftPaymentForm.tsx +12 -4
- package/src/iframe/ryft/utils/ryft-form.ts +8 -4
- package/src/product-set/control/DateAndRecurrenceInput.tsx +48 -14
- package/src/product-set/control/DateInput.tsx +2 -4
- package/src/product-set/control/ProductSetControl.stories.tsx +1 -1
- package/src/product-set/control/ProductSetControl.tsx +12 -11
- package/src/product-set/control/utils.ts +25 -0
- package/src/product-set/form/ProductCategoriesControl.tsx +8 -4
- package/src/product-set/form/ProductSetForm.stories.tsx +1 -2
- package/src/product-set/form/ProductSetForm.tsx +5 -1
- package/src/product-set/form/ProductsControl.tsx +87 -77
- package/src/product-set/form/StepsControl.tsx +11 -6
- package/src/product-set/hooks/useSortableTreeFunctions.ts +2 -0
- package/src/product-set/product/ProductControl.tsx +39 -39
- package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +0 -2
- package/src/product-set/step/StepControl.tsx +4 -3
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +4 -18
- package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +0 -1
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +11 -1
- package/src/recurring-date-picker-input/utils.ts +77 -0
- package/src/sales/booking/results/BookingResults.stories.tsx +3 -2
- package/src/sales/booking/results/components/ResultCard.tsx +2 -5
- package/src/sales/coupon/control/CouponFormControl.tsx +28 -51
- package/src/sales/coupon/form/CouponFrom.tsx +5 -15
- package/src/sales/coupon/utils/index.ts +13 -0
- package/src/setting/admin/AdminSettingForm.tsx +2 -2
- package/src/setting/dashboard/DashboardSettingForm.tsx +13 -0
- package/src/sortable-tree/SortableTreeItem.tsx +1 -4
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/ryft-payment-form/RyftPaymentForm.scss +99 -113
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/typeahead/Typeahead.tsx +16 -3
- package/src/zone/form/ZoneForm.tsx +3 -2
- package/src/zone/form/components/AvailableTimesControl.tsx +0 -2
- package/src/zone/form/components/ZoneControl.tsx +3 -3
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +7 -5
- package/src/zone/form/utils/dates.ts +9 -10
- package/jest.config.js +0 -29
- package/tests/Auth/Authorizer.test.tsx +0 -194
- package/tests/Auth/Layout/UserNavDropDown.test.tsx +0 -43
- package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +0 -33
- package/tests/Auth/Login/LoginComponent.test.tsx +0 -246
- package/tests/Auth/Login/LoginFormComponent.test.tsx +0 -182
- package/tests/Auth/Register/RegisterComponent.test.tsx +0 -285
- package/tests/Auth/Register/RegisterFormComponent.test.tsx +0 -170
- package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +0 -130
- package/tests/Auth/Social/SocialCallbackComponent.test.tsx +0 -133
- package/tests/Auth/Social/SocialFormComponent.test.tsx +0 -118
- package/tests/FileUpload/FileUpload.test.tsx +0 -42
- package/tests/Notification/EmailTemplate.test.tsx +0 -82
- package/tests/ProductSet/ProductSetPopover.test.tsx +0 -40
- package/tests/Report/Report.test.tsx +0 -48
- package/tests/Sales/Coupon.test.tsx +0 -51
- package/tests/Sales/SalesAndVIews.test.tsx +0 -63
- package/tests/SnippetTemplates/SnippetTemplates.test.tsx +0 -56
- package/tests/Table/FilterHelperComponent.test.tsx +0 -88
- package/tests/Table/PaginationHelperComponent.test.tsx +0 -109
- package/tests/Table/PerPageHelperComponent.test.tsx +0 -34
- package/tests/Table/TableHelperComponent.test.tsx +0 -295
- package/tests/TipTapEditor/TipTapEditor.test.tsx +0 -28
- package/tests/__mock__/hooks/useAuthApi.ts +0 -13
- package/tests/__mock__/hooks/useAuthMock.ts +0 -13
- package/tests/__mock__/hooks/useFormMock.ts +0 -27
- package/tests/__mock__/hooks/useNotificationMock.ts +0 -13
- package/tests/__mock__/hooks/useQueryMock.ts +0 -16
- package/tests/__mock__/hooks/useSocialApiMock.ts +0 -20
- package/tests/__mock__/hooks/useTranslationMock.ts +0 -17
- package/tests/__mock__/hooks/useUserApiMock.ts +0 -18
- package/tests/__mock__/hooks/useUserMock.ts +0 -13
- package/tests/__mock__/styleMock.js +0 -1
- package/tests/__mock__/windowMock.ts +0 -5
- package/tests/packages/react-query.tsx +0 -28
- package/tests/setupTests.ts +0 -10
|
@@ -47,141 +47,127 @@
|
|
|
47
47
|
margin-left: 0.5rem;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.ryft-payment-form {
|
|
51
|
-
.submit-button-wrapper {
|
|
52
|
-
margin: -1rem 0 1rem;
|
|
53
|
-
|
|
54
|
-
button {
|
|
55
|
-
width: 100%;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
#mobile-pay-divider-container {
|
|
59
|
-
display: flex;
|
|
60
|
-
position: relative;
|
|
61
|
-
margin-bottom: 1rem;
|
|
62
|
-
#mobile-pay-divider-text {
|
|
63
|
-
margin-right: 1rem;
|
|
64
|
-
font-size: 0.875rem;
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
}
|
|
67
|
-
#mobile-pay-divider {
|
|
68
|
-
width: 100%;
|
|
69
|
-
border-bottom: 1px #dfdfdf solid;
|
|
70
|
-
margin-bottom: 0.6rem;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
#card-title-container {
|
|
75
|
-
height: auto;
|
|
76
|
-
border: none;
|
|
77
|
-
margin-bottom: 0.5rem;
|
|
78
|
-
text-align: left;
|
|
79
|
-
:first-child {
|
|
80
|
-
font-size: 1rem;
|
|
81
|
-
font-weight: 600;
|
|
82
|
-
margin-bottom: 1rem;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.form-label {
|
|
86
|
-
margin-bottom: 0.5rem;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
.mobile-pay-title {
|
|
90
|
-
display: block;
|
|
91
|
-
font-weight: 600;
|
|
92
|
-
font-size: 1rem;
|
|
93
|
-
color: black;
|
|
94
|
-
padding: 0;
|
|
95
|
-
font-style: normal;
|
|
96
|
-
font-family: inherit;
|
|
97
|
-
margin-bottom: 1rem;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
50
|
.form {
|
|
101
51
|
.input {
|
|
102
52
|
border: 2px solid #525252 !important;
|
|
103
53
|
}
|
|
104
54
|
}
|
|
105
55
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// it's style for Google and Apple pay container, for unknown reasons we can't move this html elements with appendChild or replaceChild
|
|
114
|
-
.ryft-pay-grid {
|
|
115
|
-
width: 100%;
|
|
116
|
-
max-width: 15.5rem;
|
|
117
|
-
margin-bottom: 1rem;
|
|
56
|
+
@include media-breakpoint-down(sm) {
|
|
57
|
+
.left-block-container {
|
|
58
|
+
max-height: 100%;
|
|
59
|
+
overflow: visible;
|
|
118
60
|
}
|
|
119
|
-
.ryft-pay-apple-pay-button {
|
|
120
|
-
border-radius: 0.25rem;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.divider {
|
|
125
|
-
display: none !important;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
@include media-breakpoint-down(sm) {
|
|
129
|
-
.left-block-container {
|
|
130
|
-
max-height: 100%;
|
|
131
|
-
overflow: visible;
|
|
132
61
|
}
|
|
133
62
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@include media-breakpoint-down(sm) {
|
|
137
|
-
flex-direction: column-reverse;
|
|
138
|
-
overflow: scroll;
|
|
139
63
|
|
|
140
64
|
@include media-breakpoint-down(sm) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
65
|
+
flex-direction: column-reverse;
|
|
66
|
+
overflow: scroll;
|
|
67
|
+
|
|
68
|
+
@include media-breakpoint-down(sm) {
|
|
69
|
+
.left-block {
|
|
70
|
+
min-height: 100%;
|
|
71
|
+
}
|
|
72
|
+
.right-block {
|
|
73
|
+
margin: 0 auto;
|
|
74
|
+
width: 100%;
|
|
75
|
+
.children-wrapper {
|
|
76
|
+
.accordion {
|
|
77
|
+
.collapse {
|
|
78
|
+
overflow: visible;
|
|
79
|
+
overflow-x: unset;
|
|
80
|
+
scrollbar-width: unset;
|
|
81
|
+
}
|
|
153
82
|
}
|
|
154
83
|
}
|
|
155
84
|
}
|
|
156
85
|
}
|
|
157
86
|
}
|
|
158
87
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
88
|
+
::-webkit-scrollbar {
|
|
89
|
+
display: none;
|
|
90
|
+
scrollbar-width: none;
|
|
91
|
+
}
|
|
163
92
|
}
|
|
164
93
|
}
|
|
165
94
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
max-width: 100%;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
95
|
+
#ryft-threeDSMethodIframe {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ryft-payment-form {
|
|
100
|
+
.submit-button-wrapper {
|
|
101
|
+
margin: -1rem 0 1rem;
|
|
102
|
+
|
|
103
|
+
button {
|
|
104
|
+
width: 100%;
|
|
181
105
|
}
|
|
182
106
|
}
|
|
107
|
+
#mobile-pay-divider-container {
|
|
108
|
+
display: flex;
|
|
109
|
+
position: relative;
|
|
110
|
+
margin-bottom: 1rem;
|
|
111
|
+
#mobile-pay-divider-text {
|
|
112
|
+
margin-right: 1rem;
|
|
113
|
+
font-size: 0.875rem;
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
}
|
|
116
|
+
#mobile-pay-divider {
|
|
117
|
+
width: 100%;
|
|
118
|
+
border-bottom: 1px #dfdfdf solid;
|
|
119
|
+
margin-bottom: 0.6rem;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#card-title-container {
|
|
124
|
+
height: auto;
|
|
125
|
+
border: none;
|
|
126
|
+
margin-bottom: 0.5rem;
|
|
127
|
+
text-align: left;
|
|
128
|
+
:first-child {
|
|
129
|
+
font-size: 1rem;
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
margin-bottom: 1rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.form-label {
|
|
135
|
+
margin-bottom: 0.5rem;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
.mobile-pay-title {
|
|
139
|
+
display: block;
|
|
140
|
+
font-weight: 600;
|
|
141
|
+
font-size: 1rem;
|
|
142
|
+
color: black;
|
|
143
|
+
padding: 0;
|
|
144
|
+
font-style: normal;
|
|
145
|
+
font-family: inherit;
|
|
146
|
+
margin-bottom: 1rem;
|
|
147
|
+
}
|
|
183
148
|
}
|
|
184
149
|
|
|
185
|
-
|
|
186
|
-
|
|
150
|
+
@include media-breakpoint-up(md) {
|
|
151
|
+
.ryft-payment-form,
|
|
152
|
+
.iframe-payment-form {
|
|
153
|
+
position: relative;
|
|
154
|
+
max-height: 300px !important;
|
|
155
|
+
.submit-button-wrapper {
|
|
156
|
+
max-width: 15.5rem;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// it's style for Google and Apple pay container, for unknown reasons we can't move this html elements with appendChild or replaceChild
|
|
161
|
+
.ryft-pay-grid {
|
|
162
|
+
width: 100%;
|
|
163
|
+
max-width: 15.5rem;
|
|
164
|
+
margin-bottom: 1rem;
|
|
165
|
+
}
|
|
166
|
+
.ryft-pay-apple-pay-button {
|
|
167
|
+
border-radius: 0.25rem;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.divider {
|
|
171
|
+
display: none !important;
|
|
172
|
+
}
|
|
187
173
|
}
|
|
@@ -16,6 +16,7 @@ export interface TypeaheadProps {
|
|
|
16
16
|
isMultipleChoise?: boolean;
|
|
17
17
|
noOptionsMessage: string;
|
|
18
18
|
isInvalid?: boolean;
|
|
19
|
+
isCouponForm?: boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
function Typeahead({
|
|
@@ -24,13 +25,25 @@ function Typeahead({
|
|
|
24
25
|
isRequired = false,
|
|
25
26
|
isMultipleChoise,
|
|
26
27
|
name = "",
|
|
28
|
+
isCouponForm = false,
|
|
27
29
|
noOptionsMessage = "",
|
|
28
30
|
isInvalid,
|
|
29
31
|
}: TypeaheadProps) {
|
|
30
32
|
const { control } = useFormContext();
|
|
31
33
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
+
const getStyle = (): CSSObjectWithLabel => {
|
|
35
|
+
const couponFormStyle = isCouponForm
|
|
36
|
+
? {
|
|
37
|
+
borderRadius: "1rem",
|
|
38
|
+
minHeight: "3rem",
|
|
39
|
+
}
|
|
40
|
+
: {};
|
|
41
|
+
return isInvalid
|
|
42
|
+
? { borderColor: "red", ...couponFormStyle }
|
|
43
|
+
: {
|
|
44
|
+
...couponFormStyle,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
34
47
|
|
|
35
48
|
return (
|
|
36
49
|
<>
|
|
@@ -46,7 +59,7 @@ function Typeahead({
|
|
|
46
59
|
styles={{
|
|
47
60
|
control: (base) => ({
|
|
48
61
|
...base,
|
|
49
|
-
...
|
|
62
|
+
...getStyle(),
|
|
50
63
|
}),
|
|
51
64
|
}}
|
|
52
65
|
onChange={(value) => {
|
|
@@ -13,7 +13,7 @@ export type ZoneFormProps = {
|
|
|
13
13
|
onSubmit: (values: Partial<Zone>) => void;
|
|
14
14
|
serverErrors?: ServerError;
|
|
15
15
|
isLoading?: boolean;
|
|
16
|
-
workHours
|
|
16
|
+
workHours: WorkHour[] | undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export type ZoneFormValues = Partial<Zone> & {
|
|
@@ -25,6 +25,7 @@ export const ZoneForm = ({
|
|
|
25
25
|
onSubmit,
|
|
26
26
|
serverErrors,
|
|
27
27
|
isLoading = false,
|
|
28
|
+
workHours,
|
|
28
29
|
}: ZoneFormProps) => {
|
|
29
30
|
const { t } = useTranslation("Design");
|
|
30
31
|
const form = useForm<ZoneFormValues>({
|
|
@@ -54,7 +55,7 @@ export const ZoneForm = ({
|
|
|
54
55
|
return (
|
|
55
56
|
<FormProvider {...form}>
|
|
56
57
|
<Form onSubmit={handleSubmit(onFormSubmit)}>
|
|
57
|
-
<ZoneControl isLoading={isLoading} />
|
|
58
|
+
<ZoneControl isLoading={isLoading} workHours={workHours} />
|
|
58
59
|
<Row>
|
|
59
60
|
<Col md={6} sm={12} />
|
|
60
61
|
<Col
|
|
@@ -11,15 +11,15 @@ import { GameDurationControl } from "./GameDurationControl";
|
|
|
11
11
|
|
|
12
12
|
export type ZoneControlProps = {
|
|
13
13
|
isLoading: boolean;
|
|
14
|
-
workHours
|
|
14
|
+
workHours: WorkHour[] | undefined;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const ZoneControl = ({ isLoading }: ZoneControlProps) => {
|
|
17
|
+
export const ZoneControl = ({ isLoading, workHours }: ZoneControlProps) => {
|
|
18
18
|
return (
|
|
19
19
|
<Row>
|
|
20
20
|
<Col md={6} sm={12} className="pr-5">
|
|
21
21
|
<NameControl isLoading={isLoading} />
|
|
22
|
-
<ZoneRecurrencesControl />
|
|
22
|
+
<ZoneRecurrencesControl workHours={workHours} />
|
|
23
23
|
<hr />
|
|
24
24
|
<Row>
|
|
25
25
|
<Col md={6} sm={6}>
|
|
@@ -25,12 +25,13 @@ export interface DateAndRecurrenceInputValues {
|
|
|
25
25
|
zoneRecurrences?: Partial<ZoneRecurrence>[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
workHours
|
|
30
|
-
isLoading?: boolean;
|
|
28
|
+
type ZoneRecurrenceControlProps = {
|
|
29
|
+
workHours: WorkHour[] | undefined;
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
export const ZoneRecurrencesControl = (
|
|
32
|
+
export const ZoneRecurrencesControl = ({
|
|
33
|
+
workHours,
|
|
34
|
+
}: ZoneRecurrenceControlProps) => {
|
|
34
35
|
const {
|
|
35
36
|
control,
|
|
36
37
|
register,
|
|
@@ -69,7 +70,7 @@ export const ZoneRecurrencesControl = () => {
|
|
|
69
70
|
clearEditState();
|
|
70
71
|
});
|
|
71
72
|
|
|
72
|
-
const popoverId = useId()
|
|
73
|
+
const popoverId = useId();
|
|
73
74
|
|
|
74
75
|
const { t } = useTranslation(["Design", "Validation"]);
|
|
75
76
|
|
|
@@ -166,6 +167,7 @@ export const ZoneRecurrencesControl = () => {
|
|
|
166
167
|
onChange={handleRecurringDateChange}
|
|
167
168
|
onDelete={handleDelete}
|
|
168
169
|
setInitialStartDateAfterSelect
|
|
170
|
+
workHours={workHours}
|
|
169
171
|
/>
|
|
170
172
|
</Popover.Content>
|
|
171
173
|
</Popover>
|
|
@@ -53,18 +53,17 @@ export const getCheckboxesByWorkHours = (workHours?: WorkHour[]) => {
|
|
|
53
53
|
if (!workHours || !workHours.length)
|
|
54
54
|
return getTimeCheckboxRanges(DEFAULT_START_DAY_TIME, DEFAULT_END_DAY_TIME);
|
|
55
55
|
|
|
56
|
-
const providerWorkHoursByWeek = workHours.reduce
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const providerWorkHoursByWeek = workHours.reduce<
|
|
57
|
+
{ start: string; end: string }[]
|
|
58
|
+
>((workHoursNextArray, currentWorkHour) => {
|
|
59
|
+
const { start, end } = currentWorkHour;
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if (start && end) {
|
|
62
|
+
return [...workHoursNextArray, { start, end }];
|
|
63
|
+
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
[]
|
|
67
|
-
);
|
|
65
|
+
return workHoursNextArray;
|
|
66
|
+
}, []);
|
|
68
67
|
|
|
69
68
|
// If venue has filled only 1 work day from wee
|
|
70
69
|
// For another days we use default 00:00 and 23:59
|
package/jest.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { act } from "react-dom/test-utils";
|
|
5
|
-
import { QueryClientProvider } from "react-query";
|
|
6
|
-
import { Authorizer } from "../../src/auth/Authorizer";
|
|
7
|
-
import useAuthMock from "../__mock__/hooks/useAuthMock";
|
|
8
|
-
import useUserMock from "../__mock__/hooks/useUserMock";
|
|
9
|
-
import useAuthApi from "../__mock__/hooks/useAuthApi";
|
|
10
|
-
import { queryClient } from "../packages/react-query";
|
|
11
|
-
|
|
12
|
-
jest.mock("react-i18next", () => ({
|
|
13
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
14
|
-
useTranslation: () => ({
|
|
15
|
-
t: jest.fn((arg) => arg),
|
|
16
|
-
}),
|
|
17
|
-
}));
|
|
18
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useAuth");
|
|
19
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
20
|
-
jest.mock("@licklist/plugins/dist/hooks/Api/useAuthApi");
|
|
21
|
-
|
|
22
|
-
const DEFAULT_PROFILE_RESPONSE = {
|
|
23
|
-
useProfile: () => ({
|
|
24
|
-
isLoading: false,
|
|
25
|
-
isFetching: false,
|
|
26
|
-
isError: false,
|
|
27
|
-
data: { access_token: "test" },
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const DEFAULT_PROFILE_LOADING_RESPONSE = {
|
|
32
|
-
useProfile: () => ({
|
|
33
|
-
isLoading: true,
|
|
34
|
-
isFetching: false,
|
|
35
|
-
isError: false,
|
|
36
|
-
data: { access_token: "test" },
|
|
37
|
-
}),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
describe("Authorizer", () => {
|
|
41
|
-
it("should be rendered without issues", () => {
|
|
42
|
-
useAuthMock({
|
|
43
|
-
secrets: null,
|
|
44
|
-
});
|
|
45
|
-
useUserMock({
|
|
46
|
-
profile: null,
|
|
47
|
-
});
|
|
48
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
49
|
-
|
|
50
|
-
const component = shallow(
|
|
51
|
-
<QueryClientProvider client={queryClient}>
|
|
52
|
-
<Authorizer />
|
|
53
|
-
</QueryClientProvider>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
expect(component.exists()).toBeTruthy();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("should render children if authorized", () => {
|
|
60
|
-
let component: any;
|
|
61
|
-
|
|
62
|
-
useAuthMock({
|
|
63
|
-
secrets: "not-null",
|
|
64
|
-
});
|
|
65
|
-
useUserMock({
|
|
66
|
-
profile: "not-null",
|
|
67
|
-
});
|
|
68
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
69
|
-
|
|
70
|
-
RouteService.getCurrentPage = jest.fn();
|
|
71
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
72
|
-
RouteService.cleanRedirect = jest.fn();
|
|
73
|
-
|
|
74
|
-
act(() => {
|
|
75
|
-
component = mount(
|
|
76
|
-
<QueryClientProvider client={queryClient}>
|
|
77
|
-
<Authorizer>
|
|
78
|
-
<p>test</p>
|
|
79
|
-
</Authorizer>
|
|
80
|
-
</QueryClientProvider>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
component.update();
|
|
85
|
-
|
|
86
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
87
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
88
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
89
|
-
expect(component.exists()).toBeTruthy();
|
|
90
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should render children if current page is login", () => {
|
|
94
|
-
let component: any;
|
|
95
|
-
|
|
96
|
-
useAuthMock({
|
|
97
|
-
secrets: null,
|
|
98
|
-
});
|
|
99
|
-
useUserMock({
|
|
100
|
-
profile: null,
|
|
101
|
-
});
|
|
102
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
103
|
-
|
|
104
|
-
RouteService.getCurrentPage = jest.fn().mockReturnValue("/login");
|
|
105
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
106
|
-
RouteService.cleanRedirect = jest.fn();
|
|
107
|
-
|
|
108
|
-
act(() => {
|
|
109
|
-
component = mount(
|
|
110
|
-
<QueryClientProvider client={queryClient}>
|
|
111
|
-
<Authorizer>
|
|
112
|
-
<p>test</p>
|
|
113
|
-
</Authorizer>
|
|
114
|
-
</QueryClientProvider>
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
component.update();
|
|
119
|
-
|
|
120
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
121
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
122
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
123
|
-
expect(component.exists()).toBeTruthy();
|
|
124
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("should NOT render children if profile is loading or fetching", () => {
|
|
128
|
-
let component: any;
|
|
129
|
-
|
|
130
|
-
useAuthMock({
|
|
131
|
-
secrets: null,
|
|
132
|
-
});
|
|
133
|
-
useUserMock({
|
|
134
|
-
profile: null,
|
|
135
|
-
});
|
|
136
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
137
|
-
|
|
138
|
-
RouteService.getCurrentPage = jest.fn();
|
|
139
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
140
|
-
RouteService.cleanRedirect = jest.fn();
|
|
141
|
-
|
|
142
|
-
act(() => {
|
|
143
|
-
component = mount(
|
|
144
|
-
<QueryClientProvider client={queryClient}>
|
|
145
|
-
<Authorizer>
|
|
146
|
-
<p>test</p>
|
|
147
|
-
</Authorizer>
|
|
148
|
-
</QueryClientProvider>
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
component.update();
|
|
153
|
-
|
|
154
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
155
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
156
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
157
|
-
expect(component.exists()).toBeTruthy();
|
|
158
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it("should NOT render children if unauthorized and current page is not login", () => {
|
|
162
|
-
let component: any;
|
|
163
|
-
|
|
164
|
-
useAuthMock({
|
|
165
|
-
secrets: null,
|
|
166
|
-
});
|
|
167
|
-
useUserMock({
|
|
168
|
-
profile: null,
|
|
169
|
-
});
|
|
170
|
-
useAuthApi(DEFAULT_PROFILE_RESPONSE);
|
|
171
|
-
|
|
172
|
-
RouteService.getCurrentPage = jest.fn();
|
|
173
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
174
|
-
RouteService.cleanRedirect = jest.fn();
|
|
175
|
-
|
|
176
|
-
act(() => {
|
|
177
|
-
component = mount(
|
|
178
|
-
<QueryClientProvider client={queryClient}>
|
|
179
|
-
<Authorizer>
|
|
180
|
-
<p>test</p>
|
|
181
|
-
</Authorizer>
|
|
182
|
-
</QueryClientProvider>
|
|
183
|
-
);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
component.update();
|
|
187
|
-
|
|
188
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(3);
|
|
189
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(1);
|
|
190
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(1);
|
|
191
|
-
expect(component.exists()).toBeTruthy();
|
|
192
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
193
|
-
});
|
|
194
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
|
|
5
|
-
import useUserMock from "../../__mock__/hooks/useUserMock";
|
|
6
|
-
import { UserNavDropDown } from "../../../src/auth/Layout/UserNavDropDown";
|
|
7
|
-
|
|
8
|
-
jest.mock("react-i18next");
|
|
9
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
10
|
-
|
|
11
|
-
describe("UserNavDropDown", () => {
|
|
12
|
-
it("should be rendered without issues", () => {
|
|
13
|
-
useTranslationMock({
|
|
14
|
-
t: jest.fn(),
|
|
15
|
-
});
|
|
16
|
-
useUserMock({
|
|
17
|
-
profile: null,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const component = shallow(<UserNavDropDown />);
|
|
21
|
-
|
|
22
|
-
expect(component.exists()).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("should logout on click", () => {
|
|
26
|
-
useTranslationMock({
|
|
27
|
-
t: jest.fn(),
|
|
28
|
-
});
|
|
29
|
-
useUserMock({
|
|
30
|
-
logout: jest.fn(),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
RouteService.redirectTo = jest.fn();
|
|
34
|
-
|
|
35
|
-
const component = mount(<UserNavDropDown />);
|
|
36
|
-
|
|
37
|
-
expect(component.exists()).toBeTruthy();
|
|
38
|
-
|
|
39
|
-
component.children().prop("onClick")();
|
|
40
|
-
|
|
41
|
-
expect(RouteService.redirectTo).toHaveBeenCalledTimes(1);
|
|
42
|
-
});
|
|
43
|
-
});
|