azure-maps-control 2.3.2 → 2.3.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.
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
265
265
  return Url;
266
266
  }());
267
267
 
268
- var version = "2.3.2";
268
+ var version = "2.3.4";
269
269
 
270
270
  /**
271
271
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -18359,7 +18359,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
18359
18359
  return undefined;
18360
18360
  };
18361
18361
  /**
18362
- * Removes all user added layers from the map.
18362
+ * Removes all layers from the map.
18363
18363
  */
18364
18364
  LayerManager.prototype.clear = function () {
18365
18365
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
@@ -20697,6 +20697,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20697
20697
  });
20698
20698
  // Make the deferred layers visible once the map instance is fully loaded.
20699
20699
  _this._progressiveLoadingState.pendingVisibilityChange = function () {
20700
+ var _a;
20700
20701
  // Release the callback.
20701
20702
  _this._progressiveLoadingState.pendingVisibilityChange = null;
20702
20703
  // Bail out the callback once map style has changed.
@@ -20710,6 +20711,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20710
20711
  layer.layout.visibility = 'visible';
20711
20712
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
20712
20713
  });
20714
+ // Reload attribution after the deferred layers are visible.
20715
+ (_a = _this.map.copyrightDelegate) === null || _a === void 0 ? void 0 : _a.reloadAttribution();
20713
20716
  };
20714
20717
  _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
20715
20718
  };
@@ -21182,36 +21185,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21182
21185
  params.url = targetUrl.href;
21183
21186
  }
21184
21187
  (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
21188
+ // Delete auth token for static assets to allow AFD caching
21189
+ this._deleteAuthTokenForStaticAssets(params);
21185
21190
  }
21186
21191
  };
21187
21192
  /**
21188
21193
  * Fetches a json resource at the specified domain and path.
21189
21194
  */
21190
21195
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
21191
- var _a, _b;
21196
+ var _a;
21192
21197
  if (customQueryParams === void 0) { customQueryParams = {}; }
21193
21198
  return __awaiter$3(this, void 0, void 0, function () {
21194
21199
  var requestParams, fetchOptions;
21195
- var _c;
21196
- return __generator$3(this, function (_d) {
21197
- switch (_d.label) {
21200
+ var _b;
21201
+ return __generator$3(this, function (_c) {
21202
+ switch (_c.label) {
21198
21203
  case 0:
21199
21204
  requestParams = {
21200
21205
  url: new Url({
21201
21206
  protocol: "https",
21202
21207
  domain: domain,
21203
21208
  path: path,
21204
- queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
21205
- // Generate a hash code to avoid cache conflict
21206
- // TODO: Remove this once style version 2023-01-01 is publicly available
21207
- _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
21209
+ queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
21208
21210
  }).toString()
21209
21211
  };
21210
21212
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
21211
21213
  // If a transformRequest(...) was specified use it.
21212
21214
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
21213
21215
  }
21214
- (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
21216
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
21217
+ // Delete auth token for static assets to allow AFD caching
21218
+ this._deleteAuthTokenForStaticAssets(requestParams);
21215
21219
  fetchOptions = {
21216
21220
  method: "GET",
21217
21221
  mode: "cors",
@@ -21228,25 +21232,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21228
21232
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
21229
21233
  }
21230
21234
  })];
21231
- case 1: return [2 /*return*/, _d.sent()];
21235
+ case 1: return [2 /*return*/, _c.sent()];
21232
21236
  }
21233
21237
  });
21234
21238
  });
21235
21239
  };
21236
21240
  /**
21237
- * A basic helper function to generate a hash from an input string.
21241
+ * Delete auth token for static assets to allow AFD caching.
21238
21242
  */
21239
- StyleManager._hashCode = function (str) {
21240
- if (str === void 0) { str = ""; }
21241
- var chr, hash = 0;
21242
- if (!str)
21243
- return hash;
21244
- for (var i = 0; i < str.length; i++) {
21245
- chr = str.charCodeAt(i);
21246
- hash = (hash << 5) - hash + chr;
21247
- hash |= 0; // Convert to 32bit integer
21243
+ StyleManager.prototype._deleteAuthTokenForStaticAssets = function (params) {
21244
+ // The following resources are considered as static assets.
21245
+ // StyleSet /styling/styles
21246
+ // Style /styling/styles/*
21247
+ // Thumbnail /styling/styles/*/thumbnail.png
21248
+ // Sprite PNG /styling/sprites/*/sprite@2x.png
21249
+ // Sprite JSON /styling/sprites/*/sprite@2x.json
21250
+ // Glyph /styling/glyphs/*/0-255.pbf
21251
+ if (params.url.startsWith("https://" + this.serviceOptions.staticAssetsDomain + "/" + constants.stylePath)) {
21252
+ delete params.headers[constants.msClientIdHeaderName];
21253
+ delete params.headers[constants.authorizationHeaderName];
21248
21254
  }
21249
- return hash;
21250
21255
  };
21251
21256
  return StyleManager;
21252
21257
  }());
@@ -22432,7 +22437,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22432
22437
  this.dispose();
22433
22438
  };
22434
22439
  /**
22435
- * Removes all user added sources, layers, markers, and popups from the map.
22440
+ * Removes all sources, layers, markers, and popups from the map.
22436
22441
  * User added images are preserved.
22437
22442
  */
22438
22443
  Map.prototype.clear = function () {
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
265
265
  return Url;
266
266
  }());
267
267
 
268
- var version = "2.3.2";
268
+ var version = "2.3.4";
269
269
 
270
270
  /**
271
271
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -21976,6 +21976,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21976
21976
  _this.reloadAttribution();
21977
21977
  });
21978
21978
  };
21979
+ /**
21980
+ * @internal
21981
+ */
21979
21982
  this.reloadAttribution = function () {
21980
21983
  var sources = _this.getMapStyleVisibleSources();
21981
21984
  // keep track of all rules as well as registered to determine redundant rules that won't get applied.
@@ -26078,7 +26081,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
26078
26081
  return undefined;
26079
26082
  };
26080
26083
  /**
26081
- * Removes all user added layers from the map.
26084
+ * Removes all layers from the map.
26082
26085
  */
26083
26086
  LayerManager.prototype.clear = function () {
26084
26087
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
@@ -28416,6 +28419,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28416
28419
  });
28417
28420
  // Make the deferred layers visible once the map instance is fully loaded.
28418
28421
  _this._progressiveLoadingState.pendingVisibilityChange = function () {
28422
+ var _a;
28419
28423
  // Release the callback.
28420
28424
  _this._progressiveLoadingState.pendingVisibilityChange = null;
28421
28425
  // Bail out the callback once map style has changed.
@@ -28429,6 +28433,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28429
28433
  layer.layout.visibility = 'visible';
28430
28434
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
28431
28435
  });
28436
+ // Reload attribution after the deferred layers are visible.
28437
+ (_a = _this.map.copyrightDelegate) === null || _a === void 0 ? void 0 : _a.reloadAttribution();
28432
28438
  };
28433
28439
  _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
28434
28440
  };
@@ -28901,36 +28907,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28901
28907
  params.url = targetUrl.href;
28902
28908
  }
28903
28909
  (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
28910
+ // Delete auth token for static assets to allow AFD caching
28911
+ this._deleteAuthTokenForStaticAssets(params);
28904
28912
  }
28905
28913
  };
28906
28914
  /**
28907
28915
  * Fetches a json resource at the specified domain and path.
28908
28916
  */
28909
28917
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
28910
- var _a, _b;
28918
+ var _a;
28911
28919
  if (customQueryParams === void 0) { customQueryParams = {}; }
28912
28920
  return __awaiter$4(this, void 0, void 0, function () {
28913
28921
  var requestParams, fetchOptions;
28914
- var _c;
28915
- return __generator$4(this, function (_d) {
28916
- switch (_d.label) {
28922
+ var _b;
28923
+ return __generator$4(this, function (_c) {
28924
+ switch (_c.label) {
28917
28925
  case 0:
28918
28926
  requestParams = {
28919
28927
  url: new Url({
28920
28928
  protocol: "https",
28921
28929
  domain: domain,
28922
28930
  path: path,
28923
- queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
28924
- // Generate a hash code to avoid cache conflict
28925
- // TODO: Remove this once style version 2023-01-01 is publicly available
28926
- _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
28931
+ queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
28927
28932
  }).toString()
28928
28933
  };
28929
28934
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
28930
28935
  // If a transformRequest(...) was specified use it.
28931
28936
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
28932
28937
  }
28933
- (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
28938
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
28939
+ // Delete auth token for static assets to allow AFD caching
28940
+ this._deleteAuthTokenForStaticAssets(requestParams);
28934
28941
  fetchOptions = {
28935
28942
  method: "GET",
28936
28943
  mode: "cors",
@@ -28947,25 +28954,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28947
28954
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
28948
28955
  }
28949
28956
  })];
28950
- case 1: return [2 /*return*/, _d.sent()];
28957
+ case 1: return [2 /*return*/, _c.sent()];
28951
28958
  }
28952
28959
  });
28953
28960
  });
28954
28961
  };
28955
28962
  /**
28956
- * A basic helper function to generate a hash from an input string.
28963
+ * Delete auth token for static assets to allow AFD caching.
28957
28964
  */
28958
- StyleManager._hashCode = function (str) {
28959
- if (str === void 0) { str = ""; }
28960
- var chr, hash = 0;
28961
- if (!str)
28962
- return hash;
28963
- for (var i = 0; i < str.length; i++) {
28964
- chr = str.charCodeAt(i);
28965
- hash = (hash << 5) - hash + chr;
28966
- hash |= 0; // Convert to 32bit integer
28965
+ StyleManager.prototype._deleteAuthTokenForStaticAssets = function (params) {
28966
+ // The following resources are considered as static assets.
28967
+ // StyleSet /styling/styles
28968
+ // Style /styling/styles/*
28969
+ // Thumbnail /styling/styles/*/thumbnail.png
28970
+ // Sprite PNG /styling/sprites/*/sprite@2x.png
28971
+ // Sprite JSON /styling/sprites/*/sprite@2x.json
28972
+ // Glyph /styling/glyphs/*/0-255.pbf
28973
+ if (params.url.startsWith("https://" + this.serviceOptions.staticAssetsDomain + "/" + constants.stylePath)) {
28974
+ delete params.headers[constants.msClientIdHeaderName];
28975
+ delete params.headers[constants.authorizationHeaderName];
28967
28976
  }
28968
- return hash;
28969
28977
  };
28970
28978
  return StyleManager;
28971
28979
  }());
@@ -30157,7 +30165,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
30157
30165
  this.dispose();
30158
30166
  };
30159
30167
  /**
30160
- * Removes all user added sources, layers, markers, and popups from the map.
30168
+ * Removes all sources, layers, markers, and popups from the map.
30161
30169
  * User added images are preserved.
30162
30170
  */
30163
30171
  Map.prototype.clear = function () {