@eventlook/sdk 1.4.49-beta.5 → 1.4.49-beta.7

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 (73) hide show
  1. package/dist/cjs/form/PaymentOverviewBox.js +5 -4
  2. package/dist/cjs/form/PaymentOverviewBox.js.map +1 -1
  3. package/dist/cjs/form/PaymentOverviewDrawer.js +177 -109
  4. package/dist/cjs/form/PaymentOverviewDrawer.js.map +1 -1
  5. package/dist/cjs/form/TicketForm.js +5 -8
  6. package/dist/cjs/form/TicketForm.js.map +1 -1
  7. package/dist/cjs/form/merchandise/MerchandiseSlider.js +1 -1
  8. package/dist/cjs/form/merchandise/MerchandiseSlider.js.map +1 -1
  9. package/dist/cjs/form/product/ProductVariantsDialog.js +2 -2
  10. package/dist/cjs/form/product/ProductVariantsDialog.js.map +1 -1
  11. package/dist/cjs/form/style.js +5 -0
  12. package/dist/cjs/form/style.js.map +1 -1
  13. package/dist/cjs/form/tickets/TicketQuantityControl.js +5 -3
  14. package/dist/cjs/form/tickets/TicketQuantityControl.js.map +1 -1
  15. package/dist/cjs/hooks/useScrollToFirstError.js +19 -10
  16. package/dist/cjs/hooks/useScrollToFirstError.js.map +1 -1
  17. package/dist/cjs/locales/cs.js +4 -0
  18. package/dist/cjs/locales/cs.js.map +1 -1
  19. package/dist/cjs/locales/en.js +4 -0
  20. package/dist/cjs/locales/en.js.map +1 -1
  21. package/dist/cjs/locales/es.js +4 -0
  22. package/dist/cjs/locales/es.js.map +1 -1
  23. package/dist/cjs/locales/pl.js +4 -0
  24. package/dist/cjs/locales/pl.js.map +1 -1
  25. package/dist/cjs/locales/sk.js +4 -0
  26. package/dist/cjs/locales/sk.js.map +1 -1
  27. package/dist/cjs/locales/uk.js +4 -0
  28. package/dist/cjs/locales/uk.js.map +1 -1
  29. package/dist/esm/form/PaymentOverviewBox.js +5 -4
  30. package/dist/esm/form/PaymentOverviewBox.js.map +1 -1
  31. package/dist/esm/form/PaymentOverviewDrawer.js +177 -109
  32. package/dist/esm/form/PaymentOverviewDrawer.js.map +1 -1
  33. package/dist/esm/form/TicketForm.js +6 -9
  34. package/dist/esm/form/TicketForm.js.map +1 -1
  35. package/dist/esm/form/merchandise/MerchandiseSlider.js +1 -1
  36. package/dist/esm/form/merchandise/MerchandiseSlider.js.map +1 -1
  37. package/dist/esm/form/product/ProductVariantsDialog.js +2 -2
  38. package/dist/esm/form/product/ProductVariantsDialog.js.map +1 -1
  39. package/dist/esm/form/style.js +5 -0
  40. package/dist/esm/form/style.js.map +1 -1
  41. package/dist/esm/form/tickets/TicketQuantityControl.js +5 -3
  42. package/dist/esm/form/tickets/TicketQuantityControl.js.map +1 -1
  43. package/dist/esm/hooks/useScrollToFirstError.js +19 -10
  44. package/dist/esm/hooks/useScrollToFirstError.js.map +1 -1
  45. package/dist/esm/locales/cs.js +4 -0
  46. package/dist/esm/locales/cs.js.map +1 -1
  47. package/dist/esm/locales/en.js +4 -0
  48. package/dist/esm/locales/en.js.map +1 -1
  49. package/dist/esm/locales/es.js +4 -0
  50. package/dist/esm/locales/es.js.map +1 -1
  51. package/dist/esm/locales/pl.js +4 -0
  52. package/dist/esm/locales/pl.js.map +1 -1
  53. package/dist/esm/locales/sk.js +4 -0
  54. package/dist/esm/locales/sk.js.map +1 -1
  55. package/dist/esm/locales/uk.js +4 -0
  56. package/dist/esm/locales/uk.js.map +1 -1
  57. package/package.json +1 -3
  58. package/rollup.config.mjs +0 -1
  59. package/src/form/PaymentOverviewBox.tsx +19 -13
  60. package/src/form/PaymentOverviewDrawer.tsx +238 -128
  61. package/src/form/TicketForm.tsx +7 -8
  62. package/src/form/merchandise/MerchandiseSlider.tsx +1 -1
  63. package/src/form/product/ProductVariantsDialog.tsx +2 -0
  64. package/src/form/style.ts +6 -0
  65. package/src/form/tickets/TicketQuantityControl.tsx +6 -0
  66. package/src/hooks/useScrollToFirstError.ts +22 -17
  67. package/src/locales/cs.tsx +4 -0
  68. package/src/locales/en.tsx +4 -0
  69. package/src/locales/es.tsx +4 -0
  70. package/src/locales/pl.tsx +4 -0
  71. package/src/locales/sk.tsx +4 -0
  72. package/src/locales/uk.tsx +4 -0
  73. package/src/hooks/useConsentScrollOnDrawerOpen.ts +0 -73
@@ -6,46 +6,67 @@ import { fCurrency } from '../utils/formatNumber.js';
6
6
  import { EVENTLOOK_ORDER_FORM_ID } from '../utils/data/global.js';
7
7
 
8
8
  const swipeAreaWidth = 120;
9
- const PaymentOverviewDrawer = ({ event, totalPrice, onOpenChange }) => {
9
+ const clearResetPulledPastTimeout = (timeoutRef) => {
10
+ if (timeoutRef.current !== null) {
11
+ window.clearTimeout(timeoutRef.current);
12
+ timeoutRef.current = null;
13
+ }
14
+ };
15
+ const PaymentOverviewDrawer = ({ event, totalPrice, termsAndConditionsRef, onOpenChange, }) => {
10
16
  const { t, lang } = useGlobal();
11
- const [openDrawer, setOpenDrawer] = useState(false);
17
+ const [isDrawerOpened, setIsDrawerOpened] = useState(false);
12
18
  const [isOpeningGesture, setIsOpeningGesture] = useState(false);
13
19
  const [hasPulledPastClosedTabHeight, setHasPulledPastClosedTabHeight] = useState(false);
20
+ const [isDrawerHidden, setIsDrawerHidden] = useState(false);
14
21
  const [closedTabHeight, setClosedTabHeight] = useState(0);
15
22
  const openingTouchStartYRef = useRef(null);
16
23
  const openDrawerRef = useRef(false);
24
+ const isOpeningGestureRef = useRef(false);
25
+ const shouldReopenOnScrollUpRef = useRef(false);
26
+ const lastScrollYRef = useRef(0);
27
+ const isScrollingDownRef = useRef(false);
28
+ const wasAtPageBottomRef = useRef(false);
17
29
  const resetPulledPastTimeoutRef = useRef(null);
18
30
  const closedTabRef = useRef(null);
19
- const sentinelRef = useRef(null);
20
- const prevYRef = useRef(Number.POSITIVE_INFINITY);
21
- // Opens drawer when scrolling down
22
31
  useEffect(() => {
23
- const sentinel = sentinelRef.current;
24
- if (!sentinel)
32
+ openDrawerRef.current = isDrawerOpened;
33
+ }, [isDrawerOpened]);
34
+ useEffect(() => {
35
+ isOpeningGestureRef.current = isOpeningGesture;
36
+ }, [isOpeningGesture]);
37
+ // reopens the drawer when user scrolls up and the drawer was closed by scrolling down to the bottom of the page
38
+ useEffect(() => {
39
+ if (typeof window === 'undefined') {
25
40
  return;
26
- const observer = new IntersectionObserver((entries) => {
27
- entries.forEach((entry) => {
28
- if (totalPrice <= 0)
29
- return;
30
- const currentY = entry.boundingClientRect.y;
31
- const isScrollingDown = currentY < prevYRef.current;
32
- if (entry.isIntersecting && isScrollingDown) {
33
- openDrawerHandler();
34
- }
35
- prevYRef.current = currentY;
36
- });
37
- }, {
38
- threshold: 0,
39
- rootMargin: '0px 0px 0px 0px',
40
- });
41
- observer.observe(sentinel);
41
+ }
42
+ const atBottomThreshold = 8;
43
+ lastScrollYRef.current = window.scrollY;
44
+ isScrollingDownRef.current = false;
45
+ wasAtPageBottomRef.current =
46
+ window.innerHeight + window.scrollY >=
47
+ document.documentElement.scrollHeight - atBottomThreshold;
48
+ const handleScroll = () => {
49
+ const currentY = window.scrollY;
50
+ const isScrollingUp = currentY < lastScrollYRef.current;
51
+ const isScrollingDown = currentY > lastScrollYRef.current;
52
+ const isAtPageBottom = window.innerHeight + currentY >= document.documentElement.scrollHeight - atBottomThreshold;
53
+ isScrollingDownRef.current = isScrollingDown;
54
+ if (isScrollingUp &&
55
+ wasAtPageBottomRef.current &&
56
+ shouldReopenOnScrollUpRef.current &&
57
+ !openDrawerRef.current) {
58
+ shouldReopenOnScrollUpRef.current = false;
59
+ setIsDrawerHidden(false);
60
+ openDrawerHandler();
61
+ }
62
+ wasAtPageBottomRef.current = isAtPageBottom;
63
+ lastScrollYRef.current = currentY;
64
+ };
65
+ window.addEventListener('scroll', handleScroll, { passive: true });
42
66
  return () => {
43
- observer.unobserve(sentinel);
67
+ window.removeEventListener('scroll', handleScroll);
44
68
  };
45
- }, [totalPrice]);
46
- useEffect(() => {
47
- openDrawerRef.current = openDrawer;
48
- }, [openDrawer]);
69
+ }, []);
49
70
  useEffect(() => {
50
71
  const closedTab = closedTabRef.current;
51
72
  if (!closedTab)
@@ -63,57 +84,115 @@ const PaymentOverviewDrawer = ({ event, totalPrice, onOpenChange }) => {
63
84
  };
64
85
  }, []);
65
86
  useEffect(() => () => {
66
- if (resetPulledPastTimeoutRef.current !== null) {
67
- window.clearTimeout(resetPulledPastTimeoutRef.current);
68
- }
87
+ clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
69
88
  }, []);
70
- const toggleDrawer = () => {
71
- setOpenDrawer((prev) => {
72
- const next = !prev;
73
- onOpenChange?.(next);
74
- return next;
89
+ useEffect(() => {
90
+ const termsAndConditionsElement = termsAndConditionsRef?.current;
91
+ if (!termsAndConditionsElement) {
92
+ return;
93
+ }
94
+ if (!('IntersectionObserver' in window)) {
95
+ return;
96
+ }
97
+ const observer = new IntersectionObserver((entries) => {
98
+ const entry = entries[0];
99
+ const hasReachedTermsSection = entry?.isIntersecting ?? false;
100
+ const shouldAutoCloseDrawer = hasReachedTermsSection;
101
+ const shouldHideDrawerTab = hasReachedTermsSection && !openDrawerRef.current && !isOpeningGestureRef.current;
102
+ setIsDrawerHidden(shouldHideDrawerTab);
103
+ if (shouldAutoCloseDrawer && openDrawerRef.current && isScrollingDownRef.current) {
104
+ closeDrawerHandler({ shouldReopenOnScrollUp: true });
105
+ setIsDrawerHidden(true);
106
+ }
107
+ }, {
108
+ root: null,
109
+ threshold: 0,
110
+ rootMargin: '0px 0px -40% 0px',
75
111
  });
112
+ observer.observe(termsAndConditionsElement);
113
+ return () => {
114
+ observer.disconnect();
115
+ };
116
+ }, [termsAndConditionsRef]);
117
+ const toggleDrawer = () => {
118
+ if (openDrawerRef.current) {
119
+ closeDrawerHandler();
120
+ return;
121
+ }
122
+ openDrawerHandler();
76
123
  };
77
124
  const openDrawerHandler = () => {
78
- if (resetPulledPastTimeoutRef.current !== null) {
79
- window.clearTimeout(resetPulledPastTimeoutRef.current);
80
- resetPulledPastTimeoutRef.current = null;
81
- }
125
+ clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
82
126
  setIsOpeningGesture(false);
83
127
  setHasPulledPastClosedTabHeight(false);
84
128
  openingTouchStartYRef.current = null;
85
- setOpenDrawer(true);
129
+ shouldReopenOnScrollUpRef.current = false;
130
+ setIsDrawerOpened(true);
86
131
  onOpenChange?.(true);
87
132
  };
88
- const closeDrawerHandler = () => {
89
- if (resetPulledPastTimeoutRef.current !== null) {
90
- window.clearTimeout(resetPulledPastTimeoutRef.current);
91
- resetPulledPastTimeoutRef.current = null;
92
- }
133
+ const closeDrawerHandler = ({ shouldReopenOnScrollUp = false, } = {}) => {
134
+ clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
93
135
  setIsOpeningGesture(false);
94
136
  setHasPulledPastClosedTabHeight(false);
95
137
  openingTouchStartYRef.current = null;
96
- setOpenDrawer(false);
138
+ shouldReopenOnScrollUpRef.current = shouldReopenOnScrollUp;
139
+ setIsDrawerOpened(false);
97
140
  onOpenChange?.(false);
98
141
  };
142
+ const scheduleResetPulledPastTimeout = () => {
143
+ clearResetPulledPastTimeout(resetPulledPastTimeoutRef);
144
+ resetPulledPastTimeoutRef.current = window.setTimeout(() => {
145
+ if (!openDrawerRef.current) {
146
+ setHasPulledPastClosedTabHeight(false);
147
+ }
148
+ }, 180);
149
+ };
150
+ const handleGestureStart = (startY) => {
151
+ openingTouchStartYRef.current = startY;
152
+ setIsOpeningGesture(true);
153
+ setHasPulledPastClosedTabHeight(false);
154
+ };
155
+ const handleGestureMove = (currentY) => {
156
+ if (!isOpeningGestureRef.current)
157
+ return;
158
+ const startY = openingTouchStartYRef.current;
159
+ if (startY === null || typeof currentY !== 'number')
160
+ return;
161
+ const pullDistance = startY - currentY;
162
+ const currentClosedTabHeight = closedTabRef.current?.offsetHeight ?? 0;
163
+ setHasPulledPastClosedTabHeight(currentClosedTabHeight > 0 && pullDistance >= currentClosedTabHeight);
164
+ };
165
+ const handleGestureCancel = () => {
166
+ openingTouchStartYRef.current = null;
167
+ setIsOpeningGesture(false);
168
+ setHasPulledPastClosedTabHeight(false);
169
+ };
170
+ const handleGestureEnd = ({ shouldResetTouchStart = false, } = {}) => {
171
+ if (shouldResetTouchStart) {
172
+ openingTouchStartYRef.current = null;
173
+ }
174
+ if (!isDrawerOpened) {
175
+ setIsOpeningGesture(false);
176
+ scheduleResetPulledPastTimeout();
177
+ }
178
+ };
99
179
  return (React.createElement(Box, { sx: { display: { md: 'none' } } },
100
- React.createElement(Box, { ref: sentinelRef, sx: { height: 1, visibility: 'hidden' } }),
101
180
  React.createElement(Box, { ref: closedTabRef, sx: {
102
181
  position: 'fixed',
103
182
  bottom: 0,
104
183
  left: 0,
105
184
  right: 0,
106
185
  backgroundColor: (theme) => theme.palette.background.paper,
107
- borderTopLeftRadius: 16,
108
- borderTopRightRadius: 16,
109
- boxShadow: '0 -8px 10px 2px rgba(0,0,0,0.2)',
110
- zIndex: 1300,
111
- opacity: openDrawer || hasPulledPastClosedTabHeight ? 0 : 1,
112
- transform: openDrawer ? 'translateY(8px)' : 'translateY(0)',
113
- transition: 'opacity 180ms ease, transform 180ms ease',
186
+ borderTopLeftRadius: isOpeningGesture || isDrawerOpened ? 0 : 16,
187
+ borderTopRightRadius: isOpeningGesture || isDrawerOpened ? 0 : 16,
188
+ boxShadow: isOpeningGesture || isDrawerOpened ? 'none' : '0 -8px 10px 2px rgba(0,0,0,0.2)',
189
+ zIndex: (theme) => theme.zIndex.drawer + 1,
190
+ opacity: isDrawerHidden ? 0 : 1,
191
+ transform: isDrawerHidden ? 'translateY(calc(100% + 12px))' : 'translateY(0)',
192
+ transition: 'opacity 180ms ease, transform 180ms ease, border-radius 120ms ease, box-shadow 120ms ease',
114
193
  pointerEvents: 'none',
115
194
  } },
116
- React.createElement(Box, { sx: {
195
+ !isDrawerOpened && (React.createElement(Box, { sx: {
117
196
  display: 'flex',
118
197
  justifyContent: 'center',
119
198
  alignItems: 'center',
@@ -125,12 +204,24 @@ const PaymentOverviewDrawer = ({ event, totalPrice, onOpenChange }) => {
125
204
  height: 6,
126
205
  backgroundColor: (theme) => theme.palette.grey[300],
127
206
  borderRadius: 3,
128
- } })),
129
- React.createElement(Box, { role: "button", "aria-label": t('form.labels.payment_overview_open'), onClick: toggleDrawer, sx: {
207
+ opacity: isOpeningGesture ? 0 : 1,
208
+ transition: 'opacity 120ms ease',
209
+ } }))),
210
+ React.createElement(Box, { role: "button", "aria-label": t('form.labels.payment_overview_open'), onClick: toggleDrawer, onTouchStart: (event) => {
211
+ handleGestureStart(event.touches[0]?.clientY ?? null);
212
+ }, onMouseDown: () => {
213
+ handleGestureStart(null);
214
+ }, onTouchMove: (event) => {
215
+ handleGestureMove(event.touches[0]?.clientY);
216
+ }, onTouchCancel: handleGestureCancel, onTouchEnd: () => {
217
+ handleGestureEnd({ shouldResetTouchStart: true });
218
+ }, onMouseUp: () => {
219
+ handleGestureEnd();
220
+ }, sx: {
130
221
  width: '100%',
131
222
  px: 2,
132
223
  pb: 2,
133
- pointerEvents: openDrawer ? 'none' : 'auto',
224
+ pointerEvents: isDrawerOpened || isDrawerHidden ? 'none' : 'auto',
134
225
  cursor: 'pointer',
135
226
  } },
136
227
  React.createElement(Typography, { sx: {
@@ -146,66 +237,42 @@ const PaymentOverviewDrawer = ({ event, totalPrice, onOpenChange }) => {
146
237
  React.createElement(Button, { type: "submit", form: EVENTLOOK_ORDER_FORM_ID, onClick: (event) => {
147
238
  event.stopPropagation();
148
239
  }, variant: "contained", size: "large", fullWidth: true, sx: { mt: 1, height: { xs: 36, md: 40 } } }, t('buy')))),
149
- React.createElement(SwipeableDrawer, { anchor: "bottom", open: openDrawer, onClose: closeDrawerHandler, onOpen: openDrawerHandler, swipeAreaWidth: swipeAreaWidth, allowSwipeInChildren: true, disableSwipeToOpen: false, keepMounted: true, SwipeAreaProps: {
240
+ React.createElement(SwipeableDrawer, { anchor: "bottom", open: isDrawerOpened, onClose: () => closeDrawerHandler(), onOpen: () => openDrawerHandler(), swipeAreaWidth: swipeAreaWidth, allowSwipeInChildren: true, disableSwipeToOpen: isDrawerHidden, keepMounted: true, SwipeAreaProps: {
150
241
  onTouchStart: (event) => {
151
- openingTouchStartYRef.current = event.touches[0]?.clientY ?? null;
152
- setIsOpeningGesture(true);
153
- setHasPulledPastClosedTabHeight(false);
242
+ handleGestureStart(event.touches[0]?.clientY ?? null);
154
243
  },
155
244
  onMouseDown: () => {
156
- setIsOpeningGesture(true);
157
- setHasPulledPastClosedTabHeight(false);
245
+ handleGestureStart(null);
158
246
  },
159
247
  onTouchMove: (event) => {
160
- if (!isOpeningGesture)
161
- return;
162
- const startY = openingTouchStartYRef.current;
163
- const currentY = event.touches[0]?.clientY;
164
- if (startY === null || typeof currentY !== 'number')
165
- return;
166
- const pullDistance = startY - currentY;
167
- const closedTabHeight = closedTabRef.current?.offsetHeight ?? 0;
168
- setHasPulledPastClosedTabHeight(closedTabHeight > 0 && pullDistance >= closedTabHeight);
169
- },
170
- onTouchCancel: () => {
171
- openingTouchStartYRef.current = null;
172
- setIsOpeningGesture(false);
173
- setHasPulledPastClosedTabHeight(false);
248
+ handleGestureMove(event.touches[0]?.clientY);
174
249
  },
250
+ onTouchCancel: handleGestureCancel,
175
251
  onTouchEnd: () => {
176
- openingTouchStartYRef.current = null;
177
- if (!openDrawer) {
178
- setIsOpeningGesture(false);
179
- if (resetPulledPastTimeoutRef.current !== null) {
180
- window.clearTimeout(resetPulledPastTimeoutRef.current);
181
- }
182
- resetPulledPastTimeoutRef.current = window.setTimeout(() => {
183
- if (!openDrawerRef.current) {
184
- setHasPulledPastClosedTabHeight(false);
185
- }
186
- }, 180);
187
- }
252
+ handleGestureEnd({ shouldResetTouchStart: true });
188
253
  },
189
254
  onMouseUp: () => {
190
- if (!openDrawer) {
191
- setIsOpeningGesture(false);
192
- if (resetPulledPastTimeoutRef.current !== null) {
193
- window.clearTimeout(resetPulledPastTimeoutRef.current);
194
- }
195
- resetPulledPastTimeoutRef.current = window.setTimeout(() => {
196
- if (!openDrawerRef.current) {
197
- setHasPulledPastClosedTabHeight(false);
198
- }
199
- }, 180);
200
- }
255
+ handleGestureEnd();
256
+ },
257
+ }, sx: {
258
+ display: { md: 'none' },
259
+ pointerEvents: isDrawerOpened ? 'none' : 'auto',
260
+ '& .MuiDrawer-paper': {
261
+ pointerEvents: 'auto',
201
262
  },
202
- }, sx: { display: { md: 'none' } }, ModalProps: {
263
+ '& .MuiSwipeArea-root': {
264
+ pointerEvents: 'auto',
265
+ },
266
+ }, ModalProps: {
203
267
  disableScrollLock: true,
204
268
  keepMounted: false,
269
+ disableAutoFocus: true,
270
+ disableRestoreFocus: true,
271
+ disableEnforceFocus: true,
205
272
  BackdropProps: {
206
- sx: { background: 'linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%)' },
207
- onClick: (event) => {
208
- event.stopPropagation();
273
+ sx: {
274
+ background: 'none',
275
+ pointerEvents: 'none',
209
276
  },
210
277
  },
211
278
  }, PaperProps: {
@@ -214,10 +281,11 @@ const PaymentOverviewDrawer = ({ event, totalPrice, onOpenChange }) => {
214
281
  borderTopRightRadius: 16,
215
282
  boxShadow: '0 -8px 10px 2px rgba(0,0,0,0.2)',
216
283
  overflow: 'hidden',
217
- mb: !openDrawer && (isOpeningGesture || hasPulledPastClosedTabHeight)
284
+ mb: isDrawerOpened ||
285
+ (!isDrawerOpened && (isOpeningGesture || hasPulledPastClosedTabHeight))
218
286
  ? `${closedTabHeight}px`
219
287
  : 0,
220
- transition: 'margin-bottom 120ms ease',
288
+ transition: 'none',
221
289
  },
222
290
  } },
223
291
  React.createElement(Box, { role: "button", "aria-label": t('form.labels.payment_overview_close'), onClick: toggleDrawer, sx: {
@@ -238,7 +306,7 @@ const PaymentOverviewDrawer = ({ event, totalPrice, onOpenChange }) => {
238
306
  height: '100%',
239
307
  overflow: 'auto',
240
308
  } },
241
- React.createElement(PaymentOverviewBox, { event: event })))));
309
+ React.createElement(PaymentOverviewBox, { event: event, hideBuyButton: true })))));
242
310
  };
243
311
 
244
312
  export { PaymentOverviewDrawer as default };
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentOverviewDrawer.js","sources":["../../../src/form/PaymentOverviewDrawer.tsx"],"sourcesContent":["import { Box, Button, SwipeableDrawer, Typography } from '@mui/material';\nimport React, { useEffect } from 'react';\nimport { useRef, useState } from 'react';\nimport PaymentOverviewBox from './PaymentOverviewBox';\nimport { IEvent } from '@utils/types/event.type';\nimport useGlobal from '@hooks/useGlobal';\nimport { fCurrency } from '@utils/formatNumber';\nimport { EVENTLOOK_ORDER_FORM_ID } from '@utils/data/global.ts';\n\ninterface Props {\n event: IEvent;\n totalPrice: number;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst swipeAreaWidth = 120;\n\nconst PaymentOverviewDrawer: React.FC<Props> = ({ event, totalPrice, onOpenChange }) => {\n const { t, lang } = useGlobal();\n const [openDrawer, setOpenDrawer] = useState(false);\n const [isOpeningGesture, setIsOpeningGesture] = useState(false);\n const [hasPulledPastClosedTabHeight, setHasPulledPastClosedTabHeight] = useState(false);\n const [closedTabHeight, setClosedTabHeight] = useState(0);\n const openingTouchStartYRef = useRef<number | null>(null);\n const openDrawerRef = useRef(false);\n const resetPulledPastTimeoutRef = useRef<number | null>(null);\n const closedTabRef = useRef<HTMLDivElement>(null);\n\n const sentinelRef = useRef<HTMLDivElement>(null);\n const prevYRef = useRef<number>(Number.POSITIVE_INFINITY);\n\n // Opens drawer when scrolling down\n useEffect(() => {\n const sentinel = sentinelRef.current;\n if (!sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (totalPrice <= 0) return;\n const currentY = entry.boundingClientRect.y;\n const isScrollingDown = currentY < prevYRef.current;\n\n if (entry.isIntersecting && isScrollingDown) {\n openDrawerHandler();\n }\n\n prevYRef.current = currentY;\n });\n },\n {\n threshold: 0,\n rootMargin: '0px 0px 0px 0px',\n }\n );\n\n observer.observe(sentinel);\n\n return () => {\n observer.unobserve(sentinel);\n };\n }, [totalPrice]);\n\n useEffect(() => {\n openDrawerRef.current = openDrawer;\n }, [openDrawer]);\n\n useEffect(() => {\n const closedTab = closedTabRef.current;\n if (!closedTab) return;\n\n const updateClosedTabHeight = () => {\n setClosedTabHeight(closedTab.offsetHeight);\n };\n\n updateClosedTabHeight();\n\n const resizeObserver = new ResizeObserver(() => {\n updateClosedTabHeight();\n });\n\n resizeObserver.observe(closedTab);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n useEffect(\n () => () => {\n if (resetPulledPastTimeoutRef.current !== null) {\n window.clearTimeout(resetPulledPastTimeoutRef.current);\n }\n },\n []\n );\n\n const toggleDrawer = () => {\n setOpenDrawer((prev) => {\n const next = !prev;\n onOpenChange?.(next);\n return next;\n });\n };\n\n const openDrawerHandler = () => {\n if (resetPulledPastTimeoutRef.current !== null) {\n window.clearTimeout(resetPulledPastTimeoutRef.current);\n resetPulledPastTimeoutRef.current = null;\n }\n setIsOpeningGesture(false);\n setHasPulledPastClosedTabHeight(false);\n openingTouchStartYRef.current = null;\n setOpenDrawer(true);\n onOpenChange?.(true);\n };\n\n const closeDrawerHandler = () => {\n if (resetPulledPastTimeoutRef.current !== null) {\n window.clearTimeout(resetPulledPastTimeoutRef.current);\n resetPulledPastTimeoutRef.current = null;\n }\n setIsOpeningGesture(false);\n setHasPulledPastClosedTabHeight(false);\n openingTouchStartYRef.current = null;\n setOpenDrawer(false);\n onOpenChange?.(false);\n };\n\n return (\n <Box sx={{ display: { md: 'none' } }}>\n {/* Sentinel element for intersection observer */}\n <Box ref={sentinelRef} sx={{ height: 1, visibility: 'hidden' }} />\n\n {/* Drawer Tab */}\n <Box\n ref={closedTabRef}\n sx={{\n position: 'fixed',\n bottom: 0,\n left: 0,\n right: 0,\n backgroundColor: (theme) => theme.palette.background.paper,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n boxShadow: '0 -8px 10px 2px rgba(0,0,0,0.2)',\n zIndex: 1300,\n opacity: openDrawer || hasPulledPastClosedTabHeight ? 0 : 1,\n transform: openDrawer ? 'translateY(8px)' : 'translateY(0)',\n transition: 'opacity 180ms ease, transform 180ms ease',\n pointerEvents: 'none',\n }}\n >\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: '100%',\n py: 1,\n }}\n >\n <Box\n sx={{\n width: 80,\n height: 6,\n backgroundColor: (theme) => theme.palette.grey[300],\n borderRadius: 3,\n }}\n />\n </Box>\n <Box\n role=\"button\"\n aria-label={t('form.labels.payment_overview_open')}\n onClick={toggleDrawer}\n sx={{\n width: '100%',\n px: 2,\n pb: 2,\n pointerEvents: openDrawer ? 'none' : 'auto',\n cursor: 'pointer',\n }}\n >\n <Typography\n sx={{\n fontWeight: 'bold',\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n }}\n >\n <span>{t('form.labels.total')}:</span>\n <span>{fCurrency(totalPrice, lang, event.currency)}</span>\n </Typography>\n\n <Button\n type=\"submit\"\n form={EVENTLOOK_ORDER_FORM_ID}\n onClick={(event) => {\n event.stopPropagation();\n }}\n variant=\"contained\"\n size=\"large\"\n fullWidth\n sx={{ mt: 1, height: { xs: 36, md: 40 } }}\n >\n {t('buy')}\n </Button>\n </Box>\n </Box>\n\n {/* Drawer Content */}\n <SwipeableDrawer\n anchor=\"bottom\"\n open={openDrawer}\n onClose={closeDrawerHandler}\n onOpen={openDrawerHandler}\n swipeAreaWidth={swipeAreaWidth}\n allowSwipeInChildren\n disableSwipeToOpen={false}\n keepMounted\n SwipeAreaProps={{\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => {\n openingTouchStartYRef.current = event.touches[0]?.clientY ?? null;\n setIsOpeningGesture(true);\n setHasPulledPastClosedTabHeight(false);\n },\n onMouseDown: () => {\n setIsOpeningGesture(true);\n setHasPulledPastClosedTabHeight(false);\n },\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => {\n if (!isOpeningGesture) return;\n\n const startY = openingTouchStartYRef.current;\n const currentY = event.touches[0]?.clientY;\n if (startY === null || typeof currentY !== 'number') return;\n\n const pullDistance = startY - currentY;\n const closedTabHeight = closedTabRef.current?.offsetHeight ?? 0;\n setHasPulledPastClosedTabHeight(closedTabHeight > 0 && pullDistance >= closedTabHeight);\n },\n onTouchCancel: () => {\n openingTouchStartYRef.current = null;\n setIsOpeningGesture(false);\n setHasPulledPastClosedTabHeight(false);\n },\n onTouchEnd: () => {\n openingTouchStartYRef.current = null;\n if (!openDrawer) {\n setIsOpeningGesture(false);\n if (resetPulledPastTimeoutRef.current !== null) {\n window.clearTimeout(resetPulledPastTimeoutRef.current);\n }\n resetPulledPastTimeoutRef.current = window.setTimeout(() => {\n if (!openDrawerRef.current) {\n setHasPulledPastClosedTabHeight(false);\n }\n }, 180);\n }\n },\n onMouseUp: () => {\n if (!openDrawer) {\n setIsOpeningGesture(false);\n if (resetPulledPastTimeoutRef.current !== null) {\n window.clearTimeout(resetPulledPastTimeoutRef.current);\n }\n resetPulledPastTimeoutRef.current = window.setTimeout(() => {\n if (!openDrawerRef.current) {\n setHasPulledPastClosedTabHeight(false);\n }\n }, 180);\n }\n },\n }}\n sx={{ display: { md: 'none' } }}\n ModalProps={{\n disableScrollLock: true,\n keepMounted: false,\n BackdropProps: {\n sx: { background: 'linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%)' },\n onClick: (event: React.MouseEvent<HTMLDivElement>) => {\n event.stopPropagation();\n },\n },\n }}\n PaperProps={{\n sx: {\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n boxShadow: '0 -8px 10px 2px rgba(0,0,0,0.2)',\n overflow: 'hidden',\n mb:\n !openDrawer && (isOpeningGesture || hasPulledPastClosedTabHeight)\n ? `${closedTabHeight}px`\n : 0,\n transition: 'margin-bottom 120ms ease',\n },\n }}\n >\n <Box\n role=\"button\"\n aria-label={t('form.labels.payment_overview_close')}\n onClick={toggleDrawer}\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: (theme) => theme.palette.background.paper,\n cursor: 'pointer',\n py: 1,\n }}\n >\n <Box\n sx={{\n width: 80,\n height: 6,\n backgroundColor: (theme) => theme.palette.grey[300],\n borderRadius: 3,\n }}\n />\n </Box>\n <Box\n sx={{\n height: '100%',\n overflow: 'auto',\n }}\n >\n <PaymentOverviewBox event={event} />\n </Box>\n </SwipeableDrawer>\n </Box>\n );\n};\n\nexport default PaymentOverviewDrawer;\n"],"names":[],"mappings":";;;;;;;AAeA,MAAM,cAAc,GAAG,GAAG;AAE1B,MAAM,qBAAqB,GAAoB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,KAAI;IACrF,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE;IAC/B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACnD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC/D,MAAM,CAAC,4BAA4B,EAAE,+BAA+B,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACvF,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;AACzD,IAAA,MAAM,qBAAqB,GAAG,MAAM,CAAgB,IAAI,CAAC;AACzD,IAAA,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;AACnC,IAAA,MAAM,yBAAyB,GAAG,MAAM,CAAgB,IAAI,CAAC;AAC7D,IAAA,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC;AAEjD,IAAA,MAAM,WAAW,GAAG,MAAM,CAAiB,IAAI,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAS,MAAM,CAAC,iBAAiB,CAAC;;IAGzD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO;AACpC,QAAA,IAAI,CAAC,QAAQ;YAAE;QAEf,MAAM,QAAQ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AA,CAAA,aAAA,CAAC,kBAAkB,EAAA,EAAC,KAAK,EAAE,KAAK,GAAI,CAChC,CACU,CACd;AAEV;;;;"}
1
+ {"version":3,"file":"PaymentOverviewDrawer.js","sources":["../../../src/form/PaymentOverviewDrawer.tsx"],"sourcesContent":["import { Box, Button, SwipeableDrawer, Typography } from '@mui/material';\nimport React, { useEffect } from 'react';\nimport { useRef, useState } from 'react';\nimport PaymentOverviewBox from './PaymentOverviewBox';\nimport { IEvent } from '@utils/types/event.type';\nimport useGlobal from '@hooks/useGlobal';\nimport { fCurrency } from '@utils/formatNumber';\nimport { EVENTLOOK_ORDER_FORM_ID } from '@utils/data/global.ts';\n\ninterface Props {\n event: IEvent;\n totalPrice: number;\n termsAndConditionsRef?: React.RefObject<HTMLElement | null>;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst swipeAreaWidth = 120;\n\nconst clearResetPulledPastTimeout = (timeoutRef: { current: number | null }) => {\n if (timeoutRef.current !== null) {\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n};\n\nconst PaymentOverviewDrawer: React.FC<Props> = ({\n event,\n totalPrice,\n termsAndConditionsRef,\n onOpenChange,\n}) => {\n const { t, lang } = useGlobal();\n const [isDrawerOpened, setIsDrawerOpened] = useState(false);\n const [isOpeningGesture, setIsOpeningGesture] = useState(false);\n const [hasPulledPastClosedTabHeight, setHasPulledPastClosedTabHeight] = useState(false);\n const [isDrawerHidden, setIsDrawerHidden] = useState(false);\n const [closedTabHeight, setClosedTabHeight] = useState(0);\n const openingTouchStartYRef = useRef<number | null>(null);\n const openDrawerRef = useRef(false);\n const isOpeningGestureRef = useRef(false);\n const shouldReopenOnScrollUpRef = useRef(false);\n const lastScrollYRef = useRef(0);\n const isScrollingDownRef = useRef(false);\n const wasAtPageBottomRef = useRef(false);\n const resetPulledPastTimeoutRef = useRef<number | null>(null);\n const closedTabRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n openDrawerRef.current = isDrawerOpened;\n }, [isDrawerOpened]);\n\n useEffect(() => {\n isOpeningGestureRef.current = isOpeningGesture;\n }, [isOpeningGesture]);\n\n // reopens the drawer when user scrolls up and the drawer was closed by scrolling down to the bottom of the page\n useEffect(() => {\n if (typeof window === 'undefined') {\n return;\n }\n\n const atBottomThreshold = 8;\n lastScrollYRef.current = window.scrollY;\n isScrollingDownRef.current = false;\n wasAtPageBottomRef.current =\n window.innerHeight + window.scrollY >=\n document.documentElement.scrollHeight - atBottomThreshold;\n\n const handleScroll = () => {\n const currentY = window.scrollY;\n const isScrollingUp = currentY < lastScrollYRef.current;\n const isScrollingDown = currentY > lastScrollYRef.current;\n const isAtPageBottom =\n window.innerHeight + currentY >= document.documentElement.scrollHeight - atBottomThreshold;\n\n isScrollingDownRef.current = isScrollingDown;\n\n if (\n isScrollingUp &&\n wasAtPageBottomRef.current &&\n shouldReopenOnScrollUpRef.current &&\n !openDrawerRef.current\n ) {\n shouldReopenOnScrollUpRef.current = false;\n setIsDrawerHidden(false);\n openDrawerHandler();\n }\n\n wasAtPageBottomRef.current = isAtPageBottom;\n lastScrollYRef.current = currentY;\n };\n\n window.addEventListener('scroll', handleScroll, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', handleScroll);\n };\n }, []);\n\n useEffect(() => {\n const closedTab = closedTabRef.current;\n if (!closedTab) return;\n\n const updateClosedTabHeight = () => {\n setClosedTabHeight(closedTab.offsetHeight);\n };\n\n updateClosedTabHeight();\n\n const resizeObserver = new ResizeObserver(() => {\n updateClosedTabHeight();\n });\n\n resizeObserver.observe(closedTab);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n useEffect(\n () => () => {\n clearResetPulledPastTimeout(resetPulledPastTimeoutRef);\n },\n []\n );\n\n useEffect(() => {\n const termsAndConditionsElement = termsAndConditionsRef?.current;\n if (!termsAndConditionsElement) {\n return;\n }\n\n if (!('IntersectionObserver' in window)) {\n return;\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n const entry = entries[0];\n const hasReachedTermsSection = entry?.isIntersecting ?? false;\n const shouldAutoCloseDrawer = hasReachedTermsSection;\n const shouldHideDrawerTab =\n hasReachedTermsSection && !openDrawerRef.current && !isOpeningGestureRef.current;\n setIsDrawerHidden(shouldHideDrawerTab);\n\n if (shouldAutoCloseDrawer && openDrawerRef.current && isScrollingDownRef.current) {\n closeDrawerHandler({ shouldReopenOnScrollUp: true });\n setIsDrawerHidden(true);\n }\n },\n {\n root: null,\n threshold: 0,\n rootMargin: '0px 0px -40% 0px',\n }\n );\n\n observer.observe(termsAndConditionsElement);\n\n return () => {\n observer.disconnect();\n };\n }, [termsAndConditionsRef]);\n\n const toggleDrawer = () => {\n if (openDrawerRef.current) {\n closeDrawerHandler();\n return;\n }\n\n openDrawerHandler();\n };\n\n const openDrawerHandler = () => {\n clearResetPulledPastTimeout(resetPulledPastTimeoutRef);\n setIsOpeningGesture(false);\n setHasPulledPastClosedTabHeight(false);\n openingTouchStartYRef.current = null;\n shouldReopenOnScrollUpRef.current = false;\n setIsDrawerOpened(true);\n onOpenChange?.(true);\n };\n\n const closeDrawerHandler = ({\n shouldReopenOnScrollUp = false,\n }: { shouldReopenOnScrollUp?: boolean } = {}) => {\n clearResetPulledPastTimeout(resetPulledPastTimeoutRef);\n setIsOpeningGesture(false);\n setHasPulledPastClosedTabHeight(false);\n openingTouchStartYRef.current = null;\n shouldReopenOnScrollUpRef.current = shouldReopenOnScrollUp;\n setIsDrawerOpened(false);\n onOpenChange?.(false);\n };\n\n const scheduleResetPulledPastTimeout = () => {\n clearResetPulledPastTimeout(resetPulledPastTimeoutRef);\n resetPulledPastTimeoutRef.current = window.setTimeout(() => {\n if (!openDrawerRef.current) {\n setHasPulledPastClosedTabHeight(false);\n }\n }, 180);\n };\n\n const handleGestureStart = (startY: number | null) => {\n openingTouchStartYRef.current = startY;\n setIsOpeningGesture(true);\n setHasPulledPastClosedTabHeight(false);\n };\n\n const handleGestureMove = (currentY?: number) => {\n if (!isOpeningGestureRef.current) return;\n\n const startY = openingTouchStartYRef.current;\n if (startY === null || typeof currentY !== 'number') return;\n\n const pullDistance = startY - currentY;\n const currentClosedTabHeight = closedTabRef.current?.offsetHeight ?? 0;\n setHasPulledPastClosedTabHeight(\n currentClosedTabHeight > 0 && pullDistance >= currentClosedTabHeight\n );\n };\n\n const handleGestureCancel = () => {\n openingTouchStartYRef.current = null;\n setIsOpeningGesture(false);\n setHasPulledPastClosedTabHeight(false);\n };\n\n const handleGestureEnd = ({\n shouldResetTouchStart = false,\n }: { shouldResetTouchStart?: boolean } = {}) => {\n if (shouldResetTouchStart) {\n openingTouchStartYRef.current = null;\n }\n\n if (!isDrawerOpened) {\n setIsOpeningGesture(false);\n scheduleResetPulledPastTimeout();\n }\n };\n\n return (\n <Box sx={{ display: { md: 'none' } }}>\n {/* Drawer Tab */}\n <Box\n ref={closedTabRef}\n sx={{\n position: 'fixed',\n bottom: 0,\n left: 0,\n right: 0,\n backgroundColor: (theme) => theme.palette.background.paper,\n borderTopLeftRadius: isOpeningGesture || isDrawerOpened ? 0 : 16,\n borderTopRightRadius: isOpeningGesture || isDrawerOpened ? 0 : 16,\n boxShadow:\n isOpeningGesture || isDrawerOpened ? 'none' : '0 -8px 10px 2px rgba(0,0,0,0.2)',\n zIndex: (theme) => theme.zIndex.drawer + 1,\n opacity: isDrawerHidden ? 0 : 1,\n transform: isDrawerHidden ? 'translateY(calc(100% + 12px))' : 'translateY(0)',\n transition:\n 'opacity 180ms ease, transform 180ms ease, border-radius 120ms ease, box-shadow 120ms ease',\n pointerEvents: 'none',\n }}\n >\n {!isDrawerOpened && (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: '100%',\n py: 1,\n }}\n >\n <Box\n sx={{\n width: 80,\n height: 6,\n backgroundColor: (theme) => theme.palette.grey[300],\n borderRadius: 3,\n opacity: isOpeningGesture ? 0 : 1,\n transition: 'opacity 120ms ease',\n }}\n />\n </Box>\n )}\n <Box\n role=\"button\"\n aria-label={t('form.labels.payment_overview_open')}\n onClick={toggleDrawer}\n onTouchStart={(event: React.TouchEvent<HTMLDivElement>) => {\n handleGestureStart(event.touches[0]?.clientY ?? null);\n }}\n onMouseDown={() => {\n handleGestureStart(null);\n }}\n onTouchMove={(event: React.TouchEvent<HTMLDivElement>) => {\n handleGestureMove(event.touches[0]?.clientY);\n }}\n onTouchCancel={handleGestureCancel}\n onTouchEnd={() => {\n handleGestureEnd({ shouldResetTouchStart: true });\n }}\n onMouseUp={() => {\n handleGestureEnd();\n }}\n sx={{\n width: '100%',\n px: 2,\n pb: 2,\n pointerEvents: isDrawerOpened || isDrawerHidden ? 'none' : 'auto',\n cursor: 'pointer',\n }}\n >\n <Typography\n sx={{\n fontWeight: 'bold',\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n }}\n >\n <span>{t('form.labels.total')}:</span>\n <span>{fCurrency(totalPrice, lang, event.currency)}</span>\n </Typography>\n\n <Button\n type=\"submit\"\n form={EVENTLOOK_ORDER_FORM_ID}\n onClick={(event) => {\n event.stopPropagation();\n }}\n variant=\"contained\"\n size=\"large\"\n fullWidth\n sx={{ mt: 1, height: { xs: 36, md: 40 } }}\n >\n {t('buy')}\n </Button>\n </Box>\n </Box>\n\n {/* Drawer Content */}\n <SwipeableDrawer\n anchor=\"bottom\"\n open={isDrawerOpened}\n onClose={() => closeDrawerHandler()}\n onOpen={() => openDrawerHandler()}\n swipeAreaWidth={swipeAreaWidth}\n allowSwipeInChildren\n disableSwipeToOpen={isDrawerHidden}\n keepMounted\n SwipeAreaProps={{\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => {\n handleGestureStart(event.touches[0]?.clientY ?? null);\n },\n onMouseDown: () => {\n handleGestureStart(null);\n },\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => {\n handleGestureMove(event.touches[0]?.clientY);\n },\n onTouchCancel: handleGestureCancel,\n onTouchEnd: () => {\n handleGestureEnd({ shouldResetTouchStart: true });\n },\n onMouseUp: () => {\n handleGestureEnd();\n },\n }}\n sx={{\n display: { md: 'none' },\n pointerEvents: isDrawerOpened ? 'none' : 'auto',\n '& .MuiDrawer-paper': {\n pointerEvents: 'auto',\n },\n '& .MuiSwipeArea-root': {\n pointerEvents: 'auto',\n },\n }}\n ModalProps={{\n disableScrollLock: true,\n keepMounted: false,\n disableAutoFocus: true,\n disableRestoreFocus: true,\n disableEnforceFocus: true,\n BackdropProps: {\n sx: {\n background: 'none',\n pointerEvents: 'none',\n },\n },\n }}\n PaperProps={{\n sx: {\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n boxShadow: '0 -8px 10px 2px rgba(0,0,0,0.2)',\n overflow: 'hidden',\n mb:\n isDrawerOpened ||\n (!isDrawerOpened && (isOpeningGesture || hasPulledPastClosedTabHeight))\n ? `${closedTabHeight}px`\n : 0,\n transition: 'none',\n },\n }}\n >\n <Box\n role=\"button\"\n aria-label={t('form.labels.payment_overview_close')}\n onClick={toggleDrawer}\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: (theme) => theme.palette.background.paper,\n cursor: 'pointer',\n py: 1,\n }}\n >\n <Box\n sx={{\n width: 80,\n height: 6,\n backgroundColor: (theme) => theme.palette.grey[300],\n borderRadius: 3,\n }}\n />\n </Box>\n <Box\n sx={{\n height: '100%',\n overflow: 'auto',\n }}\n >\n <PaymentOverviewBox event={event} hideBuyButton />\n </Box>\n </SwipeableDrawer>\n </Box>\n );\n};\n\nexport default PaymentOverviewDrawer;\n"],"names":[],"mappings":";;;;;;;AAgBA,MAAM,cAAc,GAAG,GAAG;AAE1B,MAAM,2BAA2B,GAAG,CAAC,UAAsC,KAAI;AAC7E,IAAA,IAAI,UAAU,CAAC,OAAO,KAAK,IAAI,EAAE;AAC/B,QAAA,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC;AACvC,QAAA,UAAU,CAAC,OAAO,GAAG,IAAI;;AAE7B,CAAC;AAED,MAAM,qBAAqB,GAAoB,CAAC,EAC9C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,0BAAE,CAAC;AACP,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;AACF,aAAA,EAAA;AAED,YAAA,KAAA,CAAA,aAAA,CAAC,GAAG,EAAA,EACF,IAAI,EAAC,QAAQ,gBACD,CAAC,CAAC,oCAAoC,CAAC,EACnD,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE;AACF,oBAAA,OAAO,EAAE,MAAM;AACf,oBAAA,cAAc,EAAE,QAAQ;AACxB,oBAAA,UAAU,EAAE,QAAQ;AACpB,oBAAA,eAAe,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK;AAC1D,oBAAA,MAAM,EAAE,SAAS;AACjB,oBAAA,EAAE,EAAE,CAAC;AACN,iBAAA,EAAA;gBAED,KAAA,CAAA,aAAA,CAAC,GAAG,EAAA,EACF,EAAE,EAAE;AACF,wBAAA,KAAK,EAAE,EAAE;AACT,wBAAA,MAAM,EAAE,CAAC;AACT,wBAAA,eAAe,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AACnD,wBAAA,YAAY,EAAE,CAAC;AAChB,qBAAA,EAAA,CACD,CACE;YACN,KAAA,CAAA,aAAA,CAAC,GAAG,EAAA,EACF,EAAE,EAAE;AACF,oBAAA,MAAM,EAAE,MAAM;AACd,oBAAA,QAAQ,EAAE,MAAM;AACjB,iBAAA,EAAA;AAED,gBAAA,KAAA,CAAA,aAAA,CAAC,kBAAkB,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAA,IAAA,EAAA,CAAG,CAC9C,CACU,CACd;AAEV;;;;"}
@@ -2,7 +2,7 @@ import OrderSuccess from './OrderSuccess.js';
2
2
  import PaymentSuccess from './PaymentSuccess.js';
3
3
  import React, { useState, useRef, useEffect, useMemo } from 'react';
4
4
  import { useForm } from 'react-hook-form';
5
- import { Box, Stack, Typography, Grid, Stepper, Step, StepLabel, StepContent, Link } from '@mui/material';
5
+ import { Box, Stack, Typography, Grid, Stepper, Step, StepLabel, StepContent, Divider, Link } from '@mui/material';
6
6
  import { RHFCheckbox } from '../components/hook-form/RHFCheckbox.js';
7
7
  import FormProvider from '../components/hook-form/FormProvider.js';
8
8
  import dayjs from 'dayjs';
@@ -27,7 +27,6 @@ import useErrors from '../hooks/useErrors.js';
27
27
  import { EventType } from '../utils/data/event.js';
28
28
  import TimeslotSelection from './TimeslotSelection.js';
29
29
  import useGlobal from '../hooks/useGlobal.js';
30
- import useConsentScrollOnDrawerOpen from '../hooks/useConsentScrollOnDrawerOpen.js';
31
30
  import useScrollToFirstError from '../hooks/useScrollToFirstError.js';
32
31
  import { Trans } from '../components/Trans.js';
33
32
  import { EVENTLOOK_ORDER_FORM_CONTAINER_ID, EVENTLOOK_ORDER_FORM_ID } from '../utils/data/global.js';
@@ -62,10 +61,6 @@ const TicketForm = ({ event, hasGopayIdSsr, selectedReleaseId, isIframe, isInlin
62
61
  const hasFiredBeginCheckout = useRef(false);
63
62
  const hasFiredPaymentMethod = useRef(false);
64
63
  const termsAndConditionsRef = useRef(null);
65
- useConsentScrollOnDrawerOpen({
66
- isDrawerOpen: isPaymentOverviewDrawerOpen,
67
- consentRef: termsAndConditionsRef,
68
- });
69
64
  const item = {
70
65
  currency: event.currency,
71
66
  items: [
@@ -493,9 +488,11 @@ const TicketForm = ({ event, hasGopayIdSsr, selectedReleaseId, isIframe, isInlin
493
488
  0: React.createElement(CustomLink, { key: 2, href: links.termsAndConditions, target: "_blank" }),
494
489
  1: React.createElement(CustomLink, { key: 1, href: links.gdpr, target: "_blank" }),
495
490
  } }) }))),
496
- React.createElement(Grid, { item: true, xs: 12, md: 4, sx: { display: { xs: 'none', md: 'block' } } },
497
- React.createElement(PaymentOverviewBox, { event: event }))),
498
- React.createElement(PaymentOverviewDrawer, { event: event, totalPrice: values.total, onOpenChange: setIsPaymentOverviewDrawerOpen }),
491
+ React.createElement(Grid, { item: true, xs: 12, sx: { display: { xs: 'block', md: 'none' } } },
492
+ React.createElement(Divider, { sx: { borderStyle: 'dashed' } })),
493
+ React.createElement(Grid, { item: true, xs: 12, md: 4, mt: { xs: 0, md: 0 } },
494
+ React.createElement(PaymentOverviewBox, { event: event, withoutPadding: true }))),
495
+ React.createElement(PaymentOverviewDrawer, { event: event, totalPrice: values.total, termsAndConditionsRef: termsAndConditionsRef, onOpenChange: setIsPaymentOverviewDrawerOpen }),
499
496
  React.createElement(EmailConfirmation, { open: formStep === 2 && !isIframe, onClose: () => setFormStep(1),
500
497
  // @ts-ignore
501
498
  onConfirm: methods.handleSubmit(onSubmit, onInvalid) })))));