@antscorp/antsomi-ui 1.3.5-beta.411 → 1.3.5-beta.413

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.
@@ -4,6 +4,7 @@ export interface AccountListingProps {
4
4
  className?: string;
5
5
  apiConfig: {
6
6
  domain: string;
7
+ permissionDomain?: string;
7
8
  token: string;
8
9
  userId: number;
9
10
  portalId?: number;
@@ -7,6 +7,7 @@ interface AccountData {
7
7
  }
8
8
  export declare const useAccountSelection: (apiConfig: {
9
9
  domain: string;
10
+ permissionDomain?: string;
10
11
  token: string;
11
12
  userId: number;
12
13
  portalId?: number;
@@ -13,7 +13,7 @@ const isUsePermissionAccount = (appCode) => {
13
13
  return false;
14
14
  };
15
15
  export const useAccountSelection = (apiConfig) => {
16
- const { domain, token, userId, appCode, menuCode } = apiConfig;
16
+ const { permissionDomain, token, userId, appCode, menuCode } = apiConfig;
17
17
  const { data } = useGetAccountList({
18
18
  apiConfig,
19
19
  options: {
@@ -26,13 +26,13 @@ export const useAccountSelection = (apiConfig) => {
26
26
  _user_id: userId,
27
27
  _app_code: appCode || '',
28
28
  _token: token,
29
- domain,
29
+ domain: permissionDomain || '',
30
30
  appCode: appCode || '',
31
31
  fullParent: true,
32
32
  menuCode: menuCode || appCode || '',
33
33
  },
34
34
  options: {
35
- enabled: isUsePermissionAccount(appCode || '') && !!token && !!userId,
35
+ enabled: isUsePermissionAccount(appCode || '') && !!token && !!userId && !!permissionDomain,
36
36
  },
37
37
  });
38
38
  const { data: recentData } = useGetRecentAccount({
@@ -63,6 +63,7 @@ export const HeaderV2 = memo(props => {
63
63
  const { show: showAccountSharing = true, isShowSharing = true, isShareAccountAccess = true } = accountSharingConfig, accountSharingProps = __rest(accountSharingConfig, ["show", "isShowSharing", "isShareAccountAccess"]);
64
64
  const accountSelectionApiConfig = {
65
65
  domain: accountSelectionDomain,
66
+ permissionDomain,
66
67
  languageCode: language,
67
68
  userId,
68
69
  portalId,
@@ -105,7 +105,7 @@ export const LeftMenuComponent = memo(props => {
105
105
  React.createElement(FeatureMenu, { role: "menu", className: "antsomi-scroll-box" },
106
106
  React.createElement("div", { className: "menu-content scroll-content" }, renderAppMenuItems()),
107
107
  React.createElement("div", { className: "nav-blank", onMouseEnter: onHoverMenuBar }),
108
- React.createElement(PopoverWrapper, { show: state.isShowPopover && isExpandable, className: "antsomi-scroll-box antsomi-child-menu-popover" },
108
+ React.createElement(PopoverWrapper, { show: state.isShowPopover && isExpandable, hasMarginTop: !isRecommendation, className: "antsomi-scroll-box antsomi-child-menu-popover" },
109
109
  React.createElement("div", { className: "scroll-content", style: { width: '200px', maxHeight: '100%' } }, childHoverMenu))),
110
110
  React.createElement("div", { style: { flexShrink: 0 } }, renderSettings())),
111
111
  isExpandable && !isRecommendation && (React.createElement(ExpandWrapper, { onMouseEnter: onMouseLeave },
@@ -16,13 +16,12 @@ import { IconWrapper } from '../../../styled';
16
16
  import { HOME_MENU_ITEMS, ICON_SIZE } from '../../../constants';
17
17
  // Utils
18
18
  import { findActiveAppCodeByUrl, findLastMatchedItemByUrl, getMenuItem } from '../../../utils';
19
- import { findItemByPermissionCode, recursiveFindItemByKey, recursiveFindParentOfActiveItem, } from './utils';
19
+ import { handleActiveRecommendationItem, recursiveFindItemByKey, recursiveFindParentOfActiveItem, } from './utils';
20
20
  // Hooks
21
21
  import { useNavigatePath } from '../../../hooks';
22
22
  import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
23
23
  // Contexts
24
24
  import { useLeftMenuContext } from '../../../contexts';
25
- import { MARKETING_CHANNEL_CODE } from '@antscorp/antsomi-ui/es/components/template/Layout/constants';
26
25
  const noDashboardItem = {
27
26
  key: 'no_dashboard',
28
27
  label: 'No dashboard available',
@@ -79,53 +78,11 @@ export const ChildMenu = memo(props => {
79
78
  break;
80
79
  }
81
80
  case isRecommendation: {
82
- const activeItem = findItemByPermissionCode({
83
- permissionCode: customActiveCurrentKey,
84
- menuItems: items,
81
+ const menuActiveKey = handleActiveRecommendationItem({
82
+ customActiveCurrentKey,
83
+ currentActiveItem,
84
+ items,
85
85
  });
86
- const { key, permission_code } = activeItem || {};
87
- let menuActiveKey;
88
- if (permission_code && key) {
89
- switch (permission_code) {
90
- case 'JOURNEY':
91
- if (!Object.values(MARKETING_CHANNEL_CODE).includes(currentActiveItem)) {
92
- menuActiveKey = MARKETING_CHANNEL_CODE.ALL_CHANNEL;
93
- }
94
- break;
95
- case 'EVENT_SOURCES':
96
- if (!['EVENT', 'EVENT_ATTRIBUTE', 'CONVERSION'].includes(currentActiveItem))
97
- menuActiveKey = 'SOURCE';
98
- break;
99
- case 'DATAFLOWS':
100
- if (!['BATCH_STREAMING', 'REALTIME_STREAMING'].includes(currentActiveItem))
101
- menuActiveKey = 'BATCH_STREAM';
102
- break;
103
- case 'BUSINESS_OBJECT': {
104
- if (!['UPLOAD', 'EXPORT'].includes(currentActiveItem)) {
105
- menuActiveKey = 'UPLOAD';
106
- }
107
- break;
108
- }
109
- case 'DATASOURCES':
110
- menuActiveKey = 'DATA_SOURCE';
111
- break;
112
- default:
113
- menuActiveKey = key;
114
- break;
115
- }
116
- }
117
- else {
118
- switch (customActiveCurrentKey) {
119
- case 'DATASOURCES-SQL_WORKSPACE':
120
- menuActiveKey = 'DATA_SOURCE';
121
- break;
122
- case 'DATASOURCES-DATAFLOWS':
123
- menuActiveKey = 'DF_DATA_SOURCE';
124
- break;
125
- default:
126
- break;
127
- }
128
- }
129
86
  if (menuActiveKey) {
130
87
  setCurrentActiveItem(menuActiveKey);
131
88
  /** Find parent key of active menu item to open it */
@@ -216,9 +173,9 @@ export const ChildMenu = memo(props => {
216
173
  return (_a = args === null || args === void 0 ? void 0 : args.items) === null || _a === void 0 ? void 0 : _a.map(item => {
217
174
  const { key, label, children, icon, logo_url, menu_item_path = null, menu_item_domain = null, options, disabled, optionCallback, } = item;
218
175
  const isOwnerDashboardKey = key === HOME_MENU_ITEMS.DASHBOARD.menu_item_code;
219
- const renderLabel = () => (React.createElement(LabelWrapper, null,
176
+ const renderLabel = () => (React.createElement(LabelWrapper, { gap: 10, align: "center", justify: "space-between" },
220
177
  React.createElement(LabelCustom, { ellipsis: { tooltip: label } }, label),
221
- (options === null || options === void 0 ? void 0 : options.length) && !isRecommendation && (React.createElement(OptionDropdownWrapper, null,
178
+ (options === null || options === void 0 ? void 0 : options.length) && !isRecommendation && (React.createElement(OptionDropdownWrapper, { align: "center" },
222
179
  React.createElement(Dropdown, { menu: {
223
180
  items: options,
224
181
  onClick: e => {
@@ -5,7 +5,6 @@ import styled from 'styled-components';
5
5
  import { Flex, Typography } from '../../../../../atoms';
6
6
  // Constants
7
7
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
8
- import { ICON_SIZE } from '../../../constants';
9
8
  export const LabelWrapper = styled(Flex) `
10
9
  width: 100%;
11
10
  overflow: hidden;
@@ -15,6 +14,7 @@ export const LabelWrapper = styled(Flex) `
15
14
  width: fit-content;
16
15
  display: none;
17
16
  text-decoration-line: none !important;
17
+ color: #595959 !important;
18
18
 
19
19
  i {
20
20
  font-size: 15px !important;
@@ -27,16 +27,10 @@ export const LabelWrapper = styled(Flex) `
27
27
 
28
28
  &:hover {
29
29
  .icon-link {
30
- color: inherit !important;
31
30
  display: flex;
32
31
  }
33
32
  }
34
33
  `;
35
- LabelWrapper.defaultProps = {
36
- gap: 10,
37
- align: 'center',
38
- justify: 'space-between',
39
- };
40
34
  export const LabelCustom = styled(Typography.Text) `
41
35
  font-size: inherit !important;
42
36
  color: inherit !important;
@@ -46,7 +40,6 @@ export const LabelCustom = styled(Typography.Text) `
46
40
  export const OptionDropdownWrapper = styled(Flex) `
47
41
  width: 20px;
48
42
  `;
49
- OptionDropdownWrapper.defaultProps = { align: 'center' };
50
43
  export const MenuWrapper = styled.div `
51
44
  width: 100%;
52
45
  height: 100%;
@@ -90,11 +83,23 @@ export const MenuWrapper = styled.div `
90
83
  &.antsomi-menu-item-selected {
91
84
  & > .antsomi-menu-title-content {
92
85
  background-color: #deeffe !important;
86
+
87
+ ${LabelWrapper} {
88
+ & > .icon-link {
89
+ color: inherit !important;
90
+ }
91
+ }
92
+ i {
93
+ color: inherit !important;
94
+ }
93
95
  }
94
96
  }
95
97
 
96
- [role='icon'] {
97
- font-size: ${ICON_SIZE};
98
+ &.antsomi-menu-submenu-selected
99
+ > .antsomi-menu-submenu-title
100
+ > .antsomi-menu-title-content
101
+ i {
102
+ color: inherit !important;
98
103
  }
99
104
 
100
105
  & .menu-link {
@@ -37,3 +37,8 @@ export declare const findItemByPermissionCode: (args: {
37
37
  permissionCode: string;
38
38
  menuItems: TMenuItem[];
39
39
  }) => TMenuItem | undefined;
40
+ export declare const handleActiveRecommendationItem: (args: {
41
+ customActiveCurrentKey: string;
42
+ currentActiveItem: string;
43
+ items: TMenuItem[];
44
+ }) => string | undefined;
@@ -1,6 +1,7 @@
1
1
  // Utils
2
2
  import { getComparePath, getGeneratePath } from '../../../utils';
3
3
  import { handleError } from '@antscorp/antsomi-ui/es/utils';
4
+ import { MARKETING_CHANNEL_CODE } from '@antscorp/antsomi-ui/es/components/template/Layout/constants';
4
5
  const PATH = 'src/components/organism/LeftMenu/components/common/ChildMenu/utils.ts';
5
6
  /**
6
7
  * Finds the active menu item code based on the provided URL within the given menu items.
@@ -134,3 +135,54 @@ export const findItemByPermissionCode = (args) => {
134
135
  });
135
136
  }
136
137
  };
138
+ export const handleActiveRecommendationItem = (args) => {
139
+ const { customActiveCurrentKey, currentActiveItem, items } = args;
140
+ const activeItem = findItemByPermissionCode({
141
+ permissionCode: customActiveCurrentKey,
142
+ menuItems: items,
143
+ });
144
+ const { key, permission_code } = activeItem || {};
145
+ let menuActiveKey;
146
+ if (permission_code && key) {
147
+ switch (permission_code) {
148
+ case 'JOURNEY':
149
+ if (!Object.values(MARKETING_CHANNEL_CODE).includes(currentActiveItem)) {
150
+ menuActiveKey = MARKETING_CHANNEL_CODE.ALL_CHANNEL;
151
+ }
152
+ break;
153
+ case 'EVENT_SOURCES':
154
+ if (!['EVENT', 'EVENT_ATTRIBUTE', 'CONVERSION'].includes(currentActiveItem))
155
+ menuActiveKey = 'SOURCE';
156
+ break;
157
+ case 'DATAFLOWS':
158
+ if (!['BATCH_STREAMING', 'REALTIME_STREAMING'].includes(currentActiveItem))
159
+ menuActiveKey = 'BATCH_STREAM';
160
+ break;
161
+ case 'BUSINESS_OBJECT': {
162
+ if (!['UPLOAD', 'EXPORT'].includes(currentActiveItem)) {
163
+ menuActiveKey = 'UPLOAD';
164
+ }
165
+ break;
166
+ }
167
+ case 'DATASOURCES':
168
+ menuActiveKey = 'DATA_SOURCE';
169
+ break;
170
+ default:
171
+ menuActiveKey = key;
172
+ break;
173
+ }
174
+ }
175
+ else {
176
+ switch (customActiveCurrentKey) {
177
+ case 'DATASOURCES-SQL_WORKSPACE':
178
+ menuActiveKey = 'DATA_SOURCE';
179
+ break;
180
+ case 'DATASOURCES-DATAFLOWS':
181
+ menuActiveKey = 'DF_DATA_SOURCE';
182
+ break;
183
+ default:
184
+ break;
185
+ }
186
+ }
187
+ return menuActiveKey;
188
+ };
@@ -103,6 +103,7 @@ export const usePermission = () => {
103
103
  url,
104
104
  menuItems: mappingChildrenMenu,
105
105
  auth,
106
+ env,
106
107
  });
107
108
  return matchedCode
108
109
  ? findPathOfActiveItem({
@@ -110,7 +111,7 @@ export const usePermission = () => {
110
111
  menuItems: mappingChildrenMenu,
111
112
  })
112
113
  : [];
113
- }, [auth, hash, mappingChildrenMenu, pathname]);
114
+ }, [auth, env, hash, mappingChildrenMenu, pathname]);
114
115
  useEffect(() => setLeftMenuState({ dashboardList }), [dashboardList, setLeftMenuState]);
115
116
  useEffect(() => {
116
117
  if (!isCustomized) {
@@ -2,6 +2,7 @@
2
2
  export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const PopoverWrapper: import("styled-components").StyledComponent<"div", any, {
4
4
  show: boolean;
5
+ hasMarginTop: boolean;
5
6
  }, never>;
6
7
  export declare const FeatureMenuWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
7
8
  export declare const ExpandWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -16,6 +16,7 @@ export const IconWrapper = styled.div `
16
16
 
17
17
  i {
18
18
  font-size: ${ICON_SIZE}px;
19
+ color: #595959;
19
20
  }
20
21
  `;
21
22
  export const PopoverWrapper = styled.div `
@@ -35,7 +36,7 @@ export const PopoverWrapper = styled.div `
35
36
  border-radius: ${(_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadiusXL}px;
36
37
  bottom: 15px;
37
38
  box-shadow: 0px 3px 20px 0px #002e5933;
38
- height: calc(100% - ${HEADER_HEIGHT + 15}px);
39
+ height: ${({ hasMarginTop }) => hasMarginTop ? `calc(100% - ${HEADER_HEIGHT + 15}px)` : `calc(100% - 15px)`};
39
40
  transition: visibility 0s, opacity 0.2s ease-out;
40
41
  z-index: 10;
41
42
  padding: 10px;
@@ -148,6 +149,10 @@ export const FeatureMenuItem = styled.div `
148
149
  ${IconWrapper},
149
150
  span {
150
151
  color: #005eb8;
152
+
153
+ i {
154
+ color: inherit !important;
155
+ }
151
156
  }
152
157
  }
153
158
 
@@ -1,6 +1,7 @@
1
1
  import { FeatureMenuPermission, TDashboard, TDestinationChannel, TFeatureMenu } from '@antscorp/antsomi-ui/es/models/LeftMenu';
2
2
  import { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
3
3
  import { TMenuFeatureItem, TMenuItem } from '../types';
4
+ import { TEnv } from '@antscorp/antsomi-ui/es/types/config';
4
5
  /**
5
6
  * Converts a feature menu item to a menu item suitable for rendering in the UI.
6
7
  * @param {TMenuFeatureItem} featureMenu - The feature menu item to convert.
@@ -85,7 +86,7 @@ export declare const findLastMatchedItemByUrl: (args: {
85
86
  url: string;
86
87
  menuItems: TFeatureMenu[];
87
88
  auth?: Partial<PayloadInfo>;
88
- env?: string;
89
+ env?: TEnv;
89
90
  }) => TFeatureMenu | undefined;
90
91
  export declare const findPathOfActiveItem: (args: {
91
92
  activeMenuItem: TFeatureMenu;
@@ -275,7 +275,7 @@ export const findActiveAppCodeByUrl = (args) => {
275
275
  };
276
276
  export const findLastMatchedItemByUrl = (args) => {
277
277
  try {
278
- const { url, menuItems, auth, env } = args;
278
+ const { url, menuItems, auth, env = 'development' } = args;
279
279
  const matchedItems = [];
280
280
  const recursiveFindActiveItem = (items, parentId) => {
281
281
  for (const item of items) {
@@ -26,4 +26,6 @@ export declare const MENU_CODE: {
26
26
  DATA_VIEW: string;
27
27
  DATA_OBJECT: string;
28
28
  JOURNEY_TACTIC: string;
29
+ BATCH_STREAMING: string;
30
+ REALTIME_STREAMING: string;
29
31
  };
@@ -27,4 +27,6 @@ export const MENU_CODE = {
27
27
  DATA_VIEW: 'DATA_VIEW',
28
28
  DATA_OBJECT: 'DATA_OBJECT',
29
29
  JOURNEY_TACTIC: 'JOURNEY_TACTIC',
30
+ BATCH_STREAMING: 'BATCH_STREAMING',
31
+ REALTIME_STREAMING: 'REALTIME_STREAMING',
30
32
  };
@@ -14,8 +14,6 @@ export declare const MARKETING_CHANNEL_CODE: {
14
14
  * Nếu PERMISSION_CODE không được tìm thấy trong api get permissions và trong @constant MENU_PERMISSIONS thì sẽ ẩn account selection
15
15
  */
16
16
  export declare const MENU_PERMISSIONS: {
17
- BATCH_STREAM: string;
18
- REALTIME_STREAM: string;
19
17
  DF_DATA_SOURCE: string;
20
18
  DESTINATION: string;
21
19
  REPORT: string;
@@ -14,8 +14,6 @@ export const MARKETING_CHANNEL_CODE = {
14
14
  * Nếu PERMISSION_CODE không được tìm thấy trong api get permissions và trong @constant MENU_PERMISSIONS thì sẽ ẩn account selection
15
15
  */
16
16
  export const MENU_PERMISSIONS = {
17
- BATCH_STREAM: 'BATCH_STREAM',
18
- REALTIME_STREAM: 'REALTIME_STREAM',
19
17
  DF_DATA_SOURCE: 'DF_DATA_SOURCE',
20
18
  DESTINATION: 'DESTINATION',
21
19
  REPORT: 'REPORT',
@@ -17,6 +17,8 @@ export const checkingRoleScope = (args) => {
17
17
  MENU_CODE.DASHBOARD_OVERVIEW,
18
18
  MENU_CODE.MEDIA_TEMPLATE,
19
19
  MENU_CODE.EMAIL_TEMPLATE,
20
+ MENU_CODE.BATCH_STREAMING,
21
+ MENU_CODE.REALTIME_STREAMING,
20
22
  // MENU_CODE.SEGMENT,
21
23
  MENU_CODE.DESTINATIONS_HUB,
22
24
  MENU_CODE.BUSINESS_OBJECT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.411",
3
+ "version": "1.3.5-beta.413",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -59,7 +59,7 @@
59
59
  "not op_mini all"
60
60
  ],
61
61
  "dependencies": {
62
- "@antscorp/icons": "0.27.38",
62
+ "@antscorp/icons": "0.27.39",
63
63
  "@antscorp/image-editor": "1.0.2",
64
64
  "@antscorp/processing-notification": "^1.0.3",
65
65
  "@dnd-kit/core": "^6.1.0",