@bytebrand/fe-ui-core-autobahn 1.0.175 → 1.0.177
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/chrome/TopBar.tsx +29 -10
- package/locales/de/autobahn.json +879 -879
- package/locales/en/autobahn.json +879 -879
- package/package.json +30 -30
- package/theme/md3.css +11 -4
- package/utils/cookieConsent.ts +84 -84
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
|
-
"main": "index.ts",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
|
-
"peerDependencies": {
|
|
8
|
-
"react": "^18.0.0",
|
|
9
|
-
"react-dom": "^18.0.0"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
-
"@bytebrand/fe-financing": "^5.14.20",
|
|
14
|
-
"classnames": "2.2.6",
|
|
15
|
-
"clsx": "^2.1.1",
|
|
16
|
-
"d3-format": "1.4.5",
|
|
17
|
-
"js-cookie": "^2.2.0",
|
|
18
|
-
"lodash": "^4.17.21",
|
|
19
|
-
"lucide-react": "^0.288.0",
|
|
20
|
-
"mobx-react": "^7.6.0",
|
|
21
|
-
"moment": "^2.29.1",
|
|
22
|
-
"qs": "^6.6.0",
|
|
23
|
-
"react-device-detect": "^2.1.2",
|
|
24
|
-
"react-grid-system": "^5.0.2",
|
|
25
|
-
"react-lazyload": "^3.2.0",
|
|
26
|
-
"react-scroll": "^1.9.3",
|
|
27
|
-
"react-slick": "^0.29.0",
|
|
28
|
-
"slick-carousel": "1.8.1"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
+
"version": "1.0.177",
|
|
4
|
+
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": "^18.0.0",
|
|
9
|
+
"react-dom": "^18.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
+
"@bytebrand/fe-financing": "^5.14.20",
|
|
14
|
+
"classnames": "2.2.6",
|
|
15
|
+
"clsx": "^2.1.1",
|
|
16
|
+
"d3-format": "1.4.5",
|
|
17
|
+
"js-cookie": "^2.2.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"lucide-react": "^0.288.0",
|
|
20
|
+
"mobx-react": "^7.6.0",
|
|
21
|
+
"moment": "^2.29.1",
|
|
22
|
+
"qs": "^6.6.0",
|
|
23
|
+
"react-device-detect": "^2.1.2",
|
|
24
|
+
"react-grid-system": "^5.0.2",
|
|
25
|
+
"react-lazyload": "^3.2.0",
|
|
26
|
+
"react-scroll": "^1.9.3",
|
|
27
|
+
"react-slick": "^0.29.0",
|
|
28
|
+
"slick-carousel": "1.8.1"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/theme/md3.css
CHANGED
|
@@ -10472,11 +10472,18 @@ line-height: 31px;
|
|
|
10472
10472
|
border-radius: 50%;
|
|
10473
10473
|
background: #005cff;
|
|
10474
10474
|
}
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10475
|
+
/* "Meine Händler": the chevron of the row that expands the dealer list, and the dealer rows under
|
|
10476
|
+
it, their label in line with the row's label (18px inset + 22px icon + 14px gap) */
|
|
10477
|
+
.md3 .acct-chevron {
|
|
10478
|
+
flex: none;
|
|
10479
10479
|
color: #5b6b7f;
|
|
10480
|
+
transition: transform 0.2s ease;
|
|
10481
|
+
}
|
|
10482
|
+
.md3 .acct-chevron--open {
|
|
10483
|
+
transform: rotate(180deg);
|
|
10484
|
+
}
|
|
10485
|
+
.md3 .acct-row--nested {
|
|
10486
|
+
padding-left: 54px;
|
|
10480
10487
|
}
|
|
10481
10488
|
.md3 .acct-cta {
|
|
10482
10489
|
padding: 6px 18px 4px;
|
package/utils/cookieConsent.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
// ADV-268 — the cookie consent store (`localStorage['cookieConfig']`: per category the DISABLED
|
|
2
|
-
// vendor-cookie names, see COOKIE_SCHEMA) plus what the account page needs on top of it:
|
|
3
|
-
// - when the choice last changed (`cookieConfigChangedAt`, ISO), written on every save that
|
|
4
|
-
// changes it — the consent dialogs save through saveCookieConfig;
|
|
5
|
-
// - a window event after each save, so a page showing the state can update live;
|
|
6
|
-
// - openCookieSettings(), which makes the mounted CookieModal show its settings dialog again.
|
|
7
|
-
// Storage access is guarded: with site storage blocked every read returns "no choice yet".
|
|
8
|
-
|
|
9
|
-
import { COOKIE_SCHEMA } from '../constants/common';
|
|
10
|
-
|
|
11
|
-
export const COOKIE_CONFIG_KEY = 'cookieConfig';
|
|
12
|
-
export const COOKIE_CONFIG_CHANGED_AT_KEY = 'cookieConfigChangedAt';
|
|
13
|
-
export const COOKIE_CONSENT_CHANGE_EVENT = 'autode:cookie-consent-change';
|
|
14
|
-
export const OPEN_COOKIE_SETTINGS_EVENT = 'autode:open-cookie-settings';
|
|
15
|
-
|
|
16
|
-
export interface ICookieConfig {
|
|
17
|
-
marketing: string[];
|
|
18
|
-
analytics: string[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type CookieCategoryState = 'on' | 'partial' | 'off';
|
|
22
|
-
|
|
23
|
-
export interface ICookieConsentState {
|
|
24
|
-
/** false until the visitor saved a choice in the cookie dialog */
|
|
25
|
-
decided: boolean;
|
|
26
|
-
/** ISO date of the last change, null when unknown (no choice yet, or saved before it was recorded) */
|
|
27
|
-
changedAt: string | null;
|
|
28
|
-
analytics: CookieCategoryState;
|
|
29
|
-
marketing: CookieCategoryState;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const vendorCookies = (category: 'analytics' | 'marketing'): string[] =>
|
|
33
|
-
Object.values(COOKIE_SCHEMA[category]).reduce((acc: string[], val: string[]) => acc.concat(val), []);
|
|
34
|
-
|
|
35
|
-
const readStorage = (key: string): string | null => {
|
|
36
|
-
try {
|
|
37
|
-
return localStorage.getItem(key);
|
|
38
|
-
} catch (e) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const saveCookieConfig = (config: ICookieConfig | Record<string, string[]>) => {
|
|
44
|
-
const next = JSON.stringify(config);
|
|
45
|
-
try {
|
|
46
|
-
const previous = localStorage.getItem(COOKIE_CONFIG_KEY);
|
|
47
|
-
localStorage.setItem(COOKIE_CONFIG_KEY, next);
|
|
48
|
-
if (previous !== next || !localStorage.getItem(COOKIE_CONFIG_CHANGED_AT_KEY)) {
|
|
49
|
-
localStorage.setItem(COOKIE_CONFIG_CHANGED_AT_KEY, new Date().toISOString());
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
window.dispatchEvent(new Event(COOKIE_CONSENT_CHANGE_EVENT));
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const getCookieConsentState = (): ICookieConsentState => {
|
|
58
|
-
let config: Partial<ICookieConfig> | null = null;
|
|
59
|
-
try {
|
|
60
|
-
config = JSON.parse(readStorage(COOKIE_CONFIG_KEY));
|
|
61
|
-
} catch (e) {
|
|
62
|
-
config = null;
|
|
63
|
-
}
|
|
64
|
-
if (!config) return { decided: false, changedAt: null, analytics: 'off', marketing: 'off' };
|
|
65
|
-
|
|
66
|
-
const categoryState = (category: 'analytics' | 'marketing'): CookieCategoryState => {
|
|
67
|
-
const disabled = Array.isArray(config[category]) ? config[category] : [];
|
|
68
|
-
const all = vendorCookies(category);
|
|
69
|
-
const allowed = all.filter((cookie) => !disabled.includes(cookie)).length;
|
|
70
|
-
if (allowed === all.length) return 'on';
|
|
71
|
-
return allowed ? 'partial' : 'off';
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
decided: true,
|
|
76
|
-
changedAt: readStorage(COOKIE_CONFIG_CHANGED_AT_KEY),
|
|
77
|
-
analytics: categoryState('analytics'),
|
|
78
|
-
marketing: categoryState('marketing')
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const openCookieSettings = () => {
|
|
83
|
-
window.dispatchEvent(new Event(OPEN_COOKIE_SETTINGS_EVENT));
|
|
84
|
-
};
|
|
1
|
+
// ADV-268 — the cookie consent store (`localStorage['cookieConfig']`: per category the DISABLED
|
|
2
|
+
// vendor-cookie names, see COOKIE_SCHEMA) plus what the account page needs on top of it:
|
|
3
|
+
// - when the choice last changed (`cookieConfigChangedAt`, ISO), written on every save that
|
|
4
|
+
// changes it — the consent dialogs save through saveCookieConfig;
|
|
5
|
+
// - a window event after each save, so a page showing the state can update live;
|
|
6
|
+
// - openCookieSettings(), which makes the mounted CookieModal show its settings dialog again.
|
|
7
|
+
// Storage access is guarded: with site storage blocked every read returns "no choice yet".
|
|
8
|
+
|
|
9
|
+
import { COOKIE_SCHEMA } from '../constants/common';
|
|
10
|
+
|
|
11
|
+
export const COOKIE_CONFIG_KEY = 'cookieConfig';
|
|
12
|
+
export const COOKIE_CONFIG_CHANGED_AT_KEY = 'cookieConfigChangedAt';
|
|
13
|
+
export const COOKIE_CONSENT_CHANGE_EVENT = 'autode:cookie-consent-change';
|
|
14
|
+
export const OPEN_COOKIE_SETTINGS_EVENT = 'autode:open-cookie-settings';
|
|
15
|
+
|
|
16
|
+
export interface ICookieConfig {
|
|
17
|
+
marketing: string[];
|
|
18
|
+
analytics: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CookieCategoryState = 'on' | 'partial' | 'off';
|
|
22
|
+
|
|
23
|
+
export interface ICookieConsentState {
|
|
24
|
+
/** false until the visitor saved a choice in the cookie dialog */
|
|
25
|
+
decided: boolean;
|
|
26
|
+
/** ISO date of the last change, null when unknown (no choice yet, or saved before it was recorded) */
|
|
27
|
+
changedAt: string | null;
|
|
28
|
+
analytics: CookieCategoryState;
|
|
29
|
+
marketing: CookieCategoryState;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const vendorCookies = (category: 'analytics' | 'marketing'): string[] =>
|
|
33
|
+
Object.values(COOKIE_SCHEMA[category]).reduce((acc: string[], val: string[]) => acc.concat(val), []);
|
|
34
|
+
|
|
35
|
+
const readStorage = (key: string): string | null => {
|
|
36
|
+
try {
|
|
37
|
+
return localStorage.getItem(key);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const saveCookieConfig = (config: ICookieConfig | Record<string, string[]>) => {
|
|
44
|
+
const next = JSON.stringify(config);
|
|
45
|
+
try {
|
|
46
|
+
const previous = localStorage.getItem(COOKIE_CONFIG_KEY);
|
|
47
|
+
localStorage.setItem(COOKIE_CONFIG_KEY, next);
|
|
48
|
+
if (previous !== next || !localStorage.getItem(COOKIE_CONFIG_CHANGED_AT_KEY)) {
|
|
49
|
+
localStorage.setItem(COOKIE_CONFIG_CHANGED_AT_KEY, new Date().toISOString());
|
|
50
|
+
}
|
|
51
|
+
} catch (e) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
window.dispatchEvent(new Event(COOKIE_CONSENT_CHANGE_EVENT));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const getCookieConsentState = (): ICookieConsentState => {
|
|
58
|
+
let config: Partial<ICookieConfig> | null = null;
|
|
59
|
+
try {
|
|
60
|
+
config = JSON.parse(readStorage(COOKIE_CONFIG_KEY));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
config = null;
|
|
63
|
+
}
|
|
64
|
+
if (!config) return { decided: false, changedAt: null, analytics: 'off', marketing: 'off' };
|
|
65
|
+
|
|
66
|
+
const categoryState = (category: 'analytics' | 'marketing'): CookieCategoryState => {
|
|
67
|
+
const disabled = Array.isArray(config[category]) ? config[category] : [];
|
|
68
|
+
const all = vendorCookies(category);
|
|
69
|
+
const allowed = all.filter((cookie) => !disabled.includes(cookie)).length;
|
|
70
|
+
if (allowed === all.length) return 'on';
|
|
71
|
+
return allowed ? 'partial' : 'off';
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
decided: true,
|
|
76
|
+
changedAt: readStorage(COOKIE_CONFIG_CHANGED_AT_KEY),
|
|
77
|
+
analytics: categoryState('analytics'),
|
|
78
|
+
marketing: categoryState('marketing')
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const openCookieSettings = () => {
|
|
83
|
+
window.dispatchEvent(new Event(OPEN_COOKIE_SETTINGS_EVENT));
|
|
84
|
+
};
|