@rh-support/troubleshoot 1.0.25 → 1.0.26

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":"ActiveCustomerEscalation.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/ActiveCustomerEscalation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAMpD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,wBAAwB,+EAkHnC,CAAC"}
1
+ {"version":3,"file":"ActiveCustomerEscalation.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/ActiveCustomerEscalation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAM/D,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,wBAAwB,+EA4HnC,CAAC"}
@@ -17,18 +17,18 @@ export const ActiveCustomerEscalation = forwardRef((props, ref) => {
17
17
  const isInternalElements = (React.createElement("div", { className: "card card-white card-support escalations", ref: ref },
18
18
  React.createElement("h3", { className: "card-heading" },
19
19
  React.createElement(Trans, null, "Active Customer Escalation (ACE)"),
20
- React.createElement("a", { href: "/support/escalation", target: "_blank" },
20
+ React.createElement("a", { href: "/support/escalation", target: "_blank", "aria-label": t('Learn more about Red Hat support case escalation') },
21
21
  React.createElement(InfoCircleIcon, null))),
22
22
  React.createElement("div", { className: "card-body" },
23
23
  React.createElement("p", null,
24
- React.createElement("strong", null, `${t('Red Hat associates can open an ACE escalation when')}`),
24
+ React.createElement("strong", null, t('Red Hat associates can open an ACE escalation when')),
25
25
  ":"),
26
26
  React.createElement("ul", null,
27
27
  React.createElement("li", null, t('The customer wants an update')),
28
28
  React.createElement("li", null, t('The customer thinks the case is not moving appropriately')),
29
29
  React.createElement("li", null, t('The customer wants a new resource')),
30
30
  React.createElement("li", null, t('The issue is more severe than originally thought'))),
31
- React.createElement("a", { href: `/watchlist/internal/aces/new?caseNumber=${props.caseNumber}`, className: "pf-c-button pf-m-tertiary", target: "_blank", rel: "noopener noreferrer", "data-tracking-id": "request-ace-trigger" }, t('Request an escalation')))));
31
+ React.createElement("a", { href: `/watchlist/internal/aces/new?caseNumber=${props.caseNumber}`, className: "pf-c-button pf-m-tertiary", target: "_blank", rel: "noopener noreferrer", "data-tracking-id": "request-ace-trigger", "aria-label": t('Request an escalation') }, t('Request an escalation')))));
32
32
  const [openRequestEscalationModal, setOpenRequestEscalationModal] = useState(false);
33
33
  const toggleModal = () => {
34
34
  if (canEditCase.alert())
@@ -39,19 +39,19 @@ export const ActiveCustomerEscalation = forwardRef((props, ref) => {
39
39
  React.createElement("h3", { className: "card-heading" },
40
40
  t('Request an escalation'),
41
41
  React.createElement("div", { style: { marginLeft: 'auto' } },
42
- React.createElement(Popover, { showClose: false, position: 'left', hasAutoWidth: true, bodyContent: (hide) => (React.createElement("a", { href: "/support/escalation", target: "_blank" },
42
+ React.createElement(Popover, { showClose: false, position: 'left', hasAutoWidth: true, bodyContent: (hide) => (React.createElement("a", { href: "/support/escalation", target: "_blank", "aria-label": t('Learn more about escalation cases.') },
43
43
  React.createElement(Trans, null, "Learn more about escalation cases."))) },
44
44
  React.createElement(InfoCircleIcon, { title: t('Learn more about escalation cases popover') })))),
45
45
  React.createElement("div", { className: "card-body" },
46
46
  React.createElement("p", null,
47
- React.createElement("strong", null, `${t('Request a management escalation if your issue')}`),
47
+ React.createElement("strong", null, t('Request a management escalation if your issue')),
48
48
  ":"),
49
49
  React.createElement("ul", null,
50
- React.createElement("li", null, t(`Isn't being resolved appropriately`)),
51
- React.createElement("li", null, t('Needs a senior resource')),
52
- React.createElement("li", null, t('Is more severe or should be a higher priority'))),
50
+ React.createElement("li", null, t(`Isn't being resolved appropriately.`)),
51
+ React.createElement("li", null, t('Needs a senior resource.')),
52
+ React.createElement("li", null, t('Is more severe or should be a higher priority.'))),
53
53
  commonElements,
54
- React.createElement(Button, { className: "pf-c-button pf-m-tertiary", onClick: toggleModal, "data-tracking-id": "request-rme-trigger" }, t('Request an escalation')))));
54
+ React.createElement(Button, { className: "pf-c-button pf-m-tertiary", onClick: toggleModal, "data-tracking-id": "request-rme-trigger", "aria-label": t('Request an escalation') }, t('Request an escalation')))));
55
55
  return (React.createElement(React.Fragment, null,
56
56
  React.createElement(RequestEscalationModal, { caseNumber: props.caseNumber, severity: props.caseSeverity, caseStatus: props.caseStatus, show: openRequestEscalationModal, onClose: toggleModal }),
57
57
  React.createElement(Can, { do: resourceActions.CREATE, on: resources.ICE_ESCALATION, passThrough: true }, (canCreateICE) => canCreateICE ? isInternalElements : isCreateRMEVisible ? isNotInternalElements : React.createElement(React.Fragment, null))));
@@ -1 +1 @@
1
- {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAwCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,eAsWnD"}
1
+ {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAwCA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,eA0WnD"}
@@ -120,15 +120,15 @@ export function RequestEscalationModal(props) {
120
120
  });
121
121
  const modalActions = [
122
122
  React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, "data-tracking-id": "request-rme-submit", isDisabled: submitButtonIsClicked &&
123
- (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching || !hasRequiredInfo()) },
123
+ (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching || !hasRequiredInfo()), "aria-label": t('Submit') },
124
124
  (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching) && (React.createElement(LoadingIndicator, { key: "loading", isInline: true })),
125
125
  ' ',
126
126
  t('Submit')),
127
- React.createElement(Button, { key: "cancel", variant: "link", onClick: onCancel, "data-tracking-id": "request-rme-cancel", isDisabled: createEscalationFetch.isFetching || isPostingComment || isUpdatingCase }, t('Cancel')),
127
+ React.createElement(Button, { key: "cancel", variant: "link", onClick: onCancel, "data-tracking-id": "request-rme-cancel", isDisabled: createEscalationFetch.isFetching || isPostingComment || isUpdatingCase, "aria-label": t('Cancel') }, t('Cancel')),
128
128
  ];
129
129
  const header = (React.createElement(Title, { id: "custom-header-label", headingLevel: "h1" },
130
130
  React.createElement(Trans, null, "Request an escalation"),
131
- React.createElement(Popover, { showClose: false, position: 'top', hasAutoWidth: true, bodyContent: () => (React.createElement("a", { href: "/support/escalation", target: "_blank" },
131
+ React.createElement(Popover, { showClose: false, position: 'top', hasAutoWidth: true, bodyContent: () => (React.createElement("a", { href: "/support/escalation", target: "_blank", "aria-label": t('Learn more about escalation cases.') },
132
132
  React.createElement(Trans, null, "Learn more about escalation cases."))) },
133
133
  React.createElement(InfoCircleIcon, { className: "pf-u-ml-sm" }))));
134
134
  // load rme categories as soon as user opens the modal
@@ -147,10 +147,10 @@ export function RequestEscalationModal(props) {
147
147
  fetchCategories();
148
148
  // eslint-disable-next-line react-hooks/exhaustive-deps
149
149
  }, [props.show]);
150
- return (React.createElement(Modal, { id: "request-mgmt-escalation-modal", className: "request-escalation-modal", isOpen: props.show, onClose: onCancel, actions: modalActions, header: header },
150
+ return (React.createElement(Modal, { id: "request-mgmt-escalation-modal", className: "request-escalation-modal", isOpen: props.show, onClose: onCancel, actions: modalActions, header: header, "aria-label": t('Request an escalation') },
151
151
  React.createElement("p", { className: "pf-u-mb-md" },
152
152
  React.createElement(Trans, { i18nKey: "i18RequestEscalationDescription" }, "Submit an escalation if an issue has become more severe or you feel the case needs a higher priority. A support manager will review your escalation request.")),
153
- React.createElement(AlertMessage, { variant: AlertType.DANGER, title: t('Could not create case escalation'), show: creationError, onClose: onErrorClose, isInline: true, className: "pf-u-mb-md" }),
153
+ React.createElement(AlertMessage, { variant: AlertType.DANGER, title: t('Could not create case escalation'), show: creationError, onClose: onErrorClose, isInline: true, className: "pf-u-mb-md", "aria-label": t('Could not create case escalation') }),
154
154
  React.createElement(Form, { "aria-label": t('form'), className: "request-escalation-form" },
155
155
  React.createElement(Grid, { hasGutter: true, md: 12 },
156
156
  React.createElement(GridItem, { span: 6 },
@@ -1 +1 @@
1
- {"version":3,"file":"CaseDetailsAside.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsAside.tsx"],"names":[],"mappings":"AA2BA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,eAoS7C"}
1
+ {"version":3,"file":"CaseDetailsAside.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsAside.tsx"],"names":[],"mappings":"AA4BA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,eA0T7C"}
@@ -27,14 +27,16 @@ import { useCaseDetailsPageStateContext } from '../../context/CaseDetailsPageCon
27
27
  import { useRecommendationStateContext } from '../../context/RecommendationContext';
28
28
  import { ActiveCustomerEscalation } from './ActiveCustomerEscalation';
29
29
  import { CaseSolutions } from './CaseSolutions';
30
+ import { RemoteSessionAgreement } from './RequestRemoteSession';
30
31
  export function CaseDetailsAside(props) {
31
32
  var _a;
32
33
  const { t } = useTranslation();
33
- const { severity, status, isFetchingCaseDetails, isFetchingCaseDetailsError } = useCaseSelector((state) => ({
34
+ const { severity, status, isFetchingCaseDetails, isFetchingCaseDetailsError, acceptedRemoteSessionTerms } = useCaseSelector((state) => ({
34
35
  severity: state.caseDetails.severity,
35
36
  status: state.caseDetails.status,
36
37
  isFetchingCaseDetails: state.isFetchingCaseDetails,
37
38
  isFetchingCaseDetailsError: state.isFetchingCaseDetailsError,
39
+ acceptedRemoteSessionTerms: state.caseDetails.remoteSessionTermsAcked,
38
40
  }), isEqual);
39
41
  const { caseDetailsPageState: { caseEscalations }, } = useCaseDetailsPageStateContext();
40
42
  const isCreateRMEVisible = (caseEscalations.data || []).length === 0 || caseEscalations.data.every((item) => item.status === 'Closed');
@@ -54,8 +56,10 @@ export function CaseDetailsAside(props) {
54
56
  const isXLScreen = breakPoint.xl;
55
57
  const toggleCustomerViewRef = useRef(null);
56
58
  const isFirstMountRef = useRef(true);
57
- const { globalMetadataState: { navBarRef, viewAsCustomer, loggedInUsersAccount }, } = useGlobalStateContext();
59
+ const { globalMetadataState: { navBarRef, viewAsCustomer, loggedInUsersAccount, loggedInUserRights }, } = useGlobalStateContext();
58
60
  const isSecureSupportAccount = loggedInUsersAccount.data.secureSupport;
61
+ // To enable RSA Section for non-internal users
62
+ const isInternal = loggedInUserRights.data.isInternal();
59
63
  const onToggleAside = (ev) => {
60
64
  var _a;
61
65
  toggleAside(!((_a = caseDetailsAsidePanelRef.current) === null || _a === void 0 ? void 0 : _a.expanded));
@@ -128,7 +132,7 @@ export function CaseDetailsAside(props) {
128
132
  }
129
133
  else if (viewAsInternalPref === undefined) {
130
134
  yield updateOriginalCaseView(viewAsCustomer);
131
- // the else is to initialize a value for the pref. If user does not have one (undefined) we initialize with the default permission (viewascustomer).
135
+ // The else is to initialize a value for the pref. If user does not have one (undefined) we initialize with the default permission (View As Customer).
132
136
  }
133
137
  ToastNotification.addSuccessMessage(t('Successfully set the default case view'), React.createElement("p", null,
134
138
  React.createElement(Trans, null,
@@ -191,5 +195,7 @@ export function CaseDetailsAside(props) {
191
195
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading top solutions') } },
192
196
  React.createElement(CaseSolutions, { caseNumber: caseNumber, ref: topSolutionsRef, isSecureSupportAccount: isSecureSupportAccount })),
193
197
  !caseEscalations.isFetching && canViewACESection && (React.createElement(ErrorBoundary, null,
194
- React.createElement(ActiveCustomerEscalation, { caseNumber: caseNumber, caseSeverity: severity, caseStatus: status, ref: createEscalationRef })))))));
198
+ React.createElement(ActiveCustomerEscalation, { caseNumber: caseNumber, caseSeverity: severity, caseStatus: status, ref: createEscalationRef }))),
199
+ !isInternal && (React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading remote session agreement') } },
200
+ React.createElement(RemoteSessionAgreement, { caseNumber: caseNumber, caseSeverity: severity, caseStatus: status, ref: createEscalationRef, acceptedRemoteSessionTerms: acceptedRemoteSessionTerms })))))));
195
201
  }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface IProps {
3
+ caseNumber: string;
4
+ caseSeverity: string;
5
+ caseStatus: string;
6
+ acceptedRemoteSessionTerms: boolean;
7
+ }
8
+ export declare const RemoteSessionAgreement: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLDivElement>>;
9
+ export {};
10
+ //# sourceMappingURL=RemoteSessionAgreement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteSessionAgreement.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreement.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAMxE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B,EAAE,OAAO,CAAC;CACvC;AAED,eAAO,MAAM,sBAAsB,+EA6FjC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { Button, Popover, Tooltip } from '@patternfly/react-core';
2
+ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
3
+ import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
4
+ import React, { forwardRef, useContext, useRef, useState } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { TnC } from '../../../constants/tncConstants';
7
+ import { RemoteSessionAgreementModal } from './RemoteSessionAgreementModal';
8
+ export const RemoteSessionAgreement = forwardRef((props, ref) => {
9
+ const tooltipRef = useRef();
10
+ const { t } = useTranslation();
11
+ const canEditCase = useCanEditCase();
12
+ const { caseNumber, caseStatus, acceptedRemoteSessionTerms } = props;
13
+ const { globalMetadataState: { loggedInUser, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
14
+ const [openRequestRemoteSessionModal, setOpenRequestRemoteSessionnModal] = useState(false);
15
+ // To toggle RSA Modal
16
+ const toggleRemoteSessionAgreementModal = () => {
17
+ if (canEditCase.alert())
18
+ return;
19
+ setOpenRequestRemoteSessionnModal((openRequestRemoteSessionModal) => !openRequestRemoteSessionModal);
20
+ };
21
+ // RSA Aside Section Body
22
+ const RemoteSessionAgreementSectionBody = (React.createElement("div", { className: "card card-white card-support escalations", ref: ref },
23
+ React.createElement("h3", { className: "card-heading pf-u-display-flex pf-u-justify-content-space-between" },
24
+ t('Remote session'),
25
+ React.createElement(Popover, { "aria-label": t('Remote Session Helper Info'), bodyContent: t('Before Red Hat logs into your systems to analyze your support issue during a remote session, Red Hat needs your approval and authorization for such remote access.'), footerContent: React.createElement("a", { href: "/articles/3566571", target: "_blank", rel: "noopener noreferrer", "aria-label": t('Read more about remote sessions') }, t('Read more about remote sessions')) },
26
+ React.createElement(InfoCircleIcon, null))),
27
+ React.createElement("div", { className: "card-body" },
28
+ React.createElement("p", null,
29
+ React.createElement("strong", null, `${t('Red Hat may agree to remotely access your systems if:')}`)),
30
+ React.createElement("ul", null,
31
+ React.createElement("li", null, t(`Such access helps diagnose, debug or lead to the resolution of a software defect.`)),
32
+ React.createElement("li", null, t('Both you and Red Hat agree to remote access.'))),
33
+ React.createElement("p", { className: "rrs-light-grey-text" }, t('This action does not initiate a remote session. Please make a case comment if you would like to submit a request.')),
34
+ acceptedRemoteSessionTerms && (React.createElement(Tooltip, { content: t('Remote session agreement has already has been accepted.'), reference: tooltipRef, "aria-live": 'polite' })),
35
+ React.createElement(Button, { "aria-label": acceptedRemoteSessionTerms ? t('Agreement accepted') : t('Accept agreement'), variant: "primary", onClick: toggleRemoteSessionAgreementModal, "data-tracking-id": "accept-remote-session-agreement-trigger", isAriaDisabled: acceptedRemoteSessionTerms, ref: tooltipRef }, acceptedRemoteSessionTerms ? t('Agreement accepted') : t('Accept agreement')))));
36
+ return (React.createElement(React.Fragment, null,
37
+ RemoteSessionAgreementSectionBody,
38
+ React.createElement(RemoteSessionAgreementModal, { caseNumber: caseNumber, caseStatus: caseStatus, show: openRequestRemoteSessionModal, onClose: toggleRemoteSessionAgreementModal, siteCode: TnC.REMOTE_RIDER_SITE_CODE, eventCode: TnC.REMOTER_RIDER_EVENT_CODE, loggedInUser: loggedInUser.data.ssoUsername === undefined ? '' : loggedInUser.data.ssoUsername, loggedInUserRights: loggedInUserRights })));
39
+ });
@@ -0,0 +1,16 @@
1
+ import { IApiResponseDetails } from '@rh-support/types/shared';
2
+ import { UserAuth } from '@rh-support/user-permissions';
3
+ interface IProps {
4
+ caseNumber: string;
5
+ onClose?: () => void;
6
+ termsAcked?: boolean;
7
+ siteCode: string;
8
+ eventCode: string;
9
+ loggedInUser: string;
10
+ caseStatus: string;
11
+ show: boolean;
12
+ loggedInUserRights: IApiResponseDetails<UserAuth>;
13
+ }
14
+ export declare function RemoteSessionAgreementModal(props: IProps): JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=RemoteSessionAgreementModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteSessionAgreementModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAiBxD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;CACrD;AAiBD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,eAkPxD"}
@@ -0,0 +1,168 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { publicApi } from '@cee-eng/hydrajs';
11
+ import { Button, ButtonVariant, Checkbox, Modal, Select, SelectOption } from '@patternfly/react-core';
12
+ import DownloadIcon from '@patternfly/react-icons/dist/esm/icons/download-icon';
13
+ import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
14
+ import { ToastNotification, useFetch } from '@rh-support/components';
15
+ import React, { useEffect, useState } from 'react';
16
+ import { Trans, useTranslation } from 'react-i18next';
17
+ import { useCaseDispatch } from '../../../context/CaseContext';
18
+ import { useCaseDetailsPageStateContext } from '../../../context/CaseDetailsPageContext';
19
+ import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../context/CaseDiscussionTabContext';
20
+ import { updateDiscussionStateComments } from '../../../reducers/CaseDiscussionTabReducer';
21
+ import { checkForCaseStatusToggleOnAttachOrComment, setRemoteRiderFlag, updateCaseDetails, } from '../../../reducers/CaseReducer';
22
+ const getLocaleNameFromLocalCode = (localeCode) => {
23
+ if ('Intl' in window && 'DisplayNames' in Intl) {
24
+ try {
25
+ const [lang, locale] = localeCode.includes('_') ? localeCode.split('_') : localeCode.split('-');
26
+ // https://github.com/microsoft/TypeScript/issues/41338
27
+ const langName = new Intl.DisplayNames([lang], { type: 'language' });
28
+ const regionNamesInLang = new Intl.DisplayNames([lang], { type: 'region' });
29
+ return `${regionNamesInLang.of(locale)} (${langName.of(lang)})`;
30
+ }
31
+ catch (e) {
32
+ return localeCode;
33
+ }
34
+ }
35
+ return localeCode;
36
+ };
37
+ export function RemoteSessionAgreementModal(props) {
38
+ const { t } = useTranslation();
39
+ const [isTermsChecked, setIsTermsChecked] = useState(false);
40
+ const [isSubmitDisabled, setSubmitDisabled] = useState(false);
41
+ const { request } = useFetch(publicApi.terms.getRequiredTerms);
42
+ const [isLangSelectorDropdownOpen, setisLangSelectorDropdownOpen] = useState(false);
43
+ const caseDispatch = useCaseDispatch();
44
+ const [selectedTranslation, setSelectedTranslation] = useState({
45
+ id: '5001',
46
+ isDefault: false,
47
+ localeCode: 'en_US',
48
+ pdfDownloadUrl: '/wapps/tnc/viewterms/7275e6f5-5f32-4d9c-aeaf-c796b56817fd',
49
+ termsPdfId: '7275e6f5-5f32-4d9c-aeaf-c796b56817fd',
50
+ translatedDescription: 'Your acceptance of this Remote Access Rider is required when you request Red Hat’s support team to remotely access your network or systems. Remote access to your network or systems is not a standard Red Hat problem resolution process. Before Red Hat logs onto your systems to analyze your support issue, Red Hat needs your approval and authorization for such remote access.',
51
+ translatedInstructions: 'Please read and accept the Remote Access Rider terms below to allow Red Hat to access your network or systems.',
52
+ translatedTermsName: 'Remote Access Rider',
53
+ });
54
+ const [allTranslations, setAllTranslations] = useState({});
55
+ const [agreeLoading, setAgreeLoading] = useState(false);
56
+ useEffect(() => {
57
+ const fetchTerms = () => __awaiter(this, void 0, void 0, function* () {
58
+ try {
59
+ const { siteCode, eventCode, loggedInUser } = props;
60
+ const response = yield request(siteCode, eventCode, loggedInUser);
61
+ let defaultTranslation = response[0].translations[0];
62
+ const translationLangInfoMap = response[0].translations.reduce((allTranslationsmap, translation) => {
63
+ if (translation.isDefault) {
64
+ defaultTranslation = translation;
65
+ }
66
+ allTranslationsmap[translation['localeCode']] = translation;
67
+ return allTranslationsmap;
68
+ }, {});
69
+ setSelectedTranslation(defaultTranslation);
70
+ setAllTranslations(translationLangInfoMap);
71
+ }
72
+ catch (e) {
73
+ console.log(e);
74
+ }
75
+ });
76
+ fetchTerms();
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
+ }, []);
79
+ const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
80
+ propgateErrors: true,
81
+ });
82
+ const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
83
+ const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
84
+ const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
85
+ // To handle modal cancel and close
86
+ const onCancel = () => {
87
+ props.onClose && props.onClose();
88
+ };
89
+ // Function to ack remote session terms and post comment
90
+ const submitRequestRemoteSessionRequest = (pdfId) => __awaiter(this, void 0, void 0, function* () {
91
+ const requestComment = t('#### A Remote Session request has been submitted. We will review the request and confirm via case comment.\n\n This action does not initiate a remote session. Please make a case comment if you would like to submit a request.');
92
+ try {
93
+ yield updateCaseDetails(caseDispatch, props.caseNumber, { remoteSessionTermsAcked: true });
94
+ setRemoteRiderFlag(caseDispatch, true);
95
+ try {
96
+ yield postCommentRequest({
97
+ caseNumber: props.caseNumber,
98
+ commentBody: requestComment,
99
+ contentType: 'markdown',
100
+ });
101
+ updateDiscussionStateComments(dispatchDiscussion, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
102
+ checkForCaseStatusToggleOnAttachOrComment(caseDispatch, props.loggedInUserRights.data.isInternal(), props.caseStatus);
103
+ setAgreeLoading(false);
104
+ ToastNotification.addSuccessMessage(t('Remote Access Rider agreement has been accepted'), t('This action does not initiate a remote session. Please make a case comment if you would like to submit a request.'));
105
+ }
106
+ catch (e) {
107
+ ToastNotification.addWarningMessage(t('Could not submit a comment'), t('Rest assured, we have noted you have accepted the agreement'));
108
+ props.onClose();
109
+ }
110
+ props.onClose();
111
+ }
112
+ catch (e) {
113
+ ToastNotification.addDangerMessage(t('Could not accept the remote access rider agreement'), t('Please try again.'));
114
+ props.onClose();
115
+ }
116
+ });
117
+ // To check if terms acked and if not disable submit button
118
+ const onSubmit = () => {
119
+ if (isTermsChecked) {
120
+ setAgreeLoading(true);
121
+ submitRequestRemoteSessionRequest(selectedTranslation.termsPdfId);
122
+ }
123
+ else {
124
+ setSubmitDisabled(true);
125
+ }
126
+ };
127
+ // Handle terms checkbox
128
+ const onCheckBoxChange = (value) => {
129
+ setIsTermsChecked(value);
130
+ setSubmitDisabled(!value);
131
+ };
132
+ // Handle language change
133
+ const onLangChange = (event, lang) => {
134
+ setSelectedTranslation(allTranslations[lang]);
135
+ setisLangSelectorDropdownOpen(false);
136
+ };
137
+ // To handle dropdown toggle
138
+ const onDropdownToggle = (toggle) => setisLangSelectorDropdownOpen(toggle);
139
+ // RSA Modal Actions
140
+ const modalActions = [
141
+ React.createElement(Button, { "aria-label": t('I agree'), variant: ButtonVariant.primary, onClick: onSubmit, "data-tracking-id": "remote-session-agreement-check", isLoading: agreeLoading || isPostingComment, isDisabled: isSubmitDisabled || isPostingComment }, t('I agree')),
142
+ ];
143
+ // Body of RSA Modal
144
+ const RemoteSessionAgreementModalBody = (React.createElement(React.Fragment, null,
145
+ React.createElement("p", { className: "pf-u-mt-xs" },
146
+ React.createElement(Trans, null,
147
+ "Your acceptance of this Remote Access Rider is required ",
148
+ React.createElement("strong", null, "for each case"),
149
+ " when you request Red Hat\u2019s support team to directly access your network or systems.")),
150
+ React.createElement("p", { className: "pf-u-mt-md" },
151
+ React.createElement(Trans, null, "Remote access to your network or systems is not a standard Red Hat problem resolution process. Before Red Hat logs into your systems to analyze your support issue during a remote session, Red Hat needs your approval and authorization for such remote access.")),
152
+ React.createElement("p", { className: "pf-u-mt-md" },
153
+ React.createElement(Trans, null, "Please read and accept the Remote Access Rider terms below to allow Red Hat to access your network or systems.")),
154
+ React.createElement("div", null,
155
+ React.createElement(Select, { className: "pf-u-mt-md", "aria-label": t('Select language'), id: "terms-language-selector", selections: selectedTranslation.localeCode, onSelect: onLangChange, isOpen: isLangSelectorDropdownOpen, menuAppendTo: document.body, placeholderText: t('Select an option that best fits'), onToggle: onDropdownToggle, width: 350 }, Object.keys(allTranslations).map((option, index) => (React.createElement(SelectOption, { key: index, value: option }, getLocaleNameFromLocalCode(option))))),
156
+ React.createElement("a", { "aria-label": t('Download'), "data-tracking-id": "rsa-modal-terms-download", className: "pf-u-ml-md", href: selectedTranslation.pdfDownloadUrl, rel: "noopener noreferrer", target: "_blank" },
157
+ t('Download'),
158
+ " ",
159
+ React.createElement(DownloadIcon, { className: "pf-u-ml-xs" }))),
160
+ React.createElement("div", null,
161
+ React.createElement(Checkbox, { className: "pf-u-mt-md", id: "terms-accept-checkbox", label: React.createElement(React.Fragment, null,
162
+ React.createElement(Trans, null, "I have read and agree to the"),
163
+ ' ',
164
+ React.createElement("a", { className: "pf-c-button pf-m-link pf-m-inline align-link-items", rel: "noopener noreferrer", target: "_blank", href: selectedTranslation.pdfDownloadUrl, "data-tracking-id": "case-details-request-remote-session-terms" },
165
+ React.createElement(Trans, null, "terms "),
166
+ React.createElement(ExternalLinkAltIcon, null))), isChecked: isTermsChecked, "aria-label": t('I have read and agree to the terms'), onChange: onCheckBoxChange }))));
167
+ return (React.createElement(Modal, { id: "remote-session-agreement-modal", "aria-label": t('Remote Session Agreement'), title: t('Remote Session Agreement'), isOpen: props.show, onClose: onCancel, actions: modalActions }, RemoteSessionAgreementModalBody));
168
+ }
@@ -0,0 +1,2 @@
1
+ export * from './RemoteSessionAgreement';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './RemoteSessionAgreement';
@@ -915,7 +915,7 @@ div.pf-c-alert.ea-rule-alert > div.pf-c-alert__description > p {
915
915
  .customer-view-switch-label {
916
916
  font-size: 15px;
917
917
  font-weight: 700;
918
- color: #6a6e73;
918
+ color: var(--pf-global--palette--black-600);
919
919
  }
920
920
 
921
921
  #case-details-aside-content[pfe-expanded] {
@@ -959,5 +959,9 @@ p.pref-case-popover-text {
959
959
  }
960
960
 
961
961
  .blueLock {
962
- color: #06c;
962
+ color: var(--pf-global--palette--blue-400);
963
+ }
964
+
965
+ .rrs-light-grey-text {
966
+ color: var(--pf-global--palette--black-600);
963
967
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -73,8 +73,8 @@
73
73
  "@patternfly/react-core": "4.264.0",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
- "@rh-support/components": "1.2.12",
77
- "@rh-support/react-context": "1.0.14",
76
+ "@rh-support/components": "1.2.13",
77
+ "@rh-support/react-context": "1.0.15",
78
78
  "@rh-support/types": "0.2.0",
79
79
  "@rh-support/user-permissions": "1.0.10",
80
80
  "@rh-support/utils": "1.0.8",
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "e37bef728cf73aec23bea1060d855aeb01ae62b6"
145
+ "gitHead": "8e9b0b138cec4a9e71180e96ee391702b6754236"
146
146
  }