@dfds-ui/google-places 2.0.8 → 2.0.9-alpha.eff6d19a

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 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 = typeof window !== 'undefined' && Boolean((_window = window) === null || _window === void 0 ? void 0 : (_window$google = _window.google) === null || _window$google === void 0 ? void 0 : _window$google.maps);
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 (window) window.dummyCallback = dummyCallback;
31
- var callback = window ? "&callback=dummyCallback" : '';
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),
@@ -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 = typeof window !== 'undefined' && Boolean((_window = window) === null || _window === void 0 ? void 0 : (_window$google = _window.google) === null || _window$google === void 0 ? void 0 : _window$google.maps);
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 (window) window.dummyCallback = dummyCallback;
39
- const callback = window ? `&callback=dummyCallback` : '';
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.8",
6
+ "version": "2.0.9-alpha.eff6d19a",
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.8",
18
- "@dfds-ui/hooks": "2.0.8",
19
- "@dfds-ui/icons": "2.0.8",
20
- "@dfds-ui/react-components": "2.0.8",
17
+ "@dfds-ui/colors": "2.0.9-alpha.eff6d19a",
18
+ "@dfds-ui/hooks": "2.0.9-alpha.eff6d19a",
19
+ "@dfds-ui/icons": "2.0.9-alpha.eff6d19a",
20
+ "@dfds-ui/react-components": "2.0.9-alpha.eff6d19a",
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": "789ea412c8869bb479b64e20855cc21f9170f0dd",
25
+ "gitHead": "eff6d19ad1324df094fcd40a071d5e770e4a0fd2",
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  }