@openeventkit/event-site 2.0.115 → 2.0.117
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/gatsby-browser.js +28 -21
- package/gatsby-config.mjs +13 -9
- package/gatsby-node.js +25 -27
- package/package.json +6 -4
- package/plugins/gatsby-plugin-google-tagmanager/.babelrc +9 -0
- package/plugins/gatsby-plugin-google-tagmanager/CHANGELOG.md +793 -0
- package/plugins/gatsby-plugin-google-tagmanager/LICENSE +22 -0
- package/plugins/gatsby-plugin-google-tagmanager/README.md +102 -0
- package/plugins/gatsby-plugin-google-tagmanager/gatsby-browser.js +99 -0
- package/plugins/gatsby-plugin-google-tagmanager/gatsby-node.js +53 -0
- package/plugins/gatsby-plugin-google-tagmanager/gatsby-ssr.js +127 -0
- package/plugins/gatsby-plugin-google-tagmanager/index.js +1 -0
- package/plugins/gatsby-plugin-google-tagmanager/package.json +48 -0
- package/src/cms/config/collections/defaultPagesCollection/invitationsRejectPage/index.js +6 -6
- package/src/components/AttendeeToAttendeeWidgetComponent.js +7 -8
- package/src/components/Footer/template.js +3 -2
- package/src/components/FooterMarketing.js +1 -1
- package/src/components/LogoutButton.js +6 -7
- package/src/components/MarketingHero/ImagesColumn.js +2 -2
- package/src/components/MarketingHero/index.js +1 -1
- package/src/components/RegistrationLiteComponent.js +2 -4
- package/src/components/Seo.js +3 -3
- package/src/content/site-settings/index.json +50 -1
- package/src/defaults/colors.json +33 -1
- package/src/styles/colors.scss +36 -33
- package/src/styles/fonts.scss +2 -2
- package/src/templates/marketing-page-template/MainColumn.js +54 -43
- package/src/templates/marketing-page-template/index.js +14 -14
- package/src/utils/EventEmitter.js +26 -0
- package/src/utils/cookies/CookieManager.js +27 -0
- package/src/utils/cookies/CookieManagerProvider.js +15 -0
- package/src/utils/cookies/providers/KlaroProvider.js +81 -0
- package/src/utils/cookies/services.js +57 -0
- package/src/utils/envVariables.js +94 -94
- package/src/utils/eventTriggers.js +19 -0
- package/src/utils/filePath.js +2 -2
- package/src/utils/hooks/index.js +3 -1
- package/src/utils/hooks/useEventListener.js +15 -0
- package/src/utils/hooks/useResize.js +3 -8
- package/src/utils/scssUtils.js +146 -0
- package/src/utils/tag-manager/TagManager.js +41 -0
- package/src/utils/tag-manager/TagManagerProvider.js +7 -0
- package/src/utils/tag-manager/providers/GoogleTagManagerProvider.js +49 -0
- package/src/utils/useSiteSettings.js +1 -5
- package/src/utils/analytics/AnalyticsManager.js +0 -28
- package/src/utils/analytics/AnalyticsProvider.js +0 -7
- package/src/utils/analytics/events.js +0 -1
- package/src/utils/analytics/providers/GoogleTagManagerProvider.js +0 -38
- package/src/utils/cssUtils.js +0 -62
- package/src/utils/customEvents/CustomEventManager.js +0 -22
- package/src/utils/customEvents/index.js +0 -15
- package/src/utils/customEvents/useCustomEvent.js +0 -13
|
@@ -1 +1,50 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"favicon": {
|
|
3
|
+
"asset": "icon.png"
|
|
4
|
+
},
|
|
5
|
+
"widgets": {
|
|
6
|
+
"chat": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"showQA": false,
|
|
9
|
+
"showHelp": false,
|
|
10
|
+
"defaultScope": "page"
|
|
11
|
+
},
|
|
12
|
+
"schedule": {
|
|
13
|
+
"allowClick": true
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"identityProviderButtons": [
|
|
17
|
+
{
|
|
18
|
+
"buttonColor": "#082238",
|
|
19
|
+
"providerLabel": "Continue with FNid",
|
|
20
|
+
"providerLogo": "logo_fn.svg",
|
|
21
|
+
"providerLogoSize": 27
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"buttonColor": "#0A66C2",
|
|
25
|
+
"providerLabel": "Sign in with LinkedIn",
|
|
26
|
+
"providerParam": "linkedin",
|
|
27
|
+
"providerLogo": "logo_linkedin.svg",
|
|
28
|
+
"providerLogoSize": 18
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"buttonColor": "#000000",
|
|
32
|
+
"providerLabel": "Sign in with Apple",
|
|
33
|
+
"providerParam": "apple",
|
|
34
|
+
"providerLogoSize": 17,
|
|
35
|
+
"providerLogo": "logo_apple.svg"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"buttonColor": "#1877F2",
|
|
39
|
+
"providerLabel": "Login with Facebook",
|
|
40
|
+
"providerParam": "facebook",
|
|
41
|
+
"providerLogo": "logo_facebook.svg",
|
|
42
|
+
"providerLogoSize": 20
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"maintenanceMode": {
|
|
46
|
+
"enabled": false,
|
|
47
|
+
"title": "Site under maintenance",
|
|
48
|
+
"subtitle": "Please reload page shortly"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/src/defaults/colors.json
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"color_accent": "#ff5e32",
|
|
3
|
+
"color_alerts": "#ff0000",
|
|
4
|
+
"color_background_light": "#ffffff",
|
|
5
|
+
"color_background_dark": "#000000",
|
|
6
|
+
"color_button_background_color": "#ffffff",
|
|
7
|
+
"color_button_color": "#000000",
|
|
8
|
+
"color_gray_lighter": "#f2f2f2",
|
|
9
|
+
"color_gray_light": "#dfdfdf",
|
|
10
|
+
"color_gray_dark": "#999999",
|
|
11
|
+
"color_gray_darker": "#4a4a4a",
|
|
12
|
+
"color_horizontal_rule_light": "#e5e5e5",
|
|
13
|
+
"color_horizontal_rule_dark": "#7b7b7b",
|
|
14
|
+
"color_icon_light": "#ffffff",
|
|
15
|
+
"color_input_background_color_light": "#ffffff",
|
|
16
|
+
"color_input_background_color_dark": "#181a1b",
|
|
17
|
+
"color_input_border_color_light": "#dbdbdb",
|
|
18
|
+
"color_input_border_color_dark": "#3a3f41",
|
|
19
|
+
"color_input_text_color_light": "#363636",
|
|
20
|
+
"color_input_text_color_dark": "#ffffff",
|
|
21
|
+
"color_input_text_color_disabled_light": "#ffffff",
|
|
22
|
+
"color_input_text_color_disabled_dark": "#ffffff",
|
|
23
|
+
"color_primary": "#6d6e71",
|
|
24
|
+
"color_primary_contrast": "#f1f2f2",
|
|
25
|
+
"color_secondary": "#00cec4",
|
|
26
|
+
"color_secondary_contrast": "#ff5e32",
|
|
27
|
+
"color_text_light": "#ffffff",
|
|
28
|
+
"color_text_med": "#828282",
|
|
29
|
+
"color_text_dark": "#333333",
|
|
30
|
+
"color_text_input_hints_light": "#7b7b7b",
|
|
31
|
+
"color_text_input_hints_dark": "#7b7b7b",
|
|
32
|
+
"color_text_input_hints": "#c4c4c4"
|
|
33
|
+
}
|
package/src/styles/colors.scss
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Warning:
|
|
3
|
+
* Dont edit this file by hand, has been generated by colors scss util
|
|
4
|
+
* Uses default colors as base and then overriden by colors set via marketing
|
|
5
|
+
**/
|
|
6
|
+
|
|
7
|
+
$color_accent: #ff5e32;
|
|
8
|
+
$color_alerts: #ff0000;
|
|
6
9
|
$color_background_light: #ffffff;
|
|
7
10
|
$color_background_dark: #000000;
|
|
8
|
-
$
|
|
9
|
-
$
|
|
10
|
-
$
|
|
11
|
-
$
|
|
12
|
-
$color_gray_dark
|
|
13
|
-
$
|
|
14
|
-
$
|
|
15
|
-
$
|
|
11
|
+
$color_button_background_color: #ffffff;
|
|
12
|
+
$color_button_color: #000000;
|
|
13
|
+
$color_gray_lighter: #F2F2F2;
|
|
14
|
+
$color_gray_light: #DFDFDF;
|
|
15
|
+
$color_gray_dark: #999999;
|
|
16
|
+
$color_gray_darker: #4A4A4A;
|
|
17
|
+
$color_horizontal_rule_light: #e5e5e5;
|
|
18
|
+
$color_horizontal_rule_dark: #7b7b7b;
|
|
19
|
+
$color_icon_light: #ffffff;
|
|
20
|
+
$color_input_background_color_light: #ffffff;
|
|
21
|
+
$color_input_background_color_dark: #181a1b;
|
|
22
|
+
$color_input_border_color_light: #dbdbdb;
|
|
23
|
+
$color_input_border_color_dark: #3a3f41;
|
|
16
24
|
$color_input_text_color_light: #363636;
|
|
17
|
-
$
|
|
18
|
-
$
|
|
19
|
-
$
|
|
20
|
-
$
|
|
21
|
-
$
|
|
22
|
-
$
|
|
23
|
-
$
|
|
24
|
-
$
|
|
25
|
-
$
|
|
26
|
-
$
|
|
27
|
-
$color_text_input_hints_light
|
|
28
|
-
$color_text_input_hints_dark
|
|
29
|
-
$
|
|
30
|
-
$color_button_color:#000000;
|
|
31
|
-
$color_alerts:#FF0000;
|
|
25
|
+
$color_input_text_color_dark: #ffffff;
|
|
26
|
+
$color_input_text_color_disabled_light: #ffffff;
|
|
27
|
+
$color_input_text_color_disabled_dark: #ffffff;
|
|
28
|
+
$color_primary: #6d6e71;
|
|
29
|
+
$color_primary_contrast: #f1f2f2;
|
|
30
|
+
$color_secondary: #00CEC4;
|
|
31
|
+
$color_secondary_contrast: #ff5e32;
|
|
32
|
+
$color_text_light: #ffffff;
|
|
33
|
+
$color_text_med: #828282;
|
|
34
|
+
$color_text_dark: #333333;
|
|
35
|
+
$color_text_input_hints_light: #7b7b7b;
|
|
36
|
+
$color_text_input_hints_dark: #7b7b7b;
|
|
37
|
+
$color_text_input_hints: #c4c4c4;
|
|
32
38
|
|
|
33
39
|
:root {
|
|
34
40
|
--color_primary: #{$color_primary};
|
|
@@ -45,7 +51,6 @@ $color_alerts:#FF0000;
|
|
|
45
51
|
--color_gray_light: #{$color_gray_light};
|
|
46
52
|
--color_gray_lighter: #{$color_gray_lighter};
|
|
47
53
|
--color_input_text_color: #{$color_input_text_color_light};
|
|
48
|
-
--color_input_text_color_disabled: #{$color_input_text_color_disabled_light};
|
|
49
54
|
--color_input_background_color: #{$color_input_background_color_light};
|
|
50
55
|
--color_input_border_color: #{$color_input_border_color_light};
|
|
51
56
|
--color_text_input_hints: #{$color_text_input_hints_light};
|
|
@@ -55,7 +60,6 @@ $color_alerts:#FF0000;
|
|
|
55
60
|
--color_button_color: #{$color_button_color};
|
|
56
61
|
--color_alerts: #{$color_alerts};
|
|
57
62
|
}
|
|
58
|
-
|
|
59
63
|
html[data-theme="DARK"] {
|
|
60
64
|
--color_text_dark: #{$color_text_light} !important;
|
|
61
65
|
--color_text_light: #{$color_text_dark} !important;
|
|
@@ -66,9 +70,8 @@ html[data-theme="DARK"] {
|
|
|
66
70
|
--color_gray_light: #{$color_gray_dark} !important;
|
|
67
71
|
--color_gray_lighter: #{$color_gray_darker} !important;
|
|
68
72
|
--color_input_text_color: #{$color_input_text_color_dark} !important;
|
|
69
|
-
--color_input_text_color_disabled: #{$color_input_text_color_disabled_dark} !important;
|
|
70
73
|
--color_input_background_color: #{$color_input_background_color_dark} !important;
|
|
71
74
|
--color_input_border_color: #{$color_input_border_color_dark} !important;
|
|
72
75
|
--color_text_input_hints: #{$color_text_input_hints_dark} !important;
|
|
73
|
-
--color_horizontal_rule: #{$color_horizontal_rule_dark};
|
|
74
|
-
}
|
|
76
|
+
--color_horizontal_rule: #{$color_horizontal_rule_dark} !important;
|
|
77
|
+
}
|
package/src/styles/fonts.scss
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Warning:
|
|
3
|
-
* Dont edit this file by hand,
|
|
4
|
-
*
|
|
3
|
+
* Dont edit this file by hand, has been generated by fonts scss util
|
|
4
|
+
* Generated with font values set via CMS
|
|
5
5
|
**/
|
|
6
6
|
|
|
7
7
|
$font-family: 'Nunito Sans', sans-serif;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { navigate } from "gatsby";
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
import { GatsbyImage, getImage } from "gatsby-plugin-image";
|
|
4
5
|
import Mdx from "@mdx-js/runtime";
|
|
@@ -8,6 +9,8 @@ import DisqusComponent from "../../components/DisqusComponent";
|
|
|
8
9
|
import ResponsiveImage from "../../components/ResponsiveImage";
|
|
9
10
|
import Link from "../../components/Link";
|
|
10
11
|
|
|
12
|
+
import { PHASES } from "@utils/phasesUtils";
|
|
13
|
+
|
|
11
14
|
import styles from "./styles.module.scss";
|
|
12
15
|
|
|
13
16
|
const shortcodes = {
|
|
@@ -15,55 +18,63 @@ const shortcodes = {
|
|
|
15
18
|
img: ResponsiveImage
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
21
|
+
const onEventClick = (ev) => navigate(`/a/event/${ev.id}`);
|
|
22
|
+
|
|
23
|
+
const MainColumn = ({ widgets, summitPhase, isLoggedUser, onEventClick, lastDataSync, fullWidth, maxHeight }) => {
|
|
24
|
+
const { content, schedule, disqus, image } = widgets || {};
|
|
25
|
+
|
|
26
|
+
const scheduleProps = schedule && isLoggedUser && summitPhase !== PHASES.BEFORE ? { onEventClick } : {};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={`column pt-6 pb-5 px-6 ${!fullWidth ? "is-half" : ""} ${styles.mainColumn || ""}`}
|
|
31
|
+
style={{ maxHeight: !fullWidth && maxHeight ? maxHeight : "none", overflowY: "auto" }}
|
|
32
|
+
>
|
|
33
|
+
<Container>
|
|
34
|
+
{content?.display && content?.body && (
|
|
35
|
+
<Mdx components={shortcodes}>
|
|
36
|
+
{content.body}
|
|
37
|
+
</Mdx>
|
|
38
|
+
)}
|
|
39
|
+
{schedule?.display && (
|
|
40
|
+
<>
|
|
41
|
+
<h2><b>{schedule.title}</b></h2>
|
|
42
|
+
<LiteScheduleComponent
|
|
43
|
+
{...scheduleProps}
|
|
44
|
+
lastDataSync={lastDataSync}
|
|
45
|
+
id={`marketing_lite_schedule_${lastDataSync}`}
|
|
46
|
+
page="marketing-site"
|
|
47
|
+
showAllEvents={true}
|
|
48
|
+
showSearch={false}
|
|
49
|
+
showNav={true}
|
|
50
|
+
/>
|
|
51
|
+
</>
|
|
52
|
+
)}
|
|
53
|
+
{disqus?.display && (
|
|
54
|
+
<>
|
|
55
|
+
<h2><b>{disqus.title}</b></h2>
|
|
56
|
+
<DisqusComponent page="marketing-site" />
|
|
57
|
+
</>
|
|
58
|
+
)}
|
|
59
|
+
{image?.display && image?.image.src && (
|
|
60
|
+
<>
|
|
61
|
+
<h2><b>{image.title}</b></h2>
|
|
62
|
+
<br/>
|
|
63
|
+
<GatsbyImage image={getImage(image.image.src)} alt={image.image.alt ?? ""} />
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</Container>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
59
70
|
|
|
60
71
|
MainColumn.propTypes = {
|
|
61
72
|
widgets: PropTypes.object,
|
|
62
|
-
|
|
73
|
+
summitPhase: PropTypes.number,
|
|
74
|
+
isLoggedUser: PropTypes.bool,
|
|
63
75
|
lastDataSync: PropTypes.number,
|
|
64
76
|
fullWidth: PropTypes.bool,
|
|
65
77
|
maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
66
78
|
};
|
|
67
79
|
|
|
68
80
|
export default MainColumn;
|
|
69
|
-
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import React, { useRef, useState
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import {
|
|
3
|
+
import { NoSsr } from "@mui/base/NoSsr";
|
|
4
4
|
import Layout from "../../components/Layout";
|
|
5
5
|
import AttendanceTrackerComponent from "../../components/AttendanceTrackerComponent";
|
|
6
6
|
import MarketingHero from "../../components/MarketingHero";
|
|
7
7
|
import Countdown from "../../components/Countdown";
|
|
8
|
-
import Link from "../../components/Link";
|
|
9
8
|
import MainColumn from "./MainColumn";
|
|
10
9
|
import Masonry from "./Masonry";
|
|
11
10
|
import { useResize } from "@utils/hooks";
|
|
12
|
-
import { PHASES } from "@utils/phasesUtils";
|
|
13
11
|
|
|
14
12
|
import styles from "./styles.module.scss";
|
|
15
13
|
|
|
16
|
-
const onEventClick = (ev) => navigate(`/a/event/${ev.id}`);
|
|
17
|
-
|
|
18
14
|
const MarketingPageTemplate = ({ data, location, summit, summitPhase, isLoggedUser, lastDataSync }) => {
|
|
19
15
|
const masonryRef = useRef();
|
|
20
16
|
const [rightColumnHeight, setRightColumnHeight] = useState();
|
|
17
|
+
|
|
21
18
|
const onResize = () => {
|
|
22
19
|
if (masonryRef?.current) {
|
|
23
20
|
setRightColumnHeight(masonryRef.current.firstChild.clientHeight);
|
|
24
21
|
}
|
|
25
22
|
};
|
|
23
|
+
|
|
26
24
|
useResize(onResize);
|
|
25
|
+
|
|
27
26
|
const {
|
|
28
27
|
marketingPageJson: {
|
|
29
28
|
hero,
|
|
@@ -32,22 +31,23 @@ const MarketingPageTemplate = ({ data, location, summit, summitPhase, isLoggedUs
|
|
|
32
31
|
masonry
|
|
33
32
|
} = {}
|
|
34
33
|
} = data || {};
|
|
35
|
-
|
|
36
|
-
if (widgets?.schedule && isLoggedUser && summitPhase !== PHASES.BEFORE) {
|
|
37
|
-
return { onEventClick };
|
|
38
|
-
}
|
|
39
|
-
return {};
|
|
40
|
-
}, [widgets, isLoggedUser, summitPhase]);
|
|
34
|
+
|
|
41
35
|
const shouldRenderMasonry = masonry?.display;
|
|
36
|
+
|
|
42
37
|
return (
|
|
43
38
|
<Layout marketing={true} location={location}>
|
|
44
39
|
<AttendanceTrackerComponent />
|
|
45
40
|
<MarketingHero location={location} data={hero} />
|
|
46
|
-
{summit && countdown?.display &&
|
|
41
|
+
{summit && countdown?.display &&
|
|
42
|
+
<NoSsr>
|
|
43
|
+
<Countdown summit={summit} text={countdown?.text} />
|
|
44
|
+
</NoSsr>
|
|
45
|
+
}
|
|
47
46
|
<div className="columns is-marginless">
|
|
48
47
|
<MainColumn
|
|
49
48
|
widgets={widgets}
|
|
50
|
-
|
|
49
|
+
summitPhase={summitPhase}
|
|
50
|
+
isLoggedUser={isLoggedUser}
|
|
51
51
|
maxHeight={rightColumnHeight}
|
|
52
52
|
fullWidth={!shouldRenderMasonry}
|
|
53
53
|
lastDataSync={lastDataSync}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class EventEmitter extends EventTarget {
|
|
2
|
+
static instance;
|
|
3
|
+
|
|
4
|
+
constructor() {
|
|
5
|
+
if (EventEmitter.instance) {
|
|
6
|
+
return EventEmitter.instance;
|
|
7
|
+
}
|
|
8
|
+
super();
|
|
9
|
+
EventEmitter.instance = this;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
emit(eventName, detail = {}) {
|
|
13
|
+
const event = new CustomEvent(eventName, { detail });
|
|
14
|
+
this.dispatchEvent(event);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
on(eventName, callback, options) {
|
|
18
|
+
this.addEventListener(eventName, callback, options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
off(eventName, callback, options) {
|
|
22
|
+
this.removeEventListener(eventName, callback, options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default EventEmitter;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import CookieManagerProvider from "./CookieManagerProvider";
|
|
2
|
+
|
|
3
|
+
class CookieManager {
|
|
4
|
+
static instance;
|
|
5
|
+
|
|
6
|
+
constructor(provider, services) {
|
|
7
|
+
if (CookieManager.instance) {
|
|
8
|
+
return CookieManager.instance;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!(provider instanceof CookieManagerProvider)) {
|
|
12
|
+
throw new Error("Provider must implement CookieManagerProvider interface");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
this.provider = provider;
|
|
16
|
+
this.services = services;
|
|
17
|
+
this.provider.init(this.services);
|
|
18
|
+
|
|
19
|
+
CookieManager.instance = this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getConsents = () => this.provider.getConsents();
|
|
23
|
+
|
|
24
|
+
show = () => this.provider.show();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default CookieManager;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CookieManagerProvider {
|
|
2
|
+
init = (services) => {
|
|
3
|
+
throw new Error("Method 'init()' must be implemented.");
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
getConsents = () => {
|
|
7
|
+
throw new Error("Method 'getConsents()' must be implemented.");
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
show = () => {
|
|
11
|
+
throw new Error("Method 'show()' must be implemented.");
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default CookieManagerProvider;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as klaro from "klaro";
|
|
2
|
+
import CookieManagerProvider from "../CookieManagerProvider";
|
|
3
|
+
import { triggerTagManagerTrackEvent } from "../../eventTriggers";
|
|
4
|
+
|
|
5
|
+
class KlaroProvider extends CookieManagerProvider {
|
|
6
|
+
init = (services) => {
|
|
7
|
+
/**
|
|
8
|
+
* For api methods
|
|
9
|
+
* @see https://github.com/klaro-org/klaro-js/blob/master/src/lib.js
|
|
10
|
+
**/
|
|
11
|
+
this.api = klaro;
|
|
12
|
+
this.config = this.#formatConfig(services);
|
|
13
|
+
this.consentManager = this.api.getManager(this.config);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
getConsents = () => this.consentManager ? this.consentManager.consents : {};
|
|
17
|
+
|
|
18
|
+
show = () => this.api.render(this.config);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @see https://klaro.org/docs/integration/annotated-configuration
|
|
22
|
+
**/
|
|
23
|
+
#formatConfig = (services) => ({
|
|
24
|
+
acceptAll: true,
|
|
25
|
+
hideLearnMore: true,
|
|
26
|
+
translations: {
|
|
27
|
+
en: {
|
|
28
|
+
purposes: {
|
|
29
|
+
analytics: "Analytics",
|
|
30
|
+
marketing: "Marketing",
|
|
31
|
+
styling: "Styling"
|
|
32
|
+
},
|
|
33
|
+
consentNotice: {
|
|
34
|
+
description:
|
|
35
|
+
"Hi! Could we please enable cookies for anonymous {purposes} to improve your user experience?"
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
services: services.map(service => ({
|
|
40
|
+
name: service.name,
|
|
41
|
+
title: service.title,
|
|
42
|
+
description: service.description,
|
|
43
|
+
purposes: service.purposes,
|
|
44
|
+
required: service.required,
|
|
45
|
+
cookies: service.cookies,
|
|
46
|
+
onAccept: this.#handleAccept.bind(this, service),
|
|
47
|
+
onDecline: this.#handleDecline.bind(this, service),
|
|
48
|
+
onInit: service.onInit
|
|
49
|
+
}))
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
#handleAccept = (service) => {
|
|
53
|
+
if (service.name === "google-tag-manager") {
|
|
54
|
+
const consents = this.getConsents();
|
|
55
|
+
for (let k of Object.keys(consents)) {
|
|
56
|
+
if (consents[k]) {
|
|
57
|
+
let eventName = "klaro-" + k + "-accepted";
|
|
58
|
+
triggerTagManagerTrackEvent(eventName);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
let eventName = "klaro-" + service.name + "-accepted";
|
|
63
|
+
triggerTagManagerTrackEvent(eventName);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (service.onAccept) {
|
|
67
|
+
service.onAccept();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
#handleDecline = (service) => {
|
|
72
|
+
const eventName = "klaro-" + service.name + "-declined";
|
|
73
|
+
triggerTagManagerTrackEvent(eventName);
|
|
74
|
+
|
|
75
|
+
if (service.onDecline) {
|
|
76
|
+
service.onDecline();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default KlaroProvider;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//import GoogleTagManagerProvider from "../tag-manager/providers/GoogleTagManagerProvider";
|
|
2
|
+
import { triggerTagManagerConsentEvent } from "../eventTriggers";
|
|
3
|
+
|
|
4
|
+
//const googleTagManagerProvider = new GoogleTagManagerProvider();
|
|
5
|
+
|
|
6
|
+
const services = [
|
|
7
|
+
{
|
|
8
|
+
name: "google-tag-manager",
|
|
9
|
+
title: "Google Tag Manager",
|
|
10
|
+
purposes: ["marketing"],
|
|
11
|
+
default: true,
|
|
12
|
+
onInit: () => {
|
|
13
|
+
triggerTagManagerConsentEvent("default", {
|
|
14
|
+
//"ad_storage": "denied",
|
|
15
|
+
"analytics_storage": "denied",
|
|
16
|
+
//"ad_user_data": "denied",
|
|
17
|
+
//"ad_personalization": "denied"
|
|
18
|
+
});
|
|
19
|
+
//googleTagManagerProvider.set("ads_data_redaction", true);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "google-analytics",
|
|
24
|
+
title: "Google Analytics",
|
|
25
|
+
purposes: ["analytics"],
|
|
26
|
+
cookies: [/^_ga(_.*)?/],
|
|
27
|
+
default: true,
|
|
28
|
+
onAccept: () => {
|
|
29
|
+
triggerTagManagerConsentEvent("update", { "analytics_storage": "granted" });
|
|
30
|
+
},
|
|
31
|
+
onDecline: () => {
|
|
32
|
+
triggerTagManagerConsentEvent("update", { "analytics_storage": "denied" });
|
|
33
|
+
}
|
|
34
|
+
}/*,
|
|
35
|
+
{
|
|
36
|
+
name: "google-ads",
|
|
37
|
+
title: "Google Ads",
|
|
38
|
+
purposes: ["marketing"],
|
|
39
|
+
cookies: [],
|
|
40
|
+
onAccept: () => {
|
|
41
|
+
triggerTagManagerConsentEvent("update", {
|
|
42
|
+
"ad_storage": "granted",
|
|
43
|
+
"ad_user_data": "granted",
|
|
44
|
+
"ad_personalization": "granted"
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
onDecline: () => {
|
|
48
|
+
triggerTagManagerConsentEvent("update", {
|
|
49
|
+
"ad_storage": "denied",
|
|
50
|
+
"ad_user_data": "denied",
|
|
51
|
+
"ad_personalization": "denied"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}*/
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
export default services;
|