@antscorp/antsomi-ui 1.3.5-beta.616 → 1.3.5-beta.617
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.
|
@@ -19,7 +19,7 @@ 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, getObjectPropSafely, removeAppCookieSessionSubdomain, removeAppCookieSessionSubdomainPrefix, } from '@antscorp/antsomi-ui/es/utils';
|
|
22
|
+
import { formatUserId, getObjectPropSafely, removeAppCookieSessionSubdomain, removeAppCookieSessionSubdomainPrefix, setCookieSession, } 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';
|
|
@@ -481,6 +481,8 @@ export const AccountSharing = props => {
|
|
|
481
481
|
}
|
|
482
482
|
};
|
|
483
483
|
xhr.send(JSON.stringify(data));
|
|
484
|
+
// Set cookie and session
|
|
485
|
+
setCookieSession({ name: 'api_pid', value: networkIdSelected });
|
|
484
486
|
});
|
|
485
487
|
const selectNetwork = network => {
|
|
486
488
|
if (+networkId === +network.networkId) {
|
|
@@ -169,6 +169,9 @@ export const ChildMenu = memo(props => {
|
|
|
169
169
|
};
|
|
170
170
|
const onClickMenuItem = (menuItem) => {
|
|
171
171
|
const { key, menu_item_domain = '', menu_item_path = '' } = menuItem || {};
|
|
172
|
+
// If menu_item_path is empty then return
|
|
173
|
+
if (!menu_item_path)
|
|
174
|
+
return;
|
|
172
175
|
if (isPushDifferentDomain(menu_item_domain, menu_item_path)) {
|
|
173
176
|
return navigatePath(menu_item_domain, menu_item_path);
|
|
174
177
|
}
|
package/es/utils/cookie.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ interface RemoveCookieSubDomain {
|
|
|
4
4
|
env?: TEnv;
|
|
5
5
|
cookieOptions?: Record<string, any>;
|
|
6
6
|
}
|
|
7
|
+
interface SetCookieSession {
|
|
8
|
+
name: string;
|
|
9
|
+
value: any;
|
|
10
|
+
env?: TEnv;
|
|
11
|
+
cookieOptions?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export declare const setCookieSession: ({ name, value, cookieOptions }: SetCookieSession) => void;
|
|
7
14
|
export declare const removeCookieSubDomain: ({ name, env, cookieOptions, }: RemoveCookieSubDomain) => void;
|
|
8
15
|
export declare const removeAppCookieSessionSubdomain: (args: RemoveCookieSubDomain) => void;
|
|
9
16
|
export declare const removeAppCookieSession: (args: RemoveCookieSubDomain) => void;
|
package/es/utils/cookie.js
CHANGED
|
@@ -6,6 +6,14 @@ const cookies = new Cookies(null, {
|
|
|
6
6
|
sameSite: 'none',
|
|
7
7
|
secure: true,
|
|
8
8
|
});
|
|
9
|
+
// Handle cookie
|
|
10
|
+
export const setCookieSession = ({ name, value, cookieOptions }) => {
|
|
11
|
+
cookies.set(name, value, Object.assign({}, cookieOptions));
|
|
12
|
+
if (typeof Storage !== undefined) {
|
|
13
|
+
sessionStorage.setItem(name, name);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
// Handle cookie with subdomain
|
|
9
17
|
export const removeCookieSubDomain = ({ name, env = 'development', cookieOptions, }) => {
|
|
10
18
|
const arrTmp = location.hostname.split('.');
|
|
11
19
|
cookies.remove(name, Object.assign(Object.assign(Object.assign({}, (env !== ENV.DEV && {
|