@rh-support/cases 2.6.196 → 2.6.198

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":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAuClC,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAqC1C,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAMD,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBA8jBrC"}
1
+ {"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAuClC,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAqC1C,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAMD,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBAgkBrC"}
@@ -38,14 +38,14 @@ import { isNoFilterApplied, isOnlyDefaultFilterApplied } from './CaseListFilterH
38
38
  import { updateFilterState } from './CaseListFilterReducer';
39
39
  import { appendCaseList, setCaseList, setCurrentQuery, setCursorInfo, setIsFetching, setIsLoadingMore, setLoadMoreError, } from './CaseListReducer';
40
40
  export function CaseList(props) {
41
- var _a, _b;
41
+ var _a, _b, _c;
42
42
  const { t } = useTranslation();
43
43
  useDocumentTitle(PageTitle.CASE_LIST);
44
44
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
45
45
  const { caseList, isFetching, isLoadingMore, hasNextPage, endCursor, currentQuery, loadMoreError, loadMoreRetryCount, } = useCaseListStateContext();
46
46
  const CaseListDispatch = useCaseListDispatchContext();
47
47
  const breakPoint = useBreakpoint();
48
- const { globalMetadataState, globalMetadataState: { caseGroups, loggedInUserJwtToken, loggedInUserRights, loggedInUsersAccount, userPreferences, managedAccounts, bookmarkedAccounts, allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts, caseRecordTypes, caseListTraditionalSupportAgreed, }, } = useContext(GlobalMetadataStateContext);
48
+ const { globalMetadataState, globalMetadataState: { caseGroups, loggedInUserRights, loggedInUsersAccount, userPreferences, managedAccounts, bookmarkedAccounts, allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts, caseRecordTypes, caseListTraditionalSupportAgreed, }, } = useContext(GlobalMetadataStateContext);
49
49
  const globalDispatchContext = useGlobalDispatchContext();
50
50
  const apolloClient = useApolloClient();
51
51
  const location = useLocation();
@@ -238,17 +238,20 @@ export function CaseList(props) {
238
238
  console.log(err);
239
239
  }
240
240
  });
241
+ const salesforceAccountId = (_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.salesforceAccountId;
241
242
  useEffect(() => {
242
243
  var _a;
244
+ if (!salesforceAccountId)
245
+ return;
243
246
  if (haventLoadedMetadata(caseGroups, (data) => data === undefined)) {
244
247
  if ((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.isInternal) {
245
- fetchCaseGroupsForAccount(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.accountNumber);
248
+ fetchCaseGroupsForAccount(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId);
246
249
  }
247
250
  else {
248
- fetchCaseGroupsForSSO(dispatchToGlobalMetadataReducer, loggedInUserJwtToken.preferred_username);
251
+ fetchCaseGroupsForSSO(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId);
249
252
  }
250
253
  }
251
- }, [caseGroups, dispatchToGlobalMetadataReducer, loggedInUserJwtToken, loggedInUsersAccount.data]);
254
+ }, [caseGroups, dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId, loggedInUsersAccount.data]);
252
255
  useEffect(() => {
253
256
  const loadMetadata = () => __awaiter(this, void 0, void 0, function* () {
254
257
  if (haventLoadedMetadata(caseRecordTypes)) {
@@ -427,8 +430,8 @@ export function CaseList(props) {
427
430
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
428
431
  React.createElement(CaseListFilterChips, null))),
429
432
  React.createElement("section", { className: "case-search-bottom" },
430
- React.createElement("aside", { className: `case-search-filters ${((_a = filterSectionRef.current) === null || _a === void 0 ? void 0 : _a.expanded) ? '' : 'collapsed'}` },
431
- React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_b = filterSectionRef.current) === null || _b === void 0 ? void 0 : _b.expanded) ? (React.createElement(React.Fragment, null,
433
+ React.createElement("aside", { className: `case-search-filters ${((_b = filterSectionRef.current) === null || _b === void 0 ? void 0 : _b.expanded) ? '' : 'collapsed'}` },
434
+ React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_c = filterSectionRef.current) === null || _c === void 0 ? void 0 : _c.expanded) ? (React.createElement(React.Fragment, null,
432
435
  React.createElement(Button, { isInline: true, className: "pf-v6-u-flex-shrink-0 pf-v6-u-flex-none case-search-filter-text-button", variant: "link", title: t('Collapse filter section'), "data-tracking-id": "collapse-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, { className: "mirrored" }) },
433
436
  React.createElement(Trans, null, "Filters")))) : (React.createElement(Button, { isInline: true, className: "pf-v6-c-button pf-m-link pf-m-inline pf-v6-u-flex-shrink-0 pf-v6-u-flex-none pf-v6-u-display-flex pf-v6-u-align-items-center pf-v6-u-justify-content-center pf-v6-u-px-lg", variant: "link", title: t('Expand filter section'), "data-tracking-id": "expand-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, null) }, isXLScreen ? null : React.createElement(Trans, null, "Filters")))),
434
437
  React.createElement("div", { className: "filter-wrapper" },
@@ -1 +1 @@
1
- {"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAYhF,eAAO,MAAM,WAAW,GAAI,YAAO,WAIlC,CAAC;AAYF,eAAO,MAAM,eAAe,GAAI,gBAAW,EAAE,QAAG;;;;;;;GAAyD,CAAC;AAE1G,eAAO,MAAM,kBAAkB,GAAI,iBAAY,EAAE,eAAU,EAAE,QAAG,EAAE,MAAC,UAyClE,CAAC;AAEF,wBAAgB,oBAAoB,sBA8PnC"}
1
+ {"version":3,"file":"CreatorSsoNameFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-filters/CreatorSsoNameFilter.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAYhF,eAAO,MAAM,WAAW,GAAI,YAAO,WAIlC,CAAC;AAYF,eAAO,MAAM,eAAe,GAAI,gBAAW,EAAE,QAAG;;;;;;;GAAyD,CAAC;AAE1G,eAAO,MAAM,kBAAkB,GAAI,iBAAY,EAAE,eAAU,EAAE,QAAG,EAAE,MAAC,UAyClE,CAAC;AAEF,wBAAgB,oBAAoB,sBAiQnC"}
@@ -7,12 +7,12 @@ 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';
10
+ import { useApolloClient } from '@apollo/client/react';
11
11
  import { Button, MenuToggle, Select, SelectGroup, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Truncate, } from '@patternfly/react-core';
12
12
  import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
13
- import { LoadingIndicator, useFetch, useSelectKeyboardNavigator } from '@rh-support/components';
13
+ import { LoadingIndicator, useSelectKeyboardNavigator } from '@rh-support/components';
14
14
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
15
- import { getDropdownBtnPlaceholder } from '@rh-support/utils';
15
+ import { fetchLoggedInUserAccountContactsFromGraphQL, getDropdownBtnPlaceholder } from '@rh-support/utils';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import isNull from 'lodash/isNull';
18
18
  import isUndefined from 'lodash/isUndefined';
@@ -84,13 +84,14 @@ export const getSelectedListObj = (contactsList, filterInfo, own, t) => {
84
84
  };
85
85
  export function CreatorSsoNameFilter() {
86
86
  const { t } = useTranslation();
87
+ const apolloClient = useApolloClient();
87
88
  const { filterInfo } = useContext(CaseListFilterStateContext);
88
89
  const dispatch = useContext(CaseListFilterDispatchContext);
89
90
  const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
90
91
  const CaseListDispatch = useCaseListDispatchContext();
91
92
  const own = loggedInUserRights.data.getSSOUsername();
92
93
  const isExternalNonOrgAdmin = !loggedInUserRights.data.isInternal() && loggedInUserRights.data.isCustomerNonOrgAdmin();
93
- const { request: getExternalUserContactsList, isFetching: isFetchingExternalContacts } = useFetch(accounts.getAccountContacts, { propgateErrors: true });
94
+ const [isFetchingExternalContacts, setIsFetchingExternalContacts] = useState(false);
94
95
  const externalInputRef = useRef();
95
96
  const [externalContactList, setExternalContactList] = useState([]);
96
97
  const [isExternalOpen, setIsExternalOpen] = useState(false);
@@ -163,19 +164,25 @@ export function CreatorSsoNameFilter() {
163
164
  if (loggedInUserRights.data.isInternal())
164
165
  return;
165
166
  const fetchStrataAccountUsers = () => __awaiter(this, void 0, void 0, function* () {
166
- const externalContacts = isExternalNonOrgAdmin
167
- ? []
168
- : yield getExternalUserContactsList(loggedInUserRights.data.getAccountNumber());
169
- const chipsNameSsoPairs = externalContacts.reduce((result, item) => {
170
- result[item.ssoUsername] = { firstName: item.firstName || '', lastName: item.lastName || '' };
171
- return result;
172
- }, {});
173
- setChipsNameSsoMap(CaseListDispatch, chipsNameSsoPairs);
174
- setExternalContactList(externalContacts);
167
+ setIsFetchingExternalContacts(true);
168
+ try {
169
+ const externalContacts = isExternalNonOrgAdmin
170
+ ? []
171
+ : yield fetchLoggedInUserAccountContactsFromGraphQL(apolloClient);
172
+ const chipsNameSsoPairs = externalContacts.reduce((result, item) => {
173
+ result[item.ssoUsername] = { firstName: item.firstName || '', lastName: item.lastName || '' };
174
+ return result;
175
+ }, {});
176
+ setChipsNameSsoMap(CaseListDispatch, chipsNameSsoPairs);
177
+ setExternalContactList(externalContacts);
178
+ }
179
+ finally {
180
+ setIsFetchingExternalContacts(false);
181
+ }
175
182
  });
176
183
  fetchStrataAccountUsers();
177
184
  // eslint-disable-next-line react-hooks/exhaustive-deps
178
- }, [dispatch, isExternalNonOrgAdmin, loggedInUserRights.data]);
185
+ }, [dispatch, isExternalNonOrgAdmin, loggedInUserRights.data, apolloClient]);
179
186
  const filteredExternalList = useMemo(() => {
180
187
  return [
181
188
  ...(noResults && !isExternalNonOrgAdmin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/cases",
3
- "version": "2.6.196",
3
+ "version": "2.6.198",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -38,11 +38,11 @@
38
38
  "@patternfly/patternfly": "6.2.1",
39
39
  "@patternfly/react-core": "6.2.1",
40
40
  "@patternfly/react-table": "6.2.1",
41
- "@rh-support/components": "2.5.192",
42
- "@rh-support/react-context": "2.5.286",
41
+ "@rh-support/components": "2.5.194",
42
+ "@rh-support/react-context": "2.5.288",
43
43
  "@rh-support/types": "2.0.26",
44
- "@rh-support/user-permissions": "2.5.138",
45
- "@rh-support/utils": "2.5.120",
44
+ "@rh-support/user-permissions": "2.5.140",
45
+ "@rh-support/utils": "2.5.122",
46
46
  "localforage": "^1.10.0",
47
47
  "lodash": "^4.17.21",
48
48
  "pegjs": "^0.10.0",
@@ -92,5 +92,5 @@
92
92
  "defaults and supports es6-module",
93
93
  "maintained node versions"
94
94
  ],
95
- "gitHead": "84a00c5092469be74f67cb35e582d3120d0949b6"
95
+ "gitHead": "6166d112918583d5b9030b1e8cb1e7d2a27bcaa4"
96
96
  }