@bytebrand/fe-ui-core-autobahn 1.0.173 → 1.0.175
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/cards/CarCard.tsx +47 -10
- package/cards/CarRow.tsx +5 -1
- package/cards/cardParts.tsx +11 -1
- package/compat/CookieModal/CookieModal.tsx +20 -2
- package/compat/CookieModal/Modal.tsx +6 -3
- package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
- package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
- package/compat/CookieModal/useModal.ts +5 -1
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/locales/de/autobahn.json +879 -857
- package/locales/en/autobahn.json +879 -857
- package/locales/legacy/data.ts +2 -1
- package/package.json +30 -30
- package/theme/md3.css +6 -3
- package/ui/Dropdown.tsx +16 -8
- package/ui/index.ts +2 -0
- package/ui/scrollFieldIntoView.ts +41 -0
- package/ui/usePortalMenuPosition.ts +19 -13
- package/utils/cookieConsent.ts +84 -0
- package/utils/index.ts +10 -0
- package/vdp/VdpModules.tsx +3 -3
- package/vdp/types.ts +5 -5
- package/vehiclesProps/accidentDisclosure.ts +25 -0
- package/vehiclesProps/decoratedLightProps.tsx +20 -6
- package/vehiclesProps/decoratedProps.tsx +12 -4
package/cards/CarCard.tsx
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
GalleryActivityPill,
|
|
39
39
|
cardSpec,
|
|
40
40
|
PaymentMode,
|
|
41
|
+
startPaymentMode,
|
|
41
42
|
callDealerSalesPhone,
|
|
42
43
|
DEALER_SALES_PHONE,
|
|
43
44
|
} from './cardParts';
|
|
@@ -98,6 +99,11 @@ export interface CarCardProps {
|
|
|
98
99
|
* (still onOpenRateAdjust).
|
|
99
100
|
*/
|
|
100
101
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
|
|
104
|
+
* open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
|
|
105
|
+
*/
|
|
106
|
+
initialMode?: PaymentMode;
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -113,8 +119,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
113
119
|
onCall,
|
|
114
120
|
onOpenRateAdjust,
|
|
115
121
|
onShowFinancingDetails,
|
|
122
|
+
initialMode,
|
|
116
123
|
}) => {
|
|
117
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
124
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
118
125
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
119
126
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
120
127
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -157,6 +164,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
157
164
|
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
158
165
|
const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
|
|
159
166
|
const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
|
|
167
|
+
// tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
|
|
168
|
+
const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
|
|
160
169
|
return (
|
|
161
170
|
<article
|
|
162
171
|
className="mcard mcard--interactive cc-card"
|
|
@@ -277,18 +286,46 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
277
286
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
278
287
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
279
288
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
280
|
-
|
|
289
|
+
{/* every tab's hero stacked in one grid cell (.cc-hero-stack), only the active one
|
|
290
|
+
visible, bottom-aligned — Kaufen's struck list price sits on its own line above
|
|
291
|
+
the price, so without this the row (and the card) grew/shrank by that line on
|
|
292
|
+
every tab switch. Same trick as .cc-terms-stack below. */}
|
|
293
|
+
<div className="cc-hero-stack">
|
|
294
|
+
{paymentModes.map((m) => (
|
|
295
|
+
<div
|
|
296
|
+
key={m}
|
|
297
|
+
className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
|
|
298
|
+
aria-hidden={m === mode ? undefined : true}
|
|
299
|
+
>
|
|
300
|
+
<PriceHero car={car} mode={m} t={t} alwaysShowUnit />
|
|
301
|
+
</div>
|
|
302
|
+
))}
|
|
303
|
+
</div>
|
|
281
304
|
<PriceEvalCol car={car} t={t} />
|
|
282
305
|
</div>
|
|
283
306
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
284
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
307
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
308
|
+
Every tab's terms line is rendered into the same grid cell (.cc-terms-stack) and
|
|
309
|
+
only the active one is visible — the cell is as tall as the tallest line, so the
|
|
310
|
+
card keeps one height across Finanzierung/Leasing/Kaufen (Leasing's longer line
|
|
311
|
+
wraps to 2 lines on narrow phones). No change to the visible line itself. */}
|
|
312
|
+
<div className="cc-terms-stack">
|
|
313
|
+
{paymentModes.map((m) => (
|
|
314
|
+
<div
|
|
315
|
+
key={m}
|
|
316
|
+
className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
|
|
317
|
+
aria-hidden={m === mode ? undefined : true}
|
|
318
|
+
>
|
|
319
|
+
<PriceTerms
|
|
320
|
+
car={car}
|
|
321
|
+
mode={m}
|
|
322
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
323
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
|
|
324
|
+
t={t}
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
))}
|
|
328
|
+
</div>
|
|
292
329
|
</div>
|
|
293
330
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
294
331
|
rendered, with real fallbacks the page can override once it wires its own
|
package/cards/CarRow.tsx
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
ZeroDownChip,
|
|
42
42
|
fmtKm,
|
|
43
43
|
PaymentMode,
|
|
44
|
+
startPaymentMode,
|
|
44
45
|
ratingTone,
|
|
45
46
|
} from './cardParts';
|
|
46
47
|
import { AutobahnCar } from './types';
|
|
@@ -80,6 +81,8 @@ export interface CarRowProps {
|
|
|
80
81
|
* links render as plain text (see PricePaths' own fallback).
|
|
81
82
|
*/
|
|
82
83
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
84
|
+
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
85
|
+
initialMode?: PaymentMode;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -92,8 +95,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
92
95
|
t,
|
|
93
96
|
adminAction,
|
|
94
97
|
onShowFinancingDetails,
|
|
98
|
+
initialMode,
|
|
95
99
|
}) => {
|
|
96
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
100
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
97
101
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
98
102
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
99
103
|
// always call the LATEST onMediaEnter without re-arming the observer on every render (the
|
package/cards/cardParts.tsx
CHANGED
|
@@ -489,6 +489,11 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
|
|
|
489
489
|
|
|
490
490
|
export type PaymentMode = 'financing' | 'leasing' | 'buy';
|
|
491
491
|
|
|
492
|
+
/** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
|
|
493
|
+
* without a lease rate — PriceTabs has no Leasing tab for it. */
|
|
494
|
+
export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
|
|
495
|
+
requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
|
|
496
|
+
|
|
492
497
|
export interface PriceTabsProps {
|
|
493
498
|
car: AutobahnCar;
|
|
494
499
|
mode: PaymentMode;
|
|
@@ -710,7 +715,12 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
710
715
|
onShowDetails?: () => void;
|
|
711
716
|
t: TranslationFunction;
|
|
712
717
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
713
|
-
|
|
718
|
+
// Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
|
|
719
|
+
// here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
|
|
720
|
+
// real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
|
|
721
|
+
// every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
|
|
722
|
+
// FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
|
|
723
|
+
if (mode === 'buy') return <div className="cc-terms" />;
|
|
714
724
|
const finFirstInstallment =
|
|
715
725
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
716
726
|
const finMonths = car.finMonths ?? _finMonths;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import useModal from './useModal';
|
|
3
3
|
import { updateCookieList } from '../../utils/CommonUtils';
|
|
4
|
+
import { OPEN_COOKIE_SETTINGS_EVENT } from '../../utils/cookieConsent';
|
|
4
5
|
import Modal from './Modal';
|
|
6
|
+
import { TranslationFunction } from '../../types';
|
|
5
7
|
|
|
6
8
|
export interface ICookieModal {
|
|
7
9
|
handleSentryInit?: () => void;
|
|
10
|
+
/** the host's `t` with the `autobahn` namespace (`cookieModal.*`); without it the dialog is German */
|
|
11
|
+
t?: TranslationFunction;
|
|
8
12
|
}
|
|
9
13
|
|
|
10
|
-
const CookieModal = ({ handleSentryInit = () => {} }: ICookieModal) => {
|
|
11
|
-
const { isVisible, toggleModal } = useModal();
|
|
14
|
+
const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
|
|
15
|
+
const { isVisible, toggleModal, openModal } = useModal();
|
|
12
16
|
const [modal, setModal] = useState('');
|
|
13
17
|
|
|
14
18
|
useEffect(
|
|
@@ -22,6 +26,19 @@ const CookieModal = ({ handleSentryInit = () => {} }: ICookieModal) => {
|
|
|
22
26
|
[]
|
|
23
27
|
);
|
|
24
28
|
|
|
29
|
+
// ADV-268: "Cookie-Einstellungen ändern" (account page) reopens the settings dialog
|
|
30
|
+
useEffect(
|
|
31
|
+
() => {
|
|
32
|
+
const onOpenSettings = () => {
|
|
33
|
+
setModal('MANAGE_COOKIE_MODAL');
|
|
34
|
+
openModal();
|
|
35
|
+
};
|
|
36
|
+
window.addEventListener(OPEN_COOKIE_SETTINGS_EVENT, onOpenSettings);
|
|
37
|
+
return () => window.removeEventListener(OPEN_COOKIE_SETTINGS_EVENT, onOpenSettings);
|
|
38
|
+
},
|
|
39
|
+
[]
|
|
40
|
+
);
|
|
41
|
+
|
|
25
42
|
useEffect(
|
|
26
43
|
() => {
|
|
27
44
|
if (!isVisible) return undefined;
|
|
@@ -45,6 +62,7 @@ const CookieModal = ({ handleSentryInit = () => {} }: ICookieModal) => {
|
|
|
45
62
|
? <Modal
|
|
46
63
|
isVisible={isVisible}
|
|
47
64
|
handleSentryInit={handleSentryInit}
|
|
65
|
+
t={t}
|
|
48
66
|
toggleModal={toggleModal}
|
|
49
67
|
name={modal}
|
|
50
68
|
modalProps={modalProps}
|
|
@@ -16,6 +16,7 @@ import * as React from 'react';
|
|
|
16
16
|
import * as ReactDOM from 'react-dom';
|
|
17
17
|
|
|
18
18
|
import ModalsConfig from './ModalsConfig';
|
|
19
|
+
import { TranslationFunction } from '../../types';
|
|
19
20
|
import styles from './Modal.styl';
|
|
20
21
|
|
|
21
22
|
interface IBasicModal {
|
|
@@ -24,6 +25,7 @@ interface IBasicModal {
|
|
|
24
25
|
handleSentryInit?: () => void;
|
|
25
26
|
name: string;
|
|
26
27
|
modalProps?: any;
|
|
28
|
+
t?: TranslationFunction;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const OVERLAY: React.CSSProperties = {
|
|
@@ -40,16 +42,17 @@ const SURFACE: React.CSSProperties = {
|
|
|
40
42
|
maxWidth: 640, width: '100%', maxHeight: '92vh', overflowY: 'auto'
|
|
41
43
|
};
|
|
42
44
|
|
|
43
|
-
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit }: IBasicModal) => {
|
|
45
|
+
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit, t }: IBasicModal) => {
|
|
44
46
|
if (!isVisible || typeof document === 'undefined') return null;
|
|
47
|
+
const label = t ? t('autobahn:cookieModal.dialogLabel') : '';
|
|
45
48
|
return ReactDOM.createPortal(
|
|
46
49
|
// wrapped in .md3: autobahn.css scopes every token/utility class (incl.
|
|
47
50
|
// .mbtn used by the modal buttons) under `.md3` and intentionally does
|
|
48
51
|
// nothing outside it — a bare document.body portal loses the theme.
|
|
49
52
|
<div className='md3'>
|
|
50
|
-
<div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label='Cookie-Einstellungen'>
|
|
53
|
+
<div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label={label && !label.endsWith('cookieModal.dialogLabel') ? label : 'Cookie-Einstellungen'}>
|
|
51
54
|
<div className={styles.surface} style={SURFACE}>
|
|
52
|
-
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit })}
|
|
55
|
+
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit, t })}
|
|
53
56
|
</div>
|
|
54
57
|
</div>
|
|
55
58
|
</div>,
|
|
@@ -8,19 +8,43 @@ import MaterialAccordionGroup from '../../../MdAccordionGroup/MdAccordionGroup';
|
|
|
8
8
|
import MaterialSwitch from '../../../MdSwitch/MdSwitch';
|
|
9
9
|
import { COOKIE_SCHEMA, COOKIE_SCHEMA_LINKS } from '../../../../constants/common';
|
|
10
10
|
import { updateCookieList } from '../../../../utils/CommonUtils';
|
|
11
|
+
import { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
12
|
+
import { TranslationFunction } from '../../../../types';
|
|
11
13
|
|
|
12
14
|
import styles from './ManageCookieModal.styl';
|
|
13
15
|
|
|
14
16
|
interface IManageCookieModal {
|
|
15
17
|
toggleModal: () => void;
|
|
16
18
|
handleSentryInit?: () => void;
|
|
19
|
+
/** the host's `t` with the `autobahn` namespace loaded; without it the dialog stays German (fe-landing) */
|
|
20
|
+
t?: TranslationFunction;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
interface IMarketingSwitches {
|
|
20
24
|
[key: string]: any;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
// the German copy (locales/de/autobahn.json `cookieModal`), used as is when the host passes no `t`
|
|
28
|
+
const DE: Record<string, string> = {
|
|
29
|
+
title: 'Nach den Cookies geht die Fahrt weiter.',
|
|
30
|
+
manageText: 'Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.',
|
|
31
|
+
'necessary.title': 'Notwendig',
|
|
32
|
+
'necessary.text': 'Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.',
|
|
33
|
+
'analytics.title': 'Analytisch',
|
|
34
|
+
'analytics.text': 'Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.',
|
|
35
|
+
'marketing.title': 'Marketing',
|
|
36
|
+
'marketing.text': 'Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.',
|
|
37
|
+
privacyPolicy: 'Datenschutzbestimmungen',
|
|
38
|
+
saveSelection: 'Auswahl speichern',
|
|
39
|
+
acceptAll: 'Alles akzeptieren'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieModal) => {
|
|
43
|
+
// a key the host can't resolve (namespace not loaded) comes back as the key itself
|
|
44
|
+
const tr = (key: string) => {
|
|
45
|
+
const text = t ? t(`autobahn:cookieModal.${key}`) : '';
|
|
46
|
+
return text && !text.endsWith(`cookieModal.${key}`) ? text : DE[key];
|
|
47
|
+
};
|
|
24
48
|
const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(false);
|
|
25
49
|
const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(false);
|
|
26
50
|
const [analyticsSwitches, setAnalyticsSwitches] = useState<IMarketingSwitches>({});
|
|
@@ -44,6 +68,10 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
44
68
|
.reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledMarketing.includes(item) }), {});
|
|
45
69
|
setAnalyticsSwitches(newAnalyticsSwitches);
|
|
46
70
|
setMarketingSwitches(newMarketingSwitches);
|
|
71
|
+
// ADV-268: reopened from the account page, a category whose cookies are all allowed shows
|
|
72
|
+
// its master switch on (it always started off)
|
|
73
|
+
setAnalyticsMasterSwitch(Object.values(newAnalyticsSwitches).every(Boolean));
|
|
74
|
+
setMarketingMasterSwitch(Object.values(newMarketingSwitches).every(Boolean));
|
|
47
75
|
},
|
|
48
76
|
[]
|
|
49
77
|
);
|
|
@@ -86,7 +114,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
86
114
|
marketing: Object.keys(marketingSwitches).filter(i => !marketingSwitches[i]) || [],
|
|
87
115
|
analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
|
|
88
116
|
};
|
|
89
|
-
|
|
117
|
+
saveCookieConfig(cookieConfig);
|
|
90
118
|
updateCookieList(handleSentryInit);
|
|
91
119
|
toggleModal();
|
|
92
120
|
};
|
|
@@ -110,34 +138,34 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
110
138
|
return (
|
|
111
139
|
<div className={styles.modalWrapper}>
|
|
112
140
|
<IconSVG name='autodeLogo' customDimensions />
|
|
113
|
-
<div className={styles.modalTitle}>
|
|
114
|
-
<div className={styles.modalContent}>
|
|
141
|
+
<div className={styles.modalTitle}>{tr('title')}</div>
|
|
142
|
+
<div className={styles.modalContent}>{tr('manageText')}</div>
|
|
115
143
|
<div className={styles.accordions}>
|
|
116
144
|
<MaterialAccordionGroup
|
|
117
|
-
title='
|
|
145
|
+
title={tr('necessary.title')}
|
|
118
146
|
// tooltipText='Notwendig'
|
|
119
147
|
withSwitch
|
|
120
148
|
switchProps={necessarySwitchProps}
|
|
121
149
|
>
|
|
122
|
-
<span className={styles.accordionDescription}>
|
|
150
|
+
<span className={styles.accordionDescription}>{tr('necessary.text')}</span>
|
|
123
151
|
{Object.keys(COOKIE_SCHEMA.necessary).map(cookie => {
|
|
124
152
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
125
153
|
return (
|
|
126
154
|
<div className={styles.switchBlock} key={cookie} >
|
|
127
155
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
128
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
156
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
|
|
129
157
|
<MaterialSwitch sx={{ marginLeft: 'auto' }} disabled={true} value={true} onChange={() => {}} />
|
|
130
158
|
</div>
|
|
131
159
|
);
|
|
132
160
|
})}
|
|
133
161
|
</MaterialAccordionGroup>
|
|
134
162
|
<MaterialAccordionGroup
|
|
135
|
-
title='
|
|
163
|
+
title={tr('analytics.title')}
|
|
136
164
|
withSwitch
|
|
137
165
|
// tooltipText='Analytisch'
|
|
138
166
|
switchProps={analyticsSwitchProps}
|
|
139
167
|
>
|
|
140
|
-
<span className={styles.accordionDescription}>
|
|
168
|
+
<span className={styles.accordionDescription}>{tr('analytics.text')}</span>
|
|
141
169
|
{Object.keys(COOKIE_SCHEMA.analytics).map(cookie => {
|
|
142
170
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `analytics['${cookie}']`, null);
|
|
143
171
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -145,7 +173,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
145
173
|
return (
|
|
146
174
|
<div className={styles.switchBlock} key={cookie} >
|
|
147
175
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
148
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
176
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
|
|
149
177
|
<MaterialSwitch
|
|
150
178
|
sx={{ marginLeft: 'auto' }}
|
|
151
179
|
value={isChecked}
|
|
@@ -156,12 +184,12 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
156
184
|
})}
|
|
157
185
|
</MaterialAccordionGroup>
|
|
158
186
|
<MaterialAccordionGroup
|
|
159
|
-
title='
|
|
187
|
+
title={tr('marketing.title')}
|
|
160
188
|
withSwitch
|
|
161
189
|
// tooltipText='Marketing'
|
|
162
190
|
switchProps={marketingSwitchProps}
|
|
163
191
|
>
|
|
164
|
-
<span className={styles.accordionDescription}>
|
|
192
|
+
<span className={styles.accordionDescription}>{tr('marketing.text')}</span>
|
|
165
193
|
{Object.keys(COOKIE_SCHEMA.marketing).map(cookie => {
|
|
166
194
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `marketing['${cookie}']`, null);
|
|
167
195
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -169,7 +197,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
169
197
|
return (
|
|
170
198
|
<div className={styles.switchBlock} key={cookie} >
|
|
171
199
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
172
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
200
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
|
|
173
201
|
<MaterialSwitch
|
|
174
202
|
sx={{ marginLeft: 'auto' }}
|
|
175
203
|
value={isChecked}
|
|
@@ -181,8 +209,8 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
181
209
|
</MaterialAccordionGroup>
|
|
182
210
|
</div>
|
|
183
211
|
<div className={styles.buttonsContainer}>
|
|
184
|
-
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >
|
|
185
|
-
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>
|
|
212
|
+
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >{tr('saveSelection')}</Button>
|
|
213
|
+
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>{tr('acceptAll')}</Button>
|
|
186
214
|
</div>
|
|
187
215
|
</div>
|
|
188
216
|
);
|
|
@@ -3,6 +3,7 @@ import IconSVG from '../../../../iconsvg/IconSVG';
|
|
|
3
3
|
import Button from '../../../Button/Button';
|
|
4
4
|
import styles from './PreviewCookieModal.styl';
|
|
5
5
|
import { updateCookieList } from '../../../../utils/CommonUtils';
|
|
6
|
+
import { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
6
7
|
import { COOKIE_SCHEMA } from '../../../../constants/common';
|
|
7
8
|
|
|
8
9
|
interface IPreviewCookieModal {
|
|
@@ -14,16 +15,16 @@ interface IPreviewCookieModal {
|
|
|
14
15
|
const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
|
|
15
16
|
const environment = window.location.origin;
|
|
16
17
|
const onAcceptAll = () => {
|
|
17
|
-
|
|
18
|
+
saveCookieConfig({ marketing: [], analytics: [] });
|
|
18
19
|
updateCookieList(handleSentryInit);
|
|
19
20
|
toggleModal();
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
const onDisableAll = () => {
|
|
23
|
-
|
|
24
|
+
saveCookieConfig({
|
|
24
25
|
marketing: Object.values(COOKIE_SCHEMA.marketing).reduce((acc: string[], val: string[]) => acc.concat(val), []),
|
|
25
26
|
analytics: Object.values(COOKIE_SCHEMA.analytics).reduce((acc: string[], val: string[]) => acc.concat(val), [])
|
|
26
|
-
})
|
|
27
|
+
});
|
|
27
28
|
updateCookieList(handleSentryInit);
|
|
28
29
|
toggleModal();
|
|
29
30
|
};
|
package/constants/app.ts
CHANGED
|
@@ -40,7 +40,17 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
40
40
|
i18n_KEY: 'i18nLanguage'
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// ADV-284: evaluated at import time — with site storage blocked, reading localStorage throws a
|
|
44
|
+
// SecurityError that took down the whole bundle. Blocked storage behaves like "nothing saved".
|
|
45
|
+
const readStoredLang = (): string | null => {
|
|
46
|
+
try {
|
|
47
|
+
return localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const DEFAULT_LANG: string = typeof window !== 'undefined' ? readStoredLang() : 'de';
|
|
44
54
|
|
|
45
55
|
// Default support contact phone
|
|
46
56
|
export const CONTACT_PHONE: string = '+498004030182';
|
package/constants/core.ts
CHANGED
|
@@ -35,7 +35,18 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
35
35
|
i18n_KEY: 'i18nLanguage'
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// ADV-284: evaluated at import time — with site storage blocked, merely reading
|
|
39
|
+
// window.localStorage throws a SecurityError, which took down the whole bundle (landing
|
|
40
|
+
// page never rendered). Treat blocked storage like "no language saved".
|
|
41
|
+
const readStoredLang = (): string | null => {
|
|
42
|
+
try {
|
|
43
|
+
return typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const DEFAULT_LANG: string = readStoredLang() ?? 'de';
|
|
39
50
|
|
|
40
51
|
export const ROW_STYLES = {
|
|
41
52
|
marginBottom: 10
|