@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.
Files changed (93) hide show
  1. package/CHANGELOG.md +3 -5
  2. package/lib/GoogleMaps/GoogleMaps.js +67 -90
  3. package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
  4. package/lib/GoogleMaps/GoogleMapsFactory.js +21 -22
  5. package/lib/GoogleMaps/GoogleMapsFactory.js.map +1 -1
  6. package/lib/GoogleMaps/GoogleMapsHtml.js +9 -11
  7. package/lib/GoogleMaps/GoogleMapsHtml.js.map +1 -1
  8. package/lib/GoogleMaps/GoogleMapsRender.js +43 -37
  9. package/lib/GoogleMaps/GoogleMapsRender.js.map +1 -1
  10. package/lib/GoogleMaps/helpers/add-zoom-listener.js +5 -8
  11. package/lib/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
  12. package/lib/GoogleMaps/helpers/build-map-shapes.js +48 -48
  13. package/lib/GoogleMaps/helpers/build-map-shapes.js.map +1 -1
  14. package/lib/GoogleMaps/helpers/build-map-type-ids.js +4 -5
  15. package/lib/GoogleMaps/helpers/build-map-type-ids.js.map +1 -1
  16. package/lib/GoogleMaps/helpers/build-query.js +22 -28
  17. package/lib/GoogleMaps/helpers/build-query.js.map +1 -1
  18. package/lib/GoogleMaps/helpers/build-shapes-configs.js +84 -111
  19. package/lib/GoogleMaps/helpers/build-shapes-configs.js.map +1 -1
  20. package/lib/GoogleMaps/helpers/get-center-coordinates.js +20 -23
  21. package/lib/GoogleMaps/helpers/get-center-coordinates.js.map +1 -1
  22. package/lib/GoogleMaps/helpers/get-image-ids.js +9 -18
  23. package/lib/GoogleMaps/helpers/get-image-ids.js.map +1 -1
  24. package/lib/GoogleMaps/helpers/get-path.js +13 -16
  25. package/lib/GoogleMaps/helpers/get-path.js.map +1 -1
  26. package/lib/GoogleMaps/helpers/index.js +14 -15
  27. package/lib/GoogleMaps/helpers/index.js.map +1 -1
  28. package/lib/GoogleMaps/helpers/set-map-options.js +41 -44
  29. package/lib/GoogleMaps/helpers/set-map-options.js.map +1 -1
  30. package/lib/GoogleMaps/helpers/set-shapes.js +174 -245
  31. package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
  32. package/lib/GoogleMaps/hooks/index.js +4 -5
  33. package/lib/GoogleMaps/hooks/index.js.map +1 -1
  34. package/lib/GoogleMaps/hooks/use-get-entity-schemas.js +14 -20
  35. package/lib/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -1
  36. package/lib/GoogleMaps/hooks/use-get-images.js +21 -22
  37. package/lib/GoogleMaps/hooks/use-get-images.js.map +1 -1
  38. package/lib/GoogleMaps/index.js +2 -3
  39. package/lib/GoogleMaps/index.js.map +1 -1
  40. package/lib/GoogleMaps/queries.js +49 -22
  41. package/lib/GoogleMaps/queries.js.map +1 -1
  42. package/lib/constants.js +35 -36
  43. package/lib/constants.js.map +1 -1
  44. package/lib/index.js +13 -43
  45. package/lib/index.js.map +1 -1
  46. package/package.json +10 -9
  47. package/src/GoogleMaps/GoogleMaps.js +4 -1
  48. package/src/GoogleMaps/helpers/add-zoom-listener.js +1 -1
  49. package/src/GoogleMaps/helpers/build-query.js +3 -1
  50. package/lib-es/GoogleMaps/GoogleMaps.js +0 -120
  51. package/lib-es/GoogleMaps/GoogleMaps.js.map +0 -1
  52. package/lib-es/GoogleMaps/GoogleMapsFactory.js +0 -41
  53. package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +0 -1
  54. package/lib-es/GoogleMaps/GoogleMapsHtml.js +0 -16
  55. package/lib-es/GoogleMaps/GoogleMapsHtml.js.map +0 -1
  56. package/lib-es/GoogleMaps/GoogleMapsRender.js +0 -72
  57. package/lib-es/GoogleMaps/GoogleMapsRender.js.map +0 -1
  58. package/lib-es/GoogleMaps/helpers/add-zoom-listener.js +0 -9
  59. package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +0 -1
  60. package/lib-es/GoogleMaps/helpers/build-map-shapes.js +0 -68
  61. package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +0 -1
  62. package/lib-es/GoogleMaps/helpers/build-map-type-ids.js +0 -9
  63. package/lib-es/GoogleMaps/helpers/build-map-type-ids.js.map +0 -1
  64. package/lib-es/GoogleMaps/helpers/build-query.js +0 -29
  65. package/lib-es/GoogleMaps/helpers/build-query.js.map +0 -1
  66. package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +0 -124
  67. package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +0 -1
  68. package/lib-es/GoogleMaps/helpers/get-center-coordinates.js +0 -29
  69. package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +0 -1
  70. package/lib-es/GoogleMaps/helpers/get-image-ids.js +0 -13
  71. package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +0 -1
  72. package/lib-es/GoogleMaps/helpers/get-path.js +0 -13
  73. package/lib-es/GoogleMaps/helpers/get-path.js.map +0 -1
  74. package/lib-es/GoogleMaps/helpers/index.js +0 -9
  75. package/lib-es/GoogleMaps/helpers/index.js.map +0 -1
  76. package/lib-es/GoogleMaps/helpers/set-map-options.js +0 -69
  77. package/lib-es/GoogleMaps/helpers/set-map-options.js.map +0 -1
  78. package/lib-es/GoogleMaps/helpers/set-shapes.js +0 -309
  79. package/lib-es/GoogleMaps/helpers/set-shapes.js.map +0 -1
  80. package/lib-es/GoogleMaps/hooks/index.js +0 -4
  81. package/lib-es/GoogleMaps/hooks/index.js.map +0 -1
  82. package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js +0 -20
  83. package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js.map +0 -1
  84. package/lib-es/GoogleMaps/hooks/use-get-images.js +0 -27
  85. package/lib-es/GoogleMaps/hooks/use-get-images.js.map +0 -1
  86. package/lib-es/GoogleMaps/index.js +0 -3
  87. package/lib-es/GoogleMaps/index.js.map +0 -1
  88. package/lib-es/GoogleMaps/queries.js +0 -47
  89. package/lib-es/GoogleMaps/queries.js.map +0 -1
  90. package/lib-es/constants.js +0 -90
  91. package/lib-es/constants.js.map +0 -1
  92. package/lib-es/index.js +0 -17
  93. package/lib-es/index.js.map +0 -1
@@ -1,36 +1,12 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.js");
4
- require("core-js/modules/es.array.filter.js");
5
- require("core-js/modules/es.object.define-properties.js");
6
- require("core-js/modules/es.object.define-property.js");
7
- require("core-js/modules/es.object.get-own-property-descriptor.js");
8
- require("core-js/modules/es.object.get-own-property-descriptors.js");
9
- require("core-js/modules/es.weak-map.js");
10
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
11
- var _typeof = require("@babel/runtime/helpers/typeof");
12
4
  Object.defineProperty(exports, "__esModule", {
13
5
  value: true
14
6
  });
15
- exports["default"] = void 0;
7
+ exports.default = void 0;
16
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
18
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
20
- require("core-js/modules/es.array.every.js");
21
- require("core-js/modules/es.array.find.js");
22
- require("core-js/modules/es.array.for-each.js");
23
- require("core-js/modules/es.array.includes.js");
24
- require("core-js/modules/es.array.iterator.js");
25
- require("core-js/modules/es.array.map.js");
26
- require("core-js/modules/es.array.reduce.js");
27
- require("core-js/modules/es.object.keys.js");
28
- require("core-js/modules/es.object.to-string.js");
29
- require("core-js/modules/es.promise.js");
30
- require("core-js/modules/es.string.includes.js");
31
- require("core-js/modules/es.string.iterator.js");
32
- require("core-js/modules/web.dom-collections.for-each.js");
33
- require("core-js/modules/web.dom-collections.iterator.js");
34
10
  var _react = _interopRequireDefault(require("react"));
35
11
  var _lodash = _interopRequireDefault(require("lodash.isnumber"));
36
12
  var ReactDOMServer = _interopRequireWildcard(require("react-dom/server"));
@@ -39,240 +15,183 @@ var _client = require("@apollo/client");
39
15
  var _reactPageBuilder = require("@blaze-cms/react-page-builder");
40
16
  var _getPath = _interopRequireDefault(require("./get-path"));
41
17
  var _constants = require("../../constants");
42
- var _excluded = ["elementTitle", "type", "propsToDisplay"];
43
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
44
- 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; }
18
+ const _excluded = ["elementTitle", "type", "propsToDisplay"];
19
+ 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); }
45
20
  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; }
46
- 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; }
47
- var shapesArray = [];
48
- var infoWindowArray = [];
49
- var clearShapes = function clearShapes() {
21
+ 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
+ const shapesArray = [];
23
+ const infoWindowArray = [];
24
+ const clearShapes = () => {
50
25
  if (shapesArray.length) {
51
- shapesArray.forEach(function (shape) {
52
- return shape.setMap(null);
53
- });
26
+ shapesArray.forEach(shape => shape.setMap(null));
54
27
  shapesArray.length = 0;
55
28
  }
56
29
  };
57
- var closeInfoWindows = function closeInfoWindows() {
30
+ const closeInfoWindows = () => {
58
31
  if (infoWindowArray.length) {
59
- infoWindowArray.forEach(function (infoWindow) {
60
- return infoWindow.close();
61
- });
32
+ infoWindowArray.forEach(infoWindow => infoWindow.close());
62
33
  infoWindowArray.length = 0;
63
34
  }
64
35
  };
65
- var addShapeListeners = function addShapeListeners(map, router, shape, imageData, shapeInstance, client) {
66
- var _shape$enableInfoPane = shape.enableInfoPane,
67
- enableInfoPane = _shape$enableInfoPane === void 0 ? false : _shape$enableInfoPane,
68
- _shape$dataSummaries = shape.dataSummaries,
69
- dataSummaries = _shape$dataSummaries === void 0 ? [] : _shape$dataSummaries,
70
- url = shape.url,
71
- shapeData = shape.shapeData;
36
+ const addShapeListeners = (map, router, shape, imageData, shapeInstance, client) => {
37
+ const {
38
+ enableInfoPane = false,
39
+ dataSummaries = [],
40
+ url,
41
+ shapeData
42
+ } = shape;
72
43
  if (enableInfoPane) {
73
- var infoWindow = new window.google.maps.InfoWindow({
44
+ const infoWindow = new window.google.maps.InfoWindow({
74
45
  content: ''
75
46
  });
76
- shapeInstance.addListener(_constants.CLICK, /*#__PURE__*/function () {
77
- var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
78
- var content;
79
- return _regenerator["default"].wrap(function _callee$(_context) {
80
- while (1) switch (_context.prev = _context.next) {
81
- case 0:
82
- closeInfoWindows();
83
- _context.t0 = ReactDOMServer;
84
- _context.next = 4;
85
- return infoWindowContent(imageData, dataSummaries, url, shapeData, client);
86
- case 4:
87
- _context.t1 = _context.sent;
88
- content = _context.t0.renderToString.call(_context.t0, _context.t1);
89
- infoWindow.setContent(content);
90
- infoWindow.setPosition(event.latLng);
91
- infoWindow.open(map, shapeInstance);
92
- infoWindowArray.push(infoWindow);
93
- case 10:
94
- case "end":
95
- return _context.stop();
96
- }
97
- }, _callee);
98
- }));
99
- return function (_x) {
100
- return _ref.apply(this, arguments);
101
- };
102
- }());
47
+ shapeInstance.addListener(_constants.CLICK, async event => {
48
+ closeInfoWindows();
49
+ const content = ReactDOMServer.renderToString(await infoWindowContent(imageData, dataSummaries, url, shapeData, client));
50
+ infoWindow.setContent(content);
51
+ infoWindow.setPosition(event.latLng);
52
+ infoWindow.open(map, shapeInstance);
53
+ infoWindowArray.push(infoWindow);
54
+ });
103
55
  } else if (url) {
104
- shapeInstance.addListener(_constants.CLICK, function () {
56
+ shapeInstance.addListener(_constants.CLICK, () => {
105
57
  router.push(url);
106
58
  });
107
59
  }
108
60
  };
109
- var setStyleOptions = function setStyleOptions(shape) {
110
- var strokeColor = shape.strokeColor,
111
- strokeOpacity = shape.strokeOpacity,
112
- strokeWeight = shape.strokeWeight,
113
- fillColor = shape.fillColor,
114
- fillOpacity = shape.fillOpacity;
115
- var styleSettings = {
116
- strokeColor: strokeColor,
117
- fillColor: fillColor,
118
- strokeOpacity: strokeOpacity,
119
- strokeWeight: strokeWeight,
120
- fillOpacity: fillOpacity
61
+ const setStyleOptions = shape => {
62
+ const {
63
+ strokeColor,
64
+ strokeOpacity,
65
+ strokeWeight,
66
+ fillColor,
67
+ fillOpacity
68
+ } = shape;
69
+ const styleSettings = {
70
+ strokeColor,
71
+ fillColor,
72
+ strokeOpacity,
73
+ strokeWeight,
74
+ fillOpacity
121
75
  };
122
- return _objectSpread({}, Object.keys(styleSettings).reduce(function (acc, key) {
123
- var settingValue = styleSettings[key];
124
- var shouldValueBeNumber = !key.includes(_constants.COLOR);
125
- var hasValuePassedCondition = shouldValueBeNumber ? (0, _lodash["default"])(settingValue) : settingValue;
76
+ return _objectSpread({}, Object.keys(styleSettings).reduce((acc, key) => {
77
+ const settingValue = styleSettings[key];
78
+ const shouldValueBeNumber = !key.includes(_constants.COLOR);
79
+ const hasValuePassedCondition = shouldValueBeNumber ? (0, _lodash.default)(settingValue) : settingValue;
126
80
  if (hasValuePassedCondition) acc[key] = settingValue;
127
81
  return acc;
128
82
  }, {}));
129
83
  };
130
- var areRectangleBoundsNumbers = function areRectangleBoundsNumbers(bounds) {
131
- return bounds.every(function (bound) {
132
- return (0, _lodash["default"])(bound);
133
- });
134
- };
135
- var isPositionCorrect = function isPositionCorrect(lat, lng) {
136
- return (0, _lodash["default"])(lat) && (0, _lodash["default"])(lng);
137
- };
138
- var getIconUrl = function getIconUrl(imageId, imageData) {
84
+ const areRectangleBoundsNumbers = bounds => bounds.every(bound => (0, _lodash.default)(bound));
85
+ const isPositionCorrect = (lat, lng) => (0, _lodash.default)(lat) && (0, _lodash.default)(lng);
86
+ const getIconUrl = (imageId, imageData) => {
139
87
  if (!imageId) return '';
140
- var image = imageData.find(function (_ref2) {
141
- var id = _ref2.id;
142
- return id === imageId;
143
- });
88
+ const image = imageData.find(({
89
+ id
90
+ }) => id === imageId);
144
91
  if (!image || !image.url) return '';
145
92
  return image.url;
146
93
  };
147
- var infoWindowContent = /*#__PURE__*/function () {
148
- var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(imageData, dataSummaries, url, shapeData, client) {
149
- var summariesWithContent, _ref5, imageId, image, shouldShowImage, getImageElement;
150
- return _regenerator["default"].wrap(function _callee3$(_context3) {
151
- while (1) switch (_context3.prev = _context3.next) {
152
- case 0:
153
- _context3.next = 2;
154
- return Promise.all(dataSummaries.map(/*#__PURE__*/function () {
155
- var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(dataSummary) {
156
- var elementTitle, type, propsToDisplay, otherProps, isTypeHeading, summaryPropsWithContent, modifier, SummaryComponent, getDataSummaryComponent;
157
- return _regenerator["default"].wrap(function _callee2$(_context2) {
158
- while (1) switch (_context2.prev = _context2.next) {
159
- case 0:
160
- elementTitle = dataSummary.elementTitle, type = dataSummary.type, propsToDisplay = dataSummary.propsToDisplay, otherProps = (0, _objectWithoutProperties2["default"])(dataSummary, _excluded);
161
- isTypeHeading = type === _constants.HEADING_LARGE;
162
- summaryPropsWithContent = (0, _reactPageBuilder.buildPropsToDisplayWithContent)(shapeData, propsToDisplay);
163
- modifier = (0, _reactPageBuilder.getClassModifiers)(_constants.LIST, otherProps);
164
- SummaryComponent = _reactPageBuilder.summaryComponents[type];
165
- _context2.next = 7;
166
- return SummaryComponent.render.preload();
167
- case 7:
168
- if (summaryPropsWithContent.length) {
169
- _context2.next = 9;
170
- break;
171
- }
172
- return _context2.abrupt("return", null);
173
- case 9:
174
- getDataSummaryComponent = function getDataSummaryComponent() {
175
- var component = /*#__PURE__*/_react["default"].createElement(_client.ApolloProvider, {
176
- client: client
177
- }, /*#__PURE__*/_react["default"].createElement(SummaryComponent, {
178
- key: type,
179
- modifier: modifier,
180
- elementTitle: elementTitle,
181
- summaryPropsWithContent: summaryPropsWithContent
182
- }));
183
- if (isTypeHeading && url) return /*#__PURE__*/_react["default"].createElement(_nextjsComponents.Link, {
184
- href: url
185
- }, component);
186
- return component;
187
- };
188
- return _context2.abrupt("return", getDataSummaryComponent());
189
- case 11:
190
- case "end":
191
- return _context2.stop();
192
- }
193
- }, _callee2);
194
- }));
195
- return function (_x7) {
196
- return _ref4.apply(this, arguments);
197
- };
198
- }()));
199
- case 2:
200
- summariesWithContent = _context3.sent;
201
- _ref5 = shapeData || {}, imageId = _ref5.imageId;
202
- image = imageData.find(function (_ref6) {
203
- var id = _ref6.id;
204
- return id === imageId;
205
- });
206
- shouldShowImage = image && image.url;
207
- getImageElement = function getImageElement() {
208
- var imageUrl = image.url,
209
- data = image.data;
210
- var imageElement = /*#__PURE__*/_react["default"].createElement("img", {
211
- className: "info__window",
212
- src: imageUrl,
213
- alt: data && data.altText ? data.altText : ''
214
- });
215
- if (url) return /*#__PURE__*/_react["default"].createElement(_nextjsComponents.Link, {
216
- href: url
217
- }, imageElement);
218
- return imageElement;
219
- };
220
- return _context3.abrupt("return", /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, shouldShowImage && getImageElement(), summariesWithContent));
221
- case 8:
222
- case "end":
223
- return _context3.stop();
224
- }
225
- }, _callee3);
94
+ const infoWindowContent = async (imageData, dataSummaries, url, shapeData, client) => {
95
+ const summariesWithContent = await Promise.all(dataSummaries.map(async dataSummary => {
96
+ const {
97
+ elementTitle,
98
+ type,
99
+ propsToDisplay
100
+ } = dataSummary,
101
+ otherProps = (0, _objectWithoutProperties2.default)(dataSummary, _excluded);
102
+ const isTypeHeading = type === _constants.HEADING_LARGE;
103
+ const summaryPropsWithContent = (0, _reactPageBuilder.buildPropsToDisplayWithContent)(shapeData, propsToDisplay);
104
+ const modifier = (0, _reactPageBuilder.getClassModifiers)(_constants.LIST, otherProps);
105
+ const SummaryComponent = _reactPageBuilder.summaryComponents[type];
106
+ await SummaryComponent.render.preload(); // preload dynamic nextjs component
107
+
108
+ if (!summaryPropsWithContent.length) return null;
109
+ const getDataSummaryComponent = () => {
110
+ const component = /*#__PURE__*/_react.default.createElement(_client.ApolloProvider, {
111
+ client: client
112
+ }, /*#__PURE__*/_react.default.createElement(SummaryComponent, {
113
+ key: type,
114
+ modifier: modifier,
115
+ elementTitle: elementTitle,
116
+ summaryPropsWithContent: summaryPropsWithContent
117
+ }));
118
+ if (isTypeHeading && url) return /*#__PURE__*/_react.default.createElement(_nextjsComponents.Link, {
119
+ href: url
120
+ }, component);
121
+ return component;
122
+ };
123
+ return getDataSummaryComponent();
226
124
  }));
227
- return function infoWindowContent(_x2, _x3, _x4, _x5, _x6) {
228
- return _ref3.apply(this, arguments);
125
+ const {
126
+ imageId
127
+ } = shapeData || {};
128
+ const image = imageData.find(({
129
+ id
130
+ }) => id === imageId);
131
+ const shouldShowImage = image && image.url;
132
+ const getImageElement = () => {
133
+ const {
134
+ url: imageUrl,
135
+ data
136
+ } = image;
137
+ const imageElement = /*#__PURE__*/_react.default.createElement("img", {
138
+ className: "info__window",
139
+ src: imageUrl,
140
+ alt: data && data.altText ? data.altText : ''
141
+ });
142
+ if (url) return /*#__PURE__*/_react.default.createElement(_nextjsComponents.Link, {
143
+ href: url
144
+ }, imageElement);
145
+ return imageElement;
229
146
  };
230
- }();
147
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowImage && getImageElement(), summariesWithContent);
148
+ };
231
149
  function getIcon(imageData, shape) {
232
- var imageId = shape.imageId,
233
- _shape$markerWidth = shape.markerWidth,
234
- markerWidth = _shape$markerWidth === void 0 ? 50 : _shape$markerWidth,
235
- _shape$markerHeight = shape.markerHeight,
236
- markerHeight = _shape$markerHeight === void 0 ? 50 : _shape$markerHeight,
237
- strokeColor = shape.strokeColor,
238
- strokeOpacity = shape.strokeOpacity,
239
- strokeWeight = shape.strokeWeight,
240
- fillColor = shape.fillColor,
241
- fillOpacity = shape.fillOpacity,
242
- svgPath = shape.svgPath;
243
- var iconUrl = getIconUrl(imageId, imageData);
244
- var icon = iconUrl ? {
150
+ const {
151
+ imageId,
152
+ markerWidth = 50,
153
+ markerHeight = 50,
154
+ strokeColor,
155
+ strokeOpacity,
156
+ strokeWeight,
157
+ fillColor,
158
+ fillOpacity,
159
+ svgPath
160
+ } = shape;
161
+ const iconUrl = getIconUrl(imageId, imageData);
162
+ const icon = iconUrl ? {
245
163
  url: iconUrl,
246
164
  scaledSize: new window.google.maps.Size(markerWidth || 50, markerHeight || 50)
247
165
  } : null;
248
166
  if (icon) return icon;
249
167
  if (!svgPath && !fillColor && !strokeColor) return {}; // any can be true for custom marker
250
168
 
251
- var svgMarker = {
169
+ const svgMarker = {
252
170
  path: svgPath || _constants.DEFAULT_CUSTOM_MARKER_PATH,
253
- strokeColor: strokeColor,
254
- strokeOpacity: strokeOpacity,
255
- strokeWeight: strokeWeight,
256
- fillColor: fillColor,
257
- fillOpacity: fillOpacity,
171
+ strokeColor,
172
+ strokeOpacity,
173
+ strokeWeight,
174
+ fillColor,
175
+ fillOpacity,
258
176
  rotation: 0,
259
177
  scale: 2
260
178
  };
261
179
  return svgMarker;
262
180
  }
263
- var setMarker = function setMarker(map, router, shape, imageData, client) {
264
- var _shape$label = shape.label,
265
- label = _shape$label === void 0 ? '' : _shape$label,
266
- latitude = shape.latitude,
267
- longitude = shape.longitude;
181
+ const setMarker = (map, router, shape, imageData, client) => {
182
+ const {
183
+ label = '',
184
+ latitude,
185
+ longitude
186
+ } = shape;
268
187
  if (isPositionCorrect(latitude, longitude)) {
269
- var svgMarker = getIcon(imageData, shape);
270
- var marker = new window.google.maps.Marker({
188
+ const svgMarker = getIcon(imageData, shape);
189
+ const marker = new window.google.maps.Marker({
271
190
  position: {
272
191
  lat: latitude,
273
192
  lng: longitude
274
193
  },
275
- map: map,
194
+ map,
276
195
  icon: svgMarker,
277
196
  title: label || ''
278
197
  });
@@ -281,12 +200,14 @@ var setMarker = function setMarker(map, router, shape, imageData, client) {
281
200
  marker.setMap(map);
282
201
  }
283
202
  };
284
- var setPolyline = function setPolyline(map, router, shape, imageData) {
285
- var paths = shape.paths;
286
- var path = (0, _getPath["default"])(paths);
203
+ const setPolyline = (map, router, shape, imageData) => {
204
+ const {
205
+ paths
206
+ } = shape;
207
+ const path = (0, _getPath.default)(paths);
287
208
  if (path.length) {
288
- var polyline = new window.google.maps.Polyline(_objectSpread({
289
- path: path,
209
+ const polyline = new window.google.maps.Polyline(_objectSpread({
210
+ path,
290
211
  geodesic: true
291
212
  }, setStyleOptions(shape)));
292
213
  addShapeListeners(map, router, shape, imageData, polyline);
@@ -294,26 +215,30 @@ var setPolyline = function setPolyline(map, router, shape, imageData) {
294
215
  polyline.setMap(map);
295
216
  }
296
217
  };
297
- var setPolygon = function setPolygon(map, router, shape, imageData) {
298
- var unParsedPaths = shape.paths;
299
- var paths = (0, _getPath["default"])(unParsedPaths);
218
+ const setPolygon = (map, router, shape, imageData) => {
219
+ const {
220
+ paths: unParsedPaths
221
+ } = shape;
222
+ const paths = (0, _getPath.default)(unParsedPaths);
300
223
  if (paths.length) {
301
- var polygon = new window.google.maps.Polygon(_objectSpread({
302
- paths: paths
224
+ const polygon = new window.google.maps.Polygon(_objectSpread({
225
+ paths
303
226
  }, setStyleOptions(shape)));
304
227
  addShapeListeners(map, router, shape, imageData, polygon);
305
228
  shapesArray.push(polygon);
306
229
  polygon.setMap(map);
307
230
  }
308
231
  };
309
- var setRectangle = function setRectangle(map, router, shape, imageData) {
310
- var northBound = shape.northBound,
311
- southBound = shape.southBound,
312
- eastBound = shape.eastBound,
313
- westBound = shape.westBound;
232
+ const setRectangle = (map, router, shape, imageData) => {
233
+ const {
234
+ northBound,
235
+ southBound,
236
+ eastBound,
237
+ westBound
238
+ } = shape;
314
239
  if (areRectangleBoundsNumbers([northBound, southBound, eastBound, westBound])) {
315
- var rectangle = new window.google.maps.Rectangle(_objectSpread(_objectSpread({}, setStyleOptions(shape)), {}, {
316
- map: map,
240
+ const rectangle = new window.google.maps.Rectangle(_objectSpread(_objectSpread({}, setStyleOptions(shape)), {}, {
241
+ map,
317
242
  bounds: {
318
243
  north: northBound,
319
244
  south: southBound,
@@ -326,31 +251,35 @@ var setRectangle = function setRectangle(map, router, shape, imageData) {
326
251
  rectangle.setMap(map);
327
252
  }
328
253
  };
329
- var setCircle = function setCircle(map, router, shape, imageData) {
330
- var latitude = shape.latitude,
331
- longitude = shape.longitude,
332
- radius = shape.radius;
333
- if (isPositionCorrect(latitude, longitude) && (0, _lodash["default"])(radius)) {
334
- var circle = new window.google.maps.Circle(_objectSpread(_objectSpread({}, setStyleOptions(shape)), {}, {
335
- map: map,
254
+ const setCircle = (map, router, shape, imageData) => {
255
+ const {
256
+ latitude,
257
+ longitude,
258
+ radius
259
+ } = shape;
260
+ if (isPositionCorrect(latitude, longitude) && (0, _lodash.default)(radius)) {
261
+ const circle = new window.google.maps.Circle(_objectSpread(_objectSpread({}, setStyleOptions(shape)), {}, {
262
+ map,
336
263
  center: {
337
264
  lat: latitude,
338
265
  lng: longitude
339
266
  },
340
- radius: radius
267
+ radius
341
268
  }));
342
269
  addShapeListeners(map, router, shape, imageData, circle);
343
270
  shapesArray.push(circle);
344
271
  circle.setMap(map);
345
272
  }
346
273
  };
347
- var setShapes = function setShapes(map, router, shapes, imageData, client) {
348
- var mapZoom = map.getZoom();
274
+ const setShapes = (map, router, shapes, imageData, client) => {
275
+ const mapZoom = map.getZoom();
349
276
  clearShapes();
350
- shapes.forEach(function (shape) {
351
- var type = shape.type,
352
- minZoom = shape.minZoom,
353
- maxZoom = shape.maxZoom;
277
+ shapes.forEach(shape => {
278
+ const {
279
+ type,
280
+ minZoom,
281
+ maxZoom
282
+ } = shape;
354
283
  if (mapZoom >= minZoom && mapZoom <= maxZoom) {
355
284
  switch (type) {
356
285
  case _constants.MARKER:
@@ -384,5 +313,5 @@ var setShapes = function setShapes(map, router, shapes, imageData, client) {
384
313
  }
385
314
  });
386
315
  };
387
- var _default = exports["default"] = setShapes;
316
+ var _default = exports.default = setShapes;
388
317
  //# sourceMappingURL=set-shapes.js.map