@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,69 +1,69 @@
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.object.keys.js");
10
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
11
4
  Object.defineProperty(exports, "__esModule", {
12
5
  value: true
13
6
  });
14
- exports["default"] = void 0;
7
+ exports.default = void 0;
15
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- require("core-js/modules/es.array.for-each.js");
17
- require("core-js/modules/es.array.is-array.js");
18
- require("core-js/modules/es.object.to-string.js");
19
- require("core-js/modules/web.dom-collections.for-each.js");
20
9
  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
- 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
- var _getLatLonValues = function getLatLonValues(keys, data) {
10
+ 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; }
11
+ const getLatLonValues = (keys, data) => {
23
12
  if (keys.length === 1) return data[keys];
24
- var key = keys.shift();
25
- return _getLatLonValues(keys, data[key]);
13
+ const key = keys.shift();
14
+ return getLatLonValues(keys, data[key]);
26
15
  };
27
- var getLatLong = function getLatLong(latProp, lonProp, shape, data) {
28
- var latitude = shape.latitude,
29
- longitude = shape.longitude;
16
+ const getLatLong = (latProp, lonProp, shape, data) => {
17
+ const {
18
+ latitude,
19
+ longitude
20
+ } = shape;
30
21
  if (!latProp || !lonProp) return {
31
- latitude: latitude,
32
- longitude: longitude
22
+ latitude,
23
+ longitude
33
24
  };
34
- var latKeys = latProp.split('.');
35
- var lonKeys = lonProp.split('.');
36
- var lat = _getLatLonValues(latKeys, data);
37
- var lon = _getLatLonValues(lonKeys, data);
25
+ const latKeys = latProp.split('.');
26
+ const lonKeys = lonProp.split('.');
27
+ const lat = getLatLonValues(latKeys, data);
28
+ const lon = getLatLonValues(lonKeys, data);
38
29
  return {
39
30
  latitude: lat,
40
31
  longitude: lon
41
32
  };
42
33
  };
43
- var buildMapShapes = function buildMapShapes(shapesOptions, shapesData) {
34
+ const buildMapShapes = (shapesOptions, shapesData) => {
44
35
  if (!shapesData) return [];
45
- var mapShapes = [];
46
- shapesOptions.forEach(function (shape) {
47
- var shapeKey = shape.shapeKey,
48
- entityOptions = shape.entityOptions,
49
- shapeOptions = shape.shapeOptions;
50
- var dataSummaries = entityOptions.dataSummaries,
51
- enableInfoPane = entityOptions.enableInfoPane;
52
- var shapeData = Array.isArray(shapesData[shapeKey]) ? shapesData[shapeKey] : shapesData[shapeKey].results;
36
+ const mapShapes = [];
37
+ shapesOptions.forEach(shape => {
38
+ const {
39
+ shapeKey,
40
+ entityOptions,
41
+ shapeOptions
42
+ } = shape;
43
+ const {
44
+ dataSummaries,
45
+ enableInfoPane
46
+ } = entityOptions;
47
+ const shapeData = Array.isArray(shapesData[shapeKey]) ? shapesData[shapeKey] : shapesData[shapeKey].results;
53
48
  if (!shapeData) return;
54
- var latProp = entityOptions.latProp,
55
- lonProp = entityOptions.lonProp;
56
- shapeData.forEach(function (data) {
57
- var url = data.url;
58
- var _getLatLong = getLatLong(latProp, lonProp, shapeOptions, data),
59
- latitude = _getLatLong.latitude,
60
- longitude = _getLatLong.longitude;
61
- var formatedShape = _objectSpread(_objectSpread({}, shapeOptions), {}, {
62
- latitude: latitude,
63
- longitude: longitude,
64
- dataSummaries: dataSummaries,
65
- enableInfoPane: enableInfoPane,
66
- url: url,
49
+ const {
50
+ latProp,
51
+ lonProp
52
+ } = entityOptions;
53
+ shapeData.forEach(data => {
54
+ const {
55
+ url
56
+ } = data;
57
+ const {
58
+ latitude,
59
+ longitude
60
+ } = getLatLong(latProp, lonProp, shapeOptions, data);
61
+ const formatedShape = _objectSpread(_objectSpread({}, shapeOptions), {}, {
62
+ latitude,
63
+ longitude,
64
+ dataSummaries,
65
+ enableInfoPane,
66
+ url,
67
67
  shapeData: data
68
68
  });
69
69
  mapShapes.push(formatedShape);
@@ -71,5 +71,5 @@ var buildMapShapes = function buildMapShapes(shapesOptions, shapesData) {
71
71
  });
72
72
  return mapShapes;
73
73
  };
74
- var _default = exports["default"] = buildMapShapes;
74
+ var _default = exports.default = buildMapShapes;
75
75
  //# sourceMappingURL=build-map-shapes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-map-shapes.js","names":["getLatLonValues","keys","data","length","key","shift","getLatLong","latProp","lonProp","shape","latitude","longitude","latKeys","split","lonKeys","lat","lon","buildMapShapes","shapesOptions","shapesData","mapShapes","forEach","shapeKey","entityOptions","shapeOptions","dataSummaries","enableInfoPane","shapeData","Array","isArray","results","url","_getLatLong","formatedShape","_objectSpread","push","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/build-map-shapes.js"],"sourcesContent":["const getLatLonValues = (keys, data) => {\n if (keys.length === 1) return data[keys];\n const key = keys.shift();\n return getLatLonValues(keys, data[key]);\n};\n\nconst getLatLong = (latProp, lonProp, shape, data) => {\n const { latitude, longitude } = shape;\n\n if (!latProp || !lonProp) return { latitude, longitude };\n const latKeys = latProp.split('.');\n const lonKeys = lonProp.split('.');\n const lat = getLatLonValues(latKeys, data);\n const lon = getLatLonValues(lonKeys, data);\n\n return { latitude: lat, longitude: lon };\n};\n\nconst buildMapShapes = (shapesOptions, shapesData) => {\n if (!shapesData) return [];\n const mapShapes = [];\n shapesOptions.forEach(shape => {\n const { shapeKey, entityOptions, shapeOptions } = shape;\n const { dataSummaries, enableInfoPane } = entityOptions;\n\n const shapeData = Array.isArray(shapesData[shapeKey])\n ? shapesData[shapeKey]\n : shapesData[shapeKey].results;\n if (!shapeData) return;\n const { latProp, lonProp } = entityOptions;\n\n shapeData.forEach(data => {\n const { url } = data;\n const { latitude, longitude } = getLatLong(latProp, lonProp, shapeOptions, data);\n\n const formatedShape = {\n ...shapeOptions,\n latitude,\n longitude,\n dataSummaries,\n enableInfoPane,\n url,\n shapeData: data\n };\n\n mapShapes.push(formatedShape);\n });\n });\n\n return mapShapes;\n};\n\nexport default buildMapShapes;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,gBAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAI,EAAEC,IAAI,EAAK;EACtC,IAAID,IAAI,CAACE,MAAM,KAAK,CAAC,EAAE,OAAOD,IAAI,CAACD,IAAI,CAAC;EACxC,IAAMG,GAAG,GAAGH,IAAI,CAACI,KAAK,CAAC,CAAC;EACxB,OAAOL,gBAAe,CAACC,IAAI,EAAEC,IAAI,CAACE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,IAAME,UAAU,GAAG,SAAbA,UAAUA,CAAIC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAA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;MAAEC,OAAO,GAAKe,aAAa,CAAzBf,OAAO;IAExBmB,SAAS,CAACN,OAAO,CAAC,UAAAnB,IAAI,EAAI;MACxB,IAAQ6B,GAAG,GAAK7B,IAAI,CAAZ6B,GAAG;MACX,IAAAC,WAAA,GAAgC1B,UAAU,CAACC,OAAO,EAAEC,OAAO,EAAEgB,YAAY,EAAEtB,IAAI,CAAC;QAAxEQ,QAAQ,GAAAsB,WAAA,CAARtB,QAAQ;QAAEC,SAAS,GAAAqB,WAAA,CAATrB,SAAS;MAE3B,IAAMsB,aAAa,GAAAC,aAAA,CAAAA,aAAA,KACdV,YAAY;QACfd,QAAQ,EAARA,QAAQ;QACRC,SAAS,EAATA,SAAS;QACTc,aAAa,EAAbA,aAAa;QACbC,cAAc,EAAdA,cAAc;QACdK,GAAG,EAAHA,GAAG;QACHJ,SAAS,EAAEzB;MAAI,EAChB;MAEDkB,SAAS,CAACe,IAAI,CAACF,aAAa,CAAC;IAC/B,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOb,SAAS;AAClB,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,cAEapB,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"build-map-shapes.js","names":["getLatLonValues","keys","data","length","key","shift","getLatLong","latProp","lonProp","shape","latitude","longitude","latKeys","split","lonKeys","lat","lon","buildMapShapes","shapesOptions","shapesData","mapShapes","forEach","shapeKey","entityOptions","shapeOptions","dataSummaries","enableInfoPane","shapeData","Array","isArray","results","url","formatedShape","_objectSpread","push","_default","exports","default"],"sources":["../../../src/GoogleMaps/helpers/build-map-shapes.js"],"sourcesContent":["const getLatLonValues = (keys, data) => {\n if (keys.length === 1) return data[keys];\n const key = keys.shift();\n return getLatLonValues(keys, data[key]);\n};\n\nconst getLatLong = (latProp, lonProp, shape, data) => {\n const { latitude, longitude } = shape;\n\n if (!latProp || !lonProp) return { latitude, longitude };\n const latKeys = latProp.split('.');\n const lonKeys = lonProp.split('.');\n const lat = getLatLonValues(latKeys, data);\n const lon = getLatLonValues(lonKeys, data);\n\n return { latitude: lat, longitude: lon };\n};\n\nconst buildMapShapes = (shapesOptions, shapesData) => {\n if (!shapesData) return [];\n const mapShapes = [];\n shapesOptions.forEach(shape => {\n const { shapeKey, entityOptions, shapeOptions } = shape;\n const { dataSummaries, enableInfoPane } = entityOptions;\n\n const shapeData = Array.isArray(shapesData[shapeKey])\n ? shapesData[shapeKey]\n : shapesData[shapeKey].results;\n if (!shapeData) return;\n const { latProp, lonProp } = entityOptions;\n\n shapeData.forEach(data => {\n const { url } = data;\n const { latitude, longitude } = getLatLong(latProp, lonProp, shapeOptions, data);\n\n const formatedShape = {\n ...shapeOptions,\n latitude,\n longitude,\n dataSummaries,\n enableInfoPane,\n url,\n shapeData: data\n };\n\n mapShapes.push(formatedShape);\n });\n });\n\n return mapShapes;\n};\n\nexport default buildMapShapes;\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,eAAe,GAAGA,CAACC,IAAI,EAAEC,IAAI,KAAK;EACtC,IAAID,IAAI,CAACE,MAAM,KAAK,CAAC,EAAE,OAAOD,IAAI,CAACD,IAAI,CAAC;EACxC,MAAMG,GAAG,GAAGH,IAAI,CAACI,KAAK,CAAC,CAAC;EACxB,OAAOL,eAAe,CAACC,IAAI,EAAEC,IAAI,CAACE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAME,UAAU,GAAGA,CAACC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEP,IAAI,KAAK;EACpD,MAAM;IAAEQ,QAAQ;IAAEC;EAAU,CAAC,GAAGF,KAAK;EAErC,IAAI,CAACF,OAAO,IAAI,CAACC,OAAO,EAAE,OAAO;IAAEE,QAAQ;IAAEC;EAAU,CAAC;EACxD,MAAMC,OAAO,GAAGL,OAAO,CAACM,KAAK,CAAC,GAAG,CAAC;EAClC,MAAMC,OAAO,GAAGN,OAAO,CAACK,KAAK,CAAC,GAAG,CAAC;EAClC,MAAME,GAAG,GAAGf,eAAe,CAACY,O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Ae,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapB,cAAc","ignoreList":[]}
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports["default"] = void 0;
6
+ exports.default = void 0;
8
7
  var _constants = require("../../constants");
9
- var buildMapTypeIds = function buildMapTypeIds(enableSatelliteView, enableTerrainScreen) {
10
- var mapTypeIds = [_constants.ROADMAP];
8
+ const buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {
9
+ const mapTypeIds = [_constants.ROADMAP];
11
10
  if (enableSatelliteView) mapTypeIds.push(_constants.SATELLITE);
12
11
  if (enableTerrainScreen) mapTypeIds.push(_constants.TERRAIN);
13
12
  return mapTypeIds;
14
13
  };
15
- var _default = exports["default"] = buildMapTypeIds;
14
+ var _default = exports.default = buildMapTypeIds;
16
15
  //# sourceMappingURL=build-map-type-ids.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-map-type-ids.js","names":["_constants","require","buildMapTypeIds","enableSatelliteView","enableTerrainScreen","mapTypeIds","ROADMAP","push","SATELLITE","TERRAIN","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/build-map-type-ids.js"],"sourcesContent":["import { ROADMAP, SATELLITE, TERRAIN } from '../../constants';\n\nconst buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {\n const mapTypeIds = [ROADMAP];\n if (enableSatelliteView) mapTypeIds.push(SATELLITE);\n if (enableTerrainScreen) mapTypeIds.push(TERRAIN);\n return mapTypeIds;\n};\n\nexport default buildMapTypeIds;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,mBAAmB,EAAEC,mBAAmB,EAAK;EACpE,IAAMC,UAAU,GAAG,CAACC,kBAAO,CAAC;EAC5B,IAAIH,mBAAmB,EAAEE,UAAU,CAACE,IAAI,CAACC,oBAAS,CAAC;EACnD,IAAIJ,mBAAmB,EAAEC,UAAU,CAACE,IAAI,CAACE,kBAAO,CAAC;EACjD,OAAOJ,UAAU;AACnB,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEaT,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"build-map-type-ids.js","names":["_constants","require","buildMapTypeIds","enableSatelliteView","enableTerrainScreen","mapTypeIds","ROADMAP","push","SATELLITE","TERRAIN","_default","exports","default"],"sources":["../../../src/GoogleMaps/helpers/build-map-type-ids.js"],"sourcesContent":["import { ROADMAP, SATELLITE, TERRAIN } from '../../constants';\n\nconst buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {\n const mapTypeIds = [ROADMAP];\n if (enableSatelliteView) mapTypeIds.push(SATELLITE);\n if (enableTerrainScreen) mapTypeIds.push(TERRAIN);\n return mapTypeIds;\n};\n\nexport default buildMapTypeIds;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAGA,CAACC,mBAAmB,EAAEC,mBAAmB,KAAK;EACpE,MAAMC,UAAU,GAAG,CAACC,kBAAO,CAAC;EAC5B,IAAIH,mBAAmB,EAAEE,UAAU,CAACE,IAAI,CAACC,oBAAS,CAAC;EACnD,IAAIJ,mBAAmB,EAAEC,UAAU,CAACE,IAAI,CAACE,kBAAO,CAAC;EACjD,OAAOJ,UAAU;AACnB,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,eAAe","ignoreList":[]}
@@ -1,44 +1,38 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports["default"] = void 0;
9
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
- require("core-js/modules/es.array.concat.js");
11
- require("core-js/modules/es.array.index-of.js");
12
- require("core-js/modules/es.array.join.js");
13
- require("core-js/modules/es.array.map.js");
14
- require("core-js/modules/es.array.slice.js");
15
- require("core-js/modules/es.date.to-json.js");
16
- require("core-js/modules/es.object.to-string.js");
17
- require("core-js/modules/es.string.trim.js");
7
+ exports.default = void 0;
8
+ var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
9
+ var _lodash2 = _interopRequireDefault(require("lodash.camelcase"));
18
10
  var _queries = require("../queries");
19
- var buildQuery = function buildQuery(entityConfigs) {
20
- var entityIds = [];
21
- var rawQueryStringified = '';
22
- var queryString = entityConfigs.map(function (entityConfig) {
23
- var action = entityConfig.action,
24
- ids = entityConfig.ids,
25
- entity = entityConfig.entity,
26
- propsQuery = entityConfig.propsQuery,
27
- shapeKey = entityConfig.shapeKey,
28
- filtersObject = entityConfig.filtersObject;
11
+ const buildQuery = entityConfigs => {
12
+ const entityIds = [];
13
+ const rawQueryStringified = '';
14
+ const queryString = entityConfigs.map(entityConfig => {
15
+ const {
16
+ action,
17
+ ids,
18
+ entity,
19
+ propsQuery,
20
+ shapeKey,
21
+ filtersObject
22
+ } = entityConfig;
29
23
  if (!action) return '';
30
- var formatedEntity = "".concat(entity[0].toUpperCase()).concat(entity.slice(1));
31
- var filterQueryKey = action.indexOf('Published') !== -1 ? "Published".concat(formatedEntity) : formatedEntity;
32
- entityIds.push.apply(entityIds, (0, _toConsumableArray2["default"])(ids));
33
- var props = propsQuery.trim() || 'id';
34
- var singleItemQuery = filtersObject ? (0, _queries.generateFiltersQuery)(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey) : (0, _queries.generateIdsQuery)(shapeKey, props, action, ids);
24
+ const formatedEntity = (0, _lodash.default)((0, _lodash2.default)(entity));
25
+ const filterQueryKey = action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;
26
+ entityIds.push(...ids);
27
+ const props = propsQuery.trim() || 'id';
28
+ const singleItemQuery = filtersObject ? (0, _queries.generateFiltersQuery)(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey) : (0, _queries.generateIdsQuery)(shapeKey, props, action, ids);
35
29
  return singleItemQuery;
36
30
  }).join(' ');
37
31
  return {
38
32
  query: queryString ? (0, _queries.generateQuery)(queryString) : '',
39
33
  ids: entityIds,
40
- rawQueryStringified: rawQueryStringified
34
+ rawQueryStringified
41
35
  };
42
36
  };
43
- var _default = exports["default"] = buildQuery;
37
+ var _default = exports.default = buildQuery;
44
38
  //# sourceMappingURL=build-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-query.js","names":["_queries","require","buildQuery","entityConfigs","entityIds","rawQueryStringified","queryString","map","entityConfig","action","ids","entity","propsQuery","shapeKey","filtersObject","formatedEntity","concat","toUpperCase","slice","filterQueryKey","indexOf","push","apply","_toConsumableArray2","props","trim","singleItemQuery","generateFiltersQuery","JSON","stringify","generateIdsQuery","join","query","generateQuery","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/build-query.js"],"sourcesContent":["import { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';\n\nconst buildQuery = entityConfigs => {\n const entityIds = [];\n const rawQueryStringified = '';\n const queryString = entityConfigs\n .map(entityConfig => {\n const { action, ids, entity, propsQuery, shapeKey, filtersObject } = entityConfig;\n if (!action) return '';\n const formatedEntity = `${entity[0].toUpperCase()}${entity.slice(1)}`;\n const filterQueryKey =\n action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;\n\n entityIds.push(...ids);\n const props = propsQuery.trim() || 'id';\n const singleItemQuery = filtersObject\n ? generateFiltersQuery(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey)\n : generateIdsQuery(shapeKey, props, action, ids);\n\n return singleItemQuery;\n })\n .join(' ');\n\n return {\n query: queryString ? generateQuery(queryString) : '',\n ids: entityIds,\n rawQueryStringified\n };\n};\n\nexport default buildQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAM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KAAK,EAAE1B,WAAW,GAAG,IAAA2B,sBAAa,EAAC3B,WAAW,CAAC,GAAG,EAAE;IACpDI,GAAG,EAAEN,SAAS;IACdC,mBAAmB,EAAnBA;EACF,CAAC;AACH,CAAC;AAAC,IAAA6B,QAAA,GAAAC,OAAA,cAEajC,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"build-query.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_queries","buildQuery","entityConfigs","entityIds","rawQueryStringified","queryString","map","entityConfig","action","ids","entity","propsQuery","shapeKey","filtersObject","formatedEntity","upperFirst","camelcase","filterQueryKey","indexOf","push","props","trim","singleItemQuery","generateFiltersQuery","JSON","stringify","generateIdsQuery","join","query","generateQuery","_default","exports","default"],"sources":["../../../src/GoogleMaps/helpers/build-query.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport camelcase from 'lodash.camelcase';\nimport { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';\n\nconst buildQuery = entityConfigs => {\n const entityIds = [];\n const rawQueryStringified = '';\n const queryString = entityConfigs\n .map(entityConfig => {\n const { action, ids, entity, propsQuery, shapeKey, filtersObject } = entityConfig;\n if (!action) return '';\n const formatedEntity = upperFirst(camelcase(entity));\n const filterQueryKey =\n action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;\n\n entityIds.push(...ids);\n const props = propsQuery.trim() || 'id';\n const singleItemQuery = filtersObject\n ? generateFiltersQuery(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey)\n : generateIdsQuery(shapeKey, props, action, ids);\n\n return singleItemQuery;\n })\n .join(' ');\n\n return {\n query: queryString ? generateQuery(queryString) : '',\n ids: entityIds,\n rawQueryStringified\n };\n};\n\nexport default buildQuery;\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,MAAMG,UAAU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-properties.js");
5
- require("core-js/modules/es.object.define-property.js");
6
- require("core-js/modules/es.object.get-own-property-descriptor.js");
7
- require("core-js/modules/es.object.get-own-property-descriptors.js");
8
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
9
4
  Object.defineProperty(exports, "__esModule", {
10
5
  value: true
11
6
  });
12
- exports["default"] = void 0;
7
+ exports.default = void 0;
13
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
- require("core-js/modules/es.array.concat.js");
16
- require("core-js/modules/es.array.filter.js");
17
- require("core-js/modules/es.array.find.js");
18
- require("core-js/modules/es.array.for-each.js");
19
- require("core-js/modules/es.array.includes.js");
20
- require("core-js/modules/es.array.map.js");
21
- require("core-js/modules/es.array.reduce.js");
22
- require("core-js/modules/es.object.keys.js");
23
- require("core-js/modules/es.object.to-string.js");
24
- require("core-js/modules/es.string.includes.js");
25
- require("core-js/modules/es.string.trim.js");
26
- require("core-js/modules/web.dom-collections.for-each.js");
27
9
  var _lodash = _interopRequireDefault(require("lodash.flatten"));
28
10
  var _constants = require("../../constants");
29
11
  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; }
30
- 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; }
31
- var getPropValues = function getPropValues(properties) {
32
- return properties.reduce(function (acc, property) {
33
- if (property.includes('.')) {
34
- var _property$split = property.split('.'),
35
- _property$split2 = (0, _slicedToArray2["default"])(_property$split, 2),
36
- relationName = _property$split2[0],
37
- relationProp = _property$split2[1];
38
- return "".concat(acc, " ").concat(relationName, " { ").concat(relationProp, " }");
39
- }
40
- return "".concat(acc, " ").concat(property);
41
- }, '').trim();
42
- };
43
- var getUpdatedPropsQuery = function getUpdatedPropsQuery(propsQuery, entityData) {
44
- var _entityData$propertie = entityData.properties,
45
- properties = _entityData$propertie === void 0 ? {} : _entityData$propertie,
46
- _entityData$dynamicPr = entityData.dynamicProperties,
47
- dynamicProperties = _entityData$dynamicPr === void 0 ? {} : _entityData$dynamicPr;
48
- var _Object$keys$filter = Object.keys(dynamicProperties).filter(function (prop) {
49
- return prop === _constants.URL;
50
- }),
51
- _Object$keys$filter2 = (0, _slicedToArray2["default"])(_Object$keys$filter, 1),
52
- url = _Object$keys$filter2[0];
53
- var hasImage = !!Object.keys(properties).filter(function (prop) {
54
- return prop === _constants.IMAGE_ID;
55
- }).length;
56
- var updatedPropsQuery = hasImage ? "".concat(propsQuery, " ").concat(_constants.IMAGE_ID) : propsQuery;
57
- updatedPropsQuery = url ? "".concat(updatedPropsQuery, " ").concat(_constants.URL) : updatedPropsQuery;
12
+ 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; }
13
+ const getPropValues = properties => properties.reduce((acc, property) => {
14
+ if (property.includes('.')) {
15
+ const [relationName, relationProp] = property.split('.');
16
+ return `${acc} ${relationName} { ${relationProp} }`;
17
+ }
18
+ return `${acc} ${property}`;
19
+ }, '').trim();
20
+ const getUpdatedPropsQuery = (propsQuery, entityData) => {
21
+ const {
22
+ properties = {},
23
+ dynamicProperties = {}
24
+ } = entityData;
25
+ const [url] = Object.keys(dynamicProperties).filter(prop => prop === _constants.URL);
26
+ const hasImage = !!Object.keys(properties).filter(prop => prop === _constants.IMAGE_ID).length;
27
+ let updatedPropsQuery = hasImage ? `${propsQuery} ${_constants.IMAGE_ID}` : propsQuery;
28
+ updatedPropsQuery = url ? `${updatedPropsQuery} ${_constants.URL}` : updatedPropsQuery;
58
29
  return updatedPropsQuery;
59
30
  };
60
- var buildFilterQueryString = function buildFilterQueryString(filter) {
61
- var _filter$split = filter.split('/'),
62
- _filter$split2 = (0, _slicedToArray2["default"])(_filter$split, 2),
63
- filterKey = _filter$split2[0],
64
- filterValue = _filter$split2[1];
65
- var filterKeyword = "".concat(filterKey, ".keyword");
31
+ const buildFilterQueryString = filter => {
32
+ const [filterKey, filterValue] = filter.split('/');
33
+ const filterKeyword = `${filterKey}.keyword`;
66
34
  return {
67
35
  bool: {
68
36
  should: [{
69
- match: (0, _defineProperty2["default"])({}, filterKeyword, filterValue)
37
+ match: {
38
+ [filterKeyword]: filterValue
39
+ }
70
40
  }]
71
41
  }
72
42
  };
73
43
  };
74
- var buildFilters = function buildFilters(filters) {
44
+ const buildFilters = filters => {
75
45
  if (!filters || !filters.length) return null;
76
- var filterQueryProps = filters.map(buildFilterQueryString);
46
+ const filterQueryProps = filters.map(buildFilterQueryString);
77
47
  return {
78
48
  bool: {
79
49
  should: filterQueryProps
80
50
  }
81
51
  };
82
52
  };
83
- var buiildShapeProps = function buiildShapeProps(shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) {
84
- var _shape$displayItems = shape.displayItems,
85
- displayItems = _shape$displayItems === void 0 ? [] : _shape$displayItems,
86
- filterBy = shape.filterBy;
87
- var latProp = entityGroup.latProp,
88
- lonProp = entityGroup.lonProp,
89
- entity = entityGroup.entity;
90
- var actions = entityData.actions,
91
- relations = entityData.relations;
92
- var action = actions ? actions.getAllPublished || actions.getAll : '';
93
- var dataSummaryProps = dataSummaries.reduce(function (acc, _ref) {
94
- var propsToDisplay = _ref.propsToDisplay;
95
- var propsToDisplayValues = (0, _lodash["default"])(propsToDisplay.map(function (_ref2) {
96
- var propertiesToDisplay = _ref2.propertiesToDisplay;
97
- return propertiesToDisplay;
98
- }));
99
- var propsToDisplayString = getPropValues(propsToDisplayValues);
100
- return "".concat(acc, " ").concat(propsToDisplayString);
53
+ const buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) => {
54
+ const {
55
+ displayItems = [],
56
+ filterBy
57
+ } = shape;
58
+ const {
59
+ latProp,
60
+ lonProp,
61
+ entity
62
+ } = entityGroup;
63
+ const {
64
+ actions,
65
+ relations
66
+ } = entityData;
67
+ const action = actions ? actions.getAllPublished || actions.getAll : '';
68
+ const dataSummaryProps = dataSummaries.reduce((acc, {
69
+ propsToDisplay
70
+ }) => {
71
+ const propsToDisplayValues = (0, _lodash.default)(propsToDisplay.map(({
72
+ propertiesToDisplay
73
+ }) => propertiesToDisplay));
74
+ const propsToDisplayString = getPropValues(propsToDisplayValues);
75
+ return `${acc} ${propsToDisplayString}`;
101
76
  }, '').trim();
102
- var ids = [];
77
+ const ids = [];
103
78
  displayItems.length ? ids.push(displayItems[0]) : ids.push(parentId);
104
- var filtersObject = buildFilters(filterBy);
105
- var propsQuery = dataSummaryProps ? "".concat(dataSummaryProps) : '';
79
+ const filtersObject = buildFilters(filterBy);
80
+ let propsQuery = dataSummaryProps ? `${dataSummaryProps}` : '';
106
81
  propsQuery = getUpdatedPropsQuery(propsQuery, entityData);
107
82
  if (latProp && lonProp) {
108
- propsQuery = "".concat(propsQuery, " ").concat(formatProp(latProp, relations), " ").concat(formatProp(lonProp, relations));
83
+ propsQuery = `${propsQuery} ${formatProp(latProp, relations)} ${formatProp(lonProp, relations)}`;
109
84
  }
110
- if (ids.length && !propsQuery.includes(_constants.ID)) propsQuery = "".concat(propsQuery.trim(), " ").concat(_constants.ID);
85
+ if (ids.length && !propsQuery.includes(_constants.ID)) propsQuery = `${propsQuery.trim()} ${_constants.ID}`;
111
86
  return {
112
- shapeKey: shapeKey,
113
- entity: entity,
114
- propsQuery: propsQuery,
115
- ids: ids,
116
- action: action,
117
- filtersObject: filtersObject
87
+ shapeKey,
88
+ entity,
89
+ propsQuery,
90
+ ids,
91
+ action,
92
+ filtersObject
118
93
  };
119
94
  };
120
- var formatProp = function formatProp(prop) {
121
- var relations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
95
+ const formatProp = (prop, relations = []) => {
122
96
  if (!prop.includes('.')) return prop;
123
- var _prop$split = prop.split('.'),
124
- _prop$split2 = (0, _slicedToArray2["default"])(_prop$split, 2),
125
- mainProp = _prop$split2[0],
126
- nestedProp = _prop$split2[1];
127
- var idProp = relations.find(function (_ref3) {
128
- var localField = _ref3.localField;
129
- return localField === mainProp;
130
- }) ? 'id ' : '';
131
- return "".concat(mainProp, "{").concat(idProp).concat(nestedProp, "}");
97
+ const [mainProp, nestedProp] = prop.split('.');
98
+ const idProp = relations.find(({
99
+ localField
100
+ }) => localField === mainProp) ? 'id ' : '';
101
+ return `${mainProp}{${idProp}${nestedProp}}`;
132
102
  };
133
- var buildShapesConfig = function buildShapesConfig(schemas, entityGroups, parent) {
103
+ const buildShapesConfig = (schemas, entityGroups, parent) => {
134
104
  if (!schemas || !entityGroups) return [];
135
- var itemId = parent.itemId,
136
- itemEntity = parent.itemEntity;
137
- var shapeGroups = [];
138
- entityGroups.forEach(function (entityGroup, i) {
139
- var entity = entityGroup.entity,
140
- shapes = entityGroup.shapes,
141
- _entityGroup$dataSumm = entityGroup.dataSummaries,
142
- dataSummaries = _entityGroup$dataSumm === void 0 ? [] : _entityGroup$dataSumm;
143
- var parentId = entity === itemEntity && itemId;
105
+ const {
106
+ itemId,
107
+ itemEntity
108
+ } = parent;
109
+ const shapeGroups = [];
110
+ entityGroups.forEach((entityGroup, i) => {
111
+ const {
112
+ entity,
113
+ shapes,
114
+ dataSummaries = []
115
+ } = entityGroup;
116
+ const parentId = entity === itemEntity && itemId;
144
117
  if (!entity) return null;
145
- var entityData = schemas[entity] || {};
146
- shapes.filter(Boolean).forEach(function (shape, shapeIndex) {
147
- var shapeKey = "shape".concat(i).concat(shapeIndex);
148
- var shapeValues = buiildShapeProps(shape, shapeKey, dataSummaries, parentId, entityData, entityGroup);
118
+ const entityData = schemas[entity] || {};
119
+ shapes.filter(Boolean).forEach((shape, shapeIndex) => {
120
+ const shapeKey = `shape${i}${shapeIndex}`;
121
+ const shapeValues = buiildShapeProps(shape, shapeKey, dataSummaries, parentId, entityData, entityGroup);
149
122
  shapeGroups.push(_objectSpread(_objectSpread({}, shapeValues), {}, {
150
123
  shapeOptions: shape,
151
124
  entityOptions: entityGroup
@@ -154,5 +127,5 @@ var buildShapesConfig = function buildShapesConfig(schemas, entityGroups, parent
154
127
  });
155
128
  return shapeGroups;
156
129
  };
157
- var _default = exports["default"] = buildShapesConfig;
130
+ var _default = exports.default = buildShapesConfig;
158
131
  //# sourceMappingURL=build-shapes-configs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-shapes-configs.js","names":["_lodash","_interopRequireDefault","require","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getPropValues","properties","reduce","acc","property","includes","_property$split","split","_property$split2","_slicedToArray2","relationName","relationProp","concat","trim","getUpdatedPropsQuery","propsQuery","entityData","_entityData$propertie","_entityData$dynamicPr","dynamicProperties","_Object$keys$filter","prop","URL","_Object$keys$filter2","url","hasImage","IMAGE_ID","updatedPropsQuery","buildFilterQueryString","_filter$split","_filter$split2","filterKey","filterValue","filterKeyword","bool","should","match","buildFilters","filters","filterQueryProps","map","buiildShapeProps","shape","shapeKey","dataSummaries","parentId","entityGroup","_shape$displayItems","displayItems","filterBy","latProp","lonProp","entity","actions","relations","action","getAllPublished","getAll","dataSummaryProps","_ref","propsToDisplay","propsToDisplayValues","flatten","_ref2","propertiesToDisplay","propsToDisplayString","ids","filtersObject","formatProp","ID","undefined","_prop$split","_prop$split2","mainProp","nestedProp","idProp","find","_ref3","localField","buildShapesConfig","schemas","entityGroups","parent","itemId","itemEntity","shapeGroups","i","shapes","_entityGroup$dataSumm","Boolean","shapeIndex","shapeValues","shapeOptions","entityOptions","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/build-shapes-configs.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport { IMAGE_ID, URL, ID } from '../../constants';\n\nconst getPropValues = properties =>\n properties\n .reduce((acc, property) => {\n if (property.includes('.')) {\n const [relationName, relationProp] = property.split('.');\n return `${acc} ${relationName} { ${relationProp} }`;\n }\n return `${acc} ${property}`;\n }, '')\n .trim();\n\nconst getUpdatedPropsQuery = (propsQuery, entityData) => {\n const { properties = {}, dynamicProperties = {} } = entityData;\n\n const [url] = Object.keys(dynamicProperties).filter(prop => prop === URL);\n const hasImage = !!Object.keys(properties).filter(prop => prop === IMAGE_ID).length;\n\n let updatedPropsQuery = hasImage ? `${propsQuery} ${IMAGE_ID}` : propsQuery;\n updatedPropsQuery = url ? `${updatedPropsQuery} ${URL}` : updatedPropsQuery;\n\n return updatedPropsQuery;\n};\n\nconst buildFilterQueryString = filter => {\n const [filterKey, filterValue] = filter.split('/');\n const filterKeyword = `${filterKey}.keyword`;\n return { bool: { should: [{ match: { [filterKeyword]: filterValue } }] } };\n};\n\nconst buildFilters = filters => {\n if (!filters || !filters.length) return null;\n const filterQueryProps = filters.map(buildFilterQueryString);\n return { bool: { should: filterQueryProps } };\n};\n\nconst buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) => {\n const { displayItems = [], filterBy } = shape;\n const { latProp, lonProp, entity } = entityGroup;\n const { actions, relations } = entityData;\n const action = actions ? actions.getAllPublished || actions.getAll : '';\n\n const dataSummaryProps = dataSummaries\n .reduce((acc, { propsToDisplay }) => {\n const propsToDisplayValues = flatten(\n propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay)\n );\n const propsToDisplayString = getPropValues(propsToDisplayValues);\n\n return `${acc} ${propsToDisplayString}`;\n }, '')\n .trim();\n const ids = [];\n displayItems.length ? ids.push(displayItems[0]) : ids.push(parentId);\n\n const filtersObject = buildFilters(filterBy);\n let propsQuery = dataSummaryProps ? `${dataSummaryProps}` : '';\n propsQuery = getUpdatedPropsQuery(propsQuery, entityData);\n if (latProp && lonProp) {\n propsQuery = `${propsQuery} ${formatProp(latProp, relations)} ${formatProp(\n lonProp,\n relations\n )}`;\n }\n if (ids.length && !propsQuery.includes(ID)) propsQuery = `${propsQuery.trim()} ${ID}`;\n\n return {\n shapeKey,\n entity,\n propsQuery,\n ids,\n action,\n filtersObject\n };\n};\n\nconst formatProp = (prop, relations = []) => {\n if (!prop.includes('.')) return prop;\n\n const [mainProp, nestedProp] = prop.split('.');\n const idProp = relations.find(({ localField }) => localField === mainProp) ? 'id ' : '';\n return `${mainProp}{${idProp}${nestedProp}}`;\n};\n\nconst buildShapesConfig = (schemas, entityGroups, parent) => {\n if (!schemas || !entityGroups) return [];\n const { itemId, itemEntity } = parent;\n const shapeGroups = [];\n entityGroups.forEach((entityGroup, i) => {\n const { entity, shapes, dataSummaries = [] } = entityGroup;\n const parentId = entity === itemEntity && itemId;\n if (!entity) return null;\n const entityData = schemas[entity] || {};\n\n shapes.filter(Boolean).forEach((shape, shapeIndex) => {\n const shapeKey = `shape${i}${shapeIndex}`;\n const shapeValues = buiildShapeProps(\n shape,\n shapeKey,\n dataSummaries,\n parentId,\n entityData,\n entityGroup\n );\n shapeGroups.push({ ...shapeValues, shapeOptions: shape, entityOptions: entityGroup });\n });\n });\n\n return shapeGroups;\n};\n\nexport default buildShapesConfig;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAAoD,SAAAE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AEC,UAAU,GAAKF,MAAM,CAArBE,UAAU;EAC1B,IAAMC,WAAW,GAAG,EAAE;EACtBJ,YAAY,CAACtF,OAAO,CAAC,UAACmD,WAAW,EAAEwC,CAAC,EAAK;IACvC,IAAQlC,MAAM,GAAiCN,WAAW,CAAlDM,MAAM;MAAEmC,MAAM,GAAyBzC,WAAW,CAA1CyC,MAAM;MAAAC,qBAAA,GAAyB1C,WAAW,CAAlCF,aAAa;MAAbA,aAAa,GAAA4C,qBAAA,cAAG,EAAE,GAAAA,qBAAA;IAC1C,IAAM3C,QAAQ,GAAGO,MAAM,KAAKgC,UAAU,IAAID,MAAM;IAChD,IAAI,CAAC/B,MAAM,EAAE,OAAO,IAAI;IACxB,IAAMpC,UAAU,GAAGgE,OAAO,CAAC5B,MAAM,CAAC,IAAI,CAAC,CAAC;IAExCmC,MAAM,CAACpG,MAAM,CAACsG,OAAO,CAAC,CAAC9F,OAAO,CAAC,UAAC+C,KAAK,EAAEgD,UAAU,EAAK;MACpD,IAAM/C,QAAQ,WAAA/B,MAAA,CAAW0E,CAAC,EAAA1E,MAAA,CAAG8E,UAAU,CAAE;MACzC,IAAMC,WAAW,GAAGlD,gBAAgB,CAClCC,KAAK,EACLC,QAAQ,EACRC,aAAa,EACbC,QAAQ,EACR7B,UAAU,EACV8B,WACF,CAAC;MACDuC,WAAW,CAAC/F,IAAI,CAAAE,aAAA,CAAAA,aAAA,KAAMmG,WAAW;QAAEC,YAAY,EAAElD,KAAK;QAAEmD,aAAa,EAAE/C;MAAW,EAAE,CAAC;IACvF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOuC,WAAW;AACpB,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,cAEahB,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"build-shapes-configs.js","names":["_lodash","_interopRequireDefault","require","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","getPropValues","properties","reduce","acc","property","includes","relationName","relationProp","split","trim","getUpdatedPropsQuery","propsQuery","entityData","dynamicProperties","url","prop","URL","hasImage","IMAGE_ID","updatedPropsQuery","buildFilterQueryString","filterKey","filterValue","filterKeyword","bool","should","match","buildFilters","filters","filterQueryProps","map","buiildShapeProps","shape","shapeKey","dataSummaries","parentId","entityGroup","displayItems","filterBy","latProp","lonProp","entity","actions","relations","action","getAllPublished","getAll","dataSummaryProps","propsToDisplay","propsToDisplayValues","flatten","propertiesToDisplay","propsToDisplayString","ids","filtersObject","formatProp","ID","mainProp","nestedProp","idProp","find","localField","buildShapesConfig","schemas","entityGroups","parent","itemId","itemEntity","shapeGroups","i","shapes","Boolean","shapeIndex","shapeValues","shapeOptions","entityOptions","_default","exports"],"sources":["../../../src/GoogleMaps/helpers/build-shapes-configs.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport { IMAGE_ID, URL, ID } from '../../constants';\n\nconst getPropValues = properties =>\n properties\n .reduce((acc, property) => {\n if (property.includes('.')) {\n const [relationName, relationProp] = property.split('.');\n return `${acc} ${relationName} { ${relationProp} }`;\n }\n return `${acc} ${property}`;\n }, '')\n .trim();\n\nconst getUpdatedPropsQuery = (propsQuery, entityData) => {\n const { properties = {}, dynamicProperties = {} } = entityData;\n\n const [url] = Object.keys(dynamicProperties).filter(prop => prop === URL);\n const hasImage = !!Object.keys(properties).filter(prop => prop === IMAGE_ID).length;\n\n let updatedPropsQuery = hasImage ? `${propsQuery} ${IMAGE_ID}` : propsQuery;\n updatedPropsQuery = url ? `${updatedPropsQuery} ${URL}` : updatedPropsQuery;\n\n return updatedPropsQuery;\n};\n\nconst buildFilterQueryString = filter => {\n const [filterKey, filterValue] = filter.split('/');\n const filterKeyword = `${filterKey}.keyword`;\n return { bool: { should: [{ match: { [filterKeyword]: filterValue } }] } };\n};\n\nconst buildFilters = filters => {\n if (!filters || !filters.length) return null;\n const filterQueryProps = filters.map(buildFilterQueryString);\n return { bool: { should: filterQueryProps } };\n};\n\nconst buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) => {\n const { displayItems = [], filterBy } = shape;\n const { latProp, lonProp, entity } = entityGroup;\n const { actions, relations } = entityData;\n const action = actions ? actions.getAllPublished || actions.getAll : '';\n\n const dataSummaryProps = dataSummaries\n .reduce((acc, { propsToDisplay }) => {\n const propsToDisplayValues = flatten(\n propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay)\n );\n const propsToDisplayString = getPropValues(propsToDisplayValues);\n\n return `${acc} ${propsToDisplayString}`;\n }, '')\n .trim();\n const ids = [];\n displayItems.length ? ids.push(displayItems[0]) : ids.push(parentId);\n\n const filtersObject = buildFilters(filterBy);\n let propsQuery = dataSummaryProps ? `${dataSummaryProps}` : '';\n propsQuery = getUpdatedPropsQuery(propsQuery, entityData);\n if (latProp && lonProp) {\n propsQuery = `${propsQuery} ${formatProp(latProp, relations)} ${formatProp(\n lonProp,\n relations\n )}`;\n }\n if (ids.length && !propsQuery.includes(ID)) propsQuery = `${propsQuery.trim()} ${ID}`;\n\n return {\n shapeKey,\n entity,\n propsQuery,\n ids,\n action,\n filtersObject\n };\n};\n\nconst formatProp = (prop, relations = []) => {\n if (!prop.includes('.')) return prop;\n\n const [mainProp, nestedProp] = prop.split('.');\n const idProp = relations.find(({ localField }) => localField === mainProp) ? 'id ' : '';\n return `${mainProp}{${idProp}${nestedProp}}`;\n};\n\nconst buildShapesConfig = (schemas, entityGroups, parent) => {\n if (!schemas || !entityGroups) return [];\n const { itemId, itemEntity } = parent;\n const shapeGroups = [];\n entityGroups.forEach((entityGroup, i) => {\n const { entity, shapes, dataSummaries = [] } = entityGroup;\n const parentId = entity === itemEntity && itemId;\n if (!entity) return null;\n const entityData = schemas[entity] || {};\n\n shapes.filter(Boolean).forEach((shape, shapeIndex) => {\n const shapeKey = `shape${i}${shapeIndex}`;\n const shapeValues = buiildShapeProps(\n shape,\n shapeKey,\n dataSummaries,\n parentId,\n entityData,\n entityGroup\n );\n shapeGroups.push({ ...shapeValues, shapeOptions: shape, entityOptions: entityGroup });\n });\n });\n\n return shapeGroups;\n};\n\nexport default buildShapesConfig;\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAAoD,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAAC,OAAA,EAAAjB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAe,yBAAA,GAAAf,MAAA,CAAAgB,gBAAA,CAAAnB,CAAA,EAAAG,MAAA,CAAAe,yBAAA,CAAAhB,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAiB,cAAA,CAAApB,CAAA,EAAAC,CAAA,EAAAE,MAAA,CAAAK,wBAAA,CAAAN,CAAA,E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