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

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 (54) hide show
  1. package/dist/actions/layer/trafficLayerActions.factory.d.ts +4 -1
  2. package/dist/actions/marker/createClusterMarkersAction.factory.d.ts +2 -0
  3. package/dist/actions/marker/types/markerActions.types.d.ts +133 -3
  4. package/dist/actions/popup/types/popupActions.types.d.ts +1 -1
  5. package/dist/actions/types/actions.types.d.ts +2 -1
  6. package/dist/actions/types/index.d.ts +1 -0
  7. package/dist/actions/weather/index.d.ts +46 -0
  8. package/dist/actions/weather/types/index.d.ts +1 -0
  9. package/dist/actions/weather/types/weather.types.d.ts +115 -0
  10. package/dist/actions/weather/weatherAlertsActions.factory.d.ts +6 -0
  11. package/dist/apis/aerisWeather/aerisWeather.api.d.ts +75 -0
  12. package/dist/apis/aerisWeather/aerisWeather.schemas.d.ts +454 -0
  13. package/dist/apis/aerisWeather/aerisWeather.selectors.d.ts +68 -0
  14. package/dist/apis/aerisWeather/aerisWeather.slice.d.ts +18 -0
  15. package/dist/apis/aerisWeather/aerisWeather.thunks.d.ts +12 -0
  16. package/dist/apis/aerisWeather/aerisWeather.types.d.ts +142 -0
  17. package/dist/apis/types.d.ts +1 -0
  18. package/dist/components/WeatherAlertIcon/WeatherAlertIcon.d.ts +3 -0
  19. package/dist/components/WeatherAlertIcon/WeatherAlertIcon.types.d.ts +17 -0
  20. package/dist/components/WeatherAlertIcon/WeatherAlertIconPopup.d.ts +24 -0
  21. package/dist/components/WeatherAlertIcon/index.d.ts +3 -0
  22. package/dist/components/index.d.ts +1 -0
  23. package/dist/controls/createOverlayLayerControl.factory.d.ts +2 -2
  24. package/dist/controls/createWeatherLayerControl.factory.d.ts +2 -2
  25. package/dist/controls/types/controls.types.d.ts +50 -5
  26. package/dist/controls/utils/index.d.ts +0 -1
  27. package/dist/controls/utils/weatherLayers.constants.d.ts +1 -2
  28. package/dist/controls/utils/weatherLayers.helpers.d.ts +1 -1
  29. package/dist/controls/utils/weatherLayers.rendering.d.ts +1 -1
  30. package/dist/helpers/parseLonLatLikeToCoordinates.helper.d.ts +2 -1
  31. package/dist/helpers/runAsyncThread.d.ts +30 -0
  32. package/dist/index.cjs +343 -262
  33. package/dist/index.esm-8a133e09.js +3080 -0
  34. package/dist/index.esm-e8122a0a.cjs +5 -0
  35. package/dist/index.js +37004 -28019
  36. package/dist/types/common.types.d.ts +7 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/utils/common.schemas.d.ts +9 -0
  39. package/dist/utils/constants.d.ts +12 -1
  40. package/dist/utils/helpers/compareLonLatLikesByDistanceKm.helper.d.ts +2 -0
  41. package/dist/utils/helpers/filterLonLatLikesByDistanceKm.helper.d.ts +6 -0
  42. package/dist/utils/helpers/getConvertedLength.helper.d.ts +12 -0
  43. package/dist/utils/helpers/getKmDistanceBetweenLonLatLike.helper.d.ts +8 -0
  44. package/dist/utils/helpers/indexDBFactory.helper.d.ts +14 -0
  45. package/dist/utils/helpers/normalizeColor.helper.d.ts +17 -0
  46. package/dist/utils/helpers/roundToDecimals.helper.d.ts +4 -0
  47. package/dist/utils/helpers/setUrlParameter.helper.d.ts +5 -0
  48. package/dist/utils/helpers.d.ts +4 -0
  49. package/dist/utils/singletons/wasmFloat.polyfill.d.ts +9 -0
  50. package/dist/utils/singletons/wasmMath.singleton.d.ts +8 -0
  51. package/dist/utils/types.d.ts +22 -0
  52. package/dist/utils/version.d.ts +1 -1
  53. package/package.json +5 -2
  54. package/dist/controls/utils/weatherLayers.types.d.ts +0 -1
@@ -70,3 +70,10 @@ export type GeneralAppSettings = {
70
70
  */
71
71
  units: UnitsFormat;
72
72
  };
73
+ /**
74
+ * Anchor position
75
+ * @type
76
+ * @group Common
77
+ * @category Types
78
+ */
79
+ export type Anchor = "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
@@ -2,4 +2,5 @@ export * from "./common.types";
2
2
  export * from "./common.enums";
3
3
  export type * from "../createMap/types";
4
4
  export type * from "../actions/types";
5
+ export type * from "../apis/types";
5
6
  export type * from "../controls/types";
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ export declare const LonLatTupleSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
3
+ /**
4
+ * LongLatSchema
5
+ */
6
+ export declare const LongLatSchema: z.ZodObject<{
7
+ lat: z.ZodNumber;
8
+ long: z.ZodNumber;
9
+ }, z.core.$strip>;
@@ -1,4 +1,4 @@
1
- import { Env } from "./types";
1
+ import { Env, LengthUnit, Rate } from "./types";
2
2
  export declare const PROXY_ENVS: Record<string, Env>;
3
3
  export declare const MILE_MAKER_API_ENVS: Record<Env, string>;
4
4
  export declare const MILE_MAKER_APP_ENVS: Record<Env, string>;
@@ -48,3 +48,14 @@ export declare const MEASURE_UNITS_LABELS: {
48
48
  };
49
49
  export declare const EMAIL_SUBJECT_LENGTH_LIMITATION = 255;
50
50
  export declare const EMAIL_BODY_LENGTH_LIMITATION = 2000;
51
+ export declare const IndexedDB: IDBFactory;
52
+ /**
53
+ * This is a MAIN_LENGTH_UNIT constant that contains the distance unit supported by the backend when making requests
54
+ * Takes part in imperial/metric conversion when the user selects non-imperial units in app settings
55
+ */
56
+ export declare const MAIN_LENGTH_UNIT = LengthUnit.MILES;
57
+ /**
58
+ * This is LENGTH_UNITS_RATES and VOLUME_UNITS_RATES constants
59
+ * Сontain a coefficient for converting the value in both directions
60
+ */
61
+ export declare const LENGTH_UNITS_RATES: Rate<LengthUnit>;
@@ -0,0 +1,2 @@
1
+ import { LonLatLike } from "../../types";
2
+ export declare const compareLonLatLikesByDistanceKm: (leftLonLatLike: LonLatLike, rightLonLatLike: LonLatLike, distanceKm?: number) => boolean;
@@ -0,0 +1,6 @@
1
+ import { LonLatLike } from "../../types";
2
+ export declare const filterLonLatLikesByDistanceKm: (lonLatLikes: (LonLatLike | undefined | null)[], minDistance: number, { startOffsetKm, endOffsetKm }?: {
3
+ startOffsetKm?: number | undefined;
4
+ endOffsetKm?: number | undefined;
5
+ }) => LonLatLike[];
6
+ export declare const removeByOffsetKm: (lonLatLikes: LonLatLike[], direction: "right" | "left", offset: number) => LonLatLike[];
@@ -0,0 +1,12 @@
1
+ import { LengthUnit, Nillable } from "../types";
2
+ /** The function is needed to get a converted length value
3
+ * @param {Nillable<string | number>} value - Source value, length
4
+ * @param {LengthUnit} originUnit - Origin unit
5
+ * @param {LengthUnit} targetUnit - Target unit
6
+ * @returns {number} - Converted length number
7
+ */
8
+ export declare const getConvertedLength: ({ value, originUnit, targetUnit }: {
9
+ value: Nillable<string | number>;
10
+ targetUnit: LengthUnit;
11
+ originUnit?: LengthUnit | undefined;
12
+ }) => number;
@@ -0,0 +1,8 @@
1
+ import { LonLatLike } from "../../types";
2
+ /**
3
+ * This helper calculates the distance between two lon lat coordinates in kilometers
4
+ * @param {LonLatLike} firstLonLatLike The first coordinate
5
+ * @param {LonLatLike} secondLonLatLike The second coordinate
6
+ * @returns {number} Distance in km
7
+ */
8
+ export declare const getKmDistanceBetweenLonLatLike: (firstLonLatLike: LonLatLike, secondLonLatLike: LonLatLike) => number;
@@ -0,0 +1,14 @@
1
+ import { IndexDBName } from "../types";
2
+ interface IndexDB {
3
+ get<T>(key: IDBValidKey): Promise<T | undefined>;
4
+ get<T>(): Promise<T | undefined>;
5
+ save<T>(key: IDBValidKey, value: T): Promise<IDBValidKey>;
6
+ save<T>(value: T): Promise<IDBValidKey>;
7
+ update<T>(key: IDBValidKey, value: Partial<T>): Promise<IDBValidKey>;
8
+ update<T>(value: Partial<T>): Promise<IDBValidKey>;
9
+ remove(key: IDBValidKey): Promise<void>;
10
+ remove(): Promise<void>;
11
+ deleteDatabase(): void;
12
+ }
13
+ export declare const indexDBFactory: (databaseName: IndexDBName) => Promise<IndexDB>;
14
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Normalizes a color string to a valid color format
3
+ *
4
+ * @param color - Color string to normalize (hex, rgb, rgba, or CSS color name)
5
+ * @returns Normalized color string (hex or rgba format)
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * normalizeColor("orange"); // "#ffa500"
10
+ * normalizeColor("#fff"); // "#fff"
11
+ * normalizeColor("000000"); // "#000000"
12
+ * normalizeColor("rgba(0, 0, 0, 0.5)"); // "rgba(0, 0, 0, 0.5)"
13
+ * normalizeColor("invalid"); // "#000000"
14
+ * normalizeColor(undefined); // "#000000"
15
+ * ```
16
+ */
17
+ export declare const normalizeColor: (color?: string) => string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Round a number to specified decimal places
3
+ */
4
+ export declare const roundToDecimals: (num: number, decimals?: number) => number;
@@ -0,0 +1,5 @@
1
+ export declare const setUrlParameter: ({ stringUrl, key, value }: {
2
+ stringUrl: string | undefined;
3
+ key: string;
4
+ value: string;
5
+ }) => string;
@@ -1,2 +1,6 @@
1
1
  export declare const getCurrentMileMakerApiEnv: (proxyEnv: string) => string;
2
2
  export declare const getCurrentMileMakerAppEnv: (proxyEnv: string) => string;
3
+ /**
4
+ * Clears mapSdk cache, mostly browser one to avoid overloading the Browser API.
5
+ */
6
+ export declare const clearCache: () => Promise<void>;
@@ -0,0 +1,9 @@
1
+ export declare class WasmFloatPolyfill {
2
+ private _value;
3
+ constructor(value: number | WasmFloatPolyfill);
4
+ add(value: WasmFloatPolyfill): this;
5
+ sub(value: WasmFloatPolyfill): this;
6
+ mul(value: WasmFloatPolyfill): this;
7
+ div(value: WasmFloatPolyfill): this;
8
+ valueOf(): number;
9
+ }
@@ -0,0 +1,8 @@
1
+ import { CalculateTypeWithDestroy } from "gmp-wasm";
2
+ export declare class WasmMathSingleton {
3
+ private static _instance;
4
+ static get Float(): CalculateTypeWithDestroy["Float"] | undefined;
5
+ static get get(): CalculateTypeWithDestroy | undefined;
6
+ static onWasmUnsupported(): void;
7
+ static set(config: CalculateTypeWithDestroy): void;
8
+ }
@@ -16,3 +16,25 @@ export declare enum Mail {
16
16
  SUPPORT = "support@milemaker.com",
17
17
  SALES = "mmsales@milemaker.com"
18
18
  }
19
+ export type MaybePromise<T> = T | PromiseLike<T>;
20
+ export type FunctionType<Args = unknown[] | void, Return = void> = Args extends unknown[] ? (...args: Args) => Return : Args extends unknown ? (...args: unknown[]) => Return : Args extends void ? () => Return : never;
21
+ export declare enum HttpMethod {
22
+ GET = "GET",
23
+ POST = "POST",
24
+ PUT = "PUT",
25
+ DELETE = "DELETE",
26
+ PATCH = "PATCH"
27
+ }
28
+ export declare enum IndexDBName {
29
+ AERIS_WEATHER = "milemaker_aerisWeather"
30
+ }
31
+ export declare enum LengthUnit {
32
+ MILES = "miles",
33
+ KILOMETERS = "kilometers"
34
+ }
35
+ export declare enum VolumeUnit {
36
+ GALLON = "gallon",
37
+ LITER = "liter"
38
+ }
39
+ export type Rate<Unit extends LengthUnit | VolumeUnit> = Partial<Record<Unit, Partial<Record<Unit, number>>>>;
40
+ export type Nillable<T> = T | null | undefined;
@@ -1 +1 @@
1
- export declare const APP_VERSION = "2.0.0-alpha.3";
1
+ export declare const APP_VERSION = "2.0.0-alpha.5";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@milemaker/milemaker-js",
3
3
  "private": false,
4
- "version": "2.0.0-alpha.3",
4
+ "version": "2.0.0-alpha.5",
5
5
  "type": "module",
6
6
  "license": "BSD-3-Clause",
7
7
  "files": [
@@ -29,8 +29,11 @@
29
29
  "dependencies": {
30
30
  "@googlemaps/polyline-codec": "^1.0.28",
31
31
  "detect-browser": "^5.3.0",
32
+ "easy-web-worker": "^7.0.5",
33
+ "gmp-wasm": "^1.3.2",
32
34
  "lodash": "^4.17.21",
33
- "uuid": "^9.0.0"
35
+ "uuid": "^9.0.0",
36
+ "zod": "^4.2.1"
34
37
  },
35
38
  "devDependencies": {
36
39
  "@milemaker/nmaps-gl": "^1.6.10",
@@ -1 +0,0 @@
1
- export type WeatherLayerType = "radar" | "alerts" | "satellite" | "roadConditions" | "temperatures" | "windSpeeds";