• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / gui / 1493849842

13 Oct 2024 07:39AM UTC coverage: 83.457% (-16.5%) from 99.965%
1493849842

Pull #4531

gitlab-ci

web-flow
chore: Bump send and express in /tests/e2e_tests

Bumps [send](https://github.com/pillarjs/send) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `send` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/pillarjs/send/releases)
- [Changelog](https://github.com/pillarjs/send/blob/master/HISTORY.md)
- [Commits](https://github.com/pillarjs/send/compare/0.18.0...0.19.0)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: send
  dependency-type: indirect
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #4531: chore: Bump send and express in /tests/e2e_tests

4486 of 6422 branches covered (69.85%)

8551 of 10246 relevant lines covered (83.46%)

151.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.76
/src/js/tracking.js
1
import ReactGA4 from 'react-ga4';
2

3
const cookieConsentCSS = 'https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css';
184✔
4
const cookieConsentJS = 'https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js';
184✔
5

6
const ReactGA = ReactGA4.default;
184✔
7

8
class Tracker {
9
  constructor() {
10
    this.initialized = false;
184✔
11
    this.trackingEnabled = true;
184✔
12
    this.currentPageView = null;
184✔
13
    this.currentOrganizationUser = null;
184✔
14
  }
15
  cookieconsent() {
16
    return new Promise(resolve => {
3✔
17
      const style = document.createElement('link');
3✔
18
      style.href = cookieConsentCSS;
3✔
19
      style.rel = 'stylesheet';
3✔
20
      style.async = true;
3✔
21
      document.head.appendChild(style);
3✔
22
      //
23
      const script = document.createElement('script');
3✔
24
      script.src = cookieConsentJS;
3✔
25
      script.async = false;
3✔
26
      script.addEventListener('load', () => {
3✔
27
        window.cookieconsent.initialise({
×
28
          palette: {
29
            popup: {
30
              background: '#5d0f43',
31
              text: '#ffffff'
32
            },
33
            button: {
34
              background: '#73a4ad',
35
              text: '#ffffff'
36
            }
37
          },
38
          position: 'bottom-left',
39
          type: 'opt-out',
40
          content: {
41
            message: 'We use cookies to analyze our traffic so we can improve our website and give you a better experience.',
42
            link: 'View our cookie policy',
43
            href: 'https://northern.tech/legal/cookies'
44
          },
45
          autoOpen: true,
46
          revokable: false,
47
          law: {
48
            regionalLaw: false
49
          },
50
          onStatusChange: status => {
51
            let hasConsented = status == 'allow';
×
52
            resolve({ trackingConsentGiven: hasConsented });
×
53
          }
54
        });
55
      });
56
      document.body.appendChild(script);
3✔
57
    });
58
  }
59
  exception(error) {
60
    if (this.initialized && this.trackingEnabled) {
×
61
      ReactGA.event('error', error);
×
62
    }
63
  }
64
  event(data) {
65
    if (this.initialized && this.trackingEnabled) {
41!
66
      ReactGA.event(data);
×
67
    }
68
  }
69
  initialize(trackingCode) {
70
    if (this.initialized && this.trackingEnabled) {
×
71
      return false;
×
72
    }
73
    ReactGA.initialize(trackingCode);
×
74
    this.initialized = true;
×
75
    return true;
×
76
  }
77
  pageview(data) {
78
    if (data) {
6!
79
      this.currentPageView = data;
6✔
80
    }
81
  }
82
  set(value) {
83
    if (this.initialized && this.trackingEnabled) {
×
84
      ReactGA.set(value);
×
85
    }
86
  }
87
  setOrganizationUser(organization, user) {
88
    if (this.initialized && this.trackingEnabled && this.currentOrganizationUser != { organization, user }) {
×
89
      this.currentOrganizationUser = { organization, user };
×
90
      this.set({ dimension1: organization.plan });
×
91
      this.set({ dimension2: organization.id });
×
92
      this.set({ dimension3: user.id });
×
93
      this.set({ userId: user.id });
×
94
    }
95
  }
96
  setTrackingEnabled(trackingEnabled) {
97
    this.trackingEnabled = trackingEnabled;
12✔
98
  }
99
}
100

101
const Tracking = new Tracker();
184✔
102
export default Tracking;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc