@antscorp/antsomi-ui 1.3.5-beta.276 → 1.3.5-beta.278

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.
@@ -65,6 +65,6 @@ export const AccountListing = props => {
65
65
  recentData.value.map(accountId => accountData === null || accountData === void 0 ? void 0 : accountData.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 }))))), accountData === null || accountData === void 0 ? void 0 :
66
66
  accountData.filter(account => !(recentData === null || recentData === void 0 ? void 0 : recentData.value.includes(account.userId)) &&
67
67
  searchStringQuery(account.userName, searchValue)).map(account => (React.createElement(AccountItem, { key: account.userId, userName: account.userName, userId: account.userId, onClick: handleSelectAccount, isSelected: +currentAccount === account.userId }))))),
68
- showAllAccount ? (React.createElement(Text, { className: `all-account ${isAllAccount ? 'is-selected' : ''}`, onClick: () => handleSelectAccount('') },
68
+ showAllAccount ? (React.createElement(Text, { className: `all-account ${isAllAccount ? 'is-selected' : ''}`, onClick: () => handleSelectAccount('all') },
69
69
  React.createElement("strong", null, "All account"))) : null));
70
70
  };
@@ -32,9 +32,9 @@ export const HeaderV2 = memo(props => {
32
32
  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 || {};
33
33
  const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
34
34
  const urlParams = useMemo(() => new URLSearchParams(search), [search]);
35
- const oidParam = (_a = urlParams.get('oid')) !== null && _a !== void 0 ? _a : '';
35
+ const oidParam = (_a = urlParams.get('oid')) !== null && _a !== void 0 ? _a : 'all';
36
36
  // States
37
- const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(_b = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _b !== void 0 ? _b : ''}`}`);
37
+ const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(_b = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _b !== void 0 ? _b : 'all'}`}`);
38
38
  // Memo
39
39
  const accountSelectionDomain = useMemo(() => {
40
40
  var _a;
@@ -87,7 +87,7 @@ export const HeaderV2 = memo(props => {
87
87
  const handleChangeAccount = (userId) => {
88
88
  setSelectedAccount(userId);
89
89
  if (useURLParam) {
90
- if (userId) {
90
+ if (userId === 'all') {
91
91
  urlParams.set('oid', userId);
92
92
  }
93
93
  else {
@@ -99,7 +99,7 @@ export const HeaderV2 = memo(props => {
99
99
  };
100
100
  return (React.createElement(HeaderV2Styled, { className: className || '', style: style },
101
101
  React.createElement("div", { className: "left-side" },
102
- React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount || 'all', apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle })),
102
+ React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle })),
103
103
  typeof pageTitle === 'string' ? React.createElement("div", { className: "page-title" }, pageTitle) : pageTitle),
104
104
  React.createElement("div", { className: "right-side" },
105
105
  showHelp ? React.createElement(Help, Object.assign({ configs: helpConfigProps }, helpProps)) : null,
@@ -366,16 +366,14 @@ export const AlgorithmsSetting = (props) => {
366
366
  React.createElement(AlgorithmWrapper, { mode: mode },
367
367
  React.createElement(Text, Object.assign({}, labelStyle),
368
368
  t(translations.last.title).toString(),
369
- char,
370
- ' '),
369
+ char),
371
370
  React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
372
371
  React.createElement(InputNumber, { value: algo.last, width: 90, onChange: value => onChangeAlgorithm(algo, { last: value }), min: 1, max: 90, required: true }),
373
372
  React.createElement(Text, { color: isCDP ? (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorIcon : undefined, style: { marginLeft: 8 } }, t(translations.days.title).toString()))),
374
373
  React.createElement(AlgorithmWrapper, { style: { marginTop: 4 }, mode: mode },
375
374
  React.createElement(Text, Object.assign({}, labelStyle),
376
375
  t(translations.to.title).toString(),
377
- char,
378
- ' '),
376
+ char),
379
377
  React.createElement(Radio.Group, { onChange: event => onChangeAlgorithm(algo, { to: event.target.value }), value: algo.to },
380
378
  React.createElement(Radio, { value: "today" }, t(translations.today.title).toString()),
381
379
  React.createElement(Radio, { value: "yesterday" }, t(translations.yesterday.title).toString())))));
@@ -397,8 +395,7 @@ export const AlgorithmsSetting = (props) => {
397
395
  React.createElement(AlgorithmWrapper, { mode: mode },
398
396
  React.createElement(Text, Object.assign({}, labelStyle),
399
397
  t(translations.last.title).toString(),
400
- char,
401
- ' '),
398
+ char),
402
399
  React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
403
400
  React.createElement(InputNumber, { value: algo.last, width: 90, onChange: value => onChangeAlgorithm(algo, { last: value }), min: 1, max: 20, required: true }),
404
401
  React.createElement(Text, { color: isCDP ? (_c = THEME.token) === null || _c === void 0 ? void 0 : _c.colorIcon : undefined, style: { marginLeft: 8 } }, t(translations.keywords.title).toLowerCase())))));
@@ -410,8 +407,7 @@ export const AlgorithmsSetting = (props) => {
410
407
  element = (React.createElement(AlgorithmWrapper, { mode: mode },
411
408
  React.createElement(Text, Object.assign({}, labelStyle),
412
409
  t(translations.last.title).toString(),
413
- char,
414
- ' '),
410
+ char),
415
411
  React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
416
412
  React.createElement(InputNumber, { value: algo.last, width: 90, onChange: value => onChangeAlgorithm(algo, { last: value }), min: 1, max: 90, required: true }),
417
413
  React.createElement(Text, { color: isCDP ? (_d = THEME.token) === null || _d === void 0 ? void 0 : _d.colorIcon : undefined, style: { marginLeft: 8 } }, itemTypeName === ITEM_TYPE_NAME.ARTICLE
@@ -495,14 +491,12 @@ export const AlgorithmsSetting = (props) => {
495
491
  React.createElement(AlgorithmWrapper, { mode: mode },
496
492
  React.createElement(RequiredLabel, Object.assign({}, labelStyle),
497
493
  t(translations.interest.title).toString(),
498
- char,
499
- ' '),
494
+ char),
500
495
  React.createElement(Select, { required: true, showSearch: true, focused: isShowErrorAlert, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.interest, options: optionNotify, onChange: value => onChangeAlgorithm(algo, { interest: value }) })),
501
496
  React.createElement(AlgorithmWrapper, { mode: mode },
502
497
  React.createElement(Text, Object.assign({}, labelStyle),
503
498
  t(translations.last.title).toString(),
504
- char,
505
- ' '),
499
+ char),
506
500
  React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
507
501
  React.createElement(InputNumber, { value: algo.last, width: 90, onChange: value => onChangeAlgorithm(algo, { last: value }), min: 1, max: 90, required: true }),
508
502
  React.createElement(Text, { color: isCDP ? (_e = THEME.token) === null || _e === void 0 ? void 0 : _e.colorIcon : undefined, style: { marginLeft: 8 } }, t(translations.days.title).toString())))));
@@ -520,14 +514,12 @@ export const AlgorithmsSetting = (props) => {
520
514
  React.createElement(AlgorithmWrapper, { mode: mode },
521
515
  React.createElement(RequiredLabel, Object.assign({}, labelStyle),
522
516
  t(translations.with.title).toLowerCase(),
523
- char,
524
- ' '),
517
+ char),
525
518
  React.createElement(Select, { required: true, showSearch: true, disabled: isDisable, status: errorMessage ? 'error' : '', errorMsg: errorMessage, focused: isShowErrorAlert, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.sort_by, options: options, onChange: value => onChangeAlgorithm(algo, { sort_by: value }) })),
526
519
  React.createElement(AlgorithmWrapper, { mode: mode },
527
520
  React.createElement(Text, Object.assign({}, labelStyle),
528
521
  t(translations.sortBy.title).toLowerCase(),
529
- char,
530
- ' '),
522
+ char),
531
523
  React.createElement(Select, { showSearch: true, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.sort_type, options: SORT_TYPE_OPTIONS, onChange: value => onChangeAlgorithm(algo, { sort_type: value }) }))));
532
524
  break;
533
525
  }
@@ -536,14 +528,12 @@ export const AlgorithmsSetting = (props) => {
536
528
  React.createElement(AlgorithmWrapper, { mode: mode },
537
529
  React.createElement(RequiredLabel, Object.assign({}, labelStyle),
538
530
  t(translations.by.title).toLowerCase(),
539
- char,
540
- ' '),
531
+ char),
541
532
  React.createElement(Select, { required: true, showSearch: true, focused: isShowErrorAlert, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.by, options: ARTICLE_TREND_BY_OPTIONS, onChange: value => onChangeAlgorithm(algo, { by: value }) })),
542
533
  React.createElement(AlgorithmWrapper, { mode: mode },
543
534
  React.createElement(RequiredLabel, Object.assign({}, labelStyle),
544
535
  t(translations.in.title).toLowerCase(),
545
- char,
546
- ' '),
536
+ char),
547
537
  React.createElement(Select, { required: true, showSearch: true, focused: isShowErrorAlert, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.in, options: ARTICLE_TREND_IN_OPTIONS, onChange: value => onChangeAlgorithm(algo, { in: value }) })),
548
538
  algo.by === 'compare_with_before' && (React.createElement(AlgorithmWrapper, { mode: mode },
549
539
  React.createElement("div", null),
@@ -579,14 +569,12 @@ export const AlgorithmsSetting = (props) => {
579
569
  React.createElement(AlgorithmWrapper, { mode: mode },
580
570
  React.createElement(RequiredLabel, Object.assign({}, labelStyle),
581
571
  t(translations.sortBy.title).toLowerCase(),
582
- char,
583
- ' '),
572
+ char),
584
573
  React.createElement(Select, { required: true, showSearch: true, focused: isShowErrorAlert, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.sort_by, options: ARTICLE_TREND_SORT_BY_OPTIONS, onChange: value => onChangeAlgorithm(algo, { sort_by: value }) })),
585
574
  React.createElement(AlgorithmWrapper, { mode: mode },
586
575
  React.createElement(RequiredLabel, Object.assign({}, labelStyle),
587
576
  t(translations.sortOrder.title).toLowerCase(),
588
- char,
589
- ' '),
577
+ char),
590
578
  React.createElement(Select, { required: true, showSearch: true, focused: isShowErrorAlert, placeholder: t(translations.selectAnItem.title).toString(), style: styleNoBorderWFull, value: algo.sort_order, options: SORT_TYPE_OPTIONS, onChange: value => onChangeAlgorithm(algo, { sort_order: value }) }))));
591
579
  break;
592
580
  }
@@ -706,10 +694,9 @@ export const AlgorithmsSetting = (props) => {
706
694
  : 'none',
707
695
  } }, provided.dragHandleProps),
708
696
  React.createElement(Icon, { type: "icon-ants-double-three-dots", size: 16, style: { opacity: 0.4, color: (_b = THEME.token) === null || _b === void 0 ? void 0 : _b.colorIcon } })),
709
- React.createElement(Text, Object.assign({}, labelStyle), (_c = mapListAlgo[algo.value]) === null || _c === void 0 ? void 0 :
697
+ React.createElement(Text, Object.assign({}, labelStyle, { style: { marginRight: 8, textAlign: 'left' } }), (_c = mapListAlgo[algo.value]) === null || _c === void 0 ? void 0 :
710
698
  _c.label,
711
- char,
712
- ' ')),
699
+ char)),
713
700
  React.createElement(InputNumber, { value: algo.quantity, width: 90, onChange: value => onChangeAlgorithm(algo, { quantity: value }), min: 1, max: 30, required: true }),
714
701
  algorithms.value.length > 1 ? (React.createElement(Button, { onClick: () => onRemoveAlgo(algo), type: "text", icon: React.createElement(Icon, { type: "icon-ants-remove-slim", size: 15 }), style: { alignSelf: 'center' } })) : null),
715
702
  renderAlgorithmBy(algo),
@@ -1,28 +1,44 @@
1
1
  // Libraries
2
2
  import { useCallback, useMemo } from 'react';
3
- import { useHistory, useLocation } from 'react-router-dom';
3
+ import { useHistory } from 'react-router-dom';
4
4
  // Constants
5
5
  import { CONFIG_OPTIONS } from './constants';
6
- import { HOME_REPORT_ROUTES } from '../../constants';
6
+ import { HOME_REPORT_ROUTES, HOME_ROUTE } from '../../constants';
7
7
  // Utils
8
8
  import { getGeneratePath, getMenuItem } from '../../utils';
9
9
  // Types
10
10
  import { useLeftMenuStore } from '../../stores';
11
11
  export const useHomeMenu = () => {
12
12
  // Hooks
13
- const { pathname } = useLocation();
13
+ const { pathname, hash, search } = window.location;
14
14
  const history = useHistory();
15
+ // Stores
15
16
  const appMenuChildren = useLeftMenuStore(store => store.state.appMenuChildren);
16
17
  const auth = useLeftMenuStore(store => { var _a; return (_a = store.state.appConfig) === null || _a === void 0 ? void 0 : _a.auth; });
17
18
  // Memos
19
+ const urlParams = useMemo(() => new URLSearchParams(search), [search]);
20
+ // Handlers
21
+ const handleSetSearchParams = useCallback((searchParam) => {
22
+ const url = `${pathname}${hash}`;
23
+ if (url.includes(getGeneratePath(HOME_ROUTE, Object.assign({}, auth)))) {
24
+ urlParams.set('type', searchParam);
25
+ history.replace({ search: urlParams.toString() });
26
+ }
27
+ else {
28
+ history.push(getGeneratePath(HOME_ROUTE, Object.assign({}, auth)));
29
+ urlParams.set('type', searchParam);
30
+ history.replace({ search: urlParams.toString() });
31
+ }
32
+ }, [auth, hash, history, pathname, urlParams]);
33
+ // Memos
18
34
  const onOptionCallback = useCallback((args) => {
19
35
  const { optionKey, menuItemKey } = args;
20
36
  switch (optionKey) {
21
37
  case CONFIG_OPTIONS.CONFIGURE.key: {
22
- const newPathName = getGeneratePath(HOME_REPORT_ROUTES.CONFIGURE, Object.assign(Object.assign({}, auth), { dashboardId: menuItemKey }));
23
- if (newPathName !== pathname) {
24
- history.push(newPathName);
25
- }
38
+ const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: menuItemKey }));
39
+ history.push(newPathName);
40
+ urlParams.set('type', HOME_REPORT_ROUTES.CONFIGURE);
41
+ history.replace({ search: urlParams.toString() });
26
42
  break;
27
43
  }
28
44
  case CONFIG_OPTIONS.REMOVE.key:
@@ -30,15 +46,17 @@ export const useHomeMenu = () => {
30
46
  default:
31
47
  break;
32
48
  }
33
- }, [auth, pathname, history]);
49
+ }, [auth, history, urlParams]);
34
50
  const customChildren = useMemo(() => appMenuChildren === null || appMenuChildren === void 0 ? void 0 : appMenuChildren.map(appMenuItem => {
35
51
  var _a;
36
52
  return getMenuItem(Object.assign(Object.assign({}, appMenuItem), { children: (_a = appMenuItem === null || appMenuItem === void 0 ? void 0 : appMenuItem.children) === null || _a === void 0 ? void 0 : _a.map(item => (Object.assign(Object.assign({}, item), { options: Object.values(CONFIG_OPTIONS), optionCallback: onOptionCallback }))) }));
37
53
  }), [appMenuChildren, onOptionCallback]);
38
54
  // Callbacks
39
55
  const onCreateNewReport = useCallback(() => {
40
- history.push(getGeneratePath(HOME_REPORT_ROUTES.CREATE, auth));
41
- }, [auth, history]);
56
+ history.push(getGeneratePath(HOME_ROUTE, auth));
57
+ urlParams.set('type', HOME_REPORT_ROUTES.CREATE);
58
+ history.replace({ search: urlParams.toString() });
59
+ }, [auth, history, urlParams]);
42
60
  const onMenuClick = useCallback((key, _) => {
43
61
  const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: key }));
44
62
  if (newPathName !== pathname) {
@@ -16,6 +16,7 @@ export declare const MENU_ITEM_TYPE: {
16
16
  };
17
17
  export declare const ICON_SIZE = 20;
18
18
  export declare const HOME_MENU_ITEMS: Record<string, TMenuFeatureItem>;
19
+ export declare const HOME_ROUTE = "/gen2/:networkId/dashboard";
19
20
  export declare const HOME_REPORT_ROUTES: {
20
21
  DETAIL: string;
21
22
  CONFIGURE: string;
@@ -32,11 +32,11 @@ export const HOME_MENU_ITEMS = {
32
32
  icon_name: null,
33
33
  },
34
34
  };
35
- const HOME_ROUTE = '/gen2/:networkId/dashboard';
35
+ export const HOME_ROUTE = '/gen2/:networkId/dashboard';
36
36
  export const HOME_REPORT_ROUTES = {
37
37
  DETAIL: `${HOME_ROUTE}/detail/:dashboardId`,
38
- CONFIGURE: `${HOME_ROUTE}/detail/:dashboardId/configure`,
39
- CREATE: `${HOME_ROUTE}/create`,
38
+ CONFIGURE: `configure`,
39
+ CREATE: `create`,
40
40
  };
41
41
  /* MARKETING APP */
42
42
  export const MARKETING_ROUTES = {
@@ -8,6 +8,8 @@ import { findActiveAppCodeByChild, findActiveAppCodeByUrl, findLastMatchedItemBy
8
8
  // Store
9
9
  import { useLeftMenuStore } from '../stores';
10
10
  import { POST_MESSAGE_TYPES } from '@antscorp/antsomi-ui/es/constants/postMessage';
11
+ // Constants
12
+ import { CDP_API, PERMISSION_API, PERMISSION_ENV_API } from '@antscorp/antsomi-ui/es/constants';
11
13
  const initialState = {
12
14
  hoverItem: '',
13
15
  isExpandMenu: true,
@@ -17,21 +19,22 @@ export const useLeftMenu = (props) => {
17
19
  const { objectType = 'OVERVIEW', objectId = 1, isGrouped = true, appConfig, customization, onActiveMenuCodeChange, } = props;
18
20
  const { isExpandable = true, isCustomized = false, items, activeKey } = customization || {};
19
21
  // Hooks
20
- const { pathname, hash } = window.location;
22
+ const { pathname, hash, search } = window.location;
23
+ const urlParams = useMemo(() => new URLSearchParams(search), [search]);
21
24
  // Stores
22
25
  const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
23
26
  const customActiveAppKey = useLeftMenuStore(store => store.state.customActiveAppKey);
24
27
  const setLeftMenuState = useLeftMenuStore(store => store.setState);
25
28
  // Destructuring variables
26
- const { auth, languageCode } = appConfig || {};
29
+ const { auth, languageCode, env } = appConfig || {};
27
30
  // State
28
31
  const [state, setState] = useState(initialState);
29
32
  // Queries
30
33
  const { data: menuList } = useGetListMenu({
31
34
  args: {
32
35
  auth: {
33
- token: '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4' || (auth === null || auth === void 0 ? void 0 : auth.token),
34
- url: 'https://sandbox-permission.ants.vn',
36
+ token: env === 'production' ? auth === null || auth === void 0 ? void 0 : auth.token : '5474r2x214r2b4b4v2d4y444u2v5q2p5o4d4c4f424e4',
37
+ url: env ? PERMISSION_ENV_API[env] : '',
35
38
  portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
36
39
  userId: auth === null || auth === void 0 ? void 0 : auth.userId,
37
40
  accountId: auth === null || auth === void 0 ? void 0 : auth.accountId,
@@ -44,10 +47,10 @@ export const useLeftMenu = (props) => {
44
47
  const { data: menuListPermission } = useGetListMenuPermission({
45
48
  args: {
46
49
  auth: {
47
- token: '5474r2x214z284d4w2b4y454a4p5x2d4j4n4w2q4a4v5' || (auth === null || auth === void 0 ? void 0 : auth.token),
48
- url: 'https://permission.antsomi.com',
49
- userId: '1600083836' || (auth === null || auth === void 0 ? void 0 : auth.userId),
50
- accountId: '1600083836' || (auth === null || auth === void 0 ? void 0 : auth.accountId),
50
+ token: auth === null || auth === void 0 ? void 0 : auth.token,
51
+ url: PERMISSION_API,
52
+ userId: auth === null || auth === void 0 ? void 0 : auth.userId,
53
+ accountId: auth === null || auth === void 0 ? void 0 : auth.accountId,
51
54
  },
52
55
  params: {
53
56
  type: 'list-app',
@@ -61,7 +64,7 @@ export const useLeftMenu = (props) => {
61
64
  args: {
62
65
  auth: {
63
66
  token: auth === null || auth === void 0 ? void 0 : auth.token,
64
- url: 'https://sandbox-app.cdp.asia/hub',
67
+ url: env ? `${CDP_API.production}/hub` : '',
65
68
  portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
66
69
  userId: auth === null || auth === void 0 ? void 0 : auth.userId,
67
70
  },
@@ -76,9 +79,9 @@ export const useLeftMenu = (props) => {
76
79
  const { data: destinationChannel } = useGetDestinationChannel({
77
80
  args: {
78
81
  auth: {
79
- token: '5474r2x214z2a46403e4y4749426s2v544r2i4u2k5t5' || (auth === null || auth === void 0 ? void 0 : auth.token),
80
- url: 'https://sandbox-app.cdp.asia/hub',
81
- userId: '1600085179' || (auth === null || auth === void 0 ? void 0 : auth.userId),
82
+ token: auth === null || auth === void 0 ? void 0 : auth.token,
83
+ url: env ? `${CDP_API[env]}/hub` : '',
84
+ userId: auth === null || auth === void 0 ? void 0 : auth.userId,
82
85
  portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
83
86
  },
84
87
  params: {
@@ -165,35 +168,20 @@ export const useLeftMenu = (props) => {
165
168
  items,
166
169
  customActiveAppKey,
167
170
  ]);
168
- /**
169
- * Active App Item having code matching url
170
- */
171
171
  useEffect(() => {
172
+ var _a;
172
173
  if (!isCustomized) {
173
174
  const url = `${pathname}${hash}`;
175
+ /**
176
+ * Active App Item having code matching url
177
+ */
174
178
  const matchAppCode = findActiveAppCodeByUrl({ url, menuItems: mappingChildrenMenu, auth });
175
179
  if (matchAppCode && matchAppCode !== activeAppCode) {
176
180
  setLeftMenuState({ activeAppCode: matchAppCode });
177
181
  }
178
- }
179
- }, [
180
- isCustomized,
181
- activeAppCode,
182
- appConfig === null || appConfig === void 0 ? void 0 : appConfig.auth,
183
- auth,
184
- hash,
185
- mappingChildrenMenu,
186
- pathname,
187
- permissionMenu,
188
- setLeftMenuState,
189
- ]);
190
- /**
191
- * Callback function when url change
192
- */
193
- useEffect(() => {
194
- var _a;
195
- if (!isCustomized) {
196
- const url = `${pathname}${hash}`;
182
+ /**
183
+ * Callback function when url change
184
+ */
197
185
  const matchedCode = (_a = findLastMatchedItemByUrl({
198
186
  url,
199
187
  menuItems: mappingChildrenMenu,
@@ -209,12 +197,16 @@ export const useLeftMenu = (props) => {
209
197
  }
210
198
  }, [
211
199
  isCustomized,
200
+ activeAppCode,
212
201
  auth,
213
- flattenMenuPermission,
214
202
  hash,
215
203
  mappingChildrenMenu,
216
- onActiveMenuCodeChange,
217
204
  pathname,
205
+ permissionMenu,
206
+ setLeftMenuState,
207
+ onActiveMenuCodeChange,
208
+ flattenMenuPermission,
209
+ urlParams,
218
210
  ]);
219
211
  /* Callbacks */
220
212
  const onToggleChildMenu = useCallback(() => {
@@ -170,7 +170,7 @@ export const FeatureMenuItem = styled.div `
170
170
  .popup-triangle {
171
171
  opacity: 0;
172
172
  visibility: hidden;
173
- right: -4px;
173
+ right: -6px;
174
174
  position: absolute;
175
175
  width: 0;
176
176
  height: 0;
@@ -20,6 +20,11 @@ export declare const APP_PERMISSION_DOMAIN: {
20
20
  production: string;
21
21
  };
22
22
  };
23
+ export declare const PERMISSION_ENV_API: {
24
+ development: string;
25
+ sandbox: string;
26
+ production: string;
27
+ };
23
28
  export declare const APP_IAM_DOMAIN: {
24
29
  [x: string]: {
25
30
  development: string;
@@ -17,18 +17,16 @@ export const PLATFORM_API = 'https://platform.ants.tech';
17
17
  export const PERMISSION_API = 'https://permission.antsomi.com';
18
18
  export const SOCKET_API = 'https://ws.ants.tech';
19
19
  export const IAM_API = 'https://iam.ants.tech';
20
+ const PERMISSION_URLS = {
21
+ [ENV.DEV]: 'https://sandbox-permission.ants.vn',
22
+ [ENV.SANDBOX]: 'https://sandbox-permission.ants.vn',
23
+ [ENV.PROD]: 'https://permission.antsomi.com',
24
+ };
20
25
  export const APP_PERMISSION_DOMAIN = {
21
- [DATAFLOWS]: {
22
- [ENV.DEV]: 'https://sandbox-permission.ants.vn',
23
- [ENV.SANDBOX]: 'https://sandbox-permission.ants.vn',
24
- [ENV.PROD]: 'https://permission.antsomi.com',
25
- },
26
- [APP_ANTALYSER]: {
27
- [ENV.DEV]: 'https://sandbox-permission.ants.vn',
28
- [ENV.SANDBOX]: 'https://sandbox-permission.ants.vn',
29
- [ENV.PROD]: 'https://permission.antsomi.com',
30
- },
26
+ [DATAFLOWS]: PERMISSION_URLS,
27
+ [APP_ANTALYSER]: PERMISSION_URLS,
31
28
  };
29
+ export const PERMISSION_ENV_API = PERMISSION_URLS;
32
30
  export const APP_IAM_DOMAIN = {
33
31
  [DATAFLOWS]: {
34
32
  [ENV.DEV]: 'https://sandbox-aacm.ants.vn',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.276",
3
+ "version": "1.3.5-beta.278",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",