@rh-support/troubleshoot 2.7.33 → 2.7.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAoBxE,UAAU,MAAM;CAAG;AAMnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,qBAmanC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAoBxE,UAAU,MAAM;CAAG;AAMnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,qBAsanC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -216,12 +216,9 @@ function OwnerSelector(props) {
216
216
  fullNameCustom: '',
217
217
  },
218
218
  ];
219
- // set phone fields to empty value to triger fetching
220
- // phone number for new owner
221
- setCaseDetails(caseDispatch, {
222
- phoneAreaCodePrefixLineNumber: '',
223
- phoneCountryCode: '',
224
- });
219
+ // Apply phone from selected owner details (already loaded with contact)
220
+ const ownerPhoneCaseUpdate = getOwnerPhoneCaseUpdate(customerContacts[0]);
221
+ setCaseDetails(caseDispatch, Object.assign({ contactSSOName: customerContacts[0].ssoUsername, phoneAreaCodePrefixLineNumber: '', phoneCountryCode: '', phone: '' }, (ownerPhoneCaseUpdate !== null && ownerPhoneCaseUpdate !== void 0 ? ownerPhoneCaseUpdate : {})));
225
222
  setCaseState(caseDispatch, { hasUserUpdatedSuppliedPhone: false });
226
223
  onOwnerChange(customerContacts[0], previousCaseOwner, selectedNotificationContacts, caseDispatch);
227
224
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ESSRemoteSession.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/ESSRemoteSession.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,+EA2H3B,CAAC"}
1
+ {"version":3,"file":"ESSRemoteSession.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/ESSRemoteSession.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,+EAkI3B,CAAC"}
@@ -11,9 +11,14 @@ export const ESSRemoteSession = forwardRef((props, ref) => {
11
11
  const { t } = useTranslation();
12
12
  const canEditCase = useCanEditCase();
13
13
  const { caseNumber, caseStatus, readOnly, waitingOnCallback } = props;
14
- const { globalMetadataState: { loggedInUser, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
14
+ const { globalMetadataState: { loggedInUserJwtToken, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
15
15
  const isExternal = loggedInUserRights.data.isExternal();
16
16
  const isInternal = loggedInUserRights.data.isInternal();
17
+ const jwtSsoUsername = (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username) ||
18
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.username) ||
19
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.RHAT_LOGIN) ||
20
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.REDHAT_LOGIN) ||
21
+ '';
17
22
  const [openNewESSRemoteSessionModal, setOpenNewESSRemoteSessionModal] = useState(false);
18
23
  // To toggle New ESS RS Modal
19
24
  const toggleNewESSRemoteSessionModal = () => {
@@ -52,5 +57,5 @@ export const ESSRemoteSession = forwardRef((props, ref) => {
52
57
  React.createElement(Button, { "aria-label": waitingOnCallback ? t('Remote session requested') : t('Request remote session'), variant: waitingOnCallback ? 'primary' : 'secondary', onClick: toggleNewESSRemoteSessionModal, "data-tracking-id": "accept-remote-session-agreement-trigger", isDisabled: canEditCase.isCaseNotEditable, isAriaDisabled: waitingOnCallback, ref: tooltipRef, className: "remote-session-button" }, waitingOnCallback ? t('Remote session requested') : t('Request remote session')))))));
53
58
  return (React.createElement(React.Fragment, null,
54
59
  ESSRemoteSessionSectionBody,
55
- React.createElement(NewEssTermsModal, { caseNumber: caseNumber, caseStatus: caseStatus, show: openNewESSRemoteSessionModal, onClose: toggleNewESSRemoteSessionModal, siteCode: TncConstants.REMOTE_RIDER_SITE_CODE, eventCode: TncConstants.REMOTER_RIDER_EVENT_CODE, loggedInUser: loggedInUser.data.ssoUsername === undefined ? '' : loggedInUser.data.ssoUsername, loggedInUserRights: loggedInUserRights, readOnly: readOnly })));
60
+ React.createElement(NewEssTermsModal, { caseNumber: caseNumber, caseStatus: caseStatus, show: openNewESSRemoteSessionModal, onClose: toggleNewESSRemoteSessionModal, siteCode: TncConstants.REMOTE_RIDER_SITE_CODE, eventCode: TncConstants.REMOTER_RIDER_EVENT_CODE, loggedInUser: jwtSsoUsername, loggedInUserRights: loggedInUserRights, readOnly: readOnly })));
56
61
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteSessionAgreement.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreement.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B,EAAE,OAAO,CAAC;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,sBAAsB,+EA0HjC,CAAC"}
1
+ {"version":3,"file":"RemoteSessionAgreement.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreement.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B,EAAE,OAAO,CAAC;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,sBAAsB,+EAiIjC,CAAC"}
@@ -11,9 +11,14 @@ export const RemoteSessionAgreement = forwardRef((props, ref) => {
11
11
  const { t } = useTranslation();
12
12
  const canEditCase = useCanEditCase();
13
13
  const { caseNumber, caseStatus, acceptedRemoteSessionTerms, readOnly, waitingOnCallback } = props;
14
- const { globalMetadataState: { loggedInUser, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
14
+ const { globalMetadataState: { loggedInUserJwtToken, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
15
15
  const isExternal = loggedInUserRights.data.isExternal();
16
16
  const isInternal = loggedInUserRights.data.isInternal();
17
+ const jwtSsoUsername = (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username) ||
18
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.username) ||
19
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.RHAT_LOGIN) ||
20
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.REDHAT_LOGIN) ||
21
+ '';
17
22
  const [openRequestRemoteSessionModal, setOpenRequestRemoteSessionModal] = useState(false);
18
23
  // To toggle RSA Modal
19
24
  const toggleRemoteSessionAgreementModal = () => {
@@ -52,5 +57,5 @@ export const RemoteSessionAgreement = forwardRef((props, ref) => {
52
57
  React.createElement(Button, { "aria-label": waitingOnCallback ? t('Remote session requested') : t('Request remote session'), variant: waitingOnCallback ? 'primary' : 'secondary', onClick: toggleRemoteSessionAgreementModal, "data-tracking-id": "accept-remote-session-agreement-trigger", isDisabled: canEditCase.isCaseNotEditable, isAriaDisabled: waitingOnCallback, ref: tooltipRef, className: "remote-session-button" }, waitingOnCallback ? t('Remote session requested') : t('Request remote session')))))));
53
58
  return (React.createElement(React.Fragment, null,
54
59
  RemoteSessionAgreementSectionBody,
55
- React.createElement(RemoteSessionAgreementModal, { caseNumber: caseNumber, caseStatus: caseStatus, show: openRequestRemoteSessionModal, onClose: toggleRemoteSessionAgreementModal, siteCode: TncConstants.REMOTE_RIDER_SITE_CODE, eventCode: TncConstants.REMOTER_RIDER_EVENT_CODE, loggedInUser: loggedInUser.data.ssoUsername === undefined ? '' : loggedInUser.data.ssoUsername, loggedInUserRights: loggedInUserRights, readOnly: readOnly })));
60
+ React.createElement(RemoteSessionAgreementModal, { caseNumber: caseNumber, caseStatus: caseStatus, show: openRequestRemoteSessionModal, onClose: toggleRemoteSessionAgreementModal, siteCode: TncConstants.REMOTE_RIDER_SITE_CODE, eventCode: TncConstants.REMOTER_RIDER_EVENT_CODE, loggedInUser: jwtSsoUsername, loggedInUserRights: loggedInUserRights, readOnly: readOnly })));
56
61
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAsC/D,wBAAgB,kBAAkB,sBAwZjC"}
1
+ {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA0C,MAAM,OAAO,CAAC;AA4C/D,wBAAgB,kBAAkB,sBAwVjC"}
@@ -7,11 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { useApolloClient } from '@apollo/client/react';
11
10
  import { ValidatedOptions } from '@patternfly/react-core';
12
11
  import { getPhoneObj, PhoneInput } from '@rh-support/components';
13
12
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
14
- import { buildAccountWhereForContacts, GET_ACCOUNT_CONTACTS } from '@rh-support/utils';
15
13
  import isEmpty from 'lodash/isEmpty';
16
14
  import isEqual from 'lodash/isEqual';
17
15
  import isUndefined from 'lodash/isUndefined';
@@ -25,42 +23,45 @@ import { setCaseDetails, setCaseState } from '../../reducers/CaseReducer';
25
23
  import { PDFContext } from '../CaseEditView/PDFContainer';
26
24
  import { removeAllChars, trimAndReplacePlus } from '../shared/utils';
27
25
  import { ContactPhoneNumberPopOver } from './ContactPhoneNumberPopOver';
28
- function fetchContactBySSO(apolloClient, accountNumber, ssoUsername) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
31
- const { data } = yield apolloClient.query({
32
- query: GET_ACCOUNT_CONTACTS,
33
- variables: {
34
- accountWhere: buildAccountWhereForContacts(undefined, accountNumber),
35
- contactsWhere: { SSOUserName__c: { eq: ssoUsername } },
36
- first: 1,
37
- },
38
- });
39
- const response = data;
40
- const contactNode = (_j = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.Contacts) === null || _g === void 0 ? void 0 : _g.edges) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.node;
26
+ /** Parse owner phone into case phone fields (same rules as GraphQL phone mapping). */
27
+ function parseOwnerPhone(ownerPhone) {
28
+ if (!(ownerPhone === null || ownerPhone === void 0 ? void 0 : ownerPhone.trim())) {
29
+ return { phoneAreaCodePrefixLineNumber: '', phoneCountryCode: '' };
30
+ }
31
+ // TODO: Temporary — only parse country code from +{countryCode}-{phoneLine} format
32
+ const explicitPhoneMatch = ownerPhone.trim().match(/^\+(\d+)-(.+)$/);
33
+ if (explicitPhoneMatch) {
41
34
  return {
42
- phone: (_l = (_k = contactNode === null || contactNode === void 0 ? void 0 : contactNode.Phone) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : '',
35
+ phoneCountryCode: `+${explicitPhoneMatch[1]}`,
36
+ phoneAreaCodePrefixLineNumber: explicitPhoneMatch[2],
43
37
  };
44
- });
38
+ }
39
+ return {
40
+ // TODO: Temporary — strip leading + when phone is not in +{countryCode}-{phoneLine} format.
41
+ phoneAreaCodePrefixLineNumber: ownerPhone.replace(/^\+/, ''),
42
+ phoneCountryCode: '',
43
+ portalPhone: ownerPhone,
44
+ };
45
45
  }
46
46
  export function ContactPhoneNumber() {
47
- const apolloClient = useApolloClient();
48
- const { suppliedPhoneNumberVerified, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', hasLoggedInUserConfirmedPhoneNumber, contactSSOName, accountNumberRef, shouldNotSetPhoneCountryCode, isCasePhoneUpdating, } = useCaseSelector((state) => ({
49
- suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
50
- phoneCountryCode: state.caseDetails.phoneCountryCode,
51
- phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber,
52
- hasLoggedInUserConfirmedPhoneNumber: state.hasLoggedInUserConfirmedPhoneNumber,
53
- contactSSOName: state.caseDetails.contactSSOName,
54
- accountNumberRef: state.caseDetails.accountNumberRef,
55
- shouldNotSetPhoneCountryCode: state.shouldNotSetPhoneCountryCode,
56
- isCasePhoneUpdating: state.isCasePhoneUpdating,
57
- }), isEqual);
47
+ const { suppliedPhoneNumberVerified, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', hasLoggedInUserConfirmedPhoneNumber, contactSSOName, shouldNotSetPhoneCountryCode, isCasePhoneUpdating, selectedOwnerPhone, } = useCaseSelector((state) => {
48
+ var _a, _b;
49
+ return ({
50
+ suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
51
+ phoneCountryCode: state.caseDetails.phoneCountryCode,
52
+ phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber,
53
+ hasLoggedInUserConfirmedPhoneNumber: state.hasLoggedInUserConfirmedPhoneNumber,
54
+ contactSSOName: state.caseDetails.contactSSOName,
55
+ shouldNotSetPhoneCountryCode: state.shouldNotSetPhoneCountryCode,
56
+ isCasePhoneUpdating: state.isCasePhoneUpdating,
57
+ selectedOwnerPhone: (_b = (_a = state.selectedOwner) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.phone,
58
+ });
59
+ }, isEqual);
58
60
  const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
59
61
  const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
60
62
  const [invalid, setInvalid] = useState(false);
61
63
  const [portalPhone, setPortalPhone] = useState('');
62
64
  const [localFullPhone, setLocalFullPhone] = useState('');
63
- const [isFetchingSso, setIsFetchingSso] = useState(false);
64
65
  const { isExportingPDF } = useContext(PDFContext);
65
66
  const getPhone = phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber;
66
67
  const caseDispatch = useCaseDispatch();
@@ -141,7 +142,7 @@ export function ContactPhoneNumber() {
141
142
  setLocalFullPhone('');
142
143
  setCaseState(caseDispatch, { isCasePhoneUpdating: true });
143
144
  const initContactPhoneNumber = () => __awaiter(this, void 0, void 0, function* () {
144
- var _a, _b;
145
+ var _a;
145
146
  let _phoneAreaCodePrefixLineNumber;
146
147
  let _phoneCountryCode;
147
148
  let _suppliedPhoneNumberVerified;
@@ -205,51 +206,15 @@ export function ContactPhoneNumber() {
205
206
  }
206
207
  }
207
208
  else {
208
- // user is opening case for others (user is partner or red hatter)
209
- try {
210
- if (!contactSSOName)
211
- return;
212
- setIsFetchingSso(true);
213
- const selectedContact = yield fetchContactBySSO(apolloClient, accountNumberRef, contactSSOName);
214
- setIsFetchingSso(false);
215
- /* TODO: Revert to previous logic after phone format handling is finalized.
216
- const phoneLength = trimAndReplacePlus(removeAllChars(selectedContact.phone)).length;
217
-
218
- if (phoneLength > 10) {
219
- _phoneAreaCodePrefixLineNumber = getPhoneObj(selectedContact.phone).phoneLine || '';
220
- _phoneCountryCode = getPhoneObj(selectedContact.phone).countryCode || '';
221
- } else {
222
- _phoneAreaCodePrefixLineNumber = selectedContact.phone;
223
- _phoneCountryCode = '';
224
- setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: true });
225
- setPortalPhone(selectedContact.phone);
226
- }
227
- */
228
- // TODO: Temporary — only parse country code from +{countryCode}-{phoneLine} format (e.g. +93-895674341).
229
- const explicitPhoneMatch = (_b = selectedContact.phone) === null || _b === void 0 ? void 0 : _b.trim().match(/^\+(\d+)-(.+)$/);
230
- if (explicitPhoneMatch) {
231
- _phoneCountryCode = `+${explicitPhoneMatch[1]}`;
232
- _phoneAreaCodePrefixLineNumber = explicitPhoneMatch[2];
233
- }
234
- else {
235
- // TODO: Temporary — strip leading + when phone is not in +{countryCode}-{phoneLine} format.
236
- _phoneAreaCodePrefixLineNumber = selectedContact.phone.replace(/^\+/, '');
237
- /* TODO: Revert to previous logic after phone format handling is finalized.
238
- _phoneAreaCodePrefixLineNumber = selectedContact.phone;
239
- */
240
- _phoneCountryCode = '';
241
- setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: true });
242
- setPortalPhone(selectedContact.phone);
243
- }
244
- _suppliedPhoneNumberVerified = 'Deferred';
245
- }
246
- catch (e) {
247
- _phoneAreaCodePrefixLineNumber = '';
248
- _phoneCountryCode = '';
249
- _suppliedPhoneNumberVerified = 'False';
250
- setIsFetchingSso(false);
251
- setCaseState(caseDispatch, { isCasePhoneUpdating: false });
209
+ // Opening case for another owner — use phone already on selectedOwner
210
+ const parsed = parseOwnerPhone(selectedOwnerPhone);
211
+ _phoneAreaCodePrefixLineNumber = parsed.phoneAreaCodePrefixLineNumber;
212
+ _phoneCountryCode = parsed.phoneCountryCode;
213
+ if (parsed.portalPhone) {
214
+ setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: true });
215
+ setPortalPhone(parsed.portalPhone);
252
216
  }
217
+ _suppliedPhoneNumberVerified = 'Deferred';
253
218
  }
254
219
  setCaseDetails(caseDispatch, {
255
220
  phoneAreaCodePrefixLineNumber: _phoneAreaCodePrefixLineNumber,
@@ -279,24 +244,6 @@ export function ContactPhoneNumber() {
279
244
  let portalPhone;
280
245
  let supportPhone;
281
246
  setCaseState(caseDispatch, { isCasePhoneUpdating: true });
282
- const getSelectedContactPhoneInfo = () => __awaiter(this, void 0, void 0, function* () {
283
- try {
284
- if (!contactSSOName)
285
- return;
286
- const selectedContact = yield fetchContactBySSO(apolloClient, accountNumberRef, contactSSOName);
287
- if (!isEmpty(selectedContact.phone)) {
288
- portalPhone = selectedContact.phone;
289
- phoneLength = trimAndReplacePlus(removeAllChars(portalPhone)).length;
290
- supportPhone = '';
291
- }
292
- }
293
- catch (e) {
294
- portalPhone = '';
295
- supportPhone = '';
296
- phoneLength = 0;
297
- setCaseState(caseDispatch, { isCasePhoneUpdating: false });
298
- }
299
- });
300
247
  // logged in user and case owner are the same
301
248
  if (contactSSOName === loggedInUser.data.ssoUsername) {
302
249
  if (isEmpty(loggedInUser.data.supportPhoneAreaCodePrefixLineNumber) &&
@@ -307,13 +254,12 @@ export function ContactPhoneNumber() {
307
254
  }
308
255
  }
309
256
  else {
310
- // user is openning case for others (use is partner or red hatter)
311
- try {
312
- yield getSelectedContactPhoneInfo();
313
- }
314
- catch (error) {
315
- console.log(error);
316
- setCaseState(caseDispatch, { isCasePhoneUpdating: false });
257
+ // Opening case for another owner — use phone already on selectedOwner
258
+ const ownerPhone = selectedOwnerPhone !== null && selectedOwnerPhone !== void 0 ? selectedOwnerPhone : '';
259
+ if (!isEmpty(ownerPhone)) {
260
+ portalPhone = ownerPhone;
261
+ phoneLength = trimAndReplacePlus(removeAllChars(portalPhone)).length;
262
+ supportPhone = '';
317
263
  }
318
264
  }
319
265
  if ((isUndefined(supportPhone) || isEmpty(supportPhone)) &&
@@ -335,13 +281,13 @@ export function ContactPhoneNumber() {
335
281
  });
336
282
  getPhoneInfo();
337
283
  // eslint-disable-next-line react-hooks/exhaustive-deps
338
- }, [contactSSOName, shouldNotSetPhoneCountryCode]);
284
+ }, [contactSSOName, selectedOwnerPhone, shouldNotSetPhoneCountryCode]);
339
285
  return (React.createElement("div", { className: "form-group", style: { minWidth: '200px' } },
340
286
  React.createElement("label", null,
341
287
  React.createElement(Trans, null, "Case owner's phone number"),
342
288
  React.createElement("span", { className: `form-required ${isExportingPDF ? 'hide-in-pdf' : ''}`, "aria-hidden": true }, "*"),
343
289
  ContactPhoneNumberPopOver()),
344
- React.createElement(PhoneInput, { phoneValue: localFullPhone, countryCode: phoneCountryCode, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid, isLoading: isFetchingSso || isCasePhoneUpdating, shouldNotSetCountryCode: shouldNotSetPhoneCountryCode, isDisabled: isFetchingSso || isCasePhoneUpdating }),
290
+ React.createElement(PhoneInput, { phoneValue: localFullPhone, countryCode: phoneCountryCode, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, invalid: invalid, setInvalid: setInvalid, isLoading: isCasePhoneUpdating, shouldNotSetCountryCode: shouldNotSetPhoneCountryCode, isDisabled: isCasePhoneUpdating }),
345
291
  !invalid &&
346
292
  getPhone.length <= PHONE_LIMIT &&
347
293
  !(isPhoneNumberEmpty && isNextBtnClickedToShowValidationError) &&
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteRiderAcceptanceModal.d.ts","sourceRoot":"","sources":["../../../../src/components/RemoteRider/RemoteRiderAcceptanceModal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;CACrD;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,KAAK,EAAE,MAAM,qBAoF/D"}
1
+ {"version":3,"file":"RemoteRiderAcceptanceModal.d.ts","sourceRoot":"","sources":["../../../../src/components/RemoteRider/RemoteRiderAcceptanceModal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;CACrD;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,KAAK,EAAE,MAAM,qBAwF/D"}
@@ -19,7 +19,12 @@ import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
19
19
  import { GET_CASE_COMMENTS, useCreateCaseComment } from '../../hooks/useCaseComments';
20
20
  import { updateCaseDetailsGraphQL } from '../../reducers/CaseReducer';
21
21
  export default function RemoteRiderAcceptanceModal(props) {
22
- const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
22
+ const { globalMetadataState: { loggedInUserJwtToken }, } = useContext(GlobalMetadataStateContext);
23
+ const jwtSsoUsername = (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username) ||
24
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.username) ||
25
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.RHAT_LOGIN) ||
26
+ (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.REDHAT_LOGIN) ||
27
+ '';
23
28
  const { t } = useTranslation();
24
29
  const apolloClient = useApolloClient();
25
30
  const caseDispatch = useCaseDispatch();
@@ -31,8 +36,8 @@ export default function RemoteRiderAcceptanceModal(props) {
31
36
  const onConfirm = (pdfId) => __awaiter(this, void 0, void 0, function* () {
32
37
  setIsSubmitting(true);
33
38
  try {
34
- yield request(TncConstants.REMOTE_RIDER_SITE_CODE, loggedInUser.data.ssoUsername, pdfId, 'accepted');
35
- const ackedByUserId = yield resolveSalesforceUserIdByFederationId(apolloClient, loggedInUser.data.ssoUsername);
39
+ yield request(TncConstants.REMOTE_RIDER_SITE_CODE, jwtSsoUsername, pdfId, 'accepted');
40
+ const ackedByUserId = yield resolveSalesforceUserIdByFederationId(apolloClient, jwtSsoUsername);
36
41
  if (!ackedByUserId) {
37
42
  throw new Error('Salesforce user id is required to acknowledge remote rider terms');
38
43
  }
@@ -63,5 +68,5 @@ export default function RemoteRiderAcceptanceModal(props) {
63
68
  setIsSubmitting(false);
64
69
  }
65
70
  });
66
- return (React.createElement(AcceptTermsModal, { isSubmitting: isSubmitting, siteCode: TncConstants.REMOTE_RIDER_SITE_CODE, eventCode: TncConstants.REMOTER_RIDER_EVENT_CODE, loggedInUser: loggedInUser.data.ssoUsername, isModalOpen: props.isModalOpen, onModalClose: props.onModalClose, dataTrackingId: props.isCaseDetailsPage ? 'rar-case-details' : 'rar-case-submit', onConfirm: onConfirm }));
71
+ return (React.createElement(AcceptTermsModal, { isSubmitting: isSubmitting, siteCode: TncConstants.REMOTE_RIDER_SITE_CODE, eventCode: TncConstants.REMOTER_RIDER_EVENT_CODE, loggedInUser: jwtSsoUsername, isModalOpen: props.isModalOpen, onModalClose: props.onModalClose, dataTrackingId: props.isCaseDetailsPage ? 'rar-case-details' : 'rar-case-submit', onConfirm: onConfirm }));
67
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAiBvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBAkftD"}
1
+ {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAiBvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBAgftD"}
@@ -200,12 +200,10 @@ export function GlobalTroubleshootEffects(props) {
200
200
  if (selectedOwnerContactId)
201
201
  return;
202
202
  const fetchAndSetDefaultOwner = () => __awaiter(this, void 0, void 0, function* () {
203
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
203
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
204
204
  try {
205
205
  // Same as logged-in user resolve: JWT/SSO → RedHatSupportContact by SSOUserName__c
206
- const ssoUsername = loggedInUserRights.data.getSSOUsername() ||
207
- ((_a = loggedInUser.data) === null || _a === void 0 ? void 0 : _a.ssoUsername) ||
208
- (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username) ||
206
+ const ssoUsername = (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username) ||
209
207
  (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.username) ||
210
208
  (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.RHAT_LOGIN) ||
211
209
  (loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.REDHAT_LOGIN) ||
@@ -221,27 +219,27 @@ export function GlobalTroubleshootEffects(props) {
221
219
  },
222
220
  fetchPolicy: 'network-only',
223
221
  });
224
- const contactDetails = (_f = (_e = (_d = (_c = (_b = contactData === null || contactData === void 0 ? void 0 : contactData.redhat_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.RedHatSupportContact) === null || _d === void 0 ? void 0 : _d.edges) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.node;
222
+ const contactDetails = (_e = (_d = (_c = (_b = (_a = contactData === null || contactData === void 0 ? void 0 : contactData.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportContact) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.node;
225
223
  if (!(contactDetails === null || contactDetails === void 0 ? void 0 : contactDetails.Id))
226
224
  return;
227
225
  const ownerData = {
228
226
  id: contactDetails.Id,
229
- ssoUsername: ((_g = contactDetails.SSOUserName__c) === null || _g === void 0 ? void 0 : _g.value) || ssoUsername,
230
- firstName: (_j = (_h = contactDetails.FirstName) === null || _h === void 0 ? void 0 : _h.value) !== null && _j !== void 0 ? _j : '',
231
- lastName: (_l = (_k = contactDetails.LastName) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : '',
232
- fullNameCustom: (_o = (_m = contactDetails.Name) === null || _m === void 0 ? void 0 : _m.value) !== null && _o !== void 0 ? _o : '',
233
- manageSupportCases: (_q = (_p = contactDetails.ManageSupportCases__c) === null || _p === void 0 ? void 0 : _p.value) !== null && _q !== void 0 ? _q : true,
234
- isInternal: (_s = (_r = contactDetails.IsInternal__c) === null || _r === void 0 ? void 0 : _r.value) !== null && _s !== void 0 ? _s : false,
235
- isOrgAdmin: (_u = (_t = contactDetails.IsOrgAdmin__c) === null || _t === void 0 ? void 0 : _t.value) !== null && _u !== void 0 ? _u : false,
236
- phone: (_w = (_v = contactDetails.Phone) === null || _v === void 0 ? void 0 : _v.value) !== null && _w !== void 0 ? _w : '',
237
- defaultCaseGroup: (_y = (_x = contactDetails.DefaultCaseGroup__c) === null || _x === void 0 ? void 0 : _x.value) !== null && _y !== void 0 ? _y : null,
227
+ ssoUsername: ((_f = contactDetails.SSOUserName__c) === null || _f === void 0 ? void 0 : _f.value) || ssoUsername,
228
+ firstName: (_h = (_g = contactDetails.FirstName) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : '',
229
+ lastName: (_k = (_j = contactDetails.LastName) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : '',
230
+ fullNameCustom: (_m = (_l = contactDetails.Name) === null || _l === void 0 ? void 0 : _l.value) !== null && _m !== void 0 ? _m : '',
231
+ manageSupportCases: (_p = (_o = contactDetails.ManageSupportCases__c) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : true,
232
+ isInternal: (_r = (_q = contactDetails.IsInternal__c) === null || _q === void 0 ? void 0 : _q.value) !== null && _r !== void 0 ? _r : false,
233
+ isOrgAdmin: (_t = (_s = contactDetails.IsOrgAdmin__c) === null || _s === void 0 ? void 0 : _s.value) !== null && _t !== void 0 ? _t : false,
234
+ phone: (_v = (_u = contactDetails.Phone) === null || _u === void 0 ? void 0 : _u.value) !== null && _v !== void 0 ? _v : '',
235
+ defaultCaseGroup: (_x = (_w = contactDetails.DefaultCaseGroup__c) === null || _w === void 0 ? void 0 : _w.value) !== null && _x !== void 0 ? _x : null,
238
236
  };
239
237
  setCaseState(caseDispatch, {
240
238
  selectedOwner: { data: ownerData, isFetching: false, isError: false, errorMessage: '' },
241
239
  });
242
240
  setCaseDetails(caseDispatch, { contactSSOName: ownerData.ssoUsername });
243
241
  }
244
- catch (_z) {
242
+ catch (_y) {
245
243
  // Contact fetch failed; owner stays empty
246
244
  }
247
245
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.7.33",
3
+ "version": "2.7.35",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -52,11 +52,11 @@
52
52
  "@progress/kendo-licensing": "1.3.5",
53
53
  "@progress/kendo-react-pdf": "^5.16.0",
54
54
  "@redux-devtools/extension": "^3.3.0",
55
- "@rh-support/components": "2.6.30",
56
- "@rh-support/react-context": "2.6.32",
55
+ "@rh-support/components": "2.6.31",
56
+ "@rh-support/react-context": "2.6.33",
57
57
  "@rh-support/types": "2.0.31",
58
- "@rh-support/user-permissions": "2.6.28",
59
- "@rh-support/utils": "2.6.27",
58
+ "@rh-support/user-permissions": "2.6.29",
59
+ "@rh-support/utils": "2.6.28",
60
60
  "@types/react-redux": "^7.1.33",
61
61
  "@types/redux": "^3.6.0",
62
62
  "date-fns": "3.6.0",
@@ -129,5 +129,5 @@
129
129
  "defaults and supports es6-module",
130
130
  "maintained node versions"
131
131
  ],
132
- "gitHead": "9df9f4f2161c259492b62d5a05c59cdc59a7dcc8"
132
+ "gitHead": "502b4ddee254af10ba0f905309e059d28cb59ff8"
133
133
  }