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.
@@ -43477,7 +43477,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43477
43477
  return Url;
43478
43478
  }());
43479
43479
 
43480
- var version = "2.3.2";
43480
+ var version = "2.3.4";
43481
43481
 
43482
43482
  /**
43483
43483
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -61553,7 +61553,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61553
61553
  return undefined;
61554
61554
  };
61555
61555
  /**
61556
- * Removes all user added layers from the map.
61556
+ * Removes all layers from the map.
61557
61557
  */
61558
61558
  LayerManager.prototype.clear = function () {
61559
61559
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
@@ -63891,6 +63891,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63891
63891
  });
63892
63892
  // Make the deferred layers visible once the map instance is fully loaded.
63893
63893
  _this._progressiveLoadingState.pendingVisibilityChange = function () {
63894
+ var _a;
63894
63895
  // Release the callback.
63895
63896
  _this._progressiveLoadingState.pendingVisibilityChange = null;
63896
63897
  // Bail out the callback once map style has changed.
@@ -63904,6 +63905,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63904
63905
  layer.layout.visibility = 'visible';
63905
63906
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
63906
63907
  });
63908
+ // Reload attribution after the deferred layers are visible.
63909
+ (_a = _this.map.copyrightDelegate) === null || _a === void 0 ? void 0 : _a.reloadAttribution();
63907
63910
  };
63908
63911
  _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
63909
63912
  };
@@ -64376,36 +64379,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64376
64379
  params.url = targetUrl.href;
64377
64380
  }
64378
64381
  (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
64382
+ // Delete auth token for static assets to allow AFD caching
64383
+ this._deleteAuthTokenForStaticAssets(params);
64379
64384
  }
64380
64385
  };
64381
64386
  /**
64382
64387
  * Fetches a json resource at the specified domain and path.
64383
64388
  */
64384
64389
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
64385
- var _a, _b;
64390
+ var _a;
64386
64391
  if (customQueryParams === void 0) { customQueryParams = {}; }
64387
64392
  return __awaiter$3(this, void 0, void 0, function () {
64388
64393
  var requestParams, fetchOptions;
64389
- var _c;
64390
- return __generator$3(this, function (_d) {
64391
- switch (_d.label) {
64394
+ var _b;
64395
+ return __generator$3(this, function (_c) {
64396
+ switch (_c.label) {
64392
64397
  case 0:
64393
64398
  requestParams = {
64394
64399
  url: new Url({
64395
64400
  protocol: "https",
64396
64401
  domain: domain,
64397
64402
  path: path,
64398
- queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
64399
- // Generate a hash code to avoid cache conflict
64400
- // TODO: Remove this once style version 2023-01-01 is publicly available
64401
- _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
64403
+ queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
64402
64404
  }).toString()
64403
64405
  };
64404
64406
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
64405
64407
  // If a transformRequest(...) was specified use it.
64406
64408
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
64407
64409
  }
64408
- (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
64410
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
64411
+ // Delete auth token for static assets to allow AFD caching
64412
+ this._deleteAuthTokenForStaticAssets(requestParams);
64409
64413
  fetchOptions = {
64410
64414
  method: "GET",
64411
64415
  mode: "cors",
@@ -64422,25 +64426,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64422
64426
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
64423
64427
  }
64424
64428
  })];
64425
- case 1: return [2 /*return*/, _d.sent()];
64429
+ case 1: return [2 /*return*/, _c.sent()];
64426
64430
  }
64427
64431
  });
64428
64432
  });
64429
64433
  };
64430
64434
  /**
64431
- * A basic helper function to generate a hash from an input string.
64435
+ * Delete auth token for static assets to allow AFD caching.
64432
64436
  */
64433
- StyleManager._hashCode = function (str) {
64434
- if (str === void 0) { str = ""; }
64435
- var chr, hash = 0;
64436
- if (!str)
64437
- return hash;
64438
- for (var i = 0; i < str.length; i++) {
64439
- chr = str.charCodeAt(i);
64440
- hash = (hash << 5) - hash + chr;
64441
- hash |= 0; // Convert to 32bit integer
64442
- }
64443
- return hash;
64437
+ StyleManager.prototype._deleteAuthTokenForStaticAssets = function (params) {
64438
+ // The following resources are considered as static assets.
64439
+ // StyleSet /styling/styles
64440
+ // Style /styling/styles/*
64441
+ // Thumbnail /styling/styles/*/thumbnail.png
64442
+ // Sprite PNG /styling/sprites/*/sprite@2x.png
64443
+ // Sprite JSON /styling/sprites/*/sprite@2x.json
64444
+ // Glyph /styling/glyphs/*/0-255.pbf
64445
+ if (params.url.startsWith("https://" + this.serviceOptions.staticAssetsDomain + "/" + constants.stylePath)) {
64446
+ delete params.headers[constants.msClientIdHeaderName];
64447
+ delete params.headers[constants.authorizationHeaderName];
64448
+ }
64444
64449
  };
64445
64450
  return StyleManager;
64446
64451
  }());
@@ -65626,7 +65631,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65626
65631
  this.dispose();
65627
65632
  };
65628
65633
  /**
65629
- * Removes all user added sources, layers, markers, and popups from the map.
65634
+ * Removes all sources, layers, markers, and popups from the map.
65630
65635
  * User added images are preserved.
65631
65636
  */
65632
65637
  Map.prototype.clear = function () {
@@ -43477,7 +43477,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43477
43477
  return Url;
43478
43478
  }());
43479
43479
 
43480
- var version = "2.3.2";
43480
+ var version = "2.3.4";
43481
43481
 
43482
43482
  /**
43483
43483
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -65170,6 +65170,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65170
65170
  _this.reloadAttribution();
65171
65171
  });
65172
65172
  };
65173
+ /**
65174
+ * @internal
65175
+ */
65173
65176
  this.reloadAttribution = function () {
65174
65177
  var sources = _this.getMapStyleVisibleSources();
65175
65178
  // keep track of all rules as well as registered to determine redundant rules that won't get applied.
@@ -69272,7 +69275,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69272
69275
  return undefined;
69273
69276
  };
69274
69277
  /**
69275
- * Removes all user added layers from the map.
69278
+ * Removes all layers from the map.
69276
69279
  */
69277
69280
  LayerManager.prototype.clear = function () {
69278
69281
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
@@ -71610,6 +71613,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
71610
71613
  });
71611
71614
  // Make the deferred layers visible once the map instance is fully loaded.
71612
71615
  _this._progressiveLoadingState.pendingVisibilityChange = function () {
71616
+ var _a;
71613
71617
  // Release the callback.
71614
71618
  _this._progressiveLoadingState.pendingVisibilityChange = null;
71615
71619
  // Bail out the callback once map style has changed.
@@ -71623,6 +71627,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
71623
71627
  layer.layout.visibility = 'visible';
71624
71628
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
71625
71629
  });
71630
+ // Reload attribution after the deferred layers are visible.
71631
+ (_a = _this.map.copyrightDelegate) === null || _a === void 0 ? void 0 : _a.reloadAttribution();
71626
71632
  };
71627
71633
  _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
71628
71634
  };
@@ -72095,36 +72101,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
72095
72101
  params.url = targetUrl.href;
72096
72102
  }
72097
72103
  (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
72104
+ // Delete auth token for static assets to allow AFD caching
72105
+ this._deleteAuthTokenForStaticAssets(params);
72098
72106
  }
72099
72107
  };
72100
72108
  /**
72101
72109
  * Fetches a json resource at the specified domain and path.
72102
72110
  */
72103
72111
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
72104
- var _a, _b;
72112
+ var _a;
72105
72113
  if (customQueryParams === void 0) { customQueryParams = {}; }
72106
72114
  return __awaiter$4(this, void 0, void 0, function () {
72107
72115
  var requestParams, fetchOptions;
72108
- var _c;
72109
- return __generator$4(this, function (_d) {
72110
- switch (_d.label) {
72116
+ var _b;
72117
+ return __generator$4(this, function (_c) {
72118
+ switch (_c.label) {
72111
72119
  case 0:
72112
72120
  requestParams = {
72113
72121
  url: new Url({
72114
72122
  protocol: "https",
72115
72123
  domain: domain,
72116
72124
  path: path,
72117
- queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
72118
- // Generate a hash code to avoid cache conflict
72119
- // TODO: Remove this once style version 2023-01-01 is publicly available
72120
- _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
72125
+ queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
72121
72126
  }).toString()
72122
72127
  };
72123
72128
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
72124
72129
  // If a transformRequest(...) was specified use it.
72125
72130
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
72126
72131
  }
72127
- (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
72132
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
72133
+ // Delete auth token for static assets to allow AFD caching
72134
+ this._deleteAuthTokenForStaticAssets(requestParams);
72128
72135
  fetchOptions = {
72129
72136
  method: "GET",
72130
72137
  mode: "cors",
@@ -72141,25 +72148,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
72141
72148
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
72142
72149
  }
72143
72150
  })];
72144
- case 1: return [2 /*return*/, _d.sent()];
72151
+ case 1: return [2 /*return*/, _c.sent()];
72145
72152
  }
72146
72153
  });
72147
72154
  });
72148
72155
  };
72149
72156
  /**
72150
- * A basic helper function to generate a hash from an input string.
72157
+ * Delete auth token for static assets to allow AFD caching.
72151
72158
  */
72152
- StyleManager._hashCode = function (str) {
72153
- if (str === void 0) { str = ""; }
72154
- var chr, hash = 0;
72155
- if (!str)
72156
- return hash;
72157
- for (var i = 0; i < str.length; i++) {
72158
- chr = str.charCodeAt(i);
72159
- hash = (hash << 5) - hash + chr;
72160
- hash |= 0; // Convert to 32bit integer
72161
- }
72162
- return hash;
72159
+ StyleManager.prototype._deleteAuthTokenForStaticAssets = function (params) {
72160
+ // The following resources are considered as static assets.
72161
+ // StyleSet /styling/styles
72162
+ // Style /styling/styles/*
72163
+ // Thumbnail /styling/styles/*/thumbnail.png
72164
+ // Sprite PNG /styling/sprites/*/sprite@2x.png
72165
+ // Sprite JSON /styling/sprites/*/sprite@2x.json
72166
+ // Glyph /styling/glyphs/*/0-255.pbf
72167
+ if (params.url.startsWith("https://" + this.serviceOptions.staticAssetsDomain + "/" + constants.stylePath)) {
72168
+ delete params.headers[constants.msClientIdHeaderName];
72169
+ delete params.headers[constants.authorizationHeaderName];
72170
+ }
72163
72171
  };
72164
72172
  return StyleManager;
72165
72173
  }());
@@ -73351,7 +73359,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
73351
73359
  this.dispose();
73352
73360
  };
73353
73361
  /**
73354
- * Removes all user added sources, layers, markers, and popups from the map.
73362
+ * Removes all sources, layers, markers, and popups from the map.
73355
73363
  * User added images are preserved.
73356
73364
  */
73357
73365
  Map.prototype.clear = function () {