@rh-support/troubleshoot 0.2.121 → 0.2.122

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
- {"version":3,"file":"CaseDetailsErrorMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsErrorMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,UAAU,MAAM;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAsDpD"}
1
+ {"version":3,"file":"CaseDetailsErrorMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsErrorMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKrD,UAAU,MAAM;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAID,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAqEpD"}
@@ -3,14 +3,24 @@ import { GlobalMetadataStateContext } from '@rh-support/react-context';
3
3
  import { getSFDCSecureSupportCaseLink } from '@rh-support/utils';
4
4
  import React, { useContext } from 'react';
5
5
  import { Trans, useTranslation } from 'react-i18next';
6
+ // Here we need to use 'detailMessage' from case API if user is not authorized to see case details
7
+ const INVALID_CASE_GROUP_API_ERROR_DEFAULT_MESSAGE = 'Invalid group access';
6
8
  export function CaseDetailsErrorMessage(props) {
7
9
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
8
10
  const { t } = useTranslation();
9
11
  // Initialize Default Props Below
10
12
  const { isInlineError = false, canReadCase, caseNumber, errorDetails } = props;
13
+ const invalidCaseGroupErrorTitle = t('This case can only be viewed by a specific group');
14
+ /* There can be two condition for HTTP 403 error
15
+ 1. Account mismatch.
16
+ 2. Invalid case group
17
+ */
18
+ const isCaseGroupError = errorDetails['detailMessage'] === INVALID_CASE_GROUP_API_ERROR_DEFAULT_MESSAGE;
11
19
  const getErrorMessage = () => {
12
20
  const { status, message = '' } = errorDetails || {};
13
- const customDefaultErrorMessage403 = t('You are not authorized to see this case.');
21
+ const customDefaultErrorMessage403 = isCaseGroupError
22
+ ? t('Please contact your organization’s admin to request access to this case’s group.')
23
+ : t('You are not authorized to see this case.');
14
24
  const errorMessage404 = t("Case number doesn't exist");
15
25
  let errorMessage403;
16
26
  if (!canReadCase) {
@@ -36,6 +46,10 @@ export function CaseDetailsErrorMessage(props) {
36
46
  '404': { message: errorMessage404 },
37
47
  });
38
48
  };
39
- return (React.createElement(AlertMessage, { variant: AlertType.DANGER, className: "pf-u-mb-lg", show: true, title: errorMessageTitle(errorDetails), isInline: isInlineError },
49
+ return (React.createElement(AlertMessage, { variant: AlertType.DANGER, className: "pf-u-mb-lg", show: true,
50
+ // Here customizing title of alert based on case group error.
51
+ title: errorMessageTitle(errorDetails, Object.assign({}, (isCaseGroupError && {
52
+ '403': { title: invalidCaseGroupErrorTitle },
53
+ }))), isInline: isInlineError },
40
54
  React.createElement(Trans, null, getErrorMessage())));
41
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "0.2.121",
3
+ "version": "0.2.122",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -74,10 +74,10 @@
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
76
  "@rh-support/api": "0.3.24",
77
- "@rh-support/components": "1.1.73",
78
- "@rh-support/react-context": "0.2.78",
77
+ "@rh-support/components": "1.1.74",
78
+ "@rh-support/react-context": "0.2.79",
79
79
  "@rh-support/types": "0.2.0",
80
- "@rh-support/user-permissions": "0.2.61",
80
+ "@rh-support/user-permissions": "0.2.62",
81
81
  "@rh-support/utils": "0.2.46",
82
82
  "@types/react-redux": "^7.1.12",
83
83
  "@types/redux": "^3.6.0",
@@ -143,5 +143,5 @@
143
143
  "not ie <= 11",
144
144
  "not op_mini all"
145
145
  ],
146
- "gitHead": "1462a3928f01dcc4bd501c6423c1ff1f2e1b48b3"
146
+ "gitHead": "091469ce417cb7ec006f84e84d2ac5e36d18163f"
147
147
  }