@autobusal/providers 1.0.2 → 1.0.4

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/Setup/Setup.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import Preload from './Preload';
2
2
  import languages from './utilities/languages';
3
3
  import analytics from './utilities/analytics';
4
- import { GetSettings } from '../services';
4
+ import { GetSettings, GetMenu } from '../services';
5
5
 
6
6
  interface Props {
7
7
  type: 'normal' | 'whitelabel'
@@ -11,6 +11,8 @@ interface Props {
11
11
  const Setup = ({ type, children }: Props): JSX.Element => {
12
12
  const { data } = GetSettings();
13
13
 
14
+ GetMenu();
15
+
14
16
  languages(type, data.preferences.languages.default);
15
17
 
16
18
  analytics(data.preferences.googleAnalyticsID);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@autobusal/providers",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "dependencies": {
7
- "@tanstack/react-query": "^5.0.5",
8
- "axios": "^1.5.1",
9
- "i18next": "^23.6.0",
10
- "i18next-http-backend": "^2.2.2",
7
+ "@tanstack/react-query": "^5.17.19",
8
+ "axios": "^1.6.5",
9
+ "i18next": "^23.7.18",
10
+ "i18next-http-backend": "^2.4.2",
11
11
  "react-ga4": "^2.1.0",
12
12
  "react-helmet": "^6.1.0",
13
13
  "react-hot-toast": "^2.4.1",
14
- "react-i18next": "^13.3.1",
15
- "styled-components": "^6.1.0"
14
+ "react-i18next": "^14.0.1",
15
+ "styled-components": "^6.1.8"
16
16
  }
17
17
  }
package/services.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useSuspenseQuery, UseSuspenseQueryResult } from '@tanstack/react-query';
2
2
  import apiClient from './Queries/apiClient';
3
- import { SettingsData } from './types';
3
+ import { SettingsData, MenuData } from './types';
4
4
 
5
5
  export const GetSettings = (): UseSuspenseQueryResult<SettingsData> => (
6
6
  useSuspenseQuery({
@@ -15,4 +15,18 @@ export const GetSettings = (): UseSuspenseQueryResult<SettingsData> => (
15
15
  ),
16
16
  staleTime: Infinity
17
17
  })
18
+ );
19
+
20
+ export const GetMenu = (): UseSuspenseQueryResult<MenuData> => (
21
+ useSuspenseQuery({
22
+ queryKey: ['get-menu'],
23
+ queryFn: async () => (
24
+ await apiClient
25
+ .get('/api/menus/get')
26
+ .then(response => (
27
+ response.data
28
+ ))
29
+ .catch(() => {})
30
+ )
31
+ })
18
32
  );
package/types.ts CHANGED
@@ -22,4 +22,12 @@ export interface SettingsData {
22
22
  light: any
23
23
  dark: any
24
24
  }
25
+ }
26
+
27
+ export interface MenuData {
28
+ id: number
29
+ name: string
30
+ link: string
31
+ new: 'yes' | 'no'
32
+ children: MenuData[]
25
33
  }