@rh-support/manage 2.5.263 → 2.5.271

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.
Files changed (56) hide show
  1. package/lib/esm/ManageTabs.d.ts.map +1 -1
  2. package/lib/esm/ManageTabs.js +18 -46
  3. package/lib/esm/Routes.d.ts +0 -1
  4. package/lib/esm/Routes.d.ts.map +1 -1
  5. package/lib/esm/Routes.js +0 -6
  6. package/lib/esm/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.d.ts +3 -5
  7. package/lib/esm/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.d.ts.map +1 -1
  8. package/lib/esm/components/Groups/DefualtGroupSwitch/DefaultGroupSwitch.js +14 -21
  9. package/lib/esm/components/Groups/GroupSelect/GroupSelect.d.ts +0 -1
  10. package/lib/esm/components/Groups/GroupSelect/GroupSelect.d.ts.map +1 -1
  11. package/lib/esm/components/Groups/GroupSelect/GroupSelect.js +85 -156
  12. package/lib/esm/components/Groups/ManageGroupUsers/ManageGroupUsers.d.ts.map +1 -1
  13. package/lib/esm/components/Groups/ManageGroupUsers/ManageGroupUsers.js +42 -163
  14. package/lib/esm/components/ManagePreferences/sections/PreferencesACL.d.ts.map +1 -1
  15. package/lib/esm/components/ManagePreferences/sections/PreferencesACL.js +4 -3
  16. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.d.ts.map +1 -1
  17. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseCreate.js +58 -73
  18. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.d.ts.map +1 -1
  19. package/lib/esm/components/ManagePreferences/sections/PreferencesCaseView.js +98 -43
  20. package/lib/esm/constants/GroupSelectActions.d.ts +1 -2
  21. package/lib/esm/constants/GroupSelectActions.d.ts.map +1 -1
  22. package/lib/esm/constants/GroupSelectActions.js +0 -1
  23. package/lib/esm/hooks/useVersionsDiffer.d.ts.map +1 -1
  24. package/lib/esm/index.js +0 -1
  25. package/lib/esm/scss/_main.scss +0 -77
  26. package/package.json +8 -11
  27. package/lib/esm/components/Groups/AddMembersModal/AddMembersModal.d.ts +0 -12
  28. package/lib/esm/components/Groups/AddMembersModal/AddMembersModal.d.ts.map +0 -1
  29. package/lib/esm/components/Groups/AddMembersModal/AddMembersModal.js +0 -80
  30. package/lib/esm/components/Groups/AddMembersModal/index.d.ts +0 -2
  31. package/lib/esm/components/Groups/AddMembersModal/index.d.ts.map +0 -1
  32. package/lib/esm/components/Groups/AddMembersModal/index.js +0 -1
  33. package/lib/esm/components/ManageCaseLabels/AddEditCaseLabelModal.d.ts +0 -19
  34. package/lib/esm/components/ManageCaseLabels/AddEditCaseLabelModal.d.ts.map +0 -1
  35. package/lib/esm/components/ManageCaseLabels/AddEditCaseLabelModal.js +0 -83
  36. package/lib/esm/components/ManageCaseLabels/ManageCaseLabelsTab.d.ts +0 -3
  37. package/lib/esm/components/ManageCaseLabels/ManageCaseLabelsTab.d.ts.map +0 -1
  38. package/lib/esm/components/ManageCaseLabels/ManageCaseLabelsTab.js +0 -217
  39. package/lib/esm/components/ManageCaseLabels/index.d.ts +0 -2
  40. package/lib/esm/components/ManageCaseLabels/index.d.ts.map +0 -1
  41. package/lib/esm/components/ManageCaseLabels/index.js +0 -1
  42. package/lib/esm/components/ManageCaseLabels/types.d.ts +0 -6
  43. package/lib/esm/components/ManageCaseLabels/types.d.ts.map +0 -1
  44. package/lib/esm/components/ManageCaseLabels/types.js +0 -1
  45. package/lib/esm/hooks/useCaseGroupGraphQL.d.ts +0 -42
  46. package/lib/esm/hooks/useCaseGroupGraphQL.d.ts.map +0 -1
  47. package/lib/esm/hooks/useCaseGroupGraphQL.js +0 -109
  48. package/lib/esm/hooks/useCaseLabelGraphQL.d.ts +0 -26
  49. package/lib/esm/hooks/useCaseLabelGraphQL.d.ts.map +0 -1
  50. package/lib/esm/hooks/useCaseLabelGraphQL.js +0 -99
  51. package/lib/esm/hooks/useCurrentUserContact.d.ts +0 -8
  52. package/lib/esm/hooks/useCurrentUserContact.d.ts.map +0 -1
  53. package/lib/esm/hooks/useCurrentUserContact.js +0 -74
  54. package/lib/esm/utils/caseGroupMapper.d.ts +0 -18
  55. package/lib/esm/utils/caseGroupMapper.d.ts.map +0 -1
  56. package/lib/esm/utils/caseGroupMapper.js +0 -49
@@ -7,37 +7,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- // import { accounts } from '@cee-eng/hydrajs';
11
- import { Card, CardBody, CardHeader, Popover, PopoverPosition, SelectOption, Spinner, TextArea,
12
- // Tooltip,
13
- } from '@patternfly/react-core';
10
+ import { accounts } from '@cee-eng/hydrajs';
11
+ import { Card, CardBody, CardHeader, Popover, PopoverPosition, SelectOption, Spinner, TextArea, Tooltip, } from '@patternfly/react-core';
14
12
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
15
- import { ToastNotification /* , useFetch */ } from '@rh-support/components';
16
- import { GlobalMetadataStateContext } from '@rh-support/react-context';
17
- import { ability /* , CaseListFields */, resourceActions, resources } from '@rh-support/user-permissions';
13
+ import { EditorMode, ToastNotification, useFetch } from '@rh-support/components';
14
+ import { fetchLoggedInUsersAccount, GlobalMetadataDispatchContext, GlobalMetadataStateContext, } from '@rh-support/react-context';
15
+ import { ability, CaseListFields, resourceActions, resources } from '@rh-support/user-permissions';
18
16
  import debounce from 'lodash/debounce';
19
17
  import isEmpty from 'lodash/isEmpty';
20
18
  import React, { useContext, useEffect, useState } from 'react';
21
19
  import { Trans, useTranslation } from 'react-i18next';
22
20
  import { useUserPreferences } from '../../../hooks/useUserPreferences';
23
21
  import { PreferenceSelect } from '../components/PreferenceSelect';
22
+ import { PreferenceSwitch } from '../components/PreferenceSwitch';
24
23
  export function PreferencesCaseView(props) {
25
24
  const { t } = useTranslation();
26
- const { getCommentSignature, updateCommentSignature, getOriginalCaseView, updateOriginalCaseView } = useUserPreferences();
27
- const {
28
- // globalMetadataState: { loggedInUsersAccount, loggedInUserRights },
29
- globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
30
- // const [isSharingHostNames, setIsSharingHostNames] = useState(false);
25
+ const { updateCommentType, getCommentTypeFromPreference, getCommentSignature, updateCommentSignature, getOriginalCaseView, updateOriginalCaseView, } = useUserPreferences();
26
+ const { globalMetadataState: { loggedInUsersAccount, loggedInUserJwtToken, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
27
+ const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
28
+ const [isSharingHostNames, setIsSharingHostNames] = useState(false);
31
29
  const [localCommentSignature, setLocalCommentSignature] = useState('');
30
+ const [originalCommentType, setOriginalCommentType] = useState('');
32
31
  const [originalCommentSignature, setOriginalCommentSignature] = useState('');
33
32
  const [commentValidated, setCommentValidated] = useState('default');
34
- // const [isHostnamesLoading, setIsHostnamesLoading] = useState(true);
33
+ const [isHostnamesLoading, setIsHostnamesLoading] = useState(true);
35
34
  const [isCommentSignatureLoading, setIsCommentSignatureLoading] = useState(false);
35
+ const commentTypes = [EditorMode.PLAIN, EditorMode.MARKDOWN];
36
+ const defaultCommentTitleID = 'default-comment-preference-select';
36
37
  const defaultCaseViewID = 'default-case-view-select';
37
- // const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
38
+ const canUseHostName = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.HOSTNAME);
38
39
  const isInternalUserPermission = ability.can(resourceActions.READ, resources.ACCOUNTS_FILTER);
39
- // const accountNumber = loggedInUsersAccount.data.accountNumber;
40
- // const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
40
+ const accountNumber = loggedInUsersAccount.data.accountNumber;
41
+ const { request: updateShareHostnames } = useFetch(accounts.updateIsSharingHostname);
41
42
  const originalAccountPermission = loggedInUserRights.data.isInternal();
42
43
  const [originalCaseView, setOriginalCaseView] = useState(+originalAccountPermission);
43
44
  const caseViewTypes = [
@@ -49,6 +50,7 @@ export function PreferencesCaseView(props) {
49
50
  ];
50
51
  useEffect(() => {
51
52
  userOriginalCommentSignature();
53
+ userOriginalCommentType();
52
54
  userOriginalCaseView();
53
55
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
56
  }, []);
@@ -57,19 +59,23 @@ export function PreferencesCaseView(props) {
57
59
  setCommentValidated('default');
58
60
  }
59
61
  }, [localCommentSignature, commentValidated]);
60
- // useEffect(() => {
61
- // async function userOriginalHostnameValue() {
62
- // try {
63
- // loggedInUsersAccount.data?.shareHostnameWithRHT &&
64
- // setIsSharingHostNames(loggedInUsersAccount.data?.shareHostnameWithRHT);
65
- // } catch (error) {
66
- // console.log(error);
67
- // }
68
- // setIsHostnamesLoading(false);
69
- // }
70
- // canUseHostName && userOriginalHostnameValue();
71
- // // eslint-disable-next-line react-hooks/exhaustive-deps
72
- // }, []);
62
+ useEffect(() => {
63
+ function userOriginalHostnameValue() {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ var _a, _b;
66
+ try {
67
+ ((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.shareHostnameWithRHT) &&
68
+ setIsSharingHostNames((_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.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
+ }, []);
73
79
  const userOriginalCaseView = () => __awaiter(this, void 0, void 0, function* () {
74
80
  try {
75
81
  const retrievedCaseView = yield getOriginalCaseView();
@@ -81,6 +87,15 @@ export function PreferencesCaseView(props) {
81
87
  ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
82
88
  }
83
89
  });
90
+ const userOriginalCommentType = () => __awaiter(this, void 0, void 0, function* () {
91
+ try {
92
+ const retrievedComment = yield getCommentTypeFromPreference();
93
+ setOriginalCommentType(retrievedComment);
94
+ }
95
+ catch (_a) {
96
+ ToastNotification.addWarningMessage(t('Failed to fetch original preference'));
97
+ }
98
+ });
84
99
  const userOriginalCommentSignature = () => __awaiter(this, void 0, void 0, function* () {
85
100
  try {
86
101
  const retrievedSignature = yield getCommentSignature();
@@ -122,19 +137,48 @@ export function PreferencesCaseView(props) {
122
137
  console.log(error);
123
138
  }
124
139
  });
125
- // const onShareHostNamesSwitch = async () => {
126
- // try {
127
- // setIsHostnamesLoading(true);
128
- // await updateShareHostnames!(!isSharingHostNames, accountNumber!);
129
- // // TODO: migrate to GraphQL - fetchLoggedInUsersAccount(dispatchToGlobalMetadataReducer, loggedInUserJwtToken, true, apolloClient);
130
- // setIsSharingHostNames(!isSharingHostNames);
131
- // } catch (error) {
132
- // console.log(error);
133
- // }
134
- // setIsHostnamesLoading(false);
135
- // };
136
- // const prefHostnameCopy =
137
- // '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.';
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* () {
160
+ try {
161
+ const selectedComment = setOptionCase(selection, true);
162
+ yield updateCommentType(selectedComment);
163
+ setOriginalCommentType(selectedComment);
164
+ }
165
+ catch (error) {
166
+ console.log(error);
167
+ }
168
+ });
169
+ const onShareHostNamesSwitch = () => __awaiter(this, void 0, void 0, function* () {
170
+ try {
171
+ setIsHostnamesLoading(true);
172
+ yield updateShareHostnames(!isSharingHostNames, accountNumber);
173
+ fetchLoggedInUsersAccount(dispatchToGlobalMetadataReducer, loggedInUserJwtToken, true);
174
+ setIsSharingHostNames(!isSharingHostNames);
175
+ }
176
+ catch (error) {
177
+ console.log(error);
178
+ }
179
+ setIsHostnamesLoading(false);
180
+ });
181
+ 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.';
138
182
  const caseViewPrefSelection = () => {
139
183
  if (!!originalCaseView) {
140
184
  return caseViewTypes[+originalAccountPermission].value;
@@ -156,11 +200,22 @@ export function PreferencesCaseView(props) {
156
200
  React.createElement("form", null,
157
201
  isInternalUserPermission && (React.createElement("div", { className: "form-group" },
158
202
  React.createElement(PreferenceSelect, { onSelect: (event, selection) => onPrefCaseViewSelect(event, selection), 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 })))))))),
203
+ React.createElement("div", { className: "form-group" },
204
+ 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) }))))),
159
205
  React.createElement("div", { className: "form-group" },
160
206
  React.createElement("label", { htmlFor: "comment-signature-textarea" },
161
207
  React.createElement(Trans, null, "Comment signature")),
162
208
  React.createElement(TextArea, { value: localCommentSignature, onChange: (_event, value) => handleCommentSignatureChange(value), "aria-label": "comment-signature-textarea", placeholder: originalCommentSignature || 'Add a comment signature', id: "comment-signature-textarea",
163
209
  // @ts-ignore
164
210
  validated: commentValidated, resizeOrientation: "vertical" }),
165
- isCommentSignatureLoading && React.createElement(Spinner, { size: "md" }))))));
211
+ isCommentSignatureLoading && React.createElement(Spinner, { size: "md" })),
212
+ canUseHostName && (React.createElement("div", { className: "form-group" },
213
+ React.createElement("label", null,
214
+ React.createElement(Trans, null, "Case information")),
215
+ React.createElement("div", { className: "preference-page-switch-container" },
216
+ React.createElement(PreferenceSwitch, { id: "share-hostnames-switch", label: 'Share hostnames', isChecked: isSharingHostNames, onSwitchChange: onShareHostNamesSwitch }),
217
+ React.createElement("div", { className: "prefhostnameTooltip" },
218
+ React.createElement(Tooltip, { content: prefHostnameCopy, position: "right" },
219
+ React.createElement(InfoCircleIcon, { className: "pf-v6-u-ml-sm cursor-pointer", color: "#5e40be" })),
220
+ isHostnamesLoading && (React.createElement(Spinner, { size: "lg", className: "pf-v6-u-ml-sm hostnameSpinner", "aria-label": "Hostname loading" }))))))))));
166
221
  }
@@ -2,7 +2,6 @@ export declare enum GroupSelectActions {
2
2
  create = "Create",
3
3
  delete = "Delete",
4
4
  duplicate = "Duplicate",
5
- rename = "Rename",
6
- addMembers = "Add members"
5
+ rename = "Rename"
7
6
  }
8
7
  //# sourceMappingURL=GroupSelectActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupSelectActions.d.ts","sourceRoot":"","sources":["../../../src/constants/GroupSelectActions.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC1B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,UAAU,gBAAgB;CAC7B"}
1
+ {"version":3,"file":"GroupSelectActions.d.ts","sourceRoot":"","sources":["../../../src/constants/GroupSelectActions.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC1B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,MAAM,WAAW;CACpB"}
@@ -4,5 +4,4 @@ export var GroupSelectActions;
4
4
  GroupSelectActions["delete"] = "Delete";
5
5
  GroupSelectActions["duplicate"] = "Duplicate";
6
6
  GroupSelectActions["rename"] = "Rename";
7
- GroupSelectActions["addMembers"] = "Add members";
8
7
  })(GroupSelectActions || (GroupSelectActions = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"useVersionsDiffer.d.ts","sourceRoot":"","sources":["../../../src/hooks/useVersionsDiffer.tsx"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,qBAAqB,MAAM,EAAE,sBAAsB,MAAM,KAAG,CAAC,OAAO,EAAE,MAAM,EAAE,CAwD/G,CAAC"}
1
+ {"version":3,"file":"useVersionsDiffer.d.ts","sourceRoot":"","sources":["../../../src/hooks/useVersionsDiffer.tsx"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,qBAAqB,MAAM,EAAE,sBAAsB,MAAM,KAAG,CAAC,OAAO,EAAE,MAAM,EAAE,CAuD/G,CAAC"}
package/lib/esm/index.js CHANGED
@@ -2,4 +2,3 @@
2
2
  export { Manage } from './Manage';
3
3
  export { TopContentManagement } from './components/TopContentManagement';
4
4
  export { ExpiredContentManagement } from './components/ManageExpiredContents';
5
- // dummy change for publish
@@ -179,7 +179,6 @@
179
179
  border-radius: 8px;
180
180
  border-top-right-radius: 0px;
181
181
  border-top-left-radius: 0px;
182
- overflow: hidden;
183
182
 
184
183
  .pf-v6-c-table__th {
185
184
  font-size: 14px;
@@ -195,10 +194,6 @@
195
194
  tbody:first-of-type {
196
195
  border-top: none;
197
196
  }
198
-
199
- tbody:last-of-type tr:last-child {
200
- border-bottom: none;
201
- }
202
197
  .bookmark-alert {
203
198
  margin-left: 1rem;
204
199
  margin-right: 1rem;
@@ -433,78 +428,6 @@ svg.hostnameSpinner {
433
428
  border-radius: 8px;
434
429
  }
435
430
 
436
- #manage-case-labels {
437
- thead {
438
- display: none;
439
- }
440
-
441
- .case-labels-toolbar {
442
- flex-direction: row;
443
- align-items: center;
444
- justify-content: space-between;
445
- gap: var(--pf-t--global--spacer--md);
446
-
447
- .toolbar-left {
448
- flex: 0 1 auto;
449
- margin-bottom: 0;
450
- max-width: none;
451
-
452
- & > *:nth-child(2):not(.group-action) {
453
- width: auto;
454
- min-width: 16rem;
455
- }
456
- }
457
-
458
- .toolbar-right,
459
- .case-labels-toolbar__loaded {
460
- flex: 0 0 auto;
461
- max-width: none;
462
- margin-left: auto;
463
- white-space: nowrap;
464
- justify-content: flex-end;
465
- }
466
- }
467
-
468
- .case-label-row {
469
- display: flex;
470
- align-items: center;
471
- justify-content: space-between;
472
- width: 100%;
473
- gap: var(--pf-t--global--spacer--md);
474
- }
475
-
476
- .case-label-row__actions {
477
- display: flex;
478
- align-items: center;
479
- flex-shrink: 0;
480
- gap: var(--pf-t--global--spacer--sm);
481
- margin-left: auto;
482
- }
483
-
484
- .case-labels-empty-state {
485
- display: flex;
486
- align-items: center;
487
- justify-content: center;
488
- min-height: 20rem;
489
- padding: var(--pf-t--global--spacer--2xl) var(--pf-t--global--spacer--lg);
490
- background-color: var(--pf-t--global--background--color--primary--default);
491
- }
492
- }
493
-
494
- .case-label-delete-description {
495
- display: flex;
496
- flex-direction: column;
497
- gap: var(--pf-t--global--spacer--lg);
498
-
499
- p {
500
- margin: 0;
501
- }
502
-
503
- .case-label-delete-description__impact {
504
- white-space: nowrap;
505
- }
506
- }
507
-
508
431
  .pf-v6-c-empty-state__icon {
509
432
  color: var(--pf-t--color--gray--30);
510
433
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/manage",
3
- "version": "2.5.263",
3
+ "version": "2.5.271",
4
4
  "description": "Customer Support Manage App",
5
5
  "author": "Jordan Eudy <jeudy100@gmail.com>",
6
6
  "license": "ISC",
@@ -41,8 +41,7 @@
41
41
  "prepublishOnly": "npm run build"
42
42
  },
43
43
  "peerDependencies": {
44
- "@apollo/client": "^4.1.6",
45
- "@cee-eng/hydrajs": "^4.18.114",
44
+ "@cee-eng/hydrajs": "4.18.111",
46
45
  "@patternfly/patternfly": "6.2.1",
47
46
  "@patternfly/react-core": "6.2.1",
48
47
  "@patternfly/react-table": "6.2.1",
@@ -54,8 +53,6 @@
54
53
  "react-router-dom": "^5.1.2"
55
54
  },
56
55
  "devDependencies": {
57
- "@patternfly/react-styles": "^6.2.1",
58
- "@patternfly/react-tokens": "^6.2.1",
59
56
  "@testing-library/jest-dom": "^6.2.0",
60
57
  "@testing-library/react": "^14.1.2",
61
58
  "@testing-library/user-event": "^14.5.1",
@@ -74,16 +71,16 @@
74
71
  "typescript": "^5.3.3"
75
72
  },
76
73
  "dependencies": {
77
- "@cee-eng/hydrajs": "^4.18.114",
74
+ "@cee-eng/hydrajs": "4.18.111",
78
75
  "@patternfly/patternfly": "6.2.1",
79
76
  "@patternfly/react-core": "6.2.1",
80
77
  "@patternfly/react-table": "6.2.1",
81
- "@rh-support/components": "2.5.214",
78
+ "@rh-support/components": "2.5.222",
82
79
  "@rh-support/configs": "2.0.75",
83
- "@rh-support/react-context": "2.5.309",
80
+ "@rh-support/react-context": "2.5.318",
84
81
  "@rh-support/types": "2.0.26",
85
- "@rh-support/user-permissions": "2.5.161",
86
- "@rh-support/utils": "2.5.142",
82
+ "@rh-support/user-permissions": "2.5.170",
83
+ "@rh-support/utils": "2.5.149",
87
84
  "@types/react-beautiful-dnd": "^13.0.0",
88
85
  "i18next": "^23.15.0",
89
86
  "lodash": ">=4.17.15",
@@ -102,5 +99,5 @@
102
99
  "defaults and supports es6-module",
103
100
  "maintained node versions"
104
101
  ],
105
- "gitHead": "db4ef21c103bd27b78fdbcbe38b84750e7886df4"
102
+ "gitHead": "cc1c26280084d477ee0abcec8d46963c8213b783"
106
103
  }
@@ -1,12 +0,0 @@
1
- import { ICaseGroup } from '@cee-eng/hydrajs/@types/api/public/caseGroups';
2
- import React from 'react';
3
- import type { IGroupUserWithContactId } from '../../../utils/caseGroupMapper';
4
- interface IProps {
5
- readonly group: ICaseGroup;
6
- readonly existingMembers: IGroupUserWithContactId[];
7
- readonly onSuccess: () => void;
8
- readonly onClose: () => void;
9
- }
10
- export declare function AddMembersModal({ group, existingMembers, onSuccess, onClose }: IProps): React.JSX.Element;
11
- export {};
12
- //# sourceMappingURL=AddMembersModal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddMembersModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/AddMembersModal/AddMembersModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAM3E,OAAO,KAAgC,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,UAAU,MAAM;IACZ,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,uBAAuB,EAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,MAAM,qBAuGrF"}
@@ -1,80 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant } from '@patternfly/react-core';
11
- import { CaseContactsSelectorExternal, ToastNotification } from '@rh-support/components';
12
- import { useGlobalStateContext } from '@rh-support/react-context';
13
- import React, { useCallback, useState } from 'react';
14
- import { useTranslation } from 'react-i18next';
15
- import { useCreateCaseGroupMember } from '../../../hooks/useCaseGroupGraphQL';
16
- export function AddMembersModal({ group, existingMembers, onSuccess, onClose }) {
17
- var _a, _b;
18
- const { t } = useTranslation();
19
- const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount }, } = useGlobalStateContext();
20
- const { createMember, loading: createLoading } = useCreateCaseGroupMember();
21
- const [selectedContacts, setSelectedContacts] = useState([]);
22
- const [isSubmitting, setIsSubmitting] = useState(false);
23
- const accountNumber = (_b = (_a = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.accountNumber) !== null && _b !== void 0 ? _b : '';
24
- const contactSsoUsername = '';
25
- const contactsToExclude = existingMembers.map((m) => ({
26
- ssoUsername: m.ssoUsername,
27
- firstName: m.firstName,
28
- lastName: m.lastName,
29
- }));
30
- const onChange = useCallback((contacts) => {
31
- if (!(contacts === null || contacts === void 0 ? void 0 : contacts.length))
32
- return;
33
- const contact = contacts[0];
34
- if (!('ssoUsername' in contact))
35
- return;
36
- setSelectedContacts((prev) => {
37
- const exists = prev.some((c) => c.ssoUsername === contact.ssoUsername);
38
- return exists ? prev.filter((c) => c.ssoUsername !== contact.ssoUsername) : [...prev, contact];
39
- });
40
- }, []);
41
- const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
42
- const validContacts = selectedContacts.filter((contact) => contact.id);
43
- if (validContacts.length === 0)
44
- return;
45
- setIsSubmitting(true);
46
- try {
47
- const results = yield Promise.allSettled(validContacts.map((contact) => createMember(contact.id, group.groupNum)));
48
- const succeeded = results.filter((r) => r.status === 'fulfilled');
49
- const failed = results.filter((r) => r.status === 'rejected');
50
- if (succeeded.length > 0) {
51
- ToastNotification.addSuccessMessage(t('{{count}} people have been successfully added.', { count: succeeded.length }));
52
- onSuccess();
53
- }
54
- if (failed.length > 0) {
55
- const firstError = failed[0].reason;
56
- const message = String((firstError === null || firstError === void 0 ? void 0 : firstError.message) || '');
57
- if (message.includes('Organization Administrator')) {
58
- ToastNotification.addDangerMessage(t('Organization Administrators cannot be added as case group members'));
59
- }
60
- else if (message.includes('insufficient access rights')) {
61
- ToastNotification.addDangerMessage(t('You do not have permission to add members to this group'));
62
- }
63
- else {
64
- ToastNotification.addDangerMessage(t('There was an error adding members to this group'));
65
- }
66
- }
67
- onClose();
68
- }
69
- finally {
70
- setIsSubmitting(false);
71
- }
72
- });
73
- return (React.createElement(Modal, { variant: ModalVariant.medium, isOpen: true, onClose: onClose, "aria-label": t('Add members to group') },
74
- React.createElement(ModalHeader, { title: t('Add members to {{groupName}}', { groupName: group.name }) }),
75
- React.createElement(ModalBody, null,
76
- React.createElement(CaseContactsSelectorExternal, { id: "add-members-contact-select", selectedAccountNumber: accountNumber, loggedInUserRights: loggedInUserRights.data, contactSsoUsername: contactSsoUsername, contactsToExclude: [...contactsToExclude, ...selectedContacts], contactFilter: (contact) => !contact.isOrgAdmin, selected: selectedContacts, onChange: onChange, onContactEnriched: () => { }, multiple: true, clearButton: true, isDisabled: isSubmitting, placeholder: t('Search by name or SSO username') })),
77
- React.createElement(ModalFooter, null,
78
- React.createElement(Button, { key: "confirm", variant: "primary", onClick: onSubmit, isDisabled: selectedContacts.length === 0 || isSubmitting || createLoading, isLoading: isSubmitting, spinnerAriaValueText: isSubmitting ? t('Adding members') : undefined }, t('Add')),
79
- React.createElement(Button, { key: "cancel", variant: "link", onClick: onClose, isDisabled: isSubmitting }, t('Cancel')))));
80
- }
@@ -1,2 +0,0 @@
1
- export * from './AddMembersModal';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Groups/AddMembersModal/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- export * from './AddMembersModal';
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { ICaseLabel } from './types';
3
- export type SaveCaseLabelResult = {
4
- success: boolean;
5
- fieldError?: string;
6
- };
7
- interface IProps {
8
- isOpen: boolean;
9
- addMode: boolean;
10
- label?: ICaseLabel | null;
11
- isSaving?: boolean;
12
- onClose: () => void;
13
- onSave: (name: string, options?: {
14
- keepOpen?: boolean;
15
- }) => Promise<SaveCaseLabelResult> | SaveCaseLabelResult;
16
- }
17
- export declare function AddEditCaseLabelModal({ isOpen, addMode, label, isSaving, onClose, onSave }: IProps): React.JSX.Element;
18
- export {};
19
- //# sourceMappingURL=AddEditCaseLabelModal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddEditCaseLabelModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCaseLabels/AddEditCaseLabelModal.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,UAAU,MAAM;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;CAClH;AAED,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,qBA0H1G"}
@@ -1,83 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Button, ButtonVariant, FormGroup, FormHelperText, HelperText, HelperTextItem, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, TextInput, } from '@patternfly/react-core';
11
- import isEmpty from 'lodash/isEmpty';
12
- import React, { useEffect, useState } from 'react';
13
- import { Trans, useTranslation } from 'react-i18next';
14
- export function AddEditCaseLabelModal({ isOpen, addMode, label, isSaving = false, onClose, onSave }) {
15
- const { t } = useTranslation();
16
- const [name, setName] = useState('');
17
- const [error, setError] = useState('');
18
- useEffect(() => {
19
- if (isOpen) {
20
- setName(addMode ? '' : (label === null || label === void 0 ? void 0 : label.name) || '');
21
- setError('');
22
- }
23
- }, [isOpen, addMode, label]);
24
- const validate = (value) => {
25
- if (isEmpty(value.trim())) {
26
- return t('Case label name cannot be empty.');
27
- }
28
- return '';
29
- };
30
- const resetForm = () => {
31
- setName('');
32
- setError('');
33
- };
34
- const handleSave = () => __awaiter(this, void 0, void 0, function* () {
35
- const validationError = validate(name);
36
- if (!isEmpty(validationError)) {
37
- setError(validationError);
38
- return;
39
- }
40
- const result = yield onSave(name.trim(), { keepOpen: false });
41
- if (!result.success && result.fieldError) {
42
- setError(result.fieldError);
43
- }
44
- });
45
- const handleSaveAndNew = () => __awaiter(this, void 0, void 0, function* () {
46
- const validationError = validate(name);
47
- if (!isEmpty(validationError)) {
48
- setError(validationError);
49
- return;
50
- }
51
- const result = yield onSave(name.trim(), { keepOpen: true });
52
- if (result.success) {
53
- resetForm();
54
- return;
55
- }
56
- if (result.fieldError) {
57
- setError(result.fieldError);
58
- }
59
- });
60
- const handleClose = () => {
61
- resetForm();
62
- onClose();
63
- };
64
- return (React.createElement(Modal, { id: "add-edit-case-label-modal", "aria-describedby": "add-edit-case-label-modal", isOpen: isOpen, onClose: handleClose, variant: ModalVariant.small },
65
- React.createElement(ModalHeader, null,
66
- React.createElement("h2", null, addMode ? t('Create new case label') : t('Rename case label'))),
67
- React.createElement(ModalBody, null,
68
- React.createElement(FormGroup, { label: t('Case label name'), isRequired: true },
69
- React.createElement(TextInput, { isRequired: true, type: "text", id: "case-label-name-input", value: name, onChange: (_, value) => {
70
- setName(value);
71
- setError('');
72
- }, placeholder: t('Enter a unique case label name'), validated: isEmpty(error) ? 'default' : 'error', isDisabled: isSaving }),
73
- !isEmpty(error) && (React.createElement(FormHelperText, null,
74
- React.createElement(HelperText, null,
75
- React.createElement(HelperTextItem, { variant: "error" }, error)))))),
76
- React.createElement(ModalFooter, null,
77
- React.createElement(Button, { key: "save", variant: ButtonVariant.primary, onClick: handleSave, isDisabled: isEmpty(name.trim()) || !isEmpty(error) || isSaving, isLoading: isSaving },
78
- React.createElement(Trans, null, "Save")),
79
- addMode && (React.createElement(Button, { key: "save-and-new", variant: ButtonVariant.secondary, onClick: handleSaveAndNew, isDisabled: isEmpty(name.trim()) || !isEmpty(error) || isSaving, isLoading: isSaving },
80
- React.createElement(Trans, null, "Save & New"))),
81
- React.createElement(Button, { key: "cancel", variant: ButtonVariant.link, onClick: handleClose, isDisabled: isSaving },
82
- React.createElement(Trans, null, "Cancel")))));
83
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare function ManageCaseLabelsTab(): React.JSX.Element;
3
- //# sourceMappingURL=ManageCaseLabelsTab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ManageCaseLabelsTab.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCaseLabels/ManageCaseLabelsTab.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAoC5D,wBAAgB,mBAAmB,sBAsTlC"}