@rh-support/troubleshoot 2.2.129 → 2.2.131
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.
- package/lib/esm/components/AccountInfo/OwnerSelector.d.ts.map +1 -1
- package/lib/esm/components/AccountInfo/OwnerSelector.js +1 -77
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +1 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +13 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +37 -15
- package/lib/esm/components/CaseInformation/ContactPhoneNumber.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/ContactPhoneNumber.js +188 -41
- package/lib/esm/components/CaseInformation/ContactPhoneNumberAlert.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/ContactPhoneNumberAlert.js +12 -15
- package/lib/esm/components/CaseInformation/Severity.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/Severity.js +5 -23
- package/lib/esm/components/CaseManagement/CaseManagement.js +4 -4
- package/lib/esm/components/IdeaInformation/IdeaInformation.js +4 -4
- package/lib/esm/components/Recommendations/EARules/EARuleInfoAccordion.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/EARules/EARuleInfoAccordion.js +11 -1
- package/lib/esm/components/Recommendations/InsightsResults.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/InsightsResults.js +14 -1
- package/lib/esm/components/Recommendations/InsightsRuleInfo.d.ts +2 -1
- package/lib/esm/components/Recommendations/InsightsRuleInfo.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/InsightsRuleInfo.js +4 -2
- package/lib/esm/components/Recommendations/Recommendations.js +1 -1
- package/lib/esm/components/Recommendations/RulesModal.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/RulesModal.js +6 -13
- package/lib/esm/components/Review/Review.js +4 -4
- package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
- package/lib/esm/components/SessionRestore/SessionRestore.js +27 -22
- package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
- package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +4 -24
- package/lib/esm/components/shared/utils.d.ts +2 -0
- package/lib/esm/components/shared/utils.d.ts.map +1 -1
- package/lib/esm/components/shared/utils.js +12 -0
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +0 -20
- package/lib/esm/constants/caseDetailsConstants.d.ts +1 -1
- package/lib/esm/constants/caseDetailsConstants.d.ts.map +1 -1
- package/lib/esm/constants/caseDetailsConstants.js +1 -1
- package/lib/esm/css/app.css +2 -0
- package/lib/esm/reducers/CaseConstNTypes.d.ts +7 -0
- package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/CaseConstNTypes.js +11 -3
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +4 -2
- package/lib/esm/reducers/CaseHelpers.d.ts +1 -0
- package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/CaseHelpers.js +7 -1
- package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseReducer.js +8 -1
- package/lib/esm/reducers/SessionRestoreReducer.d.ts +2 -0
- package/lib/esm/reducers/SessionRestoreReducer.d.ts.map +1 -1
- package/lib/esm/reducers/SessionRestoreReducer.js +12 -3
- package/lib/esm/scss/_main.scss +5 -0
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAkB/D,UAAU,MAAM;CAAG;AAEnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAkB/D,UAAU,MAAM;CAAG;AAEnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,qBAsTnC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -28,14 +28,13 @@ import { getChangedValueTooltip } from '../shared/utils';
|
|
|
28
28
|
function OwnerSelector(props) {
|
|
29
29
|
const { t } = useTranslation();
|
|
30
30
|
const caseUpdateError = useCaseUpdateErrorMessage();
|
|
31
|
-
const { accountNumber, caseNumber, selectedNotificationContacts, selectedOwner, selectedCaseGroupUsers, isCaseOwnerUpdating,
|
|
31
|
+
const { accountNumber, caseNumber, selectedNotificationContacts, selectedOwner, selectedCaseGroupUsers, isCaseOwnerUpdating, hasLoggedInUserConfirmedPhoneNumber, } = useCaseSelector((state) => ({
|
|
32
32
|
accountNumber: state.caseDetails.accountNumberRef,
|
|
33
33
|
caseNumber: state.caseDetails.caseNumber,
|
|
34
34
|
selectedNotificationContacts: state.selectedNotificationContacts,
|
|
35
35
|
selectedOwner: state.selectedOwner,
|
|
36
36
|
selectedCaseGroupUsers: state.selectedCaseGroupUsers,
|
|
37
37
|
isCaseOwnerUpdating: state.isCaseOwnerUpdating,
|
|
38
|
-
caseDetailes: state.caseDetails,
|
|
39
38
|
hasLoggedInUserConfirmedPhoneNumber: state.hasLoggedInUserConfirmedPhoneNumber,
|
|
40
39
|
}), isEqual);
|
|
41
40
|
const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
|
|
@@ -52,60 +51,6 @@ function OwnerSelector(props) {
|
|
|
52
51
|
!isEmpty(pvalue.ssoUsername) &&
|
|
53
52
|
value.ssoUsername !== pvalue.ssoUsername;
|
|
54
53
|
const canEditCase = useCanEditCase();
|
|
55
|
-
// set owner on creating a case
|
|
56
|
-
const setContactPhoneNumber = (sso) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
// logged in user and case owner are the same
|
|
58
|
-
if (sso === loggedInUser.data.ssoUsername) {
|
|
59
|
-
if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
|
|
60
|
-
setCaseDetails(caseDispatch, {
|
|
61
|
-
phoneAreaCodePrefixLineNumber: loggedInUser.data.supportPhoneAreaCodePrefixLineNumber,
|
|
62
|
-
phoneCountryCode: loggedInUser.data.supportPhoneCountryCode,
|
|
63
|
-
suppliedPhoneNumberVerified: isEqual(hasLoggedInUserConfirmedPhoneNumber, 'True') || //hasLoggedInUserConfirmedPhoneNumber: global verification phone state for contactSSOName === loggedInUser.data.ssoUsername
|
|
64
|
-
isEqual(hasLoggedInUserConfirmedPhoneNumber, 'Deferred')
|
|
65
|
-
? hasLoggedInUserConfirmedPhoneNumber
|
|
66
|
-
: 'False',
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const phoneLine = getPhoneObj(loggedInUser.data.phone).phoneLine || '';
|
|
71
|
-
const countryCode = getPhoneObj(loggedInUser.data.phone).countryCode;
|
|
72
|
-
setCaseDetails(caseDispatch, {
|
|
73
|
-
phoneAreaCodePrefixLineNumber: phoneLine,
|
|
74
|
-
phoneCountryCode: countryCode,
|
|
75
|
-
suppliedPhoneNumberVerified: isEqual(hasLoggedInUserConfirmedPhoneNumber, 'True') ||
|
|
76
|
-
isEqual(hasLoggedInUserConfirmedPhoneNumber, 'Deferred')
|
|
77
|
-
? hasLoggedInUserConfirmedPhoneNumber
|
|
78
|
-
: 'False',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
try {
|
|
84
|
-
const selectedContact = yield contacts.getSFDCContactBySso(sso);
|
|
85
|
-
if (selectedContact.supportPhoneAreaCodePrefixLineNumber) {
|
|
86
|
-
setCaseDetails(caseDispatch, {
|
|
87
|
-
phoneAreaCodePrefixLineNumber: selectedContact.supportPhoneAreaCodePrefixLineNumber,
|
|
88
|
-
phoneCountryCode: selectedContact.supportPhoneCountryCode,
|
|
89
|
-
suppliedPhoneNumberVerified: 'Deferred',
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
setCaseDetails(caseDispatch, {
|
|
94
|
-
phoneAreaCodePrefixLineNumber: getPhoneObj(selectedContact.phone).phoneLine || '',
|
|
95
|
-
phoneCountryCode: getPhoneObj(selectedContact.phone).countryCode || '',
|
|
96
|
-
suppliedPhoneNumberVerified: 'Deferred',
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
setCaseDetails(caseDispatch, {
|
|
102
|
-
phoneAreaCodePrefixLineNumber: '',
|
|
103
|
-
phoneCountryCode: '',
|
|
104
|
-
suppliedPhoneNumberVerified: 'False',
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
54
|
const updatePhone = (phoneSetting) => __awaiter(this, void 0, void 0, function* () {
|
|
110
55
|
yield updateCaseDetails(caseDispatch, caseNumber, phoneSetting);
|
|
111
56
|
setCaseDetails(caseDispatch, Object.assign({}, phoneSetting));
|
|
@@ -190,7 +135,6 @@ function OwnerSelector(props) {
|
|
|
190
135
|
setLocalOwnerChange(true);
|
|
191
136
|
!isEmpty(selectedContact) &&
|
|
192
137
|
setNotifiedUser(dispatch, filter(notificationContacts, (c) => c.ssoUsername !== selectedContact.ssoUsername));
|
|
193
|
-
setContactPhoneNumber(selectedContact.ssoUsername);
|
|
194
138
|
});
|
|
195
139
|
/** Reset owner when selected account number changes */
|
|
196
140
|
useEffect(() => {
|
|
@@ -286,26 +230,6 @@ function OwnerSelector(props) {
|
|
|
286
230
|
users.length > 0 && setUsersWithGroupAccess(sortHydraContacts(users));
|
|
287
231
|
}
|
|
288
232
|
}, [selectedCaseGroupUsers, caseNumber]);
|
|
289
|
-
// to populate the phone number with the logged in user data
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
if (caseDetailes.contactSSOName === loggedInUser.data.ssoUsername) {
|
|
292
|
-
if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
|
|
293
|
-
setCaseDetails(caseDispatch, {
|
|
294
|
-
phoneAreaCodePrefixLineNumber: loggedInUser.data.supportPhoneAreaCodePrefixLineNumber,
|
|
295
|
-
phoneCountryCode: loggedInUser.data.supportPhoneCountryCode,
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
const phoneLine = getPhoneObj(loggedInUser.data.phone).phoneLine || '';
|
|
300
|
-
const countryCode = getPhoneObj(loggedInUser.data.phone).countryCode;
|
|
301
|
-
setCaseDetails(caseDispatch, {
|
|
302
|
-
phoneAreaCodePrefixLineNumber: phoneLine,
|
|
303
|
-
phoneCountryCode: countryCode,
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
308
|
-
}, []);
|
|
309
233
|
const showUsersWithSelectedGroupAccess = caseNumber &&
|
|
310
234
|
(selectedCaseGroupUsers.isFetching ||
|
|
311
235
|
(!selectedCaseGroupUsers.isFetching && (selectedCaseGroupUsers.data || []).length > 0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AASA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAgB/D,wBAAgB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AASA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAgB/D,wBAAgB,sBAAsB,sBAiTrC"}
|
|
@@ -101,8 +101,7 @@ export function CaseContactPhoneNumber() {
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
const onClear = () => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
|
|
105
|
-
setLocalCountryCodeState('');
|
|
104
|
+
setIsEditting(false);
|
|
106
105
|
});
|
|
107
106
|
const maxLengthErrorMessage = t('Phone number cannot be more than {{limit}} digits.', {
|
|
108
107
|
limit: PHONE_LIMIT,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseComments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AA8BvE,OAAO,
|
|
1
|
+
{"version":3,"file":"CaseComments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AA8BvE,OAAO,KAAkD,MAAM,OAAO,CAAC;AAQvE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,kBAAkB,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAChH;AAED,QAAA,MAAM,YAAY,4EA4UhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -22,7 +22,7 @@ import { AbilityContext, CaseDetailsFields, CaseDiscussionFields, resourceAction
|
|
|
22
22
|
import { formatDateTime, linkifyLinks } from '@rh-support/utils';
|
|
23
23
|
import DOMPurify from 'dompurify';
|
|
24
24
|
import isEmpty from 'lodash/isEmpty';
|
|
25
|
-
import React, { useContext, useState } from 'react';
|
|
25
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
26
26
|
import { Trans, useTranslation } from 'react-i18next';
|
|
27
27
|
import { DiscussionType } from '../../../../reducers/CaseDiscussionTabReducer';
|
|
28
28
|
import { PDFContext } from '../../PDFContainer';
|
|
@@ -31,6 +31,7 @@ import { JumpAndCopyLink } from './JumpAndCopyLink';
|
|
|
31
31
|
const CaseComments = React.forwardRef((props, ref) => {
|
|
32
32
|
var _a;
|
|
33
33
|
const { caseNumber } = props;
|
|
34
|
+
const markdownRef = useRef(null);
|
|
34
35
|
const { t } = useTranslation();
|
|
35
36
|
const ability = useContext(AbilityContext);
|
|
36
37
|
const canSeePrivateComments = ability.can(resourceActions.PATCH, resources.CASE_COMMENTS, CaseDiscussionFields.VIEW_PRIVATE_COMMENT);
|
|
@@ -186,6 +187,16 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
186
187
|
return (React.createElement("pre", { className: "push-top-narrow comment-plaintext reset-pre-text", dangerouslySetInnerHTML: commentText(parseComment), style: { fontFamily: isExportingPDF ? 'DejaVu Sans' : '' } }));
|
|
187
188
|
}
|
|
188
189
|
};
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
if ((markdownRef === null || markdownRef === void 0 ? void 0 : markdownRef.current) && isExportingPDF) {
|
|
192
|
+
const preTags = markdownRef.current.querySelectorAll('pre');
|
|
193
|
+
preTags.forEach((pre) => {
|
|
194
|
+
pre.style.wordWrap = 'break-word';
|
|
195
|
+
pre.style.overflowWrap = 'break-word';
|
|
196
|
+
pre.style.fontFamily = 'DejaVu Sans';
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}, [props.comment, isExportingPDF]);
|
|
189
200
|
if (!((_a = props.comment) === null || _a === void 0 ? void 0 : _a.isPublic) && !canSeePrivateComments)
|
|
190
201
|
return React.createElement(React.Fragment, null);
|
|
191
202
|
return (React.createElement("section", { ref: ref, id: props.comment.id, className: `prevent-split ${computePrivateComment(props.comment)} support-comment ${computeDiscussionCardCalss(props.comment)} ${ref ? 'selected-case-comment' : ''}` },
|
|
@@ -200,7 +211,7 @@ const CaseComments = React.forwardRef((props, ref) => {
|
|
|
200
211
|
React.createElement(Trans, null, "Partner"),
|
|
201
212
|
")"))),
|
|
202
213
|
React.createElement("time", null, formatDateTime(props.comment.lastModifiedDate))),
|
|
203
|
-
React.createElement("div", { className: "comment-body", onClick: onCommentAreaClick }, computeCommentText(props.comment)),
|
|
214
|
+
React.createElement("div", { className: "comment-body", onClick: onCommentAreaClick, ref: markdownRef }, computeCommentText(props.comment)),
|
|
204
215
|
React.createElement("footer", null,
|
|
205
216
|
React.createElement("span", { className: "comment-note" }, computeCommentFooter(props.comment)),
|
|
206
217
|
canSeeFeedbackButtons && commentFeedbackButtons(props.comment, props.feedback),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseDiscussion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAA0B,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseDiscussion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAA0B,MAAM,yCAAyC,CAAC;AAa1G,OAAO,KAAoE,MAAM,OAAO,CAAC;AAsCzF,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC/C,eAAe,EAAE,OAAO,CAAC;CAC5B;AAOD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,MAAM,qBAwmBnD"}
|
|
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { caseAttachments } from '@cee-eng/hydrajs';
|
|
11
|
-
import {
|
|
11
|
+
import { MenuToggle, Select, SelectList, SelectOption } from '@patternfly/react-core';
|
|
12
|
+
import { AlertMessage, AlertType, ErrorBoundary, LoadingIndicator, ToastNotification } from '@rh-support/components';
|
|
12
13
|
import { useGlobalStateContext } from '@rh-support/react-context';
|
|
13
14
|
import { AbilityContext, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
14
|
-
import { getDropdownBtnPlaceholder, getUrlParsedParams, scrollIntoView
|
|
15
|
+
import { getDropdownBtnPlaceholder, getUrlParsedParams, scrollIntoView } from '@rh-support/utils';
|
|
15
16
|
import cloneDeep from 'lodash/cloneDeep';
|
|
16
17
|
import filter from 'lodash/filter';
|
|
17
18
|
import findIndex from 'lodash/findIndex';
|
|
@@ -76,6 +77,10 @@ export default function CaseDiscussion(props) {
|
|
|
76
77
|
const [replyingToPrivateComment, setReplyingToPrivateComment] = useState(null);
|
|
77
78
|
// used for tracking comment section width changes
|
|
78
79
|
const [discussionSectionWidth, setDiscussionSectionWidth] = useState(null);
|
|
80
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
81
|
+
const [selectedFilterItems, setSelectedFilterItems] = useState([]);
|
|
82
|
+
const [isSortOpen, setIsSortOpen] = useState(false);
|
|
83
|
+
const [sortSelected, setSortSelected] = useState('Select a value');
|
|
79
84
|
if (props.isDiscussionTab) {
|
|
80
85
|
cellMeasureCache = new CellMeasurerCache({
|
|
81
86
|
fixedWidth: true,
|
|
@@ -156,14 +161,6 @@ export default function CaseDiscussion(props) {
|
|
|
156
161
|
}
|
|
157
162
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
158
163
|
}, [props.caseComments, caseAttachmentHydra, props.caseChats, caseFeedbacksHydra, caseExternalTrackersUpdate]);
|
|
159
|
-
const onSortChange = (selectedSort) => {
|
|
160
|
-
setSort(dispatchDiscussion, selectedSort.value, allDiscussions);
|
|
161
|
-
};
|
|
162
|
-
const onFilterChange = (selectedFilter) => {
|
|
163
|
-
selectedFilter = selectedFilter.map((item) => item.value.value);
|
|
164
|
-
setFilter(dispatchDiscussion, selectedFilter, discussionFiltersListState);
|
|
165
|
-
shouldRenderRVComponent && setCanUpdateScrollTop(false);
|
|
166
|
-
};
|
|
167
164
|
const onAttachmentRemove = (uuid_removed) => {
|
|
168
165
|
updateAttacmentsAfterRemoval(dispatchDiscussion, uuid_removed, allDiscussions, discussionFiltersListState);
|
|
169
166
|
};
|
|
@@ -326,6 +323,30 @@ export default function CaseDiscussion(props) {
|
|
|
326
323
|
}
|
|
327
324
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
328
325
|
}, [isPostingRemoteRequestCommentCompleted]);
|
|
326
|
+
const onToggleClick = () => {
|
|
327
|
+
setIsOpen(!isOpen);
|
|
328
|
+
};
|
|
329
|
+
const onSortToggleClick = () => {
|
|
330
|
+
setIsSortOpen(!isSortOpen);
|
|
331
|
+
};
|
|
332
|
+
const onFilterSelect = (_event, prevOption) => {
|
|
333
|
+
const isFilterSelected = !prevOption.isSelected; // to get updated state of changed filter
|
|
334
|
+
const prevSelectedFilters = list.filter((option) => option.isSelected && option.value !== prevOption.value); // to get previously selected filters
|
|
335
|
+
const prevSelectedFiltersValue = prevSelectedFilters.map((option) => option.value);
|
|
336
|
+
const newSelectedFilters = isFilterSelected // has all the selected values of filter with the updated selected filter state
|
|
337
|
+
? [...prevSelectedFiltersValue, prevOption.value]
|
|
338
|
+
: prevSelectedFiltersValue;
|
|
339
|
+
setFilter(dispatchDiscussion, newSelectedFilters, discussionFiltersListState);
|
|
340
|
+
shouldRenderRVComponent && setCanUpdateScrollTop(false);
|
|
341
|
+
setSelectedFilterItems(prevSelectedFiltersValue);
|
|
342
|
+
};
|
|
343
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isFullWidth: true }, getDropdownBtnPlaceholder(t('Select a filter'), list.filter((i) => i.isSelected).map((i) => i.filterLabel), ' ', list.length, t('All comments'))));
|
|
344
|
+
const onSortSelect = (_event, selectedSort) => {
|
|
345
|
+
setSort(dispatchDiscussion, selectedSort, allDiscussions);
|
|
346
|
+
setSortSelected(selectedSort.value);
|
|
347
|
+
setIsSortOpen(false);
|
|
348
|
+
};
|
|
349
|
+
const onSortToggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onSortToggleClick, isExpanded: isSortOpen, isFullWidth: true }, sort.name));
|
|
329
350
|
return (React.createElement(React.Fragment, null,
|
|
330
351
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading post comment section') } },
|
|
331
352
|
React.createElement(AttachmentContextProvider, null,
|
|
@@ -346,12 +367,13 @@ export default function CaseDiscussion(props) {
|
|
|
346
367
|
React.createElement("div", { className: `pfe-l-grid pfe-m-all-6-col pfe-m-gutters push-bottom ${isExportingPDF ? 'hide-in-pdf' : ''}` },
|
|
347
368
|
React.createElement("div", { className: "pfe-m-12-col" }, allDiscussions.length > 20 && (React.createElement(CommentSearch, { caseDiscussions: computeFilteredComments || [], onCommentSearch: onCaseCommentSearch, isCommentSearchCleared: isCommentSearchCleared }))),
|
|
348
369
|
React.createElement("span", { className: "push-top-narrow" },
|
|
349
|
-
React.createElement(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}), list: toOptions(list, { labelKey: 'filterLabel', disabledKey: 'isDisabled' }) })),
|
|
370
|
+
React.createElement("label", { htmlFor: "case-list-comments-dropdown", className: "pf-v5-u-mb-sm" }, t('Filter by')),
|
|
371
|
+
React.createElement(Select, { "data-tracking-id": "discussions-filter-comments-dropdown", id: "case-list-comments-dropdown", role: "menu", isOpen: isOpen, selected: selectedFilterItems, onSelect: onFilterSelect, onOpenChange: (isOpen) => setIsOpen(isOpen), toggle: toggle, popperProps: { direction: 'down', enableFlip: false }, zIndex: 9 },
|
|
372
|
+
React.createElement(SelectList, null, list.map((option) => (React.createElement(SelectOption, { hasCheckbox: true, value: option, isSelected: option.isSelected, isDisabled: option.isDisabled }, option.filterLabel)))))),
|
|
353
373
|
React.createElement("span", { className: "push-top-narrow" },
|
|
354
|
-
React.createElement(
|
|
374
|
+
React.createElement("label", { htmlFor: "se-discussion-sort", className: "pf-v5-u-mb-sm" }, t('Sort by')),
|
|
375
|
+
React.createElement(Select, { id: "se-discussion-sort", "data-tracking-id": "discussions-sort-dropdown", isOpen: isSortOpen, selected: sortSelected, onSelect: onSortSelect, onOpenChange: (isSortOpen) => setIsSortOpen(isSortOpen), toggle: onSortToggle, shouldFocusToggleOnSelect: true, popperProps: { direction: 'down', enableFlip: false }, zIndex: 9 },
|
|
376
|
+
React.createElement(SelectList, null, discussionSortOrderConst.map((option) => (React.createElement(SelectOption, { value: option, isSelected: isEqual(sort.name, option.name) }, option.name))))))),
|
|
355
377
|
React.createElement("div", { className: "support-comment-section" }, !shouldRenderRVComponent &&
|
|
356
378
|
!isSearchResultEmpty &&
|
|
357
379
|
comuteSearchedComments.map((discussion, index) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAkB/D,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAkB/D,wBAAgB,kBAAkB,sBA2UjC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
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 { contacts } from '@cee-eng/hydrajs';
|
|
1
11
|
import { ValidatedOptions } from '@patternfly/react-core';
|
|
2
12
|
import { getPhoneObj, PhoneInput } from '@rh-support/components';
|
|
3
13
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
4
|
-
import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
5
14
|
import isEmpty from 'lodash/isEmpty';
|
|
6
15
|
import isEqual from 'lodash/isEqual';
|
|
7
16
|
import isUndefined from 'lodash/isUndefined';
|
|
@@ -11,33 +20,59 @@ import { PHONE_INSTRUCTION, PHONE_IS_NOT_VALID, PHONE_LINE_CANNOT_BE_EMPTY, PHON
|
|
|
11
20
|
import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
|
|
12
21
|
import { RouteContext } from '../../context/RouteContext';
|
|
13
22
|
import { PHONE_LIMIT } from '../../reducers/CaseConstNTypes';
|
|
14
|
-
import { setCaseDetails } from '../../reducers/CaseReducer';
|
|
23
|
+
import { setCaseDetails, setCaseState } from '../../reducers/CaseReducer';
|
|
15
24
|
import { PDFContext } from '../CaseEditView/PDFContainer';
|
|
16
|
-
import { trimAndReplacePlus } from '../shared/utils';
|
|
25
|
+
import { removeAllChars, trimAndReplacePlus } from '../shared/utils';
|
|
17
26
|
import { ContactPhoneNumberPopOver } from './ContactPhoneNumberPopOver';
|
|
18
27
|
import MandatoryPhonePopOver from './MandatoryPhonePopOver';
|
|
19
28
|
export function ContactPhoneNumber() {
|
|
20
|
-
const { suppliedPhoneNumberVerified, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '',
|
|
29
|
+
const { suppliedPhoneNumberVerified, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', hasLoggedInUserConfirmedPhoneNumber, contactSSOName, shouldNotSetPhoneCountryCode, } = useCaseSelector((state) => ({
|
|
21
30
|
suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
|
|
22
31
|
phoneCountryCode: state.caseDetails.phoneCountryCode,
|
|
23
32
|
phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber,
|
|
24
|
-
|
|
33
|
+
hasLoggedInUserConfirmedPhoneNumber: state.hasLoggedInUserConfirmedPhoneNumber,
|
|
34
|
+
contactSSOName: state.caseDetails.contactSSOName,
|
|
35
|
+
shouldNotSetPhoneCountryCode: state.shouldNotSetPhoneCountryCode,
|
|
25
36
|
}), isEqual);
|
|
26
37
|
const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
|
|
27
38
|
const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
|
|
28
39
|
const [invalid, setInvalid] = useState(false);
|
|
29
|
-
const [
|
|
40
|
+
const [portalPhone, setPortalPhone] = useState('');
|
|
41
|
+
const [localFullPhone, setLocalFullPhone] = useState('');
|
|
42
|
+
const [isSettingLocalPhone, setIsSettingLocalPhone] = useState(false);
|
|
43
|
+
const [isFetchingSso, setIsFetchingSso] = useState(false);
|
|
30
44
|
const { isExportingPDF } = useContext(PDFContext);
|
|
31
|
-
const canChangeAccountInfo = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ACCOUNT_AND_OWNER);
|
|
32
45
|
const getPhone = () => phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber;
|
|
33
46
|
const caseDispatch = useCaseDispatch();
|
|
34
47
|
const { t } = useTranslation();
|
|
48
|
+
const checkingPlusInLocalFullPhone = (_localFullPhone) => {
|
|
49
|
+
if (isEqual(_localFullPhone.trim(), '+')) {
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
else if (!isEmpty(_localFullPhone.trim()) && !_localFullPhone.trim().startsWith('+')) {
|
|
53
|
+
return '+' + _localFullPhone.trim();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return _localFullPhone.trim();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
35
59
|
const onPhoneChange = (fullPhone) => {
|
|
36
|
-
setLocalFullPhone(fullPhone);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
setLocalFullPhone(checkingPlusInLocalFullPhone(fullPhone));
|
|
61
|
+
if (!shouldNotSetPhoneCountryCode) {
|
|
62
|
+
setCaseDetails(caseDispatch, {
|
|
63
|
+
phoneAreaCodePrefixLineNumber: getPhoneObj(fullPhone).phoneLine,
|
|
64
|
+
phoneCountryCode: getPhoneObj(fullPhone).countryCode,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (!isEmpty(fullPhone) && !isEqual(removeAllChars(portalPhone), removeAllChars(fullPhone))) {
|
|
69
|
+
setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: false });
|
|
70
|
+
}
|
|
71
|
+
setCaseDetails(caseDispatch, {
|
|
72
|
+
phoneAreaCodePrefixLineNumber: checkingPlusInLocalFullPhone(fullPhone),
|
|
73
|
+
phoneCountryCode: '',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
41
76
|
};
|
|
42
77
|
const onCountryCodeChange = (phoneCountryCode) => {
|
|
43
78
|
setCaseDetails(caseDispatch, { phoneCountryCode });
|
|
@@ -52,7 +87,6 @@ export function ContactPhoneNumber() {
|
|
|
52
87
|
isEmpty(phoneAreaCodePrefixLineNumber === null || phoneAreaCodePrefixLineNumber === void 0 ? void 0 : phoneAreaCodePrefixLineNumber.replace(phoneCountryCode, ''));
|
|
53
88
|
const isPhoneNumberValid = !isEmpty(phoneAreaCodePrefixLineNumber) &&
|
|
54
89
|
!isNextBtnClickedToShowValidationError &&
|
|
55
|
-
isExistingPhoneNumber &&
|
|
56
90
|
!isEmpty(trimAndReplacePlus(phoneCountryCode)) &&
|
|
57
91
|
(isEqual(suppliedPhoneNumberVerified, 'False') || isUndefined(suppliedPhoneNumberVerified))
|
|
58
92
|
? ValidatedOptions.warning
|
|
@@ -66,47 +100,160 @@ export function ContactPhoneNumber() {
|
|
|
66
100
|
: invalid
|
|
67
101
|
? ValidatedOptions.error
|
|
68
102
|
: ValidatedOptions.default;
|
|
103
|
+
// This useEffect initialize phone number inputbox
|
|
104
|
+
// - User open case for first time for herself/himself -> show portal phone number
|
|
105
|
+
// - User open case for NOT first time for herself/himself -> show phone number that we have on user contact in SF
|
|
69
106
|
useEffect(() => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
const getPhoneInfo = () => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
if (isEmpty(loggedInUser.data.phone) &&
|
|
109
|
+
isEmpty(loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) &&
|
|
110
|
+
isEmpty(loggedInUser.data.supportPhoneCountryCode))
|
|
111
|
+
setLocalFullPhone('');
|
|
112
|
+
setIsSettingLocalPhone(true);
|
|
113
|
+
const initContactPhoneNumber = () => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
let _phoneAreaCodePrefixLineNumber;
|
|
115
|
+
let _phoneCountryCode;
|
|
116
|
+
let _suppliedPhoneNumberVerified;
|
|
117
|
+
// logged in user and case owner are the same
|
|
118
|
+
if (contactSSOName === loggedInUser.data.ssoUsername) {
|
|
119
|
+
if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
|
|
120
|
+
// User has opened a case before and has phone and area code in her/his contact on SF
|
|
121
|
+
_phoneAreaCodePrefixLineNumber = loggedInUser.data.supportPhoneAreaCodePrefixLineNumber;
|
|
122
|
+
_phoneCountryCode = loggedInUser.data.supportPhoneCountryCode;
|
|
123
|
+
_suppliedPhoneNumberVerified =
|
|
124
|
+
isEqual(hasLoggedInUserConfirmedPhoneNumber, 'True') ||
|
|
125
|
+
isEqual(hasLoggedInUserConfirmedPhoneNumber, 'Deferred')
|
|
126
|
+
? hasLoggedInUserConfirmedPhoneNumber
|
|
127
|
+
: 'False';
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
// User is openning a case for the first time
|
|
131
|
+
const phoneLength = trimAndReplacePlus(removeAllChars(loggedInUser.data.phone)).length;
|
|
132
|
+
// For first time user whose phone is fetched from portal without country code
|
|
133
|
+
// For phone length less or equal to 10 country code shouldn't be fetched to avoid faulty phone population
|
|
134
|
+
if (phoneLength > 10) {
|
|
135
|
+
const phoneLine = getPhoneObj(loggedInUser.data.phone).phoneLine || '';
|
|
136
|
+
const countryCode = getPhoneObj(loggedInUser.data.phone).countryCode;
|
|
137
|
+
_phoneAreaCodePrefixLineNumber = phoneLine;
|
|
138
|
+
_phoneCountryCode = countryCode;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
setCaseState(caseDispatch, {
|
|
142
|
+
shouldNotSetPhoneCountryCode: true,
|
|
143
|
+
});
|
|
144
|
+
_phoneAreaCodePrefixLineNumber = loggedInUser.data.phone;
|
|
145
|
+
_phoneCountryCode = '';
|
|
146
|
+
setPortalPhone(loggedInUser.data.phone);
|
|
147
|
+
}
|
|
148
|
+
_suppliedPhoneNumberVerified =
|
|
149
|
+
isEqual(hasLoggedInUserConfirmedPhoneNumber, 'True') ||
|
|
150
|
+
isEqual(hasLoggedInUserConfirmedPhoneNumber, 'Deferred')
|
|
151
|
+
? hasLoggedInUserConfirmedPhoneNumber
|
|
152
|
+
: 'False';
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
// user is openning case for others (use is partner or red hatter)
|
|
157
|
+
try {
|
|
158
|
+
if (!contactSSOName)
|
|
159
|
+
return;
|
|
160
|
+
setIsFetchingSso(true);
|
|
161
|
+
const selectedContact = yield contacts.getSFDCContactBySso(contactSSOName);
|
|
162
|
+
setIsFetchingSso(false);
|
|
163
|
+
if (selectedContact.supportPhoneAreaCodePrefixLineNumber) {
|
|
164
|
+
_phoneAreaCodePrefixLineNumber = selectedContact.supportPhoneAreaCodePrefixLineNumber;
|
|
165
|
+
_phoneCountryCode = selectedContact.supportPhoneCountryCode;
|
|
166
|
+
_suppliedPhoneNumberVerified = 'Deferred';
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const phoneLength = trimAndReplacePlus(removeAllChars(selectedContact.phone)).length;
|
|
170
|
+
if (phoneLength > 10) {
|
|
171
|
+
_phoneAreaCodePrefixLineNumber = getPhoneObj(selectedContact.phone).phoneLine || '';
|
|
172
|
+
_phoneCountryCode = getPhoneObj(selectedContact.phone).countryCode || '';
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
_phoneAreaCodePrefixLineNumber = selectedContact.phone;
|
|
176
|
+
_phoneCountryCode = '';
|
|
177
|
+
setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: true });
|
|
178
|
+
setPortalPhone(selectedContact.phone);
|
|
179
|
+
}
|
|
180
|
+
_suppliedPhoneNumberVerified = 'Deferred';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
_phoneAreaCodePrefixLineNumber = '';
|
|
185
|
+
_phoneCountryCode = '';
|
|
186
|
+
_suppliedPhoneNumberVerified = 'False';
|
|
187
|
+
setIsFetchingSso(false);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
74
190
|
setCaseDetails(caseDispatch, {
|
|
75
|
-
phoneAreaCodePrefixLineNumber:
|
|
76
|
-
phoneCountryCode:
|
|
191
|
+
phoneAreaCodePrefixLineNumber: _phoneAreaCodePrefixLineNumber,
|
|
192
|
+
phoneCountryCode: _phoneCountryCode,
|
|
193
|
+
suppliedPhoneNumberVerified: _suppliedPhoneNumberVerified,
|
|
77
194
|
});
|
|
195
|
+
let _localFullPhone = _phoneCountryCode + ' ' + _phoneAreaCodePrefixLineNumber;
|
|
196
|
+
setLocalFullPhone(checkingPlusInLocalFullPhone(_localFullPhone));
|
|
197
|
+
setIsSettingLocalPhone(false);
|
|
198
|
+
});
|
|
199
|
+
// if phone not initialized with portal and user contact value, initialize it else populate phone inputbox
|
|
200
|
+
if (isEmpty(phoneAreaCodePrefixLineNumber) && isEmpty(phoneCountryCode)) {
|
|
201
|
+
initContactPhoneNumber();
|
|
78
202
|
}
|
|
79
203
|
else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
204
|
+
let phoneLength;
|
|
205
|
+
let portalPhone;
|
|
206
|
+
let supportPhone;
|
|
207
|
+
setIsSettingLocalPhone(true);
|
|
208
|
+
const getSelectedContactPhoneInfo = () => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
try {
|
|
210
|
+
if (!contactSSOName)
|
|
211
|
+
return;
|
|
212
|
+
const selectedContact = yield contacts.getSFDCContactBySso(contactSSOName);
|
|
213
|
+
if (isEmpty(selectedContact.supportPhoneAreaCodePrefixLineNumber) &&
|
|
214
|
+
!isEmpty(selectedContact.phone)) {
|
|
215
|
+
portalPhone = selectedContact.phone;
|
|
216
|
+
phoneLength = trimAndReplacePlus(removeAllChars(portalPhone)).length;
|
|
217
|
+
supportPhone = selectedContact.supportPhoneAreaCodePrefixLineNumber;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
portalPhone = '';
|
|
222
|
+
supportPhone = '';
|
|
223
|
+
phoneLength = 0;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
// logged in user and case owner are the same
|
|
227
|
+
if (contactSSOName === loggedInUser.data.ssoUsername) {
|
|
228
|
+
if (isEmpty(loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) &&
|
|
229
|
+
!isEmpty(loggedInUser.data.phone)) {
|
|
230
|
+
portalPhone = loggedInUser.data.phone;
|
|
231
|
+
phoneLength = trimAndReplacePlus(removeAllChars(portalPhone)).length;
|
|
232
|
+
supportPhone = loggedInUser.data.supportPhoneAreaCodePrefixLineNumber;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// user is openning case for others (use is partner or red hatter)
|
|
237
|
+
yield getSelectedContactPhoneInfo();
|
|
89
238
|
}
|
|
239
|
+
if ((isUndefined(supportPhone) || isEmpty(supportPhone)) &&
|
|
240
|
+
isEqual(removeAllChars(portalPhone), removeAllChars(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber)) &&
|
|
241
|
+
phoneLength <= 10) {
|
|
242
|
+
setPortalPhone(portalPhone);
|
|
243
|
+
}
|
|
244
|
+
setLocalFullPhone(checkingPlusInLocalFullPhone((phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber).trim()));
|
|
245
|
+
setIsSettingLocalPhone(false);
|
|
90
246
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
|
-
}, [phoneAreaCodePrefixLineNumber, phoneCountryCode, loggedInUser.data.phone]);
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
if (isEqual(localFullPhone.trim(), '+')) {
|
|
97
|
-
setLocalFullPhone('');
|
|
98
|
-
}
|
|
99
|
-
else if (!isEmpty(localFullPhone) && !localFullPhone.startsWith('+')) {
|
|
100
|
-
setLocalFullPhone('+' + localFullPhone.replace(' ', ''));
|
|
101
|
-
}
|
|
247
|
+
});
|
|
248
|
+
getPhoneInfo();
|
|
102
249
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
-
}, [
|
|
250
|
+
}, [contactSSOName, shouldNotSetPhoneCountryCode]);
|
|
104
251
|
return (React.createElement("div", { className: "form-group", style: { minWidth: '200px' } },
|
|
105
252
|
React.createElement("label", null,
|
|
106
253
|
React.createElement(Trans, null, "Case owner's phone number"),
|
|
107
254
|
React.createElement("span", { className: `form-required ${isExportingPDF ? 'hide-in-pdf' : ''}`, "aria-hidden": true }, "*"),
|
|
108
255
|
ContactPhoneNumberPopOver()),
|
|
109
|
-
React.createElement(PhoneInput, { phoneValue: localFullPhone, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid }),
|
|
256
|
+
React.createElement(PhoneInput, { phoneValue: localFullPhone, countryCode: phoneCountryCode, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid, isLoading: isFetchingSso || isSettingLocalPhone, shouldNotSetCountryCode: shouldNotSetPhoneCountryCode }),
|
|
110
257
|
React.createElement(MandatoryPhonePopOver, null),
|
|
111
258
|
!invalid &&
|
|
112
259
|
getPhone().length < PHONE_LIMIT &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactPhoneNumberAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumberAlert.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContactPhoneNumberAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumberAlert.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAQrD,wBAAgB,uBAAuB,sBAqFtC"}
|