@stemy/ngx-utils 11.1.1 → 11.2.3
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 +36 -23
- 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/common-types.js +1 -1
- package/esm2015/ngx-utils/pipes/reduce.pipe.js +1 -1
- package/esm2015/ngx-utils/services/acl.service.js +21 -19
- package/esm2015/ngx-utils/services/base-http.service.js +6 -4
- package/esm2015/ngx-utils/services/config.service.js +11 -2
- package/fesm2015/stemy-ngx-utils.js +35 -22
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/common-types.d.ts +2 -1
- package/ngx-utils/pipes/reduce.pipe.d.ts +1 -1
- package/ngx-utils/services/acl.service.d.ts +3 -4
- package/ngx-utils/services/base-http.service.d.ts +1 -1
- package/package.json +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -2620,7 +2620,20 @@
|
|
|
2620
2620
|
var check = info && info.guard instanceof AuthGuard ? info.guard.checkRoute(info.route) : Promise.resolve(true);
|
|
2621
2621
|
check.then(function (result) {
|
|
2622
2622
|
if (result) {
|
|
2623
|
-
|
|
2623
|
+
if (!info || !info.dirty)
|
|
2624
|
+
return;
|
|
2625
|
+
info.dirty = false;
|
|
2626
|
+
var component = info.component;
|
|
2627
|
+
if (info.first) {
|
|
2628
|
+
if (ObjectUtils.isFunction(component.onUserInitialized)) {
|
|
2629
|
+
component.onUserInitialized();
|
|
2630
|
+
}
|
|
2631
|
+
info.first = false;
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
if (ObjectUtils.isFunction(component.onUserChanged)) {
|
|
2635
|
+
component.onUserChanged();
|
|
2636
|
+
}
|
|
2624
2637
|
return;
|
|
2625
2638
|
}
|
|
2626
2639
|
info.guard.getReturnState(info.route).then(function (returnState) {
|
|
@@ -2632,25 +2645,14 @@
|
|
|
2632
2645
|
});
|
|
2633
2646
|
this.state.subscribe(function () {
|
|
2634
2647
|
var info = _this.getStateInfo();
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
AclService.checkStateDirty = function (info) {
|
|
2639
|
-
if (!info || !info.dirty)
|
|
2640
|
-
return;
|
|
2641
|
-
info.dirty = false;
|
|
2642
|
-
var component = info.component;
|
|
2643
|
-
if (info.first) {
|
|
2648
|
+
if (!(info === null || info === void 0 ? void 0 : info.component))
|
|
2649
|
+
return;
|
|
2650
|
+
var component = info.component;
|
|
2644
2651
|
if (ObjectUtils.isFunction(component.onUserInitialized)) {
|
|
2645
2652
|
component.onUserInitialized();
|
|
2646
2653
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
}
|
|
2650
|
-
if (ObjectUtils.isFunction(component.onUserChanged)) {
|
|
2651
|
-
component.onUserChanged();
|
|
2652
|
-
}
|
|
2653
|
-
};
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2654
2656
|
AclService.prototype.getStateInfo = function () {
|
|
2655
2657
|
var _this = this;
|
|
2656
2658
|
var route = this.state.route;
|
|
@@ -2661,13 +2663,13 @@
|
|
|
2661
2663
|
var guardType = (route.canActivate || emptyGuards)[0];
|
|
2662
2664
|
info = {
|
|
2663
2665
|
route: this.state.route,
|
|
2664
|
-
component: this.state.component,
|
|
2665
2666
|
guard: guardType ? this.injector.get(guardType) : null,
|
|
2666
|
-
dirty:
|
|
2667
|
+
dirty: true,
|
|
2667
2668
|
first: true
|
|
2668
2669
|
};
|
|
2669
2670
|
this.components.push(info);
|
|
2670
2671
|
}
|
|
2672
|
+
info.component = this.state.component;
|
|
2671
2673
|
return info;
|
|
2672
2674
|
};
|
|
2673
2675
|
return AclService;
|
|
@@ -2987,11 +2989,12 @@
|
|
|
2987
2989
|
var authKey = "Authorization";
|
|
2988
2990
|
// If an authorization header exists and we still have an Unauthorized response prompt the user to log in again
|
|
2989
2991
|
if (headers.has(authKey) && response.status == 401) {
|
|
2990
|
-
_this.pushFailedRequest(url, options, function () {
|
|
2992
|
+
var pushed = _this.pushFailedRequest(url, options, function () {
|
|
2991
2993
|
options.headers = _this.makeHeaders(options.originalHeaders);
|
|
2992
2994
|
_this.toPromise(url, options, listener).then(resolve, reject);
|
|
2993
2995
|
});
|
|
2994
|
-
|
|
2996
|
+
if (pushed)
|
|
2997
|
+
_this.handleUnauthorizedError(absoluteUrl, options, function () { return reject(response); });
|
|
2995
2998
|
return;
|
|
2996
2999
|
}
|
|
2997
3000
|
reject(response);
|
|
@@ -3001,8 +3004,9 @@
|
|
|
3001
3004
|
};
|
|
3002
3005
|
BaseHttpService.prototype.pushFailedRequest = function (url, options, req) {
|
|
3003
3006
|
if (url.indexOf("tokens") >= 0)
|
|
3004
|
-
return;
|
|
3007
|
+
return false;
|
|
3005
3008
|
BaseHttpService.failedRequests.push(req);
|
|
3009
|
+
return true;
|
|
3006
3010
|
};
|
|
3007
3011
|
BaseHttpService.prototype.checkHeaders = function (headers) {
|
|
3008
3012
|
if (!headers || !headers.cookie || !headers.referer || !headers.host) {
|
|
@@ -3154,6 +3158,14 @@
|
|
|
3154
3158
|
}
|
|
3155
3159
|
this.baseConfig = baseConfig || {};
|
|
3156
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
|
+
}
|
|
3157
3169
|
this.scriptParameters = scriptParams || {};
|
|
3158
3170
|
this.loaderFunc = function () {
|
|
3159
3171
|
_this.loader = _this.loader || new Promise(function (resolve, reject) {
|
|
@@ -3214,7 +3226,8 @@
|
|
|
3214
3226
|
var project = !this.loadedConfig ? "" : this.loadedConfig.project;
|
|
3215
3227
|
url = url ? "" + url.replace(/\/+$/, "") + ending : ending;
|
|
3216
3228
|
url = url.replace("[project]", project);
|
|
3217
|
-
|
|
3229
|
+
url = this.universal.isServer && url.startsWith("//") ? "http:" + url : url;
|
|
3230
|
+
return url.startsWith("/") ? this.loadedConfig.baseUrl + url.substr(1) : url;
|
|
3218
3231
|
};
|
|
3219
3232
|
ConfigService.prototype.getConfigValue = function (key) {
|
|
3220
3233
|
return this.loadedConfig[key];
|