@rh-support/cases 2.7.25 → 2.7.27
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 +6 -1
- package/lib/esm/enums/cache.d.ts.map +1 -1
- 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 +61 -11
- 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;
|
|
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((_d = loggedInUsersAccount.data) === null || _d === void 0 ? void 0 : _d.isInternal),
|
|
60
|
+
salesforceAccountId,
|
|
61
|
+
accountNumber: (_e = loggedInUsersAccount.data) === null || _e === void 0 ? void 0 : _e.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 = (_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;
|
|
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
|
+
(_k = loggedInUsersAccount.data) === null || _k === void 0 ? void 0 : _k.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
|
+
(_l = loggedInUsersAccount.data) === null || _l === void 0 ? void 0 : _l.isInternal,
|
|
412
|
+
(_m = filterState.filterInfo) === null || _m === void 0 ? void 0 : _m[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 ${((_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,
|
|
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"}
|
|
@@ -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;
|
|
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((_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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/enums/cache.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAClB,wBAAwB,2BAA2B;IACnD,0BAA0B,4BAA4B;IACtD,sBAAsB,wBAAwB;CACjD;AAED,eAAO,MAAM,mBAAmB;;cAEU,kBAAkB;;;cAGjB,kBAAkB;;;cAGtB,kBAAkB;;CAExD,CAAC;
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/enums/cache.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAClB,wBAAwB,2BAA2B;IACnD,0BAA0B,4BAA4B;IACtD,sBAAsB,wBAAwB;CACjD;AAED,eAAO,MAAM,mBAAmB;;cAEU,kBAAkB;;;cAGjB,kBAAkB;;;cAGtB,kBAAkB;;CAExD,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,yBAAyB,GAAG,qBAAqB,CAAC"}
|
|
@@ -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 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,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC7B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAieD,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,CA0JpC"}
|
|
@@ -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;
|
|
@@ -409,13 +441,38 @@ function resolveOwnerIdsBySearchTerms(searchTerms, apolloClient) {
|
|
|
409
441
|
});
|
|
410
442
|
}
|
|
411
443
|
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;
|
|
444
|
+
return __awaiter(this, arguments, void 0, function* (filterState, apolloClient, resolvedUserIds, includeSecureSupportCases = false, accountScope) {
|
|
445
|
+
var _a, _b;
|
|
414
446
|
const { paginationInfo, sortInfo, filterInfo, filterQueryInfo } = filterState;
|
|
415
447
|
const first = (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.pageSize) || 10;
|
|
416
448
|
const orderBy = buildOrderByFromSortInfo(sortInfo);
|
|
417
449
|
const andConditions = [];
|
|
418
450
|
andConditions.push(buildAccessRestrictionExclusionFilter(includeSecureSupportCases));
|
|
451
|
+
// Account scoping:
|
|
452
|
+
// - Account filter applied → AccountId(s) from selected accounts (both user types)
|
|
453
|
+
// - Filter cleared / default:
|
|
454
|
+
// - internal → Account_Number__c (logged-in account number; no AccountId available)
|
|
455
|
+
// - external → AccountId (logged-in salesforceAccountId)
|
|
456
|
+
const filteredAccountNumbers = ((_a = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.accountNumber]) === null || _a === void 0 ? void 0 : _a.length)
|
|
457
|
+
? flattenAccountNumbers(filterInfo[SolrKeys.accountNumber])
|
|
458
|
+
: [];
|
|
459
|
+
if (filteredAccountNumbers.length) {
|
|
460
|
+
const accountIds = yield resolveAccountIdsByAccountNumbers(filteredAccountNumbers, apolloClient);
|
|
461
|
+
if (!accountIds.length) {
|
|
462
|
+
return { first, orderBy, forceEmptyResult: true };
|
|
463
|
+
}
|
|
464
|
+
const accountIdFilter = buildAccountIdFilter(accountIds);
|
|
465
|
+
if (accountIdFilter)
|
|
466
|
+
andConditions.push(accountIdFilter);
|
|
467
|
+
}
|
|
468
|
+
else if (accountScope === null || accountScope === void 0 ? void 0 : accountScope.isInternal) {
|
|
469
|
+
if (accountScope.accountNumber) {
|
|
470
|
+
andConditions.push({ Account_Number__c: { eq: accountScope.accountNumber } });
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
else if (accountScope === null || accountScope === void 0 ? void 0 : accountScope.salesforceAccountId) {
|
|
474
|
+
andConditions.push({ AccountId: { eq: accountScope.salesforceAccountId } });
|
|
475
|
+
}
|
|
419
476
|
if (filterInfo) {
|
|
420
477
|
const statusFilter = buildStatusFilter(filterInfo[SolrKeys.status]);
|
|
421
478
|
if (statusFilter)
|
|
@@ -424,13 +481,6 @@ export function createGraphQLVariablesFromFilterState(filterState_1, apolloClien
|
|
|
424
481
|
if (severities === null || severities === void 0 ? void 0 : severities.length) {
|
|
425
482
|
andConditions.push({ Priority: { in: severities } });
|
|
426
483
|
}
|
|
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
484
|
const products = filterInfo[SolrPivotKeys.product_version];
|
|
435
485
|
if (products === null || products === void 0 ? void 0 : products.length) {
|
|
436
486
|
const productConditions = buildProductFilter(products);
|
|
@@ -499,7 +549,7 @@ export function createGraphQLVariablesFromFilterState(filterState_1, apolloClien
|
|
|
499
549
|
if (groupFilter)
|
|
500
550
|
andConditions.push(groupFilter);
|
|
501
551
|
const caseLabels = filterInfo[SolrKeys.caseLabel];
|
|
502
|
-
const labelIds = (
|
|
552
|
+
const labelIds = (_b = caseLabels === null || caseLabels === void 0 ? void 0 : caseLabels.map((label) => label.key).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
|
|
503
553
|
if (labelIds.length) {
|
|
504
554
|
const caseNumbers = yield resolveCaseNumbersByLabelIds(labelIds, apolloClient);
|
|
505
555
|
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.27",
|
|
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.6.
|
|
42
|
-
"@rh-support/react-context": "2.6.
|
|
43
|
-
"@rh-support/types": "2.0.
|
|
44
|
-
"@rh-support/user-permissions": "2.6.
|
|
45
|
-
"@rh-support/utils": "2.6.
|
|
41
|
+
"@rh-support/components": "2.6.23",
|
|
42
|
+
"@rh-support/react-context": "2.6.25",
|
|
43
|
+
"@rh-support/types": "2.0.31",
|
|
44
|
+
"@rh-support/user-permissions": "2.6.21",
|
|
45
|
+
"@rh-support/utils": "2.6.20",
|
|
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": "50ea801849f55d760cb8e704626d817742f72768"
|
|
98
98
|
}
|