@rh-support/manage 1.0.17 → 1.0.19

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":"PreferencesCaseView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ManagePreferences/sections/PreferencesCaseView.tsx"],"names":[],"mappings":"AAyBA,UAAU,MAAM;CAAG;AAEnB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,eA6RhD"}
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,eAsShD"}
@@ -48,6 +48,34 @@ export function PreferencesCaseView(props) {
48
48
  description: t('View internal information available to Red Hat associates only.'),
49
49
  }, // [1] ; true
50
50
  ];
51
+ useEffect(() => {
52
+ userOriginalCommentSignature();
53
+ userOriginalCommentType();
54
+ userOriginalCaseView();
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ }, []);
57
+ useEffect(() => {
58
+ if (localCommentSignature === '' && commentValidated !== 'error') {
59
+ setCommentValidated('default');
60
+ }
61
+ }, [localCommentSignature, commentValidated]);
62
+ useEffect(() => {
63
+ function userOriginalHostnameValue() {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ try {
66
+ const fetchedHostnameStatus = yield fetchHostnameDefault(accountNumber);
67
+ (fetchedHostnameStatus === null || fetchedHostnameStatus === void 0 ? void 0 : fetchedHostnameStatus.shareHostnameWithRHT) &&
68
+ setIsSharingHostNames(fetchedHostnameStatus.shareHostnameWithRHT);
69
+ }
70
+ catch (error) {
71
+ console.log(error);
72
+ }
73
+ setIsHostnamesLoading(false);
74
+ });
75
+ }
76
+ canUseHostName && userOriginalHostnameValue();
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
+ }, []);
51
79
  const userOriginalCaseView = () => __awaiter(this, void 0, void 0, function* () {
52
80
  try {
53
81
  const retrievedCaseView = yield getOriginalCaseView();
@@ -77,17 +105,6 @@ export function PreferencesCaseView(props) {
77
105
  ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
78
106
  }
79
107
  });
80
- useEffect(() => {
81
- userOriginalCommentSignature();
82
- userOriginalCommentType();
83
- userOriginalCaseView();
84
- // eslint-disable-next-line react-hooks/exhaustive-deps
85
- }, []);
86
- useEffect(() => {
87
- if (localCommentSignature === '' && commentValidated !== 'error') {
88
- setCommentValidated('default');
89
- }
90
- }, [localCommentSignature, commentValidated]);
91
108
  const debounceUpdateCommentSignature = debounce((value) => __awaiter(this, void 0, void 0, function* () {
92
109
  try {
93
110
  yield updateCommentSignature(value);
@@ -120,32 +137,35 @@ export function PreferencesCaseView(props) {
120
137
  console.log(error);
121
138
  }
122
139
  });
140
+ // To set the case of text in dropdown
141
+ const setOptionCase = (option, reverse) => {
142
+ if (reverse) {
143
+ if (option === 'Plain text') {
144
+ return EditorMode.PLAIN;
145
+ }
146
+ else if (option === 'Markdown') {
147
+ return EditorMode.MARKDOWN;
148
+ }
149
+ }
150
+ else {
151
+ if (option === EditorMode.PLAIN) {
152
+ return 'Plain text';
153
+ }
154
+ else if (option === EditorMode.MARKDOWN) {
155
+ return 'Markdown';
156
+ }
157
+ }
158
+ };
123
159
  const onCommentSelect = (event, selection) => __awaiter(this, void 0, void 0, function* () {
124
160
  try {
125
- yield updateCommentType(selection);
126
- setOriginalCommentType(selection);
161
+ const selectedComment = setOptionCase(selection, true);
162
+ yield updateCommentType(selectedComment);
163
+ setOriginalCommentType(selectedComment);
127
164
  }
128
165
  catch (error) {
129
166
  console.log(error);
130
167
  }
131
168
  });
132
- useEffect(() => {
133
- function userOriginalHostnameValue() {
134
- return __awaiter(this, void 0, void 0, function* () {
135
- try {
136
- const fetchedHostnameStatus = yield fetchHostnameDefault(accountNumber);
137
- (fetchedHostnameStatus === null || fetchedHostnameStatus === void 0 ? void 0 : fetchedHostnameStatus.shareHostnameWithRHT) &&
138
- setIsSharingHostNames(fetchedHostnameStatus.shareHostnameWithRHT);
139
- }
140
- catch (error) {
141
- console.log(error);
142
- }
143
- setIsHostnamesLoading(false);
144
- });
145
- }
146
- canUseHostName && userOriginalHostnameValue();
147
- // eslint-disable-next-line react-hooks/exhaustive-deps
148
- }, []);
149
169
  const onShareHostNamesSwitch = () => __awaiter(this, void 0, void 0, function* () {
150
170
  try {
151
171
  setIsHostnamesLoading(true);
@@ -171,15 +191,6 @@ export function PreferencesCaseView(props) {
171
191
  React.createElement(Popover, { "aria-label": "Preferred-default-case-view-popover", position: PopoverPosition.top, bodyContent: React.createElement("p", { className: 'pref-case-popover-text' },
172
192
  React.createElement(Trans, null, "Choose the default view you want to see when looking at a case")), showClose: false },
173
193
  React.createElement(InfoCircleIcon, { "aria-label": "Preferred-default-case-view-info-icon", className: "pf-u-ml-sm" }))));
174
- // To set the case of text in dropdown
175
- const setOptionCase = (option) => {
176
- if (option === 'plaintext') {
177
- return 'Plain text';
178
- }
179
- else if (option === 'markdown') {
180
- return 'Markdown';
181
- }
182
- };
183
194
  return (React.createElement(Card, { className: "preference-card" },
184
195
  React.createElement(CardHeader, null,
185
196
  React.createElement("h3", null,
@@ -189,7 +200,7 @@ export function PreferencesCaseView(props) {
189
200
  isInternalUserPermission && (React.createElement("div", { className: "form-group" },
190
201
  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 })))))))),
191
202
  React.createElement("div", { className: "form-group" },
192
- React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: setOptionCase(originalCommentType), id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: setOptionCase(option) }))))),
203
+ React.createElement(PreferenceSelect, { onSelect: onCommentSelect, selections: setOptionCase(originalCommentType, false), id: defaultCommentTitleID, label: "Default comment type" }, commentTypes.map((option, index) => (React.createElement(SelectOption, { key: index, value: setOptionCase(option, false) }))))),
193
204
  React.createElement("div", { className: "form-group" },
194
205
  React.createElement("label", { htmlFor: "comment-signature-textarea" },
195
206
  React.createElement(Trans, null, "Comment signature")),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "homepage": "",
@@ -94,9 +94,9 @@
94
94
  "@patternfly/pfe-tabs": "1.12.3",
95
95
  "@patternfly/react-core": "4.202.16",
96
96
  "@patternfly/react-table": "4.71.16",
97
- "@rh-support/components": "1.2.9",
97
+ "@rh-support/components": "1.2.10",
98
98
  "@rh-support/configs": "0.2.8",
99
- "@rh-support/react-context": "1.0.10",
99
+ "@rh-support/react-context": "1.0.11",
100
100
  "@rh-support/types": "0.2.0",
101
101
  "@rh-support/user-permissions": "1.0.9",
102
102
  "@rh-support/utils": "1.0.7",
@@ -109,5 +109,5 @@
109
109
  "react-i18next": ">=10.11.0",
110
110
  "react-router-dom": ">=5.1.2"
111
111
  },
112
- "gitHead": "be6f046487e4200cfa92a657336e9ac0526103d6"
112
+ "gitHead": "ff7637b5a64baf223384d15a3b84b6e7019b3a94"
113
113
  }