@antscorp/antsomi-ui 1.8.3 → 1.8.4
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/es/components/icons/ExpandMoreIcon.d.ts +3 -0
- package/es/components/icons/ExpandMoreIcon.js +7 -0
- package/es/components/icons/index.d.ts +1 -0
- package/es/components/icons/index.js +1 -0
- package/es/components/molecules/AccountSelection/styled.js +1 -0
- package/es/components/molecules/Dropdown/Dropdown.d.ts +1 -0
- package/es/components/molecules/Dropdown/Dropdown.js +1 -1
- package/es/components/molecules/HeaderV2/HeaderV2.d.ts +1 -0
- package/es/components/molecules/HeaderV2/HeaderV2.js +2 -2
- package/es/components/molecules/HeaderV2/styled.js +1 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +7 -3
- package/es/components/molecules/ShareAccess/constants.d.ts +1 -0
- package/es/components/molecules/ShareAccess/constants.js +1 -0
- package/es/components/molecules/ShareAccess/utils.d.ts +1 -13
- package/es/components/molecules/ShareAccess/utils.js +4 -2
- package/es/components/organism/AccountSharing/AccountSharing.js +26 -11
- package/es/components/organism/LeftMenu/LeftMenu.js +2 -2
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +5 -14
- package/es/components/organism/LeftMenu/index.d.ts +1 -0
- package/es/components/template/Layout/Layout.js +7 -1
- package/es/providers/ConfigProvider/GlobalStyle.js +24 -4
- package/es/utils/cookie.d.ts +11 -0
- package/es/utils/cookie.js +33 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { useIcon } from './hooks/useIcon';
|
|
3
|
+
export const ExpandMoreIcon = forwardRef((props, ref) => {
|
|
4
|
+
const { width, height } = useIcon(props);
|
|
5
|
+
return (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { ref: ref, width: width, height: height }),
|
|
6
|
+
React.createElement("path", { d: "M16.5938 8.57812L18 9.98438L12 15.9844L6 9.98438L7.40625 8.57812L12 13.1719L16.5938 8.57812Z", fill: "currentColor" })));
|
|
7
|
+
});
|
|
@@ -14,7 +14,7 @@ import { Space, Typography } from 'antd';
|
|
|
14
14
|
import Icon from '@antscorp/icons';
|
|
15
15
|
import { StyledInputDropdownRoot } from './styled';
|
|
16
16
|
import clsx from 'clsx';
|
|
17
|
-
|
|
17
|
+
import './style.scss';
|
|
18
18
|
export { Dropdown } from 'antd';
|
|
19
19
|
const DefaultExpandIcon = React.createElement(Icon, { type: "icon-ants-expand-more" });
|
|
20
20
|
export const InputDropdown = (props) => {
|
|
@@ -32,7 +32,7 @@ export const HeaderV2 = memo(props => {
|
|
|
32
32
|
const { search } = useLocation();
|
|
33
33
|
const { replace } = useCustomRouter();
|
|
34
34
|
// * Prefer to use Header in AppConfigContext
|
|
35
|
-
const { show = true, className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
|
|
35
|
+
const { show = true, className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, onCLickLogo, } = props;
|
|
36
36
|
/** General config for children component */
|
|
37
37
|
const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
|
|
38
38
|
const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
|
|
@@ -110,7 +110,7 @@ export const HeaderV2 = memo(props => {
|
|
|
110
110
|
const QUOTE_ENTITY = React.createElement(React.Fragment, null, "\u00BB");
|
|
111
111
|
return (React.createElement(HeaderV2Styled, { "$show": show, className: className || '', style: style },
|
|
112
112
|
React.createElement("div", { className: "left-side" },
|
|
113
|
-
showLogo && (React.createElement(LogoWrapper, { className: "logo-wrapper" },
|
|
113
|
+
showLogo && (React.createElement(LogoWrapper, { className: "logo-wrapper", onClick: onCLickLogo },
|
|
114
114
|
React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" }))),
|
|
115
115
|
React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle, refreshOnSelect: true })),
|
|
116
116
|
React.createElement("div", { className: "title-container" },
|
|
@@ -3,12 +3,13 @@ import produce from 'immer';
|
|
|
3
3
|
import { Avatar, Dropdown, List } from 'antd';
|
|
4
4
|
import { remove, cloneDeep } from 'lodash';
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
|
-
import { ACCESS_PROPERTIES_BY_ROLE, PEOPLE_ACTION_KEYS, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from '../../constants';
|
|
6
|
+
import { ACCESS_PROPERTIES_BY_ROLE, PEOPLE_ACTION_KEYS, REGEX_REMOVE_NAME, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from '../../constants';
|
|
7
7
|
import { useShareAccess } from '../../hooks';
|
|
8
8
|
import { getActionsByUser } from '../../utils';
|
|
9
9
|
import { StyledPeopleAccessRoot } from './styled';
|
|
10
10
|
import { updateModalTransferOwnership, updateObjAccessInfo } from '../../actions';
|
|
11
11
|
import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
12
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
12
13
|
const ROLE_BY_ACTIONS = {
|
|
13
14
|
[PEOPLE_ACTION_KEYS.TO_OWNER]: ROLE_MAPPING.OWNER,
|
|
14
15
|
[PEOPLE_ACTION_KEYS.TO_EDITOR]: ROLE_MAPPING.EDITOR,
|
|
@@ -84,6 +85,7 @@ export const PeopleAccess = (props) => {
|
|
|
84
85
|
return (React.createElement(StyledPeopleAccessRoot, null,
|
|
85
86
|
React.createElement("div", { className: "title" }, "People with access"),
|
|
86
87
|
React.createElement(List, { dataSource: dataSourceSorted, loading: { spinning: dataSourceSorted.length === 0, indicator: React.createElement(Spin, null) }, renderItem: access => {
|
|
88
|
+
var _a;
|
|
87
89
|
const actions = getActionsByUser({
|
|
88
90
|
userId: accessUserId,
|
|
89
91
|
updatedUserId: access.userId,
|
|
@@ -97,8 +99,10 @@ export const PeopleAccess = (props) => {
|
|
|
97
99
|
return (React.createElement(List.Item, null,
|
|
98
100
|
React.createElement(Avatar, { src: access.avatar }),
|
|
99
101
|
React.createElement("div", { className: "info" },
|
|
100
|
-
React.createElement("div", { className: "name" },
|
|
101
|
-
|
|
102
|
+
React.createElement("div", { className: "name" },
|
|
103
|
+
REGEX_REMOVE_NAME.test(access.email || '') && (React.createElement("span", { style: { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.red6 } }, "[Deleted account]\u00A0")),
|
|
104
|
+
access.fullName || (access === null || access === void 0 ? void 0 : access.name)),
|
|
105
|
+
React.createElement("div", { className: "email" }, (_a = access.email) === null || _a === void 0 ? void 0 : _a.replace(REGEX_REMOVE_NAME, ''))),
|
|
102
106
|
React.createElement(Dropdown, { trigger: ['click'], disabled: !actions.length, overlayStyle: { zIndex: 3002 }, menu: {
|
|
103
107
|
items: renderActionItems(actions),
|
|
104
108
|
onClick: e => handleClickAction(e.key, access.userId),
|
|
@@ -26,19 +26,7 @@ export declare const getActionsByUser: (args: {
|
|
|
26
26
|
updatedUserId?: number;
|
|
27
27
|
objectAccessInfo?: ObjectAccessInfo;
|
|
28
28
|
omit?: Array<(typeof PEOPLE_ACTION_KEYS)[keyof typeof PEOPLE_ACTION_KEYS]>;
|
|
29
|
-
}) =>
|
|
30
|
-
readonly label: "Viewer";
|
|
31
|
-
readonly key: "to_viewer";
|
|
32
|
-
} | {
|
|
33
|
-
readonly label: "Editor";
|
|
34
|
-
readonly key: "to_editor";
|
|
35
|
-
} | {
|
|
36
|
-
readonly label: "Transfer ownership";
|
|
37
|
-
readonly key: "to_owner";
|
|
38
|
-
} | {
|
|
39
|
-
readonly label: "Remove Access";
|
|
40
|
-
readonly key: "remove_acess";
|
|
41
|
-
})[];
|
|
29
|
+
}) => any[];
|
|
42
30
|
export declare const initAccessInfoDefault: (userInfo: Partial<UserInfo>) => ObjectAccessInfo;
|
|
43
31
|
export declare const safeParseAccessInfo: (accessInfo: ObjectAccessInfo) => {
|
|
44
32
|
ownerId: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from './constants';
|
|
1
|
+
import { MENU_PERMISSION, PEOPLE_ACTIONS, PEOPLE_ACTION_KEYS, PUBLIC_ROLE, REGEX_REMOVE_NAME, ROLE_ACCESS_LABEL, ROLE_MAPPING, } from './constants';
|
|
2
2
|
import { remove } from 'lodash';
|
|
3
3
|
import { snakeCaseToCamelCase } from '@antscorp/antsomi-ui/es/utils';
|
|
4
4
|
export const mergePermission = (objectPermissionAllow, menuPermissionValue) => {
|
|
@@ -54,7 +54,9 @@ export const getActionsByUser = (args) => {
|
|
|
54
54
|
});
|
|
55
55
|
if ((!user && !isPublic) || !updatedUser || !allowEdit || updatedUser.userId === ownerId)
|
|
56
56
|
return [];
|
|
57
|
-
const actions =
|
|
57
|
+
const actions = REGEX_REMOVE_NAME.test(updatedUser.email || '')
|
|
58
|
+
? ['remove_acess']
|
|
59
|
+
: Object.values(PEOPLE_ACTION_KEYS);
|
|
58
60
|
if (userId !== ownerId || (omit === null || omit === void 0 ? void 0 : omit.includes('to_owner'))) {
|
|
59
61
|
remove(actions, actKey => actKey === PEOPLE_ACTION_KEYS.TO_OWNER);
|
|
60
62
|
}
|
|
@@ -19,12 +19,12 @@ import CloseIcon from './icons/close';
|
|
|
19
19
|
import SearchIcon from './icons/search';
|
|
20
20
|
import { InnerCardStyled, InputSearchStyled, PackageSharingStyled, TriggerPopoverStyled, } from './styled';
|
|
21
21
|
// Utils
|
|
22
|
-
import { formatUserId } from '@antscorp/antsomi-ui/es/utils';
|
|
22
|
+
import { formatUserId, removeAppCookieSessionSubdomain, removeAppCookieSessionSubdomainPrefix, } from '@antscorp/antsomi-ui/es/utils';
|
|
23
23
|
import { translate } from './utils';
|
|
24
24
|
import Icon from '@antscorp/icons';
|
|
25
25
|
import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
|
|
26
26
|
import { DEFAULT_TRANSLATE_DATA } from './constant';
|
|
27
|
-
import { THEME, UOGS_PREFIX } from '@antscorp/antsomi-ui/es/constants';
|
|
27
|
+
import { CDP_ROUTE, THEME, UOGS_PREFIX } from '@antscorp/antsomi-ui/es/constants';
|
|
28
28
|
import { useAppConfigContext } from '../../..';
|
|
29
29
|
// Constants
|
|
30
30
|
import { ENV } from '@antscorp/antsomi-ui/es/config';
|
|
@@ -60,7 +60,7 @@ export const AccountSharing = props => {
|
|
|
60
60
|
const [serverTranslateData, setServerTranslateData] = useState({});
|
|
61
61
|
const [language, setLanguage] = useState(lang || 'en');
|
|
62
62
|
const debounceSearch = useDebounce(accountSearch, 500);
|
|
63
|
-
const [
|
|
63
|
+
const [, setCookie] = useCookies();
|
|
64
64
|
const domain = iamDomain.charAt(iamDomain.length - 1) === '/' ? iamDomain : `${iamDomain}/`;
|
|
65
65
|
const translateLang = useMemo(() => translate(translateData, serverTranslateData, language), [serverTranslateData, language, translateData]);
|
|
66
66
|
const getInfoAccount = () => {
|
|
@@ -229,18 +229,33 @@ export const AccountSharing = props => {
|
|
|
229
229
|
});
|
|
230
230
|
// const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
231
231
|
const onClickButtonLogout = useCallback(() => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
// Handle remove cookie and redirect to login
|
|
233
|
+
removeAppCookieSessionSubdomainPrefix({ name: UOGS_PREFIX, env });
|
|
234
|
+
removeAppCookieSessionSubdomain({ name: 'c_pid', env });
|
|
235
|
+
removeAppCookieSessionSubdomain({ name: 'api_token', env });
|
|
236
|
+
removeAppCookieSessionSubdomain({ name: 'api_r_token', env });
|
|
237
|
+
removeAppCookieSessionSubdomain({ name: 'api_pid', env });
|
|
238
|
+
removeAppCookieSessionSubdomain({ name: 'user_id', env });
|
|
239
|
+
removeAppCookieSessionSubdomain({ name: 'user_logged_in_email', env });
|
|
240
|
+
removeAppCookieSessionSubdomain({ name: 'user_logged_in_full_name', env });
|
|
241
|
+
removeAppCookieSessionSubdomain({ name: 'user_logged_in_avatar', env });
|
|
242
|
+
removeAppCookieSessionSubdomain({ name: '_fe_ogs_pid', env });
|
|
243
|
+
localStorage.removeItem('cdp_decrypt_permission');
|
|
235
244
|
if (callbackLogout)
|
|
236
245
|
callbackLogout();
|
|
237
|
-
if
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
246
|
+
// Check if env is dev
|
|
247
|
+
if (env === ENV.DEV) {
|
|
241
248
|
window.location.reload();
|
|
249
|
+
return;
|
|
242
250
|
}
|
|
243
|
-
|
|
251
|
+
// Handle logout with cdp domain
|
|
252
|
+
window.location.href = `${CDP_ROUTE[ENV.PROD]}/iam#/login`;
|
|
253
|
+
// if (urlLogout) {
|
|
254
|
+
// window.location.href = urlLogout;
|
|
255
|
+
// } else {
|
|
256
|
+
// window.location.reload();
|
|
257
|
+
// }
|
|
258
|
+
}, [callbackLogout, env]);
|
|
244
259
|
useEffect(() => {
|
|
245
260
|
const logoutEvent = (event) => {
|
|
246
261
|
const { data } = event;
|
|
@@ -18,7 +18,7 @@ import { useLeftMenuContext } from './contexts';
|
|
|
18
18
|
const SubLogoAntsomi = 'https://st-media-template.antsomi.com/icons/antsomi/antsomi.png';
|
|
19
19
|
const homePermissionCode = 'DASHBOARD';
|
|
20
20
|
export const LeftMenuComponent = memo(props => {
|
|
21
|
-
const { show = true, style, className, customization, showLogo = true } = props;
|
|
21
|
+
const { show = true, style, className, customization, showLogo = true, onClickLogo } = props;
|
|
22
22
|
const { showMenuPopover = true, showButtonExpand = true, type, items = [], onMenuItemClick, } = customization || {};
|
|
23
23
|
const appHoverMenuChildren = useLeftMenuContext(store => store.appHoverMenuChildren);
|
|
24
24
|
const customHoverMenuChildren = useLeftMenuContext(store => store.customHoverMenuChildren);
|
|
@@ -109,7 +109,7 @@ export const LeftMenuComponent = memo(props => {
|
|
|
109
109
|
return (React.createElement(LeftMenuNavWrapper, { "$show": show, style: style, "$isExpandMenu": state.isExpandMenu, className: className },
|
|
110
110
|
React.createElement(LeftMenuNav, { className: "left-menu-nav" },
|
|
111
111
|
React.createElement(FeatureMenuWrapper, { vertical: true, onMouseEnter: () => onShowPopover(), onMouseLeave: onMouseLeave },
|
|
112
|
-
showLogo && (React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: onHoverMenuBar },
|
|
112
|
+
showLogo && (React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: onHoverMenuBar, onClick: onClickLogo },
|
|
113
113
|
React.createElement("div", { className: "image-wrapper" },
|
|
114
114
|
React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" })))),
|
|
115
115
|
React.createElement(FeatureMenu, { role: "menu", className: "antsomi-scroll-box" },
|
|
@@ -13,8 +13,8 @@ import { DASHBOARD_MODULE_CONFIG } from '../../../template/Layout/constants';
|
|
|
13
13
|
import { usePermission } from './usePermission';
|
|
14
14
|
import { useCustomRouter, useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
|
|
15
15
|
import { useNavigatePath } from './useNavigatePath';
|
|
16
|
+
const cookies = new ReactCookies();
|
|
16
17
|
export const useLeftMenu = (props) => {
|
|
17
|
-
// Props
|
|
18
18
|
const { objectType = DASHBOARD_MODULE_CONFIG.objectType, objectId = DASHBOARD_MODULE_CONFIG.objectId, isGrouped = DASHBOARD_MODULE_CONFIG.isGrouped, appConfig, customization, onActiveMenuCodeChange, } = props;
|
|
19
19
|
const { defaultExpandMenu, type, items, activeKey, onMenuItemClick } = customization || {};
|
|
20
20
|
const mappedActiveKey = useMemo(() => {
|
|
@@ -36,7 +36,6 @@ export const useLeftMenu = (props) => {
|
|
|
36
36
|
return activeKey;
|
|
37
37
|
}
|
|
38
38
|
}, [activeKey, type]);
|
|
39
|
-
const cookies = new ReactCookies();
|
|
40
39
|
const { pathname, hash, origin } = window.location;
|
|
41
40
|
const { navigate } = useCustomRouter();
|
|
42
41
|
const { isPushDifferentDomain, getPath, navigatePath } = useNavigatePath();
|
|
@@ -46,21 +45,13 @@ export const useLeftMenu = (props) => {
|
|
|
46
45
|
const { auth, env } = appConfig || {};
|
|
47
46
|
const timeoutPopover = useRef(null);
|
|
48
47
|
const openLeftMenuCookies = cookies.get('_leftmenu_state');
|
|
49
|
-
const isOpenMenu = !isNil(openLeftMenuCookies) ? Boolean(openLeftMenuCookies) :
|
|
48
|
+
const isOpenMenu = !isNil(openLeftMenuCookies) ? Boolean(openLeftMenuCookies) : false;
|
|
50
49
|
const [state, setState] = useState({
|
|
51
50
|
hoverItem: '',
|
|
52
51
|
isShowPopover: false,
|
|
53
|
-
isExpandMenu:
|
|
52
|
+
isExpandMenu: isBoolean(defaultExpandMenu) ? defaultExpandMenu : isOpenMenu,
|
|
54
53
|
});
|
|
55
54
|
const { mappingChildrenMenu, flattenMenuPermission, menuListPermission, permissionMenu, activeItemPath, } = usePermission();
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (isBoolean(defaultExpandMenu)) {
|
|
58
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { isExpandMenu: defaultExpandMenu })));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { isExpandMenu: isOpenMenu })));
|
|
62
|
-
}
|
|
63
|
-
}, [defaultExpandMenu, isOpenMenu]);
|
|
64
55
|
const onMenuClick = useCallback((key, keyPath) => {
|
|
65
56
|
if (type === 'recommendation') {
|
|
66
57
|
setLeftMenuContextState({ customActiveCurrentKey: key });
|
|
@@ -68,7 +59,7 @@ export const useLeftMenu = (props) => {
|
|
|
68
59
|
onMenuItemClick === null || onMenuItemClick === void 0 ? void 0 : onMenuItemClick(key, [...keyPath, customActiveAppKey]);
|
|
69
60
|
}, [customActiveAppKey, onMenuItemClick, setLeftMenuContextState, type]);
|
|
70
61
|
useDeepCompareEffect(() => {
|
|
71
|
-
if (
|
|
62
|
+
if (defaultExpandMenu === undefined) {
|
|
72
63
|
cookies.set('_leftmenu_state', state.isExpandMenu ? 1 : 0, {
|
|
73
64
|
domain: `.${origin.split('.').splice(-2).join('.')}`,
|
|
74
65
|
path: '/',
|
|
@@ -76,7 +67,7 @@ export const useLeftMenu = (props) => {
|
|
|
76
67
|
secure: true,
|
|
77
68
|
});
|
|
78
69
|
}
|
|
79
|
-
}, [
|
|
70
|
+
}, [cookies, defaultExpandMenu, origin, state.isExpandMenu]);
|
|
80
71
|
useDeepCompareEffect(() => {
|
|
81
72
|
setLeftMenuContextState({
|
|
82
73
|
appConfig,
|
|
@@ -20,6 +20,7 @@ export interface LeftMenuProps {
|
|
|
20
20
|
defaultExpandMenu?: boolean;
|
|
21
21
|
onMenuItemClick?: (key: string, keyPath: string[]) => void;
|
|
22
22
|
};
|
|
23
|
+
onClickLogo?: () => void;
|
|
23
24
|
onActiveMenuCodeChange?: (activeItemPath: TFeatureMenu[], flattenPermissionList?: FeatureMenuPermission[], menuListPermission?: FeatureMenuPermission[]) => void;
|
|
24
25
|
}
|
|
25
26
|
export declare const LeftMenu: React.MemoExoticComponent<(props: LeftMenuProps) => React.JSX.Element | null>;
|
|
@@ -276,6 +276,12 @@ export const Layout = memo(props => {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}, [antsProcessingNotificationConfig, env]);
|
|
279
|
+
const onCLickLogo = useCallback(() => {
|
|
280
|
+
// Redirect to recommendation
|
|
281
|
+
if (env !== ENV.DEV) {
|
|
282
|
+
window.location.assign(`${CDP_ROUTE[env || 'development']}/gen2/${portalId}/dashboard/recommendation`);
|
|
283
|
+
}
|
|
284
|
+
}, [env, portalId]);
|
|
279
285
|
return (React.createElement(LayoutWrapper, { showLeftMenu: !!showLeftMenu },
|
|
280
286
|
React.createElement(Helmet, null,
|
|
281
287
|
React.createElement("meta", { charSet: "utf-8" }),
|
|
@@ -285,7 +291,7 @@ export const Layout = memo(props => {
|
|
|
285
291
|
? header === null || header === void 0 ? void 0 : header.pageTitle
|
|
286
292
|
: ''
|
|
287
293
|
: activePageTitle))),
|
|
288
|
-
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { show: !showOnlyContent, showLogo: !showLeftMenu })),
|
|
294
|
+
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { show: !showOnlyContent, showLogo: !showLeftMenu, onCLickLogo: onCLickLogo })),
|
|
289
295
|
React.createElement(Flex, { className: "layout-body" },
|
|
290
296
|
React.createElement(LeftMenu, Object.assign({ show: showLeftMenu && !showOnlyContent, className: `layout-body__menu ${leftMenuClassName}` }, mergeLeftMenuProps, { customization: Object.assign(Object.assign({}, mergeLeftMenuProps.customization), {
|
|
291
297
|
// If user has access denied, disable expandable
|
|
@@ -186,14 +186,34 @@ export const GlobalStyle = () => {
|
|
|
186
186
|
|
|
187
187
|
// NOTE: Just hot fix for easy looking
|
|
188
188
|
.antsomi-btn-primary.antsomi-btn-compact-item.antsomi-btn-compact-first-item {
|
|
189
|
-
padding-right:
|
|
189
|
+
padding-right: 6px !important;
|
|
190
190
|
}
|
|
191
191
|
.antsomi-btn-compact-item.antsomi-btn-primary.antsomi-btn-compact-last-item {
|
|
192
192
|
width: fit-content;
|
|
193
|
-
padding: 0px !important;
|
|
194
|
-
padding
|
|
193
|
+
//padding: 0px !important;
|
|
194
|
+
padding: 0px 4px !important;
|
|
195
195
|
&::before {
|
|
196
|
-
|
|
196
|
+
content: '';
|
|
197
|
+
position: absolute;
|
|
198
|
+
left: 0px;
|
|
199
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue5} !important;
|
|
200
|
+
top: auto !important;
|
|
201
|
+
height: 80% !important;
|
|
202
|
+
width: 1px !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&:disabled {
|
|
206
|
+
&::before {
|
|
207
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw4} !important;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&:not(:disabled) {
|
|
212
|
+
&:hover {
|
|
213
|
+
&:: before {
|
|
214
|
+
opacity: 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
197
217
|
}
|
|
198
218
|
}
|
|
199
219
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TEnv } from '../types/config';
|
|
2
|
+
interface RemoveCookieSubDomain {
|
|
3
|
+
name: string;
|
|
4
|
+
env?: TEnv;
|
|
5
|
+
cookieOptions?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export declare const removeCookieSubDomain: ({ name, env, cookieOptions, }: RemoveCookieSubDomain) => void;
|
|
8
|
+
export declare const removeAppCookieSessionSubdomain: (args: RemoveCookieSubDomain) => void;
|
|
9
|
+
export declare const removeAppCookieSession: (args: RemoveCookieSubDomain) => void;
|
|
10
|
+
export declare const removeAppCookieSessionSubdomainPrefix: (args: RemoveCookieSubDomain) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import { Cookies } from 'react-cookie';
|
|
3
|
+
import { ENV } from '../config';
|
|
4
|
+
const cookies = new Cookies(null, {
|
|
5
|
+
path: '/',
|
|
6
|
+
sameSite: 'none',
|
|
7
|
+
secure: true,
|
|
8
|
+
});
|
|
9
|
+
export const removeCookieSubDomain = ({ name, env = 'development', cookieOptions, }) => {
|
|
10
|
+
const arrTmp = location.hostname.split('.');
|
|
11
|
+
cookies.remove(name, Object.assign(Object.assign(Object.assign({}, (env !== ENV.DEV && {
|
|
12
|
+
domain: `.${arrTmp.length < 4 ? arrTmp.slice(-2).join('.') : arrTmp.slice(-3).join('.')}`,
|
|
13
|
+
})), { path: '/', sameSite: 'none', secure: true }), cookieOptions));
|
|
14
|
+
};
|
|
15
|
+
export const removeAppCookieSessionSubdomain = (args) => {
|
|
16
|
+
removeCookieSubDomain(args);
|
|
17
|
+
if (typeof Storage !== undefined) {
|
|
18
|
+
sessionStorage.removeItem(args.name);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const removeAppCookieSession = (args) => {
|
|
22
|
+
cookies.remove(args === null || args === void 0 ? void 0 : args.name, args === null || args === void 0 ? void 0 : args.cookieOptions);
|
|
23
|
+
if (typeof Storage !== undefined) {
|
|
24
|
+
sessionStorage.removeItem(args.name);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const removeAppCookieSessionSubdomainPrefix = (args) => {
|
|
28
|
+
Object.keys(cookies.getAll()).forEach(cookieName => {
|
|
29
|
+
if (cookieName.startsWith(args.name)) {
|
|
30
|
+
removeAppCookieSessionSubdomain(Object.assign(Object.assign({}, args), { name: cookieName }));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED