@rh-support/cases 2.7.26 → 2.7.28
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.
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +19 -14
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +7 -2
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +3 -2
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +4 -4
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +9 -1
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +68 -14
- package/package.json +7 -7
|
@@ -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,KAA+D,MAAM,OAAO,CAAC;AAGpF,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AA2C1C,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,
|
|
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,KAA+D,MAAM,OAAO,CAAC;AAGpF,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AA2C1C,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,qBA4zBrC"}
|
|
@@ -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;
|
|
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);
|
|
@@ -54,6 +54,12 @@ export function CaseList(props) {
|
|
|
54
54
|
const globalDispatchContext = useGlobalDispatchContext();
|
|
55
55
|
const apolloClient = useApolloClient();
|
|
56
56
|
const includeSecureSupportCases = Boolean(loggedInUsersAccount.data.secureSupport);
|
|
57
|
+
const salesforceAccountId = (_c = loggedInUsersAccount.data) === null || _c === void 0 ? void 0 : _c.salesforceAccountId;
|
|
58
|
+
const caseListAccountScope = {
|
|
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
|
+
salesforceAccountId,
|
|
61
|
+
accountNumber: (_h = loggedInUsersAccount.data) === null || _h === void 0 ? void 0 : _h.accountNumber,
|
|
62
|
+
};
|
|
57
63
|
const location = useLocation();
|
|
58
64
|
const searchParams = getUrlParsedParams(location.search);
|
|
59
65
|
const queryFromUrl = searchParams[FILTER_URL_QUERY_SEARCH_PARAM];
|
|
@@ -94,7 +100,7 @@ export function CaseList(props) {
|
|
|
94
100
|
if (!cursor || prefetchRef.current.cursor === cursor)
|
|
95
101
|
return;
|
|
96
102
|
prefetchRef.current = { cursor, data: null, loading: true };
|
|
97
|
-
loadMoreCases(activeFilterStateRef.current, apolloClient, cursor, undefined, includeSecureSupportCases)
|
|
103
|
+
loadMoreCases(activeFilterStateRef.current, apolloClient, cursor, undefined, includeSecureSupportCases, caseListAccountScope)
|
|
98
104
|
.then((result) => {
|
|
99
105
|
if (prefetchRef.current.cursor === cursor) {
|
|
100
106
|
prefetchRef.current = { cursor, data: result, loading: false };
|
|
@@ -182,7 +188,7 @@ export function CaseList(props) {
|
|
|
182
188
|
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
183
189
|
loadMoreCooldownRef.current = true;
|
|
184
190
|
activeFilterStateRef.current = currentFilterState;
|
|
185
|
-
const result = yield getCaseListFromGraphQL(applyGroupFilterAccess(currentFilterState), apolloClient, undefined, controller.signal, undefined, includeSecureSupportCases);
|
|
191
|
+
const result = yield getCaseListFromGraphQL(applyGroupFilterAccess(currentFilterState), apolloClient, undefined, controller.signal, undefined, includeSecureSupportCases, caseListAccountScope);
|
|
186
192
|
if (controller.signal.aborted) {
|
|
187
193
|
return;
|
|
188
194
|
}
|
|
@@ -236,7 +242,7 @@ export function CaseList(props) {
|
|
|
236
242
|
}
|
|
237
243
|
else {
|
|
238
244
|
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
239
|
-
result = yield loadMoreCases(applyGroupFilterAccess(activeFilterStateRef.current), apolloClient, endCursor, controller.signal, includeSecureSupportCases);
|
|
245
|
+
result = yield loadMoreCases(applyGroupFilterAccess(activeFilterStateRef.current), apolloClient, endCursor, controller.signal, includeSecureSupportCases, caseListAccountScope);
|
|
240
246
|
}
|
|
241
247
|
if (controller.signal.aborted)
|
|
242
248
|
return;
|
|
@@ -286,7 +292,7 @@ export function CaseList(props) {
|
|
|
286
292
|
};
|
|
287
293
|
const checkNewCases = () => __awaiter(this, void 0, void 0, function* () {
|
|
288
294
|
try {
|
|
289
|
-
const { caseListResponse } = yield getCaseListFromGraphQL(applyGroupFilterAccess(filterState), apolloClient, undefined, undefined, undefined, includeSecureSupportCases);
|
|
295
|
+
const { caseListResponse } = yield getCaseListFromGraphQL(applyGroupFilterAccess(filterState), apolloClient, undefined, undefined, undefined, includeSecureSupportCases, caseListAccountScope);
|
|
290
296
|
let changed = false;
|
|
291
297
|
if (caseListResponse.response.numFound <= filterState.paginationInfo.pageSize &&
|
|
292
298
|
caseListResponse.response.numFound !== caseList.numFound) {
|
|
@@ -315,15 +321,14 @@ export function CaseList(props) {
|
|
|
315
321
|
console.log(err);
|
|
316
322
|
}
|
|
317
323
|
});
|
|
318
|
-
const salesforceAccountId = (_c = loggedInUsersAccount.data) === null || _c === void 0 ? void 0 : _c.salesforceAccountId;
|
|
319
324
|
const { error: caseLabelsFetchError, refetch: refetchCaseLabels } = useCaseLabels(salesforceAccountId);
|
|
320
325
|
const retryCaseListFetch = () => {
|
|
321
326
|
refetchCaseLabels();
|
|
322
327
|
getCases(filterState);
|
|
323
328
|
};
|
|
324
|
-
const loggedInContactId = (
|
|
325
|
-
const loggedInIsOrgAdmin = (
|
|
326
|
-
const defaultCaseGroupId = (
|
|
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;
|
|
327
332
|
const prevDefaultCaseGroupIdRef = useRef(defaultCaseGroupId);
|
|
328
333
|
useEffect(() => {
|
|
329
334
|
var _a;
|
|
@@ -359,7 +364,7 @@ export function CaseList(props) {
|
|
|
359
364
|
loggedInContactId,
|
|
360
365
|
loggedInIsOrgAdmin,
|
|
361
366
|
loggedInUser.isFetching,
|
|
362
|
-
(
|
|
367
|
+
(_o = loggedInUsersAccount.data) === null || _o === void 0 ? void 0 : _o.isInternal,
|
|
363
368
|
salesforceAccountId,
|
|
364
369
|
]);
|
|
365
370
|
useEffect(() => {
|
|
@@ -403,8 +408,8 @@ export function CaseList(props) {
|
|
|
403
408
|
}, [
|
|
404
409
|
caseGroupEnabled,
|
|
405
410
|
loggedInUsersAccount.isFetching,
|
|
406
|
-
(
|
|
407
|
-
(
|
|
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],
|
|
408
413
|
]);
|
|
409
414
|
useEffect(() => {
|
|
410
415
|
const loadMetadata = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -595,8 +600,8 @@ export function CaseList(props) {
|
|
|
595
600
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
|
|
596
601
|
React.createElement(CaseListFilterChips, null))),
|
|
597
602
|
React.createElement("section", { className: "case-search-bottom" },
|
|
598
|
-
React.createElement("aside", { className: `case-search-filters ${((
|
|
599
|
-
React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((
|
|
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,
|
|
600
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" }) },
|
|
601
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")))),
|
|
602
607
|
React.createElement("div", { className: "filter-wrapper" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DownloadCSVFileModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/DownloadCSVFileModal.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAgCrC,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,oBAAoB,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAWD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"DownloadCSVFileModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/DownloadCSVFileModal.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAgCrC,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,oBAAoB,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAWD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBAiYzD"}
|
|
@@ -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,13 +174,18 @@ 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, _d, _e, _f;
|
|
177
178
|
try {
|
|
178
179
|
setIsSavedClicked(true);
|
|
179
180
|
if (!isEmpty(splitExtensionName)) {
|
|
180
181
|
setIsFetching(true);
|
|
181
182
|
const hasSelectedCases = selectedCases.length > 0;
|
|
182
183
|
const csvLimit = hasSelectedCases ? selectedCases.length : 1000;
|
|
183
|
-
const result = yield getCaseListFromGraphQL(filterState, apolloClient, csvLimit, undefined, hasSelectedCases ? selectedCases : undefined, includeSecureSupportCases
|
|
184
|
+
const result = yield getCaseListFromGraphQL(filterState, apolloClient, csvLimit, undefined, hasSelectedCases ? selectedCases : undefined, includeSecureSupportCases, {
|
|
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
|
+
});
|
|
184
189
|
setIsFetching(false);
|
|
185
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}` })));
|
|
186
191
|
downloadCSV(updatedCsvData, getHeaders(), splitExtensionName ? `${splitExtensionName}.csv` : 'CaseList.csv');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApolloClient } from '@apollo/client';
|
|
2
2
|
import { ICaseListItem } from '@rh-support/utils';
|
|
3
3
|
import { ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
4
|
+
import { ICaseListAccountScope } from './caseListVariablesBuilder';
|
|
4
5
|
export interface IGraphQLCaseListResponse {
|
|
5
6
|
caseListResponse: {
|
|
6
7
|
response: {
|
|
@@ -14,7 +15,7 @@ export interface IGraphQLCaseListResponse {
|
|
|
14
15
|
endCursor: string | undefined;
|
|
15
16
|
}
|
|
16
17
|
export declare function clearPageCursors(): void;
|
|
17
|
-
export declare function getCaseListFromGraphQL(filterState: ICaseListFilterState, apolloClient: ApolloClient, limitOverride?: number, signal?: AbortSignal, selectedCaseNumbers?: string[], includeSecureSupportCases?: boolean): Promise<IGraphQLCaseListResponse>;
|
|
18
|
+
export declare function getCaseListFromGraphQL(filterState: ICaseListFilterState, apolloClient: ApolloClient, limitOverride?: number, signal?: AbortSignal, selectedCaseNumbers?: string[], includeSecureSupportCases?: boolean, accountScope?: ICaseListAccountScope): Promise<IGraphQLCaseListResponse>;
|
|
18
19
|
export interface ILoadMoreResult {
|
|
19
20
|
docs: ICaseListItem[];
|
|
20
21
|
hasNextPage: boolean;
|
|
@@ -24,5 +25,5 @@ export interface ILoadMoreResult {
|
|
|
24
25
|
* Fetches the next page of cases for infinite scroll.
|
|
25
26
|
* Uses the provided `afterCursor` instead of the page-based cursor store.
|
|
26
27
|
*/
|
|
27
|
-
export declare function loadMoreCases(filterState: ICaseListFilterState, apolloClient: ApolloClient, afterCursor: string, signal?: AbortSignal, includeSecureSupportCases?: boolean): Promise<ILoadMoreResult>;
|
|
28
|
+
export declare function loadMoreCases(filterState: ICaseListFilterState, apolloClient: ApolloClient, afterCursor: string, signal?: AbortSignal, includeSecureSupportCases?: boolean, accountScope?: ICaseListAccountScope): Promise<ILoadMoreResult>;
|
|
28
29
|
//# sourceMappingURL=caseListGraphQLUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListGraphQLUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListGraphQLUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAKH,aAAa,EAEhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"caseListGraphQLUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListGraphQLUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAKH,aAAa,EAEhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+CAA+C,CAAC;AAGrG,OAAO,EAGH,qBAAqB,EAExB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,wBAAwB;IACrC,gBAAgB,EAAE;QACd,QAAQ,EAAE;YACN,IAAI,EAAE,aAAa,EAAE,CAAC;YACtB,QAAQ,EAAE,MAAM,CAAC;YACjB,KAAK,EAAE,MAAM,CAAC;SACjB,CAAC;KACL,CAAC;IACF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAwDD,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAkFD,wBAAsB,sBAAsB,CACxC,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,mBAAmB,CAAC,EAAE,MAAM,EAAE,EAC9B,yBAAyB,UAAQ,EACjC,YAAY,CAAC,EAAE,qBAAqB,GACrC,OAAO,CAAC,wBAAwB,CAAC,CAwGnC;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAC/B,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,EACpB,yBAAyB,UAAQ,EACjC,YAAY,CAAC,EAAE,qBAAqB,GACrC,OAAO,CAAC,eAAe,CAAC,CAyD1B"}
|
|
@@ -160,7 +160,7 @@ function resolveVersionProductIds(filterState, apolloClient) {
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
export function getCaseListFromGraphQL(filterState_1, apolloClient_1, limitOverride_1, signal_1, selectedCaseNumbers_1) {
|
|
163
|
-
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, limitOverride, signal, selectedCaseNumbers, includeSecureSupportCases = false) {
|
|
163
|
+
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, limitOverride, signal, selectedCaseNumbers, includeSecureSupportCases = false, accountScope) {
|
|
164
164
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
165
165
|
try {
|
|
166
166
|
yield resolveVersionProductIds(filterState, apolloClient);
|
|
@@ -171,7 +171,7 @@ export function getCaseListFromGraphQL(filterState_1, apolloClient_1, limitOverr
|
|
|
171
171
|
const ownerUserIds = yield resolveOwnerIds(federationIdsToResolve, apolloClient);
|
|
172
172
|
resolvedUserIds = { ownerUserIds };
|
|
173
173
|
}
|
|
174
|
-
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds, includeSecureSupportCases);
|
|
174
|
+
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds, includeSecureSupportCases, accountScope);
|
|
175
175
|
const { forceEmptyResult } = variables, caseQueryVariables = __rest(variables, ["forceEmptyResult"]);
|
|
176
176
|
if (limitOverride) {
|
|
177
177
|
caseQueryVariables.first = limitOverride;
|
|
@@ -258,7 +258,7 @@ export function getCaseListFromGraphQL(filterState_1, apolloClient_1, limitOverr
|
|
|
258
258
|
* Uses the provided `afterCursor` instead of the page-based cursor store.
|
|
259
259
|
*/
|
|
260
260
|
export function loadMoreCases(filterState_1, apolloClient_1, afterCursor_1, signal_1) {
|
|
261
|
-
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, afterCursor, signal, includeSecureSupportCases = false) {
|
|
261
|
+
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, afterCursor, signal, includeSecureSupportCases = false, accountScope) {
|
|
262
262
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
263
263
|
try {
|
|
264
264
|
yield resolveVersionProductIds(filterState, apolloClient);
|
|
@@ -269,7 +269,7 @@ export function loadMoreCases(filterState_1, apolloClient_1, afterCursor_1, sign
|
|
|
269
269
|
const ownerUserIds = yield resolveOwnerIds(federationIdsToResolve, apolloClient);
|
|
270
270
|
resolvedUserIds = { ownerUserIds };
|
|
271
271
|
}
|
|
272
|
-
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds, includeSecureSupportCases);
|
|
272
|
+
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds, includeSecureSupportCases, accountScope);
|
|
273
273
|
const { forceEmptyResult } = variables, caseQueryVariables = __rest(variables, ["forceEmptyResult"]);
|
|
274
274
|
if (forceEmptyResult) {
|
|
275
275
|
return { docs: [], hasNextPage: false, endCursor: undefined };
|
|
@@ -9,9 +9,17 @@ export interface IGraphQLCaseListVariables {
|
|
|
9
9
|
/** When true, filters resolve to zero cases (e.g. label with no linked cases) — skip the cases query. */
|
|
10
10
|
forceEmptyResult?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/** Logged-in account context used to scope getCasesByFilters. */
|
|
13
|
+
export interface ICaseListAccountScope {
|
|
14
|
+
isInternal?: boolean;
|
|
15
|
+
/** Salesforce Account Id — used for external users (and when an account filter resolves to Ids). */
|
|
16
|
+
salesforceAccountId?: string;
|
|
17
|
+
/** Account number — used for internal users when no account filter and no keyword search is applied. */
|
|
18
|
+
accountNumber?: string;
|
|
19
|
+
}
|
|
12
20
|
export interface IResolvedUserIds {
|
|
13
21
|
/** Pre-resolved OwnerId values (RedHatSupportUser or RedHatSupportGroup). */
|
|
14
22
|
ownerUserIds?: string[];
|
|
15
23
|
}
|
|
16
|
-
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, apolloClient: ApolloClient, resolvedUserIds?: IResolvedUserIds, includeSecureSupportCases?: boolean): Promise<IGraphQLCaseListVariables>;
|
|
24
|
+
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, apolloClient: ApolloClient, resolvedUserIds?: IResolvedUserIds, includeSecureSupportCases?: boolean, accountScope?: ICaseListAccountScope): Promise<IGraphQLCaseListVariables>;
|
|
17
25
|
//# sourceMappingURL=caseListVariablesBuilder.d.ts.map
|
|
@@ -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;
|
|
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,MAAM,WAAW,qBAAqB;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oGAAoG;IACpG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wGAAwG;IACxG,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;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"}
|
|
@@ -7,7 +7,7 @@ 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 { buildAccessRestrictionExclusionFilter, expandStatusGroupsToApiValues, GET_CASE_GROUPS, GET_CASE_NUMBERS_BY_CASE_LABEL, GET_CONTACT_BY_SSO, GET_GROUP_IDS_BY_NAME, GET_USER_IDS_BY_FEDERATION, getTechnicalSupportRecordTypeId, } from '@rh-support/utils';
|
|
10
|
+
import { buildAccessRestrictionExclusionFilter, expandStatusGroupsToApiValues, GET_CASE_GROUPS, GET_CASE_NUMBERS_BY_CASE_LABEL, GET_CONTACT_BY_SSO, GET_GROUP_IDS_BY_NAME, GET_USER_IDS_BY_FEDERATION, getTechnicalSupportRecordTypeId, SEARCH_ACCOUNTS, } from '@rh-support/utils';
|
|
11
11
|
import { CaseListColumnIds, caseListSortColumnIdsToGraphQLMap } from '../enums/case';
|
|
12
12
|
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
13
13
|
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
@@ -44,6 +44,38 @@ function flattenAccountNumbers(accountFilters) {
|
|
|
44
44
|
});
|
|
45
45
|
return [...new Set(numbers)];
|
|
46
46
|
}
|
|
47
|
+
function buildAccountIdFilter(accountIds) {
|
|
48
|
+
if (!accountIds.length)
|
|
49
|
+
return undefined;
|
|
50
|
+
if (accountIds.length === 1) {
|
|
51
|
+
return { AccountId: { eq: accountIds[0] } };
|
|
52
|
+
}
|
|
53
|
+
return { AccountId: { in: accountIds } };
|
|
54
|
+
}
|
|
55
|
+
/** Resolve account numbers from the Accounts filter to Salesforce Account Ids. */
|
|
56
|
+
function resolveAccountIdsByAccountNumbers(accountNumbers, apolloClient) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
|
+
if (!accountNumbers.length)
|
|
60
|
+
return [];
|
|
61
|
+
try {
|
|
62
|
+
const { data } = yield apolloClient.query({
|
|
63
|
+
query: SEARCH_ACCOUNTS,
|
|
64
|
+
variables: {
|
|
65
|
+
where: { AccountNumber: { in: accountNumbers } },
|
|
66
|
+
first: Math.max(accountNumbers.length, 1),
|
|
67
|
+
},
|
|
68
|
+
fetchPolicy: 'network-only',
|
|
69
|
+
});
|
|
70
|
+
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
71
|
+
return edges.map((edge) => { var _a; return (_a = edge.node) === null || _a === void 0 ? void 0 : _a.Id; }).filter(Boolean);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error('[GraphQL] Failed to resolve account IDs by account number:', error);
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
47
79
|
function buildStatusFilter(statuses) {
|
|
48
80
|
if (!(statuses === null || statuses === void 0 ? void 0 : statuses.length))
|
|
49
81
|
return undefined;
|
|
@@ -265,10 +297,12 @@ function buildRedHatSupportUserReferenceFilter(fieldName, values) {
|
|
|
265
297
|
})),
|
|
266
298
|
};
|
|
267
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
|
+
}
|
|
268
304
|
function buildKeywordSearchFilter(queryString) {
|
|
269
|
-
|
|
270
|
-
return undefined;
|
|
271
|
-
const keyword = queryString.replace(/\*$/g, '').trim();
|
|
305
|
+
const keyword = getSearchKeyword(queryString);
|
|
272
306
|
if (!keyword)
|
|
273
307
|
return undefined;
|
|
274
308
|
const caseNumberPattern = /^\d{8}$/;
|
|
@@ -409,13 +443,40 @@ function resolveOwnerIdsBySearchTerms(searchTerms, apolloClient) {
|
|
|
409
443
|
});
|
|
410
444
|
}
|
|
411
445
|
export function createGraphQLVariablesFromFilterState(filterState_1, apolloClient_1, resolvedUserIds_1) {
|
|
412
|
-
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, resolvedUserIds, includeSecureSupportCases = false) {
|
|
413
|
-
var _a;
|
|
446
|
+
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, resolvedUserIds, includeSecureSupportCases = false, accountScope) {
|
|
447
|
+
var _a, _b;
|
|
414
448
|
const { paginationInfo, sortInfo, filterInfo, filterQueryInfo } = filterState;
|
|
415
449
|
const first = (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.pageSize) || 10;
|
|
416
450
|
const orderBy = buildOrderByFromSortInfo(sortInfo);
|
|
417
451
|
const andConditions = [];
|
|
418
452
|
andConditions.push(buildAccessRestrictionExclusionFilter(includeSecureSupportCases));
|
|
453
|
+
// Account scoping:
|
|
454
|
+
// - Account filter applied → AccountId(s) from selected accounts (both user types)
|
|
455
|
+
// - Filter cleared / default:
|
|
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
|
|
459
|
+
const filteredAccountNumbers = ((_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.accountNumber]) === null || _a === void 0 ? void 0 : _a.length)
|
|
460
|
+
? flattenAccountNumbers(filterInfo[SolrKeys.accountNumber])
|
|
461
|
+
: [];
|
|
462
|
+
const hasKeywordSearch = Boolean(getSearchKeyword(filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString));
|
|
463
|
+
if (filteredAccountNumbers.length) {
|
|
464
|
+
const accountIds = yield resolveAccountIdsByAccountNumbers(filteredAccountNumbers, apolloClient);
|
|
465
|
+
if (!accountIds.length) {
|
|
466
|
+
return { first, orderBy, forceEmptyResult: true };
|
|
467
|
+
}
|
|
468
|
+
const accountIdFilter = buildAccountIdFilter(accountIds);
|
|
469
|
+
if (accountIdFilter)
|
|
470
|
+
andConditions.push(accountIdFilter);
|
|
471
|
+
}
|
|
472
|
+
else if (accountScope === null || accountScope === void 0 ? void 0 : accountScope.isInternal) {
|
|
473
|
+
if (accountScope.accountNumber && !hasKeywordSearch) {
|
|
474
|
+
andConditions.push({ Account_Number__c: { eq: accountScope.accountNumber } });
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
else if (accountScope === null || accountScope === void 0 ? void 0 : accountScope.salesforceAccountId) {
|
|
478
|
+
andConditions.push({ AccountId: { eq: accountScope.salesforceAccountId } });
|
|
479
|
+
}
|
|
419
480
|
if (filterInfo) {
|
|
420
481
|
const statusFilter = buildStatusFilter(filterInfo[SolrKeys.status]);
|
|
421
482
|
if (statusFilter)
|
|
@@ -424,13 +485,6 @@ export function createGraphQLVariablesFromFilterState(filterState_1, apolloClien
|
|
|
424
485
|
if (severities === null || severities === void 0 ? void 0 : severities.length) {
|
|
425
486
|
andConditions.push({ Priority: { in: severities } });
|
|
426
487
|
}
|
|
427
|
-
const accounts = filterInfo[SolrKeys.accountNumber];
|
|
428
|
-
if (accounts === null || accounts === void 0 ? void 0 : accounts.length) {
|
|
429
|
-
const accountNumbers = flattenAccountNumbers(accounts);
|
|
430
|
-
if (accountNumbers.length) {
|
|
431
|
-
andConditions.push({ Account_Number__c: { in: accountNumbers } });
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
488
|
const products = filterInfo[SolrPivotKeys.product_version];
|
|
435
489
|
if (products === null || products === void 0 ? void 0 : products.length) {
|
|
436
490
|
const productConditions = buildProductFilter(products);
|
|
@@ -499,7 +553,7 @@ export function createGraphQLVariablesFromFilterState(filterState_1, apolloClien
|
|
|
499
553
|
if (groupFilter)
|
|
500
554
|
andConditions.push(groupFilter);
|
|
501
555
|
const caseLabels = filterInfo[SolrKeys.caseLabel];
|
|
502
|
-
const labelIds = (
|
|
556
|
+
const labelIds = (_b = caseLabels === null || caseLabels === void 0 ? void 0 : caseLabels.map((label) => label.key).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
|
|
503
557
|
if (labelIds.length) {
|
|
504
558
|
const caseNumbers = yield resolveCaseNumbersByLabelIds(labelIds, apolloClient);
|
|
505
559
|
if (!caseNumbers.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.28",
|
|
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.
|
|
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.
|
|
42
|
-
"@rh-support/react-context": "2.6.
|
|
41
|
+
"@rh-support/components": "2.6.24",
|
|
42
|
+
"@rh-support/react-context": "2.6.26",
|
|
43
43
|
"@rh-support/types": "2.0.31",
|
|
44
|
-
"@rh-support/user-permissions": "2.6.
|
|
45
|
-
"@rh-support/utils": "2.6.
|
|
44
|
+
"@rh-support/user-permissions": "2.6.22",
|
|
45
|
+
"@rh-support/utils": "2.6.21",
|
|
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": "
|
|
97
|
+
"gitHead": "5433c2ca804293be5edf87dba05bf2b122bb6bbb"
|
|
98
98
|
}
|