@dfds-ui/google-places 2.0.8 → 2.0.9-alpha.86a59a03
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/GooglePlaces.js +6 -3
- package/cjs/GooglePlaces.js +6 -3
- package/package.json +6 -6
package/GooglePlaces.js
CHANGED
|
@@ -18,8 +18,11 @@ export var GooglePlacesAPIProvider = function GooglePlacesAPIProvider(_ref) {
|
|
|
18
18
|
language = _ref.language,
|
|
19
19
|
_ref$libraries = _ref.libraries,
|
|
20
20
|
libraries = _ref$libraries === void 0 ? 'places' : _ref$libraries;
|
|
21
|
+
// On SSR window does not exist.
|
|
22
|
+
var hasWindow = typeof window !== 'undefined';
|
|
23
|
+
|
|
21
24
|
// We want to prevent the google maps api to be loaded more than once
|
|
22
|
-
var isGoogleMapsDefined =
|
|
25
|
+
var isGoogleMapsDefined = hasWindow && Boolean((_window = window) === null || _window === void 0 ? void 0 : (_window$google = _window.google) === null || _window$google === void 0 ? void 0 : _window$google.maps);
|
|
23
26
|
var languageParam = language ? "&language=".concat(language) : '';
|
|
24
27
|
// NOTE: Google Maps API requires a callback when ran asynchronously. See https://developers.google.com/maps/documentation/javascript/url-params#required_parameters
|
|
25
28
|
// Dummy callback to satisfy Google Maps API.
|
|
@@ -27,8 +30,8 @@ export var GooglePlacesAPIProvider = function GooglePlacesAPIProvider(_ref) {
|
|
|
27
30
|
return;
|
|
28
31
|
};
|
|
29
32
|
// @ts-expect-error dummyCallback does not exist on window. A callback is required by Google Maps API.
|
|
30
|
-
if (
|
|
31
|
-
var callback =
|
|
33
|
+
if (hasWindow) window.dummyCallback = dummyCallback;
|
|
34
|
+
var callback = hasWindow ? "&callback=dummyCallback" : '';
|
|
32
35
|
var scriptUrl = "https://maps.googleapis.com/maps/api/js?key=".concat(apiKey, "&libraries=").concat(libraries).concat(languageParam).concat(callback);
|
|
33
36
|
var _useScript = useScript(scriptUrl, isGoogleMapsDefined),
|
|
34
37
|
_useScript2 = _slicedToArray(_useScript, 2),
|
package/cjs/GooglePlaces.js
CHANGED
|
@@ -26,8 +26,11 @@ const GooglePlacesAPIProvider = ({
|
|
|
26
26
|
libraries = 'places'
|
|
27
27
|
}) => {
|
|
28
28
|
var _window, _window$google;
|
|
29
|
+
// On SSR window does not exist.
|
|
30
|
+
const hasWindow = typeof window !== 'undefined';
|
|
31
|
+
|
|
29
32
|
// We want to prevent the google maps api to be loaded more than once
|
|
30
|
-
const isGoogleMapsDefined =
|
|
33
|
+
const isGoogleMapsDefined = hasWindow && Boolean((_window = window) === null || _window === void 0 ? void 0 : (_window$google = _window.google) === null || _window$google === void 0 ? void 0 : _window$google.maps);
|
|
31
34
|
const languageParam = language ? `&language=${language}` : '';
|
|
32
35
|
// NOTE: Google Maps API requires a callback when ran asynchronously. See https://developers.google.com/maps/documentation/javascript/url-params#required_parameters
|
|
33
36
|
// Dummy callback to satisfy Google Maps API.
|
|
@@ -35,8 +38,8 @@ const GooglePlacesAPIProvider = ({
|
|
|
35
38
|
return;
|
|
36
39
|
};
|
|
37
40
|
// @ts-expect-error dummyCallback does not exist on window. A callback is required by Google Maps API.
|
|
38
|
-
if (
|
|
39
|
-
const callback =
|
|
41
|
+
if (hasWindow) window.dummyCallback = dummyCallback;
|
|
42
|
+
const callback = hasWindow ? `&callback=dummyCallback` : '';
|
|
40
43
|
const scriptUrl = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries}${languageParam}${callback}`;
|
|
41
44
|
const _useScript = (0, _hooks.useScript)(scriptUrl, isGoogleMapsDefined),
|
|
42
45
|
_useScript2 = _slicedToArray(_useScript, 2),
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Components using Google places",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.9-alpha.86a59a03",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"main": "./cjs/index.js",
|
|
9
9
|
"module": "./index.js",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"react-dom": ">= 17.0.2"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@dfds-ui/colors": "2.0.
|
|
18
|
-
"@dfds-ui/hooks": "2.0.
|
|
19
|
-
"@dfds-ui/icons": "2.0.
|
|
20
|
-
"@dfds-ui/react-components": "2.0.
|
|
17
|
+
"@dfds-ui/colors": "2.0.9-alpha.86a59a03",
|
|
18
|
+
"@dfds-ui/hooks": "2.0.9-alpha.86a59a03",
|
|
19
|
+
"@dfds-ui/icons": "2.0.9-alpha.86a59a03",
|
|
20
|
+
"@dfds-ui/react-components": "2.0.9-alpha.86a59a03",
|
|
21
21
|
"@types/googlemaps": "3.43.3",
|
|
22
22
|
"@types/lodash.debounce": "^4.0.7",
|
|
23
23
|
"lodash.debounce": "^4.0.8"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "86a59a03fd6c99748b6c704b01928184451cea37",
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
}
|