@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,103 +1,103 @@
|
|
|
1
|
-
export const SITE_URL =
|
|
2
|
-
export const IDP_BASE_URL =
|
|
3
|
-
export const SUMMIT_API_BASE_URL =
|
|
4
|
-
export const SUMMIT_ID =
|
|
5
|
-
export const OAUTH2_CODE =
|
|
6
|
-
export const OAUTH2_CLIENT_ID =
|
|
7
|
-
export const SCOPES =
|
|
8
|
-
export const MARKETING_API_BASE_URL =
|
|
9
|
-
export const REGISTRATION_BASE_URL =
|
|
10
|
-
export const AUTHZ_USER_GROUPS =
|
|
11
|
-
export const AUTHORIZED_DEFAULT_PATH =
|
|
12
|
-
export const STREAM_IO_API_KEY =
|
|
13
|
-
export const MUX_ENV_KEY =
|
|
14
|
-
export const DISQUS_SHORTNAME =
|
|
15
|
-
export const SUPABASE_URL =
|
|
16
|
-
export const SUPABASE_KEY =
|
|
17
|
-
export const CHAT_API_BASE_URL =
|
|
18
|
-
export const SCHEDULE_EXCLUDING_TAGS =
|
|
19
|
-
export const LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS =
|
|
20
|
-
export const OAUTH2_FLOW =
|
|
21
|
-
export const API_BASE_URL =
|
|
1
|
+
export const SITE_URL = "SITE_URL";
|
|
2
|
+
export const IDP_BASE_URL = "IDP_BASE_URL";
|
|
3
|
+
export const SUMMIT_API_BASE_URL = "SUMMIT_API_BASE_URL";
|
|
4
|
+
export const SUMMIT_ID = "SUMMIT_ID";
|
|
5
|
+
export const OAUTH2_CODE = "OAUTH2_CODE";
|
|
6
|
+
export const OAUTH2_CLIENT_ID = "OAUTH2_CLIENT_ID";
|
|
7
|
+
export const SCOPES = "SCOPES";
|
|
8
|
+
export const MARKETING_API_BASE_URL = "MARKETING_API_BASE_URL";
|
|
9
|
+
export const REGISTRATION_BASE_URL = "REGISTRATION_BASE_URL";
|
|
10
|
+
export const AUTHZ_USER_GROUPS = "AUTHZ_USER_GROUPS";
|
|
11
|
+
export const AUTHORIZED_DEFAULT_PATH = "AUTHORIZED_DEFAULT_PATH";
|
|
12
|
+
export const STREAM_IO_API_KEY = "STREAM_IO_API_KEY";
|
|
13
|
+
export const MUX_ENV_KEY = "MUX_ENV_KEY";
|
|
14
|
+
export const DISQUS_SHORTNAME = "DISQUS_SHORTNAME";
|
|
15
|
+
export const SUPABASE_URL = "SUPABASE_URL";
|
|
16
|
+
export const SUPABASE_KEY = "SUPABASE_KEY";
|
|
17
|
+
export const CHAT_API_BASE_URL = "CHAT_API_BASE_URL";
|
|
18
|
+
export const SCHEDULE_EXCLUDING_TAGS = "SCHEDULE_EXCLUDING_TAGS";
|
|
19
|
+
export const LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS = "LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS";
|
|
20
|
+
export const OAUTH2_FLOW = "OAUTH2_FLOW";
|
|
21
|
+
export const API_BASE_URL = "API_BASE_URL";
|
|
22
22
|
// TODO: SUPPORT_EMAIL needs to be set via marketing api i/o env var
|
|
23
|
-
export const SUPPORT_EMAIL =
|
|
24
|
-
export const WS_PUB_SERVER_URL =
|
|
25
|
-
export const REAL_TIME_UPDATES_STRATEGY =
|
|
26
|
-
export const TIMEINTERVALSINCE1970_API_URL =
|
|
27
|
-
export const ABLY_API_KEY =
|
|
28
|
-
export const GOOGLE_TAGMANAGER_ID =
|
|
23
|
+
export const SUPPORT_EMAIL = "SUPPORT_EMAIL";
|
|
24
|
+
export const WS_PUB_SERVER_URL = "WS_PUB_SERVER_URL";
|
|
25
|
+
export const REAL_TIME_UPDATES_STRATEGY = "REAL_TIME_UPDATES_STRATEGY";
|
|
26
|
+
export const TIMEINTERVALSINCE1970_API_URL = "TIMEINTERVALSINCE1970_API_URL";
|
|
27
|
+
export const ABLY_API_KEY = "ABLY_API_KEY";
|
|
28
|
+
export const GOOGLE_TAGMANAGER_ID = "GOOGLE_TAGMANAGER_ID";
|
|
29
29
|
|
|
30
30
|
const processEnv = {
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Retrieve the site URL from environment variable set by the deploy provider.
|
|
33
|
+
* See documentation for more details:
|
|
34
|
+
* - Netlify: {@link https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata}
|
|
35
|
+
* - Cloudflare Pages: {@link https://developers.cloudflare.com/pages/platform/build-configuration#environment-variables}
|
|
36
|
+
*
|
|
37
|
+
* If not available, fallback to user-defined GATSBY_SITE_URL env var.
|
|
38
|
+
*/
|
|
39
|
+
SITE_URL: process.env.URL || process.env.CF_PAGES_URL || process.env.GATSBY_SITE_URL,
|
|
40
|
+
IDP_BASE_URL: process.env.GATSBY_IDP_BASE_URL,
|
|
41
|
+
SUMMIT_API_BASE_URL: process.env.GATSBY_SUMMIT_API_BASE_URL,
|
|
42
|
+
API_BASE_URL: process.env.GATSBY_SUMMIT_API_BASE_URL,
|
|
43
|
+
SUMMIT_ID: process.env.GATSBY_SUMMIT_ID,
|
|
44
|
+
OAUTH2_FLOW: process.env.GATSBY_OAUTH2_FLOW,
|
|
45
|
+
OAUTH2_CLIENT_ID: process.env.GATSBY_OAUTH2_CLIENT_ID,
|
|
46
|
+
SCOPES: process.env.GATSBY_SCOPES,
|
|
47
|
+
MARKETING_API_BASE_URL: process.env.GATSBY_MARKETING_API_BASE_URL,
|
|
48
|
+
REGISTRATION_BASE_URL: process.env.GATSBY_REGISTRATION_BASE_URL,
|
|
49
|
+
AUTHZ_USER_GROUPS: process.env.GATSBY_AUTHZ_USER_GROUPS,
|
|
50
|
+
AUTHORIZED_DEFAULT_PATH: process.env.GATSBY_AUTHORIZED_DEFAULT_PATH,
|
|
51
|
+
STREAM_IO_API_KEY: process.env.GATSBY_STREAM_IO_API_KEY,
|
|
52
|
+
MUX_ENV_KEY: process.env.GATSBY_MUX_ENV_KEY,
|
|
53
|
+
DISQUS_SHORTNAME: process.env.GATSBY_DISQUS_SHORTNAME,
|
|
54
|
+
SUPABASE_URL: process.env.GATSBY_SUPABASE_URL,
|
|
55
|
+
SUPABASE_KEY: process.env.GATSBY_SUPABASE_KEY,
|
|
56
|
+
CHAT_API_BASE_URL: process.env.GATSBY_CHAT_API_BASE_URL,
|
|
57
|
+
SCHEDULE_EXCLUDING_TAGS: process.env.GATSBY_SCHEDULE_EXCLUDING_TAGS,
|
|
58
|
+
LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS: process.env.GATSBY_LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS || 60,
|
|
59
|
+
SUPPORT_EMAIL: process.env.GATSBY_SUPPORT_EMAIL,
|
|
60
|
+
WS_PUB_SERVER_URL: process.env.GATSBY_WS_PUB_SERVER_URL,
|
|
61
|
+
// could be SUPA OR WS
|
|
62
|
+
REAL_TIME_UPDATES_STRATEGY: process.env.GATSBY_REAL_TIME_UPDATES_STRATEGY,
|
|
63
|
+
TIMEINTERVALSINCE1970_API_URL: process.env.GATSBY_TIMEINTERVALSINCE1970_API_URL,
|
|
64
|
+
ABLY_API_KEY: process.env.GATSBY_ABLY_API_KEY,
|
|
65
|
+
GOOGLE_TAGMANAGER_ID: process.env.GATSBY_GOOGLE_TAGMANAGER_ID,
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export const getEnvVariable = (name) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
let res = typeof window === "object" ? window[name] : null;
|
|
70
|
+
if (!res) {
|
|
71
|
+
res = processEnv[name];
|
|
72
|
+
}
|
|
73
|
+
return res;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (typeof window ===
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
76
|
+
if (typeof window === "object") {
|
|
77
|
+
window.SITE_URL = processEnv[SITE_URL];
|
|
78
|
+
window.OAUTH2_FLOW = processEnv[OAUTH2_FLOW];
|
|
79
|
+
window.OAUTH2_CLIENT_ID = processEnv[OAUTH2_CLIENT_ID];
|
|
80
|
+
window.SCOPES = processEnv[SCOPES];
|
|
81
|
+
window.IDP_BASE_URL = processEnv[IDP_BASE_URL];
|
|
82
|
+
window.SUMMIT_API_BASE_URL = processEnv[SUMMIT_API_BASE_URL];
|
|
83
|
+
window.API_BASE_URL = processEnv[API_BASE_URL];
|
|
84
|
+
window.SUMMIT_ID = processEnv[SUMMIT_ID];
|
|
85
|
+
window.MARKETING_API_BASE_URL = processEnv[MARKETING_API_BASE_URL];
|
|
86
|
+
window.REGISTRATION_BASE_URL = processEnv[REGISTRATION_BASE_URL];
|
|
87
|
+
window.AUTHZ_USER_GROUPS = processEnv[AUTHZ_USER_GROUPS];
|
|
88
|
+
window.AUTHORIZED_DEFAULT_PATH = processEnv[AUTHORIZED_DEFAULT_PATH];
|
|
89
|
+
window.STREAM_IO_API_KEY = processEnv[STREAM_IO_API_KEY];
|
|
90
|
+
window.MUX_ENV_KEY = processEnv[MUX_ENV_KEY];
|
|
91
|
+
window.DISQUS_SHORTNAME = processEnv[DISQUS_SHORTNAME];
|
|
92
|
+
window.SUPABASE_URL = processEnv[SUPABASE_URL];
|
|
93
|
+
window.SUPABASE_KEY = processEnv[SUPABASE_KEY];
|
|
94
|
+
window.CHAT_API_BASE_URL = processEnv[CHAT_API_BASE_URL];
|
|
95
|
+
window.SCHEDULE_EXCLUDING_TAGS = processEnv[SCHEDULE_EXCLUDING_TAGS];
|
|
96
|
+
window.LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS = processEnv[LIVE_EVENT_THUMBNAIL_GIF_CAPTURE_STARTS];
|
|
97
|
+
window.SUPPORT_EMAIL = processEnv[SUPPORT_EMAIL];
|
|
98
|
+
window.WS_PUB_SERVER_URL = processEnv[WS_PUB_SERVER_URL];
|
|
99
|
+
window.REAL_TIME_UPDATES_STRATEGY = processEnv[REAL_TIME_UPDATES_STRATEGY];
|
|
100
|
+
window.TIMEINTERVALSINCE1970_API_URL = processEnv[TIMEINTERVALSINCE1970_API_URL];
|
|
101
|
+
window.ABLY_API_KEY = processEnv[ABLY_API_KEY];
|
|
102
|
+
window.GOOGLE_TAGMANAGER_ID = processEnv[GOOGLE_TAGMANAGER_ID];
|
|
103
103
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import EventEmitter from "./EventEmitter";
|
|
2
|
+
|
|
3
|
+
export const INIT_LOGOUT_EVENT = "site_logout";
|
|
4
|
+
export const TAG_MANAGER_TRACK_EVENT = "tag_manager_track_event";
|
|
5
|
+
export const TAG_MANAGER_CONSENT_EVENT = "tag_manager_consent_event";
|
|
6
|
+
|
|
7
|
+
const eventEmitter = new EventEmitter();
|
|
8
|
+
|
|
9
|
+
export const triggerLogoutEvent = () => {
|
|
10
|
+
eventEmitter.emit(INIT_LOGOUT_EVENT);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const triggerTagManagerTrackEvent = (eventName, eventParams) => {
|
|
14
|
+
eventEmitter.emit(TAG_MANAGER_TRACK_EVENT, { eventName, eventParams });
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const triggerTagManagerConsentEvent = (consentArg, consentParams) => {
|
|
18
|
+
eventEmitter.emit(TAG_MANAGER_CONSENT_EVENT, { consentArg, consentParams });
|
|
19
|
+
};
|
package/src/utils/filePath.js
CHANGED
|
@@ -7,7 +7,7 @@ const CONTENT_PAGES_DIR_PATH = `${PAGES_DIR_PATH}/${CONTENT_PAGES_PATH_NAME}`;
|
|
|
7
7
|
const STYLES_DIR_PATH = "src/styles";
|
|
8
8
|
const DEFAULT_COLORS_FILE_PATH = `${DEFAULTS_DIR_PATH}/colors.json`;
|
|
9
9
|
const COLORS_FILE_PATH = `${DATA_DIR_PATH}/colors.json`;
|
|
10
|
-
const
|
|
10
|
+
const COLORS_SCSS_FILE_PATH = `${STYLES_DIR_PATH}/colors.scss`
|
|
11
11
|
const FONTS_SCSS_FILE_PATH = `${STYLES_DIR_PATH}/fonts.scss`;
|
|
12
12
|
const SITE_SETTINGS_DIR_PATH = `${STATIC_CONTENT_DIR_PATH}/site-settings`;
|
|
13
13
|
const SITE_SETTINGS_FILE_PATH = `${SITE_SETTINGS_DIR_PATH}/index.json`;
|
|
@@ -63,7 +63,7 @@ exports.CONTENT_PAGES_PATH_NAME = CONTENT_PAGES_PATH_NAME;
|
|
|
63
63
|
exports.CONTENT_PAGES_DIR_PATH = CONTENT_PAGES_DIR_PATH;
|
|
64
64
|
exports.DEFAULT_COLORS_FILE_PATH = DEFAULT_COLORS_FILE_PATH;
|
|
65
65
|
exports.COLORS_FILE_PATH = COLORS_FILE_PATH;
|
|
66
|
-
exports.
|
|
66
|
+
exports.COLORS_SCSS_FILE_PATH = COLORS_SCSS_FILE_PATH;
|
|
67
67
|
exports.FONTS_SCSS_FILE_PATH = FONTS_SCSS_FILE_PATH;
|
|
68
68
|
exports.SITE_SETTINGS_DIR_PATH = SITE_SETTINGS_DIR_PATH;
|
|
69
69
|
exports.SITE_SETTINGS_FILE_PATH = SITE_SETTINGS_FILE_PATH;
|
package/src/utils/hooks/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import EventEmitter from "../EventEmitter";
|
|
3
|
+
|
|
4
|
+
const eventEmitter = new EventEmitter();
|
|
5
|
+
|
|
6
|
+
const useEventListener = (eventName, callback, options) => {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
eventEmitter.on(eventName, callback, options);
|
|
9
|
+
return () => {
|
|
10
|
+
eventEmitter.off(eventName, callback, options);
|
|
11
|
+
};
|
|
12
|
+
}, [eventName, callback, options]);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default useEventListener;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import useEventListener from "./useEventListener";
|
|
2
3
|
|
|
3
4
|
const useResize = (callback, options = { passive: true }) => {
|
|
4
5
|
const handleResize = useCallback(() => {
|
|
@@ -7,13 +8,7 @@ const useResize = (callback, options = { passive: true }) => {
|
|
|
7
8
|
}
|
|
8
9
|
}, [callback]);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
handleResize();
|
|
12
|
-
window.addEventListener("resize", handleResize, options);
|
|
13
|
-
return () => {
|
|
14
|
-
window.removeEventListener("resize", handleResize);
|
|
15
|
-
};
|
|
16
|
-
}, [handleResize]);
|
|
11
|
+
useEventListener("resize", handleResize, options);
|
|
17
12
|
};
|
|
18
13
|
|
|
19
14
|
export default useResize;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
const basePackageDir = path.resolve(__dirname, "../..");
|
|
5
|
+
|
|
6
|
+
const { DEFAULT_COLORS_FILE_PATH } = require("./filePath");
|
|
7
|
+
const DEFAULT_COLORS_DATA = require(path.join(basePackageDir, DEFAULT_COLORS_FILE_PATH));
|
|
8
|
+
|
|
9
|
+
const generateAndWriteScssFile = (generatorFn, data, outputPath) => {
|
|
10
|
+
if (!data || Object.keys(data).length === 0) {
|
|
11
|
+
console.error(`No data provided for SCSS file generation at ${outputPath}.`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const scssFileContent = generatorFn(data);
|
|
15
|
+
if (!scssFileContent) {
|
|
16
|
+
console.error(`Failed to generate content for ${outputPath} SCSS file.`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
// since files are autogenerated, always write them in package scope
|
|
21
|
+
outputPath = path.join(basePackageDir, outputPath);
|
|
22
|
+
fs.writeFileSync(outputPath, scssFileContent);
|
|
23
|
+
console.log(`SCSS file generated successfully at ${outputPath}`);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.error(`Error writing SCSS file: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const getFontFormat = (format) => {
|
|
30
|
+
const formatMap = {
|
|
31
|
+
"ttf": "format(\"truetype\")",
|
|
32
|
+
"otf": "format(\"opentype\")",
|
|
33
|
+
"woff": "format(\"woff\")",
|
|
34
|
+
"woff2": "format(\"woff2\")",
|
|
35
|
+
};
|
|
36
|
+
return formatMap[format] || "";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getFontSrc = (fontPath) => fontPath.replace(/^\/static/, "");
|
|
40
|
+
|
|
41
|
+
const generateFontFace = (fontFamily, fontData, fontWeight) => {
|
|
42
|
+
if (!fontFamily || !fontData || !fontData.fontFile || !fontData.fontFormat) return "";
|
|
43
|
+
|
|
44
|
+
const { fontFile, fontFormat } = fontData;
|
|
45
|
+
return `@font-face {
|
|
46
|
+
font-family: "${fontFamily}";
|
|
47
|
+
src: url("${getFontSrc(fontFile)}") ${getFontFormat(fontFormat)};
|
|
48
|
+
font-weight: ${fontWeight};
|
|
49
|
+
}`;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const generateFontScssFile = (fontsData) => {
|
|
53
|
+
if (!fontsData || !fontsData.fontFamily || !fontsData.regularFont || !fontsData.boldFont) return null;
|
|
54
|
+
|
|
55
|
+
const { fontFamily, regularFont, boldFont } = fontsData;
|
|
56
|
+
|
|
57
|
+
if (!regularFont.fontFile || !regularFont.fontFormat) return null;
|
|
58
|
+
if (!boldFont.fontFile || !boldFont.fontFormat) return null;
|
|
59
|
+
|
|
60
|
+
const regularFontFace = generateFontFace(fontFamily, regularFont, "normal");
|
|
61
|
+
const boldFontFace = generateFontFace(fontFamily, boldFont, "bold");
|
|
62
|
+
|
|
63
|
+
return `$font-family: "${fontFamily}";
|
|
64
|
+
|
|
65
|
+
:root {
|
|
66
|
+
--font_family: "${fontFamily}" !important;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
${regularFontFace}
|
|
70
|
+
${boldFontFace}
|
|
71
|
+
|
|
72
|
+
%font-regular {
|
|
73
|
+
font-family: var(--font_family);
|
|
74
|
+
font-weight: 400;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
%font-semi {
|
|
78
|
+
font-family: var(--font_family);
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
%font-bold {
|
|
83
|
+
font-family: var(--font_family);
|
|
84
|
+
font-weight: 700;
|
|
85
|
+
}`;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const generateColorsScssFile = (colorsData) => {
|
|
89
|
+
const mergedColorsData = { ...DEFAULT_COLORS_DATA, ...colorsData };
|
|
90
|
+
|
|
91
|
+
let colorVars = "";
|
|
92
|
+
for (const [key, value] of Object.entries(mergedColorsData)) {
|
|
93
|
+
colorVars += `$${key}: ${value};\n`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const rootColors = `
|
|
97
|
+
:root {
|
|
98
|
+
--color_primary: #{$color_primary};
|
|
99
|
+
--color_primary_contrast: #{$color_primary_contrast};
|
|
100
|
+
--color_secondary: #{$color_secondary};
|
|
101
|
+
--color_secondary_contrast: #{$color_secondary_contrast};
|
|
102
|
+
--color_text_dark: #{$color_text_dark};
|
|
103
|
+
--color_text_med: #{$color_text_med};
|
|
104
|
+
--color_text_light: #{$color_text_light};
|
|
105
|
+
--color_background_light: #{$color_background_light};
|
|
106
|
+
--color_background_dark: #{$color_background_dark};
|
|
107
|
+
--color_gray_darker: #{$color_gray_darker};
|
|
108
|
+
--color_gray_dark: #{$color_gray_dark};
|
|
109
|
+
--color_gray_light: #{$color_gray_light};
|
|
110
|
+
--color_gray_lighter: #{$color_gray_lighter};
|
|
111
|
+
--color_input_text_color: #{$color_input_text_color_light};
|
|
112
|
+
--color_input_background_color: #{$color_input_background_color_light};
|
|
113
|
+
--color_input_border_color: #{$color_input_border_color_light};
|
|
114
|
+
--color_text_input_hints: #{$color_text_input_hints_light};
|
|
115
|
+
--color_horizontal_rule: #{$color_horizontal_rule_light};
|
|
116
|
+
--color_icon_light: #{$color_icon_light};
|
|
117
|
+
--color_button_background_color: #{$color_button_background_color};
|
|
118
|
+
--color_button_color: #{$color_button_color};
|
|
119
|
+
--color_alerts: #{$color_alerts};
|
|
120
|
+
}`;
|
|
121
|
+
|
|
122
|
+
const darkThemeColors = `
|
|
123
|
+
html[data-theme="DARK"] {
|
|
124
|
+
--color_text_dark: #{$color_text_light} !important;
|
|
125
|
+
--color_text_light: #{$color_text_dark} !important;
|
|
126
|
+
--color_background_light: #{$color_background_dark} !important;
|
|
127
|
+
--color_background_dark: #{$color_background_light} !important;
|
|
128
|
+
--color_gray_darker: #{$color_gray_lighter} !important;
|
|
129
|
+
--color_gray_dark: #{$color_gray_light} !important;
|
|
130
|
+
--color_gray_light: #{$color_gray_dark} !important;
|
|
131
|
+
--color_gray_lighter: #{$color_gray_darker} !important;
|
|
132
|
+
--color_input_text_color: #{$color_input_text_color_dark} !important;
|
|
133
|
+
--color_input_background_color: #{$color_input_background_color_dark} !important;
|
|
134
|
+
--color_input_border_color: #{$color_input_border_color_dark} !important;
|
|
135
|
+
--color_text_input_hints: #{$color_text_input_hints_dark} !important;
|
|
136
|
+
--color_horizontal_rule: #{$color_horizontal_rule_dark} !important;
|
|
137
|
+
}`;
|
|
138
|
+
|
|
139
|
+
return `${colorVars}${rootColors}${darkThemeColors}`;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
module.exports = {
|
|
143
|
+
generateAndWriteScssFile,
|
|
144
|
+
generateFontScssFile,
|
|
145
|
+
generateColorsScssFile
|
|
146
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import TagManagerProvider from "./TagManagerProvider";
|
|
2
|
+
import EventEmitter from "../EventEmitter";
|
|
3
|
+
import { TAG_MANAGER_TRACK_EVENT, TAG_MANAGER_CONSENT_EVENT } from "../eventTriggers";
|
|
4
|
+
import { normalizeData } from "../dataNormalization";
|
|
5
|
+
|
|
6
|
+
const eventEmitter = new EventEmitter();
|
|
7
|
+
|
|
8
|
+
class TagManager {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.providers = [];
|
|
11
|
+
eventEmitter.on(TAG_MANAGER_TRACK_EVENT, this.handleTrackEvent.bind(this));
|
|
12
|
+
eventEmitter.on(TAG_MANAGER_CONSENT_EVENT, this.handleConsentEvent.bind(this));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
addProvider(provider) {
|
|
16
|
+
if (!(provider instanceof TagManagerProvider)) {
|
|
17
|
+
throw new Error("An instance of TagManagerProvider is required.");
|
|
18
|
+
}
|
|
19
|
+
this.providers.push(provider);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
trackEvent = (eventName, eventParams) => {
|
|
23
|
+
this.providers.forEach(provider => provider.trackEvent(eventName, normalizeData(eventParams)));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handleTrackEvent = (event) => {
|
|
27
|
+
const { eventName, eventParams } = event.detail;
|
|
28
|
+
this.trackEvent(eventName, eventParams);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
consent = (consentArg, consentParams) => {
|
|
32
|
+
this.providers.forEach(provider => provider.consent && provider.consent(consentArg, consentParams));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
handleConsentEvent = (event) => {
|
|
36
|
+
const { consentArg, consentParams } = event.detail;
|
|
37
|
+
this.consent(consentArg, consentParams);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default TagManager;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import TagManagerProvider from "../TagManagerProvider";
|
|
2
|
+
import { getEnvVariable, GOOGLE_TAGMANAGER_ID } from "@utils/envVariables";
|
|
3
|
+
|
|
4
|
+
class GoogleTagManagerProvider extends TagManagerProvider {
|
|
5
|
+
static instance;
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
if (GoogleTagManagerProvider.instance) {
|
|
9
|
+
return GoogleTagManagerProvider.instance;
|
|
10
|
+
}
|
|
11
|
+
super();
|
|
12
|
+
if (!getEnvVariable(GOOGLE_TAGMANAGER_ID)) {
|
|
13
|
+
console.warn("GoogleTagManagerProvider: GOOGLE_TAGMANAGER_ID environment variable is not set. Tracking will be disabled.");
|
|
14
|
+
}
|
|
15
|
+
if (typeof window !== "undefined") {
|
|
16
|
+
window.dataLayer = window.dataLayer || [];
|
|
17
|
+
this.dataLayer = window.dataLayer;
|
|
18
|
+
} else {
|
|
19
|
+
this.dataLayer = [];
|
|
20
|
+
}
|
|
21
|
+
GoogleTagManagerProvider.instance = this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#gtag() {
|
|
25
|
+
this.dataLayer.push(arguments);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
trackEvent = (eventName, eventParams) => {
|
|
29
|
+
this.#gtag("event", eventName, eventParams);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
config = (targetId, additionalConfig) => {
|
|
33
|
+
this.#gtag("config", targetId, additionalConfig);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
set = (parameters) => {
|
|
37
|
+
this.#gtag("set", parameters);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
get = (target, fieldName, callback) => {
|
|
41
|
+
this.#gtag("get", target, fieldName, callback);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
consent = (consentArg, consentParams) => {
|
|
45
|
+
this.#gtag("consent", consentArg, consentParams);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default GoogleTagManagerProvider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import AnalyticsProvider from "./AnalyticsProvider";
|
|
2
|
-
import { CustomEventManager, ANALYTICS_TRACK_EVENT } from "../customEvents";
|
|
3
|
-
import { normalizeData } from "@utils/dataNormalization";
|
|
4
|
-
|
|
5
|
-
class AnalyticsManager {
|
|
6
|
-
constructor(analyticsProvider) {
|
|
7
|
-
if (!(analyticsProvider instanceof AnalyticsProvider)) {
|
|
8
|
-
throw new Error("An instance of AnalyticsProvider is required.");
|
|
9
|
-
}
|
|
10
|
-
this.analyticsProvider = analyticsProvider;
|
|
11
|
-
CustomEventManager.addEventListener(ANALYTICS_TRACK_EVENT, this.handleTrackEvent.bind(this));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get provider() {
|
|
15
|
-
return this.analyticsProvider;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
handleTrackEvent = (event) => {
|
|
19
|
-
const { eventName, eventParams } = event.detail;
|
|
20
|
-
this.trackEvent(eventName, eventParams);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
trackEvent = (eventName, eventParams) => {
|
|
24
|
-
this.analyticsProvider.trackEvent(eventName, normalizeData(eventParams));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default AnalyticsManager;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const PURCHASE_COMPLETE = "purchase_complete";
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import AnalyticsProvider from "../AnalyticsProvider";
|
|
2
|
-
import { getEnvVariable, GOOGLE_TAGMANAGER_ID } from "@utils/envVariables";
|
|
3
|
-
|
|
4
|
-
class GoogleTagManagerProvider extends AnalyticsProvider {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
if (!getEnvVariable(GOOGLE_TAGMANAGER_ID)) {
|
|
8
|
-
console.warn("GoogleTagManagerProvider: GOOGLE_TAGMANAGER_ID environment variable is not set. Tracking will be disabled.");
|
|
9
|
-
}
|
|
10
|
-
this.dataLayer = (typeof window !== "undefined" && window.dataLayer) || [];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
gtag() {
|
|
14
|
-
this.dataLayer.push(arguments);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
trackEvent = (eventName, eventParams) => {
|
|
18
|
-
this.gtag("event", eventName, eventParams);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
config = (targetId, additionalConfig) => {
|
|
22
|
-
this.gtag("config", targetId, additionalConfig);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
set = (parameters) => {
|
|
26
|
-
this.gtag("set", parameters);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
get = (target, fieldName, callback) => {
|
|
30
|
-
this.gtag("get", target, fieldName, callback);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
consent = (consentArg, consentParams) => {
|
|
34
|
-
this.gtag("consent", consentArg, consentParams);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default GoogleTagManagerProvider;
|