@dontdrinkandroot/ngx-extensions 0.0.5 → 0.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/{esm2015/dontdrinkandroot-ngx-extensions.js → esm2020/dontdrinkandroot-ngx-extensions.mjs} +1 -1
- package/esm2020/public-api.mjs +24 -0
- package/esm2020/src/cookie/cookie.service.mjs +135 -0
- package/esm2020/src/ddr-extensions.module.mjs +40 -0
- package/esm2020/src/http/redirect-to-login-interceptor.service.mjs +35 -0
- package/esm2020/src/http/url-info.mjs +26 -0
- package/esm2020/src/http/with-credentials-interceptor.service.mjs +19 -0
- package/esm2020/src/image/lazy-image.directive.mjs +132 -0
- package/esm2020/src/jwt/jwt-interceptor.service.mjs +26 -0
- package/esm2020/src/jwt/jwt-refresh-token-interceptor.service.mjs +50 -0
- package/esm2020/src/jwt/jwt-token-response.mjs +2 -0
- package/esm2020/src/jwt/jwt.service.mjs +82 -0
- package/esm2020/src/methoddecorator/debounce.mjs +13 -0
- package/esm2020/src/methoddecorator/limit.mjs +16 -0
- package/esm2020/src/scroll/bottom-hit.directive.mjs +60 -0
- package/esm2020/src/scroll/scroll.service.mjs +38 -0
- package/esm2020/src/util/collection-utils.mjs +27 -0
- package/esm2020/src/util/number-utils.mjs +10 -0
- package/esm2020/src/util/object-utils.mjs +9 -0
- package/esm2020/src/util/string-utils.mjs +35 -0
- package/esm2020/src/util/type-utils.mjs +9 -0
- package/esm2020/src/visibility/visibility.service.mjs +19 -0
- package/fesm2015/dontdrinkandroot-ngx-extensions.mjs +760 -0
- package/fesm2015/dontdrinkandroot-ngx-extensions.mjs.map +1 -0
- package/{fesm2015/dontdrinkandroot-ngx-extensions.js → fesm2020/dontdrinkandroot-ngx-extensions.mjs} +210 -154
- package/fesm2020/dontdrinkandroot-ngx-extensions.mjs.map +1 -0
- package/{dontdrinkandroot-ngx-extensions.d.ts → index.d.ts} +1 -0
- package/package.json +23 -11
- package/public-api.d.ts +1 -0
- package/src/cookie/cookie.service.d.ts +5 -2
- package/src/ddr-extensions.module.d.ts +6 -0
- package/src/http/redirect-to-login-interceptor.service.d.ts +4 -1
- package/src/http/url-info.d.ts +8 -7
- package/src/http/with-credentials-interceptor.service.d.ts +3 -0
- package/src/image/lazy-image.directive.d.ts +4 -1
- package/src/jwt/jwt-interceptor.service.d.ts +3 -0
- package/src/jwt/jwt-refresh-token-interceptor.service.d.ts +3 -0
- package/src/jwt/jwt.service.d.ts +3 -0
- package/src/scroll/bottom-hit.directive.d.ts +3 -0
- package/src/scroll/scroll.service.d.ts +3 -0
- package/src/util/collection-utils.d.ts +2 -4
- package/src/util/object-utils.d.ts +1 -0
- package/src/util/type-utils.d.ts +3 -0
- package/src/visibility/visibility.service.d.ts +3 -0
- package/bundles/dontdrinkandroot-ngx-extensions.umd.js +0 -1088
- package/bundles/dontdrinkandroot-ngx-extensions.umd.js.map +0 -1
- package/bundles/dontdrinkandroot-ngx-extensions.umd.min.js +0 -16
- package/bundles/dontdrinkandroot-ngx-extensions.umd.min.js.map +0 -1
- package/dontdrinkandroot-ngx-extensions.metadata.json +0 -1
- package/esm2015/public-api.js +0 -23
- package/esm2015/src/cookie/cookie.service.js +0 -136
- package/esm2015/src/ddr-extensions.module.js +0 -28
- package/esm2015/src/http/redirect-to-login-interceptor.service.js +0 -33
- package/esm2015/src/http/url-info.js +0 -26
- package/esm2015/src/http/with-credentials-interceptor.service.js +0 -16
- package/esm2015/src/image/lazy-image.directive.js +0 -118
- package/esm2015/src/jwt/jwt-interceptor.service.js +0 -26
- package/esm2015/src/jwt/jwt-refresh-token-interceptor.service.js +0 -50
- package/esm2015/src/jwt/jwt-token-response.js +0 -2
- package/esm2015/src/jwt/jwt.service.js +0 -73
- package/esm2015/src/methoddecorator/debounce.js +0 -12
- package/esm2015/src/methoddecorator/limit.js +0 -16
- package/esm2015/src/scroll/bottom-hit.directive.js +0 -53
- package/esm2015/src/scroll/scroll.service.js +0 -39
- package/esm2015/src/util/collection-utils.js +0 -29
- package/esm2015/src/util/number-utils.js +0 -10
- package/esm2015/src/util/object-utils.js +0 -6
- package/esm2015/src/util/string-utils.js +0 -35
- package/esm2015/src/visibility/visibility.service.js +0 -18
- package/fesm2015/dontdrinkandroot-ngx-extensions.js.map +0 -1
package/{fesm2015/dontdrinkandroot-ngx-extensions.js → fesm2020/dontdrinkandroot-ngx-extensions.mjs}
RENAMED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, Input, HostBinding, HostListener, EventEmitter, Output, InjectionToken, NgModule, Injectable, Inject } from '@angular/core';
|
|
2
3
|
import { __decorate } from 'tslib';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import * as i2 from '@angular/common';
|
|
5
|
+
import { DOCUMENT } from '@angular/common';
|
|
6
|
+
import * as i1 from '@angular/router';
|
|
7
|
+
import { NavigationStart } from '@angular/router';
|
|
8
|
+
import { merge, fromEvent, throwError } from 'rxjs';
|
|
6
9
|
import { debounceTime, startWith, map, distinctUntilChanged, shareReplay, catchError, switchMap } from 'rxjs/operators';
|
|
7
|
-
import
|
|
10
|
+
import * as i2$1 from '@angular/common/http';
|
|
11
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
8
12
|
|
|
9
13
|
class NumberUtils {
|
|
10
14
|
static getNextPowerOfTwo(value) {
|
|
@@ -52,26 +56,27 @@ class StringUtils {
|
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
function Debounce(delay = 250) {
|
|
59
|
+
let timeoutReference = undefined;
|
|
55
60
|
return (target, propertyKey, descriptor) => {
|
|
56
61
|
const original = descriptor.value;
|
|
57
|
-
const key = `__timeout__${propertyKey}`;
|
|
58
62
|
descriptor.value = function (...args) {
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
if (null != timeoutReference)
|
|
64
|
+
clearTimeout(timeoutReference);
|
|
65
|
+
timeoutReference = setTimeout(() => original.apply(this, args), delay);
|
|
61
66
|
};
|
|
62
67
|
return descriptor;
|
|
63
68
|
};
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
function Limit(rate = 250) {
|
|
72
|
+
let timeoutReference = undefined;
|
|
67
73
|
return (target, propertyKey, descriptor) => {
|
|
68
74
|
const original = descriptor.value;
|
|
69
|
-
const key = `__timeout__${propertyKey}`;
|
|
70
75
|
descriptor.value = function (...args) {
|
|
71
|
-
if (null ==
|
|
72
|
-
|
|
76
|
+
if (null == timeoutReference) {
|
|
77
|
+
timeoutReference = setTimeout(() => {
|
|
73
78
|
original.apply(this, args);
|
|
74
|
-
|
|
79
|
+
timeoutReference = undefined;
|
|
75
80
|
}, rate);
|
|
76
81
|
}
|
|
77
82
|
};
|
|
@@ -166,30 +171,43 @@ class LazyImageDirective {
|
|
|
166
171
|
return window.getComputedStyle(element).display === 'none';
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
|
-
LazyImageDirective
|
|
170
|
-
|
|
171
|
-
];
|
|
172
|
-
LazyImageDirective.ctorParameters = () => [
|
|
173
|
-
{ type: ElementRef },
|
|
174
|
-
{ type: ChangeDetectorRef }
|
|
175
|
-
];
|
|
176
|
-
LazyImageDirective.propDecorators = {
|
|
177
|
-
src: [{ type: Input, args: ['ddrLazyImage',] }],
|
|
178
|
-
objectFit: [{ type: Input }],
|
|
179
|
-
offset: [{ type: Input }],
|
|
180
|
-
hostSrc: [{ type: HostBinding, args: ['src',] }],
|
|
181
|
-
hostStyleWidthPx: [{ type: HostBinding, args: ['style.width.px',] }],
|
|
182
|
-
hostStyleHeightPx: [{ type: HostBinding, args: ['style.height.px',] }],
|
|
183
|
-
hostStyleObjectFit: [{ type: HostBinding, args: ['style.object-fit',] }],
|
|
184
|
-
windowResized: [{ type: HostListener, args: ['window:resize', ['$event'],] }],
|
|
185
|
-
windowScroll: [{ type: HostListener, args: ['window:scroll', ['$event'],] }]
|
|
186
|
-
};
|
|
174
|
+
LazyImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: LazyImageDirective, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
175
|
+
LazyImageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: LazyImageDirective, selector: "[ddrLazyImage]", inputs: { src: ["ddrLazyImage", "src"], objectFit: "objectFit", offset: "offset" }, host: { listeners: { "window:resize": "windowResized($event)", "window:scroll": "windowScroll($event)" }, properties: { "src": "this.hostSrc", "style.width.px": "this.hostStyleWidthPx", "style.height.px": "this.hostStyleHeightPx", "style.object-fit": "this.hostStyleObjectFit" } }, usesOnChanges: true, ngImport: i0 });
|
|
187
176
|
__decorate([
|
|
188
177
|
Debounce()
|
|
189
178
|
], LazyImageDirective.prototype, "windowResized", null);
|
|
190
179
|
__decorate([
|
|
191
180
|
Limit()
|
|
192
181
|
], LazyImageDirective.prototype, "windowScroll", null);
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: LazyImageDirective, decorators: [{
|
|
183
|
+
type: Directive,
|
|
184
|
+
args: [{ selector: '[ddrLazyImage]' }]
|
|
185
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { src: [{
|
|
186
|
+
type: Input,
|
|
187
|
+
args: ['ddrLazyImage']
|
|
188
|
+
}], objectFit: [{
|
|
189
|
+
type: Input
|
|
190
|
+
}], offset: [{
|
|
191
|
+
type: Input
|
|
192
|
+
}], hostSrc: [{
|
|
193
|
+
type: HostBinding,
|
|
194
|
+
args: ['src']
|
|
195
|
+
}], hostStyleWidthPx: [{
|
|
196
|
+
type: HostBinding,
|
|
197
|
+
args: ['style.width.px']
|
|
198
|
+
}], hostStyleHeightPx: [{
|
|
199
|
+
type: HostBinding,
|
|
200
|
+
args: ['style.height.px']
|
|
201
|
+
}], hostStyleObjectFit: [{
|
|
202
|
+
type: HostBinding,
|
|
203
|
+
args: ['style.object-fit']
|
|
204
|
+
}], windowResized: [{
|
|
205
|
+
type: HostListener,
|
|
206
|
+
args: ['window:resize', ['$event']]
|
|
207
|
+
}], windowScroll: [{
|
|
208
|
+
type: HostListener,
|
|
209
|
+
args: ['window:scroll', ['$event']]
|
|
210
|
+
}] } });
|
|
193
211
|
|
|
194
212
|
class BottomHitDirective {
|
|
195
213
|
constructor() {
|
|
@@ -222,58 +240,70 @@ class BottomHitDirective {
|
|
|
222
240
|
}
|
|
223
241
|
}
|
|
224
242
|
}
|
|
225
|
-
BottomHitDirective
|
|
226
|
-
|
|
227
|
-
selector: '[ddrBottomHit]'
|
|
228
|
-
},] }
|
|
229
|
-
];
|
|
230
|
-
BottomHitDirective.ctorParameters = () => [];
|
|
231
|
-
BottomHitDirective.propDecorators = {
|
|
232
|
-
onWindowBottomHit: [{ type: Output }],
|
|
233
|
-
onElementBottomHit: [{ type: Output }],
|
|
234
|
-
scrolled: [{ type: HostListener, args: ['scroll', ['$event'],] }],
|
|
235
|
-
windowScrolled: [{ type: HostListener, args: ['window:scroll', ['$event'],] }]
|
|
236
|
-
};
|
|
243
|
+
BottomHitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BottomHitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
244
|
+
BottomHitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: BottomHitDirective, selector: "[ddrBottomHit]", outputs: { onWindowBottomHit: "onWindowBottomHit", onElementBottomHit: "onElementBottomHit" }, host: { listeners: { "scroll": "scrolled($event)", "window:scroll": "windowScrolled($event)" } }, ngImport: i0 });
|
|
237
245
|
__decorate([
|
|
238
246
|
Limit()
|
|
239
247
|
], BottomHitDirective.prototype, "scrolled", null);
|
|
240
248
|
__decorate([
|
|
241
249
|
Limit()
|
|
242
250
|
], BottomHitDirective.prototype, "windowScrolled", null);
|
|
251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: BottomHitDirective, decorators: [{
|
|
252
|
+
type: Directive,
|
|
253
|
+
args: [{
|
|
254
|
+
selector: '[ddrBottomHit]'
|
|
255
|
+
}]
|
|
256
|
+
}], ctorParameters: function () { return []; }, propDecorators: { onWindowBottomHit: [{
|
|
257
|
+
type: Output
|
|
258
|
+
}], onElementBottomHit: [{
|
|
259
|
+
type: Output
|
|
260
|
+
}], scrolled: [{
|
|
261
|
+
type: HostListener,
|
|
262
|
+
args: ['scroll', ['$event']]
|
|
263
|
+
}], windowScrolled: [{
|
|
264
|
+
type: HostListener,
|
|
265
|
+
args: ['window:scroll', ['$event']]
|
|
266
|
+
}] } });
|
|
243
267
|
|
|
244
268
|
const DDR_STORAGE_PREFIX = new InjectionToken('DDR_STORAGE_PREFIX');
|
|
245
269
|
const DDR_JWT_REFRESH_TOKEN_URL = new InjectionToken('DDR_JWT_REFRESH_TOKEN_URL');
|
|
246
270
|
const DDR_LOGIN_PATH = new InjectionToken('DDR_LOGIN_PATH');
|
|
247
271
|
class DdrExtensionsModule {
|
|
248
272
|
}
|
|
249
|
-
DdrExtensionsModule
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
273
|
+
DdrExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: DdrExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
274
|
+
DdrExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: DdrExtensionsModule, declarations: [LazyImageDirective,
|
|
275
|
+
BottomHitDirective], exports: [LazyImageDirective,
|
|
276
|
+
BottomHitDirective] });
|
|
277
|
+
DdrExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: DdrExtensionsModule, providers: [
|
|
278
|
+
{
|
|
279
|
+
provide: DDR_LOGIN_PATH,
|
|
280
|
+
useValue: '/login'
|
|
281
|
+
}
|
|
282
|
+
] });
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: DdrExtensionsModule, decorators: [{
|
|
284
|
+
type: NgModule,
|
|
285
|
+
args: [{
|
|
286
|
+
declarations: [
|
|
287
|
+
LazyImageDirective,
|
|
288
|
+
BottomHitDirective
|
|
289
|
+
],
|
|
290
|
+
imports: [],
|
|
291
|
+
providers: [
|
|
292
|
+
{
|
|
293
|
+
provide: DDR_LOGIN_PATH,
|
|
294
|
+
useValue: '/login'
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
exports: [
|
|
298
|
+
LazyImageDirective,
|
|
299
|
+
BottomHitDirective
|
|
300
|
+
]
|
|
301
|
+
}]
|
|
302
|
+
}] });
|
|
268
303
|
|
|
269
304
|
// This service is based on the `ng2-cookies` package which sadly is not a service and does
|
|
270
305
|
class CookieService {
|
|
271
|
-
constructor(
|
|
272
|
-
// The type `Document` may not be used here. Although a fix is on its way,
|
|
273
|
-
// we will go with `any` for now to support Angular 2.4.x projects.
|
|
274
|
-
// Issue: https://github.com/angular/angular/issues/12631
|
|
275
|
-
// Fix: https://github.com/angular/angular/pull/14894
|
|
276
|
-
document) {
|
|
306
|
+
constructor(document) {
|
|
277
307
|
this.document = document;
|
|
278
308
|
// To avoid issues with server side prerendering, check if `document` is defined.
|
|
279
309
|
this.documentIsAccessible = document !== undefined;
|
|
@@ -297,6 +327,8 @@ class CookieService {
|
|
|
297
327
|
name = encodeURIComponent(name);
|
|
298
328
|
const regExp = this.getCookieRegExp(name);
|
|
299
329
|
const result = regExp.exec(this.document.cookie);
|
|
330
|
+
if (null == result)
|
|
331
|
+
return '';
|
|
300
332
|
return decodeURIComponent(result[1]);
|
|
301
333
|
}
|
|
302
334
|
else {
|
|
@@ -314,6 +346,7 @@ class CookieService {
|
|
|
314
346
|
for (let i = 0; i < split.length; i += 1) {
|
|
315
347
|
const currentCookie = split[i].split('=');
|
|
316
348
|
currentCookie[0] = currentCookie[0].replace(/^ /, '');
|
|
349
|
+
// @ts-ignore
|
|
317
350
|
cookies[decodeURIComponent(currentCookie[0])] = decodeURIComponent(currentCookie[1]);
|
|
318
351
|
}
|
|
319
352
|
}
|
|
@@ -382,52 +415,63 @@ class CookieService {
|
|
|
382
415
|
* @param name Cookie name
|
|
383
416
|
*/
|
|
384
417
|
getCookieRegExp(name) {
|
|
385
|
-
const escapedName = name.replace(/([\[\]
|
|
418
|
+
const escapedName = name.replace(/([\[\]{}()|=;+?,.*^$])/ig, '\\$1');
|
|
386
419
|
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
|
|
387
420
|
}
|
|
388
421
|
}
|
|
389
|
-
CookieService.ɵ
|
|
390
|
-
CookieService
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
422
|
+
CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
423
|
+
CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: CookieService, providedIn: 'root' });
|
|
424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: CookieService, decorators: [{
|
|
425
|
+
type: Injectable,
|
|
426
|
+
args: [{
|
|
427
|
+
providedIn: 'root'
|
|
428
|
+
}]
|
|
429
|
+
}], ctorParameters: function () { return [{ type: Document, decorators: [{
|
|
430
|
+
type: Inject,
|
|
431
|
+
args: [DOCUMENT]
|
|
432
|
+
}] }]; } });
|
|
433
|
+
|
|
434
|
+
class ObjectUtils {
|
|
435
|
+
static deepCopy(value) {
|
|
436
|
+
return JSON.parse(JSON.stringify(value));
|
|
437
|
+
}
|
|
438
|
+
static getProperty(o, propertyName) {
|
|
439
|
+
return o[propertyName];
|
|
440
|
+
}
|
|
441
|
+
}
|
|
398
442
|
|
|
399
443
|
class CollectionUtils {
|
|
400
444
|
/**
|
|
401
445
|
* Maps an array into a Map by a specific property which should be unique.
|
|
402
|
-
* TODO: Maybe there is something like that in typescript, couldn't find it yet.
|
|
403
446
|
*/
|
|
404
447
|
static mapByProperty(entries, property) {
|
|
405
448
|
const map = new Map();
|
|
406
449
|
for (const entry of entries) {
|
|
407
|
-
map.set(entry
|
|
450
|
+
map.set(ObjectUtils.getProperty(entry, property), entry);
|
|
408
451
|
}
|
|
409
452
|
return map;
|
|
410
453
|
}
|
|
411
454
|
/**
|
|
412
455
|
* Maps an array into a Map by a specified property and aggregates them into an array.
|
|
413
|
-
* TODO: Maybe there is something like that in typescript, couldn't find it yet.
|
|
414
456
|
*/
|
|
415
457
|
static mapArrayByProperty(entries, property) {
|
|
416
458
|
const map = new Map();
|
|
417
459
|
for (const entry of entries) {
|
|
418
|
-
const value = entry
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
map.get(value).push(entry);
|
|
460
|
+
const value = ObjectUtils.getProperty(entry, property);
|
|
461
|
+
const existingEntries = map.get(value) ?? [];
|
|
462
|
+
existingEntries.push(entry);
|
|
463
|
+
map.set(value, existingEntries);
|
|
423
464
|
}
|
|
424
465
|
return map;
|
|
425
466
|
}
|
|
426
467
|
}
|
|
427
468
|
|
|
428
|
-
class
|
|
429
|
-
static
|
|
430
|
-
|
|
469
|
+
class TypeUtils {
|
|
470
|
+
static notNull(value, message = 'Value must not be null') {
|
|
471
|
+
if (null == value) {
|
|
472
|
+
throw new Error(message);
|
|
473
|
+
}
|
|
474
|
+
return value;
|
|
431
475
|
}
|
|
432
476
|
}
|
|
433
477
|
|
|
@@ -448,21 +492,21 @@ class ScrollService {
|
|
|
448
492
|
if (this.scrollPositionMap.has(url)) {
|
|
449
493
|
/* Restore after timeout so rendering was completed */
|
|
450
494
|
setTimeout(() => {
|
|
451
|
-
this.
|
|
495
|
+
let scrollPosition = this.scrollPositionMap.get(url);
|
|
496
|
+
if (null != scrollPosition)
|
|
497
|
+
this.viewportScroller.scrollToPosition(scrollPosition);
|
|
452
498
|
}, 1);
|
|
453
499
|
}
|
|
454
500
|
}
|
|
455
501
|
}
|
|
456
|
-
ScrollService.ɵ
|
|
457
|
-
ScrollService
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
{ type: ViewportScroller }
|
|
465
|
-
];
|
|
502
|
+
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ScrollService, deps: [{ token: i1.Router }, { token: i2.ViewportScroller }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
503
|
+
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
|
504
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ScrollService, decorators: [{
|
|
505
|
+
type: Injectable,
|
|
506
|
+
args: [{
|
|
507
|
+
providedIn: 'root'
|
|
508
|
+
}]
|
|
509
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.ViewportScroller }]; } });
|
|
466
510
|
|
|
467
511
|
class VisibilityService {
|
|
468
512
|
constructor() {
|
|
@@ -472,11 +516,12 @@ class VisibilityService {
|
|
|
472
516
|
return this.visibility$;
|
|
473
517
|
}
|
|
474
518
|
}
|
|
475
|
-
VisibilityService.ɵ
|
|
476
|
-
VisibilityService
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
519
|
+
VisibilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: VisibilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
520
|
+
VisibilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: VisibilityService, providedIn: 'root' });
|
|
521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: VisibilityService, decorators: [{
|
|
522
|
+
type: Injectable,
|
|
523
|
+
args: [{ providedIn: 'root' }]
|
|
524
|
+
}], ctorParameters: function () { return []; } });
|
|
480
525
|
|
|
481
526
|
class WithCredentialsInterceptor {
|
|
482
527
|
/**
|
|
@@ -489,29 +534,31 @@ class WithCredentialsInterceptor {
|
|
|
489
534
|
return next.handle(cloned);
|
|
490
535
|
}
|
|
491
536
|
}
|
|
492
|
-
WithCredentialsInterceptor
|
|
493
|
-
|
|
494
|
-
|
|
537
|
+
WithCredentialsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: WithCredentialsInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
538
|
+
WithCredentialsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: WithCredentialsInterceptor });
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: WithCredentialsInterceptor, decorators: [{
|
|
540
|
+
type: Injectable
|
|
541
|
+
}] });
|
|
495
542
|
|
|
496
543
|
class UrlInfo {
|
|
544
|
+
constructor(protocol, host, hostname, port, pathname, hash, search) {
|
|
545
|
+
this.protocol = protocol;
|
|
546
|
+
this.host = host;
|
|
547
|
+
this.hostname = hostname;
|
|
548
|
+
this.port = port;
|
|
549
|
+
this.pathname = pathname;
|
|
550
|
+
this.hash = hash;
|
|
551
|
+
this.search = search;
|
|
552
|
+
}
|
|
497
553
|
static parse(urlString) {
|
|
498
554
|
const parser = document.createElement('a');
|
|
499
555
|
parser.href = urlString;
|
|
500
|
-
|
|
501
|
-
urlInfo.protocol = parser.protocol;
|
|
502
|
-
urlInfo.host = parser.host;
|
|
503
|
-
urlInfo.hostname = parser.hostname;
|
|
504
|
-
urlInfo.port = parser.port;
|
|
505
|
-
urlInfo.pathname = parser.pathname;
|
|
506
|
-
urlInfo.hash = parser.hash;
|
|
507
|
-
urlInfo.search = parser.search;
|
|
508
|
-
return urlInfo;
|
|
556
|
+
return new UrlInfo(parser.protocol, parser.host, parser.hostname, parser.port === '' ? 80 : +parser.port, parser.pathname, parser.hash, parser.search);
|
|
509
557
|
}
|
|
510
558
|
getRoot() {
|
|
511
559
|
let root = this.protocol + '//' + this.hostname;
|
|
512
|
-
if (this.port
|
|
560
|
+
if (this.port !== 80)
|
|
513
561
|
root += ':' + this.port;
|
|
514
|
-
}
|
|
515
562
|
return root;
|
|
516
563
|
}
|
|
517
564
|
getUrl() {
|
|
@@ -538,17 +585,26 @@ class RedirectToLoginInterceptor {
|
|
|
538
585
|
}));
|
|
539
586
|
}
|
|
540
587
|
}
|
|
541
|
-
RedirectToLoginInterceptor
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
]
|
|
588
|
+
RedirectToLoginInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: RedirectToLoginInterceptor, deps: [{ token: i1.Router }, { token: DDR_LOGIN_PATH }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
589
|
+
RedirectToLoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: RedirectToLoginInterceptor });
|
|
590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: RedirectToLoginInterceptor, decorators: [{
|
|
591
|
+
type: Injectable
|
|
592
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: undefined, decorators: [{
|
|
593
|
+
type: Inject,
|
|
594
|
+
args: [DDR_LOGIN_PATH]
|
|
595
|
+
}] }]; } });
|
|
548
596
|
|
|
549
597
|
class JwtService {
|
|
550
598
|
constructor(storagePrefix) {
|
|
551
599
|
this.storagePrefix = storagePrefix;
|
|
600
|
+
/**
|
|
601
|
+
* The current token.
|
|
602
|
+
*/
|
|
603
|
+
this.token = null;
|
|
604
|
+
/**
|
|
605
|
+
* The expiry of the current token.
|
|
606
|
+
*/
|
|
607
|
+
this.tokenExpiry = null;
|
|
552
608
|
}
|
|
553
609
|
/**
|
|
554
610
|
* Sets the current token and a refresh token.
|
|
@@ -605,15 +661,17 @@ class JwtService {
|
|
|
605
661
|
return this.storagePrefix + '.jwt.refresh_token';
|
|
606
662
|
}
|
|
607
663
|
}
|
|
608
|
-
JwtService.ɵ
|
|
609
|
-
JwtService
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
664
|
+
JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtService, deps: [{ token: DDR_STORAGE_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
665
|
+
JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtService, providedIn: 'root' });
|
|
666
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtService, decorators: [{
|
|
667
|
+
type: Injectable,
|
|
668
|
+
args: [{
|
|
669
|
+
providedIn: 'root'
|
|
670
|
+
}]
|
|
671
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
672
|
+
type: Inject,
|
|
673
|
+
args: [DDR_STORAGE_PREFIX]
|
|
674
|
+
}] }]; } });
|
|
617
675
|
|
|
618
676
|
class JwtInterceptor {
|
|
619
677
|
constructor(jwtService) {
|
|
@@ -632,18 +690,18 @@ class JwtInterceptor {
|
|
|
632
690
|
return next.handle(req);
|
|
633
691
|
}
|
|
634
692
|
}
|
|
635
|
-
JwtInterceptor
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
];
|
|
693
|
+
JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtInterceptor, deps: [{ token: JwtService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
694
|
+
JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtInterceptor });
|
|
695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtInterceptor, decorators: [{
|
|
696
|
+
type: Injectable
|
|
697
|
+
}], ctorParameters: function () { return [{ type: JwtService }]; } });
|
|
641
698
|
|
|
642
699
|
class JwtRefreshTokenInterceptor {
|
|
643
700
|
constructor(jwtService, httpClient, jwtRefreshTokenUrl) {
|
|
644
701
|
this.jwtService = jwtService;
|
|
645
702
|
this.httpClient = httpClient;
|
|
646
703
|
this.jwtRefreshTokenUrl = jwtRefreshTokenUrl;
|
|
704
|
+
this.refreshTokenRequest$ = null;
|
|
647
705
|
}
|
|
648
706
|
/**
|
|
649
707
|
* @override
|
|
@@ -659,29 +717,27 @@ class JwtRefreshTokenInterceptor {
|
|
|
659
717
|
}
|
|
660
718
|
getRefreshTokenRequest(refreshToken) {
|
|
661
719
|
if (null == this.refreshTokenRequest$) {
|
|
662
|
-
|
|
720
|
+
this.refreshTokenRequest$ = this.httpClient.post(this.jwtRefreshTokenUrl, { refresh_token: refreshToken }).pipe(map(response => {
|
|
663
721
|
this.jwtService.setTokens(response.token, response.refresh_token);
|
|
664
722
|
this.refreshTokenRequest$ = null;
|
|
665
723
|
return response;
|
|
666
724
|
}), catchError(error => {
|
|
667
725
|
this.jwtService.clear();
|
|
668
726
|
this.refreshTokenRequest$ = null;
|
|
669
|
-
return
|
|
727
|
+
return throwError(error);
|
|
670
728
|
}), shareReplay(1));
|
|
671
|
-
this.refreshTokenRequest$ = refreshTokenRequest;
|
|
672
|
-
return refreshTokenRequest;
|
|
673
729
|
}
|
|
674
730
|
return this.refreshTokenRequest$;
|
|
675
731
|
}
|
|
676
732
|
}
|
|
677
|
-
JwtRefreshTokenInterceptor
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
];
|
|
733
|
+
JwtRefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtRefreshTokenInterceptor, deps: [{ token: JwtService }, { token: i2$1.HttpClient }, { token: DDR_JWT_REFRESH_TOKEN_URL }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
734
|
+
JwtRefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtRefreshTokenInterceptor });
|
|
735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: JwtRefreshTokenInterceptor, decorators: [{
|
|
736
|
+
type: Injectable
|
|
737
|
+
}], ctorParameters: function () { return [{ type: JwtService }, { type: i2$1.HttpClient }, { type: undefined, decorators: [{
|
|
738
|
+
type: Inject,
|
|
739
|
+
args: [DDR_JWT_REFRESH_TOKEN_URL]
|
|
740
|
+
}] }]; } });
|
|
685
741
|
|
|
686
742
|
/*
|
|
687
743
|
* Public API Surface of ngx-extensions
|
|
@@ -691,5 +747,5 @@ JwtRefreshTokenInterceptor.ctorParameters = () => [
|
|
|
691
747
|
* Generated bundle index. Do not edit.
|
|
692
748
|
*/
|
|
693
749
|
|
|
694
|
-
export { BottomHitDirective, CollectionUtils, CookieService, DDR_JWT_REFRESH_TOKEN_URL, DDR_LOGIN_PATH, DDR_STORAGE_PREFIX, DdrExtensionsModule, Debounce, JwtInterceptor, JwtRefreshTokenInterceptor, JwtService, LazyImageDirective, Limit, NumberUtils, ObjectUtils, RedirectToLoginInterceptor, ScrollService, StringUtils, UrlInfo, VisibilityService, WithCredentialsInterceptor };
|
|
695
|
-
//# sourceMappingURL=dontdrinkandroot-ngx-extensions.
|
|
750
|
+
export { BottomHitDirective, CollectionUtils, CookieService, DDR_JWT_REFRESH_TOKEN_URL, DDR_LOGIN_PATH, DDR_STORAGE_PREFIX, DdrExtensionsModule, Debounce, JwtInterceptor, JwtRefreshTokenInterceptor, JwtService, LazyImageDirective, Limit, NumberUtils, ObjectUtils, RedirectToLoginInterceptor, ScrollService, StringUtils, TypeUtils, UrlInfo, VisibilityService, WithCredentialsInterceptor };
|
|
751
|
+
//# sourceMappingURL=dontdrinkandroot-ngx-extensions.mjs.map
|