@codecademy/tracking 1.0.49 → 1.0.50-alpha.407b56bc17.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,42 @@ import { theme } from '@codecademy/gamut-styles';
4
4
  */
5
5
 
6
6
  const PROPERTY_ID = 'FDS-3RC5S1';
7
+ const ot_fides_mapping = encodeURIComponent(JSON.stringify({
8
+ C0001: ['essential'],
9
+ C0002: ['analytics'],
10
+ C0003: ['functional'],
11
+ C0004: ['marketing']
12
+ }));
7
13
  export const initializeFides = () => {
8
14
  const script = document.createElement('script');
9
15
  script.setAttribute('async', 'true');
10
- script.setAttribute('src', `https://skillsoft-codecademy.fides-cdn.ethyca.com/fides.js?property_id=${PROPERTY_ID}`);
16
+ script.setAttribute('src', `https://skillsoft-codecademy.fides-cdn.ethyca.com/fides.js?property_id=${PROPERTY_ID}&ot_fides_mapping=${ot_fides_mapping}`);
11
17
  script.setAttribute('type', 'text/javascript');
12
- script.addEventListener('load', () => {
13
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14
- // @ts-ignore
15
- const fides = window.Fides;
16
- fides.gtm();
17
- const unsubscribe = fides.onFidesEvent('FidesUIShown', detail => {
18
- if (detail.extraDetails.servingComponent === 'banner') {
19
- const banner = document.getElementById('fides-banner');
20
- if (banner) {
21
- banner.setAttribute('tabIndex', '-1');
22
- }
23
- }
24
- unsubscribe();
25
- });
26
- });
27
18
  document.body.appendChild(script);
28
19
  const style = document.createElement('style');
29
20
  style.textContent = rawStyles;
30
21
  document.body.appendChild(style);
22
+ return new Promise((resolve, reject) => {
23
+ window.addEventListener('FidesInitialized', () => {
24
+ const fides = window.Fides;
25
+ try {
26
+ fides.gtm();
27
+ resolve();
28
+ const unsubscribe = fides.onFidesEvent('FidesUIShown', detail => {
29
+ if (detail.extraDetails.servingComponent === 'banner') {
30
+ const banner = document.getElementById('fides-banner');
31
+ if (banner) {
32
+ banner.setAttribute('tabIndex', '-1');
33
+ }
34
+ }
35
+ unsubscribe();
36
+ });
37
+ } catch (err) {
38
+ console.error('Error initializing Fides', err);
39
+ reject(err);
40
+ }
41
+ });
42
+ });
31
43
  };
32
44
 
33
45
  // For now, these three values duplicate theme colors from gamut-styles
@@ -129,6 +141,7 @@ div#fides-overlay {
129
141
 
130
142
  #fides-modal .fides-modal-title {
131
143
  text-align: left !important;
144
+ font-size: 20px !important;
132
145
  }
133
146
 
134
147
  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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/tracking",
3
3
  "description": "Tracking library for Codecademy",
4
- "version": "1.0.49",
4
+ "version": "1.0.50-alpha.407b56bc17.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "dependencies": {
7
7
  "@qwik.dev/partytown": "0.11.0"