@dontdrinkandroot/ngx-extensions 0.2.1 → 0.3.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.
Files changed (37) hide show
  1. package/esm2020/public-api.mjs +2 -1
  2. package/esm2020/src/cookie/cookie.service.mjs +3 -3
  3. package/esm2020/src/ddr-extensions.module.mjs +35 -8
  4. package/esm2020/src/http/redirect-to-login-interceptor.service.mjs +3 -3
  5. package/esm2020/src/http/with-credentials-interceptor.service.mjs +3 -3
  6. package/esm2020/src/image/lazy-image.directive.mjs +4 -4
  7. package/esm2020/src/jwt/jwt-interceptor.service.mjs +3 -3
  8. package/esm2020/src/jwt/jwt-refresh-token-interceptor.service.mjs +3 -3
  9. package/esm2020/src/jwt/jwt.service.mjs +13 -16
  10. package/esm2020/src/logger/console-logger.service.mjs +43 -0
  11. package/esm2020/src/logger/logger.service.mjs +9 -0
  12. package/esm2020/src/methoddecorator/debounce.mjs +2 -2
  13. package/esm2020/src/methoddecorator/limit.mjs +2 -2
  14. package/esm2020/src/oauth/oauth2-access-token-interceptor.service.mjs +3 -3
  15. package/esm2020/src/oauth/oauth2-refresh-token-interceptor.service.mjs +3 -3
  16. package/esm2020/src/oauth/oauth2.module.mjs +4 -4
  17. package/esm2020/src/oauth/oauth2.service.mjs +4 -4
  18. package/esm2020/src/oauth/redirect-to-oauth2-login-interceptor.service.mjs +3 -3
  19. package/esm2020/src/scroll/bottom-hit.directive.mjs +4 -4
  20. package/esm2020/src/scroll/scroll.service.mjs +3 -3
  21. package/esm2020/src/storage/local-storage.service.mjs +53 -0
  22. package/esm2020/src/storage/storage.service.mjs +5 -0
  23. package/esm2020/src/visibility/visibility.service.mjs +3 -3
  24. package/fesm2015/dontdrinkandroot-ngx-extensions.mjs +191 -69
  25. package/fesm2015/dontdrinkandroot-ngx-extensions.mjs.map +1 -1
  26. package/fesm2020/dontdrinkandroot-ngx-extensions.mjs +189 -67
  27. package/fesm2020/dontdrinkandroot-ngx-extensions.mjs.map +1 -1
  28. package/package.json +5 -5
  29. package/public-api.d.ts +1 -0
  30. package/src/ddr-extensions.module.d.ts +0 -1
  31. package/src/image/lazy-image.directive.d.ts +1 -1
  32. package/src/jwt/jwt.service.d.ts +3 -2
  33. package/src/logger/console-logger.service.d.ts +22 -0
  34. package/src/logger/logger.service.d.ts +10 -0
  35. package/src/scroll/bottom-hit.directive.d.ts +1 -1
  36. package/src/storage/local-storage.service.d.ts +23 -0
  37. package/src/storage/storage.service.d.ts +7 -0
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Input, HostBinding, HostListener, EventEmitter, Output, InjectionToken, NgModule, Injectable, Inject } from '@angular/core';
2
+ import { Directive, Input, HostBinding, HostListener, EventEmitter, Output, Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
3
3
  import { __decorate } from 'tslib';
4
4
  import * as i2 from '@angular/common';
5
5
  import { DOCUMENT } from '@angular/common';
@@ -56,7 +56,7 @@ class StringUtils {
56
56
  }
57
57
 
58
58
  function Debounce(delay = 250) {
59
- let timeoutReference = undefined;
59
+ let timeoutReference = null;
60
60
  return (target, propertyKey, descriptor) => {
61
61
  const original = descriptor.value;
62
62
  descriptor.value = function (...args) {
@@ -69,7 +69,7 @@ function Debounce(delay = 250) {
69
69
  }
70
70
 
71
71
  function Limit(rate = 250) {
72
- let timeoutReference = undefined;
72
+ let timeoutReference = null;
73
73
  return (target, propertyKey, descriptor) => {
74
74
  const original = descriptor.value;
75
75
  descriptor.value = function (...args) {
@@ -171,15 +171,15 @@ class LazyImageDirective {
171
171
  return window.getComputedStyle(element).display === 'none';
172
172
  }
173
173
  }
174
- LazyImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", 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.3", 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 });
174
+ LazyImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", 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: "15.2.3", 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 });
176
176
  __decorate([
177
177
  Debounce()
178
178
  ], LazyImageDirective.prototype, "windowResized", null);
179
179
  __decorate([
180
180
  Limit()
181
181
  ], LazyImageDirective.prototype, "windowScroll", null);
182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: LazyImageDirective, decorators: [{
182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: LazyImageDirective, decorators: [{
183
183
  type: Directive,
184
184
  args: [{ selector: '[ddrLazyImage]' }]
185
185
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { src: [{
@@ -240,15 +240,15 @@ class BottomHitDirective {
240
240
  }
241
241
  }
242
242
  }
243
- BottomHitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: BottomHitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
244
- BottomHitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.3", type: BottomHitDirective, selector: "[ddrBottomHit]", outputs: { onWindowBottomHit: "onWindowBottomHit", onElementBottomHit: "onElementBottomHit" }, host: { listeners: { "scroll": "scrolled($event)", "window:scroll": "windowScrolled($event)" } }, ngImport: i0 });
243
+ BottomHitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BottomHitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
244
+ BottomHitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.3", type: BottomHitDirective, selector: "[ddrBottomHit]", outputs: { onWindowBottomHit: "onWindowBottomHit", onElementBottomHit: "onElementBottomHit" }, host: { listeners: { "scroll": "scrolled($event)", "window:scroll": "windowScrolled($event)" } }, ngImport: i0 });
245
245
  __decorate([
246
246
  Limit()
247
247
  ], BottomHitDirective.prototype, "scrolled", null);
248
248
  __decorate([
249
249
  Limit()
250
250
  ], BottomHitDirective.prototype, "windowScrolled", null);
251
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: BottomHitDirective, decorators: [{
251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BottomHitDirective, decorators: [{
252
252
  type: Directive,
253
253
  args: [{
254
254
  selector: '[ddrBottomHit]'
@@ -265,22 +265,135 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
265
265
  args: ['window:scroll', ['$event']]
266
266
  }] } });
267
267
 
268
- const DDR_STORAGE_PREFIX = new InjectionToken('DDR_STORAGE_PREFIX');
268
+ class LoggerService {
269
+ constructor() {
270
+ this.debugEnabled = false;
271
+ this.infoEnabled = true;
272
+ this.warnEnabled = true;
273
+ this.errorEnabled = true;
274
+ }
275
+ }
276
+
277
+ class ConsoleLoggerService extends LoggerService {
278
+ /**
279
+ * @override
280
+ */
281
+ debug(message, ...optionalParams) {
282
+ if (this.debugEnabled) {
283
+ console.debug(message, optionalParams);
284
+ }
285
+ }
286
+ /**
287
+ * @override
288
+ */
289
+ info(message, ...optionalParams) {
290
+ if (this.infoEnabled) {
291
+ console.info(message, optionalParams);
292
+ }
293
+ }
294
+ /**
295
+ * @override
296
+ */
297
+ warn(message, ...optionalParams) {
298
+ if (this.warnEnabled) {
299
+ console.warn(message, optionalParams);
300
+ }
301
+ }
302
+ /**
303
+ * @override
304
+ */
305
+ error(message, ...optionalParams) {
306
+ if (this.errorEnabled) {
307
+ console.error(message, optionalParams);
308
+ }
309
+ }
310
+ }
311
+ ConsoleLoggerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConsoleLoggerService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
312
+ ConsoleLoggerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConsoleLoggerService });
313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ConsoleLoggerService, decorators: [{
314
+ type: Injectable
315
+ }] });
316
+
317
+ const DDR_STORAGE_PREFIX = new InjectionToken('storage-prefix');
318
+ class StorageService {
319
+ }
320
+
321
+ class LocalStorageService extends StorageService {
322
+ constructor(storagePrefix, logger) {
323
+ super();
324
+ this.storagePrefix = storagePrefix;
325
+ this.logger = logger;
326
+ }
327
+ /**
328
+ * @override
329
+ */
330
+ retrieve(key, defaultValue = null) {
331
+ let fullKey = this.getFullKey(key);
332
+ let valueJson = localStorage.getItem(fullKey);
333
+ if (null == valueJson) {
334
+ return defaultValue;
335
+ }
336
+ try {
337
+ return JSON.parse(valueJson);
338
+ }
339
+ catch (e) {
340
+ this.logger.warn('Could not parse json value', valueJson, e);
341
+ localStorage.removeItem(fullKey);
342
+ return null;
343
+ }
344
+ }
345
+ /**
346
+ * @override
347
+ */
348
+ store(key, value) {
349
+ localStorage.setItem(this.getFullKey(key), JSON.stringify(value));
350
+ }
351
+ /**
352
+ * @override
353
+ */
354
+ remove(key) {
355
+ localStorage.removeItem(this.getFullKey(key));
356
+ }
357
+ getFullKey(key) {
358
+ return this.storagePrefix + '.' + key;
359
+ }
360
+ }
361
+ LocalStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: LocalStorageService, deps: [{ token: DDR_STORAGE_PREFIX }, { token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
362
+ LocalStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: LocalStorageService });
363
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: LocalStorageService, decorators: [{
364
+ type: Injectable
365
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
366
+ type: Inject,
367
+ args: [DDR_STORAGE_PREFIX]
368
+ }] }, { type: LoggerService }]; } });
369
+
269
370
  const DDR_JWT_REFRESH_TOKEN_URL = new InjectionToken('DDR_JWT_REFRESH_TOKEN_URL');
270
371
  const DDR_LOGIN_PATH = new InjectionToken('DDR_LOGIN_PATH');
271
372
  class DdrExtensionsModule {
272
373
  }
273
- DdrExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: DdrExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
274
- DdrExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.3", ngImport: i0, type: DdrExtensionsModule, declarations: [LazyImageDirective,
374
+ DdrExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
375
+ DdrExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, declarations: [LazyImageDirective,
275
376
  BottomHitDirective], exports: [LazyImageDirective,
276
377
  BottomHitDirective] });
277
- DdrExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: DdrExtensionsModule, providers: [
378
+ DdrExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, providers: [
278
379
  {
279
380
  provide: DDR_LOGIN_PATH,
280
381
  useValue: '/login'
281
- }
382
+ },
383
+ {
384
+ provide: LoggerService,
385
+ useClass: ConsoleLoggerService
386
+ },
387
+ {
388
+ provide: DDR_STORAGE_PREFIX,
389
+ useValue: 'ddr'
390
+ },
391
+ {
392
+ provide: StorageService,
393
+ useClass: LocalStorageService
394
+ },
282
395
  ] });
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: DdrExtensionsModule, decorators: [{
396
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, decorators: [{
284
397
  type: NgModule,
285
398
  args: [{
286
399
  declarations: [
@@ -292,7 +405,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
292
405
  {
293
406
  provide: DDR_LOGIN_PATH,
294
407
  useValue: '/login'
295
- }
408
+ },
409
+ {
410
+ provide: LoggerService,
411
+ useClass: ConsoleLoggerService
412
+ },
413
+ {
414
+ provide: DDR_STORAGE_PREFIX,
415
+ useValue: 'ddr'
416
+ },
417
+ {
418
+ provide: StorageService,
419
+ useClass: LocalStorageService
420
+ },
296
421
  ],
297
422
  exports: [
298
423
  LazyImageDirective,
@@ -419,9 +544,9 @@ class CookieService {
419
544
  return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
420
545
  }
421
546
  }
422
- CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
423
- CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: CookieService, providedIn: 'root' });
424
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: CookieService, decorators: [{
547
+ CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
548
+ CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CookieService, providedIn: 'root' });
549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CookieService, decorators: [{
425
550
  type: Injectable,
426
551
  args: [{
427
552
  providedIn: 'root'
@@ -499,9 +624,9 @@ class ScrollService {
499
624
  }
500
625
  }
501
626
  }
502
- ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", 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.3", ngImport: i0, type: ScrollService, providedIn: 'root' });
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: ScrollService, decorators: [{
627
+ ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ScrollService, deps: [{ token: i1.Router }, { token: i2.ViewportScroller }], target: i0.ɵɵFactoryTarget.Injectable });
628
+ ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ScrollService, providedIn: 'root' });
629
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ScrollService, decorators: [{
505
630
  type: Injectable,
506
631
  args: [{
507
632
  providedIn: 'root'
@@ -516,9 +641,9 @@ class VisibilityService {
516
641
  return this.visibility$;
517
642
  }
518
643
  }
519
- VisibilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: VisibilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
520
- VisibilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: VisibilityService, providedIn: 'root' });
521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: VisibilityService, decorators: [{
644
+ VisibilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: VisibilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
645
+ VisibilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: VisibilityService, providedIn: 'root' });
646
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: VisibilityService, decorators: [{
522
647
  type: Injectable,
523
648
  args: [{ providedIn: 'root' }]
524
649
  }], ctorParameters: function () { return []; } });
@@ -534,9 +659,9 @@ class WithCredentialsInterceptor {
534
659
  return next.handle(cloned);
535
660
  }
536
661
  }
537
- WithCredentialsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: WithCredentialsInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
538
- WithCredentialsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: WithCredentialsInterceptor });
539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: WithCredentialsInterceptor, decorators: [{
662
+ WithCredentialsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: WithCredentialsInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
663
+ WithCredentialsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: WithCredentialsInterceptor });
664
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: WithCredentialsInterceptor, decorators: [{
540
665
  type: Injectable
541
666
  }] });
542
667
 
@@ -585,9 +710,9 @@ class RedirectToLoginInterceptor {
585
710
  }));
586
711
  }
587
712
  }
588
- RedirectToLoginInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", 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.3", ngImport: i0, type: RedirectToLoginInterceptor });
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToLoginInterceptor, decorators: [{
713
+ RedirectToLoginInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToLoginInterceptor, deps: [{ token: i1.Router }, { token: DDR_LOGIN_PATH }], target: i0.ɵɵFactoryTarget.Injectable });
714
+ RedirectToLoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToLoginInterceptor });
715
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToLoginInterceptor, decorators: [{
591
716
  type: Injectable
592
717
  }], ctorParameters: function () { return [{ type: i1.Router }, { type: undefined, decorators: [{
593
718
  type: Inject,
@@ -710,9 +835,9 @@ class OAuth2Service {
710
835
  OAuth2Service.STORAGE_KEY_CHALLENGE = 'ddr_oauth2_challenge';
711
836
  OAuth2Service.STORAGE_KEY_REFRESH_TOKEN = 'ddr_oauth2_refresh_token';
712
837
  OAuth2Service.STORAGE_KEY_RETURN_URL = 'ddr_oauth2_return_url';
713
- OAuth2Service.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Service, deps: [{ token: i1.ActivatedRoute }, { token: i2$1.HttpClient }, { token: DDR_OAUTH2_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
714
- OAuth2Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Service });
715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Service, decorators: [{
838
+ OAuth2Service.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Service, deps: [{ token: i1.ActivatedRoute }, { token: i2$1.HttpClient }, { token: DDR_OAUTH2_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
839
+ OAuth2Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Service });
840
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Service, decorators: [{
716
841
  type: Injectable
717
842
  }], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i2$1.HttpClient }, { type: OAuth2Config, decorators: [{
718
843
  type: Inject,
@@ -733,9 +858,9 @@ class OAuth2RefreshTokenInterceptor {
733
858
  return next.handle(req);
734
859
  }
735
860
  }
736
- OAuth2RefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
737
- OAuth2RefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor });
738
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, decorators: [{
861
+ OAuth2RefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
862
+ OAuth2RefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor });
863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, decorators: [{
739
864
  type: Injectable
740
865
  }], ctorParameters: function () { return [{ type: OAuth2Service }]; } });
741
866
 
@@ -762,9 +887,9 @@ class RedirectToOAuth2LoginInterceptor {
762
887
  }));
763
888
  }
764
889
  }
765
- RedirectToOAuth2LoginInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor, deps: [{ token: OAuth2Service }, { token: i1.Router }, { token: DDR_OAUTH2_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
766
- RedirectToOAuth2LoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor });
767
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor, decorators: [{
890
+ RedirectToOAuth2LoginInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor, deps: [{ token: OAuth2Service }, { token: i1.Router }, { token: DDR_OAUTH2_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
891
+ RedirectToOAuth2LoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor });
892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor, decorators: [{
768
893
  type: Injectable
769
894
  }], ctorParameters: function () { return [{ type: OAuth2Service }, { type: i1.Router }, { type: OAuth2Config, decorators: [{
770
895
  type: Inject,
@@ -788,9 +913,9 @@ class OAuth2AccessTokenInterceptor {
788
913
  return next.handle(req);
789
914
  }
790
915
  }
791
- OAuth2AccessTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
792
- OAuth2AccessTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor });
793
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, decorators: [{
916
+ OAuth2AccessTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
917
+ OAuth2AccessTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor });
918
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, decorators: [{
794
919
  type: Injectable
795
920
  }], ctorParameters: function () { return [{ type: OAuth2Service }]; } });
796
921
 
@@ -823,16 +948,16 @@ class OAuth2Module {
823
948
  };
824
949
  }
825
950
  }
826
- OAuth2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
827
- OAuth2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module });
828
- OAuth2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module });
829
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module, decorators: [{
951
+ OAuth2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
952
+ OAuth2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module });
953
+ OAuth2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module });
954
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module, decorators: [{
830
955
  type: NgModule
831
956
  }] });
832
957
 
833
958
  class JwtService {
834
- constructor(storagePrefix) {
835
- this.storagePrefix = storagePrefix;
959
+ constructor(storageService) {
960
+ this.storageService = storageService;
836
961
  /**
837
962
  * The current token.
838
963
  */
@@ -847,7 +972,7 @@ class JwtService {
847
972
  */
848
973
  setTokens(token, refreshToken) {
849
974
  this.setToken(token);
850
- localStorage.setItem(this.getRefreshTokenStorageKey(), refreshToken);
975
+ this.storageService.store(this.getRefreshTokenStorageKey(), refreshToken);
851
976
  }
852
977
  /**
853
978
  * Sets the current token.
@@ -868,7 +993,7 @@ class JwtService {
868
993
  * Gets the refresh token.
869
994
  */
870
995
  getRefreshToken() {
871
- return localStorage.getItem(this.getRefreshTokenStorageKey());
996
+ return this.storageService.retrieve(this.getRefreshTokenStorageKey());
872
997
  }
873
998
  /**
874
999
  * Checks if the current token expired.
@@ -891,23 +1016,20 @@ class JwtService {
891
1016
  clear() {
892
1017
  this.token = null;
893
1018
  this.tokenExpiry = null;
894
- localStorage.removeItem(this.getRefreshTokenStorageKey());
1019
+ this.storageService.remove(this.getRefreshTokenStorageKey());
895
1020
  }
896
1021
  getRefreshTokenStorageKey() {
897
- return this.storagePrefix + '.jwt.refresh_token';
1022
+ return 'jwt.refresh_token';
898
1023
  }
899
1024
  }
900
- JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtService, deps: [{ token: DDR_STORAGE_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
901
- JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtService, providedIn: 'root' });
902
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtService, decorators: [{
1025
+ JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtService, deps: [{ token: StorageService }], target: i0.ɵɵFactoryTarget.Injectable });
1026
+ JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtService, providedIn: 'root' });
1027
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtService, decorators: [{
903
1028
  type: Injectable,
904
1029
  args: [{
905
1030
  providedIn: 'root'
906
1031
  }]
907
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
908
- type: Inject,
909
- args: [DDR_STORAGE_PREFIX]
910
- }] }]; } });
1032
+ }], ctorParameters: function () { return [{ type: StorageService }]; } });
911
1033
 
912
1034
  class JwtInterceptor {
913
1035
  constructor(jwtService) {
@@ -926,9 +1048,9 @@ class JwtInterceptor {
926
1048
  return next.handle(req);
927
1049
  }
928
1050
  }
929
- JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtInterceptor, deps: [{ token: JwtService }], target: i0.ɵɵFactoryTarget.Injectable });
930
- JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtInterceptor });
931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtInterceptor, decorators: [{
1051
+ JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtInterceptor, deps: [{ token: JwtService }], target: i0.ɵɵFactoryTarget.Injectable });
1052
+ JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtInterceptor });
1053
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtInterceptor, decorators: [{
932
1054
  type: Injectable
933
1055
  }], ctorParameters: function () { return [{ type: JwtService }]; } });
934
1056
 
@@ -966,9 +1088,9 @@ class JwtRefreshTokenInterceptor {
966
1088
  return this.refreshTokenRequest$;
967
1089
  }
968
1090
  }
969
- JwtRefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor, deps: [{ token: JwtService }, { token: i2$1.HttpClient }, { token: DDR_JWT_REFRESH_TOKEN_URL }], target: i0.ɵɵFactoryTarget.Injectable });
970
- JwtRefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor });
971
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor, decorators: [{
1091
+ JwtRefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor, deps: [{ token: JwtService }, { token: i2$1.HttpClient }, { token: DDR_JWT_REFRESH_TOKEN_URL }], target: i0.ɵɵFactoryTarget.Injectable });
1092
+ JwtRefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor });
1093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor, decorators: [{
972
1094
  type: Injectable
973
1095
  }], ctorParameters: function () { return [{ type: JwtService }, { type: i2$1.HttpClient }, { type: undefined, decorators: [{
974
1096
  type: Inject,
@@ -983,5 +1105,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
983
1105
  * Generated bundle index. Do not edit.
984
1106
  */
985
1107
 
986
- export { BottomHitDirective, CollectionUtils, CookieService, DDR_JWT_REFRESH_TOKEN_URL, DDR_LOGIN_PATH, DDR_STORAGE_PREFIX, DdrExtensionsModule, Debounce, JwtInterceptor, JwtRefreshTokenInterceptor, JwtService, LazyImageDirective, Limit, NumberUtils, OAuth2Error, OAuth2Module, OAuth2Service, ObjectUtils, RedirectToLoginInterceptor, ScrollService, StringUtils, TypeUtils, UrlInfo, VisibilityService, WithCredentialsInterceptor };
1108
+ export { BottomHitDirective, CollectionUtils, CookieService, DDR_JWT_REFRESH_TOKEN_URL, DDR_LOGIN_PATH, DDR_STORAGE_PREFIX, DdrExtensionsModule, Debounce, JwtInterceptor, JwtRefreshTokenInterceptor, JwtService, LazyImageDirective, Limit, NumberUtils, OAuth2Error, OAuth2Module, OAuth2Service, ObjectUtils, RedirectToLoginInterceptor, ScrollService, StorageService, StringUtils, TypeUtils, UrlInfo, VisibilityService, WithCredentialsInterceptor };
987
1109
  //# sourceMappingURL=dontdrinkandroot-ngx-extensions.mjs.map