55 * Licensed under the Apache License, Version 2.0.
66 * you may not use this file except in compliance with the License.
77 */
8+ import { decompressFromBase64 } from 'lz-string' ;
89import { observer } from 'mobx-react-lite' ;
9- import { useLayoutEffect , useRef } from 'react' ;
10+ import { useLayoutEffect , useRef , useState } from 'react' ;
1011import styled , { css } from 'reshadow' ;
1112
1213import { AuthInfoService } from '@cloudbeaver/core-authentication' ;
@@ -18,6 +19,7 @@ import { ProjectInfoResource } from '@cloudbeaver/core-projects';
1819import { SessionPermissionsResource } from '@cloudbeaver/core-root' ;
1920import { ScreenService } from '@cloudbeaver/core-routing' ;
2021import { CachedMapAllKey } from '@cloudbeaver/core-sdk' ;
22+ import { LocalStorageSaveService } from '@cloudbeaver/core-settings' ;
2123import { ThemeService } from '@cloudbeaver/core-theming' ;
2224import { DNDProvider } from '@cloudbeaver/core-ui' ;
2325import { useAppVersion } from '@cloudbeaver/plugin-version' ;
@@ -37,6 +39,7 @@ const bodyStyles = css`
3739` ;
3840
3941export const Body = observer ( function Body ( ) {
42+ const [ edition , setEdition ] = useState ( ) ;
4043 // const serverConfigLoader = useResource(Body, ServerConfigResource, undefined);
4144 const themeService = useService ( ThemeService ) ;
4245 const style = useStyles ( bodyStyles ) ;
@@ -59,6 +62,20 @@ export const Body = observer(function Body() {
5962 document . documentElement . dataset . backendVersion = backendVersion ;
6063 } ) ;
6164
65+ useLayoutEffect ( ( ) => {
66+ const channel = localStorage . getItem ( 'DMS_CB_CHANNEL' ) ;
67+ if ( channel ) {
68+ try {
69+ const json = JSON . parse ( decompressFromBase64 ( channel ) ) ;
70+ if ( json . type === 'sqle_edition' ) {
71+ setEdition ( json . data ) ;
72+ }
73+ } catch ( error ) {
74+ console . error ( error ) ;
75+ }
76+ }
77+ } , [ ] ) ;
78+
6279 return styled ( style ) (
6380 < DNDProvider >
6481 < Loader suspense >
@@ -67,7 +84,9 @@ export const Body = observer(function Body() {
6784 < DialogsPortal />
6885 < Notifications />
6986 </ theme >
70- { userInfo && < Watermark theme = { userInfo . configurationParameters ?. [ 'app.theme' ] } text = { userInfo . displayName || userInfo . userId } /> }
87+ { userInfo && edition === 'ee' && (
88+ < Watermark theme = { userInfo . configurationParameters ?. [ 'app.theme' ] } text = { userInfo . displayName || userInfo . userId } />
89+ ) }
7190 </ Loader >
7291 </ DNDProvider > ,
7392 ) ;
0 commit comments