@codecademy/tracking 1.0.49 → 1.0.50-alpha.19dedbdf28.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.
|
@@ -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 {
|
|
@@ -23,7 +23,7 @@ export const initializeTrackingIntegrations = async _ref => {
|
|
|
23
23
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
24
24
|
}
|
|
25
25
|
if (isFidesEnabled) {
|
|
26
|
-
initializeFides();
|
|
26
|
+
await initializeFides();
|
|
27
27
|
} else {
|
|
28
28
|
// Load in OneTrust's banner and wait for its `OptanonWrapper` callback
|
|
29
29
|
await initializeOneTrust({
|
package/package.json
CHANGED