@stemy/ngx-utils 11.2.2 → 11.2.6

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.
@@ -3157,7 +3157,7 @@
3157
3157
  }
3158
3158
  }
3159
3159
  this.baseConfig = baseConfig || {};
3160
- this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl: baseUrl }, this.baseConfig);
3160
+ this.loadedConfig = Object.assign(this.baseConfig, !baseUrl ? {} : { baseUrl: baseUrl, baseDomain: this.parseDomain(baseUrl) });
3161
3161
  this.scriptParameters = scriptParams || {};
3162
3162
  this.loaderFunc = function () {
3163
3163
  _this.loader = _this.loader || new Promise(function (resolve, reject) {
@@ -3195,6 +3195,16 @@
3195
3195
  enumerable: false,
3196
3196
  configurable: true
3197
3197
  });
3198
+ ConfigService.prototype.parseDomain = function (baseUrl) {
3199
+ try {
3200
+ var url = new URL(baseUrl);
3201
+ var port = url.port && url.port !== "443" && url.port !== "80" ? ":" + url.port : "";
3202
+ return url.protocol + "://" + url.hostname + port + "/";
3203
+ }
3204
+ catch (_a) {
3205
+ return "/";
3206
+ }
3207
+ };
3198
3208
  ConfigService.prototype.initService = function () {
3199
3209
  };
3200
3210
  ConfigService.prototype.loadJson = function () {
@@ -3216,8 +3226,8 @@
3216
3226
  };
3217
3227
  ConfigService.prototype.prepareUrl = function (url, ending) {
3218
3228
  var project = !this.loadedConfig ? "" : this.loadedConfig.project;
3219
- url = url ? "" + url.replace(/\/+$/, "") + ending : ending;
3220
- url = url.replace("[project]", project);
3229
+ url = (url === null || url === void 0 ? void 0 : url.startsWith("/")) ? this.loadedConfig.baseDomain + url.substr(1) : url || "";
3230
+ url = ("" + url.replace(/\/+$/, "") + ending).replace("[project]", project);
3221
3231
  return this.universal.isServer && url.startsWith("//") ? "http:" + url : url;
3222
3232
  };
3223
3233
  ConfigService.prototype.getConfigValue = function (key) {