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

mozilla / fx-private-relay / 2277163c-118e-4992-9881-c04b22beeba1

12 Jan 2024 03:56PM CUT coverage: 73.584%. Remained the same
2277163c-118e-4992-9881-c04b22beeba1

push

circleci

jwhitlock
Switch from pycopg2 2.9.9 to psycopg 3.1.17

Django 4.2 supports psycopg 3, a new implementation of the PostgreSQL
adapter. It recommends it for new projects, and says psycopg2 may be
deprecated in the future.

1968 of 2925 branches covered (0.0%)

Branch coverage included in aggregate %.

6319 of 8337 relevant lines covered (75.79%)

20.08 hits per line

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

0.0
/frontend/src/components/layout/topmessage/NpsSurvey.tsx
1
import { event as gaEvent } from "react-ga";
×
2
import styles from "./NpsSurvey.module.scss";
×
3
import { useFirstSeen } from "../../../hooks/firstSeen";
×
4
import { useLocalDismissal } from "../../../hooks/localDismissal";
×
5
import { useIsLoggedIn } from "../../../hooks/session";
×
6
import { useProfiles } from "../../../hooks/api/profile";
×
7
import { CloseIcon } from "../../Icons";
×
8
import { useL10n } from "../../../hooks/l10n";
×
9

10
/**
11
 * Quickly survey the user for input to our Net Promotor Score.
12
 *
13
 * @deprecated We'll replace this with {@link CsatSurvey}.
14
 */
15
export const NpsSurvey = () => {
×
16
  const profileData = useProfiles();
×
17
  const dismissal = useLocalDismissal(
×
18
    "nps-survey_" + profileData.data?.[0].id,
19
    { duration: 30 * 24 * 60 * 60 },
20
  );
21
  const firstSeen = useFirstSeen();
×
22
  const isLoggedIn = useIsLoggedIn();
×
23
  const l10n = useL10n();
×
24

25
  const hasBeenUserForThreeDays =
26
    isLoggedIn &&
×
27
    firstSeen instanceof Date &&
28
    Date.now() - firstSeen.getTime() > 3 * 24 * 60 * 60;
29

30
  // TODO: Show if either the user has been one for three days,
31
  // *or* they've been a Premium customer for three days:
32
  if (dismissal.isDismissed || !hasBeenUserForThreeDays) {
×
33
    return null;
×
34
  }
35

36
  const submit = (likelihood: number) => {
×
37
    dismissal.dismiss();
×
38
    let label = "passive";
×
39
    let npsValue = 0;
×
40
    if (likelihood <= 6) {
×
41
      label = "detractor";
×
42
      npsValue = -1;
×
43
    }
44
    if (likelihood >= 9) {
×
45
      label = "promoter";
×
46
      npsValue = 1;
×
47
    }
48
    gaEvent({
×
49
      category: "NPS Survey",
50
      action: "submitted",
51
      label: label,
52
      value: likelihood,
53
      dimension1: label,
54
      metric1: 1,
55
      metric2: likelihood,
56
      metric3: npsValue,
57
    });
58
  };
59

60
  return (
61
    <aside className={styles.wrapper}>
62
      <div className={styles.prompt}>{l10n.getString("survey-question-1")}</div>
63
      <div className={styles.scale}>
64
        <span aria-hidden={true} className={styles.legend}>
65
          {l10n.getString("survey-option-not-likely")}
66
        </span>
67
        <ol>
68
          <li>
69
            <button className={styles.likelihood} onClick={() => submit(1)}>
×
70
              1
71
            </button>
72
          </li>
73
          <li>
74
            <button className={styles.likelihood} onClick={() => submit(2)}>
×
75
              2
76
            </button>
77
          </li>
78
          <li>
79
            <button className={styles.likelihood} onClick={() => submit(3)}>
×
80
              3
81
            </button>
82
          </li>
83
          <li>
84
            <button className={styles.likelihood} onClick={() => submit(4)}>
×
85
              4
86
            </button>
87
          </li>
88
          <li>
89
            <button className={styles.likelihood} onClick={() => submit(5)}>
×
90
              5
91
            </button>
92
          </li>
93
          <li>
94
            <button className={styles.likelihood} onClick={() => submit(6)}>
×
95
              6
96
            </button>
97
          </li>
98
          <li>
99
            <button className={styles.likelihood} onClick={() => submit(7)}>
×
100
              7
101
            </button>
102
          </li>
103
          <li>
104
            <button className={styles.likelihood} onClick={() => submit(8)}>
×
105
              8
106
            </button>
107
          </li>
108
          <li>
109
            <button className={styles.likelihood} onClick={() => submit(9)}>
×
110
              9
111
            </button>
112
          </li>
113
          <li>
114
            <button className={styles.likelihood} onClick={() => submit(10)}>
×
115
              10
116
            </button>
117
          </li>
118
        </ol>
119
        <span aria-hidden={true} className={styles.legend}>
120
          {l10n.getString("survey-option-very-likely")}
121
        </span>
122
      </div>
123
      <button
124
        className={styles["dismiss-button"]}
125
        onClick={() => dismissal.dismiss()}
×
126
        title={l10n.getString("survey-option-dismiss")}
127
      >
128
        <CloseIcon alt={l10n.getString("survey-option-dismiss")} />
129
      </button>
130
    </aside>
131
  );
132
};
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