@rh-support/cases 2.6.182 → 2.6.186
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 +7 -0
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +108 -143
- package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListContext.js +2 -5
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +4 -6
- package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListFilterReducer.js +12 -3
- package/lib/esm/components/case-list/CaseListReducer.d.ts +10 -22
- package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseListReducer.js +7 -25
- 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 +11 -18
- 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 +5 -4
- package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +7 -1
- 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 +15 -7
- package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +5 -2
- 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 +3 -1
- 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 +4 -5
- 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 +54 -15
- package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +3 -0
- 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 +44 -18
- package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +3 -0
- 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 +44 -14
- package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +3 -1
- 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 +32 -61
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +3 -7
- 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 +58 -69
- package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +5 -0
- 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 +68 -38
- 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 +15 -5
- 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 +3 -2
- package/lib/esm/components/case-list/case-search/AdvanceSearch.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/AdvanceSearch.js +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
- package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +0 -1
- 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 +1 -2
- package/lib/esm/css/caseList.css +22 -99
- package/lib/esm/enums/case.d.ts +1 -2
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +1 -14
- package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
- package/lib/esm/hooks/useExportCaseListCSV.js +9 -1
- package/lib/esm/test-utils/mockData.js +1 -1
- package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseSearchUtils.js +6 -28
- package/lib/esm/utils/constants.d.ts +1 -2
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +3 -14
- package/lib/esm/utils/mockSolrResponse.js +1 -1
- package/package.json +6 -7
- package/lib/esm/utils/caseListGraphQLUtils.d.ts +0 -28
- package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +0 -1
- package/lib/esm/utils/caseListGraphQLUtils.js +0 -244
- package/lib/esm/utils/caseListMapper.d.ts +0 -6
- package/lib/esm/utils/caseListMapper.d.ts.map +0 -1
- package/lib/esm/utils/caseListMapper.js +0 -36
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +0 -14
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +0 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +0 -193
- package/lib/esm/utils/statusUtils.d.ts +0 -3
- package/lib/esm/utils/statusUtils.d.ts.map +0 -1
- package/lib/esm/utils/statusUtils.js +0 -22
|
@@ -1,244 +0,0 @@
|
|
|
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, _g, _h, _j, _k;
|
|
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 = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, 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
|
-
hasNextPage: false,
|
|
163
|
-
endCursor: undefined,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
if ((_e = connection.pageInfo) === null || _e === void 0 ? void 0 : _e.endCursor) {
|
|
167
|
-
storeEndCursor(currentPage, connection.pageInfo.endCursor);
|
|
168
|
-
}
|
|
169
|
-
const docs = mapGraphQLResponseToCaseList(connection.edges || []);
|
|
170
|
-
return {
|
|
171
|
-
caseListResponse: {
|
|
172
|
-
response: {
|
|
173
|
-
docs,
|
|
174
|
-
numFound: connection.totalCount || 0,
|
|
175
|
-
start: 0,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
showErrorMessage: false,
|
|
179
|
-
hasNextPage: (_g = (_f = connection.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage) !== null && _g !== void 0 ? _g : false,
|
|
180
|
-
endCursor: (_j = (_h = connection.pageInfo) === null || _h === void 0 ? void 0 : _h.endCursor) !== null && _j !== void 0 ? _j : undefined,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
if ((error === null || error === void 0 ? void 0 : error.name) === 'AbortError' || ((_k = error === null || error === void 0 ? void 0 : error.message) === null || _k === void 0 ? void 0 : _k.includes('aborted')) || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
185
|
-
return {
|
|
186
|
-
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
187
|
-
showErrorMessage: false,
|
|
188
|
-
hasNextPage: false,
|
|
189
|
-
endCursor: undefined,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
console.error('[GraphQL] getCaseListFromGraphQL error:', error);
|
|
193
|
-
return {
|
|
194
|
-
caseListResponse: { response: { docs: [], numFound: 0, start: 0 } },
|
|
195
|
-
showErrorMessage: true,
|
|
196
|
-
hasNextPage: false,
|
|
197
|
-
endCursor: undefined,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Fetches the next page of cases for infinite scroll.
|
|
204
|
-
* Uses the provided `afterCursor` instead of the page-based cursor store.
|
|
205
|
-
*/
|
|
206
|
-
export function loadMoreCases(filterState, apolloClient, afterCursor, signal) {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
209
|
-
try {
|
|
210
|
-
yield resolveVersionProductIds(filterState, apolloClient);
|
|
211
|
-
const federationIdsToResolve = getOwnerFederationIdsToResolve(filterState);
|
|
212
|
-
let resolvedUserIds;
|
|
213
|
-
if (federationIdsToResolve.length) {
|
|
214
|
-
const ownerUserIds = yield resolveOwnerUserIds(federationIdsToResolve, apolloClient);
|
|
215
|
-
resolvedUserIds = { ownerUserIds };
|
|
216
|
-
}
|
|
217
|
-
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
218
|
-
variables.after = afterCursor;
|
|
219
|
-
const { data } = yield apolloClient.query({
|
|
220
|
-
query: GET_CASES_BY_FILTERS,
|
|
221
|
-
variables,
|
|
222
|
-
fetchPolicy: 'network-only',
|
|
223
|
-
context: signal ? { fetchOptions: { signal } } : undefined,
|
|
224
|
-
});
|
|
225
|
-
const connection = (_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.SalesforceSupportCase;
|
|
226
|
-
if (!connection) {
|
|
227
|
-
return { docs: [], hasNextPage: false, endCursor: undefined };
|
|
228
|
-
}
|
|
229
|
-
const docs = mapGraphQLResponseToCaseList(connection.edges || []);
|
|
230
|
-
return {
|
|
231
|
-
docs,
|
|
232
|
-
hasNextPage: (_d = (_c = connection.pageInfo) === null || _c === void 0 ? void 0 : _c.hasNextPage) !== null && _d !== void 0 ? _d : false,
|
|
233
|
-
endCursor: (_f = (_e = connection.pageInfo) === null || _e === void 0 ? void 0 : _e.endCursor) !== null && _f !== void 0 ? _f : undefined,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
if ((error === null || error === void 0 ? void 0 : error.name) === 'AbortError' || ((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.includes('aborted')) || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
238
|
-
return { docs: [], hasNextPage: false, endCursor: undefined };
|
|
239
|
-
}
|
|
240
|
-
console.error('[GraphQL] loadMoreCases error:', error);
|
|
241
|
-
throw error;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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, _4;
|
|
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.SalesforceSupportContact) === 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: ((_4 = node.AlternateCaseId__c) === null || _4 === void 0 ? void 0 : _4.value) || '',
|
|
31
|
-
uri: '',
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export function mapGraphQLResponseToCaseList(edges) {
|
|
35
|
-
return edges.map((edge) => mapGraphQLCaseToCaseListItem(edge.node));
|
|
36
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ApolloClient } from '@apollo/client';
|
|
2
|
-
import { ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
3
|
-
export declare function getOwnerFederationIdsToResolve(filterState: ICaseListFilterState): string[];
|
|
4
|
-
export interface IGraphQLCaseListVariables {
|
|
5
|
-
after?: string;
|
|
6
|
-
first: number;
|
|
7
|
-
where?: Record<string, unknown>;
|
|
8
|
-
orderBy?: Record<string, unknown>;
|
|
9
|
-
}
|
|
10
|
-
export interface IResolvedUserIds {
|
|
11
|
-
ownerUserIds?: string[];
|
|
12
|
-
}
|
|
13
|
-
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, apolloClient: ApolloClient, resolvedUserIds?: IResolvedUserIds): Promise<IGraphQLCaseListVariables>;
|
|
14
|
-
//# sourceMappingURL=caseListVariablesBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+CAA+C,CAAC;AAKrG,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAW1F;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;AAoGD,wBAAsB,qCAAqC,CACvD,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,eAAe,CAAC,EAAE,gBAAgB,GACnC,OAAO,CAAC,yBAAyB,CAAC,CAkFpC"}
|
|
@@ -1,193 +0,0 @@
|
|
|
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_CONTACT_BY_SSO, getTechnicalSupportRecordTypeId } from '@rh-support/utils';
|
|
11
|
-
import { caseListSortColumnIdsToGraphQLMap } from '../enums/case';
|
|
12
|
-
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
13
|
-
import { expandStatusGroupsToApiValues } from './statusUtils';
|
|
14
|
-
export function getOwnerFederationIdsToResolve(filterState) {
|
|
15
|
-
const { filterInfo } = filterState;
|
|
16
|
-
if (!filterInfo)
|
|
17
|
-
return [];
|
|
18
|
-
const ownerSso = filterInfo[SolrKeys.caseOwner];
|
|
19
|
-
const contactSso = filterInfo[SolrKeys.caseContactSSO];
|
|
20
|
-
const contactSsoSet = new Set(contactSso || []);
|
|
21
|
-
const filteredOwnerSso = (ownerSso || []).filter((sso) => !contactSsoSet.has(sso));
|
|
22
|
-
return [...new Set(filteredOwnerSso)];
|
|
23
|
-
}
|
|
24
|
-
function buildOrderByFromSortInfo(sortInfo) {
|
|
25
|
-
var _a;
|
|
26
|
-
if (!(sortInfo === null || sortInfo === void 0 ? void 0 : sortInfo.column))
|
|
27
|
-
return { LastModifiedDate: { order: 'DESC' } };
|
|
28
|
-
const gqlField = caseListSortColumnIdsToGraphQLMap[sortInfo.column];
|
|
29
|
-
if (!gqlField)
|
|
30
|
-
return { LastModifiedDate: { order: 'DESC' } };
|
|
31
|
-
return { [gqlField]: { order: ((_a = sortInfo.direction) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'DESC' } };
|
|
32
|
-
}
|
|
33
|
-
function flattenAccountNumbers(accountFilters) {
|
|
34
|
-
const numbers = [];
|
|
35
|
-
accountFilters.forEach((item) => {
|
|
36
|
-
if (Array.isArray(item.key)) {
|
|
37
|
-
numbers.push(...item.key);
|
|
38
|
-
}
|
|
39
|
-
else if (item.key) {
|
|
40
|
-
numbers.push(item.key);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return [...new Set(numbers)];
|
|
44
|
-
}
|
|
45
|
-
function buildStatusFilter(statuses) {
|
|
46
|
-
if (!(statuses === null || statuses === void 0 ? void 0 : statuses.length))
|
|
47
|
-
return undefined;
|
|
48
|
-
const expandedStatuses = expandStatusGroupsToApiValues(statuses);
|
|
49
|
-
return { Status: { in: expandedStatuses } };
|
|
50
|
-
}
|
|
51
|
-
function buildProductFilter(products) {
|
|
52
|
-
const conditions = [];
|
|
53
|
-
const parentProductIds = [];
|
|
54
|
-
const childProductIds = [];
|
|
55
|
-
products.forEach((product) => {
|
|
56
|
-
const versions = product[SolrKeys.version];
|
|
57
|
-
if (versions === null || versions === void 0 ? void 0 : versions.length) {
|
|
58
|
-
let hasVersionIds = false;
|
|
59
|
-
versions.forEach((version) => {
|
|
60
|
-
if (version.productId) {
|
|
61
|
-
childProductIds.push(version.productId);
|
|
62
|
-
hasVersionIds = true;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
// Fallback: if versions lack IDs (resolution failed), use parent product ID
|
|
66
|
-
if (!hasVersionIds && product.productId) {
|
|
67
|
-
parentProductIds.push(product.productId);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else if (product.productId) {
|
|
71
|
-
parentProductIds.push(product.productId);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (childProductIds.length) {
|
|
75
|
-
conditions.push({ ProductId: { in: childProductIds } });
|
|
76
|
-
}
|
|
77
|
-
if (parentProductIds.length) {
|
|
78
|
-
conditions.push({ Product: { ParentProduct__c: { in: parentProductIds } } });
|
|
79
|
-
}
|
|
80
|
-
return conditions;
|
|
81
|
-
}
|
|
82
|
-
function buildKeywordSearchFilter(queryString) {
|
|
83
|
-
if (!queryString)
|
|
84
|
-
return undefined;
|
|
85
|
-
const keyword = queryString.replace(/\*$/g, '').trim();
|
|
86
|
-
if (!keyword)
|
|
87
|
-
return undefined;
|
|
88
|
-
const caseNumberPattern = /^\d{8}$/;
|
|
89
|
-
if (caseNumberPattern.test(keyword)) {
|
|
90
|
-
return { CaseNumber__c: { eq: keyword } };
|
|
91
|
-
}
|
|
92
|
-
const likeValue = `%${keyword}%`;
|
|
93
|
-
return {
|
|
94
|
-
or: [{ Subject: { like: likeValue } }, { CaseNumber__c: { like: likeValue } }],
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function resolveContactIdBySso(ssoUsername, apolloClient) {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
var _a, _b, _c, _d, _e;
|
|
100
|
-
if (!ssoUsername)
|
|
101
|
-
return undefined;
|
|
102
|
-
try {
|
|
103
|
-
const { data } = yield apolloClient.query({
|
|
104
|
-
query: GET_CONTACT_BY_SSO,
|
|
105
|
-
variables: { ssoUsername },
|
|
106
|
-
fetchPolicy: 'cache-first',
|
|
107
|
-
});
|
|
108
|
-
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.SalesforceSupportContact) === null || _c === void 0 ? void 0 : _c.edges) || [];
|
|
109
|
-
return (_e = (_d = edges[0]) === null || _d === void 0 ? void 0 : _d.node) === null || _e === void 0 ? void 0 : _e.Id;
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
console.error('[GraphQL] Failed to resolve contact ID by SSO:', error);
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
export function createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds) {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
var _a;
|
|
120
|
-
const { paginationInfo, sortInfo, filterInfo, filterQueryInfo } = filterState;
|
|
121
|
-
const first = (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.pageSize) || 10;
|
|
122
|
-
const orderBy = buildOrderByFromSortInfo(sortInfo);
|
|
123
|
-
const andConditions = [];
|
|
124
|
-
if (filterInfo) {
|
|
125
|
-
const statusFilter = buildStatusFilter(filterInfo[SolrKeys.status]);
|
|
126
|
-
if (statusFilter)
|
|
127
|
-
andConditions.push(statusFilter);
|
|
128
|
-
const severities = filterInfo[SolrKeys.severity];
|
|
129
|
-
if (severities === null || severities === void 0 ? void 0 : severities.length) {
|
|
130
|
-
andConditions.push({ Priority: { in: severities } });
|
|
131
|
-
}
|
|
132
|
-
const accounts = filterInfo[SolrKeys.accountNumber];
|
|
133
|
-
if (accounts === null || accounts === void 0 ? void 0 : accounts.length) {
|
|
134
|
-
const accountNumbers = flattenAccountNumbers(accounts);
|
|
135
|
-
if (accountNumbers.length) {
|
|
136
|
-
andConditions.push({ Account_Number__c: { in: accountNumbers } });
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// Product filter: uses stored parent/child Product2 IDs from filter state
|
|
140
|
-
const products = filterInfo[SolrPivotKeys.product_version];
|
|
141
|
-
if (products === null || products === void 0 ? void 0 : products.length) {
|
|
142
|
-
const productConditions = buildProductFilter(products);
|
|
143
|
-
if (productConditions.length === 1) {
|
|
144
|
-
andConditions.push(productConditions[0]);
|
|
145
|
-
}
|
|
146
|
-
else if (productConditions.length > 1) {
|
|
147
|
-
andConditions.push({ or: productConditions });
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
const types = filterInfo[SolrKeys.type];
|
|
151
|
-
if (types === null || types === void 0 ? void 0 : types.length) {
|
|
152
|
-
andConditions.push({ Type: { in: types } });
|
|
153
|
-
}
|
|
154
|
-
const createdBySso = filterInfo[SolrKeys.createdBySsoUsername];
|
|
155
|
-
const contactSso = filterInfo[SolrKeys.caseContactSSO];
|
|
156
|
-
if ((_a = resolvedUserIds === null || resolvedUserIds === void 0 ? void 0 : resolvedUserIds.ownerUserIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
157
|
-
andConditions.push({ OwnerId: { in: resolvedUserIds.ownerUserIds } });
|
|
158
|
-
}
|
|
159
|
-
if (createdBySso === null || createdBySso === void 0 ? void 0 : createdBySso.length) {
|
|
160
|
-
andConditions.push({ CreatedBy: { FederationIdentifier: { in: createdBySso } } });
|
|
161
|
-
}
|
|
162
|
-
if (contactSso === null || contactSso === void 0 ? void 0 : contactSso.length) {
|
|
163
|
-
const contactId = yield resolveContactIdBySso(contactSso[0], apolloClient);
|
|
164
|
-
if (contactId) {
|
|
165
|
-
andConditions.push({ ContactId: { eq: contactId } });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// TODO: Add group filter (case_folderNumber) when GraphQL field is available
|
|
169
|
-
// TODO: Add case_alternate_id filter when GraphQL field is available
|
|
170
|
-
}
|
|
171
|
-
const escalation = filterInfo === null || filterInfo === void 0 ? void 0 : filterInfo[SolrKeys.escalation];
|
|
172
|
-
const technicalSupportId = getTechnicalSupportRecordTypeId();
|
|
173
|
-
if (technicalSupportId) {
|
|
174
|
-
andConditions.push({ RecordTypeId: { eq: technicalSupportId } });
|
|
175
|
-
}
|
|
176
|
-
if (escalation === null || escalation === void 0 ? void 0 : escalation.length) {
|
|
177
|
-
andConditions.push({ IsEscalated: { eq: true } });
|
|
178
|
-
}
|
|
179
|
-
if (filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString) {
|
|
180
|
-
const keywordFilter = buildKeywordSearchFilter(filterQueryInfo.queryString);
|
|
181
|
-
if (keywordFilter)
|
|
182
|
-
andConditions.push(keywordFilter);
|
|
183
|
-
}
|
|
184
|
-
let where;
|
|
185
|
-
if (andConditions.length === 1) {
|
|
186
|
-
where = andConditions[0];
|
|
187
|
-
}
|
|
188
|
-
else if (andConditions.length > 1) {
|
|
189
|
-
where = { and: andConditions };
|
|
190
|
-
}
|
|
191
|
-
return { first, where, orderBy };
|
|
192
|
-
});
|
|
193
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"statusUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/statusUtils.ts"],"names":[],"mappings":"AAEA,wBAAgB,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWlF;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAOtE"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { PORTAL_STATUS_GROUPS } from './constants';
|
|
2
|
-
export function expandStatusGroupsToApiValues(selectedStatuses) {
|
|
3
|
-
const expanded = [];
|
|
4
|
-
selectedStatuses.forEach((status) => {
|
|
5
|
-
const group = PORTAL_STATUS_GROUPS[status];
|
|
6
|
-
if (group) {
|
|
7
|
-
expanded.push(...group);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
expanded.push(status);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
return expanded;
|
|
14
|
-
}
|
|
15
|
-
export function mapSfdcStatusToPortalStatus(sfdcStatus) {
|
|
16
|
-
for (const [portalStatus, sfdcStatuses] of Object.entries(PORTAL_STATUS_GROUPS)) {
|
|
17
|
-
if (sfdcStatuses.includes(sfdcStatus)) {
|
|
18
|
-
return portalStatus;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return sfdcStatus;
|
|
22
|
-
}
|