@maptiler/sdk 3.0.0-rc.3 → 3.0.0-rc.4

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/dist/src/Map.d.ts CHANGED
@@ -3,6 +3,7 @@ import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
3
3
  import { SdkConfig } from './config';
4
4
  import { LanguageInfo } from './language';
5
5
  import { MinimapOptionsInput } from './Minimap';
6
+ import { Telemetry } from './Telemetry';
6
7
 
7
8
  export type LoadWithTerrainEvent = {
8
9
  type: "loadWithTerrain";
@@ -130,6 +131,7 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo"> & {
130
131
  * The Map class can be instanciated to display a map in a `<div>`
131
132
  */
132
133
  export declare class Map extends maplibregl.Map {
134
+ readonly telemetry: Telemetry;
133
135
  private isTerrainEnabled;
134
136
  private terrainExaggeration;
135
137
  private primaryLanguage;
@@ -145,6 +147,7 @@ export declare class Map extends maplibregl.Map {
145
147
  private curentProjection;
146
148
  private originalLabelStyle;
147
149
  private isStyleLocalized;
150
+ private languageIsUpdated;
148
151
  constructor(options: MapOptions);
149
152
  /**
150
153
  * Set the duration (millisec) of the terrain animation for growing or flattening.
@@ -385,4 +388,11 @@ export declare class Map extends maplibregl.Map {
385
388
  * Uses the Mercator projection. Animated by default, it can be disabled
386
389
  */
387
390
  enableMercatorProjection(animate?: boolean): void;
391
+ /**
392
+ * Returns `true` is the language was ever updated, meaning changed
393
+ * from what is delivered in the style.
394
+ * Returns `false` if language in use is the language from the style
395
+ * and has never been changed.
396
+ */
397
+ isLanguageUpdated(): boolean;
388
398
  }
@@ -0,0 +1,22 @@
1
+ import { Map as MapSDK } from './Map';
2
+
3
+ /**
4
+ * A Telemetry instance sends some usage and merics to a dedicated endpoint at MapTiler Cloud.
5
+ */
6
+ export declare class Telemetry {
7
+ private map;
8
+ private registeredModules;
9
+ /**
10
+ *
11
+ * @param map : a Map instance
12
+ * @param delay : a delay in milliseconds after which the payload is sent to MapTiler cloud (cannot be less than 1000ms)
13
+ */
14
+ constructor(map: MapSDK, delay?: number);
15
+ /**
16
+ * Register a module to the telemetry system of the SDK.
17
+ * The arguments `name` and `version` likely come from the package.json
18
+ * of each module.
19
+ */
20
+ registerModule(name: string, version: string): void;
21
+ private preparePayload;
22
+ }
@@ -31,6 +31,24 @@ declare class SdkConfig extends EventEmitter {
31
31
  * Works only for requests to the MapTiler Cloud API when sessions are enabled.
32
32
  */
33
33
  caching: boolean;
34
+ /**
35
+ * Telemetry is enabled by default but can be opted-out by setting this value to `false`.
36
+ * The telemetry is very valuable to the team at MapTiler because it shares information
37
+ * about where to add the extra effort. It also helps spotting some incompatibility issues
38
+ * that may arise between the SDK and a specific version of a module.
39
+ *
40
+ * It consists in sending metrics about usage of the following features:
41
+ * - SDK version [string]
42
+ * - API key [string]
43
+ * - MapTiler sesion ID (if opted-in) [string]
44
+ * - if tile caching is enabled [boolean]
45
+ * - if language specified at initialization [boolean]
46
+ * - if terrain is activated at initialization [boolean]
47
+ * - if globe projection is activated at initialization [boolean]
48
+ *
49
+ * In addition, each official module will be add added to a list, alongside its version number.
50
+ */
51
+ telemetry: boolean;
34
52
  /**
35
53
  * Unit to be used
36
54
  */
@@ -5,6 +5,7 @@ declare const defaults: {
5
5
  maptilerLogoURL: string;
6
6
  maptilerURL: string;
7
7
  maptilerApiHost: string;
8
+ telemetryURL: string;
8
9
  rtlPluginURL: string;
9
10
  primaryLanguage: import('@maptiler/client').LanguageInfo;
10
11
  secondaryLanguage: import('@maptiler/client').LanguageInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.0.0-rc.3",
3
+ "version": "3.0.0-rc.4",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "module": "dist/maptiler-sdk.mjs",
6
6
  "types": "dist/maptiler-sdk.d.ts",