@eventlook/sdk 1.4.49-beta.4 → 1.4.49-beta.6
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/dist/cjs/form/PaymentOverviewBox.js +5 -4
- package/dist/cjs/form/PaymentOverviewBox.js.map +1 -1
- package/dist/cjs/form/PaymentOverviewDrawer.js +220 -60
- package/dist/cjs/form/PaymentOverviewDrawer.js.map +1 -1
- package/dist/cjs/form/Shipping.js +13 -10
- package/dist/cjs/form/Shipping.js.map +1 -1
- package/dist/cjs/form/TicketForm.js +5 -8
- package/dist/cjs/form/TicketForm.js.map +1 -1
- package/dist/cjs/form/product/ProductCard.js +45 -38
- package/dist/cjs/form/product/ProductCard.js.map +1 -1
- package/dist/cjs/form/product/ProductVariantsDialog.js +13 -4
- package/dist/cjs/form/product/ProductVariantsDialog.js.map +1 -1
- package/dist/cjs/form/style.js +6 -1
- package/dist/cjs/form/style.js.map +1 -1
- package/dist/cjs/form/tickets/TicketQuantityControl.js +5 -3
- package/dist/cjs/form/tickets/TicketQuantityControl.js.map +1 -1
- package/dist/cjs/hooks/useScrollToFirstError.js +19 -10
- package/dist/cjs/hooks/useScrollToFirstError.js.map +1 -1
- package/dist/cjs/locales/cs.js +7 -0
- package/dist/cjs/locales/cs.js.map +1 -1
- package/dist/cjs/locales/en.js +7 -0
- package/dist/cjs/locales/en.js.map +1 -1
- package/dist/cjs/locales/es.js +7 -0
- package/dist/cjs/locales/es.js.map +1 -1
- package/dist/cjs/locales/pl.js +7 -0
- package/dist/cjs/locales/pl.js.map +1 -1
- package/dist/cjs/locales/sk.js +7 -0
- package/dist/cjs/locales/sk.js.map +1 -1
- package/dist/cjs/locales/uk.js +7 -0
- package/dist/cjs/locales/uk.js.map +1 -1
- package/dist/esm/form/PaymentOverviewBox.js +5 -4
- package/dist/esm/form/PaymentOverviewBox.js.map +1 -1
- package/dist/esm/form/PaymentOverviewDrawer.js +220 -60
- package/dist/esm/form/PaymentOverviewDrawer.js.map +1 -1
- package/dist/esm/form/Shipping.js +13 -10
- package/dist/esm/form/Shipping.js.map +1 -1
- package/dist/esm/form/TicketForm.js +6 -9
- package/dist/esm/form/TicketForm.js.map +1 -1
- package/dist/esm/form/product/ProductCard.js +46 -39
- package/dist/esm/form/product/ProductCard.js.map +1 -1
- package/dist/esm/form/product/ProductVariantsDialog.js +13 -4
- package/dist/esm/form/product/ProductVariantsDialog.js.map +1 -1
- package/dist/esm/form/style.js +6 -1
- package/dist/esm/form/style.js.map +1 -1
- package/dist/esm/form/tickets/TicketQuantityControl.js +5 -3
- package/dist/esm/form/tickets/TicketQuantityControl.js.map +1 -1
- package/dist/esm/hooks/useScrollToFirstError.js +19 -10
- package/dist/esm/hooks/useScrollToFirstError.js.map +1 -1
- package/dist/esm/locales/cs.js +7 -0
- package/dist/esm/locales/cs.js.map +1 -1
- package/dist/esm/locales/en.js +7 -0
- package/dist/esm/locales/en.js.map +1 -1
- package/dist/esm/locales/es.js +7 -0
- package/dist/esm/locales/es.js.map +1 -1
- package/dist/esm/locales/pl.js +7 -0
- package/dist/esm/locales/pl.js.map +1 -1
- package/dist/esm/locales/sk.js +7 -0
- package/dist/esm/locales/sk.js.map +1 -1
- package/dist/esm/locales/uk.js +7 -0
- package/dist/esm/locales/uk.js.map +1 -1
- package/package.json +1 -3
- package/rollup.config.mjs +0 -1
- package/src/form/PaymentOverviewBox.tsx +19 -13
- package/src/form/PaymentOverviewDrawer.tsx +314 -106
- package/src/form/Shipping.tsx +19 -16
- package/src/form/TicketForm.tsx +7 -8
- package/src/form/product/ProductCard.tsx +75 -70
- package/src/form/product/ProductVariantsDialog.tsx +19 -2
- package/src/form/style.ts +7 -1
- package/src/form/tickets/TicketQuantityControl.tsx +6 -0
- package/src/hooks/useScrollToFirstError.ts +22 -17
- package/src/locales/cs.tsx +7 -0
- package/src/locales/en.tsx +7 -0
- package/src/locales/es.tsx +7 -0
- package/src/locales/pl.tsx +7 -0
- package/src/locales/sk.tsx +7 -0
- package/src/locales/uk.tsx +7 -0
- package/src/hooks/useConsentScrollOnDrawerOpen.ts +0 -73
|
@@ -10,184 +10,386 @@ import { EVENTLOOK_ORDER_FORM_ID } from '@utils/data/global.ts';
|
|
|
10
10
|
interface Props {
|
|
11
11
|
event: IEvent;
|
|
12
12
|
totalPrice: number;
|
|
13
|
+
termsAndConditionsRef?: React.RefObject<HTMLElement | null>;
|
|
13
14
|
onOpenChange?: (open: boolean) => void;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const swipeAreaWidth =
|
|
17
|
+
const swipeAreaWidth = 120;
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const clearResetPulledPastTimeout = (timeoutRef: { current: number | null }) => {
|
|
20
|
+
if (timeoutRef.current !== null) {
|
|
21
|
+
window.clearTimeout(timeoutRef.current);
|
|
22
|
+
timeoutRef.current = null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const PaymentOverviewDrawer: React.FC<Props> = ({
|
|
27
|
+
event,
|
|
28
|
+
totalPrice,
|
|
29
|
+
termsAndConditionsRef,
|
|
30
|
+
onOpenChange,
|
|
31
|
+
}) => {
|
|
19
32
|
const { t, lang } = useGlobal();
|
|
20
|
-
const [
|
|
21
|
-
const
|
|
33
|
+
const [isDrawerOpened, setIsDrawerOpened] = useState(false);
|
|
34
|
+
const [isOpeningGesture, setIsOpeningGesture] = useState(false);
|
|
35
|
+
const [hasPulledPastClosedTabHeight, setHasPulledPastClosedTabHeight] = useState(false);
|
|
36
|
+
const [isDrawerHidden, setIsDrawerHidden] = useState(false);
|
|
37
|
+
const [closedTabHeight, setClosedTabHeight] = useState(0);
|
|
38
|
+
const openingTouchStartYRef = useRef<number | null>(null);
|
|
39
|
+
const openDrawerRef = useRef(false);
|
|
40
|
+
const isOpeningGestureRef = useRef(false);
|
|
41
|
+
const shouldReopenOnScrollUpRef = useRef(false);
|
|
42
|
+
const lastScrollYRef = useRef(0);
|
|
43
|
+
const isScrollingDownRef = useRef(false);
|
|
44
|
+
const wasAtPageBottomRef = useRef(false);
|
|
45
|
+
const resetPulledPastTimeoutRef = useRef<number | null>(null);
|
|
46
|
+
const closedTabRef = useRef<HTMLDivElement>(null);
|
|
22
47
|
|
|
23
|
-
|
|
24
|
-
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
openDrawerRef.current = isDrawerOpened;
|
|
50
|
+
}, [isDrawerOpened]);
|
|
25
51
|
|
|
26
|
-
// Opens drawer when scrolling down
|
|
27
52
|
useEffect(() => {
|
|
28
|
-
|
|
29
|
-
|
|
53
|
+
isOpeningGestureRef.current = isOpeningGesture;
|
|
54
|
+
}, [isOpeningGesture]);
|
|
55
|
+
|
|
56
|
+
// reopens the drawer when user scrolls up and the drawer was closed by scrolling down to the bottom of the page
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (typeof window === 'undefined') {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const atBottomThreshold = 8;
|
|
63
|
+
lastScrollYRef.current = window.scrollY;
|
|
64
|
+
isScrollingDownRef.current = false;
|
|
65
|
+
wasAtPageBottomRef.current =
|
|
66
|
+
window.innerHeight + window.scrollY >=
|
|
67
|
+
document.documentElement.scrollHeight - atBottomThreshold;
|
|
68
|
+
|
|
69
|
+
const handleScroll = () => {
|
|
70
|
+
const currentY = window.scrollY;
|
|
71
|
+
const isScrollingUp = currentY < lastScrollYRef.current;
|
|
72
|
+
const isScrollingDown = currentY > lastScrollYRef.current;
|
|
73
|
+
const isAtPageBottom =
|
|
74
|
+
window.innerHeight + currentY >= document.documentElement.scrollHeight - atBottomThreshold;
|
|
75
|
+
|
|
76
|
+
isScrollingDownRef.current = isScrollingDown;
|
|
77
|
+
|
|
78
|
+
if (
|
|
79
|
+
isScrollingUp &&
|
|
80
|
+
wasAtPageBottomRef.current &&
|
|
81
|
+
shouldReopenOnScrollUpRef.current &&
|
|
82
|
+
!openDrawerRef.current
|
|
83
|
+
) {
|
|
84
|
+
shouldReopenOnScrollUpRef.current = false;
|
|
85
|
+
setIsDrawerHidden(false);
|
|
86
|
+
openDrawerHandler();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
wasAtPageBottomRef.current = isAtPageBottom;
|
|
90
|
+
lastScrollYRef.current = currentY;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
94
|
+
|
|
95
|
+
return () => {
|
|
96
|
+
window.removeEventListener('scroll', handleScroll);
|
|
97
|
+
};
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const closedTab = closedTabRef.current;
|
|
102
|
+
if (!closedTab) return;
|
|
103
|
+
|
|
104
|
+
const updateClosedTabHeight = () => {
|
|
105
|
+
setClosedTabHeight(closedTab.offsetHeight);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
updateClosedTabHeight();
|
|
109
|
+
|
|
110
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
111
|
+
updateClosedTabHeight();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
resizeObserver.observe(closedTab);
|
|
115
|
+
|
|
116
|
+
return () => {
|
|
117
|
+
resizeObserver.disconnect();
|
|
118
|
+
};
|
|
119
|
+
}, []);
|
|
120
|
+
|
|
121
|
+
useEffect(
|
|
122
|
+
() => () => {
|
|
123
|
+
clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
|
|
124
|
+
},
|
|
125
|
+
[]
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
const termsAndConditionsElement = termsAndConditionsRef?.current;
|
|
130
|
+
if (!termsAndConditionsElement) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (!('IntersectionObserver' in window)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
30
137
|
|
|
31
138
|
const observer = new IntersectionObserver(
|
|
32
139
|
(entries) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
openDrawerHandler();
|
|
40
|
-
}
|
|
140
|
+
const entry = entries[0];
|
|
141
|
+
const hasReachedTermsSection = entry?.isIntersecting ?? false;
|
|
142
|
+
const shouldAutoCloseDrawer = hasReachedTermsSection;
|
|
143
|
+
const shouldHideDrawerTab =
|
|
144
|
+
hasReachedTermsSection && !openDrawerRef.current && !isOpeningGestureRef.current;
|
|
145
|
+
setIsDrawerHidden(shouldHideDrawerTab);
|
|
41
146
|
|
|
42
|
-
|
|
43
|
-
|
|
147
|
+
if (shouldAutoCloseDrawer && openDrawerRef.current && isScrollingDownRef.current) {
|
|
148
|
+
closeDrawerHandler({ shouldReopenOnScrollUp: true });
|
|
149
|
+
setIsDrawerHidden(true);
|
|
150
|
+
}
|
|
44
151
|
},
|
|
45
152
|
{
|
|
153
|
+
root: null,
|
|
46
154
|
threshold: 0,
|
|
47
|
-
rootMargin: '0px 0px
|
|
155
|
+
rootMargin: '0px 0px -40% 0px',
|
|
48
156
|
}
|
|
49
157
|
);
|
|
50
158
|
|
|
51
|
-
observer.observe(
|
|
159
|
+
observer.observe(termsAndConditionsElement);
|
|
52
160
|
|
|
53
161
|
return () => {
|
|
54
|
-
observer.
|
|
162
|
+
observer.disconnect();
|
|
55
163
|
};
|
|
56
|
-
}, [
|
|
164
|
+
}, [termsAndConditionsRef]);
|
|
57
165
|
|
|
58
166
|
const toggleDrawer = () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
167
|
+
if (openDrawerRef.current) {
|
|
168
|
+
closeDrawerHandler();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
openDrawerHandler();
|
|
64
173
|
};
|
|
65
174
|
|
|
66
175
|
const openDrawerHandler = () => {
|
|
67
|
-
|
|
176
|
+
clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
|
|
177
|
+
setIsOpeningGesture(false);
|
|
178
|
+
setHasPulledPastClosedTabHeight(false);
|
|
179
|
+
openingTouchStartYRef.current = null;
|
|
180
|
+
shouldReopenOnScrollUpRef.current = false;
|
|
181
|
+
setIsDrawerOpened(true);
|
|
68
182
|
onOpenChange?.(true);
|
|
69
183
|
};
|
|
70
184
|
|
|
71
|
-
const closeDrawerHandler = (
|
|
72
|
-
|
|
185
|
+
const closeDrawerHandler = ({
|
|
186
|
+
shouldReopenOnScrollUp = false,
|
|
187
|
+
}: { shouldReopenOnScrollUp?: boolean } = {}) => {
|
|
188
|
+
clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
|
|
189
|
+
setIsOpeningGesture(false);
|
|
190
|
+
setHasPulledPastClosedTabHeight(false);
|
|
191
|
+
openingTouchStartYRef.current = null;
|
|
192
|
+
shouldReopenOnScrollUpRef.current = shouldReopenOnScrollUp;
|
|
193
|
+
setIsDrawerOpened(false);
|
|
73
194
|
onOpenChange?.(false);
|
|
74
195
|
};
|
|
75
196
|
|
|
76
|
-
const
|
|
77
|
-
|
|
197
|
+
const scheduleResetPulledPastTimeout = () => {
|
|
198
|
+
clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
|
|
199
|
+
resetPulledPastTimeoutRef.current = window.setTimeout(() => {
|
|
200
|
+
if (!openDrawerRef.current) {
|
|
201
|
+
setHasPulledPastClosedTabHeight(false);
|
|
202
|
+
}
|
|
203
|
+
}, 180);
|
|
78
204
|
};
|
|
79
205
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
206
|
+
const handleGestureStart = (startY: number | null) => {
|
|
207
|
+
openingTouchStartYRef.current = startY;
|
|
208
|
+
setIsOpeningGesture(true);
|
|
209
|
+
setHasPulledPastClosedTabHeight(false);
|
|
210
|
+
};
|
|
83
211
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
212
|
+
const handleGestureMove = (currentY?: number) => {
|
|
213
|
+
if (!isOpeningGestureRef.current) return;
|
|
214
|
+
|
|
215
|
+
const startY = openingTouchStartYRef.current;
|
|
216
|
+
if (startY === null || typeof currentY !== 'number') return;
|
|
217
|
+
|
|
218
|
+
const pullDistance = startY - currentY;
|
|
219
|
+
const currentClosedTabHeight = closedTabRef.current?.offsetHeight ?? 0;
|
|
220
|
+
setHasPulledPastClosedTabHeight(
|
|
221
|
+
currentClosedTabHeight > 0 && pullDistance >= currentClosedTabHeight
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const handleGestureCancel = () => {
|
|
226
|
+
openingTouchStartYRef.current = null;
|
|
227
|
+
setIsOpeningGesture(false);
|
|
228
|
+
setHasPulledPastClosedTabHeight(false);
|
|
229
|
+
};
|
|
88
230
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
231
|
+
const handleGestureEnd = ({
|
|
232
|
+
shouldResetTouchStart = false,
|
|
233
|
+
}: { shouldResetTouchStart?: boolean } = {}) => {
|
|
234
|
+
if (shouldResetTouchStart) {
|
|
235
|
+
openingTouchStartYRef.current = null;
|
|
92
236
|
}
|
|
93
237
|
|
|
94
|
-
|
|
238
|
+
if (!isDrawerOpened) {
|
|
239
|
+
setIsOpeningGesture(false);
|
|
240
|
+
scheduleResetPulledPastTimeout();
|
|
241
|
+
}
|
|
95
242
|
};
|
|
96
243
|
|
|
97
244
|
return (
|
|
98
245
|
<Box sx={{ display: { md: 'none' } }}>
|
|
99
|
-
{/* Sentinel element for intersection observer */}
|
|
100
|
-
<Box ref={sentinelRef} sx={{ height: 1, visibility: 'hidden' }} />
|
|
101
|
-
|
|
102
246
|
{/* Drawer Tab */}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
247
|
+
<Box
|
|
248
|
+
ref={closedTabRef}
|
|
249
|
+
sx={{
|
|
250
|
+
position: 'fixed',
|
|
251
|
+
bottom: 0,
|
|
252
|
+
left: 0,
|
|
253
|
+
right: 0,
|
|
254
|
+
backgroundColor: (theme) => theme.palette.background.paper,
|
|
255
|
+
borderTopLeftRadius: isOpeningGesture || isDrawerOpened ? 0 : 16,
|
|
256
|
+
borderTopRightRadius: isOpeningGesture || isDrawerOpened ? 0 : 16,
|
|
257
|
+
boxShadow:
|
|
258
|
+
isOpeningGesture || isDrawerOpened ? 'none' : '0 -8px 10px 2px rgba(0,0,0,0.2)',
|
|
259
|
+
zIndex: (theme) => theme.zIndex.drawer + 1,
|
|
260
|
+
opacity: isDrawerHidden ? 0 : 1,
|
|
261
|
+
transform: isDrawerHidden ? 'translateY(calc(100% + 12px))' : 'translateY(0)',
|
|
262
|
+
transition:
|
|
263
|
+
'opacity 180ms ease, transform 180ms ease, border-radius 120ms ease, box-shadow 120ms ease',
|
|
264
|
+
pointerEvents: 'none',
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
{!isDrawerOpened && (
|
|
119
268
|
<Box
|
|
120
|
-
role="button"
|
|
121
|
-
aria-label={t('form.labels.payment_overview_open')}
|
|
122
|
-
onClick={toggleDrawer}
|
|
123
269
|
sx={{
|
|
124
270
|
display: 'flex',
|
|
125
271
|
justifyContent: 'center',
|
|
126
272
|
alignItems: 'center',
|
|
127
|
-
cursor: 'pointer',
|
|
128
273
|
width: '100%',
|
|
129
274
|
py: 1,
|
|
130
275
|
}}
|
|
131
276
|
>
|
|
132
277
|
<Box
|
|
133
278
|
sx={{
|
|
134
|
-
width:
|
|
279
|
+
width: 80,
|
|
135
280
|
height: 6,
|
|
136
281
|
backgroundColor: (theme) => theme.palette.grey[300],
|
|
137
282
|
borderRadius: 3,
|
|
283
|
+
opacity: isOpeningGesture ? 0 : 1,
|
|
284
|
+
transition: 'opacity 120ms ease',
|
|
138
285
|
}}
|
|
139
286
|
/>
|
|
140
287
|
</Box>
|
|
141
|
-
|
|
288
|
+
)}
|
|
289
|
+
<Box
|
|
290
|
+
role="button"
|
|
291
|
+
aria-label={t('form.labels.payment_overview_open')}
|
|
292
|
+
onClick={toggleDrawer}
|
|
293
|
+
onTouchStart={(event: React.TouchEvent<HTMLDivElement>) => {
|
|
294
|
+
handleGestureStart(event.touches[0]?.clientY ?? null);
|
|
295
|
+
}}
|
|
296
|
+
onMouseDown={() => {
|
|
297
|
+
handleGestureStart(null);
|
|
298
|
+
}}
|
|
299
|
+
onTouchMove={(event: React.TouchEvent<HTMLDivElement>) => {
|
|
300
|
+
handleGestureMove(event.touches[0]?.clientY);
|
|
301
|
+
}}
|
|
302
|
+
onTouchCancel={handleGestureCancel}
|
|
303
|
+
onTouchEnd={() => {
|
|
304
|
+
handleGestureEnd({ shouldResetTouchStart: true });
|
|
305
|
+
}}
|
|
306
|
+
onMouseUp={() => {
|
|
307
|
+
handleGestureEnd();
|
|
308
|
+
}}
|
|
309
|
+
sx={{
|
|
310
|
+
width: '100%',
|
|
311
|
+
px: 2,
|
|
312
|
+
pb: 2,
|
|
313
|
+
pointerEvents: isDrawerOpened || isDrawerHidden ? 'none' : 'auto',
|
|
314
|
+
cursor: 'pointer',
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<Typography
|
|
142
318
|
sx={{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
319
|
+
fontWeight: 'bold',
|
|
320
|
+
display: 'flex',
|
|
321
|
+
justifyContent: 'space-between',
|
|
322
|
+
alignItems: 'center',
|
|
146
323
|
}}
|
|
147
324
|
>
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
fullWidth
|
|
166
|
-
sx={{ mt: 1, height: { xs: 36, md: 40 } }}
|
|
167
|
-
>
|
|
168
|
-
{t('buy')}
|
|
169
|
-
</Button>
|
|
170
|
-
</Box>
|
|
325
|
+
<span>{t('form.labels.total')}:</span>
|
|
326
|
+
<span>{fCurrency(totalPrice, lang, event.currency)}</span>
|
|
327
|
+
</Typography>
|
|
328
|
+
|
|
329
|
+
<Button
|
|
330
|
+
type="submit"
|
|
331
|
+
form={EVENTLOOK_ORDER_FORM_ID}
|
|
332
|
+
onClick={(event) => {
|
|
333
|
+
event.stopPropagation();
|
|
334
|
+
}}
|
|
335
|
+
variant="contained"
|
|
336
|
+
size="large"
|
|
337
|
+
fullWidth
|
|
338
|
+
sx={{ mt: 1, height: { xs: 36, md: 40 } }}
|
|
339
|
+
>
|
|
340
|
+
{t('buy')}
|
|
341
|
+
</Button>
|
|
171
342
|
</Box>
|
|
172
|
-
|
|
343
|
+
</Box>
|
|
173
344
|
|
|
174
345
|
{/* Drawer Content */}
|
|
175
346
|
<SwipeableDrawer
|
|
176
347
|
anchor="bottom"
|
|
177
|
-
open={
|
|
178
|
-
onClose={closeDrawerHandler}
|
|
179
|
-
onOpen={openDrawerHandler}
|
|
348
|
+
open={isDrawerOpened}
|
|
349
|
+
onClose={() => closeDrawerHandler()}
|
|
350
|
+
onOpen={() => openDrawerHandler()}
|
|
180
351
|
swipeAreaWidth={swipeAreaWidth}
|
|
181
|
-
|
|
352
|
+
allowSwipeInChildren
|
|
353
|
+
disableSwipeToOpen={isDrawerHidden}
|
|
182
354
|
keepMounted
|
|
183
|
-
|
|
355
|
+
SwipeAreaProps={{
|
|
356
|
+
onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => {
|
|
357
|
+
handleGestureStart(event.touches[0]?.clientY ?? null);
|
|
358
|
+
},
|
|
359
|
+
onMouseDown: () => {
|
|
360
|
+
handleGestureStart(null);
|
|
361
|
+
},
|
|
362
|
+
onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => {
|
|
363
|
+
handleGestureMove(event.touches[0]?.clientY);
|
|
364
|
+
},
|
|
365
|
+
onTouchCancel: handleGestureCancel,
|
|
366
|
+
onTouchEnd: () => {
|
|
367
|
+
handleGestureEnd({ shouldResetTouchStart: true });
|
|
368
|
+
},
|
|
369
|
+
onMouseUp: () => {
|
|
370
|
+
handleGestureEnd();
|
|
371
|
+
},
|
|
372
|
+
}}
|
|
373
|
+
sx={{
|
|
374
|
+
display: { md: 'none' },
|
|
375
|
+
pointerEvents: isDrawerOpened ? 'none' : 'auto',
|
|
376
|
+
'& .MuiDrawer-paper': {
|
|
377
|
+
pointerEvents: 'auto',
|
|
378
|
+
},
|
|
379
|
+
'& .MuiSwipeArea-root': {
|
|
380
|
+
pointerEvents: 'auto',
|
|
381
|
+
},
|
|
382
|
+
}}
|
|
184
383
|
ModalProps={{
|
|
185
384
|
disableScrollLock: true,
|
|
186
385
|
keepMounted: false,
|
|
386
|
+
disableAutoFocus: true,
|
|
387
|
+
disableRestoreFocus: true,
|
|
388
|
+
disableEnforceFocus: true,
|
|
187
389
|
BackdropProps: {
|
|
188
|
-
sx: {
|
|
189
|
-
|
|
190
|
-
|
|
390
|
+
sx: {
|
|
391
|
+
background: 'none',
|
|
392
|
+
pointerEvents: 'none',
|
|
191
393
|
},
|
|
192
394
|
},
|
|
193
395
|
}}
|
|
@@ -197,6 +399,12 @@ const PaymentOverviewDrawer: React.FC<Props> = ({ event, totalPrice, onOpenChang
|
|
|
197
399
|
borderTopRightRadius: 16,
|
|
198
400
|
boxShadow: '0 -8px 10px 2px rgba(0,0,0,0.2)',
|
|
199
401
|
overflow: 'hidden',
|
|
402
|
+
mb:
|
|
403
|
+
isDrawerOpened ||
|
|
404
|
+
(!isDrawerOpened && (isOpeningGesture || hasPulledPastClosedTabHeight))
|
|
405
|
+
? `${closedTabHeight}px`
|
|
406
|
+
: 0,
|
|
407
|
+
transition: 'none',
|
|
200
408
|
},
|
|
201
409
|
}}
|
|
202
410
|
>
|
|
@@ -215,7 +423,7 @@ const PaymentOverviewDrawer: React.FC<Props> = ({ event, totalPrice, onOpenChang
|
|
|
215
423
|
>
|
|
216
424
|
<Box
|
|
217
425
|
sx={{
|
|
218
|
-
width:
|
|
426
|
+
width: 80,
|
|
219
427
|
height: 6,
|
|
220
428
|
backgroundColor: (theme) => theme.palette.grey[300],
|
|
221
429
|
borderRadius: 3,
|
|
@@ -228,7 +436,7 @@ const PaymentOverviewDrawer: React.FC<Props> = ({ event, totalPrice, onOpenChang
|
|
|
228
436
|
overflow: 'auto',
|
|
229
437
|
}}
|
|
230
438
|
>
|
|
231
|
-
<PaymentOverviewBox event={event} />
|
|
439
|
+
<PaymentOverviewBox event={event} hideBuyButton />
|
|
232
440
|
</Box>
|
|
233
441
|
</SwipeableDrawer>
|
|
234
442
|
</Box>
|
package/src/form/Shipping.tsx
CHANGED
|
@@ -160,6 +160,12 @@ const Shipping: React.FC<Props> = ({ event }) => {
|
|
|
160
160
|
key={shippingMethod.id}
|
|
161
161
|
active={Number(shippingMethodId) === shippingMethod.id}
|
|
162
162
|
hasError={!!error}
|
|
163
|
+
sx={{
|
|
164
|
+
'& .MuiFormControlLabel-labelPlacementEnd': {
|
|
165
|
+
mr: 0,
|
|
166
|
+
width: '100%',
|
|
167
|
+
},
|
|
168
|
+
}}
|
|
163
169
|
>
|
|
164
170
|
<FormControlLabel
|
|
165
171
|
value={shippingMethod.id}
|
|
@@ -171,24 +177,20 @@ const Shipping: React.FC<Props> = ({ event }) => {
|
|
|
171
177
|
alignItems="center"
|
|
172
178
|
width="100%"
|
|
173
179
|
>
|
|
174
|
-
<Stack direction="
|
|
175
|
-
<
|
|
176
|
-
sx={{
|
|
177
|
-
marginRight: 2,
|
|
178
|
-
}}
|
|
179
|
-
>
|
|
180
|
+
<Stack direction="column">
|
|
181
|
+
<Stack direction="row" alignItems="center" spacing={1}>
|
|
180
182
|
<Typography sx={{ lineHeight: 1.2 }}>
|
|
181
183
|
{t(`shipping_method.types.${shippingMethod.type}`)}
|
|
182
184
|
</Typography>
|
|
183
|
-
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
{paymentImages[shippingMethod.type]}
|
|
186
|
+
</Stack>
|
|
187
|
+
{displayBranchName &&
|
|
188
|
+
shippingMethod.type === ShippingTypes.PACKETA &&
|
|
189
|
+
shippingMethod.id === Number(shippingMethodId) && (
|
|
190
|
+
<Typography variant="caption" sx={{ lineHeight: 1 }}>
|
|
191
|
+
{displayBranchName}
|
|
192
|
+
</Typography>
|
|
193
|
+
)}
|
|
192
194
|
</Stack>
|
|
193
195
|
{shippingMethod.type === ShippingTypes.PACKETA &&
|
|
194
196
|
shippingMethod.id === Number(shippingMethodId) && (
|
|
@@ -197,8 +199,9 @@ const Shipping: React.FC<Props> = ({ event }) => {
|
|
|
197
199
|
onClick={handleChangeBranch}
|
|
198
200
|
variant="outlined"
|
|
199
201
|
size="small"
|
|
202
|
+
sx={{ px: 1, whiteSpace: 'nowrap' }}
|
|
200
203
|
>
|
|
201
|
-
{t('
|
|
204
|
+
{t('event.tickets.shipping.choose_address')}
|
|
202
205
|
</Button>
|
|
203
206
|
</Box>
|
|
204
207
|
)}
|
package/src/form/TicketForm.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import PaymentSuccess from '@form/PaymentSuccess';
|
|
|
3
3
|
import FormProvider, { RHFCheckbox } from '@components/hook-form';
|
|
4
4
|
import {
|
|
5
5
|
Box,
|
|
6
|
+
Divider,
|
|
6
7
|
Grid,
|
|
7
8
|
Link,
|
|
8
9
|
LinkProps,
|
|
@@ -52,7 +53,6 @@ import useErrors from '@hooks/useErrors';
|
|
|
52
53
|
import { EventType } from '@utils/data/event';
|
|
53
54
|
import TimeslotSelection from '@form/TimeslotSelection';
|
|
54
55
|
import useGlobal from '@hooks/useGlobal';
|
|
55
|
-
import useConsentScrollOnDrawerOpen from '@hooks/useConsentScrollOnDrawerOpen';
|
|
56
56
|
import useScrollToFirstError from '@hooks/useScrollToFirstError';
|
|
57
57
|
import { Trans } from '@components/Trans';
|
|
58
58
|
import { EVENTLOOK_ORDER_FORM_ID, EVENTLOOK_ORDER_FORM_CONTAINER_ID } from '@utils/data/global.ts';
|
|
@@ -115,11 +115,6 @@ const TicketForm: React.FC<Props> = ({
|
|
|
115
115
|
const hasFiredPaymentMethod = useRef(false);
|
|
116
116
|
const termsAndConditionsRef = useRef<HTMLDivElement | null>(null);
|
|
117
117
|
|
|
118
|
-
useConsentScrollOnDrawerOpen({
|
|
119
|
-
isDrawerOpen: isPaymentOverviewDrawerOpen,
|
|
120
|
-
consentRef: termsAndConditionsRef,
|
|
121
|
-
});
|
|
122
|
-
|
|
123
118
|
const item: IEcommerce = {
|
|
124
119
|
currency: event.currency,
|
|
125
120
|
items: [
|
|
@@ -693,14 +688,18 @@ const TicketForm: React.FC<Props> = ({
|
|
|
693
688
|
/>
|
|
694
689
|
</Stack>
|
|
695
690
|
</Grid>
|
|
696
|
-
<Grid item xs={12}
|
|
697
|
-
<
|
|
691
|
+
<Grid item xs={12} sx={{ display: { xs: 'block', md: 'none' } }}>
|
|
692
|
+
<Divider sx={{ borderStyle: 'dashed' }} />
|
|
693
|
+
</Grid>
|
|
694
|
+
<Grid item xs={12} md={4} mt={{ xs: 0, md: 0 }}>
|
|
695
|
+
<PaymentOverviewBox event={event} withoutPadding />
|
|
698
696
|
</Grid>
|
|
699
697
|
</Grid>
|
|
700
698
|
|
|
701
699
|
<PaymentOverviewDrawer
|
|
702
700
|
event={event}
|
|
703
701
|
totalPrice={values.total}
|
|
702
|
+
termsAndConditionsRef={termsAndConditionsRef}
|
|
704
703
|
onOpenChange={setIsPaymentOverviewDrawerOpen}
|
|
705
704
|
/>
|
|
706
705
|
|