@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
@@ -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,6 @@
1
+ /**
2
+ * Use this value to omit header which was set in bse query.
3
+ * It may be useful to fetch 3-d party API or when we need to specify some custom headers for a specific request for our API.
4
+ */
5
+ export declare const OMIT_HEADER_VALUE = "omit";
6
+ export declare const LICENSED_MODULE = "map_sdk";
@@ -0,0 +1,5 @@
1
+ export declare enum ApiParams {
2
+ TYPE = "type",
3
+ API_KEY = "apiKey",
4
+ LICENSED_MODULE = "licensedModule"
5
+ }
@@ -0,0 +1,37 @@
1
+ interface LogEvent {
2
+ data: Record<string, unknown>;
3
+ component: LogEventComponent;
4
+ datetime: string;
5
+ }
6
+ type LogEventDataProp = Record<string, unknown>;
7
+ declare enum LogEventComponent {
8
+ MAP_SDK = "map_sdk"
9
+ }
10
+ export declare enum LogEventScope {
11
+ API = "api",
12
+ REACT = "react",
13
+ WINDOW_ERROR = "windowError",
14
+ WINDOW_UNHANDLED_REJECTION = "windowUnhandledRejection",
15
+ NDRIVE = "ndrive",
16
+ BILLING = "billing",
17
+ WEATHER = "weather"
18
+ }
19
+ export declare const prepareLogEvent: ({ event, scope, destination, apiKey }: {
20
+ event: LogEventDataProp;
21
+ scope: LogEventScope;
22
+ destination: "api" | "email";
23
+ apiKey: string;
24
+ }) => Promise<LogEvent>;
25
+ export declare const handleLogEvents: ({ events: propEvents, scope, apiKey, baseApiUrl }: {
26
+ events: Record<string, unknown>[];
27
+ scope: LogEventScope;
28
+ apiKey: string;
29
+ baseApiUrl: string;
30
+ }) => Promise<void>;
31
+ export declare const handleLogErrorEvents: ({ errors: propErrors, scope, apiKey, baseApiUrl }: {
32
+ errors: Error[];
33
+ scope: LogEventScope;
34
+ apiKey: string;
35
+ baseApiUrl: string;
36
+ }) => Promise<void>;
37
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const triggerMapSdkInitEvent: ({ apiKey, baseApiUrl }: {
2
+ apiKey: string;
3
+ baseApiUrl: string;
4
+ }) => Promise<void>;
@@ -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,13 +1,12 @@
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>;
5
5
  export declare enum HttpHeader {
6
- X_CLIENT = "x-client"
6
+ X_CLIENT = "x-client",
7
+ AUTHORIZATION = "authorization"
7
8
  }
8
9
  export declare enum XClient {
9
- WEB_APP = "web_app",
10
- EXCEL_ADD_IN = "excel_add_in",
11
10
  MAP_SDK = "map_sdk"
12
11
  }
13
12
  export declare const MILE_MAKER_PAGE_PATH: {
@@ -47,4 +46,15 @@ export declare const MEASURE_UNITS_LABELS: {
47
46
  };
48
47
  };
49
48
  export declare const EMAIL_SUBJECT_LENGTH_LIMITATION = 255;
50
- export declare const EMAIL_BODY_LENGTH_LIMITATION = 2000;
49
+ export declare const EMAIL_BODY_LENGTH_LIMITATION = 1100;
50
+ export declare const IndexedDB: IDBFactory;
51
+ /**
52
+ * This is a MAIN_LENGTH_UNIT constant that contains the distance unit supported by the backend when making requests
53
+ * Takes part in imperial/metric conversion when the user selects non-imperial units in app settings
54
+ */
55
+ export declare const MAIN_LENGTH_UNIT = LengthUnit.MILES;
56
+ /**
57
+ * This is LENGTH_UNITS_RATES and VOLUME_UNITS_RATES constants
58
+ * Сontain a coefficient for converting the value in both directions
59
+ */
60
+ 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,29 @@
1
+ /**
2
+ * This helper is used to receive the boolean value based on condition, to understand header type is "omit".
3
+ * @param {Headers} headers - Request headers
4
+ * @param {string} name - Header name
5
+ */
6
+ export declare const getIsOmitHeader: ({ headers, name }: {
7
+ headers: Headers;
8
+ name: string;
9
+ }) => boolean;
10
+ /**
11
+ * This helper is used to add new headers for request.
12
+ * @param {Headers} headers - Request headers
13
+ * @param {string} name - Header name
14
+ * @param {string} value - Header value
15
+ */
16
+ export declare const handleHeader: ({ headers, name, value }: {
17
+ headers: Headers;
18
+ name: string;
19
+ value: string;
20
+ }) => void;
21
+ /**
22
+ * This helper is used to add Authorization header for request.
23
+ * @param {Headers} headers - Request headers
24
+ * @param {string} apiKey - Map SDK key
25
+ */
26
+ export declare const handleAuthorizationHeader: ({ headers, apiKey }: {
27
+ headers: Headers;
28
+ apiKey: string;
29
+ }) => void;
@@ -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;
@@ -1,7 +1,7 @@
1
1
  export declare const prepareAppErrorMailToData: ({ appError, accessToken }: {
2
2
  appError: Error;
3
3
  accessToken: string;
4
- }) => {
4
+ }) => Promise<{
5
5
  subject: string;
6
6
  body: string;
7
- };
7
+ }>;
@@ -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;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Reduces a full error stack to show only relevant application code frames.
3
+ * In production, it first applies source map transformations, then filters out framework/library noise.
4
+ * In development, it just filters the stack.
5
+ *
6
+ * @param stack - Full error stack trace string
7
+ * @param maxFrames - Maximum number of relevant frames to return (default: 1)
8
+ * @returns Reduced stack trace string with only application code
9
+ */
10
+ export declare function getReducedErrorStack(stack: string | undefined, maxFrames?: number): Promise<string | undefined>;
11
+ /**
12
+ * This helper will either adapt the error track to the original code if possible or return the built chunk track.
13
+ */
14
+ export declare function getAdaptedErrorStack(stack: string): Promise<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
+ }
@@ -5,14 +5,29 @@ export declare enum Env {
5
5
  }
6
6
  export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
7
7
  export type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
8
- export declare enum ContactSupportMandatoryField {
9
- MAP_SDK_KEY = "mapSdkKey",
10
- BROWSER_INFO = "browserInfo",
11
- TIMESTAMP = "timestamp",
12
- APP_VERSION = "appVersion",
13
- SCOPE = "scope"
14
- }
15
8
  export declare enum Mail {
16
9
  SUPPORT = "support@milemaker.com",
17
10
  SALES = "mmsales@milemaker.com"
18
11
  }
12
+ export type MaybePromise<T> = T | PromiseLike<T>;
13
+ 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;
14
+ export declare enum HttpMethod {
15
+ GET = "GET",
16
+ POST = "POST",
17
+ PUT = "PUT",
18
+ DELETE = "DELETE",
19
+ PATCH = "PATCH"
20
+ }
21
+ export declare enum IndexDBName {
22
+ AERIS_WEATHER = "milemaker_aerisWeather"
23
+ }
24
+ export declare enum LengthUnit {
25
+ MILES = "miles",
26
+ KILOMETERS = "kilometers"
27
+ }
28
+ export declare enum VolumeUnit {
29
+ GALLON = "gallon",
30
+ LITER = "liter"
31
+ }
32
+ export type Rate<Unit extends LengthUnit | VolumeUnit> = Partial<Record<Unit, Partial<Record<Unit, number>>>>;
33
+ 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.6";
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.7",
5
5
  "type": "module",
6
6
  "license": "BSD-3-Clause",
7
7
  "files": [
@@ -29,8 +29,13 @@
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
+ "serialize-error": "^12.0.0",
36
+ "source-map-js": "^1.2.1",
37
+ "uuid": "^9.0.0",
38
+ "zod": "^4.2.1"
34
39
  },
35
40
  "devDependencies": {
36
41
  "@milemaker/nmaps-gl": "^1.6.10",
@@ -1 +0,0 @@
1
- export type WeatherLayerType = "radar" | "alerts" | "satellite" | "roadConditions" | "temperatures" | "windSpeeds";
@@ -1,4 +0,0 @@
1
- export declare const triggerMapSdkInitEvent: ({ apiKey, proxyEnv }: {
2
- apiKey: string;
3
- proxyEnv: string;
4
- }) => Promise<void>;
@@ -1,4 +0,0 @@
1
- import { ContactSupportMandatoryField } from "../types";
2
- export declare const prepareContactSupportMandatoryFields: ({ accessToken }: {
3
- accessToken: string;
4
- }) => Record<ContactSupportMandatoryField, unknown>;