@rh-support/troubleshoot 2.2.8 → 2.2.9

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":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAqCA,UAAU,MAAM;CAAG;AAEnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,eA0VnC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAqCA,UAAU,MAAM;CAAG;AAEnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,eA6VnC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -63,10 +63,12 @@ function OwnerSelector(props) {
63
63
  });
64
64
  }
65
65
  else {
66
+ const phoneLine = getPhoneObj(loggedInUser.data.phone).phoneLine || '';
67
+ const countryCode = getPhoneObj(loggedInUser.data.phone).countryCode;
66
68
  setCaseDetails(caseDispatch, {
67
- phoneAreaCodePrefixLineNumber: getPhoneObj(loggedInUser.data.phone).phoneLine || '',
68
- phoneCountryCode: getPhoneObj(loggedInUser.data.phone).countryCode,
69
- suppliedPhoneNumberVerified: 'True',
69
+ phoneAreaCodePrefixLineNumber: phoneLine,
70
+ phoneCountryCode: countryCode,
71
+ suppliedPhoneNumberVerified: phoneLine && countryCode ? 'True' : 'False',
70
72
  });
71
73
  }
72
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,sBAAsB,gBA8MrC"}
1
+ {"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,sBAAsB,gBAqOrC"}
@@ -11,7 +11,7 @@ import { contacts } from '@cee-eng/hydrajs';
11
11
  import { InputGroupText, InputGroupTextVariant, ValidatedOptions } from '@patternfly/react-core';
12
12
  import CheckIcon from '@patternfly/react-icons/dist/js/icons/check-icon';
13
13
  import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
14
- import { PhoneInput, ToastNotification } from '@rh-support/components';
14
+ import { getPhoneObj, PhoneInput, ToastNotification } from '@rh-support/components';
15
15
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
@@ -25,13 +25,14 @@ import { updateCaseDetails } from '../../../../reducers/CaseReducer';
25
25
  import { ContactPhoneNumberPopOver } from '../../../CaseInformation/ContactPhoneNumberPopOver';
26
26
  import { PDFContext } from '../../PDFContainer';
27
27
  export function CaseContactPhoneNumber() {
28
- const { phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', caseNumber, contactSSOName, suppliedPhoneNumberVerified, isCaseOwnerUpdating, } = useCaseSelector((state) => ({
28
+ const { phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', caseNumber, contactSSOName, suppliedPhoneNumberVerified, isCaseOwnerUpdating, phone, } = useCaseSelector((state) => ({
29
29
  phoneCountryCode: state.caseDetails.phoneCountryCode || '',
30
30
  phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber || '',
31
31
  caseNumber: state.caseDetails.caseNumber,
32
32
  contactSSOName: state.caseDetails.contactSSOName,
33
33
  suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
34
34
  isCaseOwnerUpdating: state.isCaseOwnerUpdating,
35
+ phone: state.caseDetails.phone,
35
36
  }), isEqual);
36
37
  const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
37
38
  const canEditCase = useCanEditCase();
@@ -40,6 +41,7 @@ export function CaseContactPhoneNumber() {
40
41
  const [localCountryCodeState, setLocalCountryCodeState] = useState(phoneCountryCode);
41
42
  const [invalid, setInvalid] = useState(false);
42
43
  const [isSaveClicked, setIsSavedClicked] = useState(false);
44
+ const [isShowOldPhone, setIsShowOldPhone] = useState(false);
43
45
  const caseDispatch = useCaseDispatch();
44
46
  const caseUpdateError = useCaseUpdateErrorMessage();
45
47
  const { t } = useTranslation();
@@ -121,8 +123,22 @@ export function CaseContactPhoneNumber() {
121
123
  ? ValidatedOptions.error
122
124
  : ValidatedOptions.default;
123
125
  useEffect(() => {
124
- setLocalFullPhoneState(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
125
- }, [phoneCountryCode, phoneAreaCodePrefixLineNumber]);
126
+ var _a, _b;
127
+ if (isEmpty(phoneCountryCode) && isEmpty(phoneAreaCodePrefixLineNumber && !isEmpty(phone))) {
128
+ const oldPhoneline = ((_a = getPhoneObj(phone)) === null || _a === void 0 ? void 0 : _a.phoneLine) || '';
129
+ const oldCountryCode = ((_b = getPhoneObj(phone)) === null || _b === void 0 ? void 0 : _b.countryCode) || '';
130
+ if (oldPhoneline && oldCountryCode.replace('+', '')) {
131
+ setLocalFullPhoneState(oldCountryCode + ' ' + oldPhoneline);
132
+ }
133
+ else {
134
+ setIsShowOldPhone(true);
135
+ }
136
+ }
137
+ else {
138
+ setLocalFullPhoneState(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
139
+ setIsShowOldPhone(false);
140
+ }
141
+ }, [phoneCountryCode, phoneAreaCodePrefixLineNumber, phone]);
126
142
  return (React.createElement("div", { className: "form-group pf-u-pb-md", style: { minWidth: '200px' } },
127
143
  React.createElement("h3", { className: `subheading subheading-sm ${isExportingPDF ? 'expand-input' : ''}` },
128
144
  React.createElement(Trans, null, "Case owner's phone number"),
@@ -141,5 +157,10 @@ export function CaseContactPhoneNumber() {
141
157
  isSaveClicked && isPhoneLineEmpty && (React.createElement("p", { className: "form-instructions form-invalid" },
142
158
  React.createElement(Trans, null, PHONE_LINE_CANNOT_BE_EMPTY))),
143
159
  isSaveClicked && isPhoneNumberInvalid && (React.createElement("p", { className: "form-instructions form-invalid" },
144
- React.createElement(Trans, null, PHONE_IS_NOT_VALID)))));
160
+ React.createElement(Trans, null, PHONE_IS_NOT_VALID))),
161
+ isShowOldPhone && (React.createElement("p", { className: "form-instructions form-invalid" },
162
+ React.createElement(Trans, null,
163
+ "The phone number on case is ",
164
+ phone,
165
+ ". The format of the phone field is changed and this phone does not fit.")))));
145
166
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAkBA,wBAAgB,kBAAkB,gBA2GjC"}
1
+ {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,kBAAkB,gBA0IjC"}
@@ -1,5 +1,7 @@
1
1
  import { ValidatedOptions } from '@patternfly/react-core';
2
2
  import { getPhoneObj, PhoneInput } from '@rh-support/components';
3
+ import { GlobalMetadataStateContext } from '@rh-support/react-context';
4
+ import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
3
5
  import isEmpty from 'lodash/isEmpty';
4
6
  import isEqual from 'lodash/isEqual';
5
7
  import React, { useContext, useEffect, useState } from 'react';
@@ -18,8 +20,10 @@ export function ContactPhoneNumber() {
18
20
  phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber,
19
21
  }), isEqual);
20
22
  const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
23
+ const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
21
24
  const [invalid, setInvalid] = useState(false);
22
25
  const [localFullPhone, setLocalFullPhone] = useState(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
26
+ const canChangeAccountInfo = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ACCOUNT_AND_OWNER);
23
27
  const getPhone = () => phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber;
24
28
  const caseDispatch = useCaseDispatch();
25
29
  const { t } = useTranslation();
@@ -53,8 +57,29 @@ export function ContactPhoneNumber() {
53
57
  ? ValidatedOptions.error
54
58
  : ValidatedOptions.default;
55
59
  useEffect(() => {
60
+ // when canChangeAccountInfo is false OwnerSelector is hidden
61
+ // need to set phone on load here instead of OwnerSelector
62
+ if (!canChangeAccountInfo) {
63
+ if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
64
+ setCaseDetails(caseDispatch, {
65
+ phoneAreaCodePrefixLineNumber: loggedInUser.data.supportPhoneAreaCodePrefixLineNumber,
66
+ phoneCountryCode: loggedInUser.data.supportPhoneCountryCode,
67
+ suppliedPhoneNumberVerified: 'True',
68
+ });
69
+ }
70
+ else {
71
+ const phoneLine = getPhoneObj(loggedInUser.data.phone).phoneLine || '';
72
+ const countryCode = getPhoneObj(loggedInUser.data.phone).countryCode;
73
+ setCaseDetails(caseDispatch, {
74
+ phoneAreaCodePrefixLineNumber: phoneLine,
75
+ phoneCountryCode: countryCode,
76
+ suppliedPhoneNumberVerified: phoneLine && countryCode ? 'True' : 'False',
77
+ });
78
+ }
79
+ }
56
80
  setLocalFullPhone(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
57
- }, [phoneAreaCodePrefixLineNumber, phoneCountryCode]);
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
+ }, [phoneAreaCodePrefixLineNumber, phoneCountryCode, loggedInUser.data]);
58
83
  return (React.createElement("div", { className: "form-group", style: { minWidth: '200px' } },
59
84
  React.createElement("label", null,
60
85
  React.createElement(Trans, null, "Case owner's phone number"),
@@ -1 +1 @@
1
- {"version":3,"file":"SubmitCase.d.ts","sourceRoot":"","sources":["../../../../src/components/SubmitCase/SubmitCase.tsx"],"names":[],"mappings":"AA4BA,MAAM,CAAC,OAAO,UAAU,UAAU,gBAqSjC"}
1
+ {"version":3,"file":"SubmitCase.d.ts","sourceRoot":"","sources":["../../../../src/components/SubmitCase/SubmitCase.tsx"],"names":[],"mappings":"AA4BA,MAAM,CAAC,OAAO,UAAU,UAAU,gBAmTjC"}
@@ -7,7 +7,7 @@ import { getConfigField, getRedhatDotComHost, PCM_CONFIG_FIELD_TYPE, PreviousCas
7
7
  import find from 'lodash/find';
8
8
  import isEmpty from 'lodash/isEmpty';
9
9
  import isEqual from 'lodash/isEqual';
10
- import React, { useContext, useEffect, useState } from 'react';
10
+ import React, { useContext, useEffect, useRef, useState } from 'react';
11
11
  import { Trans, useTranslation } from 'react-i18next';
12
12
  import { Link } from 'react-router-dom';
13
13
  import { useCaseSelector } from '../../context/CaseContext';
@@ -40,6 +40,7 @@ export default function SubmitCase() {
40
40
  }), isEqual);
41
41
  const isIdea = caseType === PreviousCaseTypes.FEATURE_ENHANCEMENT;
42
42
  const { topContentState: { topContent }, } = useContext(TCStateContext);
43
+ const tooltipRef = useRef();
43
44
  const { rulesState } = useContext(RulesStateContext);
44
45
  const { clusterRecommendationsState: { clusterRecommendations }, } = useContext(ClusterRecommendationsContext);
45
46
  const { attachmentState } = useContext(AttachmentStateContext);
@@ -133,10 +134,9 @@ export default function SubmitCase() {
133
134
  React.createElement(ActionList, null,
134
135
  React.createElement(ActionListItem, null,
135
136
  React.createElement(Button, { component: "a", href: `${getRedhatDotComHost(Env.getEnvName())}/wapps/ugc/protected/${'personalInfo.html'}`, target: "_blank", variant: "secondary", "data-tracking-id": "get-support-update-info", className: "update-info-button" }, "Update info")),
136
- React.createElement(ActionListItem, null,
137
- React.createElement(Tooltip, { content: React.createElement("div", null, "File upload in progress."), position: "bottom", isVisible: viewDisabled },
138
- React.createElement("div", null,
139
- React.createElement(Button, { className: "pf-u-ml-md", component: (props) => (React.createElement(Link, Object.assign({}, props, { to: `/case/${caseNumber}` }))), variant: "primary", "data-tracking-id": "get-support-view-case", isDisabled: viewDisabled }, "View case"))))))),
137
+ React.createElement(ActionListItem, null, viewDisabled ? (React.createElement(React.Fragment, null,
138
+ React.createElement(Tooltip, { content: t('File upload in progress.'), "aria-live": 'polite', reference: tooltipRef }),
139
+ React.createElement(Button, { className: "pf-u-ml-md", component: "a", href: getCaseURL(), variant: "primary", "data-tracking-id": "get-support-view-case", isDisabled: viewDisabled, ref: tooltipRef, "aria-label": t('View case') }, "View case"))) : (React.createElement(Button, { className: "pf-u-ml-md", component: (props) => React.createElement(Link, Object.assign({}, props, { to: `/case/${caseNumber}` })), variant: "primary", "data-tracking-id": "get-support-view-case", "aria-label": t('View case') }, "View case")))))),
140
140
  !isEmpty(attachmentState.caseFiles.selectedLocalFiles) && (React.createElement(FileUploader, { idToUploadTo: caseNumber, isSessionId: false, isSecureSupport: loggedInUsersAccount.data.secureSupport })),
141
141
  React.createElement("div", null,
142
142
  (!isEmpty(topContent.data) || !rulesState.EARules.rules || !clusterRecommendations) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -133,5 +133,5 @@
133
133
  "defaults and supports es6-module",
134
134
  "maintained node versions"
135
135
  ],
136
- "gitHead": "a561664516a56f2e0b9bb4fa59dc3ecd64c27e38"
136
+ "gitHead": "c49d603ef2cfff4400439dcdeb4e09ead60d5180"
137
137
  }