@rh-support/troubleshoot 2.2.22 → 2.2.23

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":"AAwBA,wBAAgB,sBAAsB,gBAmPrC"}
1
+ {"version":3,"file":"CaseContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.tsx"],"names":[],"mappings":"AAwBA,wBAAgB,sBAAsB,gBAkPrC"}
@@ -60,13 +60,13 @@ export function CaseContactPhoneNumber() {
60
60
  };
61
61
  const onSave = () => __awaiter(this, void 0, void 0, function* () {
62
62
  setIsSavedClicked(true);
63
- if (isPhoneLineEmpty || isPhoneNumberInvalid)
63
+ if (isPhoneValueCannotBeSaved)
64
64
  return;
65
65
  setCasePhoneUpdating(true);
66
66
  const phoneLine = localFullPhoneState
67
67
  .substring(localCountryCodeState.length, localFullPhoneState.length)
68
68
  .trim();
69
- const countryCode = localCountryCodeState.trim();
69
+ const countryCode = trimAndReplacePlus(localCountryCodeState);
70
70
  try {
71
71
  // update case contact info
72
72
  yield updateCaseDetails(caseDispatch, caseNumber, Object.assign(Object.assign({ phoneCountryCode: countryCode, phoneAreaCodePrefixLineNumber: phoneLine }, (contactSSOName === loggedInUser.data.ssoUsername && { suppliedPhoneNumberVerified: 'True' })), (!countryCode && !phoneLine && { clearPhoneNumber: true, suppliedPhoneNumberVerified: 'False' })));
@@ -75,9 +75,7 @@ export function CaseContactPhoneNumber() {
75
75
  ToastNotification.addSuccessMessage(t(`Phone number has been successfully updated`));
76
76
  try {
77
77
  // update logged-in user contact info
78
- if (contactSSOName === loggedInUser.data.ssoUsername &&
79
- !isEmpty(phoneLine === null || phoneLine === void 0 ? void 0 : phoneLine.trim()) &&
80
- !isEmpty(trimAndReplacePlus(countryCode))) {
78
+ if (contactSSOName === loggedInUser.data.ssoUsername && !isEmpty(phoneLine) && !isEmpty(countryCode)) {
81
79
  yield contacts.updateContactBySSO(loggedInUser.data.ssoUsername, {
82
80
  supportPhoneCountryCode: countryCode,
83
81
  supportPhoneAreaCodePrefixLineNumber: phoneLine,
@@ -128,6 +126,7 @@ export function CaseContactPhoneNumber() {
128
126
  : invalid
129
127
  ? ValidatedOptions.error
130
128
  : ValidatedOptions.default;
129
+ const isPhoneValueCannotBeSaved = isPhoneLineEmpty || isPhoneNumberInvalid || localFullPhoneState.trim() === localCountryCodeState.trim();
131
130
  // should be removed when old phone field is removed by CCM team
132
131
  useEffect(() => {
133
132
  var _a, _b;
@@ -155,20 +154,19 @@ export function CaseContactPhoneNumber() {
155
154
  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 }),
156
155
  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 ||
157
156
  localFullPhoneState === phoneCountryCode + ' ' + phoneAreaCodePrefixLineNumber ||
158
- (isSaveClicked && (isPhoneLineEmpty || isPhoneNumberInvalid)), style: { display: isExportingPDF ? 'none' : '' } },
157
+ (isSaveClicked && isPhoneValueCannotBeSaved), style: { display: isExportingPDF ? 'none' : '' } },
159
158
  React.createElement(CheckIcon, null)),
160
159
  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) },
161
160
  React.createElement(TimesIcon, { color: "#6A6E73" }))),
162
161
  !invalid &&
163
162
  (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) < PHONE_LIMIT &&
164
- !(isPhoneLineEmpty && isSaveClicked) &&
165
- !(isSaveClicked && isPhoneNumberInvalid) &&
163
+ !(isSaveClicked && isPhoneValueCannotBeSaved) &&
166
164
  !isShowOldPhone && (React.createElement("p", { className: "form-instructions" },
167
165
  React.createElement(Trans, null, PHONE_INSTRUCTION))),
168
166
  invalid && (React.createElement("p", { className: "form-instructions form-invalid" },
169
167
  React.createElement(Trans, null, PHONE_NO_CHAR_ERROR))),
170
168
  (localFullPhoneState === null || localFullPhoneState === void 0 ? void 0 : localFullPhoneState.length) > PHONE_LIMIT && (React.createElement("p", { className: "form-instructions form-invalid" }, maxLengthErrorMessage)),
171
- isSaveClicked && isPhoneLineEmpty && (React.createElement("p", { className: "form-instructions form-invalid" },
169
+ isSaveClicked && (isPhoneLineEmpty || localFullPhoneState.trim() === localCountryCodeState.trim()) && (React.createElement("p", { className: "form-instructions form-invalid" },
172
170
  React.createElement(Trans, null, PHONE_LINE_CANNOT_BE_EMPTY))),
173
171
  isSaveClicked && isPhoneNumberInvalid && (React.createElement("p", { className: "form-instructions form-invalid" },
174
172
  React.createElement(Trans, null, PHONE_IS_NOT_VALID))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.2.22",
3
+ "version": "2.2.23",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -133,5 +133,5 @@
133
133
  "defaults and supports es6-module",
134
134
  "maintained node versions"
135
135
  ],
136
- "gitHead": "54bc1f4ec262c366c2f13ccf03a0df500b97af6a"
136
+ "gitHead": "37be192367e7927f47125f2452142bbb8ccf9215"
137
137
  }