@blaze-cms/plugin-google-maps-fe 0.146.0-translations.8 → 0.147.0-rc-eagle.4

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