@blaze-cms/plugin-google-maps-fe 0.146.0-rc-eagle.0 → 0.146.0-rc-eagle-3.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 +5 -1
- package/lib/GoogleMaps/GoogleMaps.js +2 -1
- package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-shapes.js +2 -1
- package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMaps.js +122 -0
- package/lib-es/GoogleMaps/GoogleMaps.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsFactory.js +41 -0
- package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsHtml.js +16 -0
- package/lib-es/GoogleMaps/GoogleMapsHtml.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsRender.js +72 -0
- package/lib-es/GoogleMaps/GoogleMapsRender.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js +9 -0
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js +68 -0
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js +9 -0
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-query.js +31 -0
- package/lib-es/GoogleMaps/helpers/build-query.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +124 -0
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js +29 -0
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-image-ids.js +13 -0
- package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-path.js +13 -0
- package/lib-es/GoogleMaps/helpers/get-path.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/index.js +9 -0
- package/lib-es/GoogleMaps/helpers/index.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/set-map-options.js +69 -0
- package/lib-es/GoogleMaps/helpers/set-map-options.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/set-shapes.js +309 -0
- package/lib-es/GoogleMaps/helpers/set-shapes.js.map +1 -0
- package/lib-es/GoogleMaps/hooks/index.js +4 -0
- package/lib-es/GoogleMaps/hooks/index.js.map +1 -0
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js +20 -0
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -0
- package/lib-es/GoogleMaps/hooks/use-get-images.js +27 -0
- package/lib-es/GoogleMaps/hooks/use-get-images.js.map +1 -0
- package/lib-es/GoogleMaps/index.js +3 -0
- package/lib-es/GoogleMaps/index.js.map +1 -0
- package/lib-es/GoogleMaps/queries.js +47 -0
- package/lib-es/GoogleMaps/queries.js.map +1 -0
- package/lib-es/constants.js +90 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/index.js +17 -0
- package/lib-es/index.js.map +1 -0
- package/package.json +12 -8
- package/babel.config.js +0 -3
- package/jest.config.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.146.0-rc-eagle.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-rc-eagle.0) (2026-
|
|
6
|
+
# [0.146.0-rc-eagle-3.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-rc-eagle-3.0) (2026-07-13)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
@@ -12,7 +12,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
12
12
|
* fix map loading and info box loading ([#5115](https://github.com/thebyte9/blaze/issues/5115)) ([9dd27e6](https://github.com/thebyte9/blaze/commit/9dd27e6c0fbd1c04acfa4aeb39447cbf4825cc9e))
|
|
13
13
|
* fixed breaking tests, updated next to 14 ([fecb0e1](https://github.com/thebyte9/blaze/commit/fecb0e1d822bd69ebbaa084072a219f0fddd23f1))
|
|
14
14
|
* linting fixed automatically ([73135b9](https://github.com/thebyte9/blaze/commit/73135b9b8b0d5407e2e1dfba42ab2381f290607f))
|
|
15
|
+
* udpated yarn lock ([0cd4fa4](https://github.com/thebyte9/blaze/commit/0cd4fa4a185fca4b80b57e472badb771dd649ec2))
|
|
15
16
|
* updated jest dependences/setup ([6d6cba8](https://github.com/thebyte9/blaze/commit/6d6cba84b3c4ce4d4da7463098de19815a9fb7a6))
|
|
17
|
+
* updated with dev ([90f545f](https://github.com/thebyte9/blaze/commit/90f545f1beabb35e26ba6fb2b45a7a0dfd072927))
|
|
18
|
+
* updated with dev ([729bb6e](https://github.com/thebyte9/blaze/commit/729bb6ee7e87946081d51564a4ab45538f7be1e7))
|
|
19
|
+
* updated with latest ([21cde6f](https://github.com/thebyte9/blaze/commit/21cde6f157c9279ed1eccb326870547821bc3dde))
|
|
16
20
|
* wip ([a2b7b30](https://github.com/thebyte9/blaze/commit/a2b7b304f1871b372b3c8f105205ecc6e2ef8f01))
|
|
17
21
|
* wip ([48ea1ee](https://github.com/thebyte9/blaze/commit/48ea1ee2bff03b04bfeca7e1e2fe13bd7b316ad1))
|
|
18
22
|
|
|
@@ -17,7 +17,8 @@ var _helpers = require("./helpers");
|
|
|
17
17
|
var _constants = require("../constants");
|
|
18
18
|
var _GoogleMapsHtml = _interopRequireDefault(require("./GoogleMapsHtml"));
|
|
19
19
|
const _excluded = ["type", "name", "modifier", "elementTitle", "imageData", "onMount", "onMountProps", "parent", "mapShapes", "centerCoordinates"];
|
|
20
|
-
function
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
22
|
const shouldNotUpdate = (props, nextProps) => {
|
|
22
23
|
const [funcs, nextFuncs] = [(0, _lodash.functions)(props), (0, _lodash.functions)(nextProps)];
|
|
23
24
|
const noPropChange = (0, _lodash.isEqual)((0, _lodash.omit)(props, funcs), (0, _lodash.omit)(nextProps, nextFuncs));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMaps.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_router","_reactPageBuilder","_customHooks","_lodash","_helpers","_constants","_GoogleMapsHtml","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","shouldNotUpdate","props","nextProps","funcs","nextFuncs","functions","noPropChange","isEqual","omit","noFuncChange","length","every","fn","toString","GoogleMaps","_ref","type","name","modifier","elementTitle","imageData","onMount","onMountProps","parent","mapShapes","centerCoordinates","otherProps","_objectWithoutProperties2","router","useRouter","isIntersecting","mapRef","useInView","IN_VIEW_CONFIG","client","useApolloClient","map","setMap","useState","useEffect","options","setMapOptions","onLoad","initialMap","window","google","maps","Map","current","latitude","lat","longitude","lng","setCenter","bounds","LatLngBounds","forEach","extend","LatLng","fitBounds","script","document","createElement","SCRIPT","src","GOOGLE_MAPS_SCRIPT","process","env","GOOGLE_MAPS_API_KEY","head","append","addEventListener","LOAD","removeEventListener","setOptions","enableGeolocation","shouldActivateGeolocation","navigator","geolocation","getCurrentPosition","position","center","coords","addZoomListener","propTypes","PropTypes","array","string","func","object","defaultProps","_default","exports","React","memo","withTitle"],"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 useEffect(() => {\n if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);\n }, [isIntersecting, map, mapShapes, imageData, router, client]);\n\n if (map && typeof onMount === `function`) onMount(map, onMountProps);\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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAA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AAQ,EAAEmE,kBAAS,CAACE,MAAM;EAC1BpE,YAAY,EAAEkE,kBAAS,CAACE,MAAM;EAC9BlE,OAAO,EAAEgE,kBAAS,CAACG,IAAI;EACvBlE,YAAY,EAAE+D,kBAAS,CAACI,MAAM;EAC9BlE,MAAM,EAAE8D,kBAAS,CAACI,MAAM;EACxBhE,iBAAiB,EAAE4D,kBAAS,CAACC;AAC/B,CAAC;AAEDxE,UAAU,CAAC4E,YAAY,GAAG;EACxBlE,SAAS,EAAE,EAAE;EACbJ,SAAS,EAAE,EAAE;EACbK,iBAAiB,EAAE,EAAE;EACrBT,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,QAAQ,EAAE,EAAE;EACZC,YAAY,EAAE,EAAE;EAChBE,OAAO,EAAE,IAAI;EACbC,YAAY,EAAE,IAAI;EAClBC,MAAM,EAAE,CAAC;AACX,CAAC;AAAC,IAAAoE,QAAA,GAAAC,OAAA,CAAArG,OAAA,gBAEasG,cAAK,CAACC,IAAI,CAAC,IAAAC,2BAAS,EAACjF,UAAU,CAAC,EAAEd,eAAe,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"GoogleMaps.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_router","_reactPageBuilder","_customHooks","_lodash","_helpers","_constants","_GoogleMapsHtml","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","shouldNotUpdate","props","nextProps","funcs","nextFuncs","functions","noPropChange","isEqual","omit","noFuncChange","length","every","fn","toString","GoogleMaps","_ref","type","name","modifier","elementTitle","imageData","onMount","onMountProps","parent","mapShapes","centerCoordinates","otherProps","_objectWithoutProperties2","router","useRouter","isIntersecting","mapRef","useInView","IN_VIEW_CONFIG","client","useApolloClient","map","setMap","useState","useEffect","options","setMapOptions","onLoad","initialMap","window","google","maps","Map","current","latitude","lat","longitude","lng","setCenter","bounds","LatLngBounds","forEach","extend","LatLng","fitBounds","script","document","createElement","SCRIPT","src","GOOGLE_MAPS_SCRIPT","process","env","GOOGLE_MAPS_API_KEY","head","append","addEventListener","LOAD","removeEventListener","setOptions","enableGeolocation","shouldActivateGeolocation","navigator","geolocation","getCurrentPosition","position","center","coords","addZoomListener","propTypes","PropTypes","array","string","func","object","defaultProps","_default","exports","React","memo","withTitle"],"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 useEffect(() => {\n if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);\n }, [isIntersecting, map, mapShapes, imageData, router, client]);\n\n if (map && typeof onMount === `function`) onMount(map, onMountProps);\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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI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EAAEiE,kBAAS,CAACC,KAAK;EAC1BtE,IAAI,EAAEqE,kBAAS,CAACE,MAAM;EACtBtE,IAAI,EAAEoE,kBAAS,CAACE,MAAM;EACtBrE,QAAQ,EAAEmE,kBAAS,CAACE,MAAM;EAC1BpE,YAAY,EAAEkE,kBAAS,CAACE,MAAM;EAC9BlE,OAAO,EAAEgE,kBAAS,CAACG,IAAI;EACvBlE,YAAY,EAAE+D,kBAAS,CAACI,MAAM;EAC9BlE,MAAM,EAAE8D,kBAAS,CAACI,MAAM;EACxBhE,iBAAiB,EAAE4D,kBAAS,CAACC;AAC/B,CAAC;AAEDxE,UAAU,CAAC4E,YAAY,GAAG;EACxBlE,SAAS,EAAE,EAAE;EACbJ,SAAS,EAAE,EAAE;EACbK,iBAAiB,EAAE,EAAE;EACrBT,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,QAAQ,EAAE,EAAE;EACZC,YAAY,EAAE,EAAE;EAChBE,OAAO,EAAE,IAAI;EACbC,YAAY,EAAE,IAAI;EAClBC,MAAM,EAAE,CAAC;AACX,CAAC;AAAC,IAAAoE,QAAA,GAAAC,OAAA,CAAA1G,OAAA,gBAEa2G,cAAK,CAACC,IAAI,CAAC,IAAAC,2BAAS,EAACjF,UAAU,CAAC,EAAEd,eAAe,CAAC","ignoreList":[]}
|
|
@@ -16,7 +16,8 @@ var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
|
16
16
|
var _getPath = _interopRequireDefault(require("./get-path"));
|
|
17
17
|
var _constants = require("../../constants");
|
|
18
18
|
const _excluded = ["elementTitle", "type", "propsToDisplay"];
|
|
19
|
-
function
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
21
|
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; }
|
|
21
22
|
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) { (0, _defineProperty2.default)(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; }
|
|
22
23
|
const shapesArray = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-shapes.js","names":["_react","_interopRequireDefault","require","_lodash","ReactDOMServer","_interopRequireWildcard","_nextjsComponents","_client","_reactPageBuilder","_getPath","_constants","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","shapesArray","infoWindowArray","clearShapes","shape","setMap","closeInfoWindows","infoWindow","close","addShapeListeners","map","router","imageData","shapeInstance","client","enableInfoPane","dataSummaries","url","shapeData","window","google","maps","InfoWindow","content","addListener","CLICK","event","renderToString","infoWindowContent","setContent","setPosition","latLng","open","setStyleOptions","strokeColor","strokeOpacity","strokeWeight","fillColor","fillOpacity","styleSettings","reduce","acc","key","settingValue","shouldValueBeNumber","includes","COLOR","hasValuePassedCondition","isNumber","areRectangleBoundsNumbers","bounds","every","bound","isPositionCorrect","lat","lng","getIconUrl","imageId","image","find","id","summariesWithContent","Promise","all","dataSummary","elementTitle","type","propsToDisplay","otherProps","_objectWithoutProperties2","isTypeHeading","HEADING_LARGE","summaryPropsWithContent","buildPropsToDisplayWithContent","modifier","getClassModifiers","LIST","SummaryComponent","summaryComponents","render","preload","getDataSummaryComponent","component","createElement","ApolloProvider","Link","href","shouldShowImage","getImageElement","imageUrl","data","imageElement","className","src","alt","altText","Fragment","getIcon","markerWidth","markerHeight","svgPath","iconUrl","icon","scaledSize","Size","svgMarker","path","DEFAULT_CUSTOM_MARKER_PATH","rotation","scale","setMarker","label","latitude","longitude","marker","Marker","position","title","setPolyline","paths","getPath","polyline","Polyline","geodesic","setPolygon","unParsedPaths","polygon","Polygon","setRectangle","northBound","southBound","eastBound","westBound","rectangle","Rectangle","north","south","east","west","setCircle","radius","circle","Circle","center","setShapes","shapes","mapZoom","getZoom","minZoom","maxZoom","MARKER","POLYLINE","POLYGON","RECTANGLE","CIRCLE","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/set-shapes.js"],"sourcesContent":["import React from 'react';\nimport isNumber from 'lodash.isnumber';\nimport * as ReactDOMServer from 'react-dom/server';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { ApolloProvider } from '@apollo/client';\nimport {\n buildPropsToDisplayWithContent,\n summaryComponents,\n getClassModifiers\n} from '@blaze-cms/react-page-builder';\nimport getPath from './get-path';\nimport {\n MARKER,\n POLYLINE,\n POLYGON,\n RECTANGLE,\n CIRCLE,\n COLOR,\n CLICK,\n HEADING_LARGE,\n LIST,\n DEFAULT_CUSTOM_MARKER_PATH\n} from '../../constants';\n\nconst shapesArray = [];\nconst infoWindowArray = [];\n\nconst clearShapes = () => {\n if (shapesArray.length) {\n shapesArray.forEach(shape => shape.setMap(null));\n shapesArray.length = 0;\n }\n};\n\nconst closeInfoWindows = () => {\n if (infoWindowArray.length) {\n infoWindowArray.forEach(infoWindow => infoWindow.close());\n infoWindowArray.length = 0;\n }\n};\n\nconst addShapeListeners = (map, router, shape, imageData, shapeInstance, client) => {\n const { enableInfoPane = false, dataSummaries = [], url, shapeData } = shape;\n\n if (enableInfoPane) {\n const infoWindow = new window.google.maps.InfoWindow({\n content: ''\n });\n\n shapeInstance.addListener(CLICK, async event => {\n closeInfoWindows();\n const content = ReactDOMServer.renderToString(\n await infoWindowContent(imageData, dataSummaries, url, shapeData, client)\n );\n infoWindow.setContent(content);\n infoWindow.setPosition(event.latLng);\n infoWindow.open(map, shapeInstance);\n infoWindowArray.push(infoWindow);\n });\n } else if (url) {\n shapeInstance.addListener(CLICK, () => {\n router.push(url);\n });\n }\n};\n\nconst setStyleOptions = shape => {\n const { strokeColor, strokeOpacity, strokeWeight, fillColor, fillOpacity } = shape;\n const styleSettings = { strokeColor, fillColor, strokeOpacity, strokeWeight, fillOpacity };\n\n return {\n ...Object.keys(styleSettings).reduce((acc, key) => {\n const settingValue = styleSettings[key];\n const shouldValueBeNumber = !key.includes(COLOR);\n const hasValuePassedCondition = shouldValueBeNumber ? isNumber(settingValue) : settingValue;\n if (hasValuePassedCondition) acc[key] = settingValue;\n return acc;\n }, {})\n };\n};\n\nconst areRectangleBoundsNumbers = bounds => bounds.every(bound => isNumber(bound));\n\nconst isPositionCorrect = (lat, lng) => isNumber(lat) && isNumber(lng);\n\nconst getIconUrl = (imageId, imageData) => {\n if (!imageId) return '';\n const image = imageData.find(({ id }) => id === imageId);\n if (!image || !image.url) return '';\n\n return image.url;\n};\n\nconst infoWindowContent = async (imageData, dataSummaries, url, shapeData, client) => {\n const summariesWithContent = await Promise.all(\n dataSummaries.map(async dataSummary => {\n const { elementTitle, type, propsToDisplay, ...otherProps } = dataSummary;\n const isTypeHeading = type === HEADING_LARGE;\n const summaryPropsWithContent = buildPropsToDisplayWithContent(shapeData, propsToDisplay);\n const modifier = getClassModifiers(LIST, otherProps);\n const SummaryComponent = summaryComponents[type];\n await SummaryComponent.render.preload(); // preload dynamic nextjs component\n\n if (!summaryPropsWithContent.length) return null;\n\n const getDataSummaryComponent = () => {\n const component = (\n <ApolloProvider client={client}>\n <SummaryComponent\n key={type}\n modifier={modifier}\n elementTitle={elementTitle}\n summaryPropsWithContent={summaryPropsWithContent}\n />\n </ApolloProvider>\n );\n\n if (isTypeHeading && url) return <Link href={url}>{component}</Link>;\n\n return component;\n };\n\n return getDataSummaryComponent();\n })\n );\n const { imageId } = shapeData || {};\n const image = imageData.find(({ id }) => id === imageId);\n const shouldShowImage = image && image.url;\n\n const getImageElement = () => {\n const { url: imageUrl, data } = image;\n const imageElement = (\n <img className=\"info__window\" src={imageUrl} alt={data && data.altText ? data.altText : ''} />\n );\n\n if (url) return <Link href={url}>{imageElement}</Link>;\n\n return imageElement;\n };\n\n return (\n <>\n {shouldShowImage && getImageElement()}\n {summariesWithContent}\n </>\n );\n};\n\nfunction getIcon(imageData, shape) {\n const {\n imageId,\n markerWidth = 50,\n markerHeight = 50,\n strokeColor,\n strokeOpacity,\n strokeWeight,\n fillColor,\n fillOpacity,\n svgPath\n } = shape;\n const iconUrl = getIconUrl(imageId, imageData);\n\n const icon = iconUrl\n ? {\n url: iconUrl,\n scaledSize: new window.google.maps.Size(markerWidth || 50, markerHeight || 50)\n }\n : null;\n\n if (icon) return icon;\n\n if (!svgPath && !fillColor && !strokeColor) return {}; // any can be true for custom marker\n\n const svgMarker = {\n path: svgPath || DEFAULT_CUSTOM_MARKER_PATH,\n strokeColor,\n strokeOpacity,\n strokeWeight,\n fillColor,\n fillOpacity,\n rotation: 0,\n scale: 2\n };\n return svgMarker;\n}\n\nconst setMarker = (map, router, shape, imageData, client) => {\n const { label = '', latitude, longitude } = shape;\n\n if (isPositionCorrect(latitude, longitude)) {\n const svgMarker = getIcon(imageData, shape);\n\n const marker = new window.google.maps.Marker({\n position: { lat: latitude, lng: longitude },\n map,\n icon: svgMarker,\n title: label || ''\n });\n\n addShapeListeners(map, router, shape, imageData, marker, client);\n\n shapesArray.push(marker);\n\n marker.setMap(map);\n }\n};\n\nconst setPolyline = (map, router, shape, imageData) => {\n const { paths } = shape;\n const path = getPath(paths);\n\n if (path.length) {\n const polyline = new window.google.maps.Polyline({\n path,\n geodesic: true,\n ...setStyleOptions(shape)\n });\n\n addShapeListeners(map, router, shape, imageData, polyline);\n\n shapesArray.push(polyline);\n\n polyline.setMap(map);\n }\n};\n\nconst setPolygon = (map, router, shape, imageData) => {\n const { paths: unParsedPaths } = shape;\n const paths = getPath(unParsedPaths);\n\n if (paths.length) {\n const polygon = new window.google.maps.Polygon({\n paths,\n ...setStyleOptions(shape)\n });\n\n addShapeListeners(map, router, shape, imageData, polygon);\n\n shapesArray.push(polygon);\n\n polygon.setMap(map);\n }\n};\n\nconst setRectangle = (map, router, shape, imageData) => {\n const { northBound, southBound, eastBound, westBound } = shape;\n if (areRectangleBoundsNumbers([northBound, southBound, eastBound, westBound])) {\n const rectangle = new window.google.maps.Rectangle({\n ...setStyleOptions(shape),\n map,\n bounds: {\n north: northBound,\n south: southBound,\n east: eastBound,\n west: westBound\n }\n });\n\n addShapeListeners(map, router, shape, imageData, rectangle);\n\n shapesArray.push(rectangle);\n\n rectangle.setMap(map);\n }\n};\n\nconst setCircle = (map, router, shape, imageData) => {\n const { latitude, longitude, radius } = shape;\n if (isPositionCorrect(latitude, longitude) && isNumber(radius)) {\n const circle = new window.google.maps.Circle({\n ...setStyleOptions(shape),\n map,\n center: { lat: latitude, lng: longitude },\n radius\n });\n\n addShapeListeners(map, router, shape, imageData, circle);\n\n shapesArray.push(circle);\n\n circle.setMap(map);\n }\n};\n\nconst setShapes = (map, router, shapes, imageData, client) => {\n const mapZoom = map.getZoom();\n clearShapes();\n\n shapes.forEach(shape => {\n const { type, minZoom, maxZoom } = shape;\n\n if (mapZoom >= minZoom && mapZoom <= maxZoom) {\n switch (type) {\n case MARKER: {\n setMarker(map, router, shape, imageData, client);\n break;\n }\n case POLYLINE: {\n setPolyline(map, router, shape, imageData);\n break;\n }\n case POLYGON: {\n setPolygon(map, router, shape, imageData);\n break;\n }\n case RECTANGLE: {\n setRectangle(map, router, shape, imageData);\n break;\n }\n case CIRCLE: {\n setCircle(map, router, shape, imageData);\n break;\n }\n default:\n break;\n }\n }\n });\n};\n\nexport default setShapes;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAWyB,MAAAS,SAAA;AAAA,SAAAN,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,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,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AK;IAExC,IAAI8I,OAAO,IAAIE,OAAO,IAAIF,OAAO,IAAIG,OAAO,EAAE;MAC5C,QAAQnF,IAAI;QACV,KAAKoF,iBAAM;UAAE;YACXxC,SAAS,CAACpG,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,EAAEE,MAAM,CAAC;YAChD;UACF;QACA,KAAKyI,mBAAQ;UAAE;YACbjC,WAAW,CAAC5G,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YAC1C;UACF;QACA,KAAK4I,kBAAO;UAAE;YACZ5B,UAAU,CAAClH,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YACzC;UACF;QACA,KAAK6I,oBAAS;UAAE;YACdzB,YAAY,CAACtH,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YAC3C;UACF;QACA,KAAK8I,iBAAM;UAAE;YACXf,SAAS,CAACjI,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YACxC;UACF;QACA;UACE;MACJ;IACF;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAA+I,QAAA,GAAAC,OAAA,CAAAlL,OAAA,GAEasK,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"set-shapes.js","names":["_react","_interopRequireDefault","require","_lodash","ReactDOMServer","_interopRequireWildcard","_nextjsComponents","_client","_reactPageBuilder","_getPath","_constants","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","shapesArray","infoWindowArray","clearShapes","shape","setMap","closeInfoWindows","infoWindow","close","addShapeListeners","map","router","imageData","shapeInstance","client","enableInfoPane","dataSummaries","url","shapeData","window","google","maps","InfoWindow","content","addListener","CLICK","event","renderToString","infoWindowContent","setContent","setPosition","latLng","open","setStyleOptions","strokeColor","strokeOpacity","strokeWeight","fillColor","fillOpacity","styleSettings","reduce","acc","key","settingValue","shouldValueBeNumber","includes","COLOR","hasValuePassedCondition","isNumber","areRectangleBoundsNumbers","bounds","every","bound","isPositionCorrect","lat","lng","getIconUrl","imageId","image","find","id","summariesWithContent","Promise","all","dataSummary","elementTitle","type","propsToDisplay","otherProps","_objectWithoutProperties2","isTypeHeading","HEADING_LARGE","summaryPropsWithContent","buildPropsToDisplayWithContent","modifier","getClassModifiers","LIST","SummaryComponent","summaryComponents","render","preload","getDataSummaryComponent","component","createElement","ApolloProvider","Link","href","shouldShowImage","getImageElement","imageUrl","data","imageElement","className","src","alt","altText","Fragment","getIcon","markerWidth","markerHeight","svgPath","iconUrl","icon","scaledSize","Size","svgMarker","path","DEFAULT_CUSTOM_MARKER_PATH","rotation","scale","setMarker","label","latitude","longitude","marker","Marker","position","title","setPolyline","paths","getPath","polyline","Polyline","geodesic","setPolygon","unParsedPaths","polygon","Polygon","setRectangle","northBound","southBound","eastBound","westBound","rectangle","Rectangle","north","south","east","west","setCircle","radius","circle","Circle","center","setShapes","shapes","mapZoom","getZoom","minZoom","maxZoom","MARKER","POLYLINE","POLYGON","RECTANGLE","CIRCLE","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/set-shapes.js"],"sourcesContent":["import React from 'react';\nimport isNumber from 'lodash.isnumber';\nimport * as ReactDOMServer from 'react-dom/server';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { ApolloProvider } from '@apollo/client';\nimport {\n buildPropsToDisplayWithContent,\n summaryComponents,\n getClassModifiers\n} from '@blaze-cms/react-page-builder';\nimport getPath from './get-path';\nimport {\n MARKER,\n POLYLINE,\n POLYGON,\n RECTANGLE,\n CIRCLE,\n COLOR,\n CLICK,\n HEADING_LARGE,\n LIST,\n DEFAULT_CUSTOM_MARKER_PATH\n} from '../../constants';\n\nconst shapesArray = [];\nconst infoWindowArray = [];\n\nconst clearShapes = () => {\n if (shapesArray.length) {\n shapesArray.forEach(shape => shape.setMap(null));\n shapesArray.length = 0;\n }\n};\n\nconst closeInfoWindows = () => {\n if (infoWindowArray.length) {\n infoWindowArray.forEach(infoWindow => infoWindow.close());\n infoWindowArray.length = 0;\n }\n};\n\nconst addShapeListeners = (map, router, shape, imageData, shapeInstance, client) => {\n const { enableInfoPane = false, dataSummaries = [], url, shapeData } = shape;\n\n if (enableInfoPane) {\n const infoWindow = new window.google.maps.InfoWindow({\n content: ''\n });\n\n shapeInstance.addListener(CLICK, async event => {\n closeInfoWindows();\n const content = ReactDOMServer.renderToString(\n await infoWindowContent(imageData, dataSummaries, url, shapeData, client)\n );\n infoWindow.setContent(content);\n infoWindow.setPosition(event.latLng);\n infoWindow.open(map, shapeInstance);\n infoWindowArray.push(infoWindow);\n });\n } else if (url) {\n shapeInstance.addListener(CLICK, () => {\n router.push(url);\n });\n }\n};\n\nconst setStyleOptions = shape => {\n const { strokeColor, strokeOpacity, strokeWeight, fillColor, fillOpacity } = shape;\n const styleSettings = { strokeColor, fillColor, strokeOpacity, strokeWeight, fillOpacity };\n\n return {\n ...Object.keys(styleSettings).reduce((acc, key) => {\n const settingValue = styleSettings[key];\n const shouldValueBeNumber = !key.includes(COLOR);\n const hasValuePassedCondition = shouldValueBeNumber ? isNumber(settingValue) : settingValue;\n if (hasValuePassedCondition) acc[key] = settingValue;\n return acc;\n }, {})\n };\n};\n\nconst areRectangleBoundsNumbers = bounds => bounds.every(bound => isNumber(bound));\n\nconst isPositionCorrect = (lat, lng) => isNumber(lat) && isNumber(lng);\n\nconst getIconUrl = (imageId, imageData) => {\n if (!imageId) return '';\n const image = imageData.find(({ id }) => id === imageId);\n if (!image || !image.url) return '';\n\n return image.url;\n};\n\nconst infoWindowContent = async (imageData, dataSummaries, url, shapeData, client) => {\n const summariesWithContent = await Promise.all(\n dataSummaries.map(async dataSummary => {\n const { elementTitle, type, propsToDisplay, ...otherProps } = dataSummary;\n const isTypeHeading = type === HEADING_LARGE;\n const summaryPropsWithContent = buildPropsToDisplayWithContent(shapeData, propsToDisplay);\n const modifier = getClassModifiers(LIST, otherProps);\n const SummaryComponent = summaryComponents[type];\n await SummaryComponent.render.preload(); // preload dynamic nextjs component\n\n if (!summaryPropsWithContent.length) return null;\n\n const getDataSummaryComponent = () => {\n const component = (\n <ApolloProvider client={client}>\n <SummaryComponent\n key={type}\n modifier={modifier}\n elementTitle={elementTitle}\n summaryPropsWithContent={summaryPropsWithContent}\n />\n </ApolloProvider>\n );\n\n if (isTypeHeading && url) return <Link href={url}>{component}</Link>;\n\n return component;\n };\n\n return getDataSummaryComponent();\n })\n );\n const { imageId } = shapeData || {};\n const image = imageData.find(({ id }) => id === imageId);\n const shouldShowImage = image && image.url;\n\n const getImageElement = () => {\n const { url: imageUrl, data } = image;\n const imageElement = (\n <img className=\"info__window\" src={imageUrl} alt={data && data.altText ? data.altText : ''} />\n );\n\n if (url) return <Link href={url}>{imageElement}</Link>;\n\n return imageElement;\n };\n\n return (\n <>\n {shouldShowImage && getImageElement()}\n {summariesWithContent}\n </>\n );\n};\n\nfunction getIcon(imageData, shape) {\n const {\n imageId,\n markerWidth = 50,\n markerHeight = 50,\n strokeColor,\n strokeOpacity,\n strokeWeight,\n fillColor,\n fillOpacity,\n svgPath\n } = shape;\n const iconUrl = getIconUrl(imageId, imageData);\n\n const icon = iconUrl\n ? {\n url: iconUrl,\n scaledSize: new window.google.maps.Size(markerWidth || 50, markerHeight || 50)\n }\n : null;\n\n if (icon) return icon;\n\n if (!svgPath && !fillColor && !strokeColor) return {}; // any can be true for custom marker\n\n const svgMarker = {\n path: svgPath || DEFAULT_CUSTOM_MARKER_PATH,\n strokeColor,\n strokeOpacity,\n strokeWeight,\n fillColor,\n fillOpacity,\n rotation: 0,\n scale: 2\n };\n return svgMarker;\n}\n\nconst setMarker = (map, router, shape, imageData, client) => {\n const { label = '', latitude, longitude } = shape;\n\n if (isPositionCorrect(latitude, longitude)) {\n const svgMarker = getIcon(imageData, shape);\n\n const marker = new window.google.maps.Marker({\n position: { lat: latitude, lng: longitude },\n map,\n icon: svgMarker,\n title: label || ''\n });\n\n addShapeListeners(map, router, shape, imageData, marker, client);\n\n shapesArray.push(marker);\n\n marker.setMap(map);\n }\n};\n\nconst setPolyline = (map, router, shape, imageData) => {\n const { paths } = shape;\n const path = getPath(paths);\n\n if (path.length) {\n const polyline = new window.google.maps.Polyline({\n path,\n geodesic: true,\n ...setStyleOptions(shape)\n });\n\n addShapeListeners(map, router, shape, imageData, polyline);\n\n shapesArray.push(polyline);\n\n polyline.setMap(map);\n }\n};\n\nconst setPolygon = (map, router, shape, imageData) => {\n const { paths: unParsedPaths } = shape;\n const paths = getPath(unParsedPaths);\n\n if (paths.length) {\n const polygon = new window.google.maps.Polygon({\n paths,\n ...setStyleOptions(shape)\n });\n\n addShapeListeners(map, router, shape, imageData, polygon);\n\n shapesArray.push(polygon);\n\n polygon.setMap(map);\n }\n};\n\nconst setRectangle = (map, router, shape, imageData) => {\n const { northBound, southBound, eastBound, westBound } = shape;\n if (areRectangleBoundsNumbers([northBound, southBound, eastBound, westBound])) {\n const rectangle = new window.google.maps.Rectangle({\n ...setStyleOptions(shape),\n map,\n bounds: {\n north: northBound,\n south: southBound,\n east: eastBound,\n west: westBound\n }\n });\n\n addShapeListeners(map, router, shape, imageData, rectangle);\n\n shapesArray.push(rectangle);\n\n rectangle.setMap(map);\n }\n};\n\nconst setCircle = (map, router, shape, imageData) => {\n const { latitude, longitude, radius } = shape;\n if (isPositionCorrect(latitude, longitude) && isNumber(radius)) {\n const circle = new window.google.maps.Circle({\n ...setStyleOptions(shape),\n map,\n center: { lat: latitude, lng: longitude },\n radius\n });\n\n addShapeListeners(map, router, shape, imageData, circle);\n\n shapesArray.push(circle);\n\n circle.setMap(map);\n }\n};\n\nconst setShapes = (map, router, shapes, imageData, client) => {\n const mapZoom = map.getZoom();\n clearShapes();\n\n shapes.forEach(shape => {\n const { type, minZoom, maxZoom } = shape;\n\n if (mapZoom >= minZoom && mapZoom <= maxZoom) {\n switch (type) {\n case MARKER: {\n setMarker(map, router, shape, imageData, client);\n break;\n }\n case POLYLINE: {\n setPolyline(map, router, shape, imageData);\n break;\n }\n case POLYGON: {\n setPolygon(map, router, shape, imageData);\n break;\n }\n case RECTANGLE: {\n setRectangle(map, router, shape, imageData);\n break;\n }\n case CIRCLE: {\n setCircle(map, router, shape, imageData);\n break;\n }\n default:\n break;\n }\n }\n });\n};\n\nexport default setShapes;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAWyB,MAAAS,SAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MA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;EAC5D,MAAMoI,OAAO,GAAGxI,GAAG,CAACyI,OAAO,CAAC,CAAC;EAC7BhJ,WAAW,CAAC,CAAC;EAEb8I,MAAM,CAACpJ,OAAO,CAACO,KAAK,IAAI;IACtB,MAAM;MAAE8D,IAAI;MAAEkF,OAAO;MAAEC;IAAQ,CAAC,GAAGjJ,KAAK;IAExC,IAAI8I,OAAO,IAAIE,OAAO,IAAIF,OAAO,IAAIG,OAAO,EAAE;MAC5C,QAAQnF,IAAI;QACV,KAAKoF,iBAAM;UAAE;YACXxC,SAAS,CAACpG,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,EAAEE,MAAM,CAAC;YAChD;UACF;QACA,KAAKyI,mBAAQ;UAAE;YACbjC,WAAW,CAAC5G,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YAC1C;UACF;QACA,KAAK4I,kBAAO;UAAE;YACZ5B,UAAU,CAAClH,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YACzC;UACF;QACA,KAAK6I,oBAAS;UAAE;YACdzB,YAAY,CAACtH,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YAC3C;UACF;QACA,KAAK8I,iBAAM;UAAE;YACXf,SAAS,CAACjI,GAAG,EAAEC,MAAM,EAAEP,KAAK,EAAEQ,SAAS,CAAC;YACxC;UACF;QACA;UACE;MACJ;IACF;EACF,CAAC,CAAC;AACJ,CAAC;AAAC,IAAA+I,QAAA,GAAAC,OAAA,CAAAxL,OAAA,GAEa4K,SAAS","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -8,7 +8,8 @@ exports.default = load;
|
|
|
8
8
|
var _dynamic = _interopRequireDefault(require("next/dynamic"));
|
|
9
9
|
var _package = _interopRequireDefault(require("../package.json"));
|
|
10
10
|
var _constants = require("./constants");
|
|
11
|
-
function
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
13
|
async function load(app) {
|
|
13
14
|
app.events.once('load:custom:page-builder:component', addComponent => {
|
|
14
15
|
addComponent({
|
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","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","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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AAY,CAAC;MACXC,GAAG,EAAE,YAAY;MACjBC,SAAS,EAAE,IAAAC,gBAAO,EAAC,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAA1B,uBAAA,CAAAR,OAAA,CAAyD,cAAc,GAAC;IAC7F,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLmC,IAAI,EAAEC,sBAAW;IACjBC,OAAO,EAAEC,gBAAG,CAACD;EACf,CAAC;AACH;AAEAb,IAAI,CAACe,UAAU,GAAGH,sBAAW","ignoreList":[]}
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
useEffect(() => {
|
|
90
|
+
if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);
|
|
91
|
+
}, [isIntersecting, map, mapShapes, imageData, router, client]);
|
|
92
|
+
if (map && typeof onMount === `function`) onMount(map, onMountProps);
|
|
93
|
+
return /*#__PURE__*/React.createElement(GoogleMapsHtml, {
|
|
94
|
+
mapRef: mapRef
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
GoogleMaps.propTypes = {
|
|
98
|
+
mapShapes: PropTypes.array,
|
|
99
|
+
imageData: PropTypes.array,
|
|
100
|
+
type: PropTypes.string,
|
|
101
|
+
name: PropTypes.string,
|
|
102
|
+
modifier: PropTypes.string,
|
|
103
|
+
elementTitle: PropTypes.string,
|
|
104
|
+
onMount: PropTypes.func,
|
|
105
|
+
onMountProps: PropTypes.object,
|
|
106
|
+
parent: PropTypes.object,
|
|
107
|
+
centerCoordinates: PropTypes.array
|
|
108
|
+
};
|
|
109
|
+
GoogleMaps.defaultProps = {
|
|
110
|
+
mapShapes: [],
|
|
111
|
+
imageData: [],
|
|
112
|
+
centerCoordinates: [],
|
|
113
|
+
type: '',
|
|
114
|
+
name: '',
|
|
115
|
+
modifier: '',
|
|
116
|
+
elementTitle: '',
|
|
117
|
+
onMount: null,
|
|
118
|
+
onMountProps: null,
|
|
119
|
+
parent: {}
|
|
120
|
+
};
|
|
121
|
+
export default React.memo(withTitle(GoogleMaps), shouldNotUpdate);
|
|
122
|
+
//# sourceMappingURL=GoogleMaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 useEffect(() => {\n if (isIntersecting) addZoomListener(map, router, mapShapes, imageData, client);\n }, [isIntersecting, map, mapShapes, imageData, router, client]);\n\n if (map && typeof onMount === `function`) onMount(map, onMountProps);\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,CAAC;EAC5E,MAAME,YAAY,GAChBH,KAAK,CAACI,MAAM,KAAKH,SAAS,CAACG,MAAM,IACjCJ,KAAK,CAACK,KAAK,CA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C,YAAY,EAAE,IAAI;EAClBC,MAAM,EAAE,CAAC;AACX,CAAC;AAED,eAAetC,KAAK,CAAC+F,IAAI,CAACzF,SAAS,CAACuB,UAAU,CAAC,EAAEX,eAAe,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,cAA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IACTC,GAAG,EAAEpB,UAAU,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":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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, client);
|
|
6
|
+
map.addListener(ZOOM_CHANGED, () => setShapes(map, router, shapes, imageData, client));
|
|
7
|
+
};
|
|
8
|
+
export default addZoomListener;
|
|
9
|
+
//# sourceMappingURL=add-zoom-listener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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, client);\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,EAAEC,MAAM,CAAC;EACjDJ,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":[]}
|