ordering-ui-admin-external 1.45.14 → 1.45.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/{ordering-ui-admin.78afa1e4be0069666f19.js → ordering-ui-admin.fe65e52f55e5e87dc919.js} +2 -2
- package/_modules/components/BusinessIntelligence/AnalyticsMap/index.js +12 -6
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/AnalyticsMap/index.js +15 -4
- /package/_bundles/{ordering-ui-admin.78afa1e4be0069666f19.js.LICENSE.txt → ordering-ui-admin.fe65e52f55e5e87dc919.js.LICENSE.txt} +0 -0
|
@@ -21,7 +21,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
21
21
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
22
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
23
23
|
var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
|
|
24
|
-
var
|
|
24
|
+
var _configState$configs, _configState$configs2, _configState$configs3, _configState$configs4, _theme$images;
|
|
25
25
|
var locationList = props.locationList;
|
|
26
26
|
var _useConfig = (0, _orderingComponentsAdminExternal.useConfig)(),
|
|
27
27
|
_useConfig2 = _slicedToArray(_useConfig, 1),
|
|
@@ -35,8 +35,8 @@ var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
|
|
|
35
35
|
isHeat = _useState2[0],
|
|
36
36
|
setIsHeat = _useState2[1];
|
|
37
37
|
var defaultCenter = {
|
|
38
|
-
lat:
|
|
39
|
-
lng:
|
|
38
|
+
lat: Number((_configState$configs = configState.configs) === null || _configState$configs === void 0 || (_configState$configs = _configState$configs.location_default_latitude) === null || _configState$configs === void 0 ? void 0 : _configState$configs.value) || 40.77473399999999,
|
|
39
|
+
lng: Number((_configState$configs2 = configState.configs) === null || _configState$configs2 === void 0 || (_configState$configs2 = _configState$configs2.location_default_longitude) === null || _configState$configs2 === void 0 ? void 0 : _configState$configs2.value) || -73.9653844
|
|
40
40
|
};
|
|
41
41
|
var googleMapsControls = {
|
|
42
42
|
defaultZoom: 15,
|
|
@@ -50,6 +50,9 @@ var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
|
|
|
50
50
|
mapTypeIds: ['roadmap', 'satellite']
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
var validLocations = locationList !== null && locationList !== void 0 && locationList.locations && Array.isArray(locationList.locations) ? locationList.locations.filter(function (location) {
|
|
54
|
+
return location && typeof location.lat !== 'undefined' && typeof location.lng !== 'undefined' && !isNaN(Number(location.lat)) && !isNaN(Number(location.lng));
|
|
55
|
+
}) : [];
|
|
53
56
|
(0, _react.useEffect)(function () {
|
|
54
57
|
setIsHeat(false);
|
|
55
58
|
}, [locationList]);
|
|
@@ -58,15 +61,18 @@ var AnalyticsMap = exports.AnalyticsMap = function AnalyticsMap(props) {
|
|
|
58
61
|
}) : /*#__PURE__*/_react.default.createElement(_styles.WrapperMap, null, (configState === null || configState === void 0 || (_configState$configs3 = configState.configs) === null || _configState$configs3 === void 0 || (_configState$configs3 = _configState$configs3.google_maps_api_key) === null || _configState$configs3 === void 0 ? void 0 : _configState$configs3.value) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.GoogleMapsMap, {
|
|
59
62
|
apiKey: configState === null || configState === void 0 || (_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 || (_configState$configs4 = _configState$configs4.google_maps_api_key) === null || _configState$configs4 === void 0 ? void 0 : _configState$configs4.value,
|
|
60
63
|
location: defaultCenter,
|
|
61
|
-
locations:
|
|
64
|
+
locations: validLocations,
|
|
62
65
|
mapControls: googleMapsControls,
|
|
63
66
|
isHeatMap: true,
|
|
64
67
|
isHeat: isHeat,
|
|
65
|
-
markerIcon: theme === null || theme === void 0 || (_theme$images = theme.images) === null || _theme$images === void 0 || (_theme$images = _theme$images.icons) === null || _theme$images === void 0 ? void 0 : _theme$images.mapMarker
|
|
68
|
+
markerIcon: theme === null || theme === void 0 || (_theme$images = theme.images) === null || _theme$images === void 0 || (_theme$images = _theme$images.icons) === null || _theme$images === void 0 ? void 0 : _theme$images.mapMarker,
|
|
69
|
+
onError: function onError(error) {
|
|
70
|
+
return console.error('Google Maps error:', error);
|
|
71
|
+
}
|
|
66
72
|
}), /*#__PURE__*/_react.default.createElement(_styles2.Button, {
|
|
67
73
|
borderRadius: "7.6px",
|
|
68
74
|
color: "primary",
|
|
69
|
-
disabled: locationList.loading,
|
|
75
|
+
disabled: locationList.loading || validLocations.length === 0,
|
|
70
76
|
onClick: function onClick() {
|
|
71
77
|
return setIsHeat(!isHeat);
|
|
72
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-admin-external",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.15",
|
|
4
4
|
"description": "Ordering UI Admin Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lodash": "^4.17.20",
|
|
84
84
|
"moment": "^2.29.1",
|
|
85
85
|
"moment-range": "^4.0.2",
|
|
86
|
-
"ordering-components-admin-external": "1.43.
|
|
86
|
+
"ordering-components-admin-external": "1.43.69",
|
|
87
87
|
"polished": "^3.6.7",
|
|
88
88
|
"prop-types": "^15.7.2",
|
|
89
89
|
"react-big-calendar": "^1.4.2",
|
|
@@ -18,8 +18,8 @@ export const AnalyticsMap = (props) => {
|
|
|
18
18
|
const [isHeat, setIsHeat] = useState(false)
|
|
19
19
|
|
|
20
20
|
const defaultCenter = {
|
|
21
|
-
lat: Number(configState.configs?.location_default_latitude?.value)
|
|
22
|
-
lng: Number(configState.configs?.location_default_longitude?.value)
|
|
21
|
+
lat: Number(configState.configs?.location_default_latitude?.value) || 40.77473399999999,
|
|
22
|
+
lng: Number(configState.configs?.location_default_longitude?.value) || -73.9653844
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const googleMapsControls = {
|
|
@@ -34,6 +34,16 @@ export const AnalyticsMap = (props) => {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const validLocations = locationList?.locations && Array.isArray(locationList.locations)
|
|
38
|
+
? locationList.locations.filter(location =>
|
|
39
|
+
location &&
|
|
40
|
+
typeof location.lat !== 'undefined' &&
|
|
41
|
+
typeof location.lng !== 'undefined' &&
|
|
42
|
+
!isNaN(Number(location.lat)) &&
|
|
43
|
+
!isNaN(Number(location.lng))
|
|
44
|
+
)
|
|
45
|
+
: []
|
|
46
|
+
|
|
37
47
|
useEffect(() => {
|
|
38
48
|
setIsHeat(false)
|
|
39
49
|
}, [locationList])
|
|
@@ -50,16 +60,17 @@ export const AnalyticsMap = (props) => {
|
|
|
50
60
|
<GoogleMapsMap
|
|
51
61
|
apiKey={configState?.configs?.google_maps_api_key?.value}
|
|
52
62
|
location={defaultCenter}
|
|
53
|
-
locations={
|
|
63
|
+
locations={validLocations}
|
|
54
64
|
mapControls={googleMapsControls}
|
|
55
65
|
isHeatMap
|
|
56
66
|
isHeat={isHeat}
|
|
57
67
|
markerIcon={theme?.images?.icons?.mapMarker}
|
|
68
|
+
onError={(error) => console.error('Google Maps error:', error)}
|
|
58
69
|
/>
|
|
59
70
|
<Button
|
|
60
71
|
borderRadius='7.6px'
|
|
61
72
|
color='primary'
|
|
62
|
-
disabled={locationList.loading}
|
|
73
|
+
disabled={locationList.loading || validLocations.length === 0}
|
|
63
74
|
onClick={() => setIsHeat(!isHeat)}
|
|
64
75
|
>
|
|
65
76
|
{isHeat ? t('GROUPED', 'Grouped') : t('HEATMAP', 'Heatmap')}
|