@evergis/api 3.0.201 → 3.0.202

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/api.esm.js CHANGED
@@ -175,6 +175,7 @@ function _get(target, property, receiver) {
175
175
  return _get(target, property, receiver || target);
176
176
  }
177
177
 
178
+ const API_USER_INFO_KEY = '@evergis/user-info';
178
179
  const STORAGE_TOKEN_KEY = "evergis-jwt-token";
179
180
  const STORAGE_REFRESH_TOKEN_KEY = "evergis-refresh-token";
180
181
 
@@ -1178,7 +1179,7 @@ let AccountService = /*#__PURE__*/function (_Service) {
1178
1179
  }, {
1179
1180
  key: "refreshToken",
1180
1181
  value: function refreshToken(data) {
1181
- return this.http.post("/account/refresh-token", data).text();
1182
+ return this.http.post("/account/refresh-token", data).json();
1182
1183
  }
1183
1184
  /**
1184
1185
  * No description
@@ -1409,8 +1410,6 @@ let AccountService = /*#__PURE__*/function (_Service) {
1409
1410
  return AccountService;
1410
1411
  }(Service);
1411
1412
 
1412
- const API_USER_INFO_KEY = '@evergis/user-info';
1413
-
1414
1413
  const getUserInfo = () => JSON.parse(localStorage.getItem(API_USER_INFO_KEY) || 'null') || void 0;
1415
1414
  const updateUserInfo = newUserInfo => {
1416
1415
  if (newUserInfo) {
@@ -4683,6 +4682,13 @@ function isString(v) {
4683
4682
 
4684
4683
  const addSubDomainToLocation = subDomain => window.location.protocol + "//" + subDomain + "." + window.location.host;
4685
4684
 
4685
+ const parseJwt = token => {
4686
+ const base64Url = token.split(".")[1];
4687
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
4688
+ const jsonPayload = decodeURIComponent(atob(base64).split("").map(c => "%" + "00".concat(c.charCodeAt(0).toString(16)).slice(-2)).join(""));
4689
+ return JSON.parse(jsonPayload);
4690
+ };
4691
+
4686
4692
  function unique(value, index, array) {
4687
4693
  return array.indexOf(value) === index;
4688
4694
  }
@@ -7489,13 +7495,6 @@ let VectorTiles = /*#__PURE__*/function (_VectorTileService) {
7489
7495
  return VectorTiles;
7490
7496
  }(VectorTileService);
7491
7497
 
7492
- const parseJwt = token => {
7493
- const base64Url = token.split(".")[1];
7494
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
7495
- const jsonPayload = decodeURIComponent(atob(base64).split("").map(c => "%" + "00".concat(c.charCodeAt(0).toString(16)).slice(-2)).join(""));
7496
- return JSON.parse(jsonPayload);
7497
- };
7498
-
7499
7498
  var UrlPath;
7500
7499
 
7501
7500
  (function (UrlPath) {
@@ -7540,23 +7539,12 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
7540
7539
  timeout: false
7541
7540
  }, httpOptions || {}, {
7542
7541
  hooks: _extends({}, hooks || {}, {
7543
- beforeRequest: [async request => {
7542
+ beforeRequest: [request => {
7544
7543
  const token = window.localStorage.getItem(STORAGE_TOKEN_KEY);
7545
- const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
7546
7544
 
7547
- if (token && refreshToken) {
7545
+ if (token) {
7548
7546
  var _request$headers;
7549
7547
 
7550
- const {
7551
- exp
7552
- } = parseJwt(token) || {};
7553
-
7554
- if (typeof exp === 'number' && exp - new Date().getTime() < 60 * 1000) {
7555
- await _this.account.refreshToken({
7556
- refreshToken
7557
- });
7558
- }
7559
-
7560
7548
  (_request$headers = request.headers) == null ? void 0 : _request$headers.set('Authorization', "Bearer " + (token || ''));
7561
7549
  }
7562
7550
  }, ...((_hooks$beforeRequest = hooks == null ? void 0 : hooks.beforeRequest) != null ? _hooks$beforeRequest : [])],
@@ -9067,5 +9055,5 @@ var TextVerticalAlignment;
9067
9055
  TextVerticalAlignment["Middle"] = "middle";
9068
9056
  })(TextVerticalAlignment || (TextVerticalAlignment = {}));
9069
9057
 
9070
- export { Account, AccountPreview, AggregationFunction, Api, ApiEvent, AttributeIconType, AttributeSelectorType, AttributeType, AuthorizationGrant, BulkOperations, Cameras, CatalogResourceType, ClassificationType, ClassifyAttributeType, ClientSettings, ConfigurationErrorEnum, ConnectionStatus, DataSourceType, DependencyType, Eql, ErrorDetailsType, ErrorReason, ErrorType, EvergisDynamicLayer, EvergisTileLayer, External, FeatureType, Feedback, FileUpload, Filters, FontStyle, FontWeight, GEOCODE_PROVIDER, General, Geocode, GeometryType, Group, HttpClient, IceRouter, Import, Layers, LayersManager, LineCapStyle, LineEndingType, LineJoinType, Names, Namespace, Notification, NotificationEvent, Operation, OwnerFilter, PbfSchema, Permissions, PolicyType, PortalSettings, Print, Projects, Quality, ResourceCatalog, ResourceSeparator, ResourceSubTypeFilter, ResourceType, ResourceTypeFilter, ResourceTypeLink, Resources, ResponseType, Scheduler, Security, ServerTaskStatus, SimplifyType, SpatialProcessor, Statistic, StringSubType, Styles, Tables, TaskGroup, TextAlignment, TextVerticalAlignment, Tools, UrlPath, VectorTiles, addSubDomainToLocation, errorHandler, formDataFromFile, generateId, isEvergisDynamicLayer, isEvergisTileLayer, isFeatureLayer, isHTTPError, isHandledError, isLayer, isProjectContentItems, isString, isTileLayerService, promiseAllIgnoreErrors, stripUselessSlashes, toFormData, unique };
9058
+ export { Account, AccountPreview, AggregationFunction, Api, ApiEvent, AttributeIconType, AttributeSelectorType, AttributeType, AuthorizationGrant, BulkOperations, Cameras, CatalogResourceType, ClassificationType, ClassifyAttributeType, ClientSettings, ConfigurationErrorEnum, ConnectionStatus, DataSourceType, DependencyType, Eql, ErrorDetailsType, ErrorReason, ErrorType, EvergisDynamicLayer, EvergisTileLayer, External, FeatureType, Feedback, FileUpload, Filters, FontStyle, FontWeight, GEOCODE_PROVIDER, General, Geocode, GeometryType, Group, HttpClient, IceRouter, Import, Layers, LayersManager, LineCapStyle, LineEndingType, LineJoinType, Names, Namespace, Notification, NotificationEvent, Operation, OwnerFilter, PbfSchema, Permissions, PolicyType, PortalSettings, Print, Projects, Quality, ResourceCatalog, ResourceSeparator, ResourceSubTypeFilter, ResourceType, ResourceTypeFilter, ResourceTypeLink, Resources, ResponseType, STORAGE_REFRESH_TOKEN_KEY, STORAGE_TOKEN_KEY, Scheduler, Security, ServerTaskStatus, SimplifyType, SpatialProcessor, Statistic, StringSubType, Styles, Tables, TaskGroup, TextAlignment, TextVerticalAlignment, Tools, UrlPath, VectorTiles, addSubDomainToLocation, errorHandler, formDataFromFile, generateId, isEvergisDynamicLayer, isEvergisTileLayer, isFeatureLayer, isHTTPError, isHandledError, isLayer, isProjectContentItems, isString, isTileLayerService, parseJwt, promiseAllIgnoreErrors, stripUselessSlashes, toFormData, unique };
9071
9059
  //# sourceMappingURL=api.esm.js.map