@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,137 @@ 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 () {
366
+ return [{ type: undefined, decorators: [{
367
+ type: Inject,
368
+ args: [DDR_STORAGE_PREFIX]
369
+ }] }, { type: LoggerService }];
370
+ } });
371
+
269
372
  const DDR_JWT_REFRESH_TOKEN_URL = new InjectionToken('DDR_JWT_REFRESH_TOKEN_URL');
270
373
  const DDR_LOGIN_PATH = new InjectionToken('DDR_LOGIN_PATH');
271
374
  class DdrExtensionsModule {
272
375
  }
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,
376
+ DdrExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
377
+ DdrExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, declarations: [LazyImageDirective,
275
378
  BottomHitDirective], exports: [LazyImageDirective,
276
379
  BottomHitDirective] });
277
- DdrExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: DdrExtensionsModule, providers: [
380
+ DdrExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, providers: [
278
381
  {
279
382
  provide: DDR_LOGIN_PATH,
280
383
  useValue: '/login'
281
- }
384
+ },
385
+ {
386
+ provide: LoggerService,
387
+ useClass: ConsoleLoggerService
388
+ },
389
+ {
390
+ provide: DDR_STORAGE_PREFIX,
391
+ useValue: 'ddr'
392
+ },
393
+ {
394
+ provide: StorageService,
395
+ useClass: LocalStorageService
396
+ },
282
397
  ] });
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: DdrExtensionsModule, decorators: [{
398
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: DdrExtensionsModule, decorators: [{
284
399
  type: NgModule,
285
400
  args: [{
286
401
  declarations: [
@@ -292,7 +407,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
292
407
  {
293
408
  provide: DDR_LOGIN_PATH,
294
409
  useValue: '/login'
295
- }
410
+ },
411
+ {
412
+ provide: LoggerService,
413
+ useClass: ConsoleLoggerService
414
+ },
415
+ {
416
+ provide: DDR_STORAGE_PREFIX,
417
+ useValue: 'ddr'
418
+ },
419
+ {
420
+ provide: StorageService,
421
+ useClass: LocalStorageService
422
+ },
296
423
  ],
297
424
  exports: [
298
425
  LazyImageDirective,
@@ -419,9 +546,9 @@ class CookieService {
419
546
  return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
420
547
  }
421
548
  }
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: [{
549
+ CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
550
+ CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CookieService, providedIn: 'root' });
551
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CookieService, decorators: [{
425
552
  type: Injectable,
426
553
  args: [{
427
554
  providedIn: 'root'
@@ -502,9 +629,9 @@ class ScrollService {
502
629
  }
503
630
  }
504
631
  }
505
- 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 });
506
- ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: ScrollService, providedIn: 'root' });
507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: ScrollService, decorators: [{
632
+ 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 });
633
+ ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ScrollService, providedIn: 'root' });
634
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: ScrollService, decorators: [{
508
635
  type: Injectable,
509
636
  args: [{
510
637
  providedIn: 'root'
@@ -519,9 +646,9 @@ class VisibilityService {
519
646
  return this.visibility$;
520
647
  }
521
648
  }
522
- VisibilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: VisibilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
523
- VisibilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: VisibilityService, providedIn: 'root' });
524
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: VisibilityService, decorators: [{
649
+ VisibilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: VisibilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
650
+ VisibilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: VisibilityService, providedIn: 'root' });
651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: VisibilityService, decorators: [{
525
652
  type: Injectable,
526
653
  args: [{ providedIn: 'root' }]
527
654
  }], ctorParameters: function () { return []; } });
@@ -537,9 +664,9 @@ class WithCredentialsInterceptor {
537
664
  return next.handle(cloned);
538
665
  }
539
666
  }
540
- WithCredentialsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: WithCredentialsInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
541
- WithCredentialsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: WithCredentialsInterceptor });
542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: WithCredentialsInterceptor, decorators: [{
667
+ WithCredentialsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: WithCredentialsInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
668
+ WithCredentialsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: WithCredentialsInterceptor });
669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: WithCredentialsInterceptor, decorators: [{
543
670
  type: Injectable
544
671
  }] });
545
672
 
@@ -588,9 +715,9 @@ class RedirectToLoginInterceptor {
588
715
  }));
589
716
  }
590
717
  }
591
- 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 });
592
- RedirectToLoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToLoginInterceptor });
593
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToLoginInterceptor, decorators: [{
718
+ 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 });
719
+ RedirectToLoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToLoginInterceptor });
720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToLoginInterceptor, decorators: [{
594
721
  type: Injectable
595
722
  }], ctorParameters: function () {
596
723
  return [{ type: i1.Router }, { type: undefined, decorators: [{
@@ -715,9 +842,9 @@ class OAuth2Service {
715
842
  OAuth2Service.STORAGE_KEY_CHALLENGE = 'ddr_oauth2_challenge';
716
843
  OAuth2Service.STORAGE_KEY_REFRESH_TOKEN = 'ddr_oauth2_refresh_token';
717
844
  OAuth2Service.STORAGE_KEY_RETURN_URL = 'ddr_oauth2_return_url';
718
- 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 });
719
- OAuth2Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Service });
720
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Service, decorators: [{
845
+ 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 });
846
+ OAuth2Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Service });
847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Service, decorators: [{
721
848
  type: Injectable
722
849
  }], ctorParameters: function () {
723
850
  return [{ type: i1.ActivatedRoute }, { type: i2$1.HttpClient }, { type: OAuth2Config, decorators: [{
@@ -740,9 +867,9 @@ class OAuth2RefreshTokenInterceptor {
740
867
  return next.handle(req);
741
868
  }
742
869
  }
743
- OAuth2RefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
744
- OAuth2RefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor });
745
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, decorators: [{
870
+ OAuth2RefreshTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
871
+ OAuth2RefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor });
872
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2RefreshTokenInterceptor, decorators: [{
746
873
  type: Injectable
747
874
  }], ctorParameters: function () { return [{ type: OAuth2Service }]; } });
748
875
 
@@ -769,9 +896,9 @@ class RedirectToOAuth2LoginInterceptor {
769
896
  }));
770
897
  }
771
898
  }
772
- 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 });
773
- RedirectToOAuth2LoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor });
774
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor, decorators: [{
899
+ 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 });
900
+ RedirectToOAuth2LoginInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor });
901
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: RedirectToOAuth2LoginInterceptor, decorators: [{
775
902
  type: Injectable
776
903
  }], ctorParameters: function () {
777
904
  return [{ type: OAuth2Service }, { type: i1.Router }, { type: OAuth2Config, decorators: [{
@@ -797,9 +924,9 @@ class OAuth2AccessTokenInterceptor {
797
924
  return next.handle(req);
798
925
  }
799
926
  }
800
- OAuth2AccessTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
801
- OAuth2AccessTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor });
802
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, decorators: [{
927
+ OAuth2AccessTokenInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, deps: [{ token: OAuth2Service }], target: i0.ɵɵFactoryTarget.Injectable });
928
+ OAuth2AccessTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor });
929
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2AccessTokenInterceptor, decorators: [{
803
930
  type: Injectable
804
931
  }], ctorParameters: function () { return [{ type: OAuth2Service }]; } });
805
932
 
@@ -832,16 +959,16 @@ class OAuth2Module {
832
959
  };
833
960
  }
834
961
  }
835
- OAuth2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
836
- OAuth2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module });
837
- OAuth2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module });
838
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: OAuth2Module, decorators: [{
962
+ OAuth2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
963
+ OAuth2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module });
964
+ OAuth2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module });
965
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: OAuth2Module, decorators: [{
839
966
  type: NgModule
840
967
  }] });
841
968
 
842
969
  class JwtService {
843
- constructor(storagePrefix) {
844
- this.storagePrefix = storagePrefix;
970
+ constructor(storageService) {
971
+ this.storageService = storageService;
845
972
  /**
846
973
  * The current token.
847
974
  */
@@ -856,7 +983,7 @@ class JwtService {
856
983
  */
857
984
  setTokens(token, refreshToken) {
858
985
  this.setToken(token);
859
- localStorage.setItem(this.getRefreshTokenStorageKey(), refreshToken);
986
+ this.storageService.store(this.getRefreshTokenStorageKey(), refreshToken);
860
987
  }
861
988
  /**
862
989
  * Sets the current token.
@@ -877,7 +1004,7 @@ class JwtService {
877
1004
  * Gets the refresh token.
878
1005
  */
879
1006
  getRefreshToken() {
880
- return localStorage.getItem(this.getRefreshTokenStorageKey());
1007
+ return this.storageService.retrieve(this.getRefreshTokenStorageKey());
881
1008
  }
882
1009
  /**
883
1010
  * Checks if the current token expired.
@@ -900,25 +1027,20 @@ class JwtService {
900
1027
  clear() {
901
1028
  this.token = null;
902
1029
  this.tokenExpiry = null;
903
- localStorage.removeItem(this.getRefreshTokenStorageKey());
1030
+ this.storageService.remove(this.getRefreshTokenStorageKey());
904
1031
  }
905
1032
  getRefreshTokenStorageKey() {
906
- return this.storagePrefix + '.jwt.refresh_token';
1033
+ return 'jwt.refresh_token';
907
1034
  }
908
1035
  }
909
- 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 });
910
- JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtService, providedIn: 'root' });
911
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtService, decorators: [{
1036
+ JwtService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtService, deps: [{ token: StorageService }], target: i0.ɵɵFactoryTarget.Injectable });
1037
+ JwtService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtService, providedIn: 'root' });
1038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtService, decorators: [{
912
1039
  type: Injectable,
913
1040
  args: [{
914
1041
  providedIn: 'root'
915
1042
  }]
916
- }], ctorParameters: function () {
917
- return [{ type: undefined, decorators: [{
918
- type: Inject,
919
- args: [DDR_STORAGE_PREFIX]
920
- }] }];
921
- } });
1043
+ }], ctorParameters: function () { return [{ type: StorageService }]; } });
922
1044
 
923
1045
  class JwtInterceptor {
924
1046
  constructor(jwtService) {
@@ -937,9 +1059,9 @@ class JwtInterceptor {
937
1059
  return next.handle(req);
938
1060
  }
939
1061
  }
940
- JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtInterceptor, deps: [{ token: JwtService }], target: i0.ɵɵFactoryTarget.Injectable });
941
- JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtInterceptor });
942
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtInterceptor, decorators: [{
1062
+ JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtInterceptor, deps: [{ token: JwtService }], target: i0.ɵɵFactoryTarget.Injectable });
1063
+ JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtInterceptor });
1064
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtInterceptor, decorators: [{
943
1065
  type: Injectable
944
1066
  }], ctorParameters: function () { return [{ type: JwtService }]; } });
945
1067
 
@@ -977,9 +1099,9 @@ class JwtRefreshTokenInterceptor {
977
1099
  return this.refreshTokenRequest$;
978
1100
  }
979
1101
  }
980
- 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 });
981
- JwtRefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor });
982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor, decorators: [{
1102
+ 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 });
1103
+ JwtRefreshTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor });
1104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: JwtRefreshTokenInterceptor, decorators: [{
983
1105
  type: Injectable
984
1106
  }], ctorParameters: function () {
985
1107
  return [{ type: JwtService }, { type: i2$1.HttpClient }, { type: undefined, decorators: [{
@@ -996,5 +1118,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
996
1118
  * Generated bundle index. Do not edit.
997
1119
  */
998
1120
 
999
- 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 };
1121
+ 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 };
1000
1122
  //# sourceMappingURL=dontdrinkandroot-ngx-extensions.mjs.map