@blaze-cms/plugin-google-maps-fe 0.146.0-node18.0 → 0.146.0-rc-eagle.0
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/CHANGELOG.md +3 -5
- package/lib/GoogleMaps/GoogleMaps.js +67 -90
- package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsFactory.js +21 -22
- package/lib/GoogleMaps/GoogleMapsFactory.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsHtml.js +9 -11
- package/lib/GoogleMaps/GoogleMapsHtml.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsRender.js +43 -37
- package/lib/GoogleMaps/GoogleMapsRender.js.map +1 -1
- package/lib/GoogleMaps/helpers/add-zoom-listener.js +5 -8
- package/lib/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-map-shapes.js +48 -48
- package/lib/GoogleMaps/helpers/build-map-shapes.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-map-type-ids.js +4 -5
- package/lib/GoogleMaps/helpers/build-map-type-ids.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-query.js +22 -28
- package/lib/GoogleMaps/helpers/build-query.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-shapes-configs.js +84 -111
- package/lib/GoogleMaps/helpers/build-shapes-configs.js.map +1 -1
- package/lib/GoogleMaps/helpers/get-center-coordinates.js +20 -23
- package/lib/GoogleMaps/helpers/get-center-coordinates.js.map +1 -1
- package/lib/GoogleMaps/helpers/get-image-ids.js +9 -18
- package/lib/GoogleMaps/helpers/get-image-ids.js.map +1 -1
- package/lib/GoogleMaps/helpers/get-path.js +13 -16
- package/lib/GoogleMaps/helpers/get-path.js.map +1 -1
- package/lib/GoogleMaps/helpers/index.js +14 -15
- package/lib/GoogleMaps/helpers/index.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-map-options.js +41 -44
- package/lib/GoogleMaps/helpers/set-map-options.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-shapes.js +174 -245
- package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib/GoogleMaps/hooks/index.js +4 -5
- package/lib/GoogleMaps/hooks/index.js.map +1 -1
- package/lib/GoogleMaps/hooks/use-get-entity-schemas.js +14 -20
- package/lib/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -1
- package/lib/GoogleMaps/hooks/use-get-images.js +21 -22
- package/lib/GoogleMaps/hooks/use-get-images.js.map +1 -1
- package/lib/GoogleMaps/index.js +2 -3
- package/lib/GoogleMaps/index.js.map +1 -1
- package/lib/GoogleMaps/queries.js +49 -22
- package/lib/GoogleMaps/queries.js.map +1 -1
- package/lib/constants.js +35 -36
- package/lib/constants.js.map +1 -1
- package/lib/index.js +13 -43
- package/lib/index.js.map +1 -1
- package/package.json +10 -9
- package/src/GoogleMaps/GoogleMaps.js +4 -1
- package/src/GoogleMaps/helpers/add-zoom-listener.js +1 -1
- package/src/GoogleMaps/helpers/build-query.js +3 -1
- package/lib-es/GoogleMaps/GoogleMaps.js +0 -120
- package/lib-es/GoogleMaps/GoogleMaps.js.map +0 -1
- package/lib-es/GoogleMaps/GoogleMapsFactory.js +0 -41
- package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +0 -1
- package/lib-es/GoogleMaps/GoogleMapsHtml.js +0 -16
- package/lib-es/GoogleMaps/GoogleMapsHtml.js.map +0 -1
- package/lib-es/GoogleMaps/GoogleMapsRender.js +0 -72
- package/lib-es/GoogleMaps/GoogleMapsRender.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js +0 -9
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js +0 -68
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js +0 -9
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/build-query.js +0 -29
- package/lib-es/GoogleMaps/helpers/build-query.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +0 -124
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js +0 -29
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/get-image-ids.js +0 -13
- package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/get-path.js +0 -13
- package/lib-es/GoogleMaps/helpers/get-path.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/index.js +0 -9
- package/lib-es/GoogleMaps/helpers/index.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/set-map-options.js +0 -69
- package/lib-es/GoogleMaps/helpers/set-map-options.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/set-shapes.js +0 -309
- package/lib-es/GoogleMaps/helpers/set-shapes.js.map +0 -1
- package/lib-es/GoogleMaps/hooks/index.js +0 -4
- package/lib-es/GoogleMaps/hooks/index.js.map +0 -1
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js +0 -20
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js.map +0 -1
- package/lib-es/GoogleMaps/hooks/use-get-images.js +0 -27
- package/lib-es/GoogleMaps/hooks/use-get-images.js.map +0 -1
- package/lib-es/GoogleMaps/index.js +0 -3
- package/lib-es/GoogleMaps/index.js.map +0 -1
- package/lib-es/GoogleMaps/queries.js +0 -47
- package/lib-es/GoogleMaps/queries.js.map +0 -1
- package/lib-es/constants.js +0 -90
- package/lib-es/constants.js.map +0 -1
- package/lib-es/index.js +0 -17
- package/lib-es/index.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -4,52 +4,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
require("core-js/modules/es.array.iterator.js");
|
|
10
|
-
require("core-js/modules/es.object.define-property.js");
|
|
11
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
-
require("core-js/modules/es.object.to-string.js");
|
|
13
|
-
require("core-js/modules/es.promise.js");
|
|
14
|
-
require("core-js/modules/es.string.iterator.js");
|
|
15
|
-
require("core-js/modules/es.weak-map.js");
|
|
16
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
17
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
18
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
7
|
+
exports.default = load;
|
|
19
8
|
var _dynamic = _interopRequireDefault(require("next/dynamic"));
|
|
20
9
|
var _package = _interopRequireDefault(require("../package.json"));
|
|
21
10
|
var _constants = require("./constants");
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
key: 'googlemaps',
|
|
35
|
-
component: (0, _dynamic["default"])(function () {
|
|
36
|
-
return Promise.resolve().then(function () {
|
|
37
|
-
return _interopRequireWildcard(require(/* webpackChunkName: "blazePbGoogleMaps" */'./GoogleMaps'));
|
|
38
|
-
});
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
return _context.abrupt("return", {
|
|
43
|
-
name: _constants.PLUGIN_NAME,
|
|
44
|
-
version: _package["default"].version
|
|
45
|
-
});
|
|
46
|
-
case 2:
|
|
47
|
-
case "end":
|
|
48
|
-
return _context.stop();
|
|
49
|
-
}
|
|
50
|
-
}, _callee);
|
|
51
|
-
}));
|
|
52
|
-
return _load.apply(this, arguments);
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
async function load(app) {
|
|
13
|
+
app.events.once('load:custom:page-builder:component', addComponent => {
|
|
14
|
+
addComponent({
|
|
15
|
+
key: 'googlemaps',
|
|
16
|
+
component: (0, _dynamic.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./GoogleMaps'))))
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
name: _constants.PLUGIN_NAME,
|
|
21
|
+
version: _package.default.version
|
|
22
|
+
};
|
|
53
23
|
}
|
|
54
24
|
load.pluginName = _constants.PLUGIN_NAME;
|
|
55
25
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_dynamic","_interopRequireDefault","require","_package","_constants","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_dynamic","_interopRequireDefault","require","_package","_constants","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","load","app","events","once","addComponent","key","component","dynamic","Promise","resolve","then","name","PLUGIN_NAME","version","pkg","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'googlemaps',\n component: dynamic(() => import(/* webpackChunkName: \"blazePbGoogleMaps\" */ './GoogleMaps'))\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA0C,SAAAG,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAE3B,eAAekB,IAAIA,CAACC,GAAG,EAAE;EACtCA,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,oCAAoC,EAAEC,YAAY,IAAI;IACpEA,YAAY,CAAC;MACXC,GAAG,EAAE,YAAY;MACjBC,SAAS,EAAE,IAAAC,gBAAO,EAAC,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAA9B,uBAAA,CAAAH,OAAA,CAAyD,cAAc,GAAC;IAC7F,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLkC,IAAI,EAAEC,sBAAW;IACjBC,OAAO,EAAEC,gBAAG,CAACD;EACf,CAAC;AACH;AAEAb,IAAI,CAACe,UAAU,GAAGH,sBAAW","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-google-maps-fe",
|
|
3
|
-
"version": "0.146.0-
|
|
3
|
+
"version": "0.146.0-rc-eagle.0",
|
|
4
4
|
"description": "Blaze Google maps plugin fe",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
7
|
-
"
|
|
7
|
+
"source": "src/index.js",
|
|
8
8
|
"directories": {
|
|
9
9
|
"src": "src/"
|
|
10
10
|
},
|
|
@@ -27,24 +27,25 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/nextjs-components": "0.146.0-
|
|
31
|
-
"@blaze-cms/react-page-builder": "0.146.0-
|
|
32
|
-
"@blaze-cms/setup-ui": "0.146.0-
|
|
30
|
+
"@blaze-cms/nextjs-components": "0.146.0-rc-eagle.0",
|
|
31
|
+
"@blaze-cms/react-page-builder": "0.146.0-rc-eagle.0",
|
|
32
|
+
"@blaze-cms/setup-ui": "0.146.0-rc-eagle.0",
|
|
33
33
|
"@blaze-react/more": "^0.7.0",
|
|
34
34
|
"@blaze-react/utils": "^0.7.0",
|
|
35
|
-
"
|
|
35
|
+
"lodash.camelcase": "^4.3.0",
|
|
36
36
|
"lodash.isnumber": "^3.0.3",
|
|
37
|
+
"lodash.upperfirst": "^4.3.1",
|
|
37
38
|
"regenerator-runtime": "^0.13.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@blaze-cms/core-ui": "0.146.0-
|
|
41
|
+
"@blaze-cms/core-ui": "0.146.0-rc-eagle.0"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
|
-
"next": "14
|
|
44
|
+
"next": ">= 14"
|
|
44
45
|
},
|
|
45
46
|
"eslintIgnore": [
|
|
46
47
|
"lib/*",
|
|
47
48
|
"lib-es/*"
|
|
48
49
|
],
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "ddfab9ac3d59438939268c106917b092e4071071"
|
|
50
51
|
}
|
|
@@ -86,8 +86,11 @@ const GoogleMaps = ({
|
|
|
86
86
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
87
|
}, []);
|
|
88
88
|
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);
|
|
91
|
+
}, [isIntersecting, map, mapShapes, imageData, router, client]);
|
|
92
|
+
|
|
89
93
|
if (map && typeof onMount === `function`) onMount(map, onMountProps);
|
|
90
|
-
if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);
|
|
91
94
|
|
|
92
95
|
return <GoogleMapsHtml mapRef={mapRef} />;
|
|
93
96
|
};
|
|
@@ -3,7 +3,7 @@ import setShapes from './set-shapes';
|
|
|
3
3
|
|
|
4
4
|
const addZoomListener = (map, router, shapes, imageData, client) => {
|
|
5
5
|
if (!map) return;
|
|
6
|
-
setShapes(map, router, shapes, imageData);
|
|
6
|
+
setShapes(map, router, shapes, imageData, client);
|
|
7
7
|
map.addListener(ZOOM_CHANGED, () => setShapes(map, router, shapes, imageData, client));
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import upperFirst from 'lodash.upperfirst';
|
|
2
|
+
import camelcase from 'lodash.camelcase';
|
|
1
3
|
import { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';
|
|
2
4
|
|
|
3
5
|
const buildQuery = entityConfigs => {
|
|
@@ -7,7 +9,7 @@ const buildQuery = entityConfigs => {
|
|
|
7
9
|
.map(entityConfig => {
|
|
8
10
|
const { action, ids, entity, propsQuery, shapeKey, filtersObject } = entityConfig;
|
|
9
11
|
if (!action) return '';
|
|
10
|
-
const formatedEntity =
|
|
12
|
+
const formatedEntity = upperFirst(camelcase(entity));
|
|
11
13
|
const filterQueryKey =
|
|
12
14
|
action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;
|
|
13
15
|
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
const _excluded = ["type", "name", "modifier", "elementTitle", "imageData", "onMount", "onMountProps", "parent", "mapShapes", "centerCoordinates"];
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { useApolloClient } from '@apollo/client';
|
|
6
|
-
import { useRouter } from 'next/router';
|
|
7
|
-
import { withTitle } from '@blaze-cms/react-page-builder';
|
|
8
|
-
import { useInView } from '@blaze-react/utils/lib/customHooks';
|
|
9
|
-
import { functions, isEqual, omit } from 'lodash';
|
|
10
|
-
import { setMapOptions, addZoomListener } from './helpers';
|
|
11
|
-
import { GOOGLE_MAPS_SCRIPT, LOAD, SCRIPT, IN_VIEW_CONFIG } from '../constants';
|
|
12
|
-
import GoogleMapsHtml from './GoogleMapsHtml';
|
|
13
|
-
const shouldNotUpdate = (props, nextProps) => {
|
|
14
|
-
const [funcs, nextFuncs] = [functions(props), functions(nextProps)];
|
|
15
|
-
const noPropChange = isEqual(omit(props, funcs), omit(nextProps, nextFuncs));
|
|
16
|
-
const noFuncChange = funcs.length === nextFuncs.length && funcs.every(fn => props[fn].toString() === nextProps[fn].toString());
|
|
17
|
-
return noPropChange && noFuncChange;
|
|
18
|
-
};
|
|
19
|
-
const GoogleMaps = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
type,
|
|
22
|
-
name,
|
|
23
|
-
modifier,
|
|
24
|
-
elementTitle,
|
|
25
|
-
imageData,
|
|
26
|
-
onMount,
|
|
27
|
-
onMountProps,
|
|
28
|
-
parent,
|
|
29
|
-
mapShapes,
|
|
30
|
-
centerCoordinates
|
|
31
|
-
} = _ref,
|
|
32
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
-
const router = useRouter();
|
|
34
|
-
const [isIntersecting, mapRef] = useInView(IN_VIEW_CONFIG);
|
|
35
|
-
const client = useApolloClient();
|
|
36
|
-
const [map, setMap] = useState();
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const options = setMapOptions(otherProps);
|
|
39
|
-
const onLoad = () => {
|
|
40
|
-
const initialMap = new window.google.maps.Map(mapRef.current, options);
|
|
41
|
-
if (centerCoordinates.length === 1) {
|
|
42
|
-
const [{
|
|
43
|
-
latitude: lat,
|
|
44
|
-
longitude: lng
|
|
45
|
-
}] = centerCoordinates;
|
|
46
|
-
initialMap.setCenter({
|
|
47
|
-
lat,
|
|
48
|
-
lng
|
|
49
|
-
});
|
|
50
|
-
} else {
|
|
51
|
-
const bounds = new window.google.maps.LatLngBounds();
|
|
52
|
-
centerCoordinates.forEach(({
|
|
53
|
-
latitude,
|
|
54
|
-
longitude
|
|
55
|
-
}) => {
|
|
56
|
-
bounds.extend(new window.google.maps.LatLng(latitude, longitude));
|
|
57
|
-
});
|
|
58
|
-
initialMap.fitBounds(bounds);
|
|
59
|
-
}
|
|
60
|
-
setMap(initialMap);
|
|
61
|
-
};
|
|
62
|
-
if (!window.google) {
|
|
63
|
-
const script = document.createElement(SCRIPT);
|
|
64
|
-
script.src = `${GOOGLE_MAPS_SCRIPT}${process.env.GOOGLE_MAPS_API_KEY}`;
|
|
65
|
-
document.head.append(script);
|
|
66
|
-
script.addEventListener(LOAD, onLoad);
|
|
67
|
-
return () => script.removeEventListener(LOAD, onLoad);
|
|
68
|
-
}
|
|
69
|
-
onLoad();
|
|
70
|
-
if (map) {
|
|
71
|
-
map.setOptions(options);
|
|
72
|
-
const {
|
|
73
|
-
enableGeolocation
|
|
74
|
-
} = otherProps;
|
|
75
|
-
const shouldActivateGeolocation = enableGeolocation && navigator.geolocation;
|
|
76
|
-
if (shouldActivateGeolocation) {
|
|
77
|
-
navigator.geolocation.getCurrentPosition(position => {
|
|
78
|
-
const center = {
|
|
79
|
-
lat: position.coords.latitude,
|
|
80
|
-
lng: position.coords.longitude
|
|
81
|
-
};
|
|
82
|
-
map.setCenter(center);
|
|
83
|
-
}, () => {});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return () => {};
|
|
87
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
-
}, []);
|
|
89
|
-
if (map && typeof onMount === `function`) onMount(map, onMountProps);
|
|
90
|
-
if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);
|
|
91
|
-
return /*#__PURE__*/React.createElement(GoogleMapsHtml, {
|
|
92
|
-
mapRef: mapRef
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
GoogleMaps.propTypes = {
|
|
96
|
-
mapShapes: PropTypes.array,
|
|
97
|
-
imageData: PropTypes.array,
|
|
98
|
-
type: PropTypes.string,
|
|
99
|
-
name: PropTypes.string,
|
|
100
|
-
modifier: PropTypes.string,
|
|
101
|
-
elementTitle: PropTypes.string,
|
|
102
|
-
onMount: PropTypes.func,
|
|
103
|
-
onMountProps: PropTypes.object,
|
|
104
|
-
parent: PropTypes.object,
|
|
105
|
-
centerCoordinates: PropTypes.array
|
|
106
|
-
};
|
|
107
|
-
GoogleMaps.defaultProps = {
|
|
108
|
-
mapShapes: [],
|
|
109
|
-
imageData: [],
|
|
110
|
-
centerCoordinates: [],
|
|
111
|
-
type: '',
|
|
112
|
-
name: '',
|
|
113
|
-
modifier: '',
|
|
114
|
-
elementTitle: '',
|
|
115
|
-
onMount: null,
|
|
116
|
-
onMountProps: null,
|
|
117
|
-
parent: {}
|
|
118
|
-
};
|
|
119
|
-
export default React.memo(withTitle(GoogleMaps), shouldNotUpdate);
|
|
120
|
-
//# sourceMappingURL=GoogleMaps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMaps.js","names":["React","useEffect","useState","PropTypes","useApolloClient","useRouter","withTitle","useInView","functions","isEqual","omit","setMapOptions","addZoomListener","GOOGLE_MAPS_SCRIPT","LOAD","SCRIPT","IN_VIEW_CONFIG","GoogleMapsHtml","shouldNotUpdate","props","nextProps","funcs","nextFuncs","noPropChange","noFuncChange","length","every","fn","toString","GoogleMaps","_ref","type","name","modifier","elementTitle","imageData","onMount","onMountProps","parent","mapShapes","centerCoordinates","otherProps","_objectWithoutProperties","_excluded","router","isIntersecting","mapRef","client","map","setMap","options","onLoad","initialMap","window","google","maps","Map","current","latitude","lat","longitude","lng","setCenter","bounds","LatLngBounds","forEach","extend","LatLng","fitBounds","script","document","createElement","src","process","env","GOOGLE_MAPS_API_KEY","head","append","addEventListener","removeEventListener","setOptions","enableGeolocation","shouldActivateGeolocation","navigator","geolocation","getCurrentPosition","position","center","coords","propTypes","array","string","func","object","defaultProps","memo"],"sources":["../../src/GoogleMaps/GoogleMaps.js"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useApolloClient } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { withTitle } from '@blaze-cms/react-page-builder';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { functions, isEqual, omit } from 'lodash';\nimport { setMapOptions, addZoomListener } from './helpers';\nimport { GOOGLE_MAPS_SCRIPT, LOAD, SCRIPT, IN_VIEW_CONFIG } from '../constants';\nimport GoogleMapsHtml from './GoogleMapsHtml';\n\nconst shouldNotUpdate = (props, nextProps) => {\n const [funcs, nextFuncs] = [functions(props), functions(nextProps)];\n const noPropChange = isEqual(omit(props, funcs), omit(nextProps, nextFuncs));\n const noFuncChange =\n funcs.length === nextFuncs.length &&\n funcs.every(fn => props[fn].toString() === nextProps[fn].toString());\n return noPropChange && noFuncChange;\n};\n\nconst GoogleMaps = ({\n type,\n name,\n modifier,\n elementTitle,\n imageData,\n onMount,\n onMountProps,\n parent,\n mapShapes,\n centerCoordinates,\n ...otherProps\n}) => {\n const router = useRouter();\n const [isIntersecting, mapRef] = useInView(IN_VIEW_CONFIG);\n const client = useApolloClient();\n const [map, setMap] = useState();\n\n useEffect(() => {\n const options = setMapOptions(otherProps);\n const onLoad = () => {\n const initialMap = new window.google.maps.Map(mapRef.current, options);\n if (centerCoordinates.length === 1) {\n const [{ latitude: lat, longitude: lng }] = centerCoordinates;\n initialMap.setCenter({ lat, lng });\n } else {\n const bounds = new window.google.maps.LatLngBounds();\n centerCoordinates.forEach(({ latitude, longitude }) => {\n bounds.extend(new window.google.maps.LatLng(latitude, longitude));\n });\n initialMap.fitBounds(bounds);\n }\n setMap(initialMap);\n };\n\n if (!window.google) {\n const script = document.createElement(SCRIPT);\n script.src = `${GOOGLE_MAPS_SCRIPT}${process.env.GOOGLE_MAPS_API_KEY}`;\n document.head.append(script);\n script.addEventListener(LOAD, onLoad);\n return () => script.removeEventListener(LOAD, onLoad);\n }\n\n onLoad();\n\n if (map) {\n map.setOptions(options);\n const { enableGeolocation } = otherProps;\n const shouldActivateGeolocation = enableGeolocation && navigator.geolocation;\n if (shouldActivateGeolocation) {\n navigator.geolocation.getCurrentPosition(\n position => {\n const center = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n\n map.setCenter(center);\n },\n () => {}\n );\n }\n }\n\n return () => {};\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (map && typeof onMount === `function`) onMount(map, onMountProps);\n if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);\n\n return <GoogleMapsHtml mapRef={mapRef} />;\n};\n\nGoogleMaps.propTypes = {\n mapShapes: PropTypes.array,\n imageData: PropTypes.array,\n type: PropTypes.string,\n name: PropTypes.string,\n modifier: PropTypes.string,\n elementTitle: PropTypes.string,\n onMount: PropTypes.func,\n onMountProps: PropTypes.object,\n parent: PropTypes.object,\n centerCoordinates: PropTypes.array\n};\n\nGoogleMaps.defaultProps = {\n mapShapes: [],\n imageData: [],\n centerCoordinates: [],\n type: '',\n name: '',\n modifier: '',\n elementTitle: '',\n onMount: null,\n onMountProps: null,\n parent: {}\n};\n\nexport default React.memo(withTitle(GoogleMaps), shouldNotUpdate);\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,SAAS,QAAQ,+BAA+B;AACzD,SAASC,SAAS,QAAQ,oCAAoC;AAC9D,SAASC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,QAAQ;AACjD,SAASC,aAAa,EAAEC,eAAe,QAAQ,WAAW;AAC1D,SAASC,kBAAkB,EAAEC,IAAI,EAAEC,MAAM,EAAEC,cAAc,QAAQ,cAAc;AAC/E,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,MAAMC,eAAe,GAAGA,CAACC,KAAK,EAAEC,SAAS,KAAK;EAC5C,MAAM,CAACC,KAAK,EAAEC,SAAS,CAAC,GAAG,CAACd,SAAS,CAACW,KAAK,CAAC,EAAEX,SAAS,CAACY,SAAS,CAAC,CAAC;EACnE,MAAMG,YAAY,GAAGd,OAAO,CAACC,IAAI,CAACS,KAAK,EAAEE,KAAK,CAAC,EAAEX,IAAI,CAACU,SAAS,EAAEE,SAAS,CAAC,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,MAAM,EAAE,CAAC;AACX,CAAC;AAED,eAAetC,KAAK,CAAC+F,IAAI,CAACzF,SAAS,CAACuB,UAAU,CAAC,EAAEX,eAAe,CAAC","ignoreList":[]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["entityGroups", "parent"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { useGetEntitySchemasAsObj } from '@blaze-cms/react-page-builder';
|
|
7
|
-
import { buildShapesConfig } from './helpers';
|
|
8
|
-
import GoogleMapsRender from './GoogleMapsRender';
|
|
9
|
-
import GoogleMapsHtml from './GoogleMapsHtml';
|
|
10
|
-
const GoogleMapsFactory = _ref => {
|
|
11
|
-
let {
|
|
12
|
-
entityGroups,
|
|
13
|
-
parent
|
|
14
|
-
} = _ref,
|
|
15
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
const {
|
|
17
|
-
data,
|
|
18
|
-
loading,
|
|
19
|
-
error
|
|
20
|
-
} = useGetEntitySchemasAsObj(entityGroups.map(({
|
|
21
|
-
entity
|
|
22
|
-
}) => entity));
|
|
23
|
-
if (loading) return /*#__PURE__*/React.createElement(GoogleMapsHtml, null);
|
|
24
|
-
if (error) return error.message;
|
|
25
|
-
const shapeConfigs = buildShapesConfig(data, entityGroups, parent);
|
|
26
|
-
return /*#__PURE__*/React.createElement(GoogleMapsRender, _extends({
|
|
27
|
-
shapeConfigs: shapeConfigs,
|
|
28
|
-
entityGroups: entityGroups,
|
|
29
|
-
parent: parent
|
|
30
|
-
}, otherProps));
|
|
31
|
-
};
|
|
32
|
-
GoogleMapsFactory.propTypes = {
|
|
33
|
-
parent: PropTypes.object,
|
|
34
|
-
entityGroups: PropTypes.array
|
|
35
|
-
};
|
|
36
|
-
GoogleMapsFactory.defaultProps = {
|
|
37
|
-
parent: {},
|
|
38
|
-
entityGroups: []
|
|
39
|
-
};
|
|
40
|
-
export default GoogleMapsFactory;
|
|
41
|
-
//# sourceMappingURL=GoogleMapsFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsFactory.js","names":["React","PropTypes","useGetEntitySchemasAsObj","buildShapesConfig","GoogleMapsRender","GoogleMapsHtml","GoogleMapsFactory","_ref","entityGroups","parent","otherProps","_objectWithoutProperties","_excluded","data","loading","error","map","entity","createElement","message","shapeConfigs","_extends","propTypes","object","array","defaultProps"],"sources":["../../src/GoogleMaps/GoogleMapsFactory.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useGetEntitySchemasAsObj } from '@blaze-cms/react-page-builder';\nimport { buildShapesConfig } from './helpers';\nimport GoogleMapsRender from './GoogleMapsRender';\nimport GoogleMapsHtml from './GoogleMapsHtml';\n\nconst GoogleMapsFactory = ({ entityGroups, parent, ...otherProps }) => {\n const { data, loading, error } = useGetEntitySchemasAsObj(\n entityGroups.map(({ entity }) => entity)\n );\n\n if (loading) return <GoogleMapsHtml />;\n if (error) return error.message;\n\n const shapeConfigs = buildShapesConfig(data, entityGroups, parent);\n\n return (\n <GoogleMapsRender\n shapeConfigs={shapeConfigs}\n entityGroups={entityGroups}\n parent={parent}\n {...otherProps}\n />\n );\n};\n\nGoogleMapsFactory.propTypes = {\n parent: PropTypes.object,\n entityGroups: PropTypes.array\n};\n\nGoogleMapsFactory.defaultProps = {\n parent: {},\n entityGroups: []\n};\n\nexport default GoogleMapsFactory;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,MAAMC,iBAAiB,GAAGC,IAAA,IAA6C;EAAA,IAA5C;MAAEC,YAAY;MAAEC;IAAsB,CAAC,GAAAF,IAAA;IAAZG,UAAU,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAC9D,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGb,wBAAwB,CACvDM,YAAY,CAACQ,GAAG,CAAC,CAAC;IAAEC;EAAO,CAAC,KAAKA,MAAM,CACzC,CAAC;EAED,IAAIH,OAAO,EAAE,oBAAOd,KAAA,CAAAkB,aAAA,CAACb,cAAc,MAAE,CAAC;EACtC,IAAIU,KAAK,EAAE,OAAOA,KAAK,CAACI,OAAO;EAE/B,MAAMC,YAAY,GAAGjB,iBAAiB,CAACU,IAAI,EAAEL,YAAY,EAAEC,MAAM,CAAC;EAElE,oBACET,KAAA,CAAAkB,aAAA,CAACd,gBAAgB,EAAAiB,QAAA;IACfD,YAAY,EAAEA,YAAa;IAC3BZ,YAAY,EAAEA,YAAa;IAC3BC,MAAM,EAAEA;EAAO,GACXC,UAAU,CACf,CAAC;AAEN,CAAC;AAEDJ,iBAAiB,CAACgB,SAAS,GAAG;EAC5Bb,MAAM,EAAER,SAAS,CAACsB,MAAM;EACxBf,YAAY,EAAEP,SAAS,CAACuB;AAC1B,CAAC;AAEDlB,iBAAiB,CAACmB,YAAY,GAAG;EAC/BhB,MAAM,EAAE,CAAC,CAAC;EACVD,YAAY,EAAE;AAChB,CAAC;AAED,eAAeF,iBAAiB","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
const GoogleMapsFactory = ({
|
|
4
|
-
mapRef
|
|
5
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
6
|
-
className: `google-maps ${!mapRef ? 'loading' : ''}`,
|
|
7
|
-
ref: mapRef
|
|
8
|
-
});
|
|
9
|
-
GoogleMapsFactory.propTypes = {
|
|
10
|
-
mapRef: PropTypes.object
|
|
11
|
-
};
|
|
12
|
-
GoogleMapsFactory.defaultProps = {
|
|
13
|
-
mapRef: null
|
|
14
|
-
};
|
|
15
|
-
export default GoogleMapsFactory;
|
|
16
|
-
//# sourceMappingURL=GoogleMapsHtml.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsHtml.js","names":["React","PropTypes","GoogleMapsFactory","mapRef","createElement","className","ref","propTypes","object","defaultProps"],"sources":["../../src/GoogleMaps/GoogleMapsHtml.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst GoogleMapsFactory = ({ mapRef }) => (\n <div className={`google-maps ${!mapRef ? 'loading' : ''}`} ref={mapRef} />\n);\n\nGoogleMapsFactory.propTypes = {\n mapRef: PropTypes.object\n};\n\nGoogleMapsFactory.defaultProps = {\n mapRef: null\n};\n\nexport default GoogleMapsFactory;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC;AAAO,CAAC,kBACnCH,KAAA,CAAAI,aAAA;EAAKC,SAAS,EAAE,eAAe,CAACF,MAAM,GAAG,SAAS,GAAG,EAAE,EAAG;EAACG,GAAG,EAAEH;AAAO,CAAE,CAC1E;AAEDD,iBAAiB,CAACK,SAAS,GAAG;EAC5BJ,MAAM,EAAEF,SAAS,CAACO;AACpB,CAAC;AAEDN,iBAAiB,CAACO,YAAY,GAAG;EAC/BN,MAAM,EAAE;AACV,CAAC;AAED,eAAeD,iBAAiB","ignoreList":[]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["shapeConfigs", "entityGroups", "id"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import isNumber from 'lodash.isnumber';
|
|
7
|
-
import { useQuery } from '@apollo/client';
|
|
8
|
-
import { getAction } from '@blaze-cms/react-page-builder';
|
|
9
|
-
import { useGetImages } from './hooks';
|
|
10
|
-
import { buildQuery, getImageIds, getCenterCoordinates, buildMapShapes } from './helpers';
|
|
11
|
-
import GoogleMaps from './GoogleMaps';
|
|
12
|
-
import GoogleMapsHtml from './GoogleMapsHtml';
|
|
13
|
-
const defaultQuery = getAction('getPublishedPages', 'id');
|
|
14
|
-
const GoogleMapsRender = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
shapeConfigs,
|
|
17
|
-
entityGroups,
|
|
18
|
-
id
|
|
19
|
-
} = _ref,
|
|
20
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
const {
|
|
22
|
-
defaultZoom
|
|
23
|
-
} = otherProps;
|
|
24
|
-
const {
|
|
25
|
-
query
|
|
26
|
-
} = buildQuery(shapeConfigs);
|
|
27
|
-
const {
|
|
28
|
-
data,
|
|
29
|
-
loading,
|
|
30
|
-
error
|
|
31
|
-
} = useQuery(query || defaultQuery, {
|
|
32
|
-
skip: !query
|
|
33
|
-
});
|
|
34
|
-
const mapShapes = buildMapShapes(shapeConfigs, data);
|
|
35
|
-
const imageIds = getImageIds(mapShapes);
|
|
36
|
-
const {
|
|
37
|
-
data: {
|
|
38
|
-
getFiles: imageData
|
|
39
|
-
} = {},
|
|
40
|
-
loading: imagesLoading,
|
|
41
|
-
error: imagesError
|
|
42
|
-
} = useGetImages(imageIds);
|
|
43
|
-
if (loading || imagesLoading) return /*#__PURE__*/React.createElement(GoogleMapsHtml, null);
|
|
44
|
-
if (error || imagesError) return null;
|
|
45
|
-
const centerCoordinates = getCenterCoordinates(mapShapes, otherProps);
|
|
46
|
-
const shouldDisplayMap = isNumber(defaultZoom) && !!centerCoordinates.length;
|
|
47
|
-
if (!shouldDisplayMap) return null;
|
|
48
|
-
return /*#__PURE__*/React.createElement(GoogleMaps, _extends({
|
|
49
|
-
key: otherProps.slug,
|
|
50
|
-
centerCoordinates: centerCoordinates,
|
|
51
|
-
mapShapes: mapShapes,
|
|
52
|
-
imageData: imageData
|
|
53
|
-
}, otherProps));
|
|
54
|
-
};
|
|
55
|
-
GoogleMapsRender.propTypes = {
|
|
56
|
-
entityGroups: PropTypes.array,
|
|
57
|
-
id: PropTypes.string,
|
|
58
|
-
shapeConfigs: PropTypes.array,
|
|
59
|
-
centerLatitude: PropTypes.number,
|
|
60
|
-
centerLongitude: PropTypes.number,
|
|
61
|
-
defaultZoom: PropTypes.number
|
|
62
|
-
};
|
|
63
|
-
GoogleMapsRender.defaultProps = {
|
|
64
|
-
entityGroups: [],
|
|
65
|
-
shapeConfigs: [],
|
|
66
|
-
id: '',
|
|
67
|
-
centerLatitude: null,
|
|
68
|
-
centerLongitude: null,
|
|
69
|
-
defaultZoom: null
|
|
70
|
-
};
|
|
71
|
-
export default GoogleMapsRender;
|
|
72
|
-
//# sourceMappingURL=GoogleMapsRender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsRender.js","names":["React","PropTypes","isNumber","useQuery","getAction","useGetImages","buildQuery","getImageIds","getCenterCoordinates","buildMapShapes","GoogleMaps","GoogleMapsHtml","defaultQuery","GoogleMapsRender","_ref","shapeConfigs","entityGroups","id","otherProps","_objectWithoutProperties","_excluded","defaultZoom","query","data","loading","error","skip","mapShapes","imageIds","getFiles","imageData","imagesLoading","imagesError","createElement","centerCoordinates","shouldDisplayMap","length","_extends","key","slug","propTypes","array","string","centerLatitude","number","centerLongitude","defaultProps"],"sources":["../../src/GoogleMaps/GoogleMapsRender.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isNumber from 'lodash.isnumber';\nimport { useQuery } from '@apollo/client';\nimport { getAction } from '@blaze-cms/react-page-builder';\nimport { useGetImages } from './hooks';\nimport { buildQuery, getImageIds, getCenterCoordinates, buildMapShapes } from './helpers';\nimport GoogleMaps from './GoogleMaps';\nimport GoogleMapsHtml from './GoogleMapsHtml';\n\nconst defaultQuery = getAction('getPublishedPages', 'id');\n\nconst GoogleMapsRender = ({ shapeConfigs, entityGroups, id, ...otherProps }) => {\n const { defaultZoom } = otherProps;\n const { query } = buildQuery(shapeConfigs);\n const { data, loading, error } = useQuery(query || defaultQuery, {\n skip: !query\n });\n\n const mapShapes = buildMapShapes(shapeConfigs, data);\n const imageIds = getImageIds(mapShapes);\n const {\n data: { getFiles: imageData } = {},\n loading: imagesLoading,\n error: imagesError\n } = useGetImages(imageIds);\n if (loading || imagesLoading) return <GoogleMapsHtml />;\n if (error || imagesError) return null;\n\n const centerCoordinates = getCenterCoordinates(mapShapes, otherProps);\n const shouldDisplayMap = isNumber(defaultZoom) && !!centerCoordinates.length;\n\n if (!shouldDisplayMap) return null;\n\n return (\n <GoogleMaps\n key={otherProps.slug}\n centerCoordinates={centerCoordinates}\n mapShapes={mapShapes}\n imageData={imageData}\n {...otherProps}\n />\n );\n};\n\nGoogleMapsRender.propTypes = {\n entityGroups: PropTypes.array,\n id: PropTypes.string,\n shapeConfigs: PropTypes.array,\n centerLatitude: PropTypes.number,\n centerLongitude: PropTypes.number,\n defaultZoom: PropTypes.number\n};\n\nGoogleMapsRender.defaultProps = {\n entityGroups: [],\n shapeConfigs: [],\n id: '',\n centerLatitude: null,\n centerLongitude: null,\n defaultZoom: null\n};\n\nexport default GoogleMapsRender;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,iBAAiB;AACtC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,SAAS,QAAQ,+BAA+B;AACzD,SAASC,YAAY,QAAQ,SAAS;AACtC,SAASC,UAAU,EAAEC,WAAW,EAAEC,oBAAoB,EAAEC,cAAc,QAAQ,WAAW;AACzF,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,MA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CAACqB,IAAK;IACrBL,iBAAiB,EAAEA,iBAAkB;IACrCP,SAAS,EAAEA,SAAU;IACrBG,SAAS,EAAEA;EAAU,GACjBZ,UAAU,CACf,CAAC;AAEN,CAAC;AAEDL,gBAAgB,CAAC2B,SAAS,GAAG;EAC3BxB,YAAY,EAAEf,SAAS,CAACwC,KAAK;EAC7BxB,EAAE,EAAEhB,SAAS,CAACyC,MAAM;EACpB3B,YAAY,EAAEd,SAAS,CAACwC,KAAK;EAC7BE,cAAc,EAAE1C,SAAS,CAAC2C,MAAM;EAChCC,eAAe,EAAE5C,SAAS,CAAC2C,MAAM;EACjCvB,WAAW,EAAEpB,SAAS,CAAC2C;AACzB,CAAC;AAED/B,gBAAgB,CAACiC,YAAY,GAAG;EAC9B9B,YAAY,EAAE,EAAE;EAChBD,YAAY,EAAE,EAAE;EAChBE,EAAE,EAAE,EAAE;EACN0B,cAAc,EAAE,IAAI;EACpBE,eAAe,EAAE,IAAI;EACrBxB,WAAW,EAAE;AACf,CAAC;AAED,eAAeR,gBAAgB","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ZOOM_CHANGED } from '../../constants';
|
|
2
|
-
import setShapes from './set-shapes';
|
|
3
|
-
const addZoomListener = (map, router, shapes, imageData, client) => {
|
|
4
|
-
if (!map) return;
|
|
5
|
-
setShapes(map, router, shapes, imageData);
|
|
6
|
-
map.addListener(ZOOM_CHANGED, () => setShapes(map, router, shapes, imageData, client));
|
|
7
|
-
};
|
|
8
|
-
export default addZoomListener;
|
|
9
|
-
//# sourceMappingURL=add-zoom-listener.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-zoom-listener.js","names":["ZOOM_CHANGED","setShapes","addZoomListener","map","router","shapes","imageData","client","addListener"],"sources":["../../../src/GoogleMaps/helpers/add-zoom-listener.js"],"sourcesContent":["import { ZOOM_CHANGED } from '../../constants';\nimport setShapes from './set-shapes';\n\nconst addZoomListener = (map, router, shapes, imageData, client) => {\n if (!map) return;\n setShapes(map, router, shapes, imageData);\n map.addListener(ZOOM_CHANGED, () => setShapes(map, router, shapes, imageData, client));\n};\n\nexport default addZoomListener;\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,eAAe,GAAGA,CAACC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,MAAM,KAAK;EAClE,IAAI,CAACJ,GAAG,EAAE;EACVF,SAAS,CAACE,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,SAAS,CAAC;EACzCH,GAAG,CAACK,WAAW,CAACR,YAAY,EAAE,MAAMC,SAAS,CAACE,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,MAAM,CAAC,CAAC;AACxF,CAAC;AAED,eAAeL,eAAe","ignoreList":[]}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
const getLatLonValues = (keys, data) => {
|
|
5
|
-
if (keys.length === 1) return data[keys];
|
|
6
|
-
const key = keys.shift();
|
|
7
|
-
return getLatLonValues(keys, data[key]);
|
|
8
|
-
};
|
|
9
|
-
const getLatLong = (latProp, lonProp, shape, data) => {
|
|
10
|
-
const {
|
|
11
|
-
latitude,
|
|
12
|
-
longitude
|
|
13
|
-
} = shape;
|
|
14
|
-
if (!latProp || !lonProp) return {
|
|
15
|
-
latitude,
|
|
16
|
-
longitude
|
|
17
|
-
};
|
|
18
|
-
const latKeys = latProp.split('.');
|
|
19
|
-
const lonKeys = lonProp.split('.');
|
|
20
|
-
const lat = getLatLonValues(latKeys, data);
|
|
21
|
-
const lon = getLatLonValues(lonKeys, data);
|
|
22
|
-
return {
|
|
23
|
-
latitude: lat,
|
|
24
|
-
longitude: lon
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const buildMapShapes = (shapesOptions, shapesData) => {
|
|
28
|
-
if (!shapesData) return [];
|
|
29
|
-
const mapShapes = [];
|
|
30
|
-
shapesOptions.forEach(shape => {
|
|
31
|
-
const {
|
|
32
|
-
shapeKey,
|
|
33
|
-
entityOptions,
|
|
34
|
-
shapeOptions
|
|
35
|
-
} = shape;
|
|
36
|
-
const {
|
|
37
|
-
dataSummaries,
|
|
38
|
-
enableInfoPane
|
|
39
|
-
} = entityOptions;
|
|
40
|
-
const shapeData = Array.isArray(shapesData[shapeKey]) ? shapesData[shapeKey] : shapesData[shapeKey].results;
|
|
41
|
-
if (!shapeData) return;
|
|
42
|
-
const {
|
|
43
|
-
latProp,
|
|
44
|
-
lonProp
|
|
45
|
-
} = entityOptions;
|
|
46
|
-
shapeData.forEach(data => {
|
|
47
|
-
const {
|
|
48
|
-
url
|
|
49
|
-
} = data;
|
|
50
|
-
const {
|
|
51
|
-
latitude,
|
|
52
|
-
longitude
|
|
53
|
-
} = getLatLong(latProp, lonProp, shapeOptions, data);
|
|
54
|
-
const formatedShape = _objectSpread(_objectSpread({}, shapeOptions), {}, {
|
|
55
|
-
latitude,
|
|
56
|
-
longitude,
|
|
57
|
-
dataSummaries,
|
|
58
|
-
enableInfoPane,
|
|
59
|
-
url,
|
|
60
|
-
shapeData: data
|
|
61
|
-
});
|
|
62
|
-
mapShapes.push(formatedShape);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
return mapShapes;
|
|
66
|
-
};
|
|
67
|
-
export default buildMapShapes;
|
|
68
|
-
//# sourceMappingURL=build-map-shapes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-map-shapes.js","names":["getLatLonValues","keys","data","length","key","shift","getLatLong","latProp","lonProp","shape","latitude","longitude","latKeys","split","lonKeys","lat","lon","buildMapShapes","shapesOptions","shapesData","mapShapes","forEach","shapeKey","entityOptions","shapeOptions","dataSummaries","enableInfoPane","shapeData","Array","isArray","results","url","formatedShape","_objectSpread","push"],"sources":["../../../src/GoogleMaps/helpers/build-map-shapes.js"],"sourcesContent":["const getLatLonValues = (keys, data) => {\n if (keys.length === 1) return data[keys];\n const key = keys.shift();\n return getLatLonValues(keys, data[key]);\n};\n\nconst getLatLong = (latProp, lonProp, shape, data) => {\n const { latitude, longitude } = shape;\n\n if (!latProp || !lonProp) return { latitude, longitude };\n const latKeys = latProp.split('.');\n const lonKeys = lonProp.split('.');\n const lat = getLatLonValues(latKeys, data);\n const lon = getLatLonValues(lonKeys, data);\n\n return { latitude: lat, longitude: lon };\n};\n\nconst buildMapShapes = (shapesOptions, shapesData) => {\n if (!shapesData) return [];\n const mapShapes = [];\n shapesOptions.forEach(shape => {\n const { shapeKey, entityOptions, shapeOptions } = shape;\n const { dataSummaries, enableInfoPane } = entityOptions;\n\n const shapeData = Array.isArray(shapesData[shapeKey])\n ? shapesData[shapeKey]\n : shapesData[shapeKey].results;\n if (!shapeData) return;\n const { latProp, lonProp } = entityOptions;\n\n shapeData.forEach(data => {\n const { url } = data;\n const { latitude, longitude } = getLatLong(latProp, lonProp, shapeOptions, data);\n\n const formatedShape = {\n ...shapeOptions,\n latitude,\n longitude,\n dataSummaries,\n enableInfoPane,\n url,\n shapeData: data\n };\n\n mapShapes.push(formatedShape);\n });\n });\n\n return mapShapes;\n};\n\nexport default buildMapShapes;\n"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AAQ,CAAC,CAAC,GACjDH,UAAU,CAACG,QAAQ,CAAC,GACpBH,UAAU,CAACG,QAAQ,CAAC,CAACQ,OAAO;IAChC,IAAI,CAACH,SAAS,EAAE;IAChB,MAAM;MAAEpB,OAAO;MAAEC;IAAQ,CAAC,GAAGe,aAAa;IAE1CI,SAAS,CAACN,OAAO,CAACnB,IAAI,IAAI;MACxB,MAAM;QAAE6B;MAAI,CAAC,GAAG7B,IAAI;MACpB,MAAM;QAAEQ,QAAQ;QAAEC;MAAU,CAAC,GAAGL,UAAU,CAACC,OAAO,EAAEC,OAAO,EAAEgB,YAAY,EAAEtB,IAAI,CAAC;MAEhF,MAAM8B,aAAa,GAAAC,aAAA,CAAAA,aAAA,KACdT,YAAY;QACfd,QAAQ;QACRC,SAAS;QACTc,aAAa;QACbC,cAAc;QACdK,GAAG;QACHJ,SAAS,EAAEzB;MAAI,EAChB;MAEDkB,SAAS,CAACc,IAAI,CAACF,aAAa,CAAC;IAC/B,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOZ,SAAS;AAClB,CAAC;AAED,eAAeH,cAAc","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ROADMAP, SATELLITE, TERRAIN } from '../../constants';
|
|
2
|
-
const buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {
|
|
3
|
-
const mapTypeIds = [ROADMAP];
|
|
4
|
-
if (enableSatelliteView) mapTypeIds.push(SATELLITE);
|
|
5
|
-
if (enableTerrainScreen) mapTypeIds.push(TERRAIN);
|
|
6
|
-
return mapTypeIds;
|
|
7
|
-
};
|
|
8
|
-
export default buildMapTypeIds;
|
|
9
|
-
//# sourceMappingURL=build-map-type-ids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-map-type-ids.js","names":["ROADMAP","SATELLITE","TERRAIN","buildMapTypeIds","enableSatelliteView","enableTerrainScreen","mapTypeIds","push"],"sources":["../../../src/GoogleMaps/helpers/build-map-type-ids.js"],"sourcesContent":["import { ROADMAP, SATELLITE, TERRAIN } from '../../constants';\n\nconst buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {\n const mapTypeIds = [ROADMAP];\n if (enableSatelliteView) mapTypeIds.push(SATELLITE);\n if (enableTerrainScreen) mapTypeIds.push(TERRAIN);\n return mapTypeIds;\n};\n\nexport default buildMapTypeIds;\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,SAAS,EAAEC,OAAO,QAAQ,iBAAiB;AAE7D,MAAMC,eAAe,GAAGA,CAACC,mBAAmB,EAAEC,mBAAmB,KAAK;EACpE,MAAMC,UAAU,GAAG,CAACN,OAAO,CAAC;EAC5B,IAAII,mBAAmB,EAAEE,UAAU,CAACC,IAAI,CAACN,SAAS,CAAC;EACnD,IAAII,mBAAmB,EAAEC,UAAU,CAACC,IAAI,CAACL,OAAO,CAAC;EACjD,OAAOI,UAAU;AACnB,CAAC;AAED,eAAeH,eAAe","ignoreList":[]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';
|
|
2
|
-
const buildQuery = entityConfigs => {
|
|
3
|
-
const entityIds = [];
|
|
4
|
-
const rawQueryStringified = '';
|
|
5
|
-
const queryString = entityConfigs.map(entityConfig => {
|
|
6
|
-
const {
|
|
7
|
-
action,
|
|
8
|
-
ids,
|
|
9
|
-
entity,
|
|
10
|
-
propsQuery,
|
|
11
|
-
shapeKey,
|
|
12
|
-
filtersObject
|
|
13
|
-
} = entityConfig;
|
|
14
|
-
if (!action) return '';
|
|
15
|
-
const formatedEntity = `${entity[0].toUpperCase()}${entity.slice(1)}`;
|
|
16
|
-
const filterQueryKey = action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;
|
|
17
|
-
entityIds.push(...ids);
|
|
18
|
-
const props = propsQuery.trim() || 'id';
|
|
19
|
-
const singleItemQuery = filtersObject ? generateFiltersQuery(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey) : generateIdsQuery(shapeKey, props, action, ids);
|
|
20
|
-
return singleItemQuery;
|
|
21
|
-
}).join(' ');
|
|
22
|
-
return {
|
|
23
|
-
query: queryString ? generateQuery(queryString) : '',
|
|
24
|
-
ids: entityIds,
|
|
25
|
-
rawQueryStringified
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export default buildQuery;
|
|
29
|
-
//# sourceMappingURL=build-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-query.js","names":["generateQuery","generateIdsQuery","generateFiltersQuery","buildQuery","entityConfigs","entityIds","rawQueryStringified","queryString","map","entityConfig","action","ids","entity","propsQuery","shapeKey","filtersObject","formatedEntity","toUpperCase","slice","filterQueryKey","indexOf","push","props","trim","singleItemQuery","JSON","stringify","join","query"],"sources":["../../../src/GoogleMaps/helpers/build-query.js"],"sourcesContent":["import { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';\n\nconst buildQuery = entityConfigs => {\n const entityIds = [];\n const rawQueryStringified = '';\n const queryString = entityConfigs\n .map(entityConfig => {\n const { action, ids, entity, propsQuery, shapeKey, filtersObject } = entityConfig;\n if (!action) return '';\n const formatedEntity = `${entity[0].toUpperCase()}${entity.slice(1)}`;\n const filterQueryKey =\n action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;\n\n entityIds.push(...ids);\n const props = propsQuery.trim() || 'id';\n const singleItemQuery = filtersObject\n ? generateFiltersQuery(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey)\n : generateIdsQuery(shapeKey, props, action, ids);\n\n return singleItemQuery;\n })\n .join(' ');\n\n return {\n query: queryString ? generateQuery(queryString) : '',\n ids: entityIds,\n rawQueryStringified\n };\n};\n\nexport default buildQuery;\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,gBAAgB,EAAEC,oBAAoB,QAAQ,YAAY;AAElF,MAAMC,UAAU,GAAGC,aAAa,IAAI;EAClC,MAAMC,SAAS,GAAG,EAAE;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