awing-library 2.1.182-dev → 2.1.183-dev

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.
@@ -10,6 +10,15 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
13
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
24
  };
@@ -83,9 +92,12 @@ var AnalyticContainer = function (props) {
83
92
  campaignAdGroups: ids.length
84
93
  ? ids.map(function (id) { return (__assign(__assign({}, id), { campaignId: campaignId })); })
85
94
  : [{ campaignId: campaignId }],
86
- analyticGroupBies: Object.values(Enum_2.AnalyticGroupBy)
87
- .filter(function (g) { return !isNaN(Number(g)); })
88
- .map(function (g) { return Number(g); }),
95
+ analyticGroupBies: __spreadArray([
96
+ Enum_2.AnalyticGroupBy.GbEventLabel,
97
+ Enum_2.AnalyticGroupBy.GbTimeline,
98
+ Enum_2.AnalyticGroupBy.GbCampaignGroupId,
99
+ Enum_2.AnalyticGroupBy.GbCampaignAdId
100
+ ], statisticType ? [Enum_2.AnalyticGroupBy.GbPlaceId] : [], true),
89
101
  placeIds: placeIds,
90
102
  includedEventLabels: Object.values(Enum_1.BaseEvent),
91
103
  })
@@ -109,9 +121,13 @@ var AnalyticContainer = function (props) {
109
121
  campaignAdGroups: ids.length
110
122
  ? ids.map(function (id) { return (__assign(__assign({}, id), { campaignId: campaignId })); })
111
123
  : [{ campaignId: campaignId }],
112
- analyticGroupBies: Object.values(Enum_2.AnalyticGroupBy)
113
- .filter(function (g) { return !isNaN(Number(g)); })
114
- .map(function (g) { return Number(g); }),
124
+ analyticGroupBies: [
125
+ Enum_2.AnalyticGroupBy.GbEventLabel,
126
+ Enum_2.AnalyticGroupBy.GbTimeline,
127
+ Enum_2.AnalyticGroupBy.GbCampaignGroupId,
128
+ Enum_2.AnalyticGroupBy.GbCampaignAdId,
129
+ Enum_2.AnalyticGroupBy.GbPlaceId,
130
+ ],
115
131
  placeIds: placeIds,
116
132
  includedEventLabels: Object.values(Enum_1.BaseEvent),
117
133
  })
@@ -47,14 +47,13 @@ var material_1 = require("@mui/material");
47
47
  function SubCampaignDetail(props) {
48
48
  var t = (0, react_i18next_1.useTranslation)().t;
49
49
  var subCampaign = props.subCampaign, onSubCampaignChange = props.onSubCampaignChange, onChangeSubCampaignStatus = props.onChangeSubCampaignStatus;
50
- var _a = (0, react_1.useState)(subCampaign.bonusAmount), bonusAmount = _a[0], setBonusAmount = _a[1];
51
50
  var getFormValid = function () { return ({
52
51
  name: (0, Utils_1.nameValid)(subCampaign.name),
53
52
  bookingAmount: !(0, Utils_1.checkPriority)(subCampaign.priority, Enum_1.CampaignPriority.ClassB) || (0, Utils_1.bookingValid)(subCampaign.bookingAmount),
54
53
  bonusAmount: (0, Utils_1.bonusValid)(subCampaign.bonusAmount),
55
54
  billingUnit: subCampaign.billingUnit !== null,
56
55
  }); };
57
- var _b = react_1.default.useState(getFormValid), subValid = _b[0], setSubValid = _b[1];
56
+ var _a = react_1.default.useState(getFormValid), subValid = _a[0], setSubValid = _a[1];
58
57
  var isCreate = (0, recoil_1.useRecoilValue)(Recoils_1.isCreateState);
59
58
  (0, react_1.useEffect)(function () {
60
59
  onSubCampaignChange(function (prev) { return (0, lodash_1.cloneDeep)(prev); });
@@ -105,17 +104,15 @@ function SubCampaignDetail(props) {
105
104
  return newSubCamp;
106
105
  });
107
106
  }, children: Object.values(Enum_1.CampaignPriority).map(function (priority) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: priority, children: t("Campaign.".concat(priority)) }, priority)); }) }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, style: { padding: 8, paddingTop: 0 }, children: [(0, Utils_1.checkPriority)(subCampaign.priority, Enum_1.CampaignPriority.ClassB) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "bookingAmount", required: true, fullWidth: true, variant: "standard", type: "number", label: translationText.booking, value: subCampaign.bookingAmount, onChange: function (e) {
108
- onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { bookingAmount: Number(e.target.value) })); });
109
- setBonusAmount(Math.round(Number(e.target.value) * 0.05));
107
+ onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { bookingAmount: Number(e.target.value), bonusAmount: Math.round(Number(e.target.value) * 0.05) })); });
110
108
  }, onFocus: function (event) { return event.target.select(); }, error: subValid.bookingAmount !== undefined &&
111
109
  !subValid.bookingAmount, helperText: subValid.bookingAmount !== undefined &&
112
110
  !subValid.bookingAmount
113
111
  ? subCampaign.bookingAmount < 0
114
112
  ? translationText.notNegative
115
113
  : translationText.helperText
116
- : '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "bonusAmount", variant: "standard", fullWidth: true, type: "number", label: translationText.bonus, value: bonusAmount, onChange: function (e) {
114
+ : '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "bonusAmount", variant: "standard", fullWidth: true, type: "number", label: translationText.bonus, value: subCampaign.bonusAmount, onChange: function (e) {
117
115
  var value = Number(e.target.value);
118
- setBonusAmount(value);
119
116
  onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { bonusAmount: value })); });
120
117
  }, onFocus: function (event) { return event.target.select(); }, error: subValid.bonusAmount !== undefined &&
121
118
  !subValid.bonusAmount, helperText: subValid.bonusAmount !== undefined &&
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var jsx_runtime_1 = require("react/jsx-runtime");
7
- var material_1 = require("@mui/material");
8
- var react_i18next_1 = require("react-i18next");
9
7
  var PinDrop_1 = __importDefault(require("@mui/icons-material/PinDrop"));
8
+ var material_1 = require("@mui/material");
9
+ var AWING_1 = require("../../AWING");
10
10
  var react_1 = require("react");
11
- var GoongMap_1 = __importDefault(require("./GoongMap"));
12
- var common_1 = require("./common");
11
+ var react_i18next_1 = require("react-i18next");
13
12
  var constants_1 = require("../../constants");
13
+ var common_1 = require("./common");
14
14
  function Component(props) {
15
15
  var t = (0, react_i18next_1.useTranslation)().t;
16
16
  var label = props.label, configs = props.configs, marker = props.marker, radius = props.radius, locationString = props.locationString, onChange = props.onChange, onSearch = props.onSearch, onGoongMapSelect = props.onGoongMapSelect, limit = props.limit, isOnlyMap = props.isOnlyMap;
@@ -42,7 +42,7 @@ function Component(props) {
42
42
  !(0, common_1.validateGoogleMapLatLong)(locationString)) }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleShowMapChange, style: {
43
43
  position: "absolute",
44
44
  right: "12px",
45
- bottom: "5px",
45
+ bottom: "9px",
46
46
  }, size: "small", children: (0, jsx_runtime_1.jsx)(PinDrop_1.default, {}) })] }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 6, style: { paddingLeft: "8px" }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, label: t("PlaceFilter.Radius"), variant: "outlined", size: "small", placeholder: t("PlaceFilter.TypeRadius"), type: "number", value: radius, onChange: function (e) {
47
47
  if (!e.target.value.includes("-") &&
48
48
  Number(e.target.value) <=
@@ -55,6 +55,6 @@ function Component(props) {
55
55
  }
56
56
  }, error: !!(radius &&
57
57
  Number(radius) <
58
- ((limit === null || limit === void 0 ? void 0 : limit.min) || constants_1.MIN_RADIUS)) }) })] })), (isOnlyMap || showMap) && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { position: "relative", marginTop: "16px" }, children: (0, jsx_runtime_1.jsx)(GoongMap_1.default, { onAddPlace: onGoongMapSelect, marker: marker, configs: configs }) }))] })] }));
58
+ ((limit === null || limit === void 0 ? void 0 : limit.min) || constants_1.MIN_RADIUS)) }) })] })), (isOnlyMap || showMap) && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { position: "relative", marginTop: "16px" }, children: (0, jsx_runtime_1.jsx)(AWING_1.GoogleMap, { onUpdateLocation: onGoongMapSelect, apiKey: configs.GOOGLE_MAP_KEY, markerPosition: marker || undefined, geofenceRadius: radius ? Number(radius) : 0 }) }))] })] }));
59
59
  }
60
60
  exports.default = Component;
@@ -1,6 +1,5 @@
1
1
  export interface IConfig {
2
- GOONG_API_KEY: string;
3
- GOONG_MAP_KEY: string;
2
+ GOOGLE_MAP_KEY: string;
4
3
  }
5
4
  export interface GeoFencingValue {
6
5
  latitude?: number;
@@ -85,8 +85,7 @@ function FieldInputComponent(props) {
85
85
  return ((0, jsx_runtime_1.jsx)(GeoFencing_1.default, { initValue: filterField.value, onChange: function (value) {
86
86
  onChange(value, index);
87
87
  }, label: filterField.label, configs: {
88
- GOONG_API_KEY: (filterField === null || filterField === void 0 ? void 0 : filterField.GOONG_API_KEY) || "",
89
- GOONG_MAP_KEY: (filterField === null || filterField === void 0 ? void 0 : filterField.GOONG_MAP_KEY) || "",
88
+ GOOGLE_MAP_KEY: (filterField === null || filterField === void 0 ? void 0 : filterField.GOOGLE_MAP_KEY) || "",
90
89
  }, value: filterField.value, limit: filterField === null || filterField === void 0 ? void 0 : filterField.radiusLimit }));
91
90
  };
92
91
  var renderMultiSelect = function (filterField, index) {
@@ -62,6 +62,7 @@ export interface IGeoFencing extends IFilterFieldBase {
62
62
  } | undefined;
63
63
  GOONG_MAP_KEY: string;
64
64
  GOONG_API_KEY: string;
65
+ GOOGLE_MAP_KEY: string;
65
66
  radiusLimit?: {
66
67
  min?: number;
67
68
  max?: number;
@@ -371,8 +371,9 @@ var BasicDataForm = function (props) {
371
371
  case 'geo-fencing': {
372
372
  var geoProps = (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.GeoFencingProps) || {};
373
373
  currentField = ((0, jsx_runtime_1.jsx)("div", { style: { margin: '16px 0px' }, children: (0, jsx_runtime_1.jsx)(GeoFencing_1.default, __assign({ configs: {
374
- GOONG_API_KEY: '',
375
- GOONG_MAP_KEY: '',
374
+ // GOONG_API_KEY: '',
375
+ // GOONG_MAP_KEY: '',
376
+ GOOGLE_MAP_KEY: '',
376
377
  }, label: '' }, geoProps, { onChange: function (value) {
377
378
  return handleChange(fieldName, value ? value : null);
378
379
  } }), index) }, index));
@@ -0,0 +1,3 @@
1
+ import { IGoogleMapProps } from './interface';
2
+ declare const GGMap: ({ defaultLocation, onUpdateLocation, apiKey, markerPosition, geofenceRadius }: IGoogleMapProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default GGMap;
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var jsx_runtime_1 = require("react/jsx-runtime");
7
+ var material_1 = require("@mui/material");
8
+ var api_1 = require("@react-google-maps/api");
9
+ var lodash_1 = __importDefault(require("lodash"));
10
+ var react_1 = require("react");
11
+ var react_i18next_1 = require("react-i18next");
12
+ var mapContainerStyle = {
13
+ height: '320px',
14
+ width: '100%',
15
+ };
16
+ var libraries = ['places'];
17
+ var GGMap = function (_a) {
18
+ var _b, _c;
19
+ var defaultLocation = _a.defaultLocation, onUpdateLocation = _a.onUpdateLocation, apiKey = _a.apiKey, markerPosition = _a.markerPosition, geofenceRadius = _a.geofenceRadius;
20
+ var t = (0, react_i18next_1.useTranslation)().t;
21
+ var _d = (0, react_1.useState)(), map = _d[0], setMap = _d[1];
22
+ var _e = (0, react_1.useState)(''), error = _e[0], setError = _e[1];
23
+ var autocompleteRef = (0, react_1.useRef)(null);
24
+ var boxRef = (0, react_1.useRef)(null);
25
+ var _f = (0, react_1.useState)(15), zoom = _f[0], setZoom = _f[1];
26
+ var onLoad = function (autocomplete) {
27
+ autocompleteRef.current = autocomplete;
28
+ };
29
+ var onPlaceChanged = function () {
30
+ var _a, _b, _c, _d;
31
+ if (autocompleteRef.current !== null) {
32
+ var place = autocompleteRef.current.getPlace();
33
+ if (place.geometry) {
34
+ var newLat = (_b = (_a = place === null || place === void 0 ? void 0 : place.geometry) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.lat();
35
+ var newLng = (_d = (_c = place === null || place === void 0 ? void 0 : place.geometry) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.lng();
36
+ onUpdateLocation({
37
+ latitude: newLat !== null && newLat !== void 0 ? newLat : 0,
38
+ longitude: newLng !== null && newLng !== void 0 ? newLng : 0,
39
+ });
40
+ map === null || map === void 0 ? void 0 : map.panTo({ lat: newLat !== null && newLat !== void 0 ? newLat : 0, lng: newLng !== null && newLng !== void 0 ? newLng : 0 });
41
+ setZoom(18);
42
+ }
43
+ }
44
+ else {
45
+ console.log('Autocomplete is not loaded yet!');
46
+ }
47
+ };
48
+ var onLoadMap = function (mapInstance) {
49
+ setMap(mapInstance);
50
+ };
51
+ //Lấy geo fencing
52
+ // const getDistance = (
53
+ // lat1: number,
54
+ // lon1: number,
55
+ // lat2: number,
56
+ // lon2: number
57
+ // ) => {
58
+ // const R = 6371e3; // Radius of the Earth in meters
59
+ // const φ1 = (lat1 * Math.PI) / 180;
60
+ // const φ2 = (lat2 * Math.PI) / 180;
61
+ // const Δφ = ((lat2 - lat1) * Math.PI) / 180;
62
+ // const Δλ = ((lon2 - lon1) * Math.PI) / 180;
63
+ // const a =
64
+ // Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
65
+ // Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
66
+ // const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
67
+ // const distance = R * c; // Distance in meters
68
+ // return distance;
69
+ // };
70
+ //Lấy vị trí hiện tại của người dùng
71
+ var getCurrentLocation = function () {
72
+ var handleLocationGeoFencing = function (position) {
73
+ var userLat = position.coords.latitude;
74
+ var userLng = position.coords.longitude;
75
+ // const distance = getDistance(
76
+ // userLat,
77
+ // userLng,
78
+ // markerPosition.lat,
79
+ // markerPosition.lng
80
+ // );
81
+ // console.log("distance", distance);
82
+ };
83
+ var showPosition = function (position) {
84
+ handleLocationGeoFencing(position);
85
+ onUpdateLocation({
86
+ latitude: position.coords.latitude,
87
+ longitude: position.coords.longitude,
88
+ });
89
+ };
90
+ var showError = function (error) {
91
+ switch (error.code) {
92
+ case error.PERMISSION_DENIED:
93
+ setError('User denied the request for Geolocation.');
94
+ break;
95
+ case error.POSITION_UNAVAILABLE:
96
+ setError('Location information is unavailable.');
97
+ break;
98
+ case error.TIMEOUT:
99
+ setError('The request to get user location timed out.');
100
+ break;
101
+ default:
102
+ setError('An unknown error occurred.');
103
+ break;
104
+ }
105
+ };
106
+ if (navigator.geolocation) {
107
+ navigator.geolocation.getCurrentPosition(showPosition, showError);
108
+ }
109
+ else {
110
+ setError('Geolocation is not supported by this browser.');
111
+ }
112
+ };
113
+ var onMapClick = function (e) {
114
+ var _a, _b, _c, _d;
115
+ onUpdateLocation({
116
+ latitude: (_b = (_a = e === null || e === void 0 ? void 0 : e.latLng) === null || _a === void 0 ? void 0 : _a.lat()) !== null && _b !== void 0 ? _b : 0,
117
+ longitude: (_d = (_c = e === null || e === void 0 ? void 0 : e.latLng) === null || _c === void 0 ? void 0 : _c.lng()) !== null && _d !== void 0 ? _d : 0,
118
+ });
119
+ };
120
+ (0, react_1.useEffect)(function () {
121
+ if (lodash_1.default.isNil(defaultLocation) || defaultLocation.lat === 0 || defaultLocation.lng === 0) {
122
+ getCurrentLocation();
123
+ }
124
+ }, [defaultLocation]);
125
+ var marker = { lat: (_b = Number(markerPosition === null || markerPosition === void 0 ? void 0 : markerPosition.latitude)) !== null && _b !== void 0 ? _b : 0, lng: (_c = Number(markerPosition === null || markerPosition === void 0 ? void 0 : markerPosition.longitude)) !== null && _c !== void 0 ? _c : 0 };
126
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
127
+ position: 'relative',
128
+ '& .pac-container.pac-logo': {
129
+ top: "55px!important",
130
+ left: "0!important",
131
+ }
132
+ }, ref: boxRef, children: (0, jsx_runtime_1.jsxs)(api_1.LoadScript, { googleMapsApiKey: apiKey || '', libraries: libraries, children: [(0, jsx_runtime_1.jsx)(api_1.Autocomplete, { onPlaceChanged: onPlaceChanged, onLoad: onLoad, children: (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: t('Common.PlaceHolderLocation'), onFocus: function () {
133
+ var _a;
134
+ var ggSuggest = document.querySelector('.pac-container.pac-logo');
135
+ if (ggSuggest) {
136
+ (_a = boxRef.current) === null || _a === void 0 ? void 0 : _a.append(ggSuggest);
137
+ }
138
+ }, style: {
139
+ boxSizing: "border-box",
140
+ border: "1px solid transparent",
141
+ width: "378px",
142
+ height: "40px",
143
+ padding: "0 12px",
144
+ borderRadius: "3px",
145
+ boxShadow: "0 2px 6px rgba(0, 0, 0, 0.3)",
146
+ fontSize: "14px",
147
+ outline: "none",
148
+ textOverflow: "ellipses",
149
+ position: 'inherit',
150
+ right: '3%',
151
+ margin: '10px 0',
152
+ zIndex: 99,
153
+ top: '50px',
154
+ } }) }), (0, jsx_runtime_1.jsx)(api_1.GoogleMap, { id: "map", mapContainerStyle: mapContainerStyle, zoom: zoom, center: marker, onLoad: onLoadMap, onClick: onMapClick, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(api_1.Marker, { position: marker }), (0, jsx_runtime_1.jsx)(api_1.Circle, { center: marker, radius: geofenceRadius, options: {
155
+ fillColor: 'red',
156
+ fillOpacity: 0.2,
157
+ strokeColor: 'red',
158
+ strokeOpacity: 1,
159
+ strokeWeight: 2,
160
+ } })] }) })] }) }));
161
+ };
162
+ exports.default = GGMap;
@@ -0,0 +1,4 @@
1
+ import { IGoogleMapProps } from "./interface";
2
+ export declare function GoogleMap(props: IGoogleMapProps): import("react/jsx-runtime").JSX.Element;
3
+ export default GoogleMap;
4
+ export * from "./interface";
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ var __importDefault = (this && this.__importDefault) || function (mod) {
28
+ return (mod && mod.__esModule) ? mod : { "default": mod };
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.GoogleMap = void 0;
32
+ var jsx_runtime_1 = require("react/jsx-runtime");
33
+ var i18n_1 = __importDefault(require("../../i18n"));
34
+ var react_i18next_1 = require("react-i18next");
35
+ var GGMap_1 = __importDefault(require("./GGMap"));
36
+ function GoogleMap(props) {
37
+ return ((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, { i18n: i18n_1.default, children: (0, jsx_runtime_1.jsx)(GGMap_1.default, __assign({}, props)) }));
38
+ }
39
+ exports.GoogleMap = GoogleMap;
40
+ exports.default = GoogleMap;
41
+ __exportStar(require("./interface"), exports);
@@ -0,0 +1,16 @@
1
+ export interface IGoogleMapProps {
2
+ defaultLocation?: {
3
+ lat: number;
4
+ lng: number;
5
+ };
6
+ markerPosition?: {
7
+ latitude: number;
8
+ longitude: number;
9
+ };
10
+ onUpdateLocation: (newValue: {
11
+ latitude: number;
12
+ longitude: number;
13
+ }) => void;
14
+ apiKey: string;
15
+ geofenceRadius?: number;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -32,3 +32,4 @@ export * from './TreeItemWithAction';
32
32
  export * from './constants';
33
33
  export * from './LogicExpression';
34
34
  export * from './Chart';
35
+ export * from './GoogleMap';
@@ -48,3 +48,4 @@ __exportStar(require("./TreeItemWithAction"), exports);
48
48
  __exportStar(require("./constants"), exports);
49
49
  __exportStar(require("./LogicExpression"), exports);
50
50
  __exportStar(require("./Chart"), exports);
51
+ __exportStar(require("./GoogleMap"), exports);
@@ -37,15 +37,17 @@ function notNullValid(value) {
37
37
  }
38
38
  exports.notNullValid = notNullValid;
39
39
  function dateValid(value) {
40
- return Boolean(value && (value === null || value === void 0 ? void 0 : value.getFullYear()) > 1000 && (0, moment_1.default)(value).isValid());
40
+ if (value instanceof Date)
41
+ return Boolean((value === null || value === void 0 ? void 0 : value.getFullYear()) > 1000 && (0, moment_1.default)(value).isValid());
42
+ return false;
41
43
  }
42
44
  exports.dateValid = dateValid;
43
45
  function dateRangeValid(value) {
44
46
  return (value !== undefined &&
45
47
  value !== null &&
46
48
  value.length === 2 &&
47
- dateValid(value[0]) &&
48
- dateValid(value[1]) &&
49
+ dateValid((0, moment_1.default)(value[0]).toDate()) &&
50
+ dateValid((0, moment_1.default)(value[1]).toDate()) &&
49
51
  value[0] !== undefined &&
50
52
  value[0] !== null &&
51
53
  value[1] !== undefined &&
@@ -51,6 +51,7 @@
51
51
  },
52
52
  "ChangeLanguage": "Change language",
53
53
  "UserProfile": "User profile",
54
+ "PlaceHolderLocation": "Enter a location ...",
54
55
  "Save": "Save",
55
56
  "Add": "Add",
56
57
  "Cancel": "Cancel",
@@ -46,6 +46,7 @@
46
46
  "Save": "Lưu",
47
47
  "Name": "Tên",
48
48
  "UserGroupUser": "Người dùng/Nhóm",
49
+ "PlaceHolderLocation": "Nhập địa chỉ ...",
49
50
  "Gender": {
50
51
  "Title": "Giới tính",
51
52
  "Gender_0": "Nữ",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.182-dev",
3
+ "version": "2.1.183-dev",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -28,6 +28,7 @@
28
28
  "@mui/styles": "^5.14.14",
29
29
  "@mui/x-date-pickers": "6.18.1",
30
30
  "@mui/x-tree-view": "^6.17.0",
31
+ "@react-google-maps/api": "^2.19.3",
31
32
  "@testing-library/jest-dom": "^6.1.4",
32
33
  "@testing-library/react": "^14.0.0",
33
34
  "@testing-library/user-event": "^14.5.1",
@@ -37,12 +38,14 @@
37
38
  "@types/node": "^20.8.8",
38
39
  "@types/react": "^18.2.31",
39
40
  "@types/react-dom": "^18.2.14",
41
+ "@vis.gl/react-google-maps": "^1.1.0",
40
42
  "aphrodite": "^2.4.0",
41
43
  "chart.js": "^4.4.3",
42
44
  "chartjs-adapter-moment": "^1.0.1",
43
45
  "clsx": "^2.1.1",
44
46
  "concurrently": "^8.2.2",
45
47
  "dayjs": "^1.11.10",
48
+ "dotenv": "^16.4.5",
46
49
  "enzyme": "^3.11.0",
47
50
  "faker": "^6.6.6",
48
51
  "file-saver": "^2.0.5",