@rh-support/troubleshoot 2.2.4 → 2.2.5

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.
Files changed (29) hide show
  1. package/lib/esm/components/AccountInfo/AccountSelector.js +1 -1
  2. package/lib/esm/components/AccountInfo/OwnerSelector.d.ts.map +1 -1
  3. package/lib/esm/components/AccountInfo/OwnerSelector.js +45 -22
  4. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  5. package/lib/esm/components/CaseEditView/CaseOverview/index.js +2 -0
  6. package/lib/esm/components/CaseEditView/PDFContainer.d.ts.map +1 -1
  7. package/lib/esm/components/CaseEditView/PDFContainer.js +2 -9
  8. package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.d.ts.map +1 -1
  9. package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.js +1 -1
  10. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.d.ts.map +1 -1
  11. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +36 -27
  12. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.d.ts.map +1 -1
  13. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.js +8 -5
  14. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberSev1ConfirmAlert.d.ts.map +1 -1
  15. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberSev1ConfirmAlert.js +4 -4
  16. package/lib/esm/components/CaseInformation/ContactPhoneNumber.d.ts.map +1 -1
  17. package/lib/esm/components/CaseInformation/ContactPhoneNumber.js +25 -20
  18. package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
  19. package/lib/esm/components/shared/useIsSectionValid.js +5 -13
  20. package/lib/esm/components/shared/utils.d.ts +1 -0
  21. package/lib/esm/components/shared/utils.d.ts.map +1 -1
  22. package/lib/esm/components/shared/utils.js +16 -0
  23. package/lib/esm/constants/caseDetailsConstants.d.ts +3 -0
  24. package/lib/esm/constants/caseDetailsConstants.d.ts.map +1 -1
  25. package/lib/esm/constants/caseDetailsConstants.js +3 -0
  26. package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
  27. package/lib/esm/reducers/CaseHelpers.js +4 -17
  28. package/lib/esm/scss/_main.scss +5 -0
  29. package/package.json +8 -8
@@ -119,7 +119,7 @@ function AccountSelector(props) {
119
119
  React.createElement(Trans, null, "Find my account")))),
120
120
  React.createElement("div", { className: "account-selector-wrapper" },
121
121
  React.createElement(AccountSelectorInternal, { selectedAccounts: [selectedAccount], canBookmarkAccount: canBookmarkAccounts, bookmarkedAccounts: bookmarkedGroupAccounts.data, id: "account-or-bookmark-selector", className: "account-selector", name: "account-or-bookmark-selector", placeholder: t(`Search for an account ${loggedInUserRights.data.isExternal() ? 'or select a bookmark' : ''} `), onSelect: onInternalAccountSelect, disabled: loggedInUserRights.data.isExternal() || selectedAccountDetails.isFetching, isInValid: isSelectedAccountSubscriptionAbused, restrictedOnSubscriptionAbuse: true })),
122
- canAccessManagedAccounts && (React.createElement(ManagedAccountsDropdown, { className: "managed-account-selector", onManagedAccountChange: onManagedAccountChange, managedAccounts: managedAccounts, selectedAccountNumber: accountNumber, disabled: selectedAccountDetails.isFetching })),
122
+ canAccessManagedAccounts && (React.createElement(ManagedAccountsDropdown, { className: "managed-account-selector pf-u-mt-xl", onManagedAccountChange: onManagedAccountChange, managedAccounts: managedAccounts, selectedAccountNumber: accountNumber, disabled: selectedAccountDetails.isFetching })),
123
123
  isSelectedAccountSubscriptionAbused && (React.createElement("p", { className: "form-instructions form-invalid" },
124
124
  React.createElement(InfoCircleIcon, null),
125
125
  ' ',
@@ -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,eA8TnC;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,eA0VnC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { contacts } from '@cee-eng/hydrajs';
11
- import { CaseContactsSelectorExternal, getHydraContactLabel, renderMenuItemChildren, ToastNotification, usePrevious, ValueChangedIcon, } from '@rh-support/components';
11
+ import { CaseContactsSelectorExternal, getHydraContactLabel, getPhoneObj, renderMenuItemChildren, ToastNotification, usePrevious, ValueChangedIcon, } from '@rh-support/components';
12
12
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
13
13
  import { sortHydraContacts } from '@rh-support/utils';
14
14
  import filter from 'lodash/filter';
@@ -28,13 +28,14 @@ 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, } = useCaseSelector((state) => ({
31
+ const { accountNumber, caseNumber, selectedNotificationContacts, selectedOwner, selectedCaseGroupUsers, isCaseOwnerUpdating, caseDetailes, } = 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,
38
39
  }), isEqual);
39
40
  const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
40
41
  const caseDispatch = useCaseDispatch();
@@ -50,7 +51,9 @@ function OwnerSelector(props) {
50
51
  !isEmpty(pvalue.ssoUsername) &&
51
52
  value.ssoUsername !== pvalue.ssoUsername;
52
53
  const canEditCase = useCanEditCase();
54
+ // set owner on creating a case
53
55
  const setContactPhoneNumber = (sso) => __awaiter(this, void 0, void 0, function* () {
56
+ // logged in user and case owner are the same
54
57
  if (sso === loggedInUser.data.ssoUsername) {
55
58
  if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
56
59
  setCaseDetails(caseDispatch, {
@@ -61,7 +64,8 @@ function OwnerSelector(props) {
61
64
  }
62
65
  else {
63
66
  setCaseDetails(caseDispatch, {
64
- phone: loggedInUser.data.phone,
67
+ phoneAreaCodePrefixLineNumber: getPhoneObj(loggedInUser.data.phone).phoneLine || '',
68
+ phoneCountryCode: getPhoneObj(loggedInUser.data.phone).countryCode,
65
69
  suppliedPhoneNumberVerified: 'True',
66
70
  });
67
71
  }
@@ -73,12 +77,13 @@ function OwnerSelector(props) {
73
77
  setCaseDetails(caseDispatch, {
74
78
  phoneAreaCodePrefixLineNumber: selectedContact.supportPhoneAreaCodePrefixLineNumber,
75
79
  phoneCountryCode: selectedContact.supportPhoneCountryCode,
76
- suppliedPhoneNumberVerified: 'True',
80
+ suppliedPhoneNumberVerified: 'Deferred',
77
81
  });
78
82
  }
79
83
  else {
80
84
  setCaseDetails(caseDispatch, {
81
- phone: selectedContact.phone,
85
+ phoneAreaCodePrefixLineNumber: getPhoneObj(selectedContact.phone).phoneLine || '',
86
+ phoneCountryCode: getPhoneObj(selectedContact.phone).countryCode || '',
82
87
  suppliedPhoneNumberVerified: 'Deferred',
83
88
  });
84
89
  }
@@ -87,50 +92,68 @@ function OwnerSelector(props) {
87
92
  setCaseDetails(caseDispatch, {
88
93
  phoneAreaCodePrefixLineNumber: '',
89
94
  phoneCountryCode: '',
90
- suppliedPhoneNumberVerified: 'Deferred',
95
+ suppliedPhoneNumberVerified: 'False',
91
96
  });
92
97
  }
93
98
  }
94
99
  });
100
+ const updatePhone = (phoneSetting) => __awaiter(this, void 0, void 0, function* () {
101
+ yield updateCaseDetails(caseDispatch, caseNumber, phoneSetting);
102
+ setCaseDetails(caseDispatch, Object.assign(Object.assign({}, caseDetailes), phoneSetting));
103
+ });
104
+ // set owner on updating a case
95
105
  const updateContactPhoneNumber = (sso) => __awaiter(this, void 0, void 0, function* () {
96
106
  try {
107
+ // logged in user and case owner are the same
97
108
  if (sso === loggedInUser.data.ssoUsername) {
98
- if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
99
- updateCaseDetails(caseDispatch, caseNumber, {
100
- phoneAreaCodePrefixLineNumber: loggedInUser.data.supportPhoneAreaCodePrefixLineNumber,
101
- phoneCountryCode: loggedInUser.data.supportPhoneCountryCode,
102
- suppliedPhoneNumberVerified: 'True',
103
- });
109
+ try {
110
+ if (loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) {
111
+ yield updatePhone({
112
+ phoneAreaCodePrefixLineNumber: loggedInUser.data.supportPhoneAreaCodePrefixLineNumber,
113
+ phoneCountryCode: loggedInUser.data.supportPhoneCountryCode,
114
+ suppliedPhoneNumberVerified: 'True',
115
+ });
116
+ }
117
+ else {
118
+ yield updatePhone({
119
+ phoneAreaCodePrefixLineNumber: getPhoneObj(loggedInUser.data.phone).phoneLine || '',
120
+ phoneCountryCode: getPhoneObj(loggedInUser.data.phone).countryCode || '',
121
+ suppliedPhoneNumberVerified: 'False',
122
+ });
123
+ }
104
124
  }
105
- else {
106
- yield updateCaseDetails(caseDispatch, caseNumber, {
107
- phone: loggedInUser.data.phone,
108
- suppliedPhoneNumberVerified: 'Deferred',
125
+ catch (e) {
126
+ yield updatePhone({
127
+ phoneAreaCodePrefixLineNumber: '',
128
+ phoneCountryCode: '',
129
+ suppliedPhoneNumberVerified: 'False',
109
130
  });
110
131
  }
111
132
  }
112
133
  else {
134
+ // logged in user and case owner are different
113
135
  try {
114
136
  const selectedContact = yield contacts.getSFDCContactBySso(sso);
115
137
  if (selectedContact.supportPhoneAreaCodePrefixLineNumber) {
116
- updateCaseDetails(caseDispatch, caseNumber, {
138
+ yield updatePhone({
117
139
  phoneAreaCodePrefixLineNumber: selectedContact.supportPhoneAreaCodePrefixLineNumber,
118
140
  phoneCountryCode: selectedContact.supportPhoneCountryCode,
119
- suppliedPhoneNumberVerified: 'True',
141
+ suppliedPhoneNumberVerified: 'Deferred',
120
142
  });
121
143
  }
122
144
  else {
123
- yield updateCaseDetails(caseDispatch, caseNumber, {
124
- phone: selectedContact.phone,
145
+ yield updatePhone({
146
+ phoneAreaCodePrefixLineNumber: getPhoneObj(selectedContact.phone).phoneLine || '',
147
+ phoneCountryCode: getPhoneObj(selectedContact.phone).countryCode || '',
125
148
  suppliedPhoneNumberVerified: 'Deferred',
126
149
  });
127
150
  }
128
151
  }
129
152
  catch (e) {
130
- yield updateCaseDetails(caseDispatch, caseNumber, {
153
+ yield updatePhone({
131
154
  phoneAreaCodePrefixLineNumber: '',
132
155
  phoneCountryCode: '',
133
- suppliedPhoneNumberVerified: 'Deferred',
156
+ suppliedPhoneNumberVerified: 'False',
134
157
  });
135
158
  }
136
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA8D,MAAM,OAAO,CAAC;AA6BnF,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eA4ejD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA8D,MAAM,OAAO,CAAC;AA8BnF,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,eA6ejD"}
@@ -27,6 +27,7 @@ import { ReopenCaseModal } from '../ConfirmationModals/ReopenCaseModal';
27
27
  import { PDFContext } from '../PDFContainer';
28
28
  import { CaseInformation } from '../Tabs/CaseDetails/CaseInformation';
29
29
  import { CaseContactPhoneNumberAlert } from '../Tabs/CaseDetails/CasePhoneNumberConfirmAlert';
30
+ import { CasePhoneNumberSev1ConfirmAlert } from '../Tabs/CaseDetails/CasePhoneNumberSev1ConfirmAlert';
30
31
  import Summary from '../Tabs/CaseDetails/Summary';
31
32
  import CaseOwnerInfo from './CaseOwnerInfo';
32
33
  import CaseStatus from './CaseStatus';
@@ -229,6 +230,7 @@ export default function CaseOverview(props) {
229
230
  React.createElement("p", { className: "pf-u-mb-sm" },
230
231
  React.createElement(Trans, null, "The customer has received two warnings regarding inactivity. This case will be closed soon if we don't receive any input."))) })))),
231
232
  React.createElement(CaseContactPhoneNumberAlert, { isReview: true, tabRef: props.tabsRef }),
233
+ React.createElement(CasePhoneNumberSev1ConfirmAlert, { isReview: true, tabRef: props.tabsRef }),
232
234
  React.createElement("header", null,
233
235
  React.createElement("h2", { className: "case-ID" },
234
236
  React.createElement(Trans, null, "Case"),
@@ -1 +1 @@
1
- {"version":3,"file":"PDFContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/PDFContainer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAGhD,UAAU,MAAM;IACZ,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACzC;AAED,UAAU,UAAU;IAChB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACrC;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC;CACpD;AAED,eAAO,MAAM,UAAU,4BAIN,CAAC;AAYlB,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,eA2KzC"}
1
+ {"version":3,"file":"PDFContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/PDFContainer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAGhD,UAAU,MAAM;IACZ,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACzC;AAED,UAAU,UAAU;IAChB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACrC;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC;CACpD;AAED,eAAO,MAAM,UAAU,4BAIN,CAAC;AAYlB,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,eAwJzC"}
@@ -1,8 +1,8 @@
1
- import { Button, Modal, ModalVariant, Tooltip, TooltipPosition } from '@patternfly/react-core';
1
+ import { Button, Modal, ModalVariant } from '@patternfly/react-core';
2
2
  import DownloadIcon from '@patternfly/react-icons/dist/js/icons/download-icon';
3
3
  import { savePDF } from '@progress/kendo-react-pdf';
4
4
  import React, { useRef, useState } from 'react';
5
- import { getI18n, Trans, useTranslation } from 'react-i18next';
5
+ import { Trans, useTranslation } from 'react-i18next';
6
6
  export const PDFContext = React.createContext({
7
7
  isExportingPDF: null,
8
8
  exportPDFButton: null,
@@ -44,13 +44,6 @@ export function PDFContainer(props) {
44
44
  setValues(Object.assign(Object.assign({}, values), { [event.target.name]: event.target.value }));
45
45
  }
46
46
  function exportPDFButton(caseNumber) {
47
- const i18n = getI18n();
48
- if (i18n.language &&
49
- (i18n.language === 'ja' || i18n.language === 'zh' || i18n.language === 'ko' || i18n.language === 'ru')) {
50
- return (React.createElement(Tooltip, { position: TooltipPosition.auto, content: React.createElement("p", null,
51
- React.createElement(Trans, null, "Case export doesn't support selected language.")) },
52
- React.createElement(DownloadIcon, { className: "fake-disable", role: "button", title: "Export as PDF", "aria-disabled": "true" })));
53
- }
54
47
  return (React.createElement(Button, { title: "Export as PDF", variant: "link", isInline: true, className: isExportingPDF ? 'hide-in-pdf' : '', "data-tracking-id": "export-case-as-pdf", onClick: openModal(caseNumber), disabled: isExportingPDF, icon: React.createElement(DownloadIcon, null), iconPosition: "right" },
55
48
  React.createElement(Trans, null, "Export")));
56
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseActionPlan.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.tsx"],"names":[],"mappings":"AAqBA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM,eAqIpC;kBArIQ,cAAc;;;AAwIvB,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CaseActionPlan.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.tsx"],"names":[],"mappings":"AAqBA,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM,eAyIpC;kBAzIQ,cAAc;;;AA4IvB,eAAe,cAAc,CAAC"}
@@ -85,7 +85,7 @@ function CaseActionPlan(props) {
85
85
  React.createElement(AlertMessage, { show: isInternalWithoutSFDCUser, variant: AlertType.WARNING, isInline: true, className: "pf-u-mb-lg", title: t('You need a Salesforce (SFDC) user to edit the action plan.') }),
86
86
  React.createElement("label", { htmlFor: "rha-action-plan", className: "sr-only" },
87
87
  React.createElement(Trans, null, "Action plan")),
88
- !canUpdateActionPlan && (React.createElement("pre", { "aria-label": t('Case Action Plan'), dangerouslySetInnerHTML: commentMarkdown(actionPlan) })),
88
+ !canUpdateActionPlan && (React.createElement("pre", { "aria-label": t('Case Action Plan'), dangerouslySetInnerHTML: commentMarkdown(actionPlan), style: { fontFamily: isExportingPDF ? 'DejaVu Sans' : '' } })),
89
89
  canUpdateActionPlan && (React.createElement("form", null,
90
90
  React.createElement("div", { className: isExportingPDF ? 'hide-in-pdf' : '' },
91
91
  React.createElement(TextAreaResizable, { className: "form-control", id: "rha-action-plan", disabled: isUpdating || isInternalWithoutSFDCUser, maxLength: 32768, name: "actionPlan", value: actionPlanState, onChange: onChange, rowsMin: 3 })),
@@ -1 +1 @@
1
- {"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,sBAAsB,gBAgLrC"}
1
+ {"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,sBAAsB,gBA8MrC"}
@@ -13,10 +13,11 @@ 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
14
  import { PhoneInput, ToastNotification } from '@rh-support/components';
15
15
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
16
- import { isEmpty } from 'lodash';
16
+ import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
18
- import React, { useContext, useState } from 'react';
18
+ import React, { useContext, useEffect, useState } from 'react';
19
19
  import { Trans, useTranslation } from 'react-i18next';
20
+ import { PHONE_IS_NOT_VALID, PHONE_LINE_CANNOT_BE_EMPTY, PHONE_NO_CHAR_ERROR, } from '../../../../constants/caseDetailsConstants';
20
21
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
21
22
  import { useCaseUpdateErrorMessage } from '../../../../hooks/useCaseUpdateErrorMessage';
22
23
  import { PHONE_LIMIT } from '../../../../reducers/CaseConstNTypes';
@@ -38,6 +39,7 @@ export function CaseContactPhoneNumber() {
38
39
  const [localFullPhoneState, setLocalFullPhoneState] = useState(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
39
40
  const [localCountryCodeState, setLocalCountryCodeState] = useState(phoneCountryCode);
40
41
  const [invalid, setInvalid] = useState(false);
42
+ const [isSaveClicked, setIsSavedClicked] = useState(false);
41
43
  const caseDispatch = useCaseDispatch();
42
44
  const caseUpdateError = useCaseUpdateErrorMessage();
43
45
  const { t } = useTranslation();
@@ -54,23 +56,25 @@ export function CaseContactPhoneNumber() {
54
56
  setLocalCountryCodeState(countryCode);
55
57
  };
56
58
  const onSave = () => __awaiter(this, void 0, void 0, function* () {
59
+ setIsSavedClicked(true);
60
+ if (isPhoneLineEmpty || isPhoneNumberInvalid)
61
+ return;
57
62
  setCasePhoneUpdating(true);
58
63
  const phoneLine = localFullPhoneState
59
64
  .substring(localCountryCodeState.length, localFullPhoneState.length)
60
65
  .trim();
61
66
  const countryCode = localCountryCodeState.trim();
62
67
  try {
63
- yield updateCaseDetails(caseDispatch, caseNumber, {
64
- phoneCountryCode: countryCode,
65
- phoneAreaCodePrefixLineNumber: phoneLine,
66
- });
68
+ // update case contact info
69
+ yield updateCaseDetails(caseDispatch, caseNumber, Object.assign(Object.assign({ phoneCountryCode: countryCode, phoneAreaCodePrefixLineNumber: phoneLine }, (contactSSOName === loggedInUser.data.ssoUsername && { suppliedPhoneNumberVerified: 'True' })), (!countryCode && !phoneLine && { clearPhoneNumber: true, suppliedPhoneNumberVerified: 'False' })));
70
+ setIsSavedClicked(false);
67
71
  setCasePhoneUpdating(false);
68
72
  ToastNotification.addSuccessMessage(t(`Phone number has been successfully updated`));
69
73
  try {
70
- contacts.updateContactBySSO(loggedInUser.data.ssoUsername, {
71
- supportPhoneCountryCode: countryCode,
72
- supportPhoneAreaCodePrefixLineNumber: phoneLine,
73
- });
74
+ // update logged-in user contact info
75
+ if (contactSSOName === loggedInUser.data.ssoUsername) {
76
+ yield contacts.updateContactBySSO(loggedInUser.data.ssoUsername, Object.assign({ supportPhoneCountryCode: countryCode, supportPhoneAreaCodePrefixLineNumber: phoneLine }, (!countryCode && !phoneLine && { clearPhoneNumber: true })));
77
+ }
74
78
  }
75
79
  catch (e) {
76
80
  // silently fails
@@ -89,17 +93,11 @@ export function CaseContactPhoneNumber() {
89
93
  yield updateCaseDetails(caseDispatch, caseNumber, {
90
94
  phoneCountryCode: '',
91
95
  phoneAreaCodePrefixLineNumber: '',
96
+ clearPhoneNumber: true,
97
+ suppliedPhoneNumberVerified: 'False',
92
98
  });
93
99
  setCasePhoneUpdating(false);
94
100
  ToastNotification.addSuccessMessage(t(`Phone number has been successfully updated`));
95
- try {
96
- contacts.updateContactBySSO(loggedInUser.data.ssoUsername, {
97
- clearPhoneNumber: true,
98
- });
99
- }
100
- catch (e) {
101
- // silently fails
102
- }
103
101
  }
104
102
  catch (e) {
105
103
  setCasePhoneUpdating(false);
@@ -110,27 +108,38 @@ export function CaseContactPhoneNumber() {
110
108
  limit: PHONE_LIMIT,
111
109
  });
112
110
  const isPhoneNeedsReview = contactSSOName === loggedInUser.data.ssoUsername && suppliedPhoneNumberVerified === 'Deferred';
113
- const noCharErrorMessage = t('Phone number can only have digits.');
111
+ // To check if country code is given but phone number empty
112
+ const isPhoneLineEmpty = !isEmpty(localFullPhoneState) && isEmpty(localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.replace(localCountryCodeState, ''));
113
+ const isPhoneNumberInvalid = isEmpty(localCountryCodeState) && !isEmpty(localFullPhoneState);
114
114
  const isPhoneNumberValid = (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT
115
115
  ? ValidatedOptions.error
116
116
  : isPhoneNeedsReview
117
117
  ? ValidatedOptions.warning
118
- : invalid
118
+ : isSaveClicked && (isPhoneLineEmpty || isPhoneNumberInvalid)
119
119
  ? ValidatedOptions.error
120
- : ValidatedOptions.default;
121
- return (React.createElement("div", { className: "form-group pf-u-pb-sm", style: { minWidth: '200px' } },
120
+ : invalid
121
+ ? ValidatedOptions.error
122
+ : ValidatedOptions.default;
123
+ useEffect(() => {
124
+ setLocalFullPhoneState(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
125
+ }, [phoneCountryCode, phoneAreaCodePrefixLineNumber]);
126
+ return (React.createElement("div", { className: "form-group pf-u-pb-md", style: { minWidth: '200px' } },
122
127
  React.createElement("h3", { className: `subheading subheading-sm ${isExportingPDF ? 'expand-input' : ''}` },
123
128
  React.createElement(Trans, null, "Case owner's phone number"),
124
129
  !isExportingPDF ? ContactPhoneNumberPopOver() : ''),
125
130
  React.createElement(InputGroupText, { variant: InputGroupTextVariant.plain },
126
131
  React.createElement(PhoneInput, { phoneValue: localFullPhoneState, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, isDisabled: isCasePhoneUpdating || isCaseOwnerUpdating, isLoading: isCasePhoneUpdating, "data-tracking-id": "case-details-page-supplied-phone", invalid: invalid, setInvalid: setInvalid }),
127
132
  React.createElement("button", { className: "btn btn-app btn-link pf-u-ml-sm", type: "button", "data-tracking-id": "case-details-page-supplied-phone-save", onClick: () => onSave(), disabled: (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT ||
128
- localFullPhoneState === phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber, style: { display: isExportingPDF ? 'none' : '' } },
133
+ localFullPhoneState === phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber ||
134
+ (isSaveClicked && (isPhoneLineEmpty || isPhoneNumberInvalid)), style: { display: isExportingPDF ? 'none' : '' } },
129
135
  React.createElement(CheckIcon, null)),
130
136
  React.createElement("button", { className: "btn btn-app btn-link", type: "button", onClick: onClear, "data-tracking-id": "case-details-page-supplied-phone-cancel", style: { display: isExportingPDF ? 'none' : '' }, disabled: isEmpty(localFullPhoneState) },
131
137
  React.createElement(TimesIcon, { color: "#6A6E73" }))),
132
- invalid && React.createElement("p", { className: "form-instructions form-invalid" },
133
- noCharErrorMessage,
134
- " "),
135
- (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT && (React.createElement("p", { className: "form-instructions form-invalid" }, maxLengthErrorMessage))));
138
+ invalid && (React.createElement("p", { className: "form-instructions form-invalid" },
139
+ React.createElement(Trans, null, PHONE_NO_CHAR_ERROR))),
140
+ (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT && (React.createElement("p", { className: "form-instructions form-invalid" }, maxLengthErrorMessage)),
141
+ isSaveClicked && isPhoneLineEmpty && (React.createElement("p", { className: "form-instructions form-invalid" },
142
+ React.createElement(Trans, null, PHONE_LINE_CANNOT_BE_EMPTY))),
143
+ isSaveClicked && isPhoneNumberInvalid && (React.createElement("p", { className: "form-instructions form-invalid" },
144
+ React.createElement(Trans, null, PHONE_IS_NOT_VALID)))));
136
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CasePhoneNumberConfirmAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAQpD,UAAU,MAAM;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,eA4FxD"}
1
+ {"version":3,"file":"CasePhoneNumberConfirmAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,UAAU,MAAM;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,eAgGxD"}
@@ -21,10 +21,11 @@ import { updateCaseDetails } from '../../../../reducers/CaseReducer';
21
21
  export function CaseContactPhoneNumberAlert(props) {
22
22
  const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
23
23
  const [isCaseUpdating, setCasUpdating] = useState(false);
24
- const { caseNumber, suppliedPhoneNumberVerified, contactSSOName } = useCaseSelector((state) => ({
24
+ const { caseNumber, suppliedPhoneNumberVerified, contactSSOName, severity } = useCaseSelector((state) => ({
25
25
  caseNumber: state.caseDetails.caseNumber,
26
26
  suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
27
27
  contactSSOName: state.caseDetails.contactSSOName,
28
+ severity: state.caseDetails.severity,
28
29
  }), isEqual);
29
30
  const { t } = useTranslation();
30
31
  const caseDispatch = useCaseDispatch();
@@ -44,19 +45,21 @@ export function CaseContactPhoneNumberAlert(props) {
44
45
  const goToPhoneField = () => {
45
46
  scrollIntoView(props.tabRef);
46
47
  };
47
- const isPhoneNeedsReview = contactSSOName === loggedInUser.data.ssoUsername && suppliedPhoneNumberVerified === 'Deferred';
48
+ const isPhoneNeedsReview = contactSSOName === loggedInUser.data.ssoUsername &&
49
+ suppliedPhoneNumberVerified === 'Deferred' &&
50
+ severity !== "1 (Urgent)" /* SEV_1 */; // we show another alert when sev is 1
51
+ const NEW_OWNER_MSG = 'You are the new owner for this case. Is the new phone number correct?';
48
52
  if (!isPhoneNeedsReview)
49
53
  return React.createElement(React.Fragment, null);
50
54
  return (React.createElement(React.Fragment, null, props.isReview ? (React.createElement(Alert, { className: "pf-u-mb-md", isInline: true, variant: AlertVariant.warning, title: t('Review phone number'), actionLinks: [
51
55
  React.createElement(Link, { replace: true, to: {
52
56
  pathname: `/case/${caseNumber}/management`,
53
- search: 'hello',
54
57
  }, onClick: () => goToPhoneField(), "data-tracking-id": "case-contact-phone-number-review" },
55
58
  React.createElement(Trans, null, "Review phone number")),
56
59
  ] },
57
- React.createElement(Trans, null, "You are the new owner for this case. Is the new phone number correct?"))) : props.isConfirm ? (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.warning, title: t('Review phone number'), actionLinks: [
60
+ React.createElement(Trans, null, NEW_OWNER_MSG))) : props.isConfirm ? (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.warning, title: t('Review phone number'), actionLinks: [
58
61
  React.createElement(Button, { variant: ButtonVariant.link, isInline: true, onClick: () => onCaseDetailsChange({ suppliedPhoneNumberVerified: 'True' }), "data-tracking-id": "case-contact-phone-number-confirm", isLoading: isCaseUpdating, isDisabled: isCaseUpdating },
59
62
  React.createElement(Trans, null, "Confirm phone number")),
60
63
  ] },
61
- React.createElement(Trans, null, "You are the new owner for this case. Is the new phone number correct?"))) : (React.createElement(React.Fragment, null))));
64
+ React.createElement(Trans, null, NEW_OWNER_MSG))) : (React.createElement(React.Fragment, null))));
62
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CasePhoneNumberSev1ConfirmAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberSev1ConfirmAlert.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,UAAU,MAAM;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAMD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,eAmG5D"}
1
+ {"version":3,"file":"CasePhoneNumberSev1ConfirmAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberSev1ConfirmAlert.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,UAAU,MAAM;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAMD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,eAgG5D"}
@@ -51,19 +51,19 @@ export function CasePhoneNumberSev1ConfirmAlert(props) {
51
51
  };
52
52
  const isPhoneNeedsConfirm = contactSSOName === loggedInUser.data.ssoUsername &&
53
53
  severity === "1 (Urgent)" /* SEV_1 */ &&
54
- suppliedPhoneNumberVerified === 'False';
54
+ suppliedPhoneNumberVerified !== 'True';
55
+ const SEV1_MSG = 'This case severity is urgent. Please confirm the phone number we have on file is correct.';
55
56
  if (!isPhoneNeedsConfirm)
56
57
  return React.createElement(React.Fragment, null);
57
58
  return (React.createElement(React.Fragment, null, props.isReview ? (React.createElement(Alert, { className: "pf-u-mb-md", isInline: true, variant: AlertVariant.warning, title: t('Review phone number'), actionLinks: [
58
59
  React.createElement(Link, { replace: true, to: {
59
60
  pathname: `/case/${caseNumber}/management`,
60
- search: 'hello',
61
61
  }, onClick: () => goToPhoneField(), "data-tracking-id": "case-contact-phone-number-review" },
62
62
  React.createElement(Trans, null, "Review phone number")),
63
63
  ] },
64
- React.createElement(Trans, null, "This case severity is urgent. Please confirm the phone number we have on file is correct."))) : props.isConfirm ? (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.warning, title: t('Review phone number'), actionLinks: [
64
+ React.createElement(Trans, null, SEV1_MSG))) : props.isConfirm ? (React.createElement(Alert, { isInline: true, className: "pf-u-mb-md", variant: AlertVariant.warning, title: t('Review phone number'), actionLinks: [
65
65
  React.createElement(Button, { variant: ButtonVariant.link, isInline: true, onClick: () => onCaseDetailsChange({ suppliedPhoneNumberVerified: 'True' }), "data-tracking-id": "case-contact-phone-number-confirm", isLoading: isCaseUpdating, isDisabled: isCaseUpdating },
66
66
  React.createElement(Trans, null, "Confirm phone number")),
67
67
  ] },
68
- React.createElement(Trans, null, "This case severity is urgent. Please confirm the phone number we have on file is correct."))) : (React.createElement(React.Fragment, null))));
68
+ React.createElement(Trans, null, SEV1_MSG))) : (React.createElement(React.Fragment, null))));
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAYA,wBAAgB,kBAAkB,gBAkFjC"}
1
+ {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAkBA,wBAAgB,kBAAkB,gBAuGjC"}
@@ -1,62 +1,67 @@
1
1
  import { ValidatedOptions } from '@patternfly/react-core';
2
- import { PhoneInput } from '@rh-support/components';
2
+ import { getPhoneObj, PhoneInput } from '@rh-support/components';
3
3
  import isEmpty from 'lodash/isEmpty';
4
4
  import isEqual from 'lodash/isEqual';
5
- import React, { useState } from 'react';
5
+ import React, { useContext, useState } from 'react';
6
6
  import { Trans, useTranslation } from 'react-i18next';
7
+ import { PHONE_IS_NOT_VALID, PHONE_LINE_CANNOT_BE_EMPTY, PHONE_NO_CHAR_ERROR, } from '../../constants/caseDetailsConstants';
7
8
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
9
+ import { RouteContext } from '../../context/RouteContext';
8
10
  import { PHONE_LIMIT } from '../../reducers/CaseConstNTypes';
9
11
  import { setCaseDetails } from '../../reducers/CaseReducer';
10
12
  import { ContactPhoneNumberPopOver } from './ContactPhoneNumberPopOver';
11
13
  export function ContactPhoneNumber() {
12
- var _a, _b;
13
14
  const { suppliedPhoneNumberVerified, severity, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', } = useCaseSelector((state) => ({
14
15
  suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
15
16
  severity: state.caseDetails.severity,
16
17
  phoneCountryCode: state.caseDetails.phoneCountryCode,
17
18
  phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber,
18
19
  }), isEqual);
20
+ const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
19
21
  const [invalid, setInvalid] = useState(false);
20
- const getPhone = () => phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber.replace(phoneCountryCode, '');
22
+ const [localFullPhone, setLocalFullPhone] = useState(phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber);
23
+ const getPhone = () => phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber;
21
24
  const caseDispatch = useCaseDispatch();
22
25
  const { t } = useTranslation();
23
26
  const onPhoneChange = (fullPhone) => {
27
+ setLocalFullPhone(fullPhone);
24
28
  if (isEmpty(fullPhone)) {
25
29
  setInvalid(false);
26
30
  }
27
31
  setCaseDetails(caseDispatch, {
28
- phoneAreaCodePrefixLineNumber: phoneCountryCode
29
- ? fullPhone.substring(phoneCountryCode.length, fullPhone.length).trim()
30
- : fullPhone.trim(),
32
+ phoneAreaCodePrefixLineNumber: getPhoneObj(fullPhone).phoneLine,
33
+ phoneCountryCode: getPhoneObj(fullPhone).countryCode,
31
34
  });
32
35
  };
33
36
  const onCountryCodeChange = (phoneCountryCode) => {
34
- setCaseDetails(caseDispatch, { phoneCountryCode: phoneCountryCode });
37
+ setCaseDetails(caseDispatch, { phoneCountryCode });
35
38
  };
36
39
  const maxLengthErrorMessage = t('Phone number cannot be more than {{limit}} digits.', {
37
40
  limit: PHONE_LIMIT,
38
41
  });
39
- const phoneNumberEmptyError = t('Phone number cannot be empty when country code is given.');
42
+ const isPhoneNumberInvalid = isEmpty(phoneCountryCode.replace('+', '')) && !isEmpty(phoneAreaCodePrefixLineNumber);
40
43
  // To check if country code is given but phone number empty
41
- const isPhoneNumberEmpty = !isEmpty(phoneCountryCode) && isEmpty(phoneAreaCodePrefixLineNumber === null || phoneAreaCodePrefixLineNumber === void 0 ? void 0 : phoneAreaCodePrefixLineNumber.replace(phoneCountryCode, ''));
42
- const isPhoneNumberValid = ((_a = getPhone) === null || _a === void 0 ? void 0 : _a.length) > PHONE_LIMIT
44
+ const isPhoneNumberEmpty = !isEmpty(phoneCountryCode.replace('+', '')) &&
45
+ isEmpty(phoneAreaCodePrefixLineNumber === null || phoneAreaCodePrefixLineNumber === void 0 ? void 0 : phoneAreaCodePrefixLineNumber.replace(phoneCountryCode, ''));
46
+ const isPhoneNumberValid = getPhone().length > PHONE_LIMIT
43
47
  ? ValidatedOptions.error
44
48
  : severity === "1 (Urgent)" /* SEV_1 */ && isEmpty(suppliedPhoneNumberVerified)
45
49
  ? ValidatedOptions.warning
46
- : isPhoneNumberEmpty
50
+ : isNextBtnClickedToShowValidationError && (isPhoneNumberEmpty || isPhoneNumberInvalid)
47
51
  ? ValidatedOptions.error
48
52
  : invalid
49
53
  ? ValidatedOptions.error
50
54
  : ValidatedOptions.default;
51
- const noCharErrorMessage = t('Phone number can only have digits.');
52
- return (React.createElement("div", { className: "form-group pf-u-pb-xl", style: { minWidth: '200px' } },
55
+ return (React.createElement("div", { className: "form-group", style: { minWidth: '200px' } },
53
56
  React.createElement("label", null,
54
57
  React.createElement(Trans, null, "Case owner's phone number"),
55
58
  ContactPhoneNumberPopOver()),
56
- React.createElement(PhoneInput, { phoneValue: getPhone(), onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid }),
57
- invalid && React.createElement("p", { className: "form-instructions form-invalid" },
58
- noCharErrorMessage,
59
- " "),
60
- ((_b = getPhone()) === null || _b === void 0 ? void 0 : _b.length) > PHONE_LIMIT && (React.createElement("p", { className: "form-instructions form-invalid" }, maxLengthErrorMessage)),
61
- isPhoneNumberEmpty && React.createElement("p", { className: "form-instructions form-invalid" }, phoneNumberEmptyError)));
59
+ React.createElement(PhoneInput, { phoneValue: localFullPhone, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid }),
60
+ invalid && (React.createElement("p", { className: "form-instructions form-invalid" },
61
+ React.createElement(Trans, null, PHONE_NO_CHAR_ERROR))),
62
+ getPhone().length > PHONE_LIMIT && (React.createElement("p", { className: "form-instructions form-invalid" }, maxLengthErrorMessage)),
63
+ isPhoneNumberEmpty && isNextBtnClickedToShowValidationError && (React.createElement("p", { className: "form-instructions form-invalid" },
64
+ React.createElement(Trans, null, PHONE_LINE_CANNOT_BE_EMPTY))),
65
+ isNextBtnClickedToShowValidationError && isPhoneNumberInvalid && (React.createElement("p", { className: "form-instructions form-invalid" },
66
+ React.createElement(Trans, null, PHONE_IS_NOT_VALID)))));
62
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useIsSectionValid.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/useIsSectionValid.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAInE,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,gBAAgB;;;;;EAsM9D"}
1
+ {"version":3,"file":"useIsSectionValid.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/useIsSectionValid.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKnE,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,gBAAgB;;;;;EA8L9D"}
@@ -7,10 +7,11 @@ import { useCaseSelector } from '../../context/CaseContext';
7
7
  import { RecommendationStateContext } from '../../context/RecommendationContext';
8
8
  import { RouteContext } from '../../context/RouteContext';
9
9
  import { TCStateContext } from '../../context/TopContentContext';
10
- import { CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, DESCRIPTION_LENGTH_LIMIT, HOSTNAME_LENGTH_LIMIT, PHONE_LIMIT, SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
10
+ import { CASE_REFERENCE_NUMBER_LIMIT, CONTACT_INFO_24X7_LIMIT, DESCRIPTION_LENGTH_LIMIT, HOSTNAME_LENGTH_LIMIT, SUMMARY_LENGTH_LIMIT, } from '../../reducers/CaseConstNTypes';
11
11
  import { isCaseInformationSectionValid, isCaseManagementStateValid, isCaseStateValid, isClusterIDValid, isIdeaCaseStateValid, } from '../../reducers/CaseHelpers';
12
12
  import { AppRouteSections } from '../../reducers/RouteConstNTypes';
13
13
  import { AttachmentStateContext } from './fileUpload/reducer/AttachmentReducerContext';
14
+ import { isPhoneValid } from './utils';
14
15
  export function useIsSectionValid(sectionName) {
15
16
  var _a, _b;
16
17
  const { caseState, caseType, product, version, contactSSOName, accountNumber, summary, description, hostname, contactInfo24x7, alternateId, selectedAccountDetails, phoneCountryCode, phoneAreaCodePrefixLineNumber, } = useCaseSelector((state) => ({
@@ -64,18 +65,14 @@ export function useIsSectionValid(sectionName) {
64
65
  ((_a = summary) === null || _a === void 0 ? void 0 : _a.length) < SUMMARY_LENGTH_LIMIT);
65
66
  };
66
67
  const isCaseManagementSectionValid = () => {
67
- var _a, _b;
68
68
  const hasContactInfo24x7ValidLength = contactInfo24x7
69
69
  ? (contactInfo24x7 === null || contactInfo24x7 === void 0 ? void 0 : contactInfo24x7.length) <= CONTACT_INFO_24X7_LIMIT
70
70
  : true;
71
71
  const hasAlternateCaseIdValidLength = alternateId ? (alternateId === null || alternateId === void 0 ? void 0 : alternateId.length) <= CASE_REFERENCE_NUMBER_LIMIT : true;
72
- const hasSuppliedPhoneValidLength = phoneAreaCodePrefixLineNumber || phoneCountryCode
73
- ? ((_a = phoneCountryCode) === null || _a === void 0 ? void 0 : _a.length) + ((_b = phoneAreaCodePrefixLineNumber) === null || _b === void 0 ? void 0 : _b.length) + 1 <= PHONE_LIMIT
74
- : true;
75
72
  return (isCaseManagementStateValid(caseState, loggedInUserJwtToken) &&
76
73
  hasContactInfo24x7ValidLength &&
77
74
  hasAlternateCaseIdValidLength &&
78
- hasSuppliedPhoneValidLength);
75
+ isPhoneValid(phoneCountryCode, phoneAreaCodePrefixLineNumber));
79
76
  };
80
77
  const isTroubleshootSectionValid = () => {
81
78
  var _a, _b, _c;
@@ -92,10 +89,7 @@ export function useIsSectionValid(sectionName) {
92
89
  var _a;
93
90
  return (isEntitledProduct &&
94
91
  isCaseStateValid(caseState, loggedInUserJwtToken) &&
95
- isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult) &&
96
- (!isEmpty(phoneCountryCode) && isEmpty(phoneAreaCodePrefixLineNumber === null || phoneAreaCodePrefixLineNumber === void 0 ? void 0 : phoneAreaCodePrefixLineNumber.replace(phoneCountryCode, ''))
97
- ? false
98
- : true));
92
+ isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult));
99
93
  };
100
94
  const isDescribeIdeaSectionValid = () => {
101
95
  return (isCaseManagementStateValid(caseState, loggedInUserJwtToken) &&
@@ -109,9 +103,7 @@ export function useIsSectionValid(sectionName) {
109
103
  return (!caseState.hasInvalidEntitlements &&
110
104
  isClusterIDValid(caseState, (_a = allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult) &&
111
105
  isCaseInformationSectionValid(caseState, loggedInUserJwtToken) &&
112
- hostnameIsValid
113
- //here
114
- );
106
+ hostnameIsValid);
115
107
  };
116
108
  const isSectionValid = (sectionNameLocal) => {
117
109
  if (!sectionNameLocal)
@@ -9,4 +9,5 @@ import { CaseValuesToWatch } from './Constants';
9
9
  * should return a human readable form of the given object.
10
10
  */
11
11
  export declare function getChangedValueTooltip<T>(valueNameCb: (current: T, previous: T) => CaseValuesToWatch, accessor?: (value: T, otherValue: T) => any): (currentValue: T, previousValue: T) => JSX.Element;
12
+ export declare const isPhoneValid: (countryCode: string, phoneLine: string) => boolean;
12
13
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/utils.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACpC,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,iBAAiB,EAC3D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,KAAK,GAAG,kBAErB,CAAC,iBAAiB,CAAC,iBAQ5C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/utils.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACpC,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,iBAAiB,EAC3D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,KAAK,GAAG,kBAErB,CAAC,iBAAiB,CAAC,iBAQ5C;AAED,eAAO,MAAM,YAAY,gBAAiB,MAAM,aAAa,MAAM,KAAG,OAmBrE,CAAC"}
@@ -1,5 +1,7 @@
1
+ import isEmpty from 'lodash/isEmpty';
1
2
  import React from 'react';
2
3
  import { Trans } from 'react-i18next';
4
+ import { PHONE_LIMIT } from '../../reducers/CaseConstNTypes';
3
5
  /**
4
6
  *
5
7
  * A function that returns a translated string for a tooltip of the given case value that is being watched
@@ -24,3 +26,17 @@ export function getChangedValueTooltip(valueNameCb, accessor) {
24
26
  accessor ? accessor(currentValue, previousValue) : currentValue,
25
27
  " ")));
26
28
  }
29
+ export const isPhoneValid = (countryCode, phoneLine) => {
30
+ const regex = /^[\d ()+-]+$/;
31
+ const phoneIncludesCorrectChars = phoneLine && regex.test(phoneLine.replace(countryCode, ''));
32
+ // To validate case state if country code and phoneline both are available
33
+ // we cannot have only country code or only phoneline
34
+ // phone is optional
35
+ const isCountryCodeFollowsByPhone = !isEmpty(countryCode) ? !isEmpty(phoneLine) : false;
36
+ const isPhoneLineHasCountryCode = !isEmpty(phoneLine) ? !isEmpty(countryCode) : false;
37
+ const hasSuppliedPhoneValidLength = (phoneLine || countryCode) && ((countryCode === null || countryCode === void 0 ? void 0 : countryCode.length) || 0) + ((phoneLine === null || phoneLine === void 0 ? void 0 : phoneLine.length) || 0) + 1 <= PHONE_LIMIT;
38
+ return (!!isCountryCodeFollowsByPhone &&
39
+ !!isPhoneLineHasCountryCode &&
40
+ !!hasSuppliedPhoneValidLength &&
41
+ !!phoneIncludesCorrectChars);
42
+ };
@@ -12,4 +12,7 @@ export declare enum CaseStatusEnum {
12
12
  WAITING_ON_CUSTOMER = "Waiting on Customer",
13
13
  WAITING_ON_REDHAT = "Waiting on Red Hat"
14
14
  }
15
+ export declare const PHONE_LINE_CANNOT_BE_EMPTY = "Phone number cannot be empty when country code is given.";
16
+ export declare const PHONE_NO_CHAR_ERROR = "Phone number can only have digits.";
17
+ export declare const PHONE_IS_NOT_VALID = "Phone number is invalid.";
15
18
  //# 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"}
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"}
@@ -14,3 +14,6 @@ export var CaseStatusEnum;
14
14
  CaseStatusEnum["WAITING_ON_CUSTOMER"] = "Waiting on Customer";
15
15
  CaseStatusEnum["WAITING_ON_REDHAT"] = "Waiting on Red Hat";
16
16
  })(CaseStatusEnum || (CaseStatusEnum = {}));
17
+ export const PHONE_LINE_CANNOT_BE_EMPTY = 'Phone number cannot be empty when country code is given.';
18
+ export const PHONE_NO_CHAR_ERROR = 'Phone number can only have digits.';
19
+ export const PHONE_IS_NOT_VALID = 'Phone number is invalid.';
@@ -1 +1 @@
1
- {"version":3,"file":"CaseHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAkB3D,OAAO,EAUH,UAAU,EAgBb,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,sBAAsB,SAAU,mBAAmB,EAAE,wBAMjE,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,WAAW,KAAG,MAOrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,mBAAmB,SAAS,MAAM,sBAyB9E,CAAC;AAIF,eAAO,MAAM,qBAAqB,UACvB,MAAM,gBACC,MAAM,uBACC,MAAM,yBACJ,MAAM,kBACb,MAAM,YACZ,MAAM,YACN,MAAM,KACjB,MAyBF,CAAC;AAIF,eAAO,MAAM,oBAAoB,UACtB,MAAM,gBACC,MAAM,uBACC,MAAM,yBACJ,MAAM,KAC9B,MAQF,CAAC;AAEF,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,MAAM,KAAG,MAQhF,CAAC;AAEF,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,MAAM,KAAG,MAQhF,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,MAAM,KAAG,MAKzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAqC5B,CAAC;AAIF,eAAO,MAAM,gBAAgB,cAAe,UAAU,wBAAwB,QAAQ,eAAe,CAAC,KAAG,OAwCxG,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAClB,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OA0BF,CAAC;AAEF,eAAO,MAAM,0BAA0B,cACxB,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAqBF,CAAC;AAIF,eAAO,MAAM,6BAA6B,cAC3B,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAuBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,cACf,UAAU,gBACP,YAAY,iBACZ,OAAO,KACtB,QAAQ,YAAY,CA2EtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,qBAAsB,YAAY,EAAE,KAAG,YAAY,EAEvF,CAAC;AACF,eAAO,MAAM,yBAAyB,qBAAsB,YAAY,EAAE,KAAG,OAE5E,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBACrB,YAAY,6BACE,MAAM,mBAChB,MAAM,KACxB,QAAQ,YAAY,CAgCtB,CAAC;AACF,eAAO,MAAM,yBAAyB,gBACrB,QAAQ,YAAY,CAAC,gCACJ,QAAQ,EAAE,KACzC,eA+CF,CAAC"}
1
+ {"version":3,"file":"CaseHelpers.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAmB3D,OAAO,EAUH,UAAU,EAeb,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,sBAAsB,SAAU,mBAAmB,EAAE,wBAMjE,CAAC;AAEF,eAAO,MAAM,2BAA2B,eAAgB,WAAW,KAAG,MAOrE,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,mBAAmB,SAAS,MAAM,sBAyB9E,CAAC;AAIF,eAAO,MAAM,qBAAqB,UACvB,MAAM,gBACC,MAAM,uBACC,MAAM,yBACJ,MAAM,kBACb,MAAM,YACZ,MAAM,YACN,MAAM,KACjB,MAyBF,CAAC;AAIF,eAAO,MAAM,oBAAoB,UACtB,MAAM,gBACC,MAAM,uBACC,MAAM,yBACJ,MAAM,KAC9B,MAQF,CAAC;AAEF,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,MAAM,KAAG,MAQhF,CAAC;AAEF,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,MAAM,KAAG,MAQhF,CAAC;AAEF,eAAO,MAAM,sBAAsB,aAAc,MAAM,KAAG,MAKzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAqC5B,CAAC;AAIF,eAAO,MAAM,gBAAgB,cAAe,UAAU,wBAAwB,QAAQ,eAAe,CAAC,KAAG,OA6BxG,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAClB,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAyBF,CAAC;AAEF,eAAO,MAAM,0BAA0B,cACxB,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAqBF,CAAC;AAIF,eAAO,MAAM,6BAA6B,cAC3B,UAAU,wBACC,QAAQ,eAAe,CAAC,KAC/C,OAuBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,cACf,UAAU,gBACP,YAAY,iBACZ,OAAO,KACtB,QAAQ,YAAY,CA2EtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,qBAAsB,YAAY,EAAE,KAAG,YAAY,EAEvF,CAAC;AACF,eAAO,MAAM,yBAAyB,qBAAsB,YAAY,EAAE,KAAG,OAE5E,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBACrB,YAAY,6BACE,MAAM,mBAChB,MAAM,KACxB,QAAQ,YAAY,CAgCtB,CAAC;AACF,eAAO,MAAM,yBAAyB,gBACrB,QAAQ,YAAY,CAAC,gCACJ,QAAQ,EAAE,KACzC,eA+CF,CAAC"}
@@ -6,8 +6,9 @@ import map from 'lodash/map';
6
6
  import some from 'lodash/some';
7
7
  import unionBy from 'lodash/unionBy';
8
8
  import uniqBy from 'lodash/uniqBy';
9
+ import { isPhoneValid } from '../components/shared/utils';
9
10
  import { getIsClusterIdInvalid, isClusterIdEnabledForProduct } from '../utils/caseOpenshiftClusterIdUtils';
10
- import { CASE_DEATILS_ENVIRONMENT_LIMIT, CASE_DEATILS_ISSUE_LIMIT, CASE_DEATILS_PERIODICITYOFISSUE_LIMIT, CASE_DETAILS_TIMEFRAMESANDURGENCY_LIMIT, CASE_REFERENCE_NUMBER_LIMIT, CLUSTER_ID_LIMIT, CONTACT_INFO_24X7_LIMIT, DESCRIPTION_LENGTH_LIMIT, HOSTNAME_LENGTH_LIMIT, ITRForSLASeverity, KtQuestionConstant, PHONE_LIMIT, SESSION_ENVIRONMENT_LIMIT, SESSION_ISSUE_LIMIT, SESSION_NO_CLUSTER_REASON_EXPLANATION_LENGTH_LIMIT, SESSION_NO_CLUSTER_REASON_LENGTH_LIMIT, SESSION_NOTIFIED_USERS_EXTERNAL_LIMIT, SESSION_NOTIFIED_USERS_INTERNAL_LIMIT, SESSION_PERIODICITY_OF_ISSUE_LIMIT, SESSION_PHONE_LENGTH_LIMIT, SESSION_TIME_FRAMES_URGENCY_LIMIT, SeverityDescription, SUMMARY_LENGTH_LIMIT, } from './CaseConstNTypes';
11
+ import { CASE_DEATILS_ENVIRONMENT_LIMIT, CASE_DEATILS_ISSUE_LIMIT, CASE_DEATILS_PERIODICITYOFISSUE_LIMIT, CASE_DETAILS_TIMEFRAMESANDURGENCY_LIMIT, CASE_REFERENCE_NUMBER_LIMIT, CLUSTER_ID_LIMIT, CONTACT_INFO_24X7_LIMIT, DESCRIPTION_LENGTH_LIMIT, HOSTNAME_LENGTH_LIMIT, ITRForSLASeverity, KtQuestionConstant, SESSION_ENVIRONMENT_LIMIT, SESSION_ISSUE_LIMIT, SESSION_NO_CLUSTER_REASON_EXPLANATION_LENGTH_LIMIT, SESSION_NO_CLUSTER_REASON_LENGTH_LIMIT, SESSION_NOTIFIED_USERS_EXTERNAL_LIMIT, SESSION_NOTIFIED_USERS_INTERNAL_LIMIT, SESSION_PERIODICITY_OF_ISSUE_LIMIT, SESSION_PHONE_LENGTH_LIMIT, SESSION_TIME_FRAMES_URGENCY_LIMIT, SeverityDescription, SUMMARY_LENGTH_LIMIT, } from './CaseConstNTypes';
11
12
  export const getCaseRecommendations = (docs, oldDocs) => {
12
13
  const recs = [];
13
14
  docs.forEach((doc, i) => {
@@ -130,9 +131,7 @@ export const isClusterIDValid = (caseState, allProducts) => {
130
131
  };
131
132
  // Add a !isEmpty to to make any KTQuestion Mandatory in isCaseStateValid
132
133
  export const isCaseStateValid = (caseState, loggedInUserJwtToken) => {
133
- var _a, _b;
134
134
  const case_details = caseState.caseDetails;
135
- const regex = /^[\d ()+-]+$/;
136
135
  return (!isEmpty(case_details.issue) &&
137
136
  isEmpty(case_details.caseNumber) &&
138
137
  !caseState.hasLargeCaseDescription &&
@@ -152,24 +151,13 @@ export const isCaseStateValid = (caseState, loggedInUserJwtToken) => {
152
151
  !isEmpty(case_details.severity) &&
153
152
  !isEmpty(case_details.accountNumberRef) &&
154
153
  !isEmpty(case_details.contactSSOName) &&
155
- // Country Code and Phone Number Not Mandatory
156
- (!isEmpty(case_details.phoneCountryCode) && !isEmpty(case_details.phoneAreaCodePrefixLineNumber)
157
- ? ((_a = case_details.phoneCountryCode) === null || _a === void 0 ? void 0 : _a.length) + ((_b = case_details.phoneAreaCodePrefixLineNumber) === null || _b === void 0 ? void 0 : _b.length) + 1 <=
158
- PHONE_LIMIT
159
- : true) &&
160
- // To validate case state if country code is given but phone number is empty
161
- (!isEmpty(case_details.phoneCountryCode) &&
162
- isEmpty(case_details.phoneAreaCodePrefixLineNumber.replace(case_details.phoneCountryCode, ''))
163
- ? false
164
- : true) &&
165
- regex.test(case_details.phoneAreaCodePrefixLineNumber.replace(case_details.phoneCountryCode, '')) &&
154
+ isPhoneValid(case_details.phoneCountryCode, case_details.phoneAreaCodePrefixLineNumber) &&
166
155
  (caseState.selectedAccountDetails.data.requireCGroupOnCreate
167
156
  ? !isEmpty(case_details.groupNumber) && case_details.groupNumber !== '-1'
168
157
  : true) &&
169
158
  canManageCase(loggedInUserJwtToken));
170
159
  };
171
160
  export const isIdeaCaseStateValid = (caseState, loggedInUserJwtToken) => {
172
- var _a, _b;
173
161
  const case_details = caseState.caseDetails;
174
162
  return (!isEmpty(case_details.issue) &&
175
163
  isEmpty(case_details.caseNumber) &&
@@ -186,8 +174,7 @@ export const isIdeaCaseStateValid = (caseState, loggedInUserJwtToken) => {
186
174
  !isEmpty(case_details.severity) &&
187
175
  !isEmpty(case_details.accountNumberRef) &&
188
176
  !isEmpty(case_details.contactSSOName) &&
189
- ((_a = case_details.phoneCountryCode) === null || _a === void 0 ? void 0 : _a.length) + ((_b = case_details.phoneAreaCodePrefixLineNumber) === null || _b === void 0 ? void 0 : _b.length) + 1 <=
190
- PHONE_LIMIT &&
177
+ isPhoneValid(case_details.phoneCountryCode, case_details.phoneAreaCodePrefixLineNumber) &&
191
178
  (caseState.selectedAccountDetails.data.requireCGroupOnCreate
192
179
  ? !isEmpty(case_details.groupNumber) && case_details.groupNumber !== '-1'
193
180
  : true) &&
@@ -878,3 +878,8 @@ svg.pf-c-spinner.pf-m-md.export-csv-loader {
878
878
  svg.pf-u-ml-xs.icon-size {
879
879
  width: 14px;
880
880
  }
881
+
882
+ @font-face {
883
+ font-family: 'DejaVu Sans';
884
+ src: url('https://access.redhat.com/chrome_themes/nimbus/fonts/unifont-15.0.06.ttf') format('truetype');
885
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
26
26
  "lib/**/*"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@cee-eng/hydrajs": "4.15.86",
29
+ "@cee-eng/hydrajs": "4.15.87",
30
30
  "@cee-eng/ui-toolkit": "1.1.6",
31
31
  "@patternfly/patternfly": "4.196.7",
32
32
  "@patternfly/pfe-accordion": "1.12.3",
@@ -56,7 +56,7 @@
56
56
  "react-virtualized": "^9.21.2"
57
57
  },
58
58
  "dependencies": {
59
- "@cee-eng/hydrajs": "4.15.86",
59
+ "@cee-eng/hydrajs": "4.15.87",
60
60
  "@cee-eng/ui-toolkit": "1.1.6",
61
61
  "@patternfly/patternfly": "4.196.7",
62
62
  "@patternfly/pfe-accordion": "1.12.3",
@@ -66,11 +66,11 @@
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.3",
70
- "@rh-support/react-context": "2.1.3",
69
+ "@rh-support/components": "2.1.4",
70
+ "@rh-support/react-context": "2.1.4",
71
71
  "@rh-support/types": "2.0.2",
72
- "@rh-support/user-permissions": "2.1.2",
73
- "@rh-support/utils": "2.1.0",
72
+ "@rh-support/user-permissions": "2.1.3",
73
+ "@rh-support/utils": "2.1.1",
74
74
  "@types/react-redux": "^7.1.12",
75
75
  "@types/redux": "^3.6.0",
76
76
  "dompurify": "^2.4.1",
@@ -133,5 +133,5 @@
133
133
  "defaults and supports es6-module",
134
134
  "maintained node versions"
135
135
  ],
136
- "gitHead": "bf789446dfb9720390fb2f595c43f4c1928d6529"
136
+ "gitHead": "d0220cf8078eb0da56f34f1cf0598edad0704669"
137
137
  }