@rh-support/troubleshoot 2.2.116 → 2.2.117

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":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AASA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAgB/D,wBAAgB,sBAAsB,sBAkRrC"}
1
+ {"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AASA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAgB/D,wBAAgB,sBAAsB,sBAoSrC"}
@@ -110,7 +110,8 @@ export function CaseContactPhoneNumber() {
110
110
  const isPhoneNeedsReview = !isEmpty(contactSSOName) &&
111
111
  contactSSOName === loggedInUser.data.ssoUsername &&
112
112
  suppliedPhoneNumberVerified === 'Deferred' &&
113
- !isCaseOwnerUpdating;
113
+ !isCaseOwnerUpdating &&
114
+ !isCasePhoneUpdating;
114
115
  const isPhoneNumberValid = (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT
115
116
  ? ValidatedOptions.error
116
117
  : isPhoneNeedsReview
@@ -134,24 +135,39 @@ export function CaseContactPhoneNumber() {
134
135
  }
135
136
  // eslint-disable-next-line react-hooks/exhaustive-deps
136
137
  }, [localFullPhoneState]);
137
- // should be removed when old phone field is removed by CCM team
138
- useEffect(() => {
138
+ const updatePhone = () => __awaiter(this, void 0, void 0, function* () {
139
139
  var _a, _b;
140
- if (isEmpty(phoneCountryCode) && isEmpty(phoneAreaCodePrefixLineNumber) && !isEmpty(phone)) {
140
+ if (!isEmpty(phoneCountryCode) && !isEmpty(phoneAreaCodePrefixLineNumber)) {
141
+ setLocalFullPhoneState((phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber).trim());
142
+ setIsShowOldPhone(false);
143
+ }
144
+ else if (isEmpty(phoneCountryCode) && isEmpty(phoneAreaCodePrefixLineNumber) && !isEmpty(phone)) {
141
145
  const oldPhoneline = ((_a = getPhoneObj(phone)) === null || _a === void 0 ? void 0 : _a.phoneLine) || '';
142
146
  const oldCountryCode = ((_b = getPhoneObj(phone)) === null || _b === void 0 ? void 0 : _b.countryCode) || '';
143
147
  if (!isEmpty(oldPhoneline.trim()) && !isEmpty(trimAndReplacePlus(oldCountryCode))) {
144
148
  setLocalFullPhoneState(oldCountryCode + ' ' + oldPhoneline);
145
149
  setLocalCountryCodeState(oldCountryCode);
150
+ setCasePhoneUpdating(true);
151
+ try {
152
+ yield updateCaseDetails(caseDispatch, caseNumber, {
153
+ phoneCountryCode: oldCountryCode,
154
+ phoneAreaCodePrefixLineNumber: oldPhoneline,
155
+ });
156
+ setCasePhoneUpdating(false);
157
+ }
158
+ catch (e) {
159
+ setCasePhoneUpdating(false);
160
+ caseUpdateError.showError(e, t(`Phone number failed to update`));
161
+ }
146
162
  }
147
163
  else {
148
164
  setIsShowOldPhone(true);
149
165
  }
150
166
  }
151
- else {
152
- setLocalFullPhoneState((phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber).trim());
153
- setIsShowOldPhone(false);
154
- }
167
+ });
168
+ // should be removed when old phone field is removed by CCM team
169
+ useEffect(() => {
170
+ updatePhone();
155
171
  // eslint-disable-next-line react-hooks/exhaustive-deps
156
172
  }, [phone, phoneAreaCodePrefixLineNumber, phoneCountryCode]);
157
173
  return (React.createElement("div", { className: "form-group pf-v5-u-pb-md", style: { minWidth: '200px' } },
@@ -160,13 +176,15 @@ export function CaseContactPhoneNumber() {
160
176
  React.createElement("span", { className: `form-required ${isExportingPDF ? 'hide-in-pdf' : ''}`, "aria-hidden": true }, "*"),
161
177
  !isExportingPDF ? ContactPhoneNumberPopOver() : ''),
162
178
  React.createElement(InputGroupText, null,
163
- React.createElement(PhoneInput, { phoneValue: localFullPhoneState, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, isDisabled: isCasePhoneUpdating || isCaseOwnerUpdating || !isEditting, isLoading: isCasePhoneUpdating, "data-tracking-id": "case-details-page-supplied-phone", invalid: invalid, setInvalid: setInvalid }),
179
+ React.createElement(PhoneInput, { phoneValue: localFullPhoneState, onPhoneValueChange: onPhoneChange, onCountryCodeChange: onCountryCodeChange, validations: isPhoneNumberValid, isDisabled: isCasePhoneUpdating || isCaseOwnerUpdating || !isEditting, isLoading: isCasePhoneUpdating || isCaseOwnerUpdating, "data-tracking-id": "case-details-page-supplied-phone", invalid: invalid, setInvalid: setInvalid }),
164
180
  isEditting ? (React.createElement(React.Fragment, null,
165
181
  React.createElement("button", { className: "btn btn-app btn-link pf-v5-u-ml-sm", type: "button", "data-tracking-id": "case-details-page-supplied-phone-save", onClick: () => onSave(), "aria-label": "Save", disabled: (isSaveClicked && isPhoneValueCannotBeSaved) ||
166
182
  (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT ||
167
- localFullPhoneState === phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber, style: { display: isExportingPDF ? 'none' : '' } },
183
+ localFullPhoneState === phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber ||
184
+ isCaseOwnerUpdating ||
185
+ isCasePhoneUpdating, style: { display: isExportingPDF ? 'none' : '' } },
168
186
  React.createElement(CheckIcon, null)),
169
- 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), "aria-label": "Clear" },
187
+ 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) || isCaseOwnerUpdating || isCasePhoneUpdating, "aria-label": "Clear" },
170
188
  React.createElement(TimesIcon, { color: "#6A6E73" })))) : (React.createElement("button", { className: "btn btn-app btn-link", type: "button", onClick: () => setIsEditting(true), "data-tracking-id": "case-details-page-supplied-phone-edit", style: { display: isExportingPDF ? 'none' : '' }, "aria-label": "Edit" },
171
189
  React.createElement(PencilAltIcon, null)))),
172
190
  !invalid &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.2.116",
3
+ "version": "2.2.117",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -131,5 +131,5 @@
131
131
  "defaults and supports es6-module",
132
132
  "maintained node versions"
133
133
  ],
134
- "gitHead": "aa56a22b784978f97c2a073e1cc5868648790890"
134
+ "gitHead": "d1c73faf620589ae18fb07a74b30805c154735e2"
135
135
  }