@rh-support/cases 2.6.178 → 2.6.181
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/utils/caseListGraphQLUtils.js +2 -2
- package/lib/esm/utils/caseListMapper.js +3 -3
- package/lib/esm/utils/caseListVariablesBuilder.d.ts +2 -1
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +99 -66
- package/package.json +5 -5
|
@@ -126,7 +126,7 @@ export function getCaseListFromGraphQL(filterState, apolloClient, limitOverride,
|
|
|
126
126
|
const ownerUserIds = yield resolveOwnerUserIds(federationIdsToResolve, apolloClient);
|
|
127
127
|
resolvedUserIds = { ownerUserIds };
|
|
128
128
|
}
|
|
129
|
-
const variables = createGraphQLVariablesFromFilterState(filterState, resolvedUserIds);
|
|
129
|
+
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
130
130
|
if (limitOverride) {
|
|
131
131
|
variables.first = limitOverride;
|
|
132
132
|
}
|
|
@@ -214,7 +214,7 @@ export function loadMoreCases(filterState, apolloClient, afterCursor, signal) {
|
|
|
214
214
|
const ownerUserIds = yield resolveOwnerUserIds(federationIdsToResolve, apolloClient);
|
|
215
215
|
resolvedUserIds = { ownerUserIds };
|
|
216
216
|
}
|
|
217
|
-
const variables = createGraphQLVariablesFromFilterState(filterState, resolvedUserIds);
|
|
217
|
+
const variables = yield createGraphQLVariablesFromFilterState(filterState, apolloClient, resolvedUserIds);
|
|
218
218
|
variables.after = afterCursor;
|
|
219
219
|
const { data } = yield apolloClient.query({
|
|
220
220
|
query: GET_CASES_BY_FILTERS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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;
|
|
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
3
|
const isEscalated = ((_a = node.IsEscalated) === null || _a === void 0 ? void 0 : _a.value) === true;
|
|
4
4
|
return {
|
|
5
5
|
id: node.Id || '',
|
|
@@ -15,7 +15,7 @@ export function mapGraphQLCaseToCaseListItem(node) {
|
|
|
15
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
16
|
case_type: ((_o = node.Type) === null || _o === void 0 ? void 0 : _o.value) || '',
|
|
17
17
|
case_accountNumber: ((_p = node.Account_Number__c) === null || _p === void 0 ? void 0 : _p.value) || '',
|
|
18
|
-
case_contactName: ((_r = (_q = node.
|
|
18
|
+
case_contactName: ((_r = (_q = node.SalesforceSupportContact) === null || _q === void 0 ? void 0 : _q.Name) === null || _r === void 0 ? void 0 : _r.value) || '',
|
|
19
19
|
case_owner: ((_t = (_s = node.Owner) === null || _s === void 0 ? void 0 : _s.Name) === null || _t === void 0 ? void 0 : _t.value) || '',
|
|
20
20
|
case_createdByName: ((_v = (_u = node.CreatedBy) === null || _u === void 0 ? void 0 : _u.Name) === null || _v === void 0 ? void 0 : _v.value) || '',
|
|
21
21
|
case_createdDate: ((_w = node.CreatedDate) === null || _w === void 0 ? void 0 : _w.value) || '',
|
|
@@ -27,7 +27,7 @@ export function mapGraphQLCaseToCaseListItem(node) {
|
|
|
27
27
|
case_closedDate: ((_3 = node.ClosedDate) === null || _3 === void 0 ? void 0 : _3.value) || '',
|
|
28
28
|
case_folderName: '',
|
|
29
29
|
case_folderNumber: '',
|
|
30
|
-
case_alternate_id: '',
|
|
30
|
+
case_alternate_id: ((_4 = node.AlternateCaseId__c) === null || _4 === void 0 ? void 0 : _4.value) || '',
|
|
31
31
|
uri: '',
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApolloClient } from '@apollo/client';
|
|
1
2
|
import { ICaseListFilterState } from '../components/case-list/CaseListFilterReducer';
|
|
2
3
|
export declare function getOwnerFederationIdsToResolve(filterState: ICaseListFilterState): string[];
|
|
3
4
|
export interface IGraphQLCaseListVariables {
|
|
@@ -9,5 +10,5 @@ export interface IGraphQLCaseListVariables {
|
|
|
9
10
|
export interface IResolvedUserIds {
|
|
10
11
|
ownerUserIds?: string[];
|
|
11
12
|
}
|
|
12
|
-
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, resolvedUserIds?: IResolvedUserIds): IGraphQLCaseListVariables
|
|
13
|
+
export declare function createGraphQLVariablesFromFilterState(filterState: ICaseListFilterState, apolloClient: ApolloClient, resolvedUserIds?: IResolvedUserIds): Promise<IGraphQLCaseListVariables>;
|
|
13
14
|
//# sourceMappingURL=caseListVariablesBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"
|
|
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,4 +1,13 @@
|
|
|
1
|
-
|
|
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';
|
|
2
11
|
import { caseListSortColumnIdsToGraphQLMap } from '../enums/case';
|
|
3
12
|
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
4
13
|
import { expandStatusGroupsToApiValues } from './statusUtils';
|
|
@@ -8,7 +17,9 @@ export function getOwnerFederationIdsToResolve(filterState) {
|
|
|
8
17
|
return [];
|
|
9
18
|
const ownerSso = filterInfo[SolrKeys.caseOwner];
|
|
10
19
|
const contactSso = filterInfo[SolrKeys.caseContactSSO];
|
|
11
|
-
|
|
20
|
+
const contactSsoSet = new Set(contactSso || []);
|
|
21
|
+
const filteredOwnerSso = (ownerSso || []).filter((sso) => !contactSsoSet.has(sso));
|
|
22
|
+
return [...new Set(filteredOwnerSso)];
|
|
12
23
|
}
|
|
13
24
|
function buildOrderByFromSortInfo(sortInfo) {
|
|
14
25
|
var _a;
|
|
@@ -83,78 +94,100 @@ function buildKeywordSearchFilter(queryString) {
|
|
|
83
94
|
or: [{ Subject: { like: likeValue } }, { CaseNumber__c: { like: likeValue } }],
|
|
84
95
|
};
|
|
85
96
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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;
|
|
99
110
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (accountNumbers.length) {
|
|
104
|
-
andConditions.push({ Account_Number__c: { in: accountNumbers } });
|
|
105
|
-
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.error('[GraphQL] Failed to resolve contact ID by SSO:', error);
|
|
113
|
+
return undefined;
|
|
106
114
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
+
}
|
|
113
149
|
}
|
|
114
|
-
|
|
115
|
-
|
|
150
|
+
const types = filterInfo[SolrKeys.type];
|
|
151
|
+
if (types === null || types === void 0 ? void 0 : types.length) {
|
|
152
|
+
andConditions.push({ Type: { in: types } });
|
|
116
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
|
|
117
170
|
}
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
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 } });
|
|
121
175
|
}
|
|
122
|
-
|
|
123
|
-
|
|
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 } });
|
|
176
|
+
if (escalation === null || escalation === void 0 ? void 0 : escalation.length) {
|
|
177
|
+
andConditions.push({ IsEscalated: { eq: true } });
|
|
126
178
|
}
|
|
127
|
-
if (
|
|
128
|
-
|
|
179
|
+
if (filterQueryInfo === null || filterQueryInfo === void 0 ? void 0 : filterQueryInfo.queryString) {
|
|
180
|
+
const keywordFilter = buildKeywordSearchFilter(filterQueryInfo.queryString);
|
|
181
|
+
if (keywordFilter)
|
|
182
|
+
andConditions.push(keywordFilter);
|
|
129
183
|
}
|
|
130
|
-
|
|
131
|
-
|
|
184
|
+
let where;
|
|
185
|
+
if (andConditions.length === 1) {
|
|
186
|
+
where = andConditions[0];
|
|
132
187
|
}
|
|
133
|
-
else if (
|
|
134
|
-
|
|
188
|
+
else if (andConditions.length > 1) {
|
|
189
|
+
where = { and: andConditions };
|
|
135
190
|
}
|
|
136
|
-
|
|
137
|
-
|
|
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 };
|
|
191
|
+
return { first, where, orderBy };
|
|
192
|
+
});
|
|
160
193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.181",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@patternfly/react-core": "6.2.1",
|
|
41
41
|
"@patternfly/react-table": "6.2.1",
|
|
42
42
|
"@rh-support/components": "2.5.165",
|
|
43
|
-
"@rh-support/react-context": "2.5.
|
|
43
|
+
"@rh-support/react-context": "2.5.271",
|
|
44
44
|
"@rh-support/types": "2.0.26",
|
|
45
|
-
"@rh-support/user-permissions": "2.5.
|
|
46
|
-
"@rh-support/utils": "2.5.
|
|
45
|
+
"@rh-support/user-permissions": "2.5.123",
|
|
46
|
+
"@rh-support/utils": "2.5.106",
|
|
47
47
|
"localforage": "^1.10.0",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
49
49
|
"pegjs": "^0.10.0",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"defaults and supports es6-module",
|
|
94
94
|
"maintained node versions"
|
|
95
95
|
],
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "7b1306d35722c768378d97b4c6f9895c6a66bce8"
|
|
97
97
|
}
|