@rh-support/react-context 2.5.257 → 2.5.263
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/GlobalContextWrapper.d.ts.map +1 -1
- package/lib/esm/GlobalContextWrapper.js +3 -9
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts +2 -0
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts.map +1 -1
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.js +40 -90
- package/lib/esm/reducers/GlobalMetadataReducer.d.ts +8 -29
- package/lib/esm/reducers/GlobalMetadataReducer.d.ts.map +1 -1
- package/lib/esm/reducers/GlobalMetadataReducer.js +35 -131
- package/lib/esm/utils/index.d.ts +5 -0
- package/lib/esm/utils/index.d.ts.map +1 -1
- package/lib/esm/utils/index.js +12 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalContextWrapper.d.ts","sourceRoot":"","sources":["../../src/GlobalContextWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlobalContextWrapper.d.ts","sourceRoot":"","sources":["../../src/GlobalContextWrapper.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,UAAU,MAAM;IACZ,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACzC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,EAAE,GAAG,CAAC;QACf,oBAAoB,EAAE,GAAG,CAAC;QAC1B,MAAM,EAAE,GAAG,CAAC;QACZ,KAAK,EAAE,GAAG,CAAC;QACX,YAAY,EAAE,GAAG,CAAC;QAClB,UAAU,EAAE,GAAG,CAAC;QAChB,mBAAmB,EAAE,GAAG,CAAC;KAC5B;IAED,UAAU,QAAQ;QACd,YAAY,EAAE,GAAG,CAAC;KACrB;CACJ;AAmGD,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,sBAKjD,CAAC"}
|
|
@@ -7,19 +7,17 @@ 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 { useApolloClient } from '@apollo/client/react';
|
|
11
10
|
import { accounts, Config } from '@cee-eng/hydrajs';
|
|
12
11
|
import { LoginModal } from '@rh-support/components';
|
|
13
|
-
import {
|
|
12
|
+
import { getApiResourceObject, setSecuredSupport, setStrataHeaders } from '@rh-support/utils';
|
|
14
13
|
import isEmpty from 'lodash/isEmpty';
|
|
15
14
|
import React, { useEffect, useState } from 'react';
|
|
16
15
|
import { GlobalMetadataContextProvider, GlobalMetadataDispatchContext } from './context/GlobalMetadataContext';
|
|
17
|
-
import { fetchAccountManagers,
|
|
16
|
+
import { fetchAccountManagers, fetchLoggedInUser, fetchLoggedInUsersAccount, fetchManagedAccounts, fetchUserPreferences, GlobalMetadataReducerConstants, loadPCMConfig, setLoggedInUserJwtToken, } from './reducers/GlobalMetadataReducer';
|
|
18
17
|
function GlobalContextMetadataWrapper() {
|
|
19
18
|
const [showReLoginModal, setShowReLoginModal] = useState(false);
|
|
20
19
|
const [showSessionExpiredModal, setShowSessionExpiredModal] = useState(false);
|
|
21
20
|
const dispatchToGlobalMetadataReducer = React.useContext(GlobalMetadataDispatchContext);
|
|
22
|
-
const apolloClient = useApolloClient();
|
|
23
21
|
// Configuring callbacks to show modals in case of auth logout or session expiry
|
|
24
22
|
useEffect(() => {
|
|
25
23
|
const init = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -31,15 +29,11 @@ function GlobalContextMetadataWrapper() {
|
|
|
31
29
|
setShowSessionExpiredModal(true);
|
|
32
30
|
}
|
|
33
31
|
}));
|
|
34
|
-
session.on('AuthRefreshSuccess', () => {
|
|
35
|
-
fetchAndSetSalesforceToken(window.sessionjs.getEncodedToken());
|
|
36
|
-
});
|
|
37
32
|
});
|
|
38
33
|
init();
|
|
39
34
|
}, []);
|
|
40
35
|
const loadGlobalMetadata = (loggedInUserJwtToken) => {
|
|
41
36
|
setLoggedInUserJwtToken(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
42
|
-
fetchCaseRecordTypes(dispatchToGlobalMetadataReducer, apolloClient);
|
|
43
37
|
/**
|
|
44
38
|
* Even GS4 users can use strata's normal user and account endpoints and thus fetching them before hand. This improves the load time by 4 seconds
|
|
45
39
|
*/
|
|
@@ -49,7 +43,7 @@ function GlobalContextMetadataWrapper() {
|
|
|
49
43
|
fetchUserPreferences(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
50
44
|
fetchManagedAccounts(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
51
45
|
fetchAccountManagers(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
52
|
-
fetchLoggedInUsersAccount(dispatchToGlobalMetadataReducer, loggedInUserJwtToken
|
|
46
|
+
fetchLoggedInUsersAccount(dispatchToGlobalMetadataReducer, loggedInUserJwtToken).then((loggedInUserAccount) => {
|
|
53
47
|
setSecuredSupport(loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport);
|
|
54
48
|
if (loggedInUserAccount === null || loggedInUserAccount === void 0 ? void 0 : loggedInUserAccount.secureSupport) {
|
|
55
49
|
Config.setUserConfig({ isLoggedInAccountGS4: true });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAccount } from '@cee-eng/hydrajs/@types/models/account';
|
|
2
|
+
import { IAccountListParams } from '@cee-eng/hydrajs/@types/models/csp/account';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
interface IProps {
|
|
4
5
|
selectedAccounts?: IAccount[];
|
|
@@ -7,6 +8,7 @@ interface IProps {
|
|
|
7
8
|
canBookmarkAccount?: boolean;
|
|
8
9
|
suggestBookmarkAccounts?: boolean;
|
|
9
10
|
onSelect?: (accounts: IAccount[]) => any;
|
|
11
|
+
accountListParams?: IAccountListParams;
|
|
10
12
|
multiple?: boolean;
|
|
11
13
|
isInValid?: boolean;
|
|
12
14
|
restrictedOnSubscriptionAbuse?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSelectorInternal.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountSelector/AccountSelectorInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSelectorInternal.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountSelector/AccountSelectorInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAqBhF,OAAO,KAA+C,MAAM,OAAO,CAAC;AAKpE,UAAU,MAAM;IACZ,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC;IACzC,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAkCD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,qBA+S7C;kBA/SQ,uBAAuB;;;AAkThC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -7,19 +7,18 @@ 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 {
|
|
10
|
+
import { accounts } from '@cee-eng/hydrajs';
|
|
11
11
|
import { Button, Flex, FlexItem, MenuToggle, Select, SelectList, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
12
|
+
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
12
13
|
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
13
|
-
import { LoadingIndicator } from '@rh-support/components';
|
|
14
|
-
import { buildSearchAccountsWhere, handleGraphQLSearchAccountsResponse, SEARCH_ACCOUNTS, } from '@rh-support/utils';
|
|
15
|
-
import debounce from 'lodash/debounce';
|
|
14
|
+
import { LoadingIndicator, useFetch } from '@rh-support/components';
|
|
16
15
|
import isEmpty from 'lodash/isEmpty';
|
|
17
16
|
import isNull from 'lodash/isNull';
|
|
18
17
|
import isUndefined from 'lodash/isUndefined';
|
|
19
18
|
import uniqBy from 'lodash/uniqBy';
|
|
20
|
-
import React, {
|
|
19
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
21
20
|
import { Trans, useTranslation } from 'react-i18next';
|
|
22
|
-
import { sortAccountsByQuery } from '../../utils';
|
|
21
|
+
import { parseAccountSearchQuery, sortAccountsByQuery } from '../../utils';
|
|
23
22
|
const defaultProps = {
|
|
24
23
|
id: '',
|
|
25
24
|
className: '',
|
|
@@ -51,28 +50,24 @@ const getDisplayName = (account) => {
|
|
|
51
50
|
: '';
|
|
52
51
|
};
|
|
53
52
|
function AccountSelectorInternal(props) {
|
|
54
|
-
const
|
|
53
|
+
const { request, isFetching } = useFetch(accounts.getAccounts, { isAbortable: true });
|
|
55
54
|
const [items, setItems] = useState([]);
|
|
56
55
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
57
56
|
const [isOpen, setIsOpen] = useState(false);
|
|
58
57
|
const [isQueryChanged, setIsQueryChanged] = useState(false);
|
|
59
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
60
58
|
const [query, setQuery] = useState('');
|
|
61
59
|
const [focusedItemIndex, setFocusedItemIndex] = useState(null);
|
|
62
|
-
const [hasNextPage, setHasNextPage] = useState(false);
|
|
63
|
-
const [endCursor, setEndCursor] = useState('');
|
|
64
|
-
const [currentSearchQuery, setCurrentSearchQuery] = useState('');
|
|
65
60
|
const textInputRef = useRef();
|
|
66
61
|
const inputGroupRef = useRef();
|
|
67
|
-
const abortControllerRef = useRef();
|
|
68
62
|
const { t } = useTranslation();
|
|
69
63
|
const bookmarkedAccountsDeduped = uniqBy(props.bookmarkedAccounts, (b) => b.accountNumber);
|
|
70
64
|
const pageSize = 20;
|
|
65
|
+
const [resultSize, setResultSize] = useState(pageSize);
|
|
71
66
|
const setQueryLabel = (selectedItems) => {
|
|
72
67
|
const item = !isEmpty(selectedItems) && !props.multiple ? selectedItems[0] : {};
|
|
73
68
|
setQuery(getDisplayName(item));
|
|
74
69
|
};
|
|
75
|
-
const itemsToRender = useMemo(() => (isEmpty(items) ? bookmarkedAccountsDeduped : items), [items, bookmarkedAccountsDeduped]);
|
|
70
|
+
const itemsToRender = useMemo(() => (isEmpty(items) ? bookmarkedAccountsDeduped : items.slice(0, props.paginate ? resultSize : items.length)), [items, bookmarkedAccountsDeduped, props.paginate, resultSize]);
|
|
76
71
|
useEffect(() => {
|
|
77
72
|
if (!props.multiple) {
|
|
78
73
|
const selectedItem = (props.selectedAccounts || [])[0];
|
|
@@ -86,13 +81,11 @@ function AccountSelectorInternal(props) {
|
|
|
86
81
|
setQueryLabel(selectedItems);
|
|
87
82
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
83
|
}, [selectedItems, props.multiple]);
|
|
89
|
-
const onDisplayMoreClick = (e) =>
|
|
84
|
+
const onDisplayMoreClick = (e) => {
|
|
90
85
|
e.stopPropagation();
|
|
86
|
+
setResultSize((pre) => Math.min(pre + pageSize, items.length));
|
|
91
87
|
setIsOpen(true);
|
|
92
|
-
|
|
93
|
-
return;
|
|
94
|
-
yield fetchAccounts(currentSearchQuery, endCursor);
|
|
95
|
-
});
|
|
88
|
+
};
|
|
96
89
|
const dropdownOptions = useMemo(() => {
|
|
97
90
|
if (isFetching) {
|
|
98
91
|
return (React.createElement("div", { key: "searching", className: "pf-v6-u-px-md pf-v6-u-py-sm" },
|
|
@@ -103,9 +96,13 @@ function AccountSelectorInternal(props) {
|
|
|
103
96
|
React.createElement(Trans, null, "No results found")));
|
|
104
97
|
}
|
|
105
98
|
return [
|
|
106
|
-
...itemsToRender.map((item, index) => (React.createElement(SelectOption, { isFocused: focusedItemIndex === index, key: index, value: item, hasCheckbox: props.multiple, isSelected: selectedItems.some((account) => item.accountNumber === account.accountNumber) },
|
|
107
|
-
React.createElement("
|
|
108
|
-
|
|
99
|
+
...itemsToRender.map((item, index) => (React.createElement(SelectOption, { isFocused: focusedItemIndex === index, key: index, value: item, hasCheckbox: props.multiple, isSelected: selectedItems.some((account) => item.accountNumber === account.accountNumber) }, props.restrictedOnSubscriptionAbuse && item.subscriptionAbuse ? (React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
100
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid" }, getDisplayName(item)),
|
|
101
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid pf-v6-u-text-nowrap pf-v6-u-pr-sm" },
|
|
102
|
+
React.createElement(InfoCircleIcon, null),
|
|
103
|
+
" ",
|
|
104
|
+
React.createElement(Trans, null, "Subscription abuse")))) : (React.createElement("span", null, getDisplayName(item)))))),
|
|
105
|
+
...(resultSize < items.length
|
|
109
106
|
? [
|
|
110
107
|
React.createElement("div", { className: "pf-v6-c-divider", role: "separator", key: "separator" }),
|
|
111
108
|
React.createElement(SelectOption, { key: 'diplay-more-option', onClick: onDisplayMoreClick, value: 'display-more' },
|
|
@@ -118,62 +115,18 @@ function AccountSelectorInternal(props) {
|
|
|
118
115
|
},
|
|
119
116
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
117
|
[items, bookmarkedAccountsDeduped, isFetching, itemsToRender, isQueryChanged]);
|
|
121
|
-
const fetchAccounts =
|
|
122
|
-
if (isEmpty(
|
|
118
|
+
const fetchAccounts = (rawQuery) => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
if (isEmpty(rawQuery === null || rawQuery === void 0 ? void 0 : rawQuery.trim())) {
|
|
123
120
|
return;
|
|
124
121
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
const where = buildSearchAccountsWhere(searchQuery);
|
|
135
|
-
const queryKey = isNaN(searchQuery) ? 'name' : 'accountNumber';
|
|
136
|
-
const { data } = yield apolloClient.query({
|
|
137
|
-
query: SEARCH_ACCOUNTS,
|
|
138
|
-
variables: Object.assign(Object.assign({ where, first: pageSize }, (afterCursor ? { after: afterCursor } : {})), { orderBy: { Name: { order: 'ASC' } } }),
|
|
139
|
-
context: { fetchOptions: { signal: abortControllerRef.current.signal } },
|
|
140
|
-
});
|
|
141
|
-
const result = handleGraphQLSearchAccountsResponse(data);
|
|
142
|
-
const newItems = result.items.map((item) => ({
|
|
143
|
-
accountNumber: item.accountNumber,
|
|
144
|
-
name: item.name,
|
|
145
|
-
}));
|
|
146
|
-
const sortedItems = sortAccountsByQuery(newItems, searchQuery, queryKey);
|
|
147
|
-
if (isAppending) {
|
|
148
|
-
setItems((prev) => [...prev, ...sortedItems]);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
setItems(sortedItems);
|
|
152
|
-
}
|
|
153
|
-
setHasNextPage(result.hasNextPage);
|
|
154
|
-
setEndCursor(result.endCursor);
|
|
155
|
-
setCurrentSearchQuery(searchQuery);
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
if ((err === null || err === void 0 ? void 0 : err.name) !== 'AbortError') {
|
|
159
|
-
console.error('Failed to search accounts via GraphQL', err);
|
|
160
|
-
setItems([]);
|
|
161
|
-
setHasNextPage(false);
|
|
162
|
-
setEndCursor('');
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
finally {
|
|
166
|
-
setIsFetching(false);
|
|
167
|
-
}
|
|
168
|
-
}), [apolloClient]);
|
|
169
|
-
const fetchAccountsRef = useRef(fetchAccounts);
|
|
170
|
-
fetchAccountsRef.current = fetchAccounts;
|
|
171
|
-
const debouncedFetchAccounts = useMemo(() => { var _a; return debounce((value) => fetchAccountsRef.current(value), (_a = props.delay) !== null && _a !== void 0 ? _a : 300); }, [props.delay]);
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
return () => {
|
|
174
|
-
debouncedFetchAccounts.cancel();
|
|
175
|
-
};
|
|
176
|
-
}, [debouncedFetchAccounts]);
|
|
122
|
+
const { query: searchQuery, queryKey } = parseAccountSearchQuery(rawQuery);
|
|
123
|
+
const fields = ['accountNumber', 'accountId', 'name', 'subscriptionAbuse'].join(',');
|
|
124
|
+
const params = Object.assign({ fields, limit: 60, accountNumberNotNull: true }, (queryKey === 'accountNumber' ? { accountNumberLike: searchQuery } : { nameLike: searchQuery }));
|
|
125
|
+
const response = request && (yield request(params));
|
|
126
|
+
const options = response && response.items && response.items.length ? response.items : [];
|
|
127
|
+
const sortedOptions = sortAccountsByQuery(options, searchQuery, queryKey);
|
|
128
|
+
setItems(sortedOptions);
|
|
129
|
+
});
|
|
177
130
|
const onOuterClick = () => {
|
|
178
131
|
setQueryLabel(props.selectedAccounts || []);
|
|
179
132
|
setSelectedItems(props.selectedAccounts || []);
|
|
@@ -209,23 +162,23 @@ function AccountSelectorInternal(props) {
|
|
|
209
162
|
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
210
163
|
};
|
|
211
164
|
const onFilter = (_event, value) => {
|
|
165
|
+
const trimmed = value.trim();
|
|
212
166
|
setQuery(value);
|
|
213
|
-
setIsQueryChanged(!isEmpty(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
debouncedFetchAccounts.cancel();
|
|
217
|
-
setItems([]);
|
|
218
|
-
setIsFetching(false);
|
|
219
|
-
setHasNextPage(false);
|
|
220
|
-
setEndCursor('');
|
|
221
|
-
return;
|
|
167
|
+
setIsQueryChanged(!isEmpty(trimmed));
|
|
168
|
+
if (!isEmpty(trimmed)) {
|
|
169
|
+
setIsOpen(true);
|
|
222
170
|
}
|
|
223
|
-
|
|
224
|
-
|
|
171
|
+
fetchAccounts(value);
|
|
172
|
+
setResultSize(pageSize);
|
|
173
|
+
setFocusedItemIndex(null);
|
|
225
174
|
};
|
|
226
175
|
const onToggleClick = () => {
|
|
227
176
|
setIsOpen((pre) => !pre);
|
|
228
177
|
};
|
|
178
|
+
const onInputClick = (e) => {
|
|
179
|
+
e.stopPropagation();
|
|
180
|
+
setIsOpen(true);
|
|
181
|
+
};
|
|
229
182
|
const onClearSelection = (e) => {
|
|
230
183
|
var _a;
|
|
231
184
|
e.stopPropagation();
|
|
@@ -233,9 +186,6 @@ function AccountSelectorInternal(props) {
|
|
|
233
186
|
setSelectedItems([]);
|
|
234
187
|
setItems([]);
|
|
235
188
|
setIsQueryChanged(false);
|
|
236
|
-
setHasNextPage(false);
|
|
237
|
-
setEndCursor('');
|
|
238
|
-
setCurrentSearchQuery('');
|
|
239
189
|
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
240
190
|
};
|
|
241
191
|
const onSelect = (selection) => {
|
|
@@ -291,7 +241,7 @@ function AccountSelectorInternal(props) {
|
|
|
291
241
|
};
|
|
292
242
|
const toggle = (toggleRef) => (React.createElement(MenuToggle, { innerRef: toggleRef, variant: "typeahead", onClick: onToggleClick, isExpanded: isOpen, isFullWidth: true, isDisabled: props.disabled },
|
|
293
243
|
React.createElement(TextInputGroup, { isPlain: true, innerRef: inputGroupRef },
|
|
294
|
-
React.createElement(TextInputGroupMain, { value: query, role: "combobox", onClick:
|
|
244
|
+
React.createElement(TextInputGroupMain, { value: query, role: "combobox", onClick: onInputClick, onKeyDown: onInputKeyDown, onChange: onFilter, placeholder: t(props.placeholder || ''), isExpanded: isOpen, innerRef: textInputRef, "aria-label": `select${props.multiple ? ' multi' : ''} typeahead listbox`, "aria-controls": "account-selector-dropdown" }),
|
|
295
245
|
React.createElement(TextInputGroupUtilities, null, !isEmpty(query) && (React.createElement(Button, { icon: isFetching ? (React.createElement(LoadingIndicator, { show: true, size: "sm" })) : (React.createElement(TimesCircleIcon, { "aria-hidden": true })), variant: "plain", onClick: onClearSelection, isDisabled: isFetching, "aria-label": t('Clear') }))))));
|
|
296
246
|
return (React.createElement(Select, { "data-tracking-id": "account-selector-dropdown", isOpen: isOpen, onOpenChange: () => setIsOpen(false), id: props.id, toggle: toggle, popperProps: { direction: 'down', enableFlip: false }, onSelect: (_e, v) => onSelect(v), selected: selectedItems, isScrollable: true },
|
|
297
247
|
React.createElement(SelectList, null, dropdownOptions)));
|
|
@@ -5,6 +5,7 @@ import { IAccount, IPartnerManagedAccount } from '@cee-eng/hydrajs/@types/models
|
|
|
5
5
|
import { ISsoContact } from '@cee-eng/hydrajs/@types/models/contact';
|
|
6
6
|
import { IPreference } from '@cee-eng/hydrajs/@types/models/general';
|
|
7
7
|
import { IConfigurationResponse } from '@cee-eng/hydrajs/@types/models/maintenance';
|
|
8
|
+
import { ISEProductListParams } from '@cee-eng/hydrajs/@types/models/product';
|
|
8
9
|
import { IAction, IApiResponseDetails, IPortalJwtToken } from '@rh-support/types/shared';
|
|
9
10
|
import { UserAuth } from '@rh-support/user-permissions';
|
|
10
11
|
import { ITroubleshootProductResponse } from '@rh-support/utils';
|
|
@@ -77,8 +78,7 @@ export declare enum GlobalMetadataReducerConstants {
|
|
|
77
78
|
setReferrerUrl = "setReferrerUrl",
|
|
78
79
|
getNoclusteridreasons = "getNoclusteridreasons",
|
|
79
80
|
setIsSharingHostnameswithRHt = "setIsSharingHostnameswithRHt",
|
|
80
|
-
setCaseListTraditionalSupportAgreed = "setCaseListTraditionalSupportAgreed"
|
|
81
|
-
setCaseRecordTypes = "setCaseRecordTypes"
|
|
81
|
+
setCaseListTraditionalSupportAgreed = "setCaseListTraditionalSupportAgreed"
|
|
82
82
|
}
|
|
83
83
|
export type ICaseType = string;
|
|
84
84
|
export type ICaseSeverity = string;
|
|
@@ -99,9 +99,6 @@ export interface IBookmarkedGroupIds {
|
|
|
99
99
|
namespaceId: number;
|
|
100
100
|
valueTypeId: number;
|
|
101
101
|
}
|
|
102
|
-
export interface ICaseRecordTypeMap {
|
|
103
|
-
[name: string]: string;
|
|
104
|
-
}
|
|
105
102
|
export interface IGlobalMetadataState {
|
|
106
103
|
allCaseTypes: IApiResponseDetails<ICaseType[]>;
|
|
107
104
|
allCaseSeverities: IApiResponseDetails<ICaseSeverity[]>;
|
|
@@ -130,7 +127,6 @@ export interface IGlobalMetadataState {
|
|
|
130
127
|
accountCustomEmails: IApiResponseDetails<IAccountNotificationAddresses[]>;
|
|
131
128
|
referrerUrl: string;
|
|
132
129
|
caseNoClusterIdReasons: IApiResponseDetails<string[]>;
|
|
133
|
-
caseRecordTypes: IApiResponseDetails<ICaseRecordTypeMap>;
|
|
134
130
|
caseListTraditionalSupportAgreed: boolean;
|
|
135
131
|
}
|
|
136
132
|
export interface IGlobalMetadataPayloadType extends IGlobalMetadataState {
|
|
@@ -146,31 +142,14 @@ export declare const setReferrerUrl: (dispatch: GlobalMetadataReducerDispatchTyp
|
|
|
146
142
|
export declare const removeGroupedBookmarks: (dispatch: GlobalMetadataReducerDispatchType, allBookmarks: IBookmark[], removedAccountsId: number[]) => void;
|
|
147
143
|
export declare const removeWholeGroup: (dispatch: GlobalMetadataReducerDispatchType, allBookmarks: IBookmark[], rootBookmarIds: number[]) => void;
|
|
148
144
|
export declare const addEditbookmarks: (dispatch: GlobalMetadataReducerDispatchType, allBookmarks: IBookmark[], updatedAccounts: IBookmarkedAccounts, selectedAccounts: IBookmark[], group: string, accountsRemovedFromGroup?: IBookmark[]) => void;
|
|
149
|
-
export declare const fetchCaseTypes: (dispatch: GlobalMetadataReducerDispatchType,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export declare const
|
|
153
|
-
export declare const fetchCaseSeverities: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
154
|
-
query: (options: any) => Promise<any>;
|
|
155
|
-
}) => Promise<void>;
|
|
156
|
-
export declare const fetchCaseSeveritiesHydra: (dispatch: GlobalMetadataReducerDispatchType, isSecureSupport: boolean) => Promise<void>;
|
|
157
|
-
export declare const fetchAllStatuses: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
158
|
-
query: (options: any) => Promise<any>;
|
|
159
|
-
}) => Promise<void>;
|
|
160
|
-
export declare const fetchProducts: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
161
|
-
query: (options: any) => Promise<any>;
|
|
162
|
-
}) => Promise<void>;
|
|
163
|
-
export declare const fetchCaseRecordTypes: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
164
|
-
query: (options: any) => Promise<any>;
|
|
165
|
-
}) => Promise<void>;
|
|
145
|
+
export declare const fetchCaseTypes: (dispatch: GlobalMetadataReducerDispatchType, isSecureSupport: boolean) => Promise<void>;
|
|
146
|
+
export declare const fetchCaseSeverities: (dispatch: GlobalMetadataReducerDispatchType, isSecureSupport: boolean) => Promise<void>;
|
|
147
|
+
export declare const fetchAllStatuses: (dispatch: GlobalMetadataReducerDispatchType, isSecureSupport: boolean) => Promise<void>;
|
|
148
|
+
export declare const fetchProducts: (dispatch: GlobalMetadataReducerDispatchType, ownerSSOUsername?: string, params?: ISEProductListParams) => Promise<void>;
|
|
166
149
|
export declare const setAllProducts: (dispatch: GlobalMetadataReducerDispatchType, allProducts: ITroubleshootProductResponse) => void;
|
|
167
|
-
export declare const fetchLoggedInUsersAccount: (dispatch: GlobalMetadataReducerDispatchType, token: Partial<IPortalJwtToken>, silent?: boolean
|
|
168
|
-
query: (options: any) => Promise<any>;
|
|
169
|
-
}) => Promise<import("@rh-support/utils").IGraphQLAccountResult>;
|
|
150
|
+
export declare const fetchLoggedInUsersAccount: (dispatch: GlobalMetadataReducerDispatchType, token: Partial<IPortalJwtToken>, silent?: boolean) => Promise<IAccount>;
|
|
170
151
|
export declare const fetchLoggedInUser: (dispatch: GlobalMetadataReducerDispatchType, token: Partial<IPortalJwtToken>, pcmConfig: any) => Promise<void>;
|
|
171
|
-
export declare const fetchLanguageMetadata: (dispatch: GlobalMetadataReducerDispatchType
|
|
172
|
-
query: (options: any) => Promise<any>;
|
|
173
|
-
}) => Promise<void>;
|
|
152
|
+
export declare const fetchLanguageMetadata: (dispatch: GlobalMetadataReducerDispatchType) => Promise<void>;
|
|
174
153
|
export declare const fetchInternalStatusMetadata: (dispatch: GlobalMetadataReducerDispatchType) => Promise<void>;
|
|
175
154
|
export declare const fetchCaseSbrsMetadata: (dispatch: GlobalMetadataReducerDispatchType) => Promise<void>;
|
|
176
155
|
export declare const fetchCaseGroupsForSSO: (dispatch: GlobalMetadataReducerDispatchType, ssoUserName: string) => Promise<ICaseGroup[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalMetadataReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/GlobalMetadataReducer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlobalMetadataReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/GlobalMetadataReducer.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAA0B,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAIH,4BAA4B,EAE/B,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,oBAAY,mBAAmB;IAC3B,sBAAsB,+BAA+B;IACrD,WAAW,oBAAoB;IAC/B,gBAAgB,yBAAyB;IACzC,uBAAuB,gCAAgC;IACvD,mBAAmB,4BAA4B;IAC/C,sBAAsB,+BAA+B;IACrD,qBAAqB,8BAA8B;IACnD,uBAAuB,gCAAgC;IACvD,gBAAgB,yBAAyB;IACzC,cAAc,uBAAuB;IACrC,iBAAiB,0BAA0B;IAC3C,aAAa,qBAAqB;IAClC,aAAa,qBAAqB;IAClC,wBAAwB,8BAA8B;IACtD,gBAAgB,yBAAyB;IACzC,8BAA8B,uCAAuC;IACrE,8BAA8B,uCAAuC;I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ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { accounts, caseMetadata, contacts, customEmail, maintenance, publicApi, userPreferences, } from '@cee-eng/hydrajs';
|
|
11
|
-
import {
|
|
10
|
+
import { accounts, caseMetadata, contacts, customEmail, maintenance, products, publicApi, userPreferences, } from '@cee-eng/hydrajs';
|
|
11
|
+
import { getApiResourceObject, handleEntitledProductResponse, handleProductSearchResponse, severitySort, } from '@rh-support/utils';
|
|
12
12
|
import differenceBy from 'lodash/differenceBy';
|
|
13
13
|
import filter from 'lodash/filter';
|
|
14
14
|
import find from 'lodash/find';
|
|
@@ -80,7 +80,6 @@ export var GlobalMetadataReducerConstants;
|
|
|
80
80
|
GlobalMetadataReducerConstants["getNoclusteridreasons"] = "getNoclusteridreasons";
|
|
81
81
|
GlobalMetadataReducerConstants["setIsSharingHostnameswithRHt"] = "setIsSharingHostnameswithRHt";
|
|
82
82
|
GlobalMetadataReducerConstants["setCaseListTraditionalSupportAgreed"] = "setCaseListTraditionalSupportAgreed";
|
|
83
|
-
GlobalMetadataReducerConstants["setCaseRecordTypes"] = "setCaseRecordTypes";
|
|
84
83
|
})(GlobalMetadataReducerConstants || (GlobalMetadataReducerConstants = {}));
|
|
85
84
|
const initialProductResponse = {
|
|
86
85
|
topProducts: [],
|
|
@@ -119,7 +118,6 @@ export const initialGlobalMetadataState = {
|
|
|
119
118
|
},
|
|
120
119
|
referrerUrl: null,
|
|
121
120
|
caseNoClusterIdReasons: getApiResourceObject([]),
|
|
122
|
-
caseRecordTypes: getApiResourceObject({}),
|
|
123
121
|
caseListTraditionalSupportAgreed: false,
|
|
124
122
|
};
|
|
125
123
|
// Resucers
|
|
@@ -220,9 +218,6 @@ export const globalMetadataReducer = (pState, action) => {
|
|
|
220
218
|
case GlobalMetadataReducerConstants.setCaseListTraditionalSupportAgreed: {
|
|
221
219
|
return Object.assign(Object.assign({}, pState), { caseListTraditionalSupportAgreed: (_a = action.payload) === null || _a === void 0 ? void 0 : _a.caseListTraditionalSupportAgreed });
|
|
222
220
|
}
|
|
223
|
-
case GlobalMetadataReducerConstants.setCaseRecordTypes: {
|
|
224
|
-
return Object.assign(Object.assign({}, pState), { caseRecordTypes: action.payload.caseRecordTypes });
|
|
225
|
-
}
|
|
226
221
|
default: {
|
|
227
222
|
return pState;
|
|
228
223
|
}
|
|
@@ -283,33 +278,7 @@ export const addEditbookmarks = (dispatch, allBookmarks, updatedAccounts, select
|
|
|
283
278
|
payload: { bookmarkedGroupAccounts: getApiResourceObject(allBookmarksCopy, false) },
|
|
284
279
|
});
|
|
285
280
|
};
|
|
286
|
-
export const fetchCaseTypes = (dispatch,
|
|
287
|
-
var _a;
|
|
288
|
-
dispatch({
|
|
289
|
-
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
290
|
-
payload: { allCaseTypes: getApiResourceObject([], true) },
|
|
291
|
-
});
|
|
292
|
-
try {
|
|
293
|
-
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Type']));
|
|
294
|
-
const allCaseTypes = getProcessedCaseTypes((_a = picklists.Type) !== null && _a !== void 0 ? _a : []);
|
|
295
|
-
dispatch({
|
|
296
|
-
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
297
|
-
payload: { allCaseTypes: getApiResourceObject(allCaseTypes) },
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
catch (e) {
|
|
301
|
-
dispatch({
|
|
302
|
-
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
303
|
-
payload: { allCaseTypes: getApiResourceObject([], false, true, e.message) },
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
// const caseTypes = await caseMetadata.getTypes(isSecureSupport);
|
|
307
|
-
// dispatch({
|
|
308
|
-
// type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
309
|
-
// payload: { allCaseTypes: getApiResourceObject(getProcessedCaseTypes(caseTypes.items)) },
|
|
310
|
-
// });
|
|
311
|
-
});
|
|
312
|
-
export const fetchCaseTypesHydra = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
281
|
+
export const fetchCaseTypes = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
313
282
|
dispatch({
|
|
314
283
|
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
315
284
|
payload: { allCaseTypes: getApiResourceObject([], true) },
|
|
@@ -328,28 +297,7 @@ export const fetchCaseTypesHydra = (dispatch, isSecureSupport) => __awaiter(void
|
|
|
328
297
|
});
|
|
329
298
|
}
|
|
330
299
|
});
|
|
331
|
-
export const fetchCaseSeverities = (dispatch,
|
|
332
|
-
var _a;
|
|
333
|
-
dispatch({
|
|
334
|
-
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
335
|
-
payload: { allCaseSeverities: getApiResourceObject([], true) },
|
|
336
|
-
});
|
|
337
|
-
try {
|
|
338
|
-
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Priority']));
|
|
339
|
-
const allCaseSeverities = [...((_a = picklists.Priority) !== null && _a !== void 0 ? _a : [])].sort((sevA, sevB) => severitySort(sevA, sevB));
|
|
340
|
-
dispatch({
|
|
341
|
-
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
342
|
-
payload: { allCaseSeverities: getApiResourceObject(allCaseSeverities) },
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
catch (e) {
|
|
346
|
-
dispatch({
|
|
347
|
-
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
348
|
-
payload: { allCaseSeverities: getApiResourceObject([], false, true, e.message) },
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
export const fetchCaseSeveritiesHydra = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
300
|
+
export const fetchCaseSeverities = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
353
301
|
dispatch({
|
|
354
302
|
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
355
303
|
payload: { allCaseSeverities: getApiResourceObject([], true) },
|
|
@@ -369,18 +317,16 @@ export const fetchCaseSeveritiesHydra = (dispatch, isSecureSupport) => __awaiter
|
|
|
369
317
|
});
|
|
370
318
|
}
|
|
371
319
|
});
|
|
372
|
-
export const fetchAllStatuses = (dispatch,
|
|
373
|
-
var _a;
|
|
320
|
+
export const fetchAllStatuses = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
374
321
|
dispatch({
|
|
375
322
|
type: GlobalMetadataReducerConstants.setCaseStatuses,
|
|
376
323
|
payload: { allCaseStatuses: getApiResourceObject([], true) },
|
|
377
324
|
});
|
|
378
325
|
try {
|
|
379
|
-
const
|
|
380
|
-
const allCaseStatuses = (_a = picklists.Status) !== null && _a !== void 0 ? _a : [];
|
|
326
|
+
const caseStatusesResponse = yield caseMetadata.getStatuses(isSecureSupport);
|
|
381
327
|
dispatch({
|
|
382
328
|
type: GlobalMetadataReducerConstants.setCaseStatuses,
|
|
383
|
-
payload: { allCaseStatuses: getApiResourceObject(
|
|
329
|
+
payload: { allCaseStatuses: getApiResourceObject(caseStatusesResponse.items) },
|
|
384
330
|
});
|
|
385
331
|
}
|
|
386
332
|
catch (e) {
|
|
@@ -390,26 +336,25 @@ export const fetchAllStatuses = (dispatch, apolloClient) => __awaiter(void 0, vo
|
|
|
390
336
|
});
|
|
391
337
|
}
|
|
392
338
|
});
|
|
393
|
-
export const fetchProducts = (
|
|
394
|
-
var _a, _b, _c, _d;
|
|
339
|
+
export const fetchProducts = (dispatch_1, ownerSSOUsername_1, ...args_1) => __awaiter(void 0, [dispatch_1, ownerSSOUsername_1, ...args_1], void 0, function* (dispatch, ownerSSOUsername, params = {}) {
|
|
395
340
|
try {
|
|
396
341
|
dispatch({
|
|
397
342
|
type: GlobalMetadataReducerConstants.setAllProducts,
|
|
398
343
|
payload: { allProducts: getApiResourceObject(initialProductResponse, true) },
|
|
399
344
|
});
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Here we are trying to fetch products from two sources (getSEProductsList and getProducts) and if even first source (getSEProductsList) fail to deliver product information
|
|
347
|
+
* we still need to use second source (getProducts) to parse and list product
|
|
348
|
+
*/
|
|
349
|
+
const response = yield Promise.allSettled([
|
|
350
|
+
products.getSEProductsList(params),
|
|
351
|
+
products.getProducts(ownerSSOUsername),
|
|
352
|
+
]);
|
|
353
|
+
const productsResultAll = response[0].status === 'fulfilled' ? response[0].value : [];
|
|
354
|
+
const productsResultEntitled = response[1].status === 'fulfilled' ? response[1].value : [];
|
|
355
|
+
const allProducts = productsResultAll.length
|
|
356
|
+
? handleProductSearchResponse(productsResultAll, productsResultEntitled)
|
|
357
|
+
: handleEntitledProductResponse(productsResultEntitled);
|
|
413
358
|
dispatch({
|
|
414
359
|
type: GlobalMetadataReducerConstants.setAllProducts,
|
|
415
360
|
payload: { allProducts: getApiResourceObject(allProducts) },
|
|
@@ -422,51 +367,18 @@ export const fetchProducts = (dispatch, apolloClient) => __awaiter(void 0, void
|
|
|
422
367
|
});
|
|
423
368
|
}
|
|
424
369
|
});
|
|
425
|
-
export const fetchCaseRecordTypes = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
426
|
-
var _a, _b, _c, _d;
|
|
427
|
-
dispatch({
|
|
428
|
-
type: GlobalMetadataReducerConstants.setCaseRecordTypes,
|
|
429
|
-
payload: { caseRecordTypes: getApiResourceObject({}, true) },
|
|
430
|
-
});
|
|
431
|
-
try {
|
|
432
|
-
const { data } = yield apolloClient.query({
|
|
433
|
-
query: GET_CASE_RECORD_TYPES,
|
|
434
|
-
});
|
|
435
|
-
const recordTypeInfos = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.objectInfos) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.recordTypeInfos) !== null && _d !== void 0 ? _d : [];
|
|
436
|
-
const caseRecordTypes = {};
|
|
437
|
-
recordTypeInfos.forEach((info) => {
|
|
438
|
-
caseRecordTypes[info.name] = info.recordTypeId;
|
|
439
|
-
});
|
|
440
|
-
setCaseRecordTypes(caseRecordTypes);
|
|
441
|
-
dispatch({
|
|
442
|
-
type: GlobalMetadataReducerConstants.setCaseRecordTypes,
|
|
443
|
-
payload: { caseRecordTypes: getApiResourceObject(caseRecordTypes) },
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
catch (e) {
|
|
447
|
-
dispatch({
|
|
448
|
-
type: GlobalMetadataReducerConstants.setCaseRecordTypes,
|
|
449
|
-
payload: { caseRecordTypes: getApiResourceObject({}, false, true, e.message) },
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
});
|
|
453
370
|
export const setAllProducts = (dispatch, allProducts) => {
|
|
454
371
|
dispatch({
|
|
455
372
|
type: GlobalMetadataReducerConstants.setAllProducts,
|
|
456
373
|
payload: { allProducts: getApiResourceObject(allProducts) },
|
|
457
374
|
});
|
|
458
375
|
};
|
|
459
|
-
export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __awaiter(void 0, [dispatch_1, token_1, ...args_1], void 0, function* (dispatch, token, silent = false
|
|
460
|
-
var _a
|
|
376
|
+
export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __awaiter(void 0, [dispatch_1, token_1, ...args_1], void 0, function* (dispatch, token, silent = false) {
|
|
377
|
+
var _a;
|
|
461
378
|
let accountNumber = token.account_number;
|
|
462
379
|
if (silent) {
|
|
463
380
|
try {
|
|
464
|
-
const
|
|
465
|
-
query: GET_ACCOUNT,
|
|
466
|
-
variables: getAccountQueryVariables(accountNumber),
|
|
467
|
-
});
|
|
468
|
-
const edges = (_d = (_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.SalesforceSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
469
|
-
const loggedInUsersAccount = handleGraphQLAccountResponse(edges);
|
|
381
|
+
const loggedInUsersAccount = yield accounts.getAccount(accountNumber);
|
|
470
382
|
dispatch({
|
|
471
383
|
type: GlobalMetadataReducerConstants.setLoggedInUsersAccount,
|
|
472
384
|
payload: { loggedInUsersAccount: getApiResourceObject(loggedInUsersAccount) },
|
|
@@ -482,13 +394,7 @@ export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __a
|
|
|
482
394
|
type: GlobalMetadataReducerConstants.setLoggedInUsersAccount,
|
|
483
395
|
payload: { loggedInUsersAccount: getApiResourceObject({}, true) },
|
|
484
396
|
});
|
|
485
|
-
const
|
|
486
|
-
query: GET_ACCOUNT,
|
|
487
|
-
variables: getAccountQueryVariables(accountNumber),
|
|
488
|
-
fetchPolicy: 'network-only',
|
|
489
|
-
});
|
|
490
|
-
const edges = (_h = (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _e === void 0 ? void 0 : _e.query) === null || _f === void 0 ? void 0 : _f.SalesforceSupportAccount) === null || _g === void 0 ? void 0 : _g.edges) !== null && _h !== void 0 ? _h : [];
|
|
491
|
-
const loggedInUsersAccount = handleGraphQLAccountResponse(edges);
|
|
397
|
+
const loggedInUsersAccount = yield accounts.getAccount(accountNumber);
|
|
492
398
|
dispatch({
|
|
493
399
|
type: GlobalMetadataReducerConstants.setLoggedInUsersAccount,
|
|
494
400
|
payload: { loggedInUsersAccount: getApiResourceObject(loggedInUsersAccount) },
|
|
@@ -496,7 +402,7 @@ export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __a
|
|
|
496
402
|
return loggedInUsersAccount;
|
|
497
403
|
}
|
|
498
404
|
catch (e) {
|
|
499
|
-
(
|
|
405
|
+
(_a = window.sessionjs) === null || _a === void 0 ? void 0 : _a.reportProblem(e, {
|
|
500
406
|
tags: {
|
|
501
407
|
portal_app: window.app || 'Portal Case Management',
|
|
502
408
|
error_effect: 'PCM - App wide error',
|
|
@@ -518,7 +424,7 @@ export const fetchLoggedInUser = (dispatch, token, pcmConfig) => __awaiter(void
|
|
|
518
424
|
type: GlobalMetadataReducerConstants.setLoggedInUser,
|
|
519
425
|
payload: { loggedInUser: getApiResourceObject({}, true) },
|
|
520
426
|
});
|
|
521
|
-
|
|
427
|
+
let loggedInUser = yield contacts.getCurrentContact({
|
|
522
428
|
userId: token.sub,
|
|
523
429
|
assumeEntitledIfSubscriptionServiceUnavailable: true,
|
|
524
430
|
});
|
|
@@ -526,7 +432,7 @@ export const fetchLoggedInUser = (dispatch, token, pcmConfig) => __awaiter(void
|
|
|
526
432
|
type: GlobalMetadataReducerConstants.setLoggedInUser,
|
|
527
433
|
payload: { loggedInUser: getApiResourceObject(loggedInUser) },
|
|
528
434
|
});
|
|
529
|
-
//
|
|
435
|
+
// Saving bookmarked accounts separately.
|
|
530
436
|
const canViewBookmarkAccounts = loggedInUser.isInternal;
|
|
531
437
|
if (canViewBookmarkAccounts) {
|
|
532
438
|
fetchBookmarkedGroupAccounts(dispatch, loggedInUser.ssoUsername);
|
|
@@ -549,18 +455,16 @@ export const fetchLoggedInUser = (dispatch, token, pcmConfig) => __awaiter(void
|
|
|
549
455
|
});
|
|
550
456
|
}
|
|
551
457
|
});
|
|
552
|
-
export const fetchLanguageMetadata = (dispatch
|
|
553
|
-
var _a;
|
|
554
|
-
dispatch({
|
|
555
|
-
type: GlobalMetadataReducerConstants.setCaseLanguages,
|
|
556
|
-
payload: { caseLanguages: getApiResourceObject([], true) },
|
|
557
|
-
});
|
|
458
|
+
export const fetchLanguageMetadata = (dispatch) => __awaiter(void 0, void 0, void 0, function* () {
|
|
558
459
|
try {
|
|
559
|
-
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Language']));
|
|
560
|
-
const caseLanguages = (_a = picklists.Language) !== null && _a !== void 0 ? _a : [];
|
|
561
460
|
dispatch({
|
|
562
461
|
type: GlobalMetadataReducerConstants.setCaseLanguages,
|
|
563
|
-
payload: { caseLanguages: getApiResourceObject(
|
|
462
|
+
payload: { caseLanguages: getApiResourceObject([], true) },
|
|
463
|
+
});
|
|
464
|
+
const response = yield caseMetadata.getLanguagesMetadata();
|
|
465
|
+
dispatch({
|
|
466
|
+
type: GlobalMetadataReducerConstants.setCaseLanguages,
|
|
467
|
+
payload: { caseLanguages: getApiResourceObject(response.items) },
|
|
564
468
|
});
|
|
565
469
|
}
|
|
566
470
|
catch (e) {
|
package/lib/esm/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** Parses pasted/typed account text into a search term and field type. */
|
|
2
|
+
export declare function parseAccountSearchQuery(rawQuery: string): {
|
|
3
|
+
query: string;
|
|
4
|
+
queryKey: 'name' | 'accountNumber';
|
|
5
|
+
};
|
|
1
6
|
/**
|
|
2
7
|
* The below function sorts the account search results based on the provided query string (account name or number).
|
|
3
8
|
* test
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA,EAAE,QAAQ,KAAA,OAgB/D"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.tsx"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAU/G;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA,EAAE,QAAQ,KAAA,OAgB/D"}
|
package/lib/esm/utils/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/** Parses pasted/typed account text into a search term and field type. */
|
|
2
|
+
export function parseAccountSearchQuery(rawQuery) {
|
|
3
|
+
const trimmed = rawQuery.trim();
|
|
4
|
+
const displayFormatMatch = trimmed.match(/^(.+?)\s*\((\d+)\)\s*$/);
|
|
5
|
+
if (displayFormatMatch) {
|
|
6
|
+
return { query: displayFormatMatch[2], queryKey: 'accountNumber' };
|
|
7
|
+
}
|
|
8
|
+
if (!isNaN(trimmed) && trimmed !== '') {
|
|
9
|
+
return { query: trimmed, queryKey: 'accountNumber' };
|
|
10
|
+
}
|
|
11
|
+
return { query: trimmed, queryKey: 'name' };
|
|
12
|
+
}
|
|
1
13
|
/**
|
|
2
14
|
* The below function sorts the account search results based on the provided query string (account name or number).
|
|
3
15
|
* test
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.263",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@cee-eng/hydrajs": "4.18.111",
|
|
37
37
|
"@patternfly/react-core": "6.2.1",
|
|
38
38
|
"@patternfly/react-icons": "6.2.1",
|
|
39
|
-
"@rh-support/components": "2.5.
|
|
39
|
+
"@rh-support/components": "2.5.165",
|
|
40
40
|
"@rh-support/types": "2.0.26",
|
|
41
|
-
"@rh-support/user-permissions": "2.5.
|
|
42
|
-
"@rh-support/utils": "2.5.
|
|
41
|
+
"@rh-support/user-permissions": "2.5.111",
|
|
42
|
+
"@rh-support/utils": "2.5.92",
|
|
43
43
|
"i18next": "^23.15.0",
|
|
44
44
|
"localforage": "^1.10.0",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"defaults and supports es6-module",
|
|
90
90
|
"maintained node versions"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "807e479fdf2ee11467e286baeceb5856f0f32c00"
|
|
93
93
|
}
|