@antscorp/antsomi-ui 1.3.5-beta.160 → 1.3.5-beta.161
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/assets/images/logo/sub-logo-antsomi.png +0 -0
- package/es/components/common/ConfigProvider/ConfigProvider.js +8 -0
- package/es/components/common/ConfigProvider/GlobalStyle.js +6 -0
- package/es/components/index.d.ts +0 -1
- package/es/components/index.js +0 -1
- package/es/components/molecules/AccountSelection/AccountSelection.d.ts +16 -0
- package/es/components/molecules/AccountSelection/AccountSelection.js +33 -0
- package/es/components/molecules/AccountSelection/components/AccountItem.d.ts +10 -0
- package/es/components/molecules/AccountSelection/components/AccountItem.js +11 -0
- package/es/components/molecules/AccountSelection/components/index.d.ts +1 -0
- package/es/components/molecules/AccountSelection/components/index.js +1 -0
- package/es/components/molecules/AccountSelection/index.d.ts +1 -0
- package/es/components/molecules/AccountSelection/index.js +1 -0
- package/es/components/molecules/AccountSelection/styled.d.ts +2 -0
- package/es/components/molecules/AccountSelection/styled.js +95 -0
- package/es/components/molecules/HeaderV2/HeaderV2.d.ts +31 -0
- package/es/components/molecules/HeaderV2/HeaderV2.js +66 -0
- package/es/components/molecules/HeaderV2/constants.d.ts +1 -0
- package/es/components/molecules/HeaderV2/constants.js +1 -0
- package/es/components/molecules/HeaderV2/index.d.ts +1 -0
- package/es/components/molecules/HeaderV2/index.js +1 -0
- package/es/components/molecules/HeaderV2/styled.d.ts +1 -0
- package/es/components/molecules/HeaderV2/styled.js +28 -0
- package/es/components/molecules/index.d.ts +2 -0
- package/es/components/molecules/index.js +2 -0
- package/es/components/organism/AccountSharing/AccountSharing.d.ts +19 -0
- package/es/components/organism/AccountSharing/AccountSharing.js +443 -0
- package/es/components/organism/AccountSharing/constant.d.ts +20 -0
- package/es/components/organism/AccountSharing/constant.js +20 -0
- package/es/components/organism/AccountSharing/icons/close.d.ts +3 -0
- package/es/components/organism/AccountSharing/icons/close.js +5 -0
- package/es/components/organism/AccountSharing/icons/search.d.ts +3 -0
- package/es/components/organism/AccountSharing/icons/search.js +5 -0
- package/es/components/organism/AccountSharing/index.d.ts +1 -0
- package/es/components/organism/AccountSharing/index.js +1 -0
- package/es/components/organism/AccountSharing/styled.d.ts +3 -0
- package/es/components/organism/AccountSharing/styled.js +341 -0
- package/es/components/organism/AccountSharing/utils.d.ts +1 -0
- package/es/components/organism/AccountSharing/utils.js +4 -0
- package/es/components/organism/Help/Help.js +10 -10
- package/es/components/organism/Help/styled.d.ts +3 -0
- package/es/components/organism/Help/styled.js +14 -2
- package/es/components/organism/Help/types.d.ts +2 -2
- package/es/components/organism/LeftMenu/components/ContentMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/ContentMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/ContentMenu/useContentMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/ContentMenu/useContentMenu.js +12 -0
- package/es/components/organism/LeftMenu/components/DataMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/DataMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/DataMenu/useDataMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/DataMenu/useDataMenu.js +12 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/constants.d.ts +6 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/constants.js +27 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/index.js +20 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/styled.d.ts +5 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/styled.js +23 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.d.ts +4 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +84 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/utils.d.ts +1 -0
- package/es/components/organism/LeftMenu/components/HomeMenu/utils.js +30 -0
- package/es/components/organism/LeftMenu/components/InsightsMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/InsightsMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/InsightsMenu/useInsightsMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/InsightsMenu/useInsightsMenu.js +12 -0
- package/es/components/organism/LeftMenu/components/MarketingMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/MarketingMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/MarketingMenu/useMarketingMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/MarketingMenu/useMarketingMenu.js +49 -0
- package/es/components/organism/LeftMenu/components/ProfilesMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/ProfilesMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/ProfilesMenu/useProfilesMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/ProfilesMenu/useProfilesMenu.js +13 -0
- package/es/components/organism/LeftMenu/components/SettingsMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/SettingsMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/SettingsMenu/useSettingsMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/SettingsMenu/useSettingsMenu.js +13 -0
- package/es/components/organism/LeftMenu/components/TemplatesMenu/index.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/TemplatesMenu/index.js +10 -0
- package/es/components/organism/LeftMenu/components/TemplatesMenu/useTemplatesMenu.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/TemplatesMenu/useTemplatesMenu.js +13 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/components/MenuItemImage/index.d.ts +7 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/components/MenuItemImage/index.js +9 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/components/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/components/index.js +1 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/constants/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/constants/index.js +1 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/constants/sampleData.d.ts +2 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/constants/sampleData.js +39 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.d.ts +7 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +59 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/styled.d.ts +3 -0
- package/es/components/organism/LeftMenu/components/common/ChildMenu/styled.js +37 -0
- package/es/components/organism/LeftMenu/components/common/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/components/common/index.js +1 -0
- package/es/components/organism/LeftMenu/components/index.d.ts +8 -0
- package/es/components/organism/LeftMenu/components/index.js +8 -0
- package/es/components/organism/LeftMenu/constants/index.d.ts +3 -0
- package/es/components/organism/LeftMenu/constants/index.js +3 -0
- package/es/components/organism/LeftMenu/constants/links.d.ts +1 -0
- package/es/components/organism/LeftMenu/constants/links.js +1 -0
- package/es/components/organism/LeftMenu/constants/sampleData.d.ts +7 -0
- package/es/components/organism/LeftMenu/constants/sampleData.js +985 -0
- package/es/components/organism/LeftMenu/constants/variables.d.ts +15 -0
- package/es/components/organism/LeftMenu/constants/variables.js +15 -0
- package/es/components/organism/LeftMenu/contexts/index.d.ts +13 -0
- package/es/components/organism/LeftMenu/contexts/index.js +10 -0
- package/es/components/organism/LeftMenu/hooks/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/hooks/index.js +1 -0
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.d.ts +18 -0
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +94 -0
- package/es/components/organism/LeftMenu/index.d.ts +9 -0
- package/es/components/organism/LeftMenu/index.js +91 -0
- package/es/components/organism/LeftMenu/styled.d.ts +13 -0
- package/es/components/organism/LeftMenu/styled.js +210 -0
- package/es/components/organism/LeftMenu/types/index.d.ts +27 -0
- package/es/components/organism/LeftMenu/types/index.js +1 -0
- package/es/components/organism/LeftMenu/utils/index.d.ts +6 -0
- package/es/components/organism/LeftMenu/utils/index.js +69 -0
- package/es/components/organism/Notification/Notification.d.ts +10 -0
- package/es/components/organism/Notification/Notification.js +245 -0
- package/es/components/organism/Notification/index.d.ts +1 -0
- package/es/components/organism/Notification/index.js +1 -0
- package/es/components/organism/Notification/styled.d.ts +8 -0
- package/es/components/organism/Notification/styled.js +148 -0
- package/es/components/organism/index.d.ts +3 -0
- package/es/components/organism/index.js +3 -0
- package/es/components/template/Layout/index.d.ts +8 -0
- package/es/components/template/Layout/index.js +51 -0
- package/es/components/template/Layout/styled.d.ts +4 -0
- package/es/components/template/Layout/styled.js +57 -0
- package/es/components/template/index.d.ts +1 -0
- package/es/components/template/index.js +1 -0
- package/es/config/index.d.ts +4 -0
- package/es/config/index.js +7 -0
- package/es/constants/api.d.ts +13 -0
- package/es/constants/api.js +13 -0
- package/es/constants/index.d.ts +2 -0
- package/es/constants/index.js +2 -0
- package/es/constants/permissions.d.ts +6 -0
- package/es/constants/permissions.js +6 -0
- package/es/constants/queries.d.ts +6 -0
- package/es/constants/queries.js +8 -0
- package/es/constants/theme.js +6 -0
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/useEffectDebugger.d.ts +20 -0
- package/es/hooks/useEffectDebugger.js +39 -0
- package/es/hooks/useIsFirstRender.d.ts +1 -0
- package/es/hooks/useIsFirstRender.js +9 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/models/AccountListing.d.ts +15 -0
- package/es/models/AccountListing.js +1 -0
- package/es/models/LeftMenu/Dashboard.d.ts +44 -0
- package/es/models/LeftMenu/Dashboard.js +1 -0
- package/es/models/LeftMenu/DestinationChannel.d.ts +15 -0
- package/es/models/LeftMenu/DestinationChannel.js +1 -0
- package/es/models/LeftMenu/FeatureMenu.d.ts +42 -0
- package/es/models/LeftMenu/FeatureMenu.js +54 -0
- package/es/models/LeftMenu/FeatureMenuPermission.d.ts +43 -0
- package/es/models/LeftMenu/FeatureMenuPermission.js +1 -0
- package/es/models/LeftMenu/index.d.ts +4 -0
- package/es/models/LeftMenu/index.js +4 -0
- package/es/providers/AppConfigProvider/contexts/index.d.ts +16 -0
- package/es/providers/AppConfigProvider/contexts/index.js +10 -0
- package/es/providers/AppConfigProvider/index.d.ts +1 -0
- package/es/providers/AppConfigProvider/index.js +1 -0
- package/es/providers/ConfigProvider/ConfigProvider.d.ts +13 -0
- package/es/providers/ConfigProvider/ConfigProvider.js +65 -0
- package/es/providers/ConfigProvider/GlobalStyle.d.ts +5 -0
- package/es/providers/ConfigProvider/GlobalStyle.js +848 -0
- package/es/providers/ConfigProvider/index.d.ts +1 -0
- package/es/providers/ConfigProvider/index.js +1 -0
- package/es/providers/index.d.ts +2 -0
- package/es/providers/index.js +2 -0
- package/es/queries/Account/index.d.ts +1 -0
- package/es/queries/Account/index.js +1 -0
- package/es/queries/Account/useGetAccountList.d.ts +15 -0
- package/es/queries/Account/useGetAccountList.js +15 -0
- package/es/queries/LeftMenu/index.d.ts +23 -0
- package/es/queries/LeftMenu/index.js +23 -0
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/Account/index.d.ts +12 -0
- package/es/services/Account/index.js +65 -0
- package/es/services/LeftMenu/index.d.ts +40 -0
- package/es/services/LeftMenu/index.js +134 -0
- package/es/services/LeftMenu/utils.d.ts +9 -0
- package/es/services/LeftMenu/utils.js +135 -0
- package/es/test.js +51 -1
- package/es/types/api.d.ts +6 -0
- package/es/types/api.js +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/utils/common.d.ts +23 -6
- package/es/utils/common.js +96 -43
- package/package.json +12 -5
- package/es/components/common/index.d.ts +0 -1
- package/es/components/common/index.js +0 -1
|
Binary file
|
|
@@ -16,6 +16,7 @@ import dayjs from 'dayjs';
|
|
|
16
16
|
import React, { useEffect } from 'react';
|
|
17
17
|
import weekday from 'dayjs/plugin/weekday';
|
|
18
18
|
import localeData from 'dayjs/plugin/localeData';
|
|
19
|
+
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
19
20
|
/** dayjs plugins for timezone */
|
|
20
21
|
import utc from 'dayjs/plugin/utc';
|
|
21
22
|
import timezone from 'dayjs/plugin/timezone';
|
|
@@ -28,11 +29,18 @@ import '@antscorp/antsomi-ui/es/assets/css/main.scss';
|
|
|
28
29
|
// import '@antscorp/antsomi-ui/es/locales/i18n';
|
|
29
30
|
import i18next from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
30
31
|
import 'animate.css';
|
|
32
|
+
// Providers
|
|
33
|
+
// import {
|
|
34
|
+
// QueryClientProviderAntsomiUI,
|
|
35
|
+
// QueryDevtoolsAntsomiUI,
|
|
36
|
+
// queryClientAntsomiUI,
|
|
37
|
+
// } from '@antscorp/antsomi-ui/es/queries';
|
|
31
38
|
// NOTE: HOT fix DatePicker Advanced
|
|
32
39
|
dayjs.extend(weekday);
|
|
33
40
|
dayjs.extend(localeData);
|
|
34
41
|
dayjs.extend(utc);
|
|
35
42
|
dayjs.extend(timezone);
|
|
43
|
+
dayjs.extend(relativeTime);
|
|
36
44
|
const ConfigProvider = props => {
|
|
37
45
|
// Props
|
|
38
46
|
const { children, locale } = props, restOfProps = __rest(props, ["children", "locale"]);
|
|
@@ -84,6 +84,12 @@ export const GlobalStyle = () => {
|
|
|
84
84
|
width: 36px !important;
|
|
85
85
|
height: 36px !important;
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
&.antsomi-btn-icon-only.antsomi-btn-sm {
|
|
89
|
+
/* Important to override the above code before */
|
|
90
|
+
width: 24px !important;
|
|
91
|
+
height: 24px !important;
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
.antsomi-btn-text:disabled,
|
package/es/components/index.d.ts
CHANGED
package/es/components/index.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AccountSelectionProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
apiConfig: {
|
|
5
|
+
domain: string;
|
|
6
|
+
token: string;
|
|
7
|
+
userId: number;
|
|
8
|
+
portalId?: number;
|
|
9
|
+
languageCode?: string;
|
|
10
|
+
};
|
|
11
|
+
showAllAccount?: boolean;
|
|
12
|
+
currentAccount?: number | 'ALL_ACCOUNT';
|
|
13
|
+
inputStyle?: 'select' | 'input';
|
|
14
|
+
onChange?: (userId: number | 'ALL_ACCOUNT') => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const AccountSelection: React.FC<AccountSelectionProps>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Icon from '@antscorp/icons';
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { Input, Popover, Text } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
4
|
+
import { AccountItem } from './components';
|
|
5
|
+
import { AccountSelectionStyled, PopoverFieldStyled } from './styled';
|
|
6
|
+
import { useGetAccountList, useGetRecentAccount } from '../../..';
|
|
7
|
+
import { Tooltip } from 'antd';
|
|
8
|
+
import { searchStringQuery } from '@antscorp/antsomi-ui/es/utils';
|
|
9
|
+
export const AccountSelection = props => {
|
|
10
|
+
const { className, apiConfig, showAllAccount = true, currentAccount, inputStyle = 'input', onChange, } = props;
|
|
11
|
+
const { data } = useGetAccountList({ apiConfig });
|
|
12
|
+
const { data: recentData } = useGetRecentAccount({ apiConfig });
|
|
13
|
+
const [open, setOpen] = useState(false);
|
|
14
|
+
const [searchValue, setSearchValue] = useState('');
|
|
15
|
+
const currentAccountInfo = useMemo(() => data === null || data === void 0 ? void 0 : data.entries.find(account => account.userId === currentAccount), [data, currentAccount]);
|
|
16
|
+
const handleSelectAccount = useCallback((userId) => {
|
|
17
|
+
setOpen(false);
|
|
18
|
+
if (onChange)
|
|
19
|
+
onChange(userId);
|
|
20
|
+
}, [onChange]);
|
|
21
|
+
return (React.createElement(Popover, { content: React.createElement(AccountSelectionStyled, { className: className },
|
|
22
|
+
React.createElement(Input, { placeholder: "Search", suffix: React.createElement(Icon, { type: "icon-ants-search-2", style: { fontSize: '24px' } }), value: searchValue, onChange: event => setSearchValue(event.target.value) }),
|
|
23
|
+
React.createElement(Text, { className: "recent-text" }, "Recent"),
|
|
24
|
+
React.createElement("ul", null, recentData === null || recentData === void 0 ? void 0 : recentData.value.map(accountId => data === null || data === void 0 ? void 0 : data.entries.find(account => account.userId === accountId)).filter(Boolean).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: currentAccount === account.userId })))),
|
|
25
|
+
React.createElement("ul", { className: "account-list" }, data === null || data === void 0 ? void 0 : data.entries.filter(account => !(recentData === null || recentData === void 0 ? void 0 : recentData.value.includes(account.userId)) &&
|
|
26
|
+
searchStringQuery(account.userName, searchValue)).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: currentAccount === account.userId })))),
|
|
27
|
+
showAllAccount ? (React.createElement(Text, { className: `all-account ${currentAccount === 'ALL_ACCOUNT' ? 'is-selected' : ''}`, onClick: () => handleSelectAccount('ALL_ACCOUNT') },
|
|
28
|
+
React.createElement("strong", null, "All account"))) : null), trigger: "click", overlayInnerStyle: { padding: 0 }, placement: "bottomLeft", arrow: false, open: open, onOpenChange: setOpen },
|
|
29
|
+
React.createElement(PopoverFieldStyled, { className: inputStyle },
|
|
30
|
+
React.createElement(Tooltip, { title: currentAccount === 'ALL_ACCOUNT' ? 'All account' : currentAccountInfo === null || currentAccountInfo === void 0 ? void 0 : currentAccountInfo.userName },
|
|
31
|
+
React.createElement("span", null, currentAccount === 'ALL_ACCOUNT' ? 'All account' : currentAccountInfo === null || currentAccountInfo === void 0 ? void 0 : currentAccountInfo.userName)),
|
|
32
|
+
React.createElement(Icon, { type: "icon-ants-angle-down", style: { width: '20px', textAlign: 'center' } }))));
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AccountItemProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
userName: string;
|
|
5
|
+
userId: number;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
onClick?: (userId: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const AccountItem: React.FC<AccountItemProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, Typography } from '../../../atoms';
|
|
3
|
+
import { formatUserId } from '@antscorp/antsomi-ui/es/utils';
|
|
4
|
+
export const AccountItem = React.memo(props => {
|
|
5
|
+
const { className, userName, userId, isSelected, onClick } = props;
|
|
6
|
+
return (
|
|
7
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
8
|
+
React.createElement("li", { onClick: () => onClick && onClick(userId), className: `${className || ''} ${isSelected ? 'is-selected' : ''}` },
|
|
9
|
+
React.createElement(Typography.Text, { className: "account-name", ellipsis: { tooltip: true } }, userName),
|
|
10
|
+
React.createElement(Text, { className: "account-id" }, formatUserId(userId))));
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccountItem } from './AccountItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccountItem } from './AccountItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccountSelection, type AccountSelectionProps } from './AccountSelection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccountSelection } from './AccountSelection';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
export const AccountSelectionStyled = styled.div `
|
|
5
|
+
background-color: white;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
width: 300px;
|
|
9
|
+
height: 450px;
|
|
10
|
+
box-shadow: 0px 3px 20px 0px #002e5933;
|
|
11
|
+
|
|
12
|
+
.input__wrapper .antsomi-input-affix-wrapper {
|
|
13
|
+
padding: 8px 10px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.recent-text {
|
|
17
|
+
color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw7};
|
|
18
|
+
padding: 6px 10px 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ul {
|
|
22
|
+
list-style: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ul.account-list {
|
|
28
|
+
border-top: 1px solid ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw3};
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
li {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
padding: 8px 10px;
|
|
36
|
+
margin-bottom: 6px;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
|
|
39
|
+
.account-name {
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
text-overflow: ellipsis;
|
|
43
|
+
}
|
|
44
|
+
.account-id {
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.all-account {
|
|
50
|
+
padding: 8px 10px;
|
|
51
|
+
border-top: 1px solid ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw3};
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
li:hover,
|
|
56
|
+
.all-account:hover {
|
|
57
|
+
background-color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.blue};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
li.is-selected,
|
|
61
|
+
.all-account.is-selected {
|
|
62
|
+
background-color: ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.blue1_1};
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
export const PopoverFieldStyled = styled.div `
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
width: 190px;
|
|
68
|
+
height: 36px;
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
align-items: center;
|
|
72
|
+
padding: 0 10px;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
|
|
75
|
+
background-color: white;
|
|
76
|
+
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
font-weight: bold;
|
|
79
|
+
|
|
80
|
+
span {
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.select {
|
|
87
|
+
border: 1px solid ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.bw3};
|
|
88
|
+
border-radius: 999px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.input {
|
|
92
|
+
border-bottom: 1px solid ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.colorPrimary};
|
|
93
|
+
width: 300px;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccountSelectionProps } from '../AccountSelection';
|
|
3
|
+
import { AccountSharingProps } from '../../organism';
|
|
4
|
+
import { IHelpProps } from '../../organism/Help/types';
|
|
5
|
+
export interface HeaderV2Props {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
pageTitle?: string | React.ReactNode;
|
|
9
|
+
accountSelection?: Omit<AccountSelectionProps, 'onChange' | 'apiConfig'> & {
|
|
10
|
+
onSelectAccount?: (account: number | 'ALL_ACCOUNT') => void;
|
|
11
|
+
};
|
|
12
|
+
helpConfig: Omit<IHelpProps, 'configs'> & {
|
|
13
|
+
configs: Omit<IHelpProps['configs'], 'portalId' | 'userId' | 'token' | 'domain' | 'domainTicket' | 'domainPlatform'>;
|
|
14
|
+
} & {
|
|
15
|
+
show?: boolean;
|
|
16
|
+
};
|
|
17
|
+
notificationConfig?: {
|
|
18
|
+
show?: boolean;
|
|
19
|
+
};
|
|
20
|
+
accountSharingConfig: Pick<AccountSharingProps, 'isShowSharing' | 'isShareAccountAccess' | 'u_ogs' | 'appCode' | 'callbackLogout' | 'callbackGetInfoAccount'> & {
|
|
21
|
+
show?: boolean;
|
|
22
|
+
};
|
|
23
|
+
config: {
|
|
24
|
+
env: 'DEVELOPMENT' | 'PRODUCTION';
|
|
25
|
+
language?: string;
|
|
26
|
+
userId: number;
|
|
27
|
+
portalId: number;
|
|
28
|
+
token: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare const HeaderV2: React.FC<HeaderV2Props>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { memo, useState } from 'react';
|
|
13
|
+
import { AccountSelection } from '../AccountSelection';
|
|
14
|
+
import { HeaderV2Styled } from './styled';
|
|
15
|
+
import { AccountSharing, Help, Notification, } from '../../organism';
|
|
16
|
+
import { CDP_API, IAM_API, ISSUE_API, PERMISSION_API, PLATFORM_API, SOCKET_API, } from '@antscorp/antsomi-ui/es/constants';
|
|
17
|
+
export const HeaderV2 = memo(props => {
|
|
18
|
+
var _a;
|
|
19
|
+
const { className, style, pageTitle = 'Page Title', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, config, } = props;
|
|
20
|
+
/** General config for children component */
|
|
21
|
+
const { env, language = 'en', userId, portalId, token } = config;
|
|
22
|
+
const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
|
|
23
|
+
const { show: showHelp = true, configs } = helpConfig, helpProps = __rest(helpConfig, ["show", "configs"]);
|
|
24
|
+
const { show: showNotification = true } = notificationConfig;
|
|
25
|
+
const { show: showAccountSharing = true, isShowSharing = true, isShareAccountAccess = true } = accountSharingConfig, accountSharingProps = __rest(accountSharingConfig, ["show", "isShowSharing", "isShareAccountAccess"]);
|
|
26
|
+
const [selectedAccount, setSelectedAccount] = useState((_a = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _a !== void 0 ? _a : 'ALL_ACCOUNT');
|
|
27
|
+
const accountSelectionApiConfig = {
|
|
28
|
+
domain: CDP_API[env],
|
|
29
|
+
languageCode: language,
|
|
30
|
+
userId,
|
|
31
|
+
portalId,
|
|
32
|
+
token,
|
|
33
|
+
};
|
|
34
|
+
const helpConfigProps = Object.assign(Object.assign({}, configs), { portalId: portalId.toString(), userId: userId.toString(), token, domain: CDP_API[env], domainTicket: ISSUE_API[env], domainPlatform: PLATFORM_API, config: Object.assign(Object.assign({}, configs.config), { user_language: language }) });
|
|
35
|
+
const notificationConfigProps = {
|
|
36
|
+
accountId: userId,
|
|
37
|
+
networkId: portalId,
|
|
38
|
+
token,
|
|
39
|
+
lang: language,
|
|
40
|
+
permissionDomain: PERMISSION_API,
|
|
41
|
+
socketDomain: SOCKET_API,
|
|
42
|
+
};
|
|
43
|
+
const accountSharingPropsFormatted = {
|
|
44
|
+
permissionDomain: PERMISSION_API,
|
|
45
|
+
iamDomain: IAM_API,
|
|
46
|
+
accountId: userId,
|
|
47
|
+
networkId: portalId,
|
|
48
|
+
urlEditProfile: `${PERMISSION_API}/${portalId}#/account/profile/`,
|
|
49
|
+
// 6006 is storybook port so direct to sandbox page
|
|
50
|
+
urlLogout: `${window.location.port === '6006' ? 'https://sandbox-cdp.antsomi.com/' : window.location.origin}/gen2/login`,
|
|
51
|
+
token,
|
|
52
|
+
lang: language,
|
|
53
|
+
};
|
|
54
|
+
return (React.createElement(HeaderV2Styled, { className: className || '', style: style },
|
|
55
|
+
React.createElement("div", { className: "left-side" },
|
|
56
|
+
React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: userId => {
|
|
57
|
+
setSelectedAccount(userId);
|
|
58
|
+
if (onSelectAccount)
|
|
59
|
+
onSelectAccount(userId);
|
|
60
|
+
}, inputStyle: inputStyle })),
|
|
61
|
+
typeof pageTitle === 'string' ? React.createElement("div", { className: "page-title" }, pageTitle) : pageTitle),
|
|
62
|
+
React.createElement("div", { className: "right-side" },
|
|
63
|
+
showHelp ? React.createElement(Help, Object.assign({ configs: helpConfigProps }, helpProps)) : null,
|
|
64
|
+
showNotification ? React.createElement(Notification, Object.assign({}, notificationConfigProps)) : null,
|
|
65
|
+
showAccountSharing ? (React.createElement(AccountSharing, Object.assign({ isShowSharing: isShowSharing, isShareAccountAccess: isShareAccountAccess }, accountSharingPropsFormatted, accountSharingProps))) : null)));
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HEADER_HEIGHT = 60;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const HEADER_HEIGHT = 60;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HeaderV2, type HeaderV2Props } from './HeaderV2';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HeaderV2 } from './HeaderV2';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HeaderV2Styled: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
4
|
+
export const HeaderV2Styled = styled.div `
|
|
5
|
+
height: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.headerHeight};
|
|
6
|
+
background-color: #f6f8fc;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
padding: 10px 20px;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
|
|
13
|
+
.left-side,
|
|
14
|
+
.right-side {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.left-side {
|
|
21
|
+
gap: 15px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.page-title {
|
|
25
|
+
font-size: 20px;
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AccountSelection } from './AccountSelection';
|
|
1
2
|
export { Cascader } from './Cascader';
|
|
2
3
|
export { Dropdown } from './Dropdown';
|
|
3
4
|
export { Modal } from './Modal';
|
|
@@ -25,6 +26,7 @@ export { TreeSelect } from './TreeSelect';
|
|
|
25
26
|
export { Card } from './Card';
|
|
26
27
|
export { InputNumberWithUnit } from './InputNumberWithUnit';
|
|
27
28
|
export { GradientSetting } from './GradientSetting';
|
|
29
|
+
export { HeaderV2, type HeaderV2Props } from './HeaderV2';
|
|
28
30
|
export { SettingWrapperPopover } from './SettingWrapperPopover';
|
|
29
31
|
export { FontWeightSelect } from './FontWeightSelect';
|
|
30
32
|
export { FontFamilySelect } from './FontFamilySelect';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AccountSelection } from './AccountSelection';
|
|
1
2
|
export { Cascader } from './Cascader';
|
|
2
3
|
export { Dropdown } from './Dropdown';
|
|
3
4
|
export { Modal } from './Modal';
|
|
@@ -25,6 +26,7 @@ export { TreeSelect } from './TreeSelect';
|
|
|
25
26
|
export { Card } from './Card';
|
|
26
27
|
export { InputNumberWithUnit } from './InputNumberWithUnit';
|
|
27
28
|
export { GradientSetting } from './GradientSetting';
|
|
29
|
+
export { HeaderV2 } from './HeaderV2';
|
|
28
30
|
export { SettingWrapperPopover } from './SettingWrapperPopover';
|
|
29
31
|
export { FontWeightSelect } from './FontWeightSelect';
|
|
30
32
|
export { FontFamilySelect } from './FontFamilySelect';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AccountSharingProps {
|
|
3
|
+
permissionDomain: string;
|
|
4
|
+
iamDomain: string;
|
|
5
|
+
token: string;
|
|
6
|
+
accountId: number;
|
|
7
|
+
networkId: number;
|
|
8
|
+
appCode: string;
|
|
9
|
+
lang: string;
|
|
10
|
+
translateData?: any;
|
|
11
|
+
urlEditProfile: string;
|
|
12
|
+
callbackGetInfoAccount?: (args: any) => void;
|
|
13
|
+
urlLogout: string;
|
|
14
|
+
isShowSharing?: boolean;
|
|
15
|
+
isShareAccountAccess?: boolean;
|
|
16
|
+
u_ogs: string;
|
|
17
|
+
callbackLogout?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const AccountSharing: React.FC<AccountSharingProps>;
|