@milemaker/milemaker-js 2.0.0-alpha.3 → 2.0.0-alpha.7

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 (78) hide show
  1. package/dist/actions/layer/trafficLayerActions.factory.d.ts +4 -1
  2. package/dist/actions/marker/createClusterMarkersAction.factory.d.ts +5 -0
  3. package/dist/actions/marker/index.d.ts +4 -1
  4. package/dist/actions/marker/types/markerActions.types.d.ts +133 -3
  5. package/dist/actions/popup/types/popupActions.types.d.ts +1 -1
  6. package/dist/actions/types/actions.types.d.ts +2 -1
  7. package/dist/actions/types/index.d.ts +1 -0
  8. package/dist/actions/weather/index.d.ts +46 -0
  9. package/dist/actions/weather/types/index.d.ts +1 -0
  10. package/dist/actions/weather/types/weather.types.d.ts +115 -0
  11. package/dist/actions/weather/weatherAlertsActions.factory.d.ts +6 -0
  12. package/dist/apis/aerisWeather/aerisWeather.api.d.ts +75 -0
  13. package/dist/apis/aerisWeather/aerisWeather.schemas.d.ts +454 -0
  14. package/dist/apis/aerisWeather/aerisWeather.selectors.d.ts +68 -0
  15. package/dist/apis/aerisWeather/aerisWeather.slice.d.ts +11 -0
  16. package/dist/apis/aerisWeather/aerisWeather.thunks.d.ts +12 -0
  17. package/dist/apis/aerisWeather/aerisWeather.types.d.ts +142 -0
  18. package/dist/apis/types.d.ts +1 -0
  19. package/dist/components/WeatherAlertIcon/WeatherAlertIcon.d.ts +3 -0
  20. package/dist/components/WeatherAlertIcon/WeatherAlertIcon.types.d.ts +17 -0
  21. package/dist/components/WeatherAlertIcon/WeatherAlertIconPopup.d.ts +24 -0
  22. package/dist/components/WeatherAlertIcon/index.d.ts +3 -0
  23. package/dist/components/WeatherLegend/RainSnowIceLegend/RainSnowIceLegend.types.d.ts +1 -0
  24. package/dist/components/WeatherLegend/WeatherAlertsLegend/WeatherAlertsLegend.types.d.ts +1 -0
  25. package/dist/components/WeatherLegend/WeatherLegend.types.d.ts +1 -0
  26. package/dist/components/WeatherLegend/WeatherTemperaturesLegend/WeatherTemperaturesLegend.types.d.ts +1 -0
  27. package/dist/components/WeatherLegend/WeatherWindSpeedsLegend/WeatherWindSpeedsLegend.types.d.ts +1 -0
  28. package/dist/components/index.d.ts +1 -0
  29. package/dist/controls/createOverlayLayerControl.factory.d.ts +2 -2
  30. package/dist/controls/createWeatherLayerControl.factory.d.ts +2 -2
  31. package/dist/controls/types/controls.types.d.ts +50 -5
  32. package/dist/controls/utils/index.d.ts +0 -1
  33. package/dist/controls/utils/weatherLayers.constants.d.ts +1 -2
  34. package/dist/controls/utils/weatherLayers.helpers.d.ts +1 -1
  35. package/dist/controls/utils/weatherLayers.rendering.d.ts +1 -1
  36. package/dist/createMap/createMap.d.ts +1 -1
  37. package/dist/helpers/parseLonLatLikeToCoordinates.helper.d.ts +2 -1
  38. package/dist/helpers/runAsyncThread.d.ts +30 -0
  39. package/dist/index.cjs +341 -260
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.esm-8a133e09.js +3081 -0
  42. package/dist/index.esm-8a133e09.js.map +1 -0
  43. package/dist/index.esm-e8122a0a.cjs +6 -0
  44. package/dist/index.esm-e8122a0a.cjs.map +1 -0
  45. package/dist/index.js +34452 -26452
  46. package/dist/index.js.map +1 -0
  47. package/dist/nmaps-gl-69f5266d.js +1 -0
  48. package/dist/nmaps-gl-69f5266d.js.map +1 -0
  49. package/dist/nmaps-gl-6afeae26.cjs +1 -0
  50. package/dist/nmaps-gl-6afeae26.cjs.map +1 -0
  51. package/dist/types/common.types.d.ts +7 -0
  52. package/dist/types/index.d.ts +1 -0
  53. package/dist/utils/apis/api.constants.d.ts +6 -0
  54. package/dist/utils/apis/api.types.d.ts +5 -0
  55. package/dist/utils/apis/logEvents.api.d.ts +37 -0
  56. package/dist/utils/apis/sdkEvents.api.d.ts +4 -0
  57. package/dist/utils/common.schemas.d.ts +9 -0
  58. package/dist/utils/constants.d.ts +15 -5
  59. package/dist/utils/helpers/compareLonLatLikesByDistanceKm.helper.d.ts +2 -0
  60. package/dist/utils/helpers/filterLonLatLikesByDistanceKm.helper.d.ts +6 -0
  61. package/dist/utils/helpers/getConvertedLength.helper.d.ts +12 -0
  62. package/dist/utils/helpers/getKmDistanceBetweenLonLatLike.helper.d.ts +8 -0
  63. package/dist/utils/helpers/httpHeader.helpers.d.ts +29 -0
  64. package/dist/utils/helpers/indexDBFactory.helper.d.ts +14 -0
  65. package/dist/utils/helpers/normalizeColor.helper.d.ts +17 -0
  66. package/dist/utils/helpers/prepareAppErrorMailToData.helper.d.ts +2 -2
  67. package/dist/utils/helpers/roundToDecimals.helper.d.ts +4 -0
  68. package/dist/utils/helpers/setUrlParameter.helper.d.ts +5 -0
  69. package/dist/utils/helpers/sourcemap.helpers.d.ts +14 -0
  70. package/dist/utils/helpers.d.ts +4 -0
  71. package/dist/utils/singletons/wasmFloat.polyfill.d.ts +9 -0
  72. package/dist/utils/singletons/wasmMath.singleton.d.ts +8 -0
  73. package/dist/utils/types.d.ts +22 -7
  74. package/dist/utils/version.d.ts +1 -1
  75. package/package.json +7 -2
  76. package/dist/controls/utils/weatherLayers.types.d.ts +0 -1
  77. package/dist/helpers/sdkEvents.helpers.d.ts +0 -4
  78. package/dist/utils/helpers/prepareContactSupportMandatoryFields.helper.d.ts +0 -4
@@ -1,3 +1,6 @@
1
+ import { GeneralAppSettings } from "../../types";
1
2
  import { CreateActionsFactory } from "../types";
2
3
  import { TrafficLayerActions } from "./types";
3
- export declare const trafficLayerActionsFactory: CreateActionsFactory<TrafficLayerActions>;
4
+ export declare const trafficLayerActionsFactory: CreateActionsFactory<TrafficLayerActions, {
5
+ generalAppSettings: GeneralAppSettings;
6
+ }>;
@@ -0,0 +1,5 @@
1
+ import { CreateActionsFactory, MarkerActions } from "../types";
2
+ export declare const createClusterMarkersActionFactory: CreateActionsFactory<MarkerActions["createClusterMarkers"], {
3
+ accessToken: string;
4
+ baseApiUrl: string;
5
+ }>;
@@ -1,3 +1,6 @@
1
1
  import { CreateActionsFactory } from "../types";
2
2
  import { MarkerActions } from "./types";
3
- export declare const markerActionsFactory: CreateActionsFactory<MarkerActions>;
3
+ export declare const markerActionsFactory: CreateActionsFactory<MarkerActions, {
4
+ accessToken: string;
5
+ baseApiUrl: string;
6
+ }>;
@@ -1,5 +1,5 @@
1
1
  import MapProvider from "../../../MapProvider";
2
- import { LonLatLike, Popup } from "../../../types";
2
+ import { Anchor, LonLatLike, Popup } from "../../../types";
3
3
  import { CreatePopupOptions, MapElement } from "../../types";
4
4
  /**
5
5
  * Marker instance
@@ -78,6 +78,11 @@ export type MarkerPopupOptions = {
78
78
  * Do toggle marker on click
79
79
  */
80
80
  toggleOnMarkerClick?: boolean;
81
+ /**
82
+ * Show popup on marker hover and hide on mouse leave
83
+ * @default false
84
+ */
85
+ toggleOnMarkerHover?: boolean;
81
86
  } & CreatePopupOptions;
82
87
  /**
83
88
  * Create marker options
@@ -95,6 +100,11 @@ export type CreateMarkerOptions = {
95
100
  * Do center on click
96
101
  */
97
102
  centerOnClick?: boolean;
103
+ /**
104
+ * Marker's anchor
105
+ * @default "bottom"
106
+ */
107
+ anchor?: Anchor;
98
108
  /**
99
109
  * Marker's popup options
100
110
  */
@@ -145,7 +155,7 @@ export type CreateMarkerOptions = {
145
155
  */
146
156
  onMouseLeave?(): void;
147
157
  } | void;
148
- } & Omit<MapProvider.MarkerOptions, "element">;
158
+ } & Omit<MapProvider.MarkerOptions, "element" | "anchor">;
149
159
  /**
150
160
  * Create stop marker options with predefined icon, and color.
151
161
  * @interface
@@ -172,7 +182,7 @@ export type CreateStopMarkerOptions = {
172
182
  * @group Actions
173
183
  * @category Marker
174
184
  */
175
- export type MarkersPopupOptions = Pick<MarkerPopupOptions, "toggleOnMarkerClick" | "showOnMount" | "hideOnClickOutside">;
185
+ export type MarkersPopupOptions = Pick<MarkerPopupOptions, "toggleOnMarkerClick" | "toggleOnMarkerHover" | "showOnMount" | "hideOnClickOutside">;
176
186
  /**
177
187
  * Create stop markers options
178
188
  * @interface
@@ -189,6 +199,121 @@ export type CreateStopMarkersOptions = Pick<CreateMarkerOptions, "color" | "show
189
199
  */
190
200
  getMarkerOptions?: (item: LonLatLike, index: number, array: LonLatLike[]) => Partial<CreateStopMarkerOptions>;
191
201
  };
202
+ /**
203
+ * Base interface for cluster marker items
204
+ * @interface
205
+ * @group Actions
206
+ * @category Marker
207
+ */
208
+ export type BaseClusterMarkerItem = {
209
+ /**
210
+ * Unique identifier for the item
211
+ */
212
+ id: string;
213
+ /**
214
+ * Coordinate of the item
215
+ */
216
+ lonLatLike: LonLatLike;
217
+ };
218
+ /**
219
+ * Cluster information with marker instance
220
+ * @interface
221
+ * @group Actions
222
+ * @category Marker
223
+ */
224
+ export type ClusterInfo<T extends BaseClusterMarkerItem = BaseClusterMarkerItem> = {
225
+ /**
226
+ * MapBox cluster ID (undefined for single points)
227
+ */
228
+ clusterId?: number;
229
+ /**
230
+ * Array of all items in this cluster
231
+ */
232
+ clusteredItems: T[];
233
+ /**
234
+ * Representative item for this cluster (middle item from clusteredItems)
235
+ */
236
+ clusterItem: T;
237
+ /**
238
+ * Coordinates where the cluster marker is placed
239
+ */
240
+ clusterLonLatLike: LonLatLike;
241
+ /**
242
+ * Marker instance for this cluster
243
+ */
244
+ clusterMarker: Marker | undefined;
245
+ };
246
+ /**
247
+ * Cluster markers instance
248
+ * @interface
249
+ * @group Actions
250
+ * @category Marker
251
+ */
252
+ export type ClusterMarkers<T extends BaseClusterMarkerItem = BaseClusterMarkerItem> = MapElement & {
253
+ /**
254
+ * Original items passed to createClusterMarkers
255
+ */
256
+ items: T[];
257
+ /**
258
+ * Get current clusters with their markers
259
+ */
260
+ getClusters(): ClusterInfo<T>[];
261
+ };
262
+ /**
263
+ * Create cluster markers options
264
+ * @interface
265
+ * @group Actions
266
+ * @category Marker
267
+ */
268
+ export type CreateClusterMarkersOptions<T extends BaseClusterMarkerItem = BaseClusterMarkerItem> = {
269
+ /**
270
+ * Array of items to cluster
271
+ */
272
+ items: T[];
273
+ /**
274
+ * Show markers on creation
275
+ * @default true
276
+ */
277
+ showAtMount?: boolean;
278
+ /**
279
+ * Do zoom on cluster click
280
+ * @default true
281
+ */
282
+ doZoomOnClick?: boolean;
283
+ /**
284
+ * Radius in pixels to cluster points
285
+ * @default 40
286
+ */
287
+ clusterRadius?: number;
288
+ /**
289
+ * Cluster item radius - size of invisible circle for clustering calculations
290
+ * @default 20
291
+ */
292
+ clusterItemRadius?: number;
293
+ /**
294
+ * Place cluster markers on existing item positions (middle item)
295
+ * @default true
296
+ */
297
+ doPlaceOnExistingItems?: boolean;
298
+ /**
299
+ * Create marker options for cluster or point
300
+ * @param cluster - Cluster information
301
+ */
302
+ createMarkerOptions(cluster: {
303
+ /**
304
+ * Coordinates where the cluster marker is placed
305
+ */
306
+ clusterLonLatLike: LonLatLike;
307
+ /**
308
+ * Representative item for this cluster (middle item)
309
+ */
310
+ clusterItem: T;
311
+ /**
312
+ * Array of all items in this cluster
313
+ */
314
+ clusteredItems: T[];
315
+ }): CreateMarkerOptions;
316
+ };
192
317
  /**
193
318
  * Marker actions
194
319
  * @interface
@@ -214,4 +339,9 @@ export type MarkerActions = {
214
339
  * @param options - Options to set
215
340
  */
216
341
  createStopMarkers(stops: LonLatLike[], options?: CreateStopMarkersOptions): Markers;
342
+ /**
343
+ * Create cluster markers with dynamic clustering
344
+ * @param options - Clustering options
345
+ */
346
+ createClusterMarkers<T extends BaseClusterMarkerItem = BaseClusterMarkerItem>(options: CreateClusterMarkersOptions<T>): ClusterMarkers<T>;
217
347
  };
@@ -111,7 +111,7 @@ export type CreatePopupOptions = {
111
111
  */
112
112
  onMount?(popup: Popup): void;
113
113
  };
114
- } & MapProvider.PopupOptions;
114
+ } & Omit<MapProvider.PopupOptions, "offset">;
115
115
  /**
116
116
  * Popup actions
117
117
  * @interface
@@ -3,6 +3,7 @@ import { MapLayerActions } from "../layer/types";
3
3
  import { MarkerActions } from "../marker/types";
4
4
  import { PopupActions } from "../popup/types";
5
5
  import { RouteActions } from "../route/types";
6
+ import { WeatherActions } from "../weather/types";
6
7
  import { ZoomActions } from "../zoom/types";
7
8
  /**
8
9
  * Basic map element
@@ -56,5 +57,5 @@ export type CreateActionsFactory<Return, AdditionalOptions = void> = (options: B
56
57
  * @interface
57
58
  * @group Actions
58
59
  */
59
- export type MapActions = ZoomActions & MapLayerActions & MarkerActions & PopupActions & RouteActions;
60
+ export type MapActions = ZoomActions & MapLayerActions & MarkerActions & PopupActions & RouteActions & WeatherActions;
60
61
  export {};
@@ -5,3 +5,4 @@ export * from "../marker/types";
5
5
  export * from "../popup/types";
6
6
  export * from "../route/types";
7
7
  export * from "../zoom/types";
8
+ export * from "../weather/types";
@@ -0,0 +1,46 @@
1
+ import { CreateActionsFactory } from "../types";
2
+ import { WeatherActions } from "./types";
3
+ /**
4
+ * Weather actions factory
5
+ *
6
+ * Creates weather-related actions for the map including weather alerts.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const weatherActions = weatherActionsFactory({
11
+ * map: mapInstance,
12
+ * accessToken: "your-access-token"
13
+ * });
14
+ *
15
+ * // Show weather alerts for a route with configuration
16
+ * await weatherActions.weatherAlertsActions.show(routeCoordinates, {
17
+ * strokeColor: "#9333EA",
18
+ * showAtMount: true,
19
+ * doZoomOnClick: true,
20
+ * clusterRadius: 60,
21
+ * createMarkerOptions: ({ clusteredItems, clusterItem }) => ({
22
+ * getHtmlIconElement: () => ({
23
+ * htmlElement: createCustomWeatherAlertIcon(clusterItem)
24
+ * }),
25
+ * popupOptions: {
26
+ * getHtmlContentElement: () => ({
27
+ * htmlElement: createCustomWeatherAlertPopup(clusteredItems)
28
+ * })
29
+ * }
30
+ * })
31
+ * });
32
+ *
33
+ * // Hide weather alerts
34
+ * weatherActions.weatherAlertsActions.hide();
35
+ *
36
+ * // Check visibility
37
+ * const isVisible = weatherActions.weatherAlertsActions.getIsVisible();
38
+ * ```
39
+ *
40
+ * @group Actions
41
+ * @category Weather
42
+ */
43
+ export declare const weatherActionsFactory: CreateActionsFactory<WeatherActions, {
44
+ baseApiUrl: string;
45
+ accessToken: string;
46
+ }>;
@@ -0,0 +1 @@
1
+ export * from "./weather.types";
@@ -0,0 +1,115 @@
1
+ import type { AerisWeatherResponseItemAlert, AlertResponseItemPerLonLatLike } from "../../../apis/aerisWeather/aerisWeather.types";
2
+ import type { LonLatLike } from "../../../types";
3
+ import type { BaseClusterMarkerItem, ClusterMarkers, CreateMarkerOptions } from "../../types";
4
+ /**
5
+ * Weather alert cluster item
6
+ *
7
+ * @group Actions
8
+ * @category Weather
9
+ */
10
+ export type WeatherAlertClusterItem = BaseClusterMarkerItem & {
11
+ /** Alert response data from Aeris API */
12
+ alertResponseItem: AerisWeatherResponseItemAlert;
13
+ };
14
+ /**
15
+ * Create weather alert cluster marker options
16
+ * @interface
17
+ * @group Actions
18
+ * @category Weather
19
+ */
20
+ export type CreateWeatherAlertClusterMarkerOptions = {
21
+ /**
22
+ * Array of all items in this cluster
23
+ */
24
+ clusteredItems: WeatherAlertClusterItem[];
25
+ /**
26
+ * Coordinates where the cluster marker is placed
27
+ */
28
+ clusterLonLatLike: LonLatLike;
29
+ /**
30
+ * Representative item for this cluster (middle item from clusteredItems)
31
+ */
32
+ clusterItem: WeatherAlertClusterItem;
33
+ };
34
+ /**
35
+ * Weather alerts options
36
+ * @interface
37
+ * @group Actions
38
+ * @category Weather
39
+ */
40
+ export type WeatherAlertsOptions = {
41
+ /**
42
+ * Function to create marker options for each cluster
43
+ */
44
+ createMarkerOptions?: (options: CreateWeatherAlertClusterMarkerOptions) => CreateMarkerOptions;
45
+ /**
46
+ * Stroke color for weather alert icon triangle border (hex format)
47
+ * @example "#FF0000"
48
+ * @default "#000000"
49
+ */
50
+ strokeColor?: string;
51
+ /**
52
+ * Show markers on mount
53
+ * @default true
54
+ */
55
+ showAtMount?: boolean;
56
+ /**
57
+ * Do zoom on cluster click
58
+ * @default true
59
+ */
60
+ doZoomOnClick?: boolean;
61
+ /**
62
+ * Cluster radius in pixels
63
+ * @default 40
64
+ */
65
+ clusterRadius?: number;
66
+ /**
67
+ * Cluster item radius - size of invisible circle for clustering calculations
68
+ * @default 20
69
+ */
70
+ clusterItemRadius?: number;
71
+ };
72
+ /**
73
+ * Weather alerts actions
74
+ * @interface
75
+ * @group Actions
76
+ * @category Weather
77
+ */
78
+ export type WeatherAlertsActions = {
79
+ /**
80
+ * Show weather alerts layer
81
+ * @param lonLatLikes - Array of coordinates along the route
82
+ * @param options - Optional options for weather alerts display
83
+ */
84
+ show(lonLatLikes: LonLatLike[], options?: WeatherAlertsOptions): Promise<void>;
85
+ /**
86
+ * Hide weather alerts layer
87
+ */
88
+ hide(): void;
89
+ /**
90
+ * Get is weather alerts layer visible
91
+ */
92
+ getIsVisible(): boolean;
93
+ /**
94
+ * Get cluster markers instance
95
+ */
96
+ getClusterMarkers(): ClusterMarkers<WeatherAlertClusterItem> | null;
97
+ /**
98
+ * Get weather alerts for given coordinates
99
+ * @param lonLatLikes - Array of coordinates to fetch alerts for
100
+ * @returns Promise resolving to array of alert items with alerts (filtered to only include items that have alerts)
101
+ */
102
+ getAlerts(lonLatLikes: LonLatLike[]): Promise<AlertResponseItemPerLonLatLike[]>;
103
+ };
104
+ /**
105
+ * Weather actions
106
+ * @interface
107
+ * @group Actions
108
+ * @category Weather
109
+ */
110
+ export type WeatherActions = {
111
+ /**
112
+ * Weather alerts actions
113
+ */
114
+ weatherAlertsActions: WeatherAlertsActions;
115
+ };
@@ -0,0 +1,6 @@
1
+ import { CreateActionsFactory } from "../types";
2
+ import { WeatherAlertsActions } from "./types";
3
+ export declare const weatherAlertsActionsFactory: CreateActionsFactory<WeatherAlertsActions, {
4
+ accessToken: string;
5
+ baseApiUrl: string;
6
+ }>;
@@ -0,0 +1,75 @@
1
+ import { LonLatLike } from "../../types";
2
+ export declare const aerisWeatherApi: {
3
+ getWeatherAlertsResponseItems: ({ lonLatLikes, baseApiUrl, accessToken }: {
4
+ lonLatLikes: LonLatLike[];
5
+ baseApiUrl: string;
6
+ accessToken: string;
7
+ }) => Promise<{
8
+ type: "Feature";
9
+ geometry: {
10
+ coordinates: [number, number];
11
+ type: "Point";
12
+ };
13
+ properties: {
14
+ request: {
15
+ id: string;
16
+ skipped: boolean;
17
+ success: boolean;
18
+ error: {
19
+ code: string;
20
+ description: string;
21
+ } | null;
22
+ };
23
+ response: {
24
+ id: string;
25
+ loc: {
26
+ lat: number;
27
+ long: number;
28
+ };
29
+ dataSource: string;
30
+ details: {
31
+ type: string;
32
+ name: string;
33
+ loc: string;
34
+ emergency: boolean;
35
+ priority: number;
36
+ color: string;
37
+ cat: string;
38
+ body: string;
39
+ bodyFull: string;
40
+ };
41
+ timestamps: {
42
+ issued: number;
43
+ issuedISO: string;
44
+ begins: number;
45
+ beginsISO: string;
46
+ expires: number;
47
+ expiresISO: string;
48
+ updated: number;
49
+ updateISO: string;
50
+ added: number;
51
+ addedISO: string;
52
+ created: number;
53
+ createdISO: string;
54
+ };
55
+ poly: string;
56
+ geoPoly: null;
57
+ includes: {
58
+ fips: string[];
59
+ counties: string[];
60
+ wxzones: string[];
61
+ zipcodes: string[];
62
+ };
63
+ place: {
64
+ name: string;
65
+ state: string;
66
+ country: string;
67
+ };
68
+ profile: {
69
+ tz: string;
70
+ };
71
+ active: boolean;
72
+ }[] | null;
73
+ };
74
+ }[]>;
75
+ };