@dfds-ui/google-places 2.0.1-alpha.9c083a06 → 2.0.1-alpha.f1803963

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
@@ -21,7 +21,15 @@ export var GooglePlacesAPIProvider = function GooglePlacesAPIProvider(_ref) {
21
21
  // We want to prevent the google maps api to be loaded more than once
22
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);
23
23
  var languageParam = language ? "&language=".concat(language) : '';
24
- var scriptUrl = "https://maps.googleapis.com/maps/api/js?key=".concat(apiKey, "&libraries=").concat(libraries).concat(languageParam);
24
+ // NOTE: Google Maps API requires a callback when ran asynchronously. See https://developers.google.com/maps/documentation/javascript/url-params#required_parameters
25
+ // Dummy callback to satisfy Google Maps API.
26
+ var dummyCallback = function dummyCallback() {
27
+ return;
28
+ };
29
+ // @ts-expect-error dummyCallback does not exist on window. A callback is required by Google Maps API.
30
+ window.dummyCallback = dummyCallback;
31
+ var callback = "&callback=dummyCallback";
32
+ var scriptUrl = "https://maps.googleapis.com/maps/api/js?key=".concat(apiKey, "&libraries=").concat(libraries).concat(languageParam).concat(callback);
25
33
  var _useScript = useScript(scriptUrl, isGoogleMapsDefined),
26
34
  _useScript2 = _slicedToArray(_useScript, 2),
27
35
  loaded = _useScript2[0],
@@ -29,7 +29,15 @@ const GooglePlacesAPIProvider = ({
29
29
  // We want to prevent the google maps api to be loaded more than once
30
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);
31
31
  const languageParam = language ? `&language=${language}` : '';
32
- const scriptUrl = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries}${languageParam}`;
32
+ // NOTE: Google Maps API requires a callback when ran asynchronously. See https://developers.google.com/maps/documentation/javascript/url-params#required_parameters
33
+ // Dummy callback to satisfy Google Maps API.
34
+ const dummyCallback = () => {
35
+ return;
36
+ };
37
+ // @ts-expect-error dummyCallback does not exist on window. A callback is required by Google Maps API.
38
+ window.dummyCallback = dummyCallback;
39
+ const callback = `&callback=dummyCallback`;
40
+ const scriptUrl = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries}${languageParam}${callback}`;
33
41
  const _useScript = (0, _hooks.useScript)(scriptUrl, isGoogleMapsDefined),
34
42
  _useScript2 = _slicedToArray(_useScript, 2),
35
43
  loaded = _useScript2[0],
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.1-alpha.9c083a06",
6
+ "version": "2.0.1-alpha.f1803963",
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.1-alpha.9c083a06",
18
- "@dfds-ui/hooks": "2.0.1-alpha.9c083a06",
19
- "@dfds-ui/icons": "2.0.1-alpha.9c083a06",
20
- "@dfds-ui/react-components": "2.0.1-alpha.9c083a06",
17
+ "@dfds-ui/colors": "2.0.1-alpha.f1803963",
18
+ "@dfds-ui/hooks": "2.0.1-alpha.f1803963",
19
+ "@dfds-ui/icons": "2.0.1-alpha.f1803963",
20
+ "@dfds-ui/react-components": "2.0.1-alpha.f1803963",
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": "9c083a06e84998b685cd3f36c98ee47422029e96",
25
+ "gitHead": "f18039636510980c38f1ef3e47cd337de4366095",
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  }