@@ -31,13 +31,13 @@ import {
31
31
ADMIN_AUTH_URL ,
32
32
PUBLIC_APP_EDITOR_URL ,
33
33
} from "constants/routesURL" ;
34
- import React , { useMemo } from "react" ;
34
+ import React , { useEffect , useMemo } from "react" ;
35
35
import { createRoot } from "react-dom/client" ;
36
36
import { Helmet } from "react-helmet" ;
37
- import { connect , Provider } from "react-redux" ;
37
+ import { connect , Provider , useDispatch , useSelector } from "react-redux" ;
38
38
import { Redirect , Route , Router , Switch } from "react-router-dom" ;
39
39
import type { AppState } from "redux/reducers" ;
40
- import { fetchConfigAction } from "redux/reduxActions/configActions" ;
40
+ import { fetchConfigAction , fetchDeploymentIdAction } from "redux/reduxActions/configActions" ;
41
41
import { fetchUserAction } from "redux/reduxActions/userActions" ;
42
42
import { reduxStore } from "redux/store/store" ;
43
43
import { developEnv } from "util/envUtils" ;
@@ -50,10 +50,10 @@ import { loadComps } from "comps";
50
50
import { initApp } from "util/commonUtils" ;
51
51
import { favicon } from "assets/images" ;
52
52
import { hasQueryParam } from "util/urlUtils" ;
53
- import { isFetchUserFinished } from "redux/selectors/usersSelectors" ; // getCurrentUser,
53
+ import { getUser , isFetchUserFinished } from "redux/selectors/usersSelectors" ; // getCurrentUser,
54
54
import { getIsCommonSettingFetched } from "redux/selectors/commonSettingSelectors" ;
55
55
import { SystemWarning } from "./components/SystemWarning" ;
56
- import { getBrandingConfig } from "./redux/selectors/configSelectors" ;
56
+ import { getBrandingConfig , getDeploymentId } from "./redux/selectors/configSelectors" ;
57
57
import { buildMaterialPreviewURL } from "./util/materialUtils" ;
58
58
import GlobalInstances from 'components/GlobalInstances' ;
59
59
// import posthog from 'posthog-js'
@@ -64,6 +64,7 @@ import { fetchBrandingSetting } from "./redux/reduxActions/enterpriseActions";
64
64
import { EnterpriseProvider } from "./util/context/EnterpriseContext" ;
65
65
import { SimpleSubscriptionContextProvider } from "./util/context/SimpleSubscriptionContext" ;
66
66
import { getBrandingSetting } from "./redux/selectors/enterpriseSelectors" ;
67
+ import { fetchSubscriptionsAction } from "./redux/reduxActions/subscriptionActions" ;
67
68
68
69
const LazyUserAuthComp = React . lazy ( ( ) => import ( "pages/userAuth" ) ) ;
69
70
const LazyInviteLanding = React . lazy ( ( ) => import ( "pages/common/inviteLanding" ) ) ;
@@ -81,6 +82,22 @@ const Wrapper = React.memo((props: {
81
82
language : string ,
82
83
fontFamily ?: string
83
84
} ) => {
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
+
84
101
const theme = useMemo ( ( ) => {
85
102
return {
86
103
hashed : false ,
0 commit comments