@antscorp/antsomi-ui 2.0.40 → 2.0.41

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.
@@ -26,7 +26,11 @@ export const HeaderV2 = memo(props => {
26
26
  // * Prefer to use Header in AppConfigContext
27
27
  const { show = true, className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, onCLickLogo, } = props;
28
28
  /** General config for children component */
29
- const { env = envContext, language = languageCode, userId = isNaN(Number(auth?.userId)) ? 0 : Number(auth?.userId), portalId = auth?.portalId, token = auth?.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
29
+ const { env = envContext, language = languageCode,
30
+ // NOTE: Just hot fix for change userId to accountId
31
+ userId = isNaN(Number(auth?.accountId || auth?.userId))
32
+ ? 0
33
+ : Number(auth?.accountId || auth?.userId), portalId = auth?.portalId, token = auth?.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
30
34
  const { currentAccount, inputStyle = 'select', onSelectAccount, ...accountSelectionProps } = accountSelection;
31
35
  const urlParams = useMemo(() => new URLSearchParams(search), [search]);
32
36
  const oidParam = urlParams.get('oid') || currentAccount || 'all';
@@ -101,7 +101,9 @@ export const usePermission = () => {
101
101
  auth: {
102
102
  token: auth?.token,
103
103
  url: permissionDomain || PERMISSION_API,
104
- userId: auth?.userId,
104
+ // NOTE: Hot fix for case menu permission working wrong
105
+ // userId: auth?.userId,
106
+ userId: auth?.accountId,
105
107
  accountId: auth?.accountId,
106
108
  },
107
109
  params: {
@@ -99,9 +99,10 @@ export const recursivePermissionMenu = (menuItems, menuPermissions) => {
99
99
  */
100
100
  export const getGeneratePath = (path, params) => {
101
101
  try {
102
- const { portalId, userId, dashboardId, channelId } = params || {};
102
+ const { portalId, userId, accountId, dashboardId, channelId } = params || {};
103
103
  const paramsObjects = {
104
- user_id: userId ?? '-1',
104
+ // NOTE: Hot fix for account_id (login account)
105
+ user_id: accountId ?? userId ?? '-1',
105
106
  networkId: portalId ?? -1,
106
107
  portalId: portalId ?? -1,
107
108
  dashboardId: dashboardId ?? '-1',
@@ -198,7 +198,8 @@ export const Layout = memo(props => {
198
198
  permissionDomain,
199
199
  socketDomain: SOCKET_API,
200
200
  token,
201
- accountId: userId,
201
+ // accountId: userId,
202
+ accountId,
202
203
  userId,
203
204
  lang: languageCode,
204
205
  networkId: portalId,
@@ -222,6 +223,12 @@ export const Layout = memo(props => {
222
223
  : menu_item_name);
223
224
  setActiveMenu(activeMenuItem);
224
225
  onActiveMenuChange?.(menu_item_code);
226
+ console.log({
227
+ activeItemPath: cloneDeep(activeItemPath),
228
+ flattenPermissionList,
229
+ menuListPermission,
230
+ appItem: activeItemPath[0],
231
+ });
225
232
  const hasRole = hasSelectAccountPermission({
226
233
  activeItemPath: cloneDeep(activeItemPath),
227
234
  flattenPermissionList,
@@ -251,10 +258,10 @@ export const Layout = memo(props => {
251
258
  /** Handle replace current userId in params if current userId is not match */
252
259
  useDeepCompareEffect(() => {
253
260
  const { userId: userIdParam } = (params || {});
254
- if (userIdParam && userId && +userIdParam !== +userId && location.pathname) {
255
- replace(`${location.pathname.replace(userIdParam, `${userId}`)}${location.search}`);
261
+ if (userIdParam && accountId && +userIdParam !== +accountId && location.pathname) {
262
+ replace(`${location.pathname.replace(userIdParam, `${accountId}`)}${location.search}`);
256
263
  }
257
- }, [params, location.pathname, userId, replace]);
264
+ }, [params, location.pathname, accountId, replace]);
258
265
  /** If left menu props has customization then set layout loading to false, because we don't need check permission here */
259
266
  useDeepCompareEffect(() => {
260
267
  if (mergeLeftMenuProps.customization) {
@@ -43,7 +43,9 @@ export const OldLeftMenu = memo(props => {
43
43
  auth: {
44
44
  token: auth?.token,
45
45
  url: PERMISSION_API,
46
- userId: auth?.userId,
46
+ // NOTE: Hot fix for case menu permission working wrong
47
+ // userId: auth?.userId,
48
+ userId: auth?.accountId,
47
49
  accountId: auth?.accountId,
48
50
  },
49
51
  params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "2.0.40",
3
+ "version": "2.0.41",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",