@rh-support/manage 1.0.11 → 1.0.13

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":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAoBA,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eA+JlD"}
1
+ {"version":3,"file":"PreferencesCaseCreate.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseCreate.tsx"],"names":[],"mappings":"AAoBA,UAAU,MAAM;CAAG;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,eAkKlD"}
@@ -44,7 +44,10 @@ export function PreferencesCaseCreate(props) {
44
44
  return languagesList.find((language) => language.label === selection);
45
45
  };
46
46
  const getLanguageInitialLangValue = (label) => {
47
- return languagesList.find((language) => language.value === label);
47
+ const foundLang = languagesList.find((language) => language.value === label);
48
+ if (!isEmpty(foundLang)) {
49
+ return foundLang === null || foundLang === void 0 ? void 0 : foundLang.label;
50
+ }
48
51
  };
49
52
  const onPreferredLanguageSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
50
53
  const selectedLanguageCode = getLanguageKey(selection);
@@ -80,7 +83,7 @@ export function PreferencesCaseCreate(props) {
80
83
  const retrievedGroupId = yield getDefaultGroup();
81
84
  setOriginalDefaultGroup(groupDictionary[retrievedGroupId]);
82
85
  }
83
- catch (_a) {
86
+ catch (e) {
84
87
  ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
85
88
  }
86
89
  });
@@ -108,16 +111,16 @@ export function PreferencesCaseCreate(props) {
108
111
  try {
109
112
  const retrievedLanguage = yield getPreferredLanguage();
110
113
  const finalOriginalLanguage = getLanguageInitialLangValue(retrievedLanguage);
111
- setOriginalPreferredLanguage(finalOriginalLanguage.label);
114
+ setOriginalPreferredLanguage(finalOriginalLanguage);
112
115
  }
113
- catch (_b) {
116
+ catch (e) {
114
117
  ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
115
118
  }
116
119
  });
117
120
  refreshParsedGroups();
118
121
  userOriginalPreferredLanguage();
119
122
  // eslint-disable-next-line react-hooks/exhaustive-deps
120
- }, [caseGroups, dispatchToGlobalMetadataReducer, loggedInUserJwtToken]);
123
+ }, [caseLanguages, caseGroups, dispatchToGlobalMetadataReducer, loggedInUserJwtToken]);
121
124
  return (React.createElement(Card, { className: "preference-card" },
122
125
  React.createElement(CardHeader, null,
123
126
  React.createElement("h3", null,
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA4QhD"}
1
+ {"version":3,"file":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eAkRhD"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { accounts } from '@cee-eng/hydrajs';
11
11
  import { Card, CardBody, CardHeader, Popover, PopoverPosition, SelectOption, Spinner, TextArea, Tooltip, } from '@patternfly/react-core';
12
- import InfoIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
12
+ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
13
13
  import { EditorMode, ToastNotification, useFetch } from '@rh-support/components';
14
14
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
15
15
  import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
@@ -51,7 +51,7 @@ export function PreferencesCaseView(props) {
51
51
  const userOriginalCaseView = () => __awaiter(this, void 0, void 0, function* () {
52
52
  try {
53
53
  const retrievedCaseView = yield getOriginalCaseView();
54
- if (!isEmpty(retrievedCaseView)) {
54
+ if (retrievedCaseView !== null) {
55
55
  setOriginalCaseView(+retrievedCaseView);
56
56
  }
57
57
  }
@@ -114,7 +114,7 @@ export function PreferencesCaseView(props) {
114
114
  try {
115
115
  let selectedView = event.currentTarget.getAttribute('data-index');
116
116
  updateOriginalCaseView(selectedView);
117
- setOriginalCaseView(selectedView);
117
+ setOriginalCaseView(+selectedView);
118
118
  }
119
119
  catch (error) {
120
120
  console.log(error);
@@ -157,12 +157,19 @@ export function PreferencesCaseView(props) {
157
157
  setIsHostnamesLoading(false);
158
158
  });
159
159
  const prefHostnameCopy = 'Red Hat Support cannot currently access hostnames that have been entered on a case. You can share this information at any time to improve your support experience.';
160
- const caseViewPrefSelection = caseViewTypes[originalCaseView].value || caseViewTypes[+originalAccountPermission].value;
160
+ const caseViewPrefSelection = () => {
161
+ if (!!originalCaseView) {
162
+ return caseViewTypes[+originalAccountPermission].value;
163
+ }
164
+ else if (!!!originalCaseView) {
165
+ return caseViewTypes[originalCaseView].value;
166
+ }
167
+ };
161
168
  const prefCasePopover = (React.createElement(React.Fragment, null,
162
169
  React.createElement(Trans, null, "Default Case View"),
163
170
  React.createElement(Popover, { "aria-label": "Preferred-default-case-view-popover", position: PopoverPosition.top, bodyContent: React.createElement("p", { className: 'pref-case-popover-text' },
164
171
  React.createElement(Trans, null, "Choose the default view you want to see when looking at a case")), showClose: false },
165
- React.createElement("i", { "aria-label": "Preferred-default-case-view-info-icon", className: "fa fa-question-circle" }))));
172
+ React.createElement(InfoCircleIcon, { "aria-label": "Preferred-default-case-view-info-icon", className: "pf-u-ml-sm" }))));
166
173
  return (React.createElement(Card, { className: "preference-card" },
167
174
  React.createElement(CardHeader, null,
168
175
  React.createElement("h3", null,
@@ -170,7 +177,7 @@ export function PreferencesCaseView(props) {
170
177
  React.createElement(CardBody, null,
171
178
  React.createElement("form", null,
172
179
  isInternalUserPermission && (React.createElement("div", { className: "form-group" },
173
- React.createElement(PreferenceSelect, { onSelect: onPrefCaseViewSelect, selections: caseViewPrefSelection, id: defaultCaseViewID, label: prefCasePopover }, caseViewTypes.map((option, index) => (React.createElement(SelectOption, Object.assign({ "data-index": index, key: index, value: option.value }, (option.description && { description: option.description })))))))),
180
+ React.createElement(PreferenceSelect, { onSelect: onPrefCaseViewSelect, selections: caseViewPrefSelection(), id: defaultCaseViewID, label: prefCasePopover }, caseViewTypes.map((option, index) => (React.createElement(SelectOption, Object.assign({ "data-index": index, key: index, value: option.value }, (option.description && { description: option.description })))))))),
174
181
  React.createElement("div", { className: "form-group" },
175
182
  React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: originalCommentType, id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: option }))))),
176
183
  React.createElement("div", { className: "form-group" },
@@ -187,6 +194,6 @@ export function PreferencesCaseView(props) {
187
194
  React.createElement(PreferenceSwitch, { className: "switches hostnameSwitch", id: "share-hostnames-switch", label: 'Share hostnames', isChecked: isSharingHostNames, onSwitchChange: onShareHostNamesSwitch }),
188
195
  React.createElement("div", { className: "prefhostnameTooltip" },
189
196
  React.createElement(Tooltip, { content: prefHostnameCopy, position: "right" },
190
- React.createElement(InfoIcon, { className: "pf-u-ml-sm" })),
197
+ React.createElement(InfoCircleIcon, { className: "pf-u-ml-sm" })),
191
198
  isHostnamesLoading && (React.createElement(Spinner, { isSVG: true, size: "lg", className: "pf-u-ml-sm hostnameSpinner", "aria-label": "Hostname loading" }))))))))));
192
199
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -109,5 +109,5 @@
109
109
  "react-i18next": ">=10.11.0",
110
110
  "react-router-dom": ">=5.1.2"
111
111
  },
112
- "gitHead": "9647d8b819bf1ccbf691c0e89909160752ea24a7"
112
+ "gitHead": "385be1a5087e7a199a974b22442a06f8ef61a06b"
113
113
  }