@codecademy/tracking 1.0.49-alpha.eda04bfb95.0 → 1.0.50-alpha.12b1068c76.0
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/dist/events/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initializeFides: () => void
|
|
1
|
+
export declare const initializeFides: () => Promise<void>;
|
|
@@ -4,30 +4,48 @@ import { theme } from '@codecademy/gamut-styles';
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const PROPERTY_ID = 'FDS-3RC5S1';
|
|
7
|
+
const FIDES_TIMEOUT = 10000; // 10 seconds
|
|
8
|
+
|
|
9
|
+
const ot_fides_mapping = encodeURIComponent(JSON.stringify({
|
|
10
|
+
C0001: ['essential'],
|
|
11
|
+
C0002: ['analytics'],
|
|
12
|
+
C0003: ['functional'],
|
|
13
|
+
C0004: ['marketing']
|
|
14
|
+
}));
|
|
7
15
|
export const initializeFides = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const timeout = setTimeout(() => {
|
|
18
|
+
reject(new Error('Fides initialization timed out'));
|
|
19
|
+
}, FIDES_TIMEOUT);
|
|
20
|
+
window.addEventListener('FidesInitialized', () => {
|
|
21
|
+
clearTimeout(timeout);
|
|
22
|
+
const fides = window.Fides;
|
|
23
|
+
try {
|
|
24
|
+
fides.gtm();
|
|
25
|
+
const unsubscribe = fides.onFidesEvent('FidesUIShown', detail => {
|
|
26
|
+
if (detail.extraDetails.servingComponent === 'banner') {
|
|
27
|
+
const banner = document.getElementById('fides-banner');
|
|
28
|
+
if (banner) {
|
|
29
|
+
banner.setAttribute('tabIndex', '-1');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
unsubscribe();
|
|
33
|
+
});
|
|
34
|
+
resolve();
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error('Error initializing Fides', err);
|
|
37
|
+
reject(err);
|
|
23
38
|
}
|
|
24
|
-
unsubscribe();
|
|
25
39
|
});
|
|
40
|
+
const script = document.createElement('script');
|
|
41
|
+
script.setAttribute('async', 'true');
|
|
42
|
+
script.setAttribute('src', `https://skillsoft-codecademy.fides-cdn.ethyca.com/fides.js?property_id=${PROPERTY_ID}&ot_fides_mapping=${ot_fides_mapping}`);
|
|
43
|
+
script.setAttribute('type', 'text/javascript');
|
|
44
|
+
document.body.appendChild(script);
|
|
45
|
+
const style = document.createElement('style');
|
|
46
|
+
style.textContent = rawStyles;
|
|
47
|
+
document.body.appendChild(style);
|
|
26
48
|
});
|
|
27
|
-
document.body.appendChild(script);
|
|
28
|
-
const style = document.createElement('style');
|
|
29
|
-
style.textContent = rawStyles;
|
|
30
|
-
document.body.appendChild(style);
|
|
31
49
|
};
|
|
32
50
|
|
|
33
51
|
// For now, these three values duplicate theme colors from gamut-styles
|
|
@@ -129,6 +147,7 @@ div#fides-overlay {
|
|
|
129
147
|
|
|
130
148
|
#fides-modal .fides-modal-title {
|
|
131
149
|
text-align: left !important;
|
|
150
|
+
font-size: 20px !important;
|
|
132
151
|
}
|
|
133
152
|
|
|
134
153
|
div#fides-banner-container {
|
|
@@ -17,7 +17,7 @@ export const initializeTrackingIntegrations = async _ref => {
|
|
|
17
17
|
if (init) return; // Prevent multiple initializations
|
|
18
18
|
init = true;
|
|
19
19
|
if (enablePartytown) {
|
|
20
|
-
|
|
20
|
+
initializePartytown();
|
|
21
21
|
} else {
|
|
22
22
|
// Wait to allow any other post-hydration logic to run first
|
|
23
23
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
@@ -34,7 +34,7 @@ export const initializeTrackingIntegrations = async _ref => {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// Load GTM
|
|
37
|
-
|
|
37
|
+
initializeGTM({
|
|
38
38
|
scope,
|
|
39
39
|
environment,
|
|
40
40
|
optedOutExternalTracking,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/tracking",
|
|
3
3
|
"description": "Tracking library for Codecademy",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.50-alpha.12b1068c76.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@qwik.dev/partytown": "0.11.0"
|