@@ -31,13 +31,13 @@ import {
3131 ADMIN_AUTH_URL ,
3232 PUBLIC_APP_EDITOR_URL ,
3333} from "constants/routesURL" ;
34- import React , { useMemo } from "react" ;
34+ import React , { useEffect , useMemo } from "react" ;
3535import { createRoot } from "react-dom/client" ;
3636import { Helmet } from "react-helmet" ;
37- import { connect , Provider } from "react-redux" ;
37+ import { connect , Provider , useDispatch , useSelector } from "react-redux" ;
3838import { Redirect , Route , Router , Switch } from "react-router-dom" ;
3939import type { AppState } from "redux/reducers" ;
40- import { fetchConfigAction } from "redux/reduxActions/configActions" ;
40+ import { fetchConfigAction , fetchDeploymentIdAction } from "redux/reduxActions/configActions" ;
4141import { fetchUserAction } from "redux/reduxActions/userActions" ;
4242import { reduxStore } from "redux/store/store" ;
4343import { developEnv } from "util/envUtils" ;
@@ -50,10 +50,10 @@ import { loadComps } from "comps";
5050import { initApp } from "util/commonUtils" ;
5151import { favicon } from "assets/images" ;
5252import { hasQueryParam } from "util/urlUtils" ;
53- import { isFetchUserFinished } from "redux/selectors/usersSelectors" ; // getCurrentUser,
53+ import { getUser , isFetchUserFinished } from "redux/selectors/usersSelectors" ; // getCurrentUser,
5454import { getIsCommonSettingFetched } from "redux/selectors/commonSettingSelectors" ;
5555import { SystemWarning } from "./components/SystemWarning" ;
56- import { getBrandingConfig } from "./redux/selectors/configSelectors" ;
56+ import { getBrandingConfig , getDeploymentId } from "./redux/selectors/configSelectors" ;
5757import { buildMaterialPreviewURL } from "./util/materialUtils" ;
5858import GlobalInstances from 'components/GlobalInstances' ;
5959// import posthog from 'posthog-js'
@@ -64,6 +64,7 @@ import { fetchBrandingSetting } from "./redux/reduxActions/enterpriseActions";
6464import { EnterpriseProvider } from "./util/context/EnterpriseContext" ;
6565import { SimpleSubscriptionContextProvider } from "./util/context/SimpleSubscriptionContext" ;
6666import { getBrandingSetting } from "./redux/selectors/enterpriseSelectors" ;
67+ import { fetchSubscriptionsAction } from "./redux/reduxActions/subscriptionActions" ;
6768
6869const LazyUserAuthComp = React . lazy ( ( ) => import ( "pages/userAuth" ) ) ;
6970const LazyInviteLanding = React . lazy ( ( ) => import ( "pages/common/inviteLanding" ) ) ;
@@ -81,6 +82,22 @@ const Wrapper = React.memo((props: {
8182 language : string ,
8283 fontFamily ?: string
8384} ) => {
85+ const deploymentId = useSelector ( getDeploymentId ) ;
86+ const user = useSelector ( getUser ) ;
87+ const dispatch = useDispatch ( ) ;
88+
89+ useEffect ( ( ) => {
90+ if ( user . currentOrgId ) {
91+ dispatch ( fetchDeploymentIdAction ( ) ) ;
92+ }
93+ } , [ user . currentOrgId ] ) ;
94+
95+ useEffect ( ( ) => {
96+ if ( Boolean ( deploymentId ) ) {
97+ dispatch ( fetchSubscriptionsAction ( ) )
98+ }
99+ } , [ deploymentId ] ) ;
100+
84101 const theme = useMemo ( ( ) => {
85102 return {
86103 hashed : false ,
0 commit comments