@selfcommunity/react-core 0.7.0-mui7.33 → 0.7.0-react-17.0.1.7

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.
@@ -1,9 +1,6 @@
1
- /// <reference types="google.maps" />
2
1
  declare const useSCGoogleApiLoader: () => {
3
2
  isLoaded: boolean;
4
- status: import("@vis.gl/react-google-maps").APILoadingStatus;
3
+ loadError: Error;
5
4
  geocodingApiKey: any;
6
- libraries: string[];
7
- placesLibrary: google.maps.PlacesLibrary;
8
5
  };
9
6
  export default useSCGoogleApiLoader;
@@ -2,20 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = require("react");
5
- const react_google_maps_1 = require("@vis.gl/react-google-maps");
5
+ const api_1 = require("@react-google-maps/api");
6
6
  const SCPreferencesProvider_1 = require("../components/provider/SCPreferencesProvider");
7
7
  const SCPreferences = tslib_1.__importStar(require("../constants/Preferences"));
8
+ const GOOGLE_MAPS_LIBRARIES = ['places', 'geocoding', 'maps'];
8
9
  const useSCGoogleApiLoader = () => {
9
10
  const { preferences } = (0, SCPreferencesProvider_1.useSCPreferences)();
10
- const isLoaded = (0, react_google_maps_1.useApiIsLoaded)();
11
- const status = (0, react_google_maps_1.useApiLoadingStatus)();
12
- const placesLibrary = (0, react_google_maps_1.useMapsLibrary)('places');
13
- const libraries = ['places', 'geocoding', 'maps'];
14
11
  const geocodingApiKey = (0, react_1.useMemo)(() => {
15
12
  return preferences && SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY in preferences
16
13
  ? preferences[SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY].value
17
14
  : null;
18
15
  }, [preferences]);
19
- return { isLoaded, status, geocodingApiKey, libraries, placesLibrary };
16
+ const { isLoaded, loadError } = (0, api_1.useLoadScript)({
17
+ googleMapsApiKey: geocodingApiKey,
18
+ libraries: GOOGLE_MAPS_LIBRARIES,
19
+ });
20
+ return { isLoaded, loadError, geocodingApiKey };
20
21
  };
21
22
  exports.default = useSCGoogleApiLoader;
@@ -10,5 +10,5 @@
10
10
  * return (<div> {count} | {prevCount}</div>);
11
11
  * }
12
12
  */
13
- declare const usePreviousValue: (value: any) => any;
13
+ declare const usePreviousValue: (value: any) => undefined;
14
14
  export default usePreviousValue;
@@ -14,7 +14,7 @@ const react_1 = require("react");
14
14
  * }
15
15
  */
16
16
  const usePreviousValue = (value) => {
17
- const ref = (0, react_1.useRef)(null);
17
+ const ref = (0, react_1.useRef)();
18
18
  (0, react_1.useEffect)(() => {
19
19
  ref.current = value;
20
20
  });
@@ -1,9 +1,6 @@
1
- /// <reference types="google.maps" />
2
1
  declare const useSCGoogleApiLoader: () => {
3
2
  isLoaded: boolean;
4
- status: import("@vis.gl/react-google-maps").APILoadingStatus;
3
+ loadError: Error;
5
4
  geocodingApiKey: any;
6
- libraries: string[];
7
- placesLibrary: google.maps.PlacesLibrary;
8
5
  };
9
6
  export default useSCGoogleApiLoader;
@@ -1,18 +1,19 @@
1
1
  import { useMemo } from 'react';
2
- import { useApiIsLoaded, useApiLoadingStatus, useMapsLibrary } from '@vis.gl/react-google-maps';
2
+ import { useLoadScript } from '@react-google-maps/api';
3
3
  import { useSCPreferences } from '../components/provider/SCPreferencesProvider';
4
4
  import * as SCPreferences from '../constants/Preferences';
5
+ const GOOGLE_MAPS_LIBRARIES = ['places', 'geocoding', 'maps'];
5
6
  const useSCGoogleApiLoader = () => {
6
7
  const { preferences } = useSCPreferences();
7
- const isLoaded = useApiIsLoaded();
8
- const status = useApiLoadingStatus();
9
- const placesLibrary = useMapsLibrary('places');
10
- const libraries = ['places', 'geocoding', 'maps'];
11
8
  const geocodingApiKey = useMemo(() => {
12
9
  return preferences && SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY in preferences
13
10
  ? preferences[SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY].value
14
11
  : null;
15
12
  }, [preferences]);
16
- return { isLoaded, status, geocodingApiKey, libraries, placesLibrary };
13
+ const { isLoaded, loadError } = useLoadScript({
14
+ googleMapsApiKey: geocodingApiKey,
15
+ libraries: GOOGLE_MAPS_LIBRARIES,
16
+ });
17
+ return { isLoaded, loadError, geocodingApiKey };
17
18
  };
18
19
  export default useSCGoogleApiLoader;
@@ -10,5 +10,5 @@
10
10
  * return (<div> {count} | {prevCount}</div>);
11
11
  * }
12
12
  */
13
- declare const usePreviousValue: (value: any) => any;
13
+ declare const usePreviousValue: (value: any) => undefined;
14
14
  export default usePreviousValue;
@@ -12,7 +12,7 @@ import { useEffect, useRef } from 'react';
12
12
  * }
13
13
  */
14
14
  const usePreviousValue = (value) => {
15
- const ref = useRef(null);
15
+ const ref = useRef();
16
16
  useEffect(() => {
17
17
  ref.current = value;
18
18
  });