@rh-support/cases 2.6.165 → 2.6.167
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 +0 -7
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +106 -107
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +0 -2
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +5 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +2 -1
- package/lib/esm/components/case-list/CaseListReducer.d.ts +2 -8
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +1 -13
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +18 -11
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +4 -2
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +1 -7
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +7 -15
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +2 -5
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +14 -14
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +1 -3
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +5 -4
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +15 -54
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +18 -44
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +0 -3
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +14 -44
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +1 -3
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +61 -32
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +0 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/CaseListTable.js +5 -6
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +0 -5
- 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 +38 -68
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +5 -15
- package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +2 -3
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +1 -0
- package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/CaseSearch.js +6 -6
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +2 -1
- package/lib/esm/enums/case.d.ts +2 -1
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +14 -1
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +1 -9
- package/lib/esm/test-utils/mockData.js +1 -1
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +16 -0
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -0
- package/lib/esm/utils/caseListGraphQLUtils.js +193 -0
- package/lib/esm/utils/caseListMapper.d.ts +6 -0
- package/lib/esm/utils/caseListMapper.d.ts.map +1 -0
- package/lib/esm/utils/caseListMapper.js +36 -0
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +13 -0
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -0
- package/lib/esm/utils/caseListVariablesBuilder.js +160 -0
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +26 -1
- package/lib/esm/utils/constants.d.ts +2 -1
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +14 -3
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/lib/esm/utils/statusUtils.d.ts +3 -0
- package/lib/esm/utils/statusUtils.d.ts.map +1 -0
- package/lib/esm/utils/statusUtils.js +22 -0
- package/package.json +6 -6
|
@@ -6,7 +6,7 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
|
6
6
|
import { Trans, useTranslation } from 'react-i18next';
|
|
7
7
|
import { CaseSearchQueryType } from '../../../enums/caseSearch';
|
|
8
8
|
import { createFilterStateFromAdvancedQuery, createUserFriendlyQueryFromFilterStateAdvancedSearch, } from '../../../utils/caseSearchUtils';
|
|
9
|
-
import { useCaseListStateContext } from '../CaseListContext';
|
|
9
|
+
// import { useCaseListStateContext } from '../CaseListContext';
|
|
10
10
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext, initialPaginationInfo, } from '../CaseListFilterContext';
|
|
11
11
|
import { initialFilterInfo, updateFilterQuery, updateFilterState } from '../CaseListFilterReducer';
|
|
12
12
|
import { AdvanceSearch } from './AdvanceSearch';
|
|
@@ -21,7 +21,7 @@ export function CaseSearch(props) {
|
|
|
21
21
|
const [searchVal, setSearchVal] = useState(filterQueryInfo.queryString);
|
|
22
22
|
const [isAdvancedSearchValid, setIsAdvancedSearchValid] = useState(true);
|
|
23
23
|
const dispatch = useContext(CaseListFilterDispatchContext);
|
|
24
|
-
const { isFetching } = useCaseListStateContext();
|
|
24
|
+
// const { isFetching } = useCaseListStateContext();
|
|
25
25
|
const getType = useCallback(() => (filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.type) || CaseSearchQueryType.BASIC, [filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.type]);
|
|
26
26
|
// on queryString and parsedQuery change need to update search
|
|
27
27
|
useEffect(() => {
|
|
@@ -98,16 +98,16 @@ export function CaseSearch(props) {
|
|
|
98
98
|
React.createElement("div", { className: "case-search-input-container" },
|
|
99
99
|
React.createElement(SearchInput, { className: "pf-v6-u-w-100 case-search-input", placeholder: t('Search by keyword or case ID'), value: searchVal === null || searchVal === void 0 ? void 0 : searchVal.trim(), "data-tracking-id": "search-cases-text-input", id: "case-search-basic", "aria-label": t('Search by keyword or case ID'), onChange: (_event, val) => onSearchValChange(val), onClear: clearSearchVal }),
|
|
100
100
|
React.createElement(Button, { variant: "primary", type: "submit", className: "search-btn", "data-tracking-id": "case-list-search-button", isDisabled: isSearchButtonDisabled },
|
|
101
|
-
React.createElement(Trans, null, "Search"))
|
|
102
|
-
canUseAdvancedSearch && (React.createElement(Button, { variant: "link", onClick: () => onSearchTypeChange(CaseSearchQueryType.ADVANCED), isDisabled: isFetching, "data-tracking-id": "case-list-adv-toggle-button", className: "case-search-toggle secondary-button-pill" },
|
|
103
|
-
React.createElement(Trans, null, "Advanced"))))));
|
|
101
|
+
React.createElement(Trans, null, "Search")))));
|
|
104
102
|
};
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
104
|
const renderAdvanceSearch = () => {
|
|
106
105
|
return canUseAdvancedSearch ? (React.createElement(React.Fragment, null,
|
|
107
106
|
React.createElement(AdvanceSearch, { isSearchDisabled: isSearchButtonDisabled, onSearchValChange: onSearchValChange, onSearchClear: clearAdvancedSearchVal, onSearchSubmit: onCaseSearchAdvanced, onSearchTypeChange: onSearchTypeChange, onAdvancedSearchValidation: (isValid) => setIsAdvancedSearchValid(isValid) }))) : (renderBasicSearch());
|
|
108
107
|
};
|
|
108
|
+
void renderAdvanceSearch;
|
|
109
109
|
return (React.createElement(React.Fragment, null,
|
|
110
110
|
React.createElement("form", { onSubmit: handleSubmit, onKeyDown: handleSearchInputKeyDown },
|
|
111
|
-
React.createElement("div", { className: "form-group case-search-form-group" },
|
|
111
|
+
React.createElement("div", { className: "form-group case-search-form-group" }, renderBasicSearch())),
|
|
112
112
|
React.createElement(BookmarkedSearchesSelector, { currentCaseSearchString: searchVal === null || searchVal === void 0 ? void 0 : searchVal.trim(), currentSearchType: getType(), isAdvancedSearchValid: isAdvancedSearchValid, defaultSavedSearchName: props.defaultSavedSearchName })));
|
|
113
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAdvanceSearchParser.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/useAdvanceSearchParser.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,MAAM,EAAE;;CAAA;
|
|
1
|
+
{"version":3,"file":"useAdvanceSearchParser.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-search/useAdvanceSearchParser.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,MAAM,EAAE;;CAAA;yBAUzB,MAAM;6BAIF,MAAM;;EA+LzC"}
|
|
@@ -5,7 +5,8 @@ import { useEffect, useRef } from 'react';
|
|
|
5
5
|
import { SolrKeys } from '../../../enums/filters';
|
|
6
6
|
import { useCaseListStateContext } from '../CaseListContext';
|
|
7
7
|
export default function useAdvanceSearchParser({ onInit }) {
|
|
8
|
-
const
|
|
8
|
+
const caseListState = useCaseListStateContext();
|
|
9
|
+
const filterValuesFromFacetResponse = caseListState.filterValuesFromFacetResponse || {};
|
|
9
10
|
const { globalMetadataState: { caseGroups, loggedInUsersAccount, bookmarkedGroupAccounts, allCaseTypes }, } = useGlobalStateContext();
|
|
10
11
|
const parserRef = useRef(null);
|
|
11
12
|
const parse = (stringQuery) => {
|
package/lib/esm/enums/case.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare enum CaseStatus {
|
|
|
9
9
|
export declare enum CaseSeverity {
|
|
10
10
|
Urgent = "1 - Urgent",
|
|
11
11
|
Important = "2 - Important",
|
|
12
|
-
|
|
12
|
+
Medium = "3 - Medium",
|
|
13
13
|
Low = "4 - Low"
|
|
14
14
|
}
|
|
15
15
|
export declare const caseListFields = "case_createdByName,case_createdDate,case_lastModifiedDate,case_lastModifiedByName,id,uri,case_summary,case_status,case_product,case_version,case_accountNumber,case_number,case_contactName,case_owner,case_severity,case_last_public_update_date,case_last_public_update_by,case_customer_escalation,case_folderName,case_closedDate";
|
|
@@ -56,6 +56,7 @@ export declare const caseListSortColumnIdsToSFDCMap: {
|
|
|
56
56
|
type: SFDCKeys;
|
|
57
57
|
closedDate: SFDCKeys;
|
|
58
58
|
};
|
|
59
|
+
export declare const caseListSortColumnIdsToGraphQLMap: Record<string, string>;
|
|
59
60
|
export declare const caseTableColumSortNamesMap: {
|
|
60
61
|
number: string;
|
|
61
62
|
summary: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/enums/case.ts"],"names":[],"mappings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Y;IACnB,QAAQ,aAAa;IACrB,KAAK,gBAAgB;IACrB,OAAO,gBAAgB;IACvB,MAAM,WAAW;IACjB,QAAQ,qBAAqB;IAC7B,iBAAiB,YAAY;IAC7B,aAAa,kBAAkB;IAC/B,KAAK,eAAe;IACpB,eAAe,oBAAoB;IACnC,IAAI,SAAS;IACb,cAAc,eAAe;CAChC;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAGF,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWpE,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAatC,CAAC"}
|
package/lib/esm/enums/case.js
CHANGED
|
@@ -11,7 +11,7 @@ export var CaseSeverity;
|
|
|
11
11
|
(function (CaseSeverity) {
|
|
12
12
|
CaseSeverity["Urgent"] = "1 - Urgent";
|
|
13
13
|
CaseSeverity["Important"] = "2 - Important";
|
|
14
|
-
CaseSeverity["
|
|
14
|
+
CaseSeverity["Medium"] = "3 - Medium";
|
|
15
15
|
CaseSeverity["Low"] = "4 - Low";
|
|
16
16
|
})(CaseSeverity || (CaseSeverity = {}));
|
|
17
17
|
export const caseListFields = 'case_createdByName,case_createdDate,case_lastModifiedDate,case_lastModifiedByName,id,uri,case_summary,case_status,case_product,case_version,case_accountNumber,case_number,case_contactName,case_owner,case_severity,case_last_public_update_date,case_last_public_update_by,case_customer_escalation,case_folderName,case_closedDate';
|
|
@@ -59,6 +59,19 @@ export const caseListSortColumnIdsToSFDCMap = {
|
|
|
59
59
|
[CaseListColumnIds.type]: SFDCKeys.caseType,
|
|
60
60
|
[CaseListColumnIds.caseClosedDate]: SFDCKeys.caseClosedDate,
|
|
61
61
|
};
|
|
62
|
+
// Maps CaseListColumnIds to GraphQL SalesforceSupportCase_OrderBy field paths
|
|
63
|
+
export const caseListSortColumnIdsToGraphQLMap = {
|
|
64
|
+
[CaseListColumnIds.caseId]: 'CaseNumber',
|
|
65
|
+
[CaseListColumnIds.summary]: 'Subject',
|
|
66
|
+
[CaseListColumnIds.severity]: 'Priority',
|
|
67
|
+
[CaseListColumnIds.owner]: 'OwnerId',
|
|
68
|
+
[CaseListColumnIds.created]: 'CreatedDate',
|
|
69
|
+
[CaseListColumnIds.status]: 'Status',
|
|
70
|
+
[CaseListColumnIds.modified]: 'LastModifiedDate',
|
|
71
|
+
[CaseListColumnIds.accountNumber]: 'Account_Number__c',
|
|
72
|
+
[CaseListColumnIds.type]: 'Type',
|
|
73
|
+
[CaseListColumnIds.caseClosedDate]: 'ClosedDate',
|
|
74
|
+
};
|
|
62
75
|
export const caseTableColumSortNamesMap = {
|
|
63
76
|
[CaseListColumnIds.caseId]: 'Case ID',
|
|
64
77
|
[CaseListColumnIds.summary]: 'Title',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExportCaseListCSV.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useExportCaseListCSV.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExportCaseListCSV.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,MAAM,WAAW,qBAAqB;IAClC,uBAAuB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB;;;;;;EA+BhE"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { useFetch } from '@rh-support/components';
|
|
2
1
|
import { useState } from 'react';
|
|
3
2
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { getCaseListFromSolr } from '../utils/caseListUtils';
|
|
5
3
|
export const MAX_LIMIT = 1000;
|
|
6
4
|
export function useExportCaseListCSV(props) {
|
|
7
5
|
const { isExportCsvDisabled, selectedCases } = props;
|
|
8
6
|
const { t } = useTranslation();
|
|
9
|
-
// const currentFilteredCaseCount = currentFilteredCaseList?.numFound ?? 0;
|
|
10
|
-
const { isFetching } = useFetch(getCaseListFromSolr, { propgateErrors: true });
|
|
11
7
|
const [openUpdateSeverityModal, setOpenUpdateSeverityModal] = useState(false);
|
|
12
|
-
const isFetchingCSVData = isFetching;
|
|
13
8
|
let showError = selectedCases.length > MAX_LIMIT;
|
|
14
|
-
const isBtnDisabled =
|
|
15
|
-
// To show tooltip if export csv is disabled when SOLR is down
|
|
9
|
+
const isBtnDisabled = showError;
|
|
16
10
|
const getTooltipContent = () => {
|
|
17
11
|
let tooltipText = t('Your download will include the first 1000 cases in your list.');
|
|
18
12
|
if (showError) {
|
|
@@ -23,9 +17,7 @@ export function useExportCaseListCSV(props) {
|
|
|
23
17
|
}
|
|
24
18
|
return tooltipText;
|
|
25
19
|
};
|
|
26
|
-
// To check if export csv button is disabled
|
|
27
20
|
const isExportButtonDisabled = isBtnDisabled || isExportCsvDisabled;
|
|
28
|
-
// To toggle download csv modal
|
|
29
21
|
const toggleDownloadCSVModal = () => {
|
|
30
22
|
setOpenUpdateSeverityModal((openUpdateSeverityModal) => !openUpdateSeverityModal);
|
|
31
23
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApolloClient } from '@apollo/client';
|
|
2
|
+
import { ICaseListItem } from '@rh-support/utils';
|
|
3
|
+
import { ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
4
|
+
export interface IGraphQLCaseListResponse {
|
|
5
|
+
caseListResponse: {
|
|
6
|
+
response: {
|
|
7
|
+
docs: ICaseListItem[];
|
|
8
|
+
numFound: number;
|
|
9
|
+
start: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
showErrorMessage: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function clearPageCursors(): void;
|
|
15
|
+
export declare function getCaseListFromGraphQL(filterState: ICaseListFilterState, apolloClient: ApolloClient, limitOverride?: number, signal?: AbortSignal, selectedCaseNumbers?: string[]): Promise<IGraphQLCaseListResponse>;
|
|
16
|
+
//# sourceMappingURL=caseListGraphQLUtils.d.ts.map
|
|
@@ -0,0 +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,EAIH,aAAa,EAEhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+CAA+C,CAAC;AASrG,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;CAC7B;AAsBD,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,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CA+EnC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { GET_CASES_BY_FILTERS, GET_PRODUCTS, GET_USER_IDS_BY_FEDERATION, } from '@rh-support/utils';
|
|
11
|
+
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
12
|
+
import { mapGraphQLResponseToCaseList } from './caseListMapper';
|
|
13
|
+
import { createGraphQLVariablesFromFilterState, getOwnerFederationIdsToResolve, } from './caseListVariablesBuilder';
|
|
14
|
+
function resolveOwnerUserIds(federationIds, apolloClient) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
if (!federationIds.length)
|
|
18
|
+
return [];
|
|
19
|
+
try {
|
|
20
|
+
const { data } = yield apolloClient.query({
|
|
21
|
+
query: GET_USER_IDS_BY_FEDERATION,
|
|
22
|
+
variables: { federationIds },
|
|
23
|
+
fetchPolicy: 'network-only',
|
|
24
|
+
});
|
|
25
|
+
const edges = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportUser) === null || _c === void 0 ? void 0 : _c.edges) || [];
|
|
26
|
+
return edges.map((edge) => edge.node.Id);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('[GraphQL] Failed to resolve owner user IDs:', error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const pageCursors = new Map();
|
|
35
|
+
export function clearPageCursors() {
|
|
36
|
+
pageCursors.clear();
|
|
37
|
+
}
|
|
38
|
+
function getCursorForPage(page) {
|
|
39
|
+
var _a;
|
|
40
|
+
if (page <= 1)
|
|
41
|
+
return undefined;
|
|
42
|
+
return (_a = pageCursors.get(page)) !== null && _a !== void 0 ? _a : undefined;
|
|
43
|
+
}
|
|
44
|
+
function storeEndCursor(currentPage, endCursor) {
|
|
45
|
+
pageCursors.set(currentPage + 1, endCursor);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolves missing Product2 IDs for product/version filters loaded from URL.
|
|
49
|
+
* When filters come from the UI, IDs are already set by ProductsFilter/VersionsFilter.
|
|
50
|
+
* When filters come from a URL (which only contains product/version names), this function
|
|
51
|
+
* queries GraphQL to resolve names → IDs so buildProductFilter can construct the where clause.
|
|
52
|
+
* Uses cache-first policy to avoid redundant network calls.
|
|
53
|
+
*/
|
|
54
|
+
function resolveVersionProductIds(filterState, apolloClient) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
57
|
+
const products = (_a = filterState.filterInfo) === null || _a === void 0 ? void 0 : _a[SolrPivotKeys.product_version];
|
|
58
|
+
if (!(products === null || products === void 0 ? void 0 : products.length))
|
|
59
|
+
return;
|
|
60
|
+
for (const product of products) {
|
|
61
|
+
// Resolve parent product ID by name (only needed for URL-based filters)
|
|
62
|
+
if (!product.productId) {
|
|
63
|
+
try {
|
|
64
|
+
const { data: prodData } = yield apolloClient.query({
|
|
65
|
+
query: GET_PRODUCTS,
|
|
66
|
+
variables: {
|
|
67
|
+
where: { Name: { eq: product.value }, IsActive: { eq: true } },
|
|
68
|
+
first: 1,
|
|
69
|
+
},
|
|
70
|
+
fetchPolicy: 'cache-first',
|
|
71
|
+
});
|
|
72
|
+
const parentEdges = (_e = (_d = (_c = (_b = prodData === null || prodData === void 0 ? void 0 : prodData.salesforce_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.SalesforceSupportProduct2) === null || _d === void 0 ? void 0 : _d.edges) !== null && _e !== void 0 ? _e : [];
|
|
73
|
+
if (parentEdges.length > 0) {
|
|
74
|
+
product.productId = parentEdges[0].node.Id;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (_k) {
|
|
78
|
+
// continue without parent ID
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const versions = product[SolrKeys.version];
|
|
82
|
+
if (!(versions === null || versions === void 0 ? void 0 : versions.length) || !product.productId)
|
|
83
|
+
continue;
|
|
84
|
+
const hasUnresolvedVersions = versions.some((v) => v.productId === undefined || v.productId === null);
|
|
85
|
+
if (!hasUnresolvedVersions)
|
|
86
|
+
continue;
|
|
87
|
+
// Fetch child products for this parent and match version names to their Product2 IDs
|
|
88
|
+
try {
|
|
89
|
+
const { data } = yield apolloClient.query({
|
|
90
|
+
query: GET_PRODUCTS,
|
|
91
|
+
variables: {
|
|
92
|
+
where: { ParentProduct__c: { eq: product.productId }, IsActive: { eq: true } },
|
|
93
|
+
first: 200,
|
|
94
|
+
orderBy: { Name: { order: 'ASC' } },
|
|
95
|
+
},
|
|
96
|
+
fetchPolicy: 'cache-first',
|
|
97
|
+
});
|
|
98
|
+
const edges = (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _f === void 0 ? void 0 : _f.query) === null || _g === void 0 ? void 0 : _g.SalesforceSupportProduct2) === null || _h === void 0 ? void 0 : _h.edges) !== null && _j !== void 0 ? _j : [];
|
|
99
|
+
const childProducts = edges.map((edge) => ({
|
|
100
|
+
id: edge.node.Id,
|
|
101
|
+
name: edge.node.Name.value,
|
|
102
|
+
}));
|
|
103
|
+
versions.forEach((ver) => {
|
|
104
|
+
if (ver.productId)
|
|
105
|
+
return;
|
|
106
|
+
const match = childProducts.find((cp) => cp.name === ver.value || cp.name.endsWith(ver.value));
|
|
107
|
+
if (match) {
|
|
108
|
+
ver.productId = match.id;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error('[GraphQL] Failed to resolve version product IDs:', error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export function getCaseListFromGraphQL(filterState, apolloClient, limitOverride, signal, selectedCaseNumbers) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f;
|
|
121
|
+
try {
|
|
122
|
+
yield resolveVersionProductIds(filterState, apolloClient);
|
|
123
|
+
const federationIdsToResolve = getOwnerFederationIdsToResolve(filterState);
|
|
124
|
+
let resolvedUserIds;
|
|
125
|
+
if (federationIdsToResolve.length) {
|
|
126
|
+
const ownerUserIds = yield resolveOwnerUserIds(federationIdsToResolve, apolloClient);
|
|
127
|
+
resolvedUserIds = { ownerUserIds };
|
|
128
|
+
}
|
|
129
|
+
const variables = createGraphQLVariablesFromFilterState(filterState, resolvedUserIds);
|
|
130
|
+
if (limitOverride) {
|
|
131
|
+
variables.first = limitOverride;
|
|
132
|
+
}
|
|
133
|
+
const currentPage = ((_a = filterState.paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) || 1;
|
|
134
|
+
if (selectedCaseNumbers === null || selectedCaseNumbers === void 0 ? void 0 : selectedCaseNumbers.length) {
|
|
135
|
+
const caseNumberFilter = { CaseNumber__c: { in: selectedCaseNumbers } };
|
|
136
|
+
variables.first = selectedCaseNumbers.length;
|
|
137
|
+
if ((_b = variables.where) === null || _b === void 0 ? void 0 : _b.and) {
|
|
138
|
+
variables.where.and.push(caseNumberFilter);
|
|
139
|
+
}
|
|
140
|
+
else if (variables.where) {
|
|
141
|
+
variables.where = { and: [variables.where, caseNumberFilter] };
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
variables.where = caseNumberFilter;
|
|
145
|
+
}
|
|
146
|
+
variables.after = undefined;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
variables.after = getCursorForPage(currentPage);
|
|
150
|
+
}
|
|
151
|
+
const { data, error } = yield apolloClient.query({
|
|
152
|
+
query: GET_CASES_BY_FILTERS,
|
|
153
|
+
variables,
|
|
154
|
+
fetchPolicy: 'network-only',
|
|
155
|
+
context: signal ? { fetchOptions: { signal } } : undefined,
|
|
156
|
+
});
|
|
157
|
+
const connection = (_d = (_c = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _c === void 0 ? void 0 : _c.query) === null || _d === void 0 ? void 0 : _d.SalesforceSupportCase;
|
|
158
|
+
if (!connection) {
|
|
159
|
+
return {
|
|
160
|
+
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
161
|
+
showErrorMessage: !!error,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if ((_e = connection.pageInfo) === null || _e === void 0 ? void 0 : _e.endCursor) {
|
|
165
|
+
storeEndCursor(currentPage, connection.pageInfo.endCursor);
|
|
166
|
+
}
|
|
167
|
+
const docs = mapGraphQLResponseToCaseList(connection.edges || []);
|
|
168
|
+
return {
|
|
169
|
+
caseListResponse: {
|
|
170
|
+
response: {
|
|
171
|
+
docs,
|
|
172
|
+
numFound: connection.totalCount || 0,
|
|
173
|
+
start: 0,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
showErrorMessage: false,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'AbortError' || ((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.includes('aborted')) || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
181
|
+
return {
|
|
182
|
+
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
183
|
+
showErrorMessage: false,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
console.error('[GraphQL] getCaseListFromGraphQL error:', error);
|
|
187
|
+
return {
|
|
188
|
+
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
189
|
+
showErrorMessage: true,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ICaseListItem, IGqlCaseNode } from '@rh-support/utils';
|
|
2
|
+
export declare function mapGraphQLCaseToCaseListItem(node: IGqlCaseNode): ICaseListItem;
|
|
3
|
+
export declare function mapGraphQLResponseToCaseList(edges: Array<{
|
|
4
|
+
node: IGqlCaseNode;
|
|
5
|
+
}>): ICaseListItem[];
|
|
6
|
+
//# sourceMappingURL=caseListMapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caseListMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEhE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAgC9E;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,GAAG,aAAa,EAAE,CAElG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function mapGraphQLCaseToCaseListItem(node) {
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
3
|
+
const isEscalated = ((_a = node.IsEscalated) === null || _a === void 0 ? void 0 : _a.value) === true;
|
|
4
|
+
return {
|
|
5
|
+
id: node.Id || '',
|
|
6
|
+
case_number: ((_b = node.CaseNumber__c) === null || _b === void 0 ? void 0 : _b.value) || '',
|
|
7
|
+
case_summary: ((_c = node.Subject) === null || _c === void 0 ? void 0 : _c.value) || '',
|
|
8
|
+
case_status: ((_d = node.Status) === null || _d === void 0 ? void 0 : _d.value) || '',
|
|
9
|
+
case_severity: ((_e = node.Priority) === null || _e === void 0 ? void 0 : _e.value) || '',
|
|
10
|
+
case_product: ((_h = (_g = (_f = node.Product) === null || _f === void 0 ? void 0 : _f.ParentProduct__r) === null || _g === void 0 ? void 0 : _g.Name) === null || _h === void 0 ? void 0 : _h.value)
|
|
11
|
+
? [node.Product.ParentProduct__r.Name.value]
|
|
12
|
+
: ((_k = (_j = node.Product) === null || _j === void 0 ? void 0 : _j.Name) === null || _k === void 0 ? void 0 : _k.value)
|
|
13
|
+
? [node.Product.Name.value]
|
|
14
|
+
: [],
|
|
15
|
+
case_version: ((_m = (_l = node.Product) === null || _l === void 0 ? void 0 : _l.VersionName__c) === null || _m === void 0 ? void 0 : _m.value) || '',
|
|
16
|
+
case_type: ((_o = node.Type) === null || _o === void 0 ? void 0 : _o.value) || '',
|
|
17
|
+
case_accountNumber: ((_p = node.Account_Number__c) === null || _p === void 0 ? void 0 : _p.value) || '',
|
|
18
|
+
case_contactName: ((_r = (_q = node.Owner) === null || _q === void 0 ? void 0 : _q.Name) === null || _r === void 0 ? void 0 : _r.value) || '',
|
|
19
|
+
case_owner: ((_t = (_s = node.Owner) === null || _s === void 0 ? void 0 : _s.Name) === null || _t === void 0 ? void 0 : _t.value) || '',
|
|
20
|
+
case_createdByName: ((_v = (_u = node.CreatedBy) === null || _u === void 0 ? void 0 : _u.Name) === null || _v === void 0 ? void 0 : _v.value) || '',
|
|
21
|
+
case_createdDate: ((_w = node.CreatedDate) === null || _w === void 0 ? void 0 : _w.value) || '',
|
|
22
|
+
case_lastModifiedByName: ((_y = (_x = node.LastModifiedBy) === null || _x === void 0 ? void 0 : _x.Name) === null || _y === void 0 ? void 0 : _y.value) || '',
|
|
23
|
+
case_lastModifiedDate: ((_z = node.LastModifiedDate) === null || _z === void 0 ? void 0 : _z.value) || '',
|
|
24
|
+
case_last_public_update_by: ((_1 = (_0 = node.LastModifiedBy) === null || _0 === void 0 ? void 0 : _0.Name) === null || _1 === void 0 ? void 0 : _1.value) || '',
|
|
25
|
+
case_last_public_update_date: ((_2 = node.LastModifiedDate) === null || _2 === void 0 ? void 0 : _2.value) || '',
|
|
26
|
+
case_customer_escalation: isEscalated,
|
|
27
|
+
case_closedDate: ((_3 = node.ClosedDate) === null || _3 === void 0 ? void 0 : _3.value) || '',
|
|
28
|
+
case_folderName: '',
|
|
29
|
+
case_folderNumber: '',
|
|
30
|
+
case_alternate_id: '',
|
|
31
|
+
uri: '',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function mapGraphQLResponseToCaseList(edges) {
|
|
35
|
+
return edges.map((edge) => mapGraphQLCaseToCaseListItem(edge.node));
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
2
|
+
export declare function getOwnerFederationIdsToResolve(filterState: ICaseListFilterState): string[];
|
|
3
|
+
export interface IGraphQLCaseListVariables {
|
|
4
|
+
after?: string;
|
|
5
|
+
first: number;
|
|
6
|
+
where?: Record<string, unknown>;
|
|
7
|
+
orderBy?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface IResolvedUserIds {
|
|
10
|
+
ownerUserIds?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, resolvedUserIds?: IResolvedUserIds): IGraphQLCaseListVariables;
|
|
13
|
+
//# sourceMappingURL=caseListVariablesBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+CAA+C,CAAC;AAKrG,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAQ1F;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;CACrC;AAED,MAAM,WAAW,gBAAgB;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAkFD,wBAAgB,qCAAqC,CACjD,WAAW,EAAE,oBAAoB,EACjC,eAAe,CAAC,EAAE,gBAAgB,GACnC,yBAAyB,CAkF3B"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { getTechnicalSupportRecordTypeId } from '@rh-support/utils';
|
|
2
|
+
import { caseListSortColumnIdsToGraphQLMap } from '../enums/case';
|
|
3
|
+
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
4
|
+
import { expandStatusGroupsToApiValues } from './statusUtils';
|
|
5
|
+
export function getOwnerFederationIdsToResolve(filterState) {
|
|
6
|
+
const { filterInfo } = filterState;
|
|
7
|
+
if (!filterInfo)
|
|
8
|
+
return [];
|
|
9
|
+
const ownerSso = filterInfo[SolrKeys.caseOwner];
|
|
10
|
+
const contactSso = filterInfo[SolrKeys.caseContactSSO];
|
|
11
|
+
return [...new Set([...(ownerSso || []), ...(contactSso || [])])];
|
|
12
|
+
}
|
|
13
|
+
function buildOrderByFromSortInfo(sortInfo) {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!(sortInfo === null || sortInfo === void 0 ? void 0 : sortInfo.column))
|
|
16
|
+
return { LastModifiedDate: { order: 'DESC' } };
|
|
17
|
+
const gqlField = caseListSortColumnIdsToGraphQLMap[sortInfo.column];
|
|
18
|
+
if (!gqlField)
|
|
19
|
+
return { LastModifiedDate: { order: 'DESC' } };
|
|
20
|
+
return { [gqlField]: { order: ((_a = sortInfo.direction) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'DESC' } };
|
|
21
|
+
}
|
|
22
|
+
function flattenAccountNumbers(accountFilters) {
|
|
23
|
+
const numbers = [];
|
|
24
|
+
accountFilters.forEach((item) => {
|
|
25
|
+
if (Array.isArray(item.key)) {
|
|
26
|
+
numbers.push(...item.key);
|
|
27
|
+
}
|
|
28
|
+
else if (item.key) {
|
|
29
|
+
numbers.push(item.key);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return [...new Set(numbers)];
|
|
33
|
+
}
|
|
34
|
+
function buildStatusFilter(statuses) {
|
|
35
|
+
if (!(statuses === null || statuses === void 0 ? void 0 : statuses.length))
|
|
36
|
+
return undefined;
|
|
37
|
+
const expandedStatuses = expandStatusGroupsToApiValues(statuses);
|
|
38
|
+
return { Status: { in: expandedStatuses } };
|
|
39
|
+
}
|
|
40
|
+
function buildProductFilter(products) {
|
|
41
|
+
const conditions = [];
|
|
42
|
+
const parentProductIds = [];
|
|
43
|
+
const childProductIds = [];
|
|
44
|
+
products.forEach((product) => {
|
|
45
|
+
const versions = product[SolrKeys.version];
|
|
46
|
+
if (versions === null || versions === void 0 ? void 0 : versions.length) {
|
|
47
|
+
let hasVersionIds = false;
|
|
48
|
+
versions.forEach((version) => {
|
|
49
|
+
if (version.productId) {
|
|
50
|
+
childProductIds.push(version.productId);
|
|
51
|
+
hasVersionIds = true;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
// Fallback: if versions lack IDs (resolution failed), use parent product ID
|
|
55
|
+
if (!hasVersionIds && product.productId) {
|
|
56
|
+
parentProductIds.push(product.productId);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (product.productId) {
|
|
60
|
+
parentProductIds.push(product.productId);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
if (childProductIds.length) {
|
|
64
|
+
conditions.push({ ProductId: { in: childProductIds } });
|
|
65
|
+
}
|
|
66
|
+
if (parentProductIds.length) {
|
|
67
|
+
conditions.push({ Product: { ParentProduct__c: { in: parentProductIds } } });
|
|
68
|
+
}
|
|
69
|
+
return conditions;
|
|
70
|
+
}
|
|
71
|
+
function buildKeywordSearchFilter(queryString) {
|
|
72
|
+
if (!queryString)
|
|
73
|
+
return undefined;
|
|
74
|
+
const keyword = queryString.replace(/\*$/g, '').trim();
|
|
75
|
+
if (!keyword)
|
|
76
|
+
return undefined;
|
|
77
|
+
const caseNumberPattern = /^\d{8}$/;
|
|
78
|
+
if (caseNumberPattern.test(keyword)) {
|
|
79
|
+
return { CaseNumber__c: { eq: keyword } };
|
|
80
|
+
}
|
|
81
|
+
const likeValue = `%${keyword}%`;
|
|
82
|
+
return {
|
|
83
|
+
or: [{ Subject: { like: likeValue } }, { CaseNumber__c: { like: likeValue } }],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function createGraphQLVariablesFromFilterState(filterState, resolvedUserIds) {
|
|
87
|
+
var _a;
|
|
88
|
+
const { paginationInfo, sortInfo, filterInfo, filterQueryInfo } = filterState;
|
|
89
|
+
const first = (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.pageSize) || 10;
|
|
90
|
+
const orderBy = buildOrderByFromSortInfo(sortInfo);
|
|
91
|
+
const andConditions = [];
|
|
92
|
+
if (filterInfo) {
|
|
93
|
+
const statusFilter = buildStatusFilter(filterInfo[SolrKeys.status]);
|
|
94
|
+
if (statusFilter)
|
|
95
|
+
andConditions.push(statusFilter);
|
|
96
|
+
const severities = filterInfo[SolrKeys.severity];
|
|
97
|
+
if (severities === null || severities === void 0 ? void 0 : severities.length) {
|
|
98
|
+
andConditions.push({ Priority: { in: severities } });
|
|
99
|
+
}
|
|
100
|
+
const accounts = filterInfo[SolrKeys.accountNumber];
|
|
101
|
+
if (accounts === null || accounts === void 0 ? void 0 : accounts.length) {
|
|
102
|
+
const accountNumbers = flattenAccountNumbers(accounts);
|
|
103
|
+
if (accountNumbers.length) {
|
|
104
|
+
andConditions.push({ Account_Number__c: { in: accountNumbers } });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Product filter: uses stored parent/child Product2 IDs from filter state
|
|
108
|
+
const products = filterInfo[SolrPivotKeys.product_version];
|
|
109
|
+
if (products === null || products === void 0 ? void 0 : products.length) {
|
|
110
|
+
const productConditions = buildProductFilter(products);
|
|
111
|
+
if (productConditions.length === 1) {
|
|
112
|
+
andConditions.push(productConditions[0]);
|
|
113
|
+
}
|
|
114
|
+
else if (productConditions.length > 1) {
|
|
115
|
+
andConditions.push({ or: productConditions });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const types = filterInfo[SolrKeys.type];
|
|
119
|
+
if (types === null || types === void 0 ? void 0 : types.length) {
|
|
120
|
+
andConditions.push({ Type: { in: types } });
|
|
121
|
+
}
|
|
122
|
+
const createdBySso = filterInfo[SolrKeys.createdBySsoUsername];
|
|
123
|
+
const ssoOrConditions = [];
|
|
124
|
+
if ((_a = resolvedUserIds === null || resolvedUserIds === void 0 ? void 0 : resolvedUserIds.ownerUserIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
125
|
+
ssoOrConditions.push({ OwnerId: { in: resolvedUserIds.ownerUserIds } });
|
|
126
|
+
}
|
|
127
|
+
if (createdBySso === null || createdBySso === void 0 ? void 0 : createdBySso.length) {
|
|
128
|
+
ssoOrConditions.push({ CreatedBy: { FederationIdentifier: { in: createdBySso } } });
|
|
129
|
+
}
|
|
130
|
+
if (ssoOrConditions.length === 1) {
|
|
131
|
+
andConditions.push(ssoOrConditions[0]);
|
|
132
|
+
}
|
|
133
|
+
else if (ssoOrConditions.length > 1) {
|
|
134
|
+
andConditions.push({ or: ssoOrConditions });
|
|
135
|
+
}
|
|
136
|
+
// TODO: Add group filter (case_folderNumber) when GraphQL field is available
|
|
137
|
+
// TODO: Add case_alternate_id filter when GraphQL field is available
|
|
138
|
+
}
|
|
139
|
+
const escalation = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.escalation];
|
|
140
|
+
const technicalSupportId = getTechnicalSupportRecordTypeId();
|
|
141
|
+
if (technicalSupportId) {
|
|
142
|
+
andConditions.push({ RecordTypeId: { eq: technicalSupportId } });
|
|
143
|
+
}
|
|
144
|
+
if (escalation === null || escalation === void 0 ? void 0 : escalation.length) {
|
|
145
|
+
andConditions.push({ IsEscalated: { eq: true } });
|
|
146
|
+
}
|
|
147
|
+
if (filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString) {
|
|
148
|
+
const keywordFilter = buildKeywordSearchFilter(filterQueryInfo.queryString);
|
|
149
|
+
if (keywordFilter)
|
|
150
|
+
andConditions.push(keywordFilter);
|
|
151
|
+
}
|
|
152
|
+
let where;
|
|
153
|
+
if (andConditions.length === 1) {
|
|
154
|
+
where = andConditions[0];
|
|
155
|
+
}
|
|
156
|
+
else if (andConditions.length > 1) {
|
|
157
|
+
where = { and: andConditions };
|
|
158
|
+
}
|
|
159
|
+
return { first, where, orderBy };
|
|
160
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseSearchUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseSearchUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAkBxD,OAAO,EACH,oBAAoB,EACpB,WAAW,EAId,MAAM,+CAA+C,CAAC;AAOvD,OAAO,EAEH,mBAAmB,EAEtB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,eAAO,MAAM,6BAA6B,UAAU,CAAC;AACrD,eAAO,MAAM,oCAAoC,MAAM,CAAC;AACxD,eAAO,MAAM,iCAAiC,SAAS,CAAC;AACxD,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,iBAAS,8BAA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