@taruvi/navkit 0.0.40 → 0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taruvi/navkit",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "main": "src/App.tsx",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/App.tsx CHANGED
@@ -13,9 +13,9 @@ import taruviLogoWhite from "./assets/taruvi-logo-white.png";
13
13
  import type { Client } from "@taruvi/sdk"
14
14
 
15
15
  const NavkitContent = () => {
16
- const { isUserAuthenticated, siteSettings, appSettings, appName, userData, jwtToken, themeMode } = useNavigation();
16
+ const { isUserAuthenticated, siteSettings, appSettings, appSettingsLoaded, appName, userData, jwtToken, themeMode } = useNavigation();
17
17
  const resolvedAppName = appName || appSettings?.displayName
18
- const showTaruviLogo = !resolvedAppName && !appSettings?.icon
18
+ const showTaruviLogo = appSettingsLoaded && !resolvedAppName && !appSettings?.icon
19
19
  const styles = getAppStyles(themeMode)
20
20
  const [showAppLauncher, setShowAppLauncher] = useState<boolean>(false)
21
21
  const [showProfileMenu, setShowProfileMenu] = useState<boolean>(false)
@@ -40,7 +40,7 @@ const NavkitContent = () => {
40
40
  <Box component={"a"} href="/" sx={styles.leftSection}>
41
41
  {showTaruviLogo ? (
42
42
  <Box component="img" src={taruviLogoWhite} sx={styles.taruviSpaceLogo} />
43
- ) : (
43
+ ) : appSettingsLoaded ? (
44
44
  <>
45
45
  {appSettings?.icon ? <Box component="img" src={appSettings?.icon} sx={styles.logo} /> : <></>}
46
46
  {resolvedAppName &&
@@ -49,7 +49,7 @@ const NavkitContent = () => {
49
49
  </Typography>
50
50
  }
51
51
  </>
52
- )}
52
+ ) : null}
53
53
  </Box>
54
54
  <Box component={"div"} sx={styles.rightSection}>
55
55
  <Shortcuts showChat={setShowChat} onMenuToggle={() => setShowShortcutsMenu(!showShortcutsMenu)} />
@@ -32,6 +32,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
32
32
  enableDarkMode: false,
33
33
  })
34
34
  const [appSettings, setAppSettings] = useState<AppSettings>({})
35
+ const [appSettingsLoaded, setAppSettingsLoaded] = useState<boolean>(false)
35
36
 
36
37
  const [isDesk, setIsDesk] = useState<boolean>(false)
37
38
  const [appsList, setAppsList] = useState<AppData[]>([])
@@ -86,6 +87,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
86
87
 
87
88
  // Fetch app settings to get the app name
88
89
  try {
90
+ setAppSettingsLoaded(false)
89
91
  const { data } = appName ? { data: { display_name: appName } } : await new App(client).settings().execute() as { data: { display_name?: string, icon?: string, primary_color?: string, secondary_color?: string } }
90
92
  setAppSettings({
91
93
  displayName: data?.display_name,
@@ -95,6 +97,9 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
95
97
  })
96
98
  } catch {
97
99
  // App settings not available, continue without app settings
100
+ setAppSettings({})
101
+ } finally {
102
+ setAppSettingsLoaded(true)
98
103
  }
99
104
 
100
105
  const rawSettings = (fetchedSettings?.data ?? fetchedSettings)?.settings ?? {}
@@ -169,7 +174,7 @@ export const NavkitProvider = ({ children, client, onThemeChange, appName }: Nav
169
174
  }, [themeMode, onThemeChange])
170
175
 
171
176
  return (
172
- <NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
177
+ <NavigationContext.Provider value={{ navigateToUrl, isDesk, appsList, userData, siteSettings: siteSettings.current, appSettings, appSettingsLoaded, appName, jwtToken, isUserAuthenticated, client, auth, themeMode, toggleTheme }}>
173
178
  {children}
174
179
  </NavigationContext.Provider>
175
180
  )
package/src/types.ts CHANGED
@@ -34,6 +34,7 @@ export interface NavigationContextType {
34
34
  userData: UserData | null
35
35
  siteSettings: SiteSettings
36
36
  appSettings: AppSettings
37
+ appSettingsLoaded: boolean
37
38
  appName?: string
38
39
  jwtToken: string
39
40
  isUserAuthenticated: boolean