@rh-support/cases 2.7.27 → 2.7.29

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.
@@ -41,7 +41,7 @@ import { isNoFilterApplied, isOnlyDefaultFilterApplied, isOnlyGroupFilterApplied
41
41
  import { updateFilterState } from './CaseListFilterReducer';
42
42
  import { appendCaseList, setCaseList, setCurrentQuery, setCursorInfo, setIsFetching, setIsLoadingMore, setLoadMoreError, } from './CaseListReducer';
43
43
  export function CaseList(props) {
44
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
45
45
  const { t } = useTranslation();
46
46
  useDocumentTitle(PageTitle.CASE_LIST);
47
47
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
@@ -56,9 +56,9 @@ export function CaseList(props) {
56
56
  const includeSecureSupportCases = Boolean(loggedInUsersAccount.data.secureSupport);
57
57
  const salesforceAccountId = (_c = loggedInUsersAccount.data) === null || _c === void 0 ? void 0 : _c.salesforceAccountId;
58
58
  const caseListAccountScope = {
59
- isInternal: Boolean((_d = loggedInUsersAccount.data) === null || _d === void 0 ? void 0 : _d.isInternal),
59
+ isInternal: Boolean((_f = (_e = (_d = loggedInUserRights.data) === null || _d === void 0 ? void 0 : _d.isInternal) === null || _e === void 0 ? void 0 : _e.call(_d)) !== null && _f !== void 0 ? _f : (_g = loggedInUser.data) === null || _g === void 0 ? void 0 : _g.isInternal),
60
60
  salesforceAccountId,
61
- accountNumber: (_e = loggedInUsersAccount.data) === null || _e === void 0 ? void 0 : _e.accountNumber,
61
+ accountNumber: (_h = loggedInUsersAccount.data) === null || _h === void 0 ? void 0 : _h.accountNumber,
62
62
  };
63
63
  const location = useLocation();
64
64
  const searchParams = getUrlParsedParams(location.search);
@@ -326,9 +326,9 @@ export function CaseList(props) {
326
326
  refetchCaseLabels();
327
327
  getCases(filterState);
328
328
  };
329
- const loggedInContactId = (_f = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _f === void 0 ? void 0 : _f.id;
330
- const loggedInIsOrgAdmin = (_g = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _g === void 0 ? void 0 : _g.isOrgAdmin;
331
- const defaultCaseGroupId = (_j = (_h = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _h === void 0 ? void 0 : _h.defaultCaseGroup) !== null && _j !== void 0 ? _j : null;
329
+ const loggedInContactId = (_j = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _j === void 0 ? void 0 : _j.id;
330
+ const loggedInIsOrgAdmin = (_k = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _k === void 0 ? void 0 : _k.isOrgAdmin;
331
+ const defaultCaseGroupId = (_m = (_l = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _l === void 0 ? void 0 : _l.defaultCaseGroup) !== null && _m !== void 0 ? _m : null;
332
332
  const prevDefaultCaseGroupIdRef = useRef(defaultCaseGroupId);
333
333
  useEffect(() => {
334
334
  var _a;
@@ -364,7 +364,7 @@ export function CaseList(props) {
364
364
  loggedInContactId,
365
365
  loggedInIsOrgAdmin,
366
366
  loggedInUser.isFetching,
367
- (_k = loggedInUsersAccount.data) === null || _k === void 0 ? void 0 : _k.isInternal,
367
+ (_o = loggedInUsersAccount.data) === null || _o === void 0 ? void 0 : _o.isInternal,
368
368
  salesforceAccountId,
369
369
  ]);
370
370
  useEffect(() => {
@@ -408,8 +408,8 @@ export function CaseList(props) {
408
408
  }, [
409
409
  caseGroupEnabled,
410
410
  loggedInUsersAccount.isFetching,
411
- (_l = loggedInUsersAccount.data) === null || _l === void 0 ? void 0 : _l.isInternal,
412
- (_m = filterState.filterInfo) === null || _m === void 0 ? void 0 : _m[SolrKeys.group],
411
+ (_p = loggedInUsersAccount.data) === null || _p === void 0 ? void 0 : _p.isInternal,
412
+ (_q = filterState.filterInfo) === null || _q === void 0 ? void 0 : _q[SolrKeys.group],
413
413
  ]);
414
414
  useEffect(() => {
415
415
  const loadMetadata = () => __awaiter(this, void 0, void 0, function* () {
@@ -600,8 +600,8 @@ export function CaseList(props) {
600
600
  React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
601
601
  React.createElement(CaseListFilterChips, null))),
602
602
  React.createElement("section", { className: "case-search-bottom" },
603
- React.createElement("aside", { className: `case-search-filters ${((_o = filterSectionRef.current) === null || _o === void 0 ? void 0 : _o.expanded) ? '' : 'collapsed'}` },
604
- React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_p = filterSectionRef.current) === null || _p === void 0 ? void 0 : _p.expanded) ? (React.createElement(React.Fragment, null,
603
+ React.createElement("aside", { className: `case-search-filters ${((_r = filterSectionRef.current) === null || _r === void 0 ? void 0 : _r.expanded) ? '' : 'collapsed'}` },
604
+ React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_s = filterSectionRef.current) === null || _s === void 0 ? void 0 : _s.expanded) ? (React.createElement(React.Fragment, null,
605
605
  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" }) },
606
606
  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")))),
607
607
  React.createElement("div", { className: "filter-wrapper" },
@@ -32,7 +32,7 @@ export default function DownloadCSVFileModal(props) {
32
32
  const { onClose, onModalshow, isDisabled, filterState, selectedCases, filteredCaseCount } = props;
33
33
  const { t } = useTranslation();
34
34
  const apolloClient = useApolloClient();
35
- const { globalMetadataState: { loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
35
+ const { globalMetadataState: { loggedInUsersAccount, loggedInUserRights, loggedInUser }, } = useContext(GlobalMetadataStateContext);
36
36
  const includeSecureSupportCases = Boolean(loggedInUsersAccount.data.secureSupport);
37
37
  const [isFetching, setIsFetching] = useState(false);
38
38
  const [downloadCSVFileName, setDownloadCSVFileName] = useState('CaseList.csv');
@@ -174,7 +174,7 @@ export default function DownloadCSVFileModal(props) {
174
174
  const checkboxValues = Object.values(checkboxes).slice(1); // as we don't want selectAll value
175
175
  const allCheckBoxNotSelected = checkboxValues.includes(false);
176
176
  const onExportCSVClick = () => __awaiter(this, void 0, void 0, function* () {
177
- var _a, _b, _c;
177
+ var _a, _b, _c, _d, _e, _f;
178
178
  try {
179
179
  setIsSavedClicked(true);
180
180
  if (!isEmpty(splitExtensionName)) {
@@ -182,9 +182,9 @@ export default function DownloadCSVFileModal(props) {
182
182
  const hasSelectedCases = selectedCases.length > 0;
183
183
  const csvLimit = hasSelectedCases ? selectedCases.length : 1000;
184
184
  const result = yield getCaseListFromGraphQL(filterState, apolloClient, csvLimit, undefined, hasSelectedCases ? selectedCases : undefined, includeSecureSupportCases, {
185
- isInternal: Boolean((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.isInternal),
186
- salesforceAccountId: (_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
187
- accountNumber: (_c = loggedInUsersAccount.data) === null || _c === void 0 ? void 0 : _c.accountNumber,
185
+ isInternal: Boolean((_c = (_b = (_a = loggedInUserRights.data) === null || _a === void 0 ? void 0 : _a.isInternal) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : (_d = loggedInUser.data) === null || _d === void 0 ? void 0 : _d.isInternal),
186
+ salesforceAccountId: (_e = loggedInUsersAccount.data) === null || _e === void 0 ? void 0 : _e.salesforceAccountId,
187
+ accountNumber: (_f = loggedInUsersAccount.data) === null || _f === void 0 ? void 0 : _f.accountNumber,
188
188
  });
189
189
  setIsFetching(false);
190
190
  const updatedCsvData = result.caseListResponse.response.docs.map((row) => (Object.assign(Object.assign({}, row), { case_type: toNewCaseTypeSwitcher(row.case_type), case_link: `https://${window.location.host}${window.location.pathname}/#/case/${row.case_number}` })));
@@ -14,7 +14,7 @@ export interface ICaseListAccountScope {
14
14
  isInternal?: boolean;
15
15
  /** Salesforce Account Id — used for external users (and when an account filter resolves to Ids). */
16
16
  salesforceAccountId?: string;
17
- /** Account number — used for internal users when no account filter is applied. */
17
+ /** Account number — used for internal users when no account filter and no keyword search is applied. */
18
18
  accountNumber?: string;
19
19
  }
20
20
  export interface IResolvedUserIds {
@@ -1 +1 @@
1
- {"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAenD,OAAO,EAEH,oBAAoB,EAEvB,MAAM,+CAA+C,CAAC;AAMvD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAM1F;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,yGAAyG;IACzG,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,iEAAiE;AACjE,MAA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AgB;IAC7B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAmeD,wBAAsB,qCAAqC,CACvD,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,eAAe,CAAC,EAAE,gBAAgB,EAClC,yBAAyB,UAAQ,EACjC,YAAY,CAAC,EAAE,qBAAqB,GACrC,OAAO,CAAC,yBAAyB,CAAC,CA4JpC"}
@@ -297,10 +297,12 @@ function buildRedHatSupportUserReferenceFilter(fieldName, values) {
297
297
  })),
298
298
  };
299
299
  }
300
+ function getSearchKeyword(queryString) {
301
+ var _a;
302
+ return (_a = queryString === null || queryString === void 0 ? void 0 : queryString.replace(/\*$/g, '').trim()) !== null && _a !== void 0 ? _a : '';
303
+ }
300
304
  function buildKeywordSearchFilter(queryString) {
301
- if (!queryString)
302
- return undefined;
303
- const keyword = queryString.replace(/\*$/g, '').trim();
305
+ const keyword = getSearchKeyword(queryString);
304
306
  if (!keyword)
305
307
  return undefined;
306
308
  const caseNumberPattern = /^\d{8}$/;
@@ -451,11 +453,13 @@ export function createGraphQLVariablesFromFilterState(filterState_1, apolloClien
451
453
  // Account scoping:
452
454
  // - Account filter applied → AccountId(s) from selected accounts (both user types)
453
455
  // - Filter cleared / default:
454
- // - internal → Account_Number__c (logged-in account number; no AccountId available)
455
- // - external → AccountId (logged-in salesforceAccountId)
456
+ // - internal + keyword search → no account scope (search across accounts)
457
+ // - internal, no keyword → Account_Number__c (logged-in account number)
458
+ // - external → AccountId (logged-in salesforceAccountId), with or without keyword search
456
459
  const filteredAccountNumbers = ((_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.accountNumber]) === null || _a === void 0 ? void 0 : _a.length)
457
460
  ? flattenAccountNumbers(filterInfo[SolrKeys.accountNumber])
458
461
  : [];
462
+ const hasKeywordSearch = Boolean(getSearchKeyword(filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString));
459
463
  if (filteredAccountNumbers.length) {
460
464
  const accountIds = yield resolveAccountIdsByAccountNumbers(filteredAccountNumbers, apolloClient);
461
465
  if (!accountIds.length) {
@@ -466,7 +470,7 @@ export function createGraphQLVariablesFromFilterState(filterState_1, apolloClien
466
470
  andConditions.push(accountIdFilter);
467
471
  }
468
472
  else if (accountScope === null || accountScope === void 0 ? void 0 : accountScope.isInternal) {
469
- if (accountScope.accountNumber) {
473
+ if (accountScope.accountNumber && !hasKeywordSearch) {
470
474
  andConditions.push({ Account_Number__c: { eq: accountScope.accountNumber } });
471
475
  }
472
476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/cases",
3
- "version": "2.7.27",
3
+ "version": "2.7.29",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -34,15 +34,15 @@
34
34
  "solr-query-builder": "1.0.1"
35
35
  },
36
36
  "dependencies": {
37
- "@cee-eng/hydrajs": "^4.18.114",
37
+ "@cee-eng/hydrajs": "^4.18.116",
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.6.23",
42
- "@rh-support/react-context": "2.6.25",
41
+ "@rh-support/components": "2.6.25",
42
+ "@rh-support/react-context": "2.6.27",
43
43
  "@rh-support/types": "2.0.31",
44
- "@rh-support/user-permissions": "2.6.21",
45
- "@rh-support/utils": "2.6.20",
44
+ "@rh-support/user-permissions": "2.6.23",
45
+ "@rh-support/utils": "2.6.22",
46
46
  "localforage": "^1.10.0",
47
47
  "lodash": "^4.17.21",
48
48
  "pegjs": "^0.10.0",
@@ -94,5 +94,5 @@
94
94
  "defaults and supports es6-module",
95
95
  "maintained node versions"
96
96
  ],
97
- "gitHead": "50ea801849f55d760cb8e704626d817742f72768"
97
+ "gitHead": "261e4abdf99d53426e11de96fc157763484410c5"
98
98
  }