qpp-style 9.28.3 → 9.28.4-mo-beta.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.
@@ -11,19 +11,27 @@ const extractCookieValues = (cookies) => {
11
11
  return [hasAuthorizations, cmsInternalRoles];
12
12
  };
13
13
 
14
+ const reviewerRoles = [
15
+ 'QPP Self-Nomination',
16
+ 'QPP Targeted Review & Exceptions',
17
+ 'QPP Case Management - PIMMS Reviewer',
18
+ 'QPP Case Management - ACO PAC Reviewer',
19
+ 'QPP Case Management - CMS Reviewer',
20
+ ];
21
+
22
+ const cmsRoles = [
23
+ 'QPP Content Management - Author',
24
+ 'QPP Content Management - Approver',
25
+ 'QPP Content Management - Admin',
26
+ 'QPP Front-end - Author',
27
+ ];
28
+
14
29
  /**
15
30
  * Check if internal cms role is a Reviewer role
16
31
  * @param {string} cmsInternalRole
17
32
  * @returns {boolean}
18
33
  */
19
34
  export const isReviewerRole = (cmsInternalRole) => {
20
- const reviewerRoles = [
21
- 'QPP Self-Nomination',
22
- 'QPP Targeted Review & Exceptions',
23
- 'QPP Case Management - PIMMS Reviewer',
24
- 'QPP Case Management - ACO PAC Reviewer',
25
- 'QPP Case Management - CMS Reviewer',
26
- ];
27
35
  return reviewerRoles.includes(cmsInternalRole);
28
36
  };
29
37
 
@@ -49,15 +57,35 @@ const hasHelpdeskRole = (cmsInternalRoles) => {
49
57
 
50
58
  const hasContentMgmtRole = (cmsInternalRoles) => {
51
59
  if (!cmsInternalRoles) return false;
52
- const cmsRoles = [
53
- 'QPP Content Management - Author',
54
- 'QPP Content Management - Approver',
55
- 'QPP Content Management - Admin',
56
- 'QPP Front-end - Author',
57
- ];
58
60
  return cmsInternalRoles.some((role) => cmsRoles.includes(role));
59
61
  };
60
62
 
63
+ const includesRole = (arr, roles) => roles.some((role) => arr.includes(role));
64
+
65
+ /**
66
+ * Check if internal cms roles includes only Content Manager roles
67
+ * @param {array} internalAuthz array of values
68
+ * @returns {boolean}
69
+ */
70
+ export const isOnlyContentManager = (internalAuthz) => {
71
+ return (
72
+ includesRole(internalAuthz, cmsRoles) &&
73
+ !includesRole(internalAuthz, reviewerRoles)
74
+ );
75
+ };
76
+
77
+ /**
78
+ * Check if internal cms roles includes only Internal Reviewers roles
79
+ * @param {array} internalAuthz array of values
80
+ * @returns {boolean}
81
+ */
82
+ export const isOnlyInternalReviewer = (internalAuthz) => {
83
+ return (
84
+ includesRole(internalAuthz, reviewerRoles) &&
85
+ !includesRole(internalAuthz, cmsRoles)
86
+ );
87
+ };
88
+
61
89
  /**
62
90
  * Transforms cookie values into optios format for use in role seelction dropdown
63
91
  * @param {array} values extracted & parsed vookie values
@@ -17,7 +17,11 @@ import {
17
17
  AuthorContentIcon,
18
18
  RegistrationIcon,
19
19
  } from '../../lib/SvgComponents';
20
- import { isReviewerRole } from './Content/SelectRole/utils';
20
+ import {
21
+ isReviewerRole,
22
+ isOnlyInternalReviewer,
23
+ isOnlyContentManager,
24
+ } from './Content/SelectRole/utils';
21
25
 
22
26
  const submissionsUrl = '/user/submissions';
23
27
  const dashboardUrl = '/user/dashboard';
@@ -193,7 +197,11 @@ const isMultiRoleUser = (docCookie) => {
193
197
  return activeRoles.add(element);
194
198
  });
195
199
 
196
- return activeRoles.size > 1;
200
+ return (
201
+ !isOnlyContentManager(internalAuthz) &&
202
+ !isOnlyInternalReviewer(internalAuthz) &&
203
+ activeRoles.size > 1
204
+ );
197
205
  };
198
206
 
199
207
  /**