@rh-support/cases 2.6.211 → 2.6.213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/case-list/CaseList.d.ts.map +1 -1
- package/lib/esm/components/case-list/CaseList.js +10 -7
- package/lib/esm/components/case-list/case-list-table/CaseListTable.d.ts +1 -0
- 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 +3 -4
- 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 +1 -2
- package/lib/esm/enums/case.d.ts +8 -3
- package/lib/esm/enums/case.d.ts.map +1 -1
- package/lib/esm/enums/case.js +7 -2
- package/lib/esm/hooks/useCloseCase.d.ts.map +1 -1
- package/lib/esm/hooks/useCloseCase.js +38 -21
- package/lib/esm/utils/caseListVariablesBuilder.d.ts.map +1 -1
- package/lib/esm/utils/caseListVariablesBuilder.js +1 -2
- package/lib/esm/utils/constants.d.ts +1 -4
- package/lib/esm/utils/constants.d.ts.map +1 -1
- package/lib/esm/utils/constants.js +1 -24
- package/package.json +6 -6
- package/lib/esm/utils/statusUtils.d.ts +0 -4
- package/lib/esm/utils/statusUtils.d.ts.map +0 -1
- package/lib/esm/utils/statusUtils.js +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAuClC,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAqC1C,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAMD,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBAspBrC"}
|
|
@@ -38,7 +38,7 @@ import { isNoFilterApplied, isOnlyDefaultFilterApplied } from './CaseListFilterH
|
|
|
38
38
|
import { updateFilterState } from './CaseListFilterReducer';
|
|
39
39
|
import { appendCaseList, setCaseList, setCurrentQuery, setCursorInfo, setIsFetching, setIsLoadingMore, setLoadMoreError, } from './CaseListReducer';
|
|
40
40
|
export function CaseList(props) {
|
|
41
|
-
var _a, _b, _c, _d, _e;
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
42
42
|
const { t } = useTranslation();
|
|
43
43
|
useDocumentTitle(PageTitle.CASE_LIST);
|
|
44
44
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
@@ -273,16 +273,17 @@ export function CaseList(props) {
|
|
|
273
273
|
const salesforceAccountId = (_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.salesforceAccountId;
|
|
274
274
|
const loggedInContactId = (_b = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _b === void 0 ? void 0 : _b.id;
|
|
275
275
|
const loggedInIsOrgAdmin = (_c = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _c === void 0 ? void 0 : _c.isOrgAdmin;
|
|
276
|
+
const defaultCaseGroupId = (_e = (_d = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.data) === null || _d === void 0 ? void 0 : _d.defaultCaseGroup) !== null && _e !== void 0 ? _e : null;
|
|
276
277
|
useEffect(() => {
|
|
277
278
|
var _a;
|
|
278
|
-
if (!salesforceAccountId)
|
|
279
|
+
if (!salesforceAccountId || loggedInUser.isFetching)
|
|
279
280
|
return;
|
|
280
281
|
if (haventLoadedMetadata(caseGroups, (data) => data === undefined)) {
|
|
281
282
|
if ((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.isInternal) {
|
|
282
|
-
fetchCaseGroupsForAccount(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId,
|
|
283
|
+
fetchCaseGroupsForAccount(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId, defaultCaseGroupId, loggedInContactId, loggedInIsOrgAdmin);
|
|
283
284
|
}
|
|
284
285
|
else {
|
|
285
|
-
fetchCaseGroupsForSSO(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId,
|
|
286
|
+
fetchCaseGroupsForSSO(dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId, defaultCaseGroupId, loggedInContactId, loggedInIsOrgAdmin);
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
}, [
|
|
@@ -293,6 +294,8 @@ export function CaseList(props) {
|
|
|
293
294
|
loggedInUsersAccount.data,
|
|
294
295
|
loggedInContactId,
|
|
295
296
|
loggedInIsOrgAdmin,
|
|
297
|
+
loggedInUser.isFetching,
|
|
298
|
+
defaultCaseGroupId,
|
|
296
299
|
]);
|
|
297
300
|
useEffect(() => {
|
|
298
301
|
const loadMetadata = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -483,8 +486,8 @@ export function CaseList(props) {
|
|
|
483
486
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filter chips') } },
|
|
484
487
|
React.createElement(CaseListFilterChips, null))),
|
|
485
488
|
React.createElement("section", { className: "case-search-bottom" },
|
|
486
|
-
React.createElement("aside", { className: `case-search-filters ${((
|
|
487
|
-
React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((
|
|
489
|
+
React.createElement("aside", { className: `case-search-filters ${((_f = filterSectionRef.current) === null || _f === void 0 ? void 0 : _f.expanded) ? '' : 'collapsed'}` },
|
|
490
|
+
React.createElement("h2", { className: "filter-header pf-v6-u-display-flex" }, ((_g = filterSectionRef.current) === null || _g === void 0 ? void 0 : _g.expanded) ? (React.createElement(React.Fragment, null,
|
|
488
491
|
React.createElement(Button, { isInline: true, className: "pf-v6-u-flex-shrink-0 pf-v6-u-flex-none case-search-filter-text-button", variant: "link", title: t('Collapse filter section'), "data-tracking-id": "collapse-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, { className: "mirrored" }) },
|
|
489
492
|
React.createElement(Trans, null, "Filters")))) : (React.createElement(Button, { isInline: true, className: "pf-v6-c-button pf-m-link pf-m-inline pf-v6-u-flex-shrink-0 pf-v6-u-flex-none pf-v6-u-display-flex pf-v6-u-align-items-center pf-v6-u-justify-content-center pf-v6-u-px-lg", variant: "link", title: t('Expand filter section'), "data-tracking-id": "expand-case-list-filter", onClick: onToggleFilterBtnClick, iconPosition: "right", icon: React.createElement(OpenDrawerRightIcon, null) }, isXLScreen ? null : React.createElement(Trans, null, "Filters")))),
|
|
490
493
|
React.createElement("div", { className: "filter-wrapper" },
|
|
@@ -492,5 +495,5 @@ export function CaseList(props) {
|
|
|
492
495
|
React.createElement(ErrorBoundary, { errorMsgInfo: { message: t('There was an error loading filters') } },
|
|
493
496
|
React.createElement(CaseListFilters, { allCaseTypes: allCaseTypes, allCaseStatuses: allCaseStatuses, allCaseSeverities: allCaseSeverities, allProducts: allProducts }))))),
|
|
494
497
|
React.createElement("section", { className: "case-search-table pf-v6-u-display-flex pf-v6-u-flex-direction-column" },
|
|
495
|
-
React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, isCaseListPageLoading: isFetching, hasError: hasError, hasNextPage: hasNextPage, isLoadingMore: isLoadingMore, loadMoreError: loadMoreError, loadMoreRetryCount: loadMoreRetryCount, onRetryLoadMore: retryLoadMore, sentinelRef: sentinelRef }))))));
|
|
498
|
+
React.createElement(CaseListTable, { caseList: caseList, caseGroups: caseGroups.data || [], loggedInUserRights: loggedInUserRights.data, sortInfo: filterState.sortInfo, isCaseListPageLoading: isFetching, hasError: hasError, hasNextPage: hasNextPage, isLoadingMore: isLoadingMore, loadMoreError: loadMoreError, loadMoreRetryCount: loadMoreRetryCount, onRetryLoadMore: retryLoadMore, onCasesCloseSuccess: () => getCases(filterState), sentinelRef: sentinelRef }))))));
|
|
496
499
|
}
|
|
@@ -16,6 +16,7 @@ interface IProps {
|
|
|
16
16
|
loadMoreError: boolean;
|
|
17
17
|
loadMoreRetryCount: number;
|
|
18
18
|
onRetryLoadMore: () => void;
|
|
19
|
+
onCasesCloseSuccess?: () => void;
|
|
19
20
|
sentinelRef?: (node?: Element | null) => void;
|
|
20
21
|
}
|
|
21
22
|
export declare function CaseListTable(props: IProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAsB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseListTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/CaseListTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAsB3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAaxD,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAgB,SAAS,EAAc,MAAM,0BAA0B,CAAC;AA4B/E,UAAU,MAAM;IACZ,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CACjD;AAsBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,qBA0oB1C"}
|
|
@@ -3,7 +3,7 @@ import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
|
3
3
|
import { Table, TableVariant, Tbody, Td, Th, Thead, Tr, Visibility } from '@patternfly/react-table';
|
|
4
4
|
import { TableComponent } from '@rh-support/components';
|
|
5
5
|
import { GlobalMetadataDispatchContext, updateUserPreferences, useGlobalStateContext, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
6
|
-
import { dtmTrackEventCaseStepEncountered, formatDate, toNewCaseTypeSwitcher } from '@rh-support/utils';
|
|
6
|
+
import { dtmTrackEventCaseStepEncountered, formatDate, mapSfdcStatusToPortalStatus, toNewCaseTypeSwitcher, } from '@rh-support/utils';
|
|
7
7
|
import find from 'lodash/find';
|
|
8
8
|
import flatMap from 'lodash/flatMap';
|
|
9
9
|
import includes from 'lodash/includes';
|
|
@@ -14,9 +14,8 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
|
14
14
|
import { Trans, useTranslation } from 'react-i18next';
|
|
15
15
|
import { Link } from 'react-router-dom';
|
|
16
16
|
import { CaseListColumnIds } from '../../../enums/case';
|
|
17
|
-
import { mapSfdcStatusToPortalStatus } from '../../../utils/statusUtils';
|
|
18
17
|
import { CaseListFilterDispatchContext, CaseListFilterStateContext } from '../CaseListFilterContext';
|
|
19
|
-
import { clearFilters,
|
|
18
|
+
import { clearFilters, updateSort } from '../CaseListFilterReducer';
|
|
20
19
|
import SeverityLabel from './SeverityLabel';
|
|
21
20
|
import { TableColumnSelector } from './table-column-selector/TableColumnSelector';
|
|
22
21
|
import { TableActionsDropdown } from './TableActionsDropdown';
|
|
@@ -207,7 +206,7 @@ export function CaseListTable(props) {
|
|
|
207
206
|
React.createElement(EmptyState, { variant: EmptyStateVariant.sm },
|
|
208
207
|
React.createElement(Spinner, { size: "xl" }))))));
|
|
209
208
|
const onCasesCloseSuccess = () => {
|
|
210
|
-
|
|
209
|
+
props.onCasesCloseSuccess && props.onCasesCloseSuccess();
|
|
211
210
|
};
|
|
212
211
|
const getItemCount = () => {
|
|
213
212
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DownloadCSVFileModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/DownloadCSVFileModal.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"DownloadCSVFileModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/case-list/case-list-table/DownloadCSVFileModal.tsx"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AA+BrC,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,UAAU,MAAM;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,oBAAoB,CAAC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAWD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBA8WzD"}
|
|
@@ -13,13 +13,12 @@ import { Button, Checkbox, Form, FormGroup, Grid, GridItem, InputGroup, Modal, M
|
|
|
13
13
|
import DownloadIcon from '@patternfly/react-icons/dist/js/icons/download-icon';
|
|
14
14
|
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
15
15
|
import { ToastNotification } from '@rh-support/components';
|
|
16
|
-
import { downloadCSV, formatDateTime, toNewCaseTypeSwitcher } from '@rh-support/utils';
|
|
16
|
+
import { downloadCSV, formatDateTime, mapSfdcStatusToPortalStatus, toNewCaseTypeSwitcher, } from '@rh-support/utils';
|
|
17
17
|
import { isEmpty } from 'lodash';
|
|
18
18
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
import { SolrKeys } from '../../../enums/filters';
|
|
21
21
|
import { getCaseListFromGraphQL } from '../../../utils/caseListGraphQLUtils';
|
|
22
|
-
import { mapSfdcStatusToPortalStatus } from '../../../utils/statusUtils';
|
|
23
22
|
const csvHeaders = [
|
|
24
23
|
{ label: 'Case number', key: SolrKeys.caseNumber },
|
|
25
24
|
{
|
package/lib/esm/enums/case.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { SFDCKeys, SolrKeys } from './filters';
|
|
2
2
|
export declare enum CaseStatus {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
WaitingOnCustomerActionRequired = "Waiting on Customer Action Required",
|
|
4
|
+
WaitingOnCustomerSolutionDelivered = "Waiting on Customer Solution Delivered",
|
|
5
|
+
InProgress = "In Progress",
|
|
5
6
|
Open = "All open cases",
|
|
6
7
|
Closed = "Closed",
|
|
7
|
-
All = "All cases"
|
|
8
|
+
All = "All cases",
|
|
9
|
+
/** @deprecated Legacy alias -- do not use for new writes */
|
|
10
|
+
WaitingOnCustomer = "Waiting on Customer",
|
|
11
|
+
/** @deprecated Legacy alias -- do not use for new writes */
|
|
12
|
+
WaitingOnRedHat = "Waiting on Red Hat"
|
|
8
13
|
}
|
|
9
14
|
export declare enum CaseSeverity {
|
|
10
15
|
Urgent = "1 - Urgent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/enums/case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,UAAU;IAClB,
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/enums/case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,oBAAY,UAAU;IAClB,+BAA+B,wCAAwC;IACvE,kCAAkC,2CAA2C;IAC7E,UAAU,gBAAgB;IAC1B,IAAI,mBAAmB;IACvB,MAAM,WAAW;IACjB,GAAG,cAAc;IACjB,4DAA4D;IAC5D,iBAAiB,wBAAwB;IACzC,4DAA4D;IAC5D,eAAe,uBAAuB;CACzC;AAED,oBAAY,YAAY;IACpB,MAAM,eAAe;IACrB,SAAS,kBAAkB;IAC3B,MAAM,eAAe;IACrB,GAAG,YAAY;CAClB;AAED,eAAO,MAAM,cAAc,0UACgT,CAAC;AAE5U,oBAAY,iBAAiB;IACzB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,gBAAgB;IACrB,OAAO,gBAAgB;IACvB,MAAM,WAAW;IACjB,QAAQ,qBAAqB;IAC7B,iBAAiB,YAAY;IAC7B,aAAa,kBAAkB;IAC/B,KAAK,eAAe;IACpB,eAAe,oBAAoB;IACnC,IAAI,SAAS;IACb,cAAc,eAAe;CAChC;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAa1C,CAAC;AAGF,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWpE,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAatC,CAAC"}
|
package/lib/esm/enums/case.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { SFDCKeys, SolrKeys } from './filters';
|
|
2
2
|
export var CaseStatus;
|
|
3
3
|
(function (CaseStatus) {
|
|
4
|
-
CaseStatus["
|
|
5
|
-
CaseStatus["
|
|
4
|
+
CaseStatus["WaitingOnCustomerActionRequired"] = "Waiting on Customer Action Required";
|
|
5
|
+
CaseStatus["WaitingOnCustomerSolutionDelivered"] = "Waiting on Customer Solution Delivered";
|
|
6
|
+
CaseStatus["InProgress"] = "In Progress";
|
|
6
7
|
CaseStatus["Open"] = "All open cases";
|
|
7
8
|
CaseStatus["Closed"] = "Closed";
|
|
8
9
|
CaseStatus["All"] = "All cases";
|
|
10
|
+
/** @deprecated Legacy alias -- do not use for new writes */
|
|
11
|
+
CaseStatus["WaitingOnCustomer"] = "Waiting on Customer";
|
|
12
|
+
/** @deprecated Legacy alias -- do not use for new writes */
|
|
13
|
+
CaseStatus["WaitingOnRedHat"] = "Waiting on Red Hat";
|
|
9
14
|
})(CaseStatus || (CaseStatus = {}));
|
|
10
15
|
export var CaseSeverity;
|
|
11
16
|
(function (CaseSeverity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCloseCase.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCloseCase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCloseCase.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCloseCase.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAQD,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB;;;;;;;;;;;;;EAyHrD"}
|
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { ToastNotification
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
|
+
import { ToastNotification } from '@rh-support/components';
|
|
12
12
|
import { useCanCreateCase } from '@rh-support/react-context';
|
|
13
|
-
import { dtmTrackEventCaseStepEncountered } from '@rh-support/utils';
|
|
13
|
+
import { CREATE_CASE_COMMENT, dtmTrackEventCaseStepEncountered, sanitizeForSalesforce, updateCaseDetailsByGraphQL, } from '@rh-support/utils';
|
|
14
14
|
import filter from 'lodash/filter';
|
|
15
15
|
import find from 'lodash/find';
|
|
16
16
|
import includes from 'lodash/includes';
|
|
@@ -21,8 +21,9 @@ const reflect = (p) => p.then((v) => ({ v, status: 'fulfilled' }), (e) => ({ e,
|
|
|
21
21
|
export function useCloseCase(props) {
|
|
22
22
|
const { caseList, selectedCases, onCasesCloseSuccess } = props;
|
|
23
23
|
const { t } = useTranslation();
|
|
24
|
+
const apolloClient = useApolloClient();
|
|
24
25
|
const maxCasesSelected = (selectedCases || []).length > MAX_ALLOWED_CASES;
|
|
25
|
-
const
|
|
26
|
+
const [isFetching, setIsFetching] = useState(false);
|
|
26
27
|
const closedCaseIds = filter(selectedCases, (selected) => {
|
|
27
28
|
const caseDetails = find(caseList, (caseObj) => caseObj['case_number'] === selected);
|
|
28
29
|
return caseDetails && caseDetails['case_status'] !== 'Closed' ? false : true;
|
|
@@ -38,10 +39,7 @@ export function useCloseCase(props) {
|
|
|
38
39
|
isFetching;
|
|
39
40
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
40
41
|
const canCreateCase = useCanCreateCase();
|
|
41
|
-
const
|
|
42
|
-
propgateErrors: true,
|
|
43
|
-
});
|
|
44
|
-
// To handle button click
|
|
42
|
+
const [isPostingComment, setIsPostingComment] = useState(false);
|
|
45
43
|
const onBtnClick = () => {
|
|
46
44
|
if (canCreateCase.alert()) {
|
|
47
45
|
return;
|
|
@@ -53,29 +51,48 @@ export function useCloseCase(props) {
|
|
|
53
51
|
const onConfirm = (commentBody) => __awaiter(this, void 0, void 0, function* () {
|
|
54
52
|
const promiseArr = [];
|
|
55
53
|
setIsModalOpen(false);
|
|
54
|
+
setIsFetching(true);
|
|
56
55
|
const toastId = ToastNotification.addSuccessMessage(t(`Closing selected cases`));
|
|
57
|
-
filter(selectedCases, (selected) => !includes(closedCaseIds, selected))
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
56
|
+
const casesToClose = filter(selectedCases, (selected) => !includes(closedCaseIds, selected));
|
|
57
|
+
casesToClose.forEach((caseNumber) => {
|
|
58
|
+
const caseDetails = find(caseList, (caseObj) => caseObj.case_number === caseNumber);
|
|
59
|
+
if (!caseDetails)
|
|
60
|
+
return;
|
|
61
|
+
const salesforceCaseId = caseDetails.id;
|
|
62
|
+
const product = caseDetails.case_product[0];
|
|
63
|
+
const version = caseDetails.case_version;
|
|
64
|
+
const p = updateCaseDetailsByGraphQL(apolloClient, salesforceCaseId, { Status: 'Closed' });
|
|
61
65
|
promiseArr.push(p);
|
|
62
|
-
p.then((
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
p.then(() => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
if (commentBody) {
|
|
68
|
+
setIsPostingComment(true);
|
|
69
|
+
try {
|
|
70
|
+
yield apolloClient.mutate({
|
|
71
|
+
mutation: CREATE_CASE_COMMENT,
|
|
72
|
+
variables: {
|
|
73
|
+
commentInput: {
|
|
74
|
+
Case__c: salesforceCaseId,
|
|
75
|
+
Body__c: sanitizeForSalesforce(commentBody),
|
|
76
|
+
Visibility__c: 'Public',
|
|
77
|
+
IsAssociate__c: false,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
setIsPostingComment(false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
69
86
|
ToastNotification.clearToast(toastId);
|
|
70
87
|
ToastNotification.addSuccessMessage(t('Case {{caseNumber}} successfully closed', { caseNumber }));
|
|
71
|
-
// Only call dtm track event only when the case has been closed successfully.
|
|
72
88
|
dtmTrackEventCaseStepEncountered('close', caseNumber, product, version);
|
|
73
|
-
}), (
|
|
89
|
+
}), () => {
|
|
74
90
|
ToastNotification.clearToast(toastId);
|
|
75
91
|
ToastNotification.addDangerMessage(t('Could not close case {{caseNumber}}', { caseNumber }));
|
|
76
92
|
});
|
|
77
93
|
});
|
|
78
94
|
yield Promise.all(promiseArr.map(reflect));
|
|
95
|
+
setIsFetching(false);
|
|
79
96
|
onCasesCloseSuccess && onCasesCloseSuccess();
|
|
80
97
|
});
|
|
81
98
|
const onCancel = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"caseListVariablesBuilder.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListVariablesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAcnD,OAAO,EAEH,oBAAoB,EAEvB,MAAM,+CAA+C,CAAC;AAMvD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAM1F;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,gBAAgB;IAC7B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAqaD,wBAAsB,qCAAqC,CACvD,WAAW,EAAE,oBAAoB,EACjC,YAAY,EAAE,YAAY,EAC1B,eAAe,CAAC,EAAE,gBAAgB,GACnC,OAAO,CAAC,yBAAyB,CAAC,CAuIpC"}
|
|
@@ -7,12 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { buildAccessRestrictionExclusionFilter, GET_CASE_GROUPS, GET_CASE_NUMBERS_BY_CASE_LABEL, GET_CONTACT_BY_SSO, GET_GROUP_IDS_BY_NAME, GET_USER_IDS_BY_FEDERATION, getTechnicalSupportRecordTypeId, } from '@rh-support/utils';
|
|
10
|
+
import { buildAccessRestrictionExclusionFilter, expandStatusGroupsToApiValues, GET_CASE_GROUPS, GET_CASE_NUMBERS_BY_CASE_LABEL, GET_CONTACT_BY_SSO, GET_GROUP_IDS_BY_NAME, GET_USER_IDS_BY_FEDERATION, getTechnicalSupportRecordTypeId, } from '@rh-support/utils';
|
|
11
11
|
import { CaseListColumnIds, caseListSortColumnIdsToGraphQLMap } from '../enums/case';
|
|
12
12
|
import { CaseSearchQueryType } from '../enums/caseSearch';
|
|
13
13
|
import { SolrKeys, SolrPivotKeys } from '../enums/filters';
|
|
14
14
|
import { parseAdvanceSearchDate } from './advanceSearchUtils';
|
|
15
|
-
import { expandStatusGroupsToApiValues } from './statusUtils';
|
|
16
15
|
export function getOwnerFederationIdsToResolve(filterState) {
|
|
17
16
|
const { filterInfo } = filterState;
|
|
18
17
|
if (!filterInfo)
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const PORTAL_DISPLAY_STATUSES: string[];
|
|
3
|
-
/** Statuses treated as open (excludes Closed and Archived). */
|
|
4
|
-
export declare const PORTAL_OPEN_DISPLAY_STATUSES: string[];
|
|
1
|
+
export { PORTAL_STATUS_GROUPS, PORTAL_DISPLAY_STATUSES, PORTAL_USER_SELECTABLE_STATUSES, PORTAL_OPEN_DISPLAY_STATUSES, } from '@rh-support/utils';
|
|
5
2
|
export declare const filterNamesMap: {
|
|
6
3
|
readonly case_status: any;
|
|
7
4
|
readonly case_severity: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,+BAA+B,EAC/B,4BAA4B,GAC/B,MAAM,mBAAmB,CAAC;AAI3B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAgE1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,iDAAiD,CAAC"}
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import i18n from 'i18next';
|
|
2
2
|
import { SolrKeys } from '../enums/filters';
|
|
3
|
-
export
|
|
4
|
-
'In Progress': [
|
|
5
|
-
'In Progress',
|
|
6
|
-
'New',
|
|
7
|
-
'Waiting on Collab',
|
|
8
|
-
'Waiting on Engineering',
|
|
9
|
-
'Waiting on Sales',
|
|
10
|
-
'Waiting on 3rd Party Vendor',
|
|
11
|
-
'Needs New Owner',
|
|
12
|
-
// Legacy Solr value retained for case-list filter expansion
|
|
13
|
-
'Waiting on Red Hat',
|
|
14
|
-
],
|
|
15
|
-
'Waiting on Customer Action Required': [
|
|
16
|
-
'Waiting on Customer Action Required',
|
|
17
|
-
// Legacy Solr value
|
|
18
|
-
'Waiting on Customer',
|
|
19
|
-
],
|
|
20
|
-
'Waiting on Customer Solution Delivered': ['Waiting on Customer Solution Delivered'],
|
|
21
|
-
Closed: ['Closed'],
|
|
22
|
-
Archived: ['Archived'],
|
|
23
|
-
};
|
|
24
|
-
export const PORTAL_DISPLAY_STATUSES = Object.keys(PORTAL_STATUS_GROUPS);
|
|
25
|
-
/** Statuses treated as open (excludes Closed and Archived). */
|
|
26
|
-
export const PORTAL_OPEN_DISPLAY_STATUSES = PORTAL_DISPLAY_STATUSES.filter((status) => status !== 'Closed' && status !== 'Archived');
|
|
3
|
+
export { PORTAL_STATUS_GROUPS, PORTAL_DISPLAY_STATUSES, PORTAL_USER_SELECTABLE_STATUSES, PORTAL_OPEN_DISPLAY_STATUSES, } from '@rh-support/utils';
|
|
27
4
|
// used for adding title text for different solr fields
|
|
28
5
|
// test
|
|
29
6
|
export const filterNamesMap = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.213",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"@patternfly/patternfly": "6.2.1",
|
|
39
39
|
"@patternfly/react-core": "6.2.1",
|
|
40
40
|
"@patternfly/react-table": "6.2.1",
|
|
41
|
-
"@rh-support/components": "2.5.
|
|
42
|
-
"@rh-support/react-context": "2.5.
|
|
41
|
+
"@rh-support/components": "2.5.208",
|
|
42
|
+
"@rh-support/react-context": "2.5.303",
|
|
43
43
|
"@rh-support/types": "2.0.26",
|
|
44
|
-
"@rh-support/user-permissions": "2.5.
|
|
45
|
-
"@rh-support/utils": "2.5.
|
|
44
|
+
"@rh-support/user-permissions": "2.5.155",
|
|
45
|
+
"@rh-support/utils": "2.5.136",
|
|
46
46
|
"localforage": "^1.10.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"pegjs": "^0.10.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"defaults and supports es6-module",
|
|
95
95
|
"maintained node versions"
|
|
96
96
|
],
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "f7a13ec00f6cb4714674e5cbfc342df08a509f06"
|
|
98
98
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function expandStatusGroupsToApiValues(selectedStatuses: string[]): string[];
|
|
2
|
-
export declare function mapSfdcStatusToPortalStatus(sfdcStatus: string): string;
|
|
3
|
-
export declare function resolvePortalStatusToApiValue(portalStatus: string, currentApiStatus?: string | null): string;
|
|
4
|
-
//# sourceMappingURL=statusUtils.d.ts.map
|
|
@@ -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;AAED,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgB5G"}
|
|
@@ -1,36 +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
|
-
}
|
|
23
|
-
export function resolvePortalStatusToApiValue(portalStatus, currentApiStatus) {
|
|
24
|
-
const group = PORTAL_STATUS_GROUPS[portalStatus];
|
|
25
|
-
if (!group) {
|
|
26
|
-
return portalStatus;
|
|
27
|
-
}
|
|
28
|
-
const currentPortalStatus = currentApiStatus ? mapSfdcStatusToPortalStatus(currentApiStatus) : null;
|
|
29
|
-
if (currentPortalStatus === portalStatus && currentApiStatus && group.includes(currentApiStatus)) {
|
|
30
|
-
return currentApiStatus;
|
|
31
|
-
}
|
|
32
|
-
if (portalStatus === 'In Progress') {
|
|
33
|
-
return 'In Progress';
|
|
34
|
-
}
|
|
35
|
-
return group[0];
|
|
36
|
-
}
|