@stemy/ngx-utils 11.2.5 → 11.2.9
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/bundles/stemy-ngx-utils.umd.js +15 -11
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/bundles/stemy-ngx-utils.umd.min.js +1 -1
- package/bundles/stemy-ngx-utils.umd.min.js.map +1 -1
- package/esm2015/ngx-utils/services/config.service.js +16 -12
- package/fesm2015/stemy-ngx-utils.js +15 -11
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/services/config.service.d.ts +1 -0
- package/package.json +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -3157,15 +3157,7 @@
|
|
|
3157
3157
|
}
|
|
3158
3158
|
}
|
|
3159
3159
|
this.baseConfig = baseConfig || {};
|
|
3160
|
-
this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl: baseUrl }, this.baseConfig);
|
|
3161
|
-
try {
|
|
3162
|
-
var url = new URL(this.loadedConfig.baseUrl);
|
|
3163
|
-
var port = url.port && url.port !== "443" && url.port !== "80" ? ":" + url.port : "";
|
|
3164
|
-
this.loadedConfig.baseDomain = url.protocol + "://" + url.hostname + port + "/";
|
|
3165
|
-
}
|
|
3166
|
-
catch (_a) {
|
|
3167
|
-
this.loadedConfig.baseDomain = "/";
|
|
3168
|
-
}
|
|
3160
|
+
this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl: baseUrl, baseDomain: this.parseDomain(baseUrl) }, this.baseConfig);
|
|
3169
3161
|
this.scriptParameters = scriptParams || {};
|
|
3170
3162
|
this.loaderFunc = function () {
|
|
3171
3163
|
_this.loader = _this.loader || new Promise(function (resolve, reject) {
|
|
@@ -3203,6 +3195,16 @@
|
|
|
3203
3195
|
enumerable: false,
|
|
3204
3196
|
configurable: true
|
|
3205
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
|
+
};
|
|
3206
3208
|
ConfigService.prototype.initService = function () {
|
|
3207
3209
|
};
|
|
3208
3210
|
ConfigService.prototype.loadJson = function () {
|
|
@@ -3223,10 +3225,12 @@
|
|
|
3223
3225
|
return Promise.resolve(config);
|
|
3224
3226
|
};
|
|
3225
3227
|
ConfigService.prototype.prepareUrl = function (url, ending) {
|
|
3228
|
+
var _a;
|
|
3226
3229
|
var project = !this.loadedConfig ? "" : this.loadedConfig.project;
|
|
3227
|
-
|
|
3230
|
+
var needsProtocol = (_a = url === null || url === void 0 ? void 0 : url.startsWith("//")) !== null && _a !== void 0 ? _a : false;
|
|
3231
|
+
url = !needsProtocol && (url === null || url === void 0 ? void 0 : url.startsWith("/")) ? this.loadedConfig.baseDomain + url.substr(1) : url || "";
|
|
3228
3232
|
url = ("" + url.replace(/\/+$/, "") + ending).replace("[project]", project);
|
|
3229
|
-
return this.universal.isServer &&
|
|
3233
|
+
return this.universal.isServer && needsProtocol ? "http:" + url : url;
|
|
3230
3234
|
};
|
|
3231
3235
|
ConfigService.prototype.getConfigValue = function (key) {
|
|
3232
3236
|
return this.loadedConfig[key];
|