@rh-support/react-context 1.0.2 → 1.0.3
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/AccountSelector/AccountSelectorInternal.d.ts.map +1 -1
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.js +5 -10
- package/lib/esm/components/bookmarks/index.d.ts +0 -2
- package/lib/esm/components/bookmarks/index.d.ts.map +1 -1
- package/lib/esm/components/bookmarks/index.js +0 -2
- package/lib/esm/hooks/useUserPreferences.d.ts +2 -0
- package/lib/esm/hooks/useUserPreferences.d.ts.map +1 -1
- package/lib/esm/hooks/useUserPreferences.js +11 -0
- package/lib/esm/reducers/GlobalMetadataReducer.d.ts +2 -1
- package/lib/esm/reducers/GlobalMetadataReducer.d.ts.map +1 -1
- package/lib/esm/reducers/GlobalMetadataReducer.js +1 -0
- package/package.json +4 -4
- package/lib/esm/components/bookmarks/AddRemoveBookmark.d.ts +0 -12
- package/lib/esm/components/bookmarks/AddRemoveBookmark.d.ts.map +0 -1
- package/lib/esm/components/bookmarks/AddRemoveBookmark.js +0 -69
- package/lib/esm/components/bookmarks/AddRemoveBookmarkWrapper.d.ts +0 -3
- package/lib/esm/components/bookmarks/AddRemoveBookmarkWrapper.d.ts.map +0 -1
- package/lib/esm/components/bookmarks/AddRemoveBookmarkWrapper.js +0 -10
|
@@ -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;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAEhF,OAAO,EAAqB,kBAAkB,EAAoC,MAAM,wBAAwB,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;AAEhF,OAAO,EAAqB,kBAAkB,EAAoC,MAAM,wBAAwB,CAAC;AASjH,UAAU,MAAO,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IACjD,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;CAC3C;AAuBD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAsL7C;kBAtLQ,uBAAuB;;;AAyLhC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -10,14 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { accounts } from '@cee-eng/hydrajs';
|
|
11
11
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
12
12
|
import { AsyncDropDownList, AsyncMultiDropDownList, useFetch } from '@rh-support/components';
|
|
13
|
-
import { ability, resourceActions, resources } from '@rh-support/user-permissions';
|
|
14
13
|
import { toOption, toOptions } from '@rh-support/utils';
|
|
15
14
|
import assign from 'lodash/assign';
|
|
16
15
|
import isEmpty from 'lodash/isEmpty';
|
|
17
16
|
import uniqBy from 'lodash/uniqBy';
|
|
18
17
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
18
|
import { Trans, useTranslation } from 'react-i18next';
|
|
20
|
-
import { AddRemoveBookmarkWrapper } from '../bookmarks/AddRemoveBookmarkWrapper';
|
|
21
19
|
const defaultProps = {
|
|
22
20
|
id: '',
|
|
23
21
|
className: '',
|
|
@@ -43,7 +41,6 @@ function AccountSelectorInternal(props) {
|
|
|
43
41
|
const [items, setItems] = useState([]);
|
|
44
42
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
45
43
|
const { t } = useTranslation();
|
|
46
|
-
const canAccessBookmark = ability.can(resourceActions.READ, resources.BOOKMARK_ACCOUNTS);
|
|
47
44
|
const bookmarkedAccountsDeduped = uniqBy(props.bookmarkedAccounts, (b) => b.accountNumber);
|
|
48
45
|
useEffect(() => {
|
|
49
46
|
if (!props.multiple) {
|
|
@@ -72,13 +69,11 @@ function AccountSelectorInternal(props) {
|
|
|
72
69
|
.filter((account) => !!account && !props.excludeAccounts.find(({ accountId }) => accountId === account.accountId))
|
|
73
70
|
.map((account) => assign({
|
|
74
71
|
children: (React.createElement(React.Fragment, null, props.restrictedOnSubscriptionAbuse && account.subscriptionAbuse ? (React.createElement("span", { className: "form-instructions form-invalid" }, getDisplayName(account))) : (getDisplayName(account)))),
|
|
75
|
-
actionItem: (React.createElement(React.Fragment, null,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
" ",
|
|
81
|
-
React.createElement(Trans, null, "Subscription abuse"))))),
|
|
72
|
+
actionItem: (React.createElement(React.Fragment, null, props.restrictedOnSubscriptionAbuse && account.subscriptionAbuse && (React.createElement("span", { className: "form-instructions form-invalid pf-u-text-nowrap pf-u-pr-sm" },
|
|
73
|
+
' ',
|
|
74
|
+
React.createElement(InfoCircleIcon, null),
|
|
75
|
+
" ",
|
|
76
|
+
React.createElement(Trans, null, "Subscription abuse"))))),
|
|
82
77
|
}, account));
|
|
83
78
|
};
|
|
84
79
|
const fetchAccounts = (query) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/bookmarks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/bookmarks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -23,5 +23,7 @@ export declare function useUserPreferences(): {
|
|
|
23
23
|
updatePreferredLanguage: (value: string) => Promise<void>;
|
|
24
24
|
getDefaultGroup: () => any;
|
|
25
25
|
updateDefaultGroup: (value: string) => Promise<void>;
|
|
26
|
+
getOriginalCaseView: () => any;
|
|
27
|
+
updateOriginalCaseView: (value: any) => Promise<void>;
|
|
26
28
|
};
|
|
27
29
|
//# sourceMappingURL=useUserPreferences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserPreferences.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUserPreferences.tsx"],"names":[],"mappings":"AAKA,wBAAgB,kBAAkB;;sCAoBiB;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;;;+BAyJjD,MAAM;;;;oDApHe,MAAM;;mDAoBP,OAAO;;qDAgBL,OAAO;;oCAgBxB,MAAM;;kCAgBR,OAAO;;qCAgBJ,MAAM;;gCAgBX,MAAM
|
|
1
|
+
{"version":3,"file":"useUserPreferences.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUserPreferences.tsx"],"names":[],"mappings":"AAKA,wBAAgB,kBAAkB;;sCAoBiB;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;;;+BAyJjD,MAAM;;;;oDApHe,MAAM;;mDAoBP,OAAO;;qDAgBL,OAAO;;oCAgBxB,MAAM;;kCAgBR,OAAO;;qCAgBJ,MAAM;;gCAgBX,MAAM;;;EAsElD"}
|
|
@@ -109,6 +109,15 @@ export function useUserPreferences() {
|
|
|
109
109
|
return;
|
|
110
110
|
yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.commentType, value }], 'add', true, true);
|
|
111
111
|
});
|
|
112
|
+
// Will return 1 if caseViewPref is set to internal. If returning 0, it is assumed the user wants external view. No value means has not been chosen.
|
|
113
|
+
const getOriginalCaseView = () => {
|
|
114
|
+
return getKeyValue(UserPreferencesKeys.caseViewInternal);
|
|
115
|
+
};
|
|
116
|
+
const updateOriginalCaseView = (value) => __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
if (doesKeyExistWithSameValue(UserPreferencesKeys.caseViewInternal, value))
|
|
118
|
+
return;
|
|
119
|
+
yield updateUserPreferences(globalMetadataDispatch, loggedInUser.data.ssoUsername, [{ key: UserPreferencesKeys.caseViewInternal, value }], 'add', true, true);
|
|
120
|
+
});
|
|
112
121
|
return {
|
|
113
122
|
getHostnamesVisibilityObj,
|
|
114
123
|
updateShowHostnamesCount,
|
|
@@ -131,5 +140,7 @@ export function useUserPreferences() {
|
|
|
131
140
|
updatePreferredLanguage,
|
|
132
141
|
getDefaultGroup,
|
|
133
142
|
updateDefaultGroup,
|
|
143
|
+
getOriginalCaseView,
|
|
144
|
+
updateOriginalCaseView,
|
|
134
145
|
};
|
|
135
146
|
}
|
|
@@ -24,7 +24,8 @@ export declare enum UserPreferencesKeys {
|
|
|
24
24
|
preferredLanguage = "PCM-PreferredLanguage",
|
|
25
25
|
defaultGroups = "PCM-DefaultGroup",
|
|
26
26
|
showHostnames = "PCM-showHostName",
|
|
27
|
-
showNewPreferenceTooltip = "PCM-prefToolTipVisibility"
|
|
27
|
+
showNewPreferenceTooltip = "PCM-prefToolTipVisibility",
|
|
28
|
+
caseViewInternal = "PCM-caseViewInternal"
|
|
28
29
|
}
|
|
29
30
|
export declare const BOOKMARK_APPLICATION_NAME = "pcm";
|
|
30
31
|
export declare const BOOKMARK_NAME_SPACE = "customer-portal";
|
|
@@ -1 +1 @@
|
|
|
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,EAKH,4BAA4B,EAG/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;
|
|
1
|
+
{"version":3,"file":"GlobalMetadataReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/GlobalMetadata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Keys["showNewPreferenceTooltip"] = "PCM-prefToolTipVisibility";
|
|
36
|
+
UserPreferencesKeys["caseViewInternal"] = "PCM-caseViewInternal";
|
|
36
37
|
})(UserPreferencesKeys || (UserPreferencesKeys = {}));
|
|
37
38
|
export const BOOKMARK_APPLICATION_NAME = 'pcm';
|
|
38
39
|
export const BOOKMARK_NAME_SPACE = 'customer-portal';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@cee-eng/hydrajs": "4.13.0",
|
|
45
45
|
"@patternfly/react-core": "4.202.16",
|
|
46
46
|
"@patternfly/react-icons": "4.53.16",
|
|
47
|
-
"@rh-support/components": "1.2.
|
|
47
|
+
"@rh-support/components": "1.2.2",
|
|
48
48
|
"@rh-support/types": "0.2.0",
|
|
49
|
-
"@rh-support/user-permissions": "1.0.
|
|
49
|
+
"@rh-support/user-permissions": "1.0.2",
|
|
50
50
|
"@rh-support/utils": "1.0.1",
|
|
51
51
|
"i18next": "^19.0.1",
|
|
52
52
|
"localforage": "^1.7.3",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"not ie <= 11",
|
|
88
88
|
"not op_mini all"
|
|
89
89
|
],
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "727b155d872dbee66440d6fb874eef95d119bc3a"
|
|
91
91
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IAccount } from '@cee-eng/hydrajs/@types/models/account';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
interface IProps {
|
|
4
|
-
onToggleSuccess?: (isBookmarekdNow: boolean) => void;
|
|
5
|
-
selectedAccount: IAccount;
|
|
6
|
-
addBookmarkTitle: string;
|
|
7
|
-
removeBookmarkTitle: string;
|
|
8
|
-
onToggleClick?: (ev: any) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const AddRemoveBookmark: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
-
export { AddRemoveBookmark };
|
|
12
|
-
//# sourceMappingURL=AddRemoveBookmark.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddRemoveBookmark.d.ts","sourceRoot":"","sources":["../../../../src/components/bookmarks/AddRemoveBookmark.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAMlE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,UAAU,MAAM;IACZ,eAAe,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,eAAe,EAAE,QAAQ,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,EAAE,KAAA,KAAK,IAAI,CAAC;CAChC;AAED,QAAA,MAAM,iBAAiB,kFAmErB,CAAC;AAEH,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { accounts } from '@cee-eng/hydrajs';
|
|
11
|
-
import OutlinedStarIcon from '@patternfly/react-icons/dist/js/icons/outlined-star-icon';
|
|
12
|
-
import StarIcon from '@patternfly/react-icons/dist/js/icons/star-icon';
|
|
13
|
-
import { LoadingIndicator, ToastNotification, useFetch } from '@rh-support/components';
|
|
14
|
-
import find from 'lodash/find';
|
|
15
|
-
import isEmpty from 'lodash/isEmpty';
|
|
16
|
-
import React, { useContext } from 'react';
|
|
17
|
-
import { useTranslation } from 'react-i18next';
|
|
18
|
-
import { GlobalMetadataDispatchContext, GlobalMetadataStateContext } from '../../context/GlobalMetadataContext';
|
|
19
|
-
import { GlobalMetadataReducerConstants } from '../../reducers/GlobalMetadataReducer';
|
|
20
|
-
const AddRemoveBookmark = React.forwardRef(function (props, ref) {
|
|
21
|
-
var _a;
|
|
22
|
-
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
23
|
-
const { request: addBookmarkedAccounts, isFetching: isAddingBookmark } = useFetch(accounts.bookmarkAccount, {
|
|
24
|
-
propgateErrors: true,
|
|
25
|
-
});
|
|
26
|
-
const { request: removeBookmarkedAccounts, isFetching: isRemovingBookmark, } = useFetch(accounts.removeBookmarkedAccount, { propgateErrors: true });
|
|
27
|
-
const { globalMetadataState: { bookmarkedAccounts, loggedInUser }, } = useContext(GlobalMetadataStateContext);
|
|
28
|
-
const { t } = useTranslation();
|
|
29
|
-
/** Add remove bookmarks related */
|
|
30
|
-
const isSelectedAccountBookmarked = (number) => {
|
|
31
|
-
const bookmarkedAccount = find(bookmarkedAccounts.data, (account) => account.accountNumber === number);
|
|
32
|
-
return !isEmpty(bookmarkedAccount);
|
|
33
|
-
};
|
|
34
|
-
const addRemoveBookmarkedAccount = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
props.onToggleClick && props.onToggleClick(event);
|
|
36
|
-
event.preventDefault();
|
|
37
|
-
try {
|
|
38
|
-
const account = props.selectedAccount || {};
|
|
39
|
-
if (isSelectedAccountBookmarked(account.accountNumber)) {
|
|
40
|
-
yield removeBookmarkedAccounts(loggedInUser.data.ssoUsername, account.accountNumber);
|
|
41
|
-
dispatchToGlobalMetadataReducer({
|
|
42
|
-
type: GlobalMetadataReducerConstants.bookmarkRemoved,
|
|
43
|
-
payload: { account },
|
|
44
|
-
});
|
|
45
|
-
ToastNotification.addSuccessMessage(t(`Account has been successfully removed`));
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
yield addBookmarkedAccounts(loggedInUser.data.ssoUsername, account.accountNumber);
|
|
49
|
-
dispatchToGlobalMetadataReducer({
|
|
50
|
-
type: GlobalMetadataReducerConstants.bookmarkAdded,
|
|
51
|
-
payload: { account },
|
|
52
|
-
});
|
|
53
|
-
ToastNotification.addSuccessMessage(t(`Account has been successfully bookmarked`));
|
|
54
|
-
}
|
|
55
|
-
props.onToggleSuccess && props.onToggleSuccess(!isSelectedAccountBookmarked(account.accountNumber));
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
ToastNotification.addDangerMessage(t(`Bookmarked account failed to update`));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return (React.createElement("button", { ref: ref, disabled: isEmpty(props.selectedAccount), onClick: addRemoveBookmarkedAccount, className: "btn btn-app btn-link add-remove-bookmark", "data-tracking-id": `add-remove-bookmark-${props.selectedAccount && isSelectedAccountBookmarked((_a = props.selectedAccount) === null || _a === void 0 ? void 0 : _a.accountNumber)
|
|
62
|
-
? 'remove'
|
|
63
|
-
: 'add'}` },
|
|
64
|
-
React.createElement(LoadingIndicator, { isInline: true, show: isAddingBookmark || isRemovingBookmark, size: "xs" }),
|
|
65
|
-
!isAddingBookmark &&
|
|
66
|
-
!isRemovingBookmark &&
|
|
67
|
-
(!isEmpty(props.selectedAccount) && isSelectedAccountBookmarked(props.selectedAccount.accountNumber) ? (React.createElement(StarIcon, { color: "#F0AB00", title: props.removeBookmarkTitle })) : (React.createElement(OutlinedStarIcon, { title: props.addBookmarkTitle })))));
|
|
68
|
-
});
|
|
69
|
-
export { AddRemoveBookmark };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddRemoveBookmarkWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/bookmarks/AddRemoveBookmarkWrapper.tsx"],"names":[],"mappings":"AAMA,iBAAS,wBAAwB,CAAC,KAAK,KAAA,eAYtC;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { getConfigField, PCM_CONFIG_FIELD_TYPE } from '@rh-support/utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useGlobalStateContext } from '../../context/GlobalMetadataContext';
|
|
4
|
-
import { AddRemoveBookmark } from './AddRemoveBookmark';
|
|
5
|
-
function AddRemoveBookmarkWrapper(props) {
|
|
6
|
-
const { globalMetadataState: { pcmConfig }, } = useGlobalStateContext();
|
|
7
|
-
const isGroupBookmarkEnabled = getConfigField(pcmConfig.data, 'isGroupBookmarkEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
|
|
8
|
-
return React.createElement(React.Fragment, null, isGroupBookmarkEnabled ? React.createElement(React.Fragment, null) : React.createElement(AddRemoveBookmark, Object.assign({}, props)));
|
|
9
|
-
}
|
|
10
|
-
export { AddRemoveBookmarkWrapper };
|