@rh-support/manage 1.0.16 → 1.0.18

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,eAkRhD"}
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);
@@ -110,7 +127,7 @@ export function PreferencesCaseView(props) {
110
127
  setLocalCommentSignature(value);
111
128
  setIsCommentSignatureLoading(false);
112
129
  });
113
- const onPrefCaseViewSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
130
+ const onPrefCaseViewSelect = (event, selection) => __awaiter(this, void 0, void 0, function* () {
114
131
  try {
115
132
  let selectedView = event.currentTarget.getAttribute('data-index');
116
133
  updateOriginalCaseView(selectedView);
@@ -120,31 +137,35 @@ export function PreferencesCaseView(props) {
120
137
  console.log(error);
121
138
  }
122
139
  });
123
- const onCommentSelect = (event, selection, isPlaceholder) => __awaiter(this, void 0, void 0, function* () {
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
+ };
159
+ const onCommentSelect = (event, selection) => __awaiter(this, void 0, void 0, function* () {
124
160
  try {
125
- yield updateCommentType(selection);
161
+ const selectedComment = setOptionCase(selection, true);
162
+ yield updateCommentType(selectedComment);
163
+ setOriginalCommentType(selectedComment);
126
164
  }
127
165
  catch (error) {
128
166
  console.log(error);
129
167
  }
130
168
  });
131
- useEffect(() => {
132
- function userOriginalHostnameValue() {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- try {
135
- const fetchedHostnameStatus = yield fetchHostnameDefault(accountNumber);
136
- (fetchedHostnameStatus === null || fetchedHostnameStatus === void 0 ? void 0 : fetchedHostnameStatus.shareHostnameWithRHT) &&
137
- setIsSharingHostNames(fetchedHostnameStatus.shareHostnameWithRHT);
138
- }
139
- catch (error) {
140
- console.log(error);
141
- }
142
- setIsHostnamesLoading(false);
143
- });
144
- }
145
- canUseHostName && userOriginalHostnameValue();
146
- // eslint-disable-next-line react-hooks/exhaustive-deps
147
- }, []);
148
169
  const onShareHostNamesSwitch = () => __awaiter(this, void 0, void 0, function* () {
149
170
  try {
150
171
  setIsHostnamesLoading(true);
@@ -179,7 +200,7 @@ export function PreferencesCaseView(props) {
179
200
  isInternalUserPermission && (React.createElement("div", { className: "form-group" },
180
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 })))))))),
181
202
  React.createElement("div", { className: "form-group" },
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 }))))),
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) }))))),
183
204
  React.createElement("div", { className: "form-group" },
184
205
  React.createElement("label", { htmlFor: "comment-signature-textarea" },
185
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.16",
3
+ "version": "1.0.18",
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": "8b668e214afb2821d1966a85d4d471fd33864d51"
112
+ "gitHead": "925fc7670c5e657db520965e2fd9edec6fb4c2e7"
113
113
  }