@rh-support/troubleshoot 2.2.8 → 2.2.10

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":"AAqBA,wBAAgB,kBAAkB,gBAkJjC"}
@@ -1,10 +1,12 @@
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';
6
8
  import { Trans, useTranslation } from 'react-i18next';
7
- import { PHONE_IS_NOT_VALID, PHONE_LINE_CANNOT_BE_EMPTY, PHONE_NO_CHAR_ERROR, } from '../../constants/caseDetailsConstants';
9
+ import { PHONE_INSTRUCTION, PHONE_IS_NOT_VALID, PHONE_LINE_CANNOT_BE_EMPTY, PHONE_NO_CHAR_ERROR, } from '../../constants/caseDetailsConstants';
8
10
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
9
11
  import { RouteContext } from '../../context/RouteContext';
10
12
  import { PHONE_LIMIT } from '../../reducers/CaseConstNTypes';
@@ -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,13 +57,39 @@ 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"),
61
86
  ContactPhoneNumberPopOver()),
62
87
  React.createElement(PhoneInput, { phoneValue: localFullPhone, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid }),
88
+ !invalid &&
89
+ getPhone().length < PHONE_LIMIT &&
90
+ !(isPhoneNumberEmpty && isNextBtnClickedToShowValidationError) &&
91
+ !(isNextBtnClickedToShowValidationError && isPhoneNumberInvalid) && (React.createElement("p", { className: "form-instructions" },
92
+ React.createElement(Trans, null, PHONE_INSTRUCTION))),
63
93
  invalid && (React.createElement("p", { className: "form-instructions form-invalid" },
64
94
  React.createElement(Trans, null, PHONE_NO_CHAR_ERROR))),
65
95
  getPhone().length > PHONE_LIMIT && (React.createElement("p", { className: "form-instructions form-invalid" }, maxLengthErrorMessage)),
@@ -21,9 +21,9 @@ export default function CaseManagement(props) {
21
21
  return (React.createElement("form", null,
22
22
  React.createElement(SupportLevel, null),
23
23
  React.createElement(Flex, { direction: { default: 'column', '2xl': 'row' } },
24
- React.createElement(FlexItem, { flex: { default: 'flex_1' }, className: "pf-u-mb-xl" },
24
+ React.createElement(FlexItem, { flex: { default: 'flex_1' }, className: "pf-u-mb-xs" },
25
25
  React.createElement(Severity, { showSeverityInfoIcon: true, onSeverityChange: onSeverityChange })),
26
- React.createElement(FlexItem, { flex: { default: 'flex_1' }, className: "pf-u-mb-xl" },
26
+ React.createElement(FlexItem, { flex: { default: 'flex_1' }, className: "pf-u-mb-xs" },
27
27
  React.createElement(ContactPhoneNumber, null))),
28
28
  React.createElement(ContactPhoneNumberAlert, null),
29
29
  React.createElement(Fts, { inlineEditable: false }),
@@ -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) &&
@@ -15,4 +15,5 @@ export declare enum CaseStatusEnum {
15
15
  export declare const PHONE_LINE_CANNOT_BE_EMPTY = "Phone number cannot be empty when country code is given.";
16
16
  export declare const PHONE_NO_CHAR_ERROR = "Phone number can only have digits.";
17
17
  export declare const PHONE_IS_NOT_VALID = "Phone number is invalid.";
18
+ export declare const PHONE_INSTRUCTION = "A current phone number with the country code helps us support you better.";
18
19
  //# sourceMappingURL=caseDetailsConstants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"caseDetailsConstants.d.ts","sourceRoot":"","sources":["../../../src/constants/caseDetailsConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oCAAoC,yBAAyB,CAAC;AAE3E,oBAAY,mBAAmB;IAC3B,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,UAAU,gBAAgB;CAC7B;AAED,oBAAY,cAAc;IACtB,MAAM,WAAW;IACjB,mBAAmB,wBAAwB;IAC3C,iBAAiB,uBAAuB;CAC3C;AAED,eAAO,MAAM,0BAA0B,6DAA6D,CAAC;AAErG,eAAO,MAAM,mBAAmB,uCAAuC,CAAC;AAExE,eAAO,MAAM,kBAAkB,6BAA6B,CAAC"}
1
+ {"version":3,"file":"caseDetailsConstants.d.ts","sourceRoot":"","sources":["../../../src/constants/caseDetailsConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oCAAoC,yBAAyB,CAAC;AAE3E,oBAAY,mBAAmB;IAC3B,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,UAAU,gBAAgB;CAC7B;AAED,oBAAY,cAAc;IACtB,MAAM,WAAW;IACjB,mBAAmB,wBAAwB;IAC3C,iBAAiB,uBAAuB;CAC3C;AAED,eAAO,MAAM,0BAA0B,6DAA6D,CAAC;AAErG,eAAO,MAAM,mBAAmB,uCAAuC,CAAC;AAExE,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,eAAO,MAAM,iBAAiB,8EAA8E,CAAC"}
@@ -17,3 +17,4 @@ export var CaseStatusEnum;
17
17
  export const PHONE_LINE_CANNOT_BE_EMPTY = 'Phone number cannot be empty when country code is given.';
18
18
  export const PHONE_NO_CHAR_ERROR = 'Phone number can only have digits.';
19
19
  export const PHONE_IS_NOT_VALID = 'Phone number is invalid.';
20
+ export const PHONE_INSTRUCTION = 'A current phone number with the country code helps us support you better.';
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.10",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -66,8 +66,8 @@
66
66
  "@patternfly/react-core": "4.264.0",
67
67
  "@progress/kendo-drawing": "^1.6.0",
68
68
  "@progress/kendo-react-pdf": "^3.12.0",
69
- "@rh-support/components": "2.1.4",
70
- "@rh-support/react-context": "2.1.4",
69
+ "@rh-support/components": "2.1.5",
70
+ "@rh-support/react-context": "2.1.5",
71
71
  "@rh-support/types": "2.0.2",
72
72
  "@rh-support/user-permissions": "2.1.3",
73
73
  "@rh-support/utils": "2.1.1",
@@ -133,5 +133,5 @@
133
133
  "defaults and supports es6-module",
134
134
  "maintained node versions"
135
135
  ],
136
- "gitHead": "a561664516a56f2e0b9bb4fa59dc3ecd64c27e38"
136
+ "gitHead": "4de9544feb2e412e3f3fc6c95843cce2419a026c"
137
137
  }