qpp-style 9.37.0 → 9.38.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.
@@ -8,7 +8,6 @@ import { OpenInNewIcon } from "../../lib/SvgComponents";
8
8
  const infoTipLabel =
9
9
  "When dialing 711, you will automatically be connected to a TRS Communications Assistant who will relay your conversation to the help desk agent with strict confidentiality.";
10
10
  const { version: buildVersion } = pjson;
11
-
12
11
  const FooterUI = () => (
13
12
  <>
14
13
  <div className="feedback-session-sign-up">
@@ -98,6 +97,7 @@ const FooterUI = () => (
98
97
  1-866-288-8292 (TRS: 711)
99
98
  <span className="footer-trs-infotip">
100
99
  <InfoTip
100
+ aria-labelledby="footer-trs-infotip"
101
101
  ariaLabel="TRS Communications Assistant Information"
102
102
  label={infoTipLabel}
103
103
  />
@@ -101,7 +101,7 @@ const HeaderMenuItem = ({
101
101
  <button
102
102
  ref={menuButtonRef}
103
103
  className="menu-dropdown-toggle"
104
- aria-label={`${name} navigation dropdown`}
104
+ aria-label={`${name} ${subtitle} navigation dropdown`}
105
105
  aria-expanded={isOpen}
106
106
  aria-controls={`nav-section-${menuIdentifier}`}
107
107
  data-toggle="dropdown"
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { submissionsUrl } from "../SideNav/helpers";
4
3
  import { useHeaderState } from "./hooks";
5
4
  import { setUtagLink } from "./utag-helpers";
6
5
 
6
+ const submissionsUrl = "/user/submissions";
7
7
  // exclude submissions urls
8
8
  const isNotExcluded = (href) => !href.includes(submissionsUrl);
9
9
 
@@ -7,8 +7,8 @@ import {
7
7
  revertQppHasAuthsCookie,
8
8
  revertApmPaymentCookie,
9
9
  } from "../../session/logout";
10
- import { viewingToolUrl } from "../SideNav/helpers";
11
10
 
11
+ const viewingToolUrl = "/user/helpdesk-viewing-tool";
12
12
  const getViewType = (viewType) =>
13
13
  ({
14
14
  username: "HARP ID",
@@ -37,7 +37,7 @@ const touchHandlers = {
37
37
  * Tooltip with styled information icon
38
38
  */
39
39
  const Infotip = ({ ariaLabel, label, lightIcon, ...props }) => (
40
- <InfotipContent label={label} {...props}>
40
+ <InfotipContent label={label} id="info-tip" {...props}>
41
41
  <button
42
42
  type="button"
43
43
  aria-label={ariaLabel}
@@ -10,7 +10,7 @@ import {
10
10
  const TEXT_COLOR = "#FFF";
11
11
  const BACKGROUND_COLOR = "#333";
12
12
 
13
- const InfotipContent = ({ children, label }) => {
13
+ const InfotipContent = ({ children, label, id }) => {
14
14
  const tooltip = useTooltipState();
15
15
 
16
16
  const cssStyles = {
@@ -27,6 +27,7 @@ const InfotipContent = ({ children, label }) => {
27
27
  {children}
28
28
  </TooltipAnchor>
29
29
  <TooltipAriaKit
30
+ aria-labelledby={id}
30
31
  state={tooltip}
31
32
  className="tooltip-content"
32
33
  style={cssStyles}
@@ -41,6 +42,7 @@ const InfotipContent = ({ children, label }) => {
41
42
  InfotipContent.propTypes = {
42
43
  children: PropTypes.node.isRequired,
43
44
  label: PropTypes.node.isRequired,
45
+ id: PropTypes.node.isRequired,
44
46
  };
45
47
 
46
48
  export default InfotipContent;
@@ -11,45 +11,9 @@ const MINUTE = 60 * SECOND;
11
11
  const TWO_MINUTES = 2 * MINUTE;
12
12
  const DEFAULT_SESSION_CHECK_INTERVAL = TWO_MINUTES;
13
13
 
14
- // This Dialog shows up 2 minutes before the user session ends
15
- // giving the user an opportunity to refresh the token
16
- // or to sign out
17
- const InactiveDialog = () => {
18
- const [isOpen, setIsOpen] = useState(true);
19
-
20
- useEffect(() => {
21
- const timeout = setTimeout(() => logoutSession(window), TWO_MINUTES);
22
- return () => clearInterval(timeout);
23
- }, []);
24
-
25
- return (
26
- <Modal
27
- useDesignSystem
28
- title="You will be signed out within two minutes"
29
- isOpen={isOpen}
30
- primary={{
31
- title: "Keep me signed in",
32
- onClick: () => {
33
- refreshSession();
34
- setIsOpen(false);
35
- },
36
- }}
37
- secondary={{
38
- title: "Sign me out now",
39
- onClick: () => logoutSession(window),
40
- }}
41
- onRequestClose={() => setIsOpen(false)}
42
- >
43
- <p>
44
- You have been inactive for thirty minutes. For your security, we will
45
- sign you out automatically.
46
- </p>
47
- </Modal>
48
- );
49
- };
50
-
51
14
  // 120 seconds is 2 minutes
52
15
  const DEFAULT_WARNING_TIMEOUT_SECONDS = 120;
16
+
53
17
  function shouldShowInactiveDialog(
54
18
  timeRemainingSeconds,
55
19
  warningTimeoutSeconds = DEFAULT_WARNING_TIMEOUT_SECONDS,
@@ -58,18 +22,20 @@ function shouldShowInactiveDialog(
58
22
  }
59
23
 
60
24
  const Session = () => {
61
- const [isInactiveDialogOpen, setIsInactiveDialogOpen] = useState(false);
25
+ const [isOpen, setIsOpen] = useState(false);
26
+
27
+ let ttlInterval;
62
28
 
63
29
  useEffect(() => {
64
30
  let didCancel = false;
65
31
  const cookies = cookie.parse(document.cookie);
66
32
  const hasAuthToken = !!cookies.qpp_auth_token;
33
+
67
34
  async function isSessionValid() {
68
35
  if (hasAuthToken) {
69
36
  const timeRemaining = await fetchTtl(cookies.qpp_auth_token);
70
37
  // safeguard against unmounted component
71
38
  if (didCancel) return;
72
-
73
39
  // token expired
74
40
  if (timeRemaining === 0) {
75
41
  logoutSession(window);
@@ -77,23 +43,47 @@ const Session = () => {
77
43
  }
78
44
  // token is about to expire
79
45
  if (shouldShowInactiveDialog(timeRemaining)) {
80
- setIsInactiveDialogOpen(true);
46
+ setIsOpen(true);
81
47
  }
82
48
  }
83
49
  }
84
- isSessionValid();
85
- const interval = setInterval(
86
- isSessionValid,
87
- DEFAULT_SESSION_CHECK_INTERVAL,
88
- );
50
+
51
+ ttlInterval = setInterval(isSessionValid, DEFAULT_SESSION_CHECK_INTERVAL);
89
52
 
90
53
  return () => {
91
- clearInterval(interval);
54
+ clearInterval(ttlInterval);
92
55
  didCancel = true;
93
56
  };
94
57
  }, []);
95
58
 
96
- return <>{isInactiveDialogOpen && <InactiveDialog />}</>;
59
+ // This Dialog shows up 2 minutes before the user session ends
60
+ // giving the user an opportunity to refresh the token
61
+ // or to sign out
62
+ return (
63
+ <Modal
64
+ useDesignSystem
65
+ title="You will be signed out within two minutes"
66
+ isOpen={isOpen}
67
+ primary={{
68
+ title: "Keep me signed in",
69
+ onClick: () => {
70
+ refreshSession();
71
+ clearInterval(ttlInterval);
72
+ setIsOpen(false);
73
+ },
74
+ }}
75
+ secondary={{
76
+ title: "Sign me out now",
77
+ onClick: () => logoutSession(window),
78
+ }}
79
+ onRequestClose={() => setIsOpen(false)}
80
+ >
81
+ <p>
82
+ You have been inactive for thirty minutes. For your security, we will
83
+ sign you out automatically.
84
+ </p>
85
+ </Modal>
86
+ );
97
87
  };
98
88
 
99
89
  export default Session;
@@ -4,11 +4,20 @@ import cookie from "cookie";
4
4
  import jwtDecode from "jwt-decode";
5
5
  import SanitizedContent from "../../SanitizedContent";
6
6
  import AnimationGroup from "../AnimationGroup/AnimationGroup";
7
- import { isMultiRoleUser } from "../helpers";
8
7
  import SelectRole from "./SelectRole";
8
+ import { loadRoleOptions } from "./SelectRole/utils";
9
9
 
10
10
  const LevelOneContent = ({ isExpanded, levelOneContent }) => {
11
- let { qpp_auth_token } = cookie.parse(document.cookie);
11
+ const {
12
+ qpp_auth_token,
13
+ qpp_has_authorizations: hasAuthorizations,
14
+ qpp_cms_internal_authorized: cmsInternalRoleValues,
15
+ } = cookie.parse(document.cookie);
16
+
17
+ const roleOptions = loadRoleOptions([
18
+ hasAuthorizations,
19
+ cmsInternalRoleValues,
20
+ ]);
12
21
 
13
22
  const [selectedRole, setSelectedRole] = useState("");
14
23
 
@@ -20,7 +29,7 @@ const LevelOneContent = ({ isExpanded, levelOneContent }) => {
20
29
  const path = window.location.pathname;
21
30
  document.cookie = `current_path=${path}; Path=/;`;
22
31
 
23
- const hasMultipleRoles = isMultiRoleUser(document.cookie);
32
+ const hasMultipleRoles = roleOptions.length > 1;
24
33
 
25
34
  return (
26
35
  <div className="sidebar-content">
@@ -32,6 +41,7 @@ const LevelOneContent = ({ isExpanded, levelOneContent }) => {
32
41
  <SelectRole
33
42
  selectedRole={selectedRole}
34
43
  setSelectedRole={setSelectedRole}
44
+ roleOptions={roleOptions}
35
45
  />
36
46
  )}
37
47
 
@@ -3,29 +3,20 @@ import PropTypes from "prop-types";
3
3
  import cookie from "cookie";
4
4
  import Dropdown from "../../../Dropdown";
5
5
  import {
6
- loadRoleOptions,
7
6
  redirectPage,
8
7
  getLocalStorageRoleState,
9
8
  initializeLocalStorageRoleState,
10
9
  updateLocalStorageRoleState,
11
10
  } from "./utils";
12
11
 
13
- const SelectRole = ({ selectedRole, setSelectedRole }) => {
14
- const {
15
- qpp_has_authorizations: hasAuthorizations,
16
- qpp_cms_internal_authorized: cmsInternalRoleValues,
17
- qpp_impersonated_user: isHelpdeskRoleAndImpersonating,
18
- } = cookie.parse(document.cookie);
19
-
20
- const ROLE_OPTIONS = loadRoleOptions([
21
- hasAuthorizations,
22
- cmsInternalRoleValues,
23
- ]);
12
+ const SelectRole = ({ selectedRole, setSelectedRole, roleOptions }) => {
13
+ const { qpp_impersonated_user: isHelpdeskRoleAndImpersonating } =
14
+ cookie.parse(document.cookie);
24
15
 
25
16
  const handleSelection = (e) => {
26
17
  e.preventDefault();
27
18
  const dropdownValue = e.target.value;
28
- const newRoleSelected = ROLE_OPTIONS.filter(
19
+ const newRoleSelected = roleOptions.filter(
29
20
  (opt) => opt.value === dropdownValue,
30
21
  )[0].value;
31
22
  // Update localStorage with the new role selected
@@ -39,7 +30,7 @@ const SelectRole = ({ selectedRole, setSelectedRole }) => {
39
30
  useEffect(() => {
40
31
  // Check localStorage & set initial selected role
41
32
  const { selectedUserRole } = getLocalStorageRoleState();
42
- const roleValue = selectedUserRole || ROLE_OPTIONS[0].value;
33
+ const roleValue = selectedUserRole || roleOptions[0].value;
43
34
 
44
35
  // Set localStorage values if not set
45
36
  initializeLocalStorageRoleState(roleValue);
@@ -62,7 +53,7 @@ const SelectRole = ({ selectedRole, setSelectedRole }) => {
62
53
  name="user-role-selection"
63
54
  ariaLabel="Select User Role"
64
55
  className="qpp-u-width--100 SelectRole__Dropdown"
65
- options={ROLE_OPTIONS}
56
+ options={roleOptions}
66
57
  onChange={handleSelection}
67
58
  disabled={isHelpdeskRoleAndImpersonating}
68
59
  />
@@ -73,6 +64,7 @@ const SelectRole = ({ selectedRole, setSelectedRole }) => {
73
64
  SelectRole.propTypes = {
74
65
  selectedRole: PropTypes.string,
75
66
  setSelectedRole: PropTypes.func,
67
+ roleOptions: PropTypes.array,
76
68
  };
77
69
 
78
70
  export default SelectRole;
@@ -35,13 +35,6 @@ export const isReviewerRole = (cmsInternalRole) => {
35
35
  return reviewerRoles.includes(cmsInternalRole);
36
36
  };
37
37
 
38
- // Check if internal cms role in a Content Mgr role
39
- // @param {string} cmsInternalRole
40
- // @returns {boolean}
41
- export const isContentMgmtRole = (cmsInternalRole) => {
42
- return cmsRoles.includes(cmsInternalRole);
43
- };
44
-
45
38
  /**
46
39
  * Check if internal cms roles has Reviewer role
47
40
  * @param {array} cmsInternalRoles array of values
@@ -1,46 +1,4 @@
1
1
  import cookie from "cookie";
2
- import {
3
- AccountHomeIcon,
4
- DashboardIcon,
5
- FacilityBasedPreviewIcon,
6
- HardshipIcon,
7
- HelpSupportIcon,
8
- ManageUsersIcon,
9
- MyApplicationsIcon,
10
- MyTestDataIcon,
11
- PaymentIcon,
12
- PhysicianCompareIcon,
13
- StarIcon,
14
- TargetIcon,
15
- IndividualReporting,
16
- ManageDocumentsIcon,
17
- AuthorContentIcon,
18
- RegistrationIcon,
19
- } from "../../lib/SvgComponents";
20
- import { isReviewerRole, isContentMgmtRole } from "./Content/SelectRole/utils";
21
-
22
- const submissionsUrl = "/user/submissions";
23
- const dashboardUrl = "/user/dashboard";
24
- const manageUrl = "/user/manage-access";
25
- const feedbackUrl = `${submissionsUrl}/feedback`;
26
- const physicianCompareUrl = `${submissionsUrl}/doctors-clinicians-preview`;
27
- const reportsPortalUrl = `${submissionsUrl}/reports`;
28
- const facilityBasedPreviewBaseUrl = `${submissionsUrl}/facility-based-preview`;
29
- const viewingToolUrl = "/user/helpdesk-viewing-tool";
30
- const contentMgrDashboardUrl = "/user/content-management";
31
- const registrationUrl = "/user/registration/";
32
-
33
- const performanceFeedbackUrl = (performanceYear) => {
34
- if (performanceYear) {
35
- return `${feedbackUrl}/${performanceYear}`;
36
- } else {
37
- return feedbackUrl;
38
- }
39
- };
40
-
41
- const facilityBasedPreviewUrl = (performanceYear) => {
42
- return `${facilityBasedPreviewBaseUrl}/${performanceYear}`;
43
- };
44
2
 
45
3
  const handleNavigation = (e, linkCallbackFunction, label) => {
46
4
  if (linkCallbackFunction) {
@@ -59,293 +17,6 @@ const handleNavigation = (e, linkCallbackFunction, label) => {
59
17
  });
60
18
  };
61
19
 
62
- /**
63
- * Load icon by url
64
- * @param {string} url
65
- * @returns svg icon
66
- */
67
- const getIcon = (url, linkLabel) => {
68
- const icons = {
69
- [dashboardUrl]: DashboardIcon,
70
- [feedbackUrl]: StarIcon,
71
- [manageUrl]: ManageUsersIcon,
72
- [physicianCompareUrl]: PhysicianCompareIcon,
73
- [reportsPortalUrl]: HardshipIcon,
74
- [submissionsUrl]: AccountHomeIcon,
75
- [facilityBasedPreviewBaseUrl]: FacilityBasedPreviewIcon,
76
- [registrationUrl]: RegistrationIcon,
77
- "/developers": HelpSupportIcon,
78
- "/resources/help-and-support": HelpSupportIcon,
79
- "/user/apm-incentive-payments": PaymentIcon,
80
- "/user/applications": MyApplicationsIcon,
81
- "/user/exception/#/landing": HardshipIcon,
82
- "/user/targeted-review/#/landing": TargetIcon,
83
- "/user/test-data": MyTestDataIcon,
84
- "/user/self-nomination/#/landing": IndividualReporting,
85
- "/user/reviewers": AccountHomeIcon,
86
- "/reviewer/exception": HardshipIcon,
87
- "/reviewer/targeted-review": TargetIcon,
88
- "/self-nomination": IndividualReporting,
89
- "/case-management": FacilityBasedPreviewIcon,
90
- [contentMgrDashboardUrl]: AccountHomeIcon,
91
- "Manage Documents": ManageDocumentsIcon,
92
- "Author Content": AuthorContentIcon,
93
- };
94
-
95
- if (linkLabel) return icons[linkLabel];
96
- return icons[url];
97
- };
98
-
99
- const singleRoleContentMap = {
100
- "QPP Content Management - Author": "contentManager",
101
- "QPP Content Management - Approver": "contentManager",
102
- "QPP Content Management - Admin": "contentManager",
103
- "QPP Front-end - Author": "contentManager",
104
- "QPP Self-Nomination": "internalReviewers",
105
- "QPP Targeted Review & Exceptions": "internalReviewers",
106
- "QPP Case Management - PIMMS Reviewer": "internalReviewers",
107
- "QPP Case Management - ACO PAC Reviewer": "internalReviewers",
108
- "QPP Case Management - CMS Reviewer": "internalReviewers",
109
- };
110
-
111
- const multiRoleContentMap = {
112
- Reviewer: "internalReviewers",
113
- "Content Manager": "contentManager",
114
- };
115
-
116
- const replaceDefaultContentMgrLinks = (defaultContent) => {
117
- const host = window.location.host;
118
- const updatedDefaultContent = {
119
- ...defaultContent,
120
- contentManager: [
121
- defaultContent.contentManager.find(
122
- (obj) => obj.label === "Dashboard Home",
123
- ),
124
- {
125
- url: `${host}.qpp.cms.gov/cm/`,
126
- label: "Manage Documents",
127
- },
128
- {
129
- url: `${host}.qpp.cms.gov/content-management/`,
130
- label: "Author Content",
131
- },
132
- ],
133
- };
134
- return updatedDefaultContent;
135
- };
136
-
137
- /**
138
- * Load the side nav content for the given role
139
- * @param {string} roleName role of given user from internalReviewerNames
140
- * @param {object} navContent object of side nav links by role (levelOneContent & defaultContent)
141
- * @returns {array} returns an array of objects (side nav menu links) from levelOneContent
142
- * || defaultContent
143
- */
144
- const loadSideNavContent = (roleName, navContent, isMultiRoleUser = false) => {
145
- const { levelOneContent, defaultContent } = navContent;
146
- const updatedDefaultContent = replaceDefaultContentMgrLinks(defaultContent);
147
- const roleContentMap = isMultiRoleUser
148
- ? multiRoleContentMap
149
- : singleRoleContentMap;
150
- const contentByRole = roleContentMap[roleName];
151
- if (levelOneContent) {
152
- return levelOneContent[contentByRole] || levelOneContent.default;
153
- }
154
- return updatedDefaultContent[contentByRole] || updatedDefaultContent.default;
155
- };
156
-
157
- /**
158
- * Check if user is currently impersonating
159
- * @param {string} docCookie document cookie
160
- * @returns {boolean}
161
- */
162
- const isImpersonating = (docCookie) => {
163
- const parsedCookies = cookie.parse(docCookie);
164
- return (
165
- parsedCookies.qpp_can_impersonate && parsedCookies.qpp_impersonated_user
166
- );
167
- };
168
-
169
- /**
170
- * Check if user has multiple roles, used to display Select Role dropdown
171
- * @param {string} docCookie document cookie
172
- * @returns {boolean}
173
- */
174
- const isMultiRoleUser = (docCookie) => {
175
- const activeRoles = new Set();
176
- const {
177
- qpp_cms_internal_authorized,
178
- qpp_has_authorizations,
179
- qpp_is_dev_pre,
180
- } = cookie.parse(docCookie);
181
-
182
- let internalAuthz = [];
183
-
184
- if (qpp_cms_internal_authorized) {
185
- internalAuthz = JSON.parse(qpp_cms_internal_authorized);
186
- }
187
- // Filter out test internalCms authz
188
- const filteredInternalAuthz = internalAuthz.filter((internalAuth) => {
189
- return (
190
- internalAuth !== "Test internalCms Resource" &&
191
- internalAuth !== "Test internalCms Resource 2"
192
- );
193
- });
194
-
195
- filteredInternalAuthz.forEach((element) => {
196
- if (isReviewerRole(element)) {
197
- return activeRoles.add("reviewer");
198
- }
199
- if (isContentMgmtRole(element)) {
200
- return activeRoles.add("content manager");
201
- }
202
- return activeRoles.add(element);
203
- });
204
-
205
- if (qpp_has_authorizations === "true") {
206
- activeRoles.add("qpp user");
207
- }
208
-
209
- if (qpp_is_dev_pre === "true") {
210
- activeRoles.clear(); // reset roles since there is no dropdown in devpre
211
- activeRoles.add("devpre user");
212
- }
213
-
214
- return activeRoles.size > 1;
215
- };
216
-
217
- /**
218
- * Transform cookie values to permissions object
219
- * @param {object} cookies parsed document.cookie values
220
- * @returns {object}
221
- */
222
- const transformCookieValues = (cookies) => {
223
- const {
224
- qpp_can_impersonate,
225
- qpp_has_authorizations,
226
- user_has_apm_payments,
227
- qpp_cms_internal_authorized,
228
- qpp_ehr_authorized,
229
- qpp_has_non_registry_authorizations,
230
- } = cookies;
231
- return {
232
- canImpersonate: qpp_can_impersonate === "true",
233
- hasAuthorizations: qpp_has_authorizations === "true",
234
- hasApmPayments: user_has_apm_payments === "true",
235
- internalReviewerNames: qpp_cms_internal_authorized
236
- ? JSON.parse(qpp_cms_internal_authorized)
237
- : [],
238
- ehrAuthorized: qpp_ehr_authorized === "true",
239
- hasNonRegistryAuthorizations:
240
- qpp_has_non_registry_authorizations === "true",
241
- };
242
- };
243
-
244
- const permissionsByRole = {
245
- "QPP User": {
246
- canImpersonate: false,
247
- hasAuthorizations: true,
248
- hasApmPayments: true,
249
- },
250
- Reviewer: {
251
- hasAuthorizations: false,
252
- hasApmPaymentss: false,
253
- },
254
- "Helpdesk Viewer": {
255
- hasAuthorizations: false,
256
- hasApmPayments: false,
257
- hasNonRegistryAuthorizations: false,
258
- internalReviewerNames: ["QPP Helpdesk"],
259
- },
260
- // Helpdesk role && impersonating (use impersonated user authz values)
261
- Impersonation: {
262
- internalReviewerNames: ["QPP Helpdesk"],
263
- },
264
- "Content Manager": {
265
- hasAuthorizations: false,
266
- hasApmPaymentss: false,
267
- hasNonRegistryAuthorizations: false,
268
- },
269
- };
270
-
271
- /**
272
- * Return permissions by role
273
- * @param {string} selectedRole selected user role
274
- * @param {object} permissionValues default permission values from transformed parsed cookie
275
- * @returns {object}
276
- */
277
- const loadUserPermissionsByRole = (selectedRole, permissionValues) => {
278
- return {
279
- ...permissionValues,
280
- ...permissionsByRole[selectedRole],
281
- };
282
- };
283
-
284
- /**
285
- * Helper fn to return user permissions/properties from cookies set on login
286
- * @param {string} docCookie cookie values set on login
287
- * @param {string} selectedRole string of selected role if user has multiple roles
288
- * @returns {object}
289
- */
290
- const loadUserPermissions = (docCookie, selectedRole) => {
291
- const parsedCookies = cookie.parse(docCookie);
292
- const permissionValues = transformCookieValues(parsedCookies);
293
- const impersonating = isImpersonating(docCookie);
294
- const role = impersonating ? "Impersonation" : selectedRole;
295
-
296
- if (role) {
297
- return loadUserPermissionsByRole(role, permissionValues);
298
- }
299
-
300
- return permissionValues;
301
- };
302
-
303
- /**
304
- * Return map of link conditionals based on user cookies for side nav
305
- * @param {object} userPermissions user permissions/properties derived from cookies set on login
306
- * @returns {object}
307
- */
308
- const getUrlConditionMap = (userPermissions) => {
309
- return {
310
- [dashboardUrl]: userPermissions.hasAuthorizations,
311
- [feedbackUrl]: userPermissions.hasAuthorizations,
312
- "/user/apm-incentive-payments": userPermissions.hasApmPayments,
313
- [physicianCompareUrl]: userPermissions.hasNonRegistryAuthorizations,
314
- [registrationUrl]: userPermissions.hasAuthorizations,
315
- [reportsPortalUrl]: userPermissions.hasAuthorizations,
316
- [facilityBasedPreviewBaseUrl]: userPermissions.hasAuthorizations,
317
- "/user/helpdesk-viewing-tool": userPermissions.canImpersonate,
318
- "/reviewer/exception": userPermissions.internalReviewerNames?.includes(
319
- "QPP Targeted Review & Exceptions",
320
- ),
321
- "/reviewer/targeted-review":
322
- userPermissions.internalReviewerNames?.includes(
323
- "QPP Targeted Review & Exceptions",
324
- ),
325
- "/self-nomination": userPermissions.internalReviewerNames?.includes(
326
- "QPP Self-Nomination",
327
- ),
328
-
329
- "/case-management": userPermissions.internalReviewerNames?.some((val) =>
330
- [
331
- "QPP Case Management - PIMMS Reviewer",
332
- "QPP Case Management - ACO PAC Reviewer",
333
- "QPP Case Management - CMS Reviewer",
334
- ].includes(val),
335
- ),
336
-
337
- // dev pre
338
- "/user/applications": userPermissions.ehrAuthorized,
339
- "/user/test-data": userPermissions.ehrAuthorized,
340
- };
341
- };
342
-
343
- const isImpersonationLink = (docCookie, linkLabel) => {
344
- if (!isImpersonating(docCookie)) return;
345
- const helpdeskLinks = ["Account Home", "Manage Access", "Help and Support"];
346
- return !helpdeskLinks.includes(linkLabel);
347
- };
348
-
349
20
  /**
350
21
  * Sets the qpp_side_nav_expanded cookie value
351
22
  * @param {Document} document object
@@ -374,26 +45,4 @@ const isSideNavExpanded = (_document) => {
374
45
  return parsedCookies.qpp_side_nav_expanded === "true";
375
46
  };
376
47
 
377
- module.exports = {
378
- submissionsUrl,
379
- dashboardUrl,
380
- feedbackUrl,
381
- manageUrl,
382
- physicianCompareUrl,
383
- registrationUrl,
384
- performanceFeedbackUrl,
385
- facilityBasedPreviewUrl,
386
- handleNavigation,
387
- reportsPortalUrl,
388
- facilityBasedPreviewBaseUrl,
389
- viewingToolUrl,
390
- loadUserPermissions,
391
- getUrlConditionMap,
392
- isMultiRoleUser,
393
- getIcon,
394
- isImpersonating,
395
- isImpersonationLink,
396
- loadSideNavContent,
397
- setSideNavExpanded,
398
- isSideNavExpanded,
399
- };
48
+ export { handleNavigation, setSideNavExpanded, isSideNavExpanded };