@rh-support/cases 2.6.168 → 2.6.170

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.
Files changed (89) hide show
  1. package/lib/esm/components/case-list/CaseList.d.ts +0 -7
  2. package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
  3. package/lib/esm/components/case-list/CaseList.js +116 -111
  4. package/lib/esm/components/case-list/CaseListContext.d.ts.map +1 -1
  5. package/lib/esm/components/case-list/CaseListContext.js +0 -2
  6. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts +6 -1
  7. package/lib/esm/components/case-list/CaseListFilterReducer.d.ts.map +1 -1
  8. package/lib/esm/components/case-list/CaseListFilterReducer.js +4 -1
  9. package/lib/esm/components/case-list/CaseListReducer.d.ts +2 -8
  10. package/lib/esm/components/case-list/CaseListReducer.d.ts.map +1 -1
  11. package/lib/esm/components/case-list/CaseListReducer.js +1 -13
  12. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.d.ts.map +1 -1
  13. package/lib/esm/components/case-list/case-list-filters/AccountsFilter.js +18 -11
  14. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.d.ts.map +1 -1
  15. package/lib/esm/components/case-list/case-list-filters/AdditionalFilters.js +28 -3
  16. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts +1 -7
  17. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.d.ts.map +1 -1
  18. package/lib/esm/components/case-list/case-list-filters/CaseListFilterChips.js +7 -15
  19. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts +2 -5
  20. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.d.ts.map +1 -1
  21. package/lib/esm/components/case-list/case-list-filters/CaseListFilters.js +14 -14
  22. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts +1 -3
  23. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.d.ts.map +1 -1
  24. package/lib/esm/components/case-list/case-list-filters/ProductFilterChip.js +2 -2
  25. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts +5 -4
  26. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.d.ts.map +1 -1
  27. package/lib/esm/components/case-list/case-list-filters/ProductsFilter.js +15 -54
  28. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts +0 -3
  29. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.d.ts.map +1 -1
  30. package/lib/esm/components/case-list/case-list-filters/SeverityFilter.js +18 -44
  31. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts +0 -3
  32. package/lib/esm/components/case-list/case-list-filters/StatusFilter.d.ts.map +1 -1
  33. package/lib/esm/components/case-list/case-list-filters/StatusFilter.js +14 -44
  34. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts +1 -3
  35. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.d.ts.map +1 -1
  36. package/lib/esm/components/case-list/case-list-filters/VersionsFilter.js +61 -32
  37. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +0 -1
  38. package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts.map +1 -1
  39. package/lib/esm/components/case-list/case-list-table/CaseListTable.js +9 -8
  40. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts +0 -5
  41. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.d.ts.map +1 -1
  42. package/lib/esm/components/case-list/case-list-table/DownloadCSVFileModal.js +38 -68
  43. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.d.ts.map +1 -1
  44. package/lib/esm/components/case-list/case-list-table/ExportCaseListCSV.js +5 -15
  45. package/lib/esm/components/case-list/case-list-table/SeverityLabel.js +1 -1
  46. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.d.ts.map +1 -1
  47. package/lib/esm/components/case-list/case-list-table/TableActionsDropdown.js +2 -3
  48. package/lib/esm/components/case-list/case-search/AdvanceSearch.d.ts.map +1 -1
  49. package/lib/esm/components/case-list/case-search/AdvanceSearch.js +2 -2
  50. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.d.ts.map +1 -1
  51. package/lib/esm/components/case-list/case-search/BookmarkedSearchesSelector.js +1 -0
  52. package/lib/esm/components/case-list/case-search/CaseSearch.d.ts.map +1 -1
  53. package/lib/esm/components/case-list/case-search/CaseSearch.js +6 -6
  54. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.d.ts.map +1 -1
  55. package/lib/esm/components/case-list/case-search/useAdvanceSearchParser.js +4 -1
  56. package/lib/esm/css/caseList.css +0 -2
  57. package/lib/esm/enums/case.d.ts +2 -1
  58. package/lib/esm/enums/case.d.ts.map +1 -1
  59. package/lib/esm/enums/case.js +14 -1
  60. package/lib/esm/enums/caseSearch.d.ts +2 -0
  61. package/lib/esm/enums/caseSearch.d.ts.map +1 -1
  62. package/lib/esm/enums/caseSearch.js +1 -0
  63. package/lib/esm/enums/filters.d.ts +3 -1
  64. package/lib/esm/enums/filters.d.ts.map +1 -1
  65. package/lib/esm/enums/filters.js +2 -0
  66. package/lib/esm/hooks/useExportCaseListCSV.d.ts.map +1 -1
  67. package/lib/esm/hooks/useExportCaseListCSV.js +1 -9
  68. package/lib/esm/models/caseList.d.ts +0 -2
  69. package/lib/esm/models/caseList.d.ts.map +1 -1
  70. package/lib/esm/test-utils/mockData.js +1 -1
  71. package/lib/esm/utils/caseListGraphQLUtils.d.ts +16 -0
  72. package/lib/esm/utils/caseListGraphQLUtils.d.ts.map +1 -0
  73. package/lib/esm/utils/caseListGraphQLUtils.js +193 -0
  74. package/lib/esm/utils/caseListMapper.d.ts +6 -0
  75. package/lib/esm/utils/caseListMapper.d.ts.map +1 -0
  76. package/lib/esm/utils/caseListMapper.js +36 -0
  77. package/lib/esm/utils/caseListVariablesBuilder.d.ts +13 -0
  78. package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -0
  79. package/lib/esm/utils/caseListVariablesBuilder.js +160 -0
  80. package/lib/esm/utils/caseSearchUtils.d.ts.map +1 -1
  81. package/lib/esm/utils/caseSearchUtils.js +51 -10
  82. package/lib/esm/utils/constants.d.ts +2 -0
  83. package/lib/esm/utils/constants.d.ts.map +1 -1
  84. package/lib/esm/utils/constants.js +14 -0
  85. package/lib/esm/utils/mockSolrResponse.js +1 -1
  86. package/lib/esm/utils/statusUtils.d.ts +3 -0
  87. package/lib/esm/utils/statusUtils.d.ts.map +1 -0
  88. package/lib/esm/utils/statusUtils.js +22 -0
  89. package/package.json +7 -7
@@ -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;AAU7B,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,8BAA8B,CACnC,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,aAAa,GAAE,MAAM,EAAO,OA8D/B;AAED,iBAAS,sCAAsC,CAC3C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,EAChC,WAAW,EAAE,MAAM,EACnB,eAAe,GAAE,OAAe,UA2BnC;AAED,iBAAS,oDAAoD,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,UAsDlH;AAkBD,iBAAS,wCAAwC,CAC7C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,EAChC,OAAO,EAAE,MAAM,EACf,eAAe,QAAK,UA6BvB;AASD,iBAAS,yBAAyB,CAC9B,WAAW,EAAE,oBAAoB,EACjC,kBAAkB,EAAE,QAAQ,EAC5B,oBAAoB,KAAA,EACpB,aAAa,GAAE,MAAM,EAAO,EAC5B,UAAU,SAAI,EACd,UAAU,SAAO,OAoBpB;AAkBD,iBAAS,8BAA8B,CACnC,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,EACtC,aAAa,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,eAAe,CAAC,CAkE1B;AAED,iBAAS,6BAA6B,CAAC,QAAQ,GAAE,qBAAqB,EAAO,GAAG,qBAAqB,EAAE,CAEtG;AAcD,iBAAS,6BAA6B,CAAC,WAAW,EAAE,oBAAoB,UAUvE;AAED,iBAAS,6BAA6B,CAClC,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,oBAAoB,EACzC,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,GAAE,mBAA+C,wBAsD9D;AAGD,iBAAS,kCAAkC,CACvC,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,oBAAoB,EACzC,kBAAkB,EAAE,oBAAoB,EACxC,WAAW,GAAE,MAAW,EACxB,IAAI,GAAE,mBAA+C,wBA+DxD;AA0KD,OAAO,EACH,8BAA8B,EAC9B,sCAAsC,EACtC,oDAAoD,EACpD,yBAAyB,EACzB,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,wCAAwC,EACxC,kCAAkC,GACrC,CAAC"}
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,8BAA8B,CACnC,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,aAAa,GAAE,MAAM,EAAO,OAgE/B;AAED,iBAAS,sCAAsC,CAC3C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,EAChC,WAAW,EAAE,MAAM,EACnB,eAAe,GAAE,OAAe,UA2BnC;AAED,iBAAS,oDAAoD,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,UA+DlH;AAkBD,iBAAS,wCAAwC,CAC7C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,EAChC,OAAO,EAAE,MAAM,EACf,eAAe,QAAK,UA6BvB;AASD,iBAAS,yBAAyB,CAC9B,WAAW,EAAE,oBAAoB,EACjC,kBAAkB,EAAE,QAAQ,EAC5B,oBAAoB,KAAA,EACpB,aAAa,GAAE,MAAM,EAAO,EAC5B,UAAU,SAAI,EACd,UAAU,SAAO,OAoBpB;AAkBD,iBAAS,8BAA8B,CACnC,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,QAAQ,EACtB,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,EACtC,aAAa,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,eAAe,CAAC,CAkE1B;AAED,iBAAS,6BAA6B,CAAC,QAAQ,GAAE,qBAAqB,EAAO,GAAG,qBAAqB,EAAE,CAEtG;AAoBD,iBAAS,6BAA6B,CAAC,WAAW,EAAE,oBAAoB,UAUvE;AAED,iBAAS,6BAA6B,CAClC,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,oBAAoB,EACzC,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,GAAE,mBAA+C,wBA0D9D;AAGD,iBAAS,kCAAkC,CACvC,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,oBAAoB,EACzC,kBAAkB,EAAE,oBAAoB,EACxC,WAAW,GAAE,MAAW,EACxB,IAAI,GAAE,mBAA+C,wBAmExD;AA0LD,OAAO,EACH,8BAA8B,EAC9B,sCAAsC,EACtC,oDAAoD,EACpD,yBAAyB,EACzB,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,wCAAwC,EACxC,kCAAkC,GACrC,CAAC"}
@@ -19,7 +19,7 @@ import { getLabel } from '../components/case-list/case-list-filters/AccountsBook
19
19
  import { initialCaseFilterState } from '../components/case-list/CaseListFilterContext';
20
20
  import { CaseListColumnIds, caseListSortColumnIdsToSFDCMap, caseListSortColumnIdsToSolrMap, CaseStatus, } from '../enums/case';
21
21
  import { advanceSearchFieldNameToSolrFieldMapping, CaseSearchQueryType, fieldNameToSolrFieldMapping, } from '../enums/caseSearch';
22
- import { AdditionalFilterLabels, advancedSearchMap, ProductVersionKey, sfdcFieldToSolrMap, SolrKeys, SolrPivotKeys, SolrTags, } from '../enums/filters';
22
+ import { AdditionalFilterLabels, advancedSearchMap, ProductVersionKey, sfdcFieldToSolrMap, SFDCKeys, SolrKeys, SolrPivotKeys, SolrTags, } from '../enums/filters';
23
23
  export const FILTER_URL_QUERY_SEARCH_PARAM = 'query';
24
24
  export const FILTER_URL_CURRENT_PAGE_SEARCH_PARAM = 'p';
25
25
  export const FILTER_URL_PAGE_SIZE_SEARCH_PARAM = 'size';
@@ -35,6 +35,7 @@ function createSolrQueryFromFilterState(filterState, loggedInUser, selectedCases
35
35
  const filteredGroups = filterInfo[SolrKeys.group].map((item) => item.key);
36
36
  const start = (currentPage - 1) * pageSize;
37
37
  const escalationValue = filterInfo[SolrKeys.escalation].map((item) => item.key);
38
+ const isPrivateValue = filterInfo[SolrKeys.isPrivate].map((item) => item.key);
38
39
  // When user selects a group of accounts, multiple accounts are selected and are passed in an array.
39
40
  // We need to spread them
40
41
  let filteredAccounts = filterInfo[SolrKeys.accountNumber].reduce((acc, item) => (Array.isArray(item.key) ? [...acc, ...item.key] : [...acc, item.key]), []);
@@ -52,7 +53,7 @@ function createSolrQueryFromFilterState(filterState, loggedInUser, selectedCases
52
53
  'f.case_product.facet.limit': -1,
53
54
  'f.case_version.facet.pivot.limit': -1,
54
55
  'f.case_version.facet.pivot.mincount': 1,
55
- fl: '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_alternate_id,case_type,case_closedDate',
56
+ fl: '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_alternate_id,case_type,case_closedDate,case_private',
56
57
  })
57
58
  .facetField(SolrKeys.product, [SolrTags.c_product])
58
59
  .facetField(SolrKeys.severity, [SolrTags.c_severity])
@@ -65,6 +66,7 @@ function createSolrQueryFromFilterState(filterState, loggedInUser, selectedCases
65
66
  .fq(SolrKeys.group, filteredGroups)
66
67
  .fq(SolrKeys.accountNumber, filteredAccounts)
67
68
  .fq(SolrKeys.escalation, escalationValue)
69
+ .fq(SolrKeys.isPrivate, isPrivateValue)
68
70
  .fq(SolrKeys.type, filterInfo[SolrKeys.type], [SolrTags.c_type])
69
71
  .fq(SolrKeys.caseNumber, selectedCases)
70
72
  .beginOr()
@@ -88,7 +90,7 @@ function createUserFriendlyQueryFromFilterState(filterInfo, filterQuery, useKeyF
88
90
  : _filterKey === SolrKeys.type
89
91
  ? toNewCaseTypeMapper(filterInfo[_filterKey])
90
92
  : filterInfo[_filterKey];
91
- if (_filterKey !== ProductVersionKey) {
93
+ if (_filterKey !== ProductVersionKey && _filterKey !== SolrKeys.product) {
92
94
  Array.isArray(fieldValue) && fieldValue.length > 0 && solrQuery.where(fieldLabel).in(flatMap(fieldValue));
93
95
  }
94
96
  });
@@ -108,11 +110,15 @@ function createUserFriendlyQueryFromFilterStateAdvancedSearch(filterInfo, filter
108
110
  ? fieldNameToSolrFieldMapping[_filterKey]
109
111
  : _filterKey;
110
112
  const fieldValue = isKeyValuePair(filterInfo[_filterKey])
111
- ? filterInfo[_filterKey].map((item) => (_filterKey === SolrKeys.accountNumber ? item.key : item.value))
113
+ ? filterInfo[_filterKey].map((item) => _filterKey === SolrKeys.accountNumber ||
114
+ _filterKey === SolrKeys.isPrivate ||
115
+ _filterKey === SolrKeys.escalation
116
+ ? item.key
117
+ : item.value)
112
118
  : _filterKey === SolrKeys.type
113
119
  ? toNewCaseTypeMapper(filterInfo[_filterKey])
114
120
  : filterInfo[_filterKey];
115
- if (_filterKey !== ProductVersionKey) {
121
+ if (_filterKey !== ProductVersionKey && _filterKey !== SolrKeys.product) {
116
122
  Array.isArray(fieldValue) && fieldValue.length > 0 && solrQuery.where(fieldLabel).in(flatMap(fieldValue));
117
123
  }
118
124
  });
@@ -145,7 +151,10 @@ function createUserFriendlyQueryFromFilterStateAdvancedSearch(filterInfo, filter
145
151
  .join(' and ')
146
152
  .replace(/\s+AND\s+/g, ' and ')
147
153
  .replace(/\s+OR\s+/g, ' or ')
148
- .replace('escalated: ("Escalated cases")', 'escalated: true')
154
+ .replace('escalated: ("true")', 'escalated: true')
155
+ .replace('escalated: ("false")', 'escalated: false')
156
+ .replace('private: ("true")', 'private: true')
157
+ .replace('private: ("false")', 'private: false')
149
158
  .replace('createdBySsoUsername', 'createdBySSO')
150
159
  .replace('ownedByMe', 'assignedToContactSSO')
151
160
  .replace('owner', 'ownerSSO');
@@ -173,7 +182,7 @@ function createAdvancedSearchQueryFromFilterState(filterInfo, keyword, useKeyFor
173
182
  ? getStringOrBooleanValue(item.key)
174
183
  : getStringOrBooleanValue(item.value))
175
184
  : filterInfo[_filterKey];
176
- if (_filterKey !== ProductVersionKey) {
185
+ if (_filterKey !== ProductVersionKey && _filterKey !== SolrKeys.product) {
177
186
  if (Array.isArray(fieldValue) && fieldValue.length > 0) {
178
187
  fieldValue.length > 1
179
188
  ? advanceQuery.where(fieldLabel).in(fieldValue)
@@ -301,6 +310,13 @@ function sfdcObjectToSolrObject(sfdcObject) {
301
310
  else if (solrKey) {
302
311
  ret[solrKey] = sfdcObject[key];
303
312
  }
313
+ // as we are getting only one field in sfdc and want to map that with two fields in solr
314
+ if (key == SFDCKeys.modifiedDate) {
315
+ ret[SolrKeys.lastPublicUpdateDate] = sfdcObject[key];
316
+ }
317
+ else if (key == SFDCKeys.modifiedBy) {
318
+ ret[SolrKeys.lastPublicUpdateDateBy] = sfdcObject[key];
319
+ }
304
320
  return ret;
305
321
  }, {});
306
322
  }
@@ -312,6 +328,7 @@ function createURLQueryFromFilterState(filterState) {
312
328
  return finalQuery;
313
329
  }
314
330
  function createFilterStateFromUrlQuery(urlQuery, globalMetadataState, pageSize, currentPage, searchType = CaseSearchQueryType.BASIC) {
331
+ var _a;
315
332
  const { paginationInfo: defaultPaginationInfo, sortInfo: defaultSortInfo, filterInfo: defaultFilterInfo, filterQueryInfo: defaultFilterQueryInfo, } = initialCaseFilterState;
316
333
  const [filters = '', sortQuery] = (urlQuery || '').split(/orderBy/i);
317
334
  const paginationInfoFromUrl = {
@@ -325,7 +342,7 @@ function createFilterStateFromUrlQuery(urlQuery, globalMetadataState, pageSize,
325
342
  sortInfo = { column, direction: direction };
326
343
  }
327
344
  const filterInfo = {};
328
- const _a = parseSolrQuery(filters), { keyword: queryString = [''] } = _a, restFilters = __rest(_a, ["keyword"]);
345
+ const _b = parseSolrQuery(filters), { keyword: queryString = [''] } = _b, restFilters = __rest(_b, ["keyword"]);
329
346
  const filterQueryInfo = merge({}, defaultFilterQueryInfo, {
330
347
  queryString: queryString[0].replace(/\\"/g, '"'),
331
348
  type: searchType,
@@ -342,6 +359,9 @@ function createFilterStateFromUrlQuery(urlQuery, globalMetadataState, pageSize,
342
359
  }
343
360
  }
344
361
  });
362
+ if ((_a = filterInfo[SolrPivotKeys.product_version]) === null || _a === void 0 ? void 0 : _a.length) {
363
+ enrichProductFilterWithIds(filterInfo[SolrPivotKeys.product_version], globalMetadataState);
364
+ }
345
365
  const parsedQuery = filterQueryInfo.type === CaseSearchQueryType.ADVANCED
346
366
  ? createUserFriendlyQueryFromFilterStateAdvancedSearch(filterInfo, filterQueryInfo.queryString)
347
367
  : '';
@@ -355,6 +375,7 @@ function createFilterStateFromUrlQuery(urlQuery, globalMetadataState, pageSize,
355
375
  }
356
376
  // advanced query
357
377
  function createFilterStateFromAdvancedQuery(queryString, globalMetadataState, currentFilterState, parsedQuery = '', type = CaseSearchQueryType.BASIC) {
378
+ var _a;
358
379
  const filterObj = parseSolrQuery(queryString);
359
380
  const newFilterInfo = {};
360
381
  let advanceToBasicQuery = [];
@@ -404,6 +425,9 @@ function createFilterStateFromAdvancedQuery(queryString, globalMetadataState, cu
404
425
  }
405
426
  delete newFilterInfo[SolrKeys.version];
406
427
  }
428
+ if ((_a = newFilterInfo[SolrPivotKeys.product_version]) === null || _a === void 0 ? void 0 : _a.length) {
429
+ enrichProductFilterWithIds(newFilterInfo[SolrPivotKeys.product_version], globalMetadataState);
430
+ }
407
431
  const filterState = Object.assign(Object.assign({}, currentFilterState), { filterQueryInfo: Object.assign(Object.assign({}, currentFilterState.filterQueryInfo), { queryString: advanceToBasicQuery.join(' AND '), parsedQuery,
408
432
  type }), filterInfo: Object.assign(Object.assign({}, initialCaseFilterState.filterInfo), newFilterInfo) });
409
433
  return filterState;
@@ -456,7 +480,7 @@ function getValidValues(solrFieldName, itemValues = [], globalMetadataState) {
456
480
  }
457
481
  });
458
482
  }
459
- else if (solrFieldName === SolrKeys.escalation) {
483
+ else if (solrFieldName === SolrKeys.escalation || solrFieldName === SolrKeys.isPrivate) {
460
484
  mappedValues = itemValues.map((item) => ({
461
485
  key: item,
462
486
  value: AdditionalFilterLabels[solrFieldName],
@@ -506,7 +530,7 @@ function getValidValuesAdvancedSearch(solrFieldName, itemValues = [], globalMeta
506
530
  }
507
531
  });
508
532
  }
509
- else if (solrFieldName === SolrKeys.escalation) {
533
+ else if (solrFieldName === SolrKeys.escalation || solrFieldName === SolrKeys.isPrivate) {
510
534
  mappedValues = itemValues.map((item) => ({
511
535
  key: item,
512
536
  value: AdditionalFilterLabels[solrFieldName],
@@ -537,4 +561,21 @@ function generateProductVersionPivotValue(values) {
537
561
  };
538
562
  });
539
563
  }
564
+ /**
565
+ * Enriches product filter objects (from URL) with their parent Product2 IDs
566
+ * by matching product names against the allProducts metadata loaded at startup.
567
+ * This allows buildProductFilter to use ParentProduct__c when version IDs aren't yet resolved.
568
+ */
569
+ function enrichProductFilterWithIds(products, globalMetadataState) {
570
+ var _a, _b;
571
+ const allProductsList = ((_b = (_a = globalMetadataState === null || globalMetadataState === void 0 ? void 0 : globalMetadataState.allProducts) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.productsResult) || [];
572
+ products.forEach((prod) => {
573
+ if (prod.productId)
574
+ return;
575
+ const matched = allProductsList.find((p) => p.name === prod.value || p.product === prod.value);
576
+ if (matched === null || matched === void 0 ? void 0 : matched.productId) {
577
+ prod.productId = matched.productId;
578
+ }
579
+ });
580
+ }
540
581
  export { createSolrQueryFromFilterState, createUserFriendlyQueryFromFilterState, createUserFriendlyQueryFromFilterStateAdvancedSearch, createQueryForCSVDownload, createSFDCQueryFromFilterState, mapSFDCCaseListToSolrCaseList, createURLQueryFromFilterState, createFilterStateFromUrlQuery, createAdvancedSearchQueryFromFilterState, createFilterStateFromAdvancedQuery, };
@@ -1,3 +1,5 @@
1
+ export declare const PORTAL_STATUS_GROUPS: Record<string, string[]>;
2
+ export declare const PORTAL_DISPLAY_STATUSES: string[];
1
3
  export declare const filterNamesMap: {
2
4
  readonly case_status: any;
3
5
  readonly case_severity: any;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAuD1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,iDAAiD,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAYzD,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAAoC,CAAC;AAIzE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAuD1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,iDAAiD,CAAC"}
@@ -1,5 +1,19 @@
1
1
  import i18n from 'i18next';
2
2
  import { SolrKeys } from '../enums/filters';
3
+ export const PORTAL_STATUS_GROUPS = {
4
+ 'In Progress': [
5
+ 'New',
6
+ 'In Progress',
7
+ 'Needs New Owner',
8
+ 'Waiting on Collab',
9
+ 'Waiting on Engineering',
10
+ 'Waiting on Sales',
11
+ 'Waiting on 3rd Party Vendor',
12
+ ],
13
+ 'Waiting on Customer': ['Waiting on Customer Action Required', 'Waiting on Customer Solution Delivered'],
14
+ Closed: ['Closed'],
15
+ };
16
+ export const PORTAL_DISPLAY_STATUSES = Object.keys(PORTAL_STATUS_GROUPS);
3
17
  // used for adding title text for different solr fields
4
18
  // test
5
19
  export const filterNamesMap = {
@@ -319,7 +319,7 @@ export const mockSolrResponse = {
319
319
  'dfisher dummy test',
320
320
  0,
321
321
  ],
322
- case_severity: ['1 (Urgent)', 2335, '2 (High)', 158, '3 (Normal)', 5984, '4 (Low)', 9338],
322
+ case_severity: ['1 (Urgent)', 2335, '2 (High)', 158, '3 (Medium)', 5984, '4 (Low)', 9338],
323
323
  case_status: ['Closed', 6348, 'Waiting on Customer', 8, 'Waiting on Red Hat', 11459],
324
324
  },
325
325
  facet_ranges: {},