@stemy/ngx-utils 11.0.10 → 11.2.0
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 +18 -7
- 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 +2 -1
- package/esm2015/ngx-utils/ngx-utils.module.js +6 -2
- package/esm2015/ngx-utils/services/base-http.service.js +6 -4
- package/esm2015/ngx-utils/services/config.service.js +9 -6
- package/esm2015/public_api.js +2 -2
- package/fesm2015/stemy-ngx-utils.js +18 -8
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/common-types.d.ts +1 -0
- package/ngx-utils/services/base-http.service.d.ts +1 -1
- package/ngx-utils/services/config.service.d.ts +3 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -780,6 +780,7 @@
|
|
|
780
780
|
var CONFIG_SERVICE = new core.InjectionToken("config-service");
|
|
781
781
|
var BASE_CONFIG = new core.InjectionToken("base-config");
|
|
782
782
|
var SCRIPT_PARAMS = new core.InjectionToken("script-params");
|
|
783
|
+
var ROOT_ELEMENT = new core.InjectionToken("app-root-element");
|
|
783
784
|
var ERROR_HANDLER = new core.InjectionToken("error-handler-callback");
|
|
784
785
|
// --- Valued promise ---
|
|
785
786
|
var ValuedPromise = /** @class */ (function (_super) {
|
|
@@ -2986,11 +2987,12 @@
|
|
|
2986
2987
|
var authKey = "Authorization";
|
|
2987
2988
|
// If an authorization header exists and we still have an Unauthorized response prompt the user to log in again
|
|
2988
2989
|
if (headers.has(authKey) && response.status == 401) {
|
|
2989
|
-
_this.pushFailedRequest(url, options, function () {
|
|
2990
|
+
var pushed = _this.pushFailedRequest(url, options, function () {
|
|
2990
2991
|
options.headers = _this.makeHeaders(options.originalHeaders);
|
|
2991
2992
|
_this.toPromise(url, options, listener).then(resolve, reject);
|
|
2992
2993
|
});
|
|
2993
|
-
|
|
2994
|
+
if (pushed)
|
|
2995
|
+
_this.handleUnauthorizedError(absoluteUrl, options, function () { return reject(response); });
|
|
2994
2996
|
return;
|
|
2995
2997
|
}
|
|
2996
2998
|
reject(response);
|
|
@@ -3000,8 +3002,9 @@
|
|
|
3000
3002
|
};
|
|
3001
3003
|
BaseHttpService.prototype.pushFailedRequest = function (url, options, req) {
|
|
3002
3004
|
if (url.indexOf("tokens") >= 0)
|
|
3003
|
-
return;
|
|
3005
|
+
return false;
|
|
3004
3006
|
BaseHttpService.failedRequests.push(req);
|
|
3007
|
+
return true;
|
|
3005
3008
|
};
|
|
3006
3009
|
BaseHttpService.prototype.checkHeaders = function (headers) {
|
|
3007
3010
|
if (!headers || !headers.cookie || !headers.referer || !headers.host) {
|
|
@@ -3130,12 +3133,13 @@
|
|
|
3130
3133
|
}());
|
|
3131
3134
|
|
|
3132
3135
|
var ConfigService = /** @class */ (function () {
|
|
3133
|
-
function ConfigService(http, universal, baseConfig, scriptParams) {
|
|
3136
|
+
function ConfigService(http, universal, rootElement, baseConfig, scriptParams) {
|
|
3134
3137
|
var _this = this;
|
|
3135
3138
|
if (baseConfig === void 0) { baseConfig = null; }
|
|
3136
3139
|
if (scriptParams === void 0) { scriptParams = null; }
|
|
3137
3140
|
this.http = http;
|
|
3138
3141
|
this.universal = universal;
|
|
3142
|
+
this.rootElement = rootElement;
|
|
3139
3143
|
for (var key in []) {
|
|
3140
3144
|
Object.defineProperty(Array.prototype, key, {
|
|
3141
3145
|
enumerable: false
|
|
@@ -3150,13 +3154,15 @@
|
|
|
3150
3154
|
baseUrl = scriptSrc.substr(0, srcParts[0].lastIndexOf("/") + 1);
|
|
3151
3155
|
}
|
|
3152
3156
|
}
|
|
3153
|
-
this.
|
|
3157
|
+
this.baseConfig = baseConfig || {};
|
|
3158
|
+
this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl: baseUrl }, this.baseConfig);
|
|
3154
3159
|
this.scriptParameters = scriptParams || {};
|
|
3155
3160
|
this.loaderFunc = function () {
|
|
3156
3161
|
_this.loader = _this.loader || new Promise(function (resolve, reject) {
|
|
3157
3162
|
_this.loadJson().then(function (config) {
|
|
3158
3163
|
_this.loadedConfig = config = Object.assign(_this.loadedConfig, config);
|
|
3159
3164
|
_this.prepareConfig(config).then(function (c) {
|
|
3165
|
+
_this.loadedConfig = c;
|
|
3160
3166
|
c.baseUrl = c.baseUrl || "/";
|
|
3161
3167
|
resolve(c);
|
|
3162
3168
|
});
|
|
@@ -3199,8 +3205,7 @@
|
|
|
3199
3205
|
_this.http.get(configUrl).toPromise().then(function (response) {
|
|
3200
3206
|
resolve(response);
|
|
3201
3207
|
}, function () {
|
|
3202
|
-
|
|
3203
|
-
resolve({});
|
|
3208
|
+
reject("Config file not found at: " + configUrl);
|
|
3204
3209
|
});
|
|
3205
3210
|
});
|
|
3206
3211
|
};
|
|
@@ -3234,6 +3239,7 @@
|
|
|
3234
3239
|
ConfigService.ctorParameters = function () { return [
|
|
3235
3240
|
{ type: http.HttpClient },
|
|
3236
3241
|
{ type: UniversalService },
|
|
3242
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [ROOT_ELEMENT,] }] },
|
|
3237
3243
|
{ type: IConfiguration, decorators: [{ type: core.Optional }, { type: core.Inject, args: [BASE_CONFIG,] }] },
|
|
3238
3244
|
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [SCRIPT_PARAMS,] }] }
|
|
3239
3245
|
]; };
|
|
@@ -5859,6 +5865,10 @@
|
|
|
5859
5865
|
provide: CONFIG_SERVICE,
|
|
5860
5866
|
useExisting: (!config ? null : config.configService) || ConfigService
|
|
5861
5867
|
},
|
|
5868
|
+
{
|
|
5869
|
+
provide: ROOT_ELEMENT,
|
|
5870
|
+
useValue: null
|
|
5871
|
+
},
|
|
5862
5872
|
{
|
|
5863
5873
|
provide: core.APP_INITIALIZER,
|
|
5864
5874
|
useFactory: (!config ? null : config.initializeApp) || loadConfig,
|
|
@@ -5957,6 +5967,7 @@
|
|
|
5957
5967
|
exports.PaginationMenuComponent = PaginationMenuComponent;
|
|
5958
5968
|
exports.Point = Point;
|
|
5959
5969
|
exports.PromiseService = PromiseService;
|
|
5970
|
+
exports.ROOT_ELEMENT = ROOT_ELEMENT;
|
|
5960
5971
|
exports.Rect = Rect;
|
|
5961
5972
|
exports.ReducePipe = ReducePipe;
|
|
5962
5973
|
exports.ReflectUtils = ReflectUtils;
|