@rxap/service-worker 16.0.0-dev.2 → 16.0.0-dev.21

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/CHANGELOG.md +266 -0
  2. package/LICENSE +621 -27
  3. package/LICENSE.md +621 -0
  4. package/README.md +7 -22
  5. package/esm2022/index.mjs +10 -6
  6. package/esm2022/lib/check-for-update.service.mjs +19 -27
  7. package/esm2022/lib/dialog-update.service.mjs +60 -0
  8. package/esm2022/lib/log-update.service.mjs +7 -20
  9. package/esm2022/lib/provide-service-worker-updater.mjs +32 -0
  10. package/esm2022/lib/service-worker-update-dialog/service-worker-update-dialog.component.mjs +28 -0
  11. package/esm2022/lib/unregister-service-worker.mjs +17 -0
  12. package/esm2022/rxap-service-worker.mjs +1 -1
  13. package/fesm2022/rxap-service-worker.mjs +135 -180
  14. package/fesm2022/rxap-service-worker.mjs.map +1 -1
  15. package/index.d.ts +5 -5
  16. package/lib/check-for-update.service.d.ts +1 -6
  17. package/lib/dialog-update.service.d.ts +12 -0
  18. package/lib/log-update.service.d.ts +0 -6
  19. package/lib/provide-service-worker-updater.d.ts +4 -0
  20. package/lib/service-worker-update-dialog/service-worker-update-dialog.component.d.ts +13 -0
  21. package/lib/unregister-service-worker.d.ts +2 -0
  22. package/package.json +50 -42
  23. package/theme.css +1 -0
  24. package/collection.json +0 -10
  25. package/esm2022/lib/prompt-update/prompt-update.component.mjs +0 -54
  26. package/esm2022/lib/prompt-update/prompt-update.component.module.mjs +0 -24
  27. package/esm2022/lib/prompt-update/prompt-update.service.mjs +0 -46
  28. package/esm2022/lib/snack-bar-update.service.mjs +0 -64
  29. package/lib/prompt-update/prompt-update.component.d.ts +0 -19
  30. package/lib/prompt-update/prompt-update.component.module.d.ts +0 -9
  31. package/lib/prompt-update/prompt-update.service.d.ts +0 -12
  32. package/lib/snack-bar-update.service.d.ts +0 -19
  33. package/migration.json +0 -4
  34. package/src/schematics/ng-add/index.d.ts +0 -2
  35. package/src/schematics/ng-add/index.js +0 -8
  36. package/src/schematics/ng-add/index.js.map +0 -1
  37. package/src/schematics/ng-add/schema.json +0 -7
@@ -1,254 +1,209 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, NgModule, Inject, Component, ChangeDetectionStrategy } from '@angular/core';
3
- import * as i2 from '@angular/service-worker';
2
+ import { InjectionToken, EventEmitter, inject, Component, ViewChild, Output, Injectable, Inject, createComponent, Injector, ApplicationRef, APP_INITIALIZER } from '@angular/core';
3
+ import * as i1$1 from '@angular/service-worker';
4
4
  import { SwUpdate } from '@angular/service-worker';
5
- import { startWith, tap, first, concatMap, filter, map, take } from 'rxjs/operators';
6
- import { interval } from 'rxjs';
7
5
  import * as i1 from '@rxap/life-cycle';
8
6
  import { LifeCycleService } from '@rxap/life-cycle';
9
- import { log } from '@rxap/utilities/rxjs';
10
- import * as i1$1 from '@angular/material/dialog';
11
- import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule, MatDialog } from '@angular/material/dialog';
12
- import * as i4 from '@angular/material/button';
13
- import { MatButtonModule } from '@angular/material/button';
14
- import * as i3 from '@angular/material/tooltip';
15
- import { MatTooltipModule } from '@angular/material/tooltip';
16
- import * as i2$1 from '@angular/material/progress-bar';
17
- import { MatProgressBarModule } from '@angular/material/progress-bar';
18
- import * as i1$2 from '@angular/material/snack-bar';
19
- import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
7
+ import { interval } from 'rxjs';
8
+ import { startWith, tap, concatMap } from 'rxjs/operators';
20
9
 
21
- class LogUpdateService {
22
- constructor(updates) {
23
- this.updates = updates;
10
+ const UPDATE_AVAILABLE_EVENT = new InjectionToken('UPDATE_AVAILABLE_EVENT');
11
+ class ServiceWorkerUpdateDialogComponent {
12
+ constructor() {
13
+ this.closeDialog = new EventEmitter();
14
+ this.updateAvailableEvent = inject(UPDATE_AVAILABLE_EVENT);
24
15
  }
25
- start() {
26
- console.debug('start log update');
27
- this.updates.available.subscribe(event => {
28
- console.log('current version is', event.current);
29
- console.log('available version is', event.available);
30
- });
31
- this.updates.activated.subscribe(event => {
32
- console.log('old version was', event.previous);
33
- console.log('new version is', event.current);
34
- });
16
+ ngAfterViewInit() {
17
+ this.dialog.nativeElement.showModal();
35
18
  }
36
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateService, deps: [{ token: i2.SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
37
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateService, providedIn: 'root' }); }
38
- }
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateService, decorators: [{
40
- type: Injectable,
41
- args: [{
42
- providedIn: 'root'
43
- }]
44
- }], ctorParameters: function () { return [{ type: i2.SwUpdate }]; } });
45
- class LogUpdateModule {
46
- constructor(logUpdate) {
47
- logUpdate.start();
19
+ close() {
20
+ this.dialog.nativeElement.close();
21
+ this.closeDialog.emit();
48
22
  }
49
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateModule, deps: [{ token: LogUpdateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
50
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateModule }); }
51
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateModule }); }
23
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ServiceWorkerUpdateDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
24
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.4", type: ServiceWorkerUpdateDialogComponent, isStandalone: true, selector: "rxap-service-worker-update-dialog", outputs: { closeDialog: "closeDialog" }, viewQueries: [{ propertyName: "dialog", first: true, predicate: ["dialog"], descendants: true, static: true }], ngImport: i0, template: "<dialog #dialog\n class=\"max-w-6xl rounded overflow-auto drop-shadow-2xl dark:bg-black dark:text-white flex flex-col gap-3 p-6\">\n <h2 class=\"text-2xl font-bold\" i18n>A new application version is available</h2>\n <table class=\"table-auto\">\n <tr>\n <th>Current version hash</th>\n <td>{{updateAvailableEvent.current.hash}}</td>\n </tr>\n <tr>\n <th>New version hash</th>\n <td>{{updateAvailableEvent.available.hash}}</td>\n </tr>\n </table>\n <button (click)=\"close()\" class=\"px-4 py-2 rounded bg-primary-500\" i18n>Update</button>\n</dialog>\n", styles: [""] }); }
52
25
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: LogUpdateModule, decorators: [{
54
- type: NgModule
55
- }], ctorParameters: function () { return [{ type: LogUpdateService }]; } });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ServiceWorkerUpdateDialogComponent, decorators: [{
27
+ type: Component,
28
+ args: [{ selector: 'rxap-service-worker-update-dialog', standalone: true, imports: [], template: "<dialog #dialog\n class=\"max-w-6xl rounded overflow-auto drop-shadow-2xl dark:bg-black dark:text-white flex flex-col gap-3 p-6\">\n <h2 class=\"text-2xl font-bold\" i18n>A new application version is available</h2>\n <table class=\"table-auto\">\n <tr>\n <th>Current version hash</th>\n <td>{{updateAvailableEvent.current.hash}}</td>\n </tr>\n <tr>\n <th>New version hash</th>\n <td>{{updateAvailableEvent.available.hash}}</td>\n </tr>\n </table>\n <button (click)=\"close()\" class=\"px-4 py-2 rounded bg-primary-500\" i18n>Update</button>\n</dialog>\n" }]
29
+ }], propDecorators: { dialog: [{
30
+ type: ViewChild,
31
+ args: ['dialog', { static: true }]
32
+ }], closeDialog: [{
33
+ type: Output
34
+ }] } });
56
35
 
57
36
  class CheckForUpdateService {
58
37
  constructor(lifeCycle, updates) {
59
38
  this.lifeCycle = lifeCycle;
60
39
  this.updates = updates;
40
+ this._started = false;
61
41
  }
62
42
  start() {
43
+ if (this._started) {
44
+ console.warn('check for update already started');
45
+ return;
46
+ }
47
+ this._started = true;
63
48
  if (this.updates.isEnabled) {
64
49
  console.debug('start check for update');
65
50
  this.updates.checkForUpdate();
66
51
  this
67
52
  .lifeCycle
68
53
  .whenReady(() => interval(15 * 60 * 1000)
69
- .pipe(startWith(null), log('check for update'), tap(() => this.updates.checkForUpdate())))
54
+ .pipe(startWith(null), tap(() => console.log('check for update')), tap(() => this.updates.checkForUpdate())))
70
55
  .subscribe();
71
56
  }
57
+ else {
58
+ console.warn('service worker updates are not enabled');
59
+ }
72
60
  }
73
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateService, deps: [{ token: LifeCycleService }, { token: SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
74
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateService, providedIn: 'root' }); }
61
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: CheckForUpdateService, deps: [{ token: LifeCycleService }, { token: SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
62
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: CheckForUpdateService, providedIn: 'root' }); }
75
63
  }
76
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateService, decorators: [{
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: CheckForUpdateService, decorators: [{
77
65
  type: Injectable,
78
66
  args: [{
79
- providedIn: 'root'
67
+ providedIn: 'root',
80
68
  }]
81
69
  }], ctorParameters: function () { return [{ type: i1.LifeCycleService, decorators: [{
82
70
  type: Inject,
83
71
  args: [LifeCycleService]
84
- }] }, { type: i2.SwUpdate, decorators: [{
72
+ }] }, { type: i1$1.SwUpdate, decorators: [{
85
73
  type: Inject,
86
74
  args: [SwUpdate]
87
75
  }] }]; } });
88
- class CheckForUpdateModule {
89
- constructor(checkForUpdate) {
90
- checkForUpdate.start();
91
- }
92
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateModule, deps: [{ token: CheckForUpdateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
93
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateModule }); }
94
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateModule }); }
95
- }
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CheckForUpdateModule, decorators: [{
97
- type: NgModule
98
- }], ctorParameters: function () { return [{ type: CheckForUpdateService, decorators: [{
99
- type: Inject,
100
- args: [CheckForUpdateService]
101
- }] }]; } });
102
-
103
- class PromptUpdateComponent {
104
- static { this.AUTO_UPDATE_IN = 1000 * 60 * 1.5; }
105
- constructor(event, dialogRef, lifecycle) {
106
- this.event = event;
107
- this.dialogRef = dialogRef;
108
- this.lifecycle = lifecycle;
109
- this.progress = 1;
110
- }
111
- ngOnInit() {
112
- this.subscription = this.lifecycle
113
- .whenReady(() => interval(100).pipe(tap((i) => (this.progress = Math.floor(((i + 1) / (PromptUpdateComponent.AUTO_UPDATE_IN / 100)) * 100))), first((i) => i >= PromptUpdateComponent.AUTO_UPDATE_IN / 100), log('start auto update'), tap(() => this.dialogRef.close(true))))
114
- .subscribe();
115
- }
116
- ngOnDestroy() {
117
- this.subscription?.unsubscribe();
118
- }
119
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: MatDialogRef }, { token: LifeCycleService }], target: i0.ɵɵFactoryTarget.Component }); }
120
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: PromptUpdateComponent, isStandalone: true, selector: "rxap-prompt-update", ngImport: i0, template: "<h2 mat-dialog-title>Update available</h2>\n<mat-dialog-content>\n <p>Ein neue Version der App steht zur Verf\u00FCgung!</p>\n <p>Soll die neue Version heruntergeladen werden und aktiviert werden?</p>\n <table class=\"version\">\n <tr>\n <th>Aktuelle Version</th>\n <td>{{event.current.hash}}</td>\n </tr>\n <tr>\n <th>Neue Version</th>\n <td>{{event.available.hash}}</td>\n </tr>\n </table>\n <mat-progress-bar [value]=\"progress\" matTooltip=\"start auto update\" mode=\"determinate\"></mat-progress-bar>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button [mat-dialog-close]=\"false\" mat-button>Abbrechen</button>\n <!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->\n <button [mat-dialog-close]=\"true\" mat-button>Update</button>\n</mat-dialog-actions>\n", styles: [".version th{padding-right:12px}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i2$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
121
- }
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateComponent, decorators: [{
123
- type: Component,
124
- args: [{ selector: 'rxap-prompt-update', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [
125
- MatDialogModule,
126
- MatProgressBarModule,
127
- MatTooltipModule,
128
- MatButtonModule
129
- ], template: "<h2 mat-dialog-title>Update available</h2>\n<mat-dialog-content>\n <p>Ein neue Version der App steht zur Verf\u00FCgung!</p>\n <p>Soll die neue Version heruntergeladen werden und aktiviert werden?</p>\n <table class=\"version\">\n <tr>\n <th>Aktuelle Version</th>\n <td>{{event.current.hash}}</td>\n </tr>\n <tr>\n <th>Neue Version</th>\n <td>{{event.available.hash}}</td>\n </tr>\n </table>\n <mat-progress-bar [value]=\"progress\" matTooltip=\"start auto update\" mode=\"determinate\"></mat-progress-bar>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button [mat-dialog-close]=\"false\" mat-button>Abbrechen</button>\n <!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->\n <button [mat-dialog-close]=\"true\" mat-button>Update</button>\n</mat-dialog-actions>\n", styles: [".version th{padding-right:12px}\n"] }]
130
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
131
- type: Inject,
132
- args: [MAT_DIALOG_DATA]
133
- }] }, { type: i1$1.MatDialogRef, decorators: [{
134
- type: Inject,
135
- args: [MatDialogRef]
136
- }] }, { type: i1.LifeCycleService, decorators: [{
137
- type: Inject,
138
- args: [LifeCycleService]
139
- }] }]; } });
140
76
 
141
- class PromptUpdateService {
142
- constructor(dialog, updates) {
143
- this.dialog = dialog;
77
+ class DialogUpdateService {
78
+ constructor(applicationRef, updates) {
79
+ this.applicationRef = applicationRef;
144
80
  this.updates = updates;
145
81
  }
146
82
  start() {
147
- console.debug('start prompt update');
83
+ console.debug('start dialog update service');
148
84
  this.updates.available
149
- .pipe(concatMap((event) => this.promptUser(event)), filter(Boolean), log('start app update'), tap(() => this.updates.activateUpdate().then(() => {
85
+ .pipe(concatMap((event) => this.openUpdateDialog(event)), tap(() => console.log('start app update')), tap(() => this.updates.activateUpdate().then(() => {
150
86
  console.log('app update completed. Reload app.');
151
87
  document.location.reload();
152
88
  })))
153
89
  .subscribe();
154
90
  }
155
- promptUser(event) {
156
- const dialogRef = this.dialog.open(PromptUpdateComponent, {
157
- data: event,
91
+ openUpdateDialog(event) {
92
+ console.debug('open update dialog');
93
+ const body = document.getElementsByTagName('body')[0];
94
+ const div = document.createElement('div');
95
+ body.appendChild(div);
96
+ const componentRef = createComponent(ServiceWorkerUpdateDialogComponent, {
97
+ hostElement: div,
98
+ environmentInjector: this.applicationRef.injector,
99
+ elementInjector: Injector.create({
100
+ providers: [
101
+ {
102
+ provide: UPDATE_AVAILABLE_EVENT,
103
+ useValue: event,
104
+ },
105
+ ],
106
+ }),
158
107
  });
159
- return dialogRef.afterClosed().pipe(map(Boolean), take(1));
160
- }
161
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateService, deps: [{ token: MatDialog }, { token: SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
162
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateService, providedIn: 'root' }); }
108
+ this.applicationRef.attachView(componentRef.hostView);
109
+ return componentRef.instance.closeDialog.pipe(tap(() => {
110
+ componentRef.destroy();
111
+ body.removeChild(div);
112
+ div.remove();
113
+ }));
114
+ }
115
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DialogUpdateService, deps: [{ token: ApplicationRef }, { token: SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
116
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DialogUpdateService, providedIn: 'root' }); }
163
117
  }
164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateService, decorators: [{
118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: DialogUpdateService, decorators: [{
165
119
  type: Injectable,
166
120
  args: [{
167
121
  providedIn: 'root',
168
122
  }]
169
- }], ctorParameters: function () { return [{ type: i1$1.MatDialog, decorators: [{
123
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef, decorators: [{
170
124
  type: Inject,
171
- args: [MatDialog]
172
- }] }, { type: i2.SwUpdate, decorators: [{
125
+ args: [ApplicationRef]
126
+ }] }, { type: i1$1.SwUpdate, decorators: [{
173
127
  type: Inject,
174
128
  args: [SwUpdate]
175
129
  }] }]; } });
176
130
 
177
- class PromptUpdateModule {
178
- constructor(promptUpdate) {
179
- promptUpdate.start();
180
- }
181
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateModule, deps: [{ token: PromptUpdateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
182
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateModule, imports: [PromptUpdateComponent], exports: [PromptUpdateComponent] }); }
183
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateModule, imports: [PromptUpdateComponent] }); }
184
- }
185
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: PromptUpdateModule, decorators: [{
186
- type: NgModule,
187
- args: [{
188
- imports: [
189
- PromptUpdateComponent
190
- ],
191
- exports: [PromptUpdateComponent]
192
- }]
193
- }], ctorParameters: function () { return [{ type: PromptUpdateService }]; } });
194
-
195
- class SnackBarUpdateService {
196
- constructor(snackBar, updates) {
197
- this.snackBar = snackBar;
131
+ class LogUpdateService {
132
+ constructor(updates) {
198
133
  this.updates = updates;
199
134
  }
200
135
  start() {
201
- console.debug('start prompt update');
202
- this.updates.available
203
- .pipe(concatMap((event) => this.openSnackBar(event)), log('start app update'), tap(() => this.updates.activateUpdate().then(() => {
204
- console.log('app update completed. Reload app.');
205
- document.location.reload();
206
- })))
207
- .subscribe();
208
- }
209
- openSnackBar(event) {
210
- const snackBarRef = this.snackBar.open('New update available', 'update', {
211
- duration: 25 * 1000,
212
- data: event,
136
+ console.debug('start log update');
137
+ this.updates.available.subscribe(event => {
138
+ console.log('current version is', event.current);
139
+ console.log('available version is', event.available);
140
+ });
141
+ this.updates.activated.subscribe(event => {
142
+ console.log('old version was', event.previous);
143
+ console.log('new version is', event.current);
213
144
  });
214
- return snackBarRef.onAction();
215
145
  }
216
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateService, deps: [{ token: MatSnackBar }, { token: SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
217
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateService, providedIn: 'root' }); }
146
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LogUpdateService, deps: [{ token: i1$1.SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable }); }
147
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LogUpdateService, providedIn: 'root' }); }
218
148
  }
219
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateService, decorators: [{
149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LogUpdateService, decorators: [{
220
150
  type: Injectable,
221
151
  args: [{
222
152
  providedIn: 'root',
223
153
  }]
224
- }], ctorParameters: function () { return [{ type: i1$2.MatSnackBar, decorators: [{
225
- type: Inject,
226
- args: [MatSnackBar]
227
- }] }, { type: i2.SwUpdate, decorators: [{
228
- type: Inject,
229
- args: [SwUpdate]
230
- }] }]; } });
231
- class SnackBarUpdateServiceModule {
232
- constructor(snackBarUpdate) {
233
- snackBarUpdate.start();
154
+ }], ctorParameters: function () { return [{ type: i1$1.SwUpdate }]; } });
155
+
156
+ function ProvideServiceWorkerUpdater(...providers) {
157
+ return [
158
+ {
159
+ provide: APP_INITIALIZER,
160
+ multi: true,
161
+ useFactory: (checkForUpdate) => () => checkForUpdate.start(),
162
+ deps: [CheckForUpdateService],
163
+ },
164
+ ...providers,
165
+ ];
166
+ }
167
+ function withLogUpdater() {
168
+ return {
169
+ provide: APP_INITIALIZER,
170
+ multi: true,
171
+ useFactory: (logUpdateService) => () => logUpdateService.start(),
172
+ deps: [LogUpdateService],
173
+ };
174
+ }
175
+ function withDialogUpdater() {
176
+ return {
177
+ provide: APP_INITIALIZER,
178
+ multi: true,
179
+ useFactory: (dus) => () => dus.start(),
180
+ deps: [DialogUpdateService],
181
+ };
182
+ }
183
+
184
+ function UnregisterServiceWorker(environment) {
185
+ if (!environment.serviceWorker) {
186
+ navigator?.serviceWorker?.getRegistrations().then(async (registrations) => {
187
+ await Promise.all(registrations.map((registration) => {
188
+ console.log('unregister service worker: ' + registration.scope);
189
+ return registration.unregister();
190
+ }));
191
+ if (registrations.length) {
192
+ const response = confirm('All dangling service worker are unregistered. Should the application be reloaded to complete the migration');
193
+ if (response) {
194
+ location.reload();
195
+ }
196
+ }
197
+ });
234
198
  }
235
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateServiceModule, deps: [{ token: SnackBarUpdateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
236
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateServiceModule, exports: [MatSnackBarModule] }); }
237
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateServiceModule, imports: [MatSnackBarModule] }); }
238
199
  }
239
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SnackBarUpdateServiceModule, decorators: [{
240
- type: NgModule,
241
- args: [{
242
- exports: [MatSnackBarModule],
243
- }]
244
- }], ctorParameters: function () { return [{ type: SnackBarUpdateService, decorators: [{
245
- type: Inject,
246
- args: [SnackBarUpdateService]
247
- }] }]; } });
200
+
201
+ // region service-worker-update-dialog
202
+ // endregion
248
203
 
249
204
  /**
250
205
  * Generated bundle index. Do not edit.
251
206
  */
252
207
 
253
- export { CheckForUpdateModule, CheckForUpdateService, LogUpdateModule, LogUpdateService, PromptUpdateComponent, PromptUpdateModule, PromptUpdateService, SnackBarUpdateService, SnackBarUpdateServiceModule };
208
+ export { CheckForUpdateService, DialogUpdateService, LogUpdateService, ProvideServiceWorkerUpdater, ServiceWorkerUpdateDialogComponent, UPDATE_AVAILABLE_EVENT, UnregisterServiceWorker, withDialogUpdater, withLogUpdater };
254
209
  //# sourceMappingURL=rxap-service-worker.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-service-worker.mjs","sources":["../../../../libs/service-worker/src/lib/log-update.service.ts","../../../../libs/service-worker/src/lib/check-for-update.service.ts","../../../../libs/service-worker/src/lib/prompt-update/prompt-update.component.ts","../../../../libs/service-worker/src/lib/prompt-update/prompt-update.component.html","../../../../libs/service-worker/src/lib/prompt-update/prompt-update.service.ts","../../../../libs/service-worker/src/lib/prompt-update/prompt-update.component.module.ts","../../../../libs/service-worker/src/lib/snack-bar-update.service.ts","../../../../libs/service-worker/src/rxap-service-worker.ts"],"sourcesContent":["import {\n Injectable,\n NgModule\n} from '@angular/core';\nimport { SwUpdate } from '@angular/service-worker';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LogUpdateService {\n\n constructor(private readonly updates: SwUpdate) {}\n\n public start() {\n console.debug('start log update');\n this.updates.available.subscribe(event => {\n console.log('current version is', event.current);\n console.log('available version is', event.available);\n });\n this.updates.activated.subscribe(event => {\n console.log('old version was', event.previous);\n console.log('new version is', event.current);\n });\n }\n\n}\n\n@NgModule()\nexport class LogUpdateModule {\n\n constructor(logUpdate: LogUpdateService) {\n logUpdate.start();\n }\n\n}\n","import {\n Injectable,\n NgModule,\n Inject\n} from '@angular/core';\nimport { SwUpdate } from '@angular/service-worker';\nimport {\n tap,\n startWith\n} from 'rxjs/operators';\nimport { interval } from 'rxjs';\nimport { LifeCycleService } from '@rxap/life-cycle';\nimport { log } from '@rxap/utilities/rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class CheckForUpdateService {\n\n constructor(\n @Inject(LifeCycleService) private readonly lifeCycle: LifeCycleService,\n @Inject(SwUpdate) private readonly updates: SwUpdate,\n ) {}\n\n public start(): void {\n if (this.updates.isEnabled) {\n\n console.debug('start check for update');\n\n this.updates.checkForUpdate();\n\n this\n .lifeCycle\n .whenReady(() => interval(15 * 60 * 1000)\n .pipe(\n startWith(null),\n log('check for update'),\n tap(() => this.updates.checkForUpdate()),\n ),\n )\n .subscribe();\n\n }\n }\n\n}\n\n@NgModule()\nexport class CheckForUpdateModule {\n\n constructor(@Inject(CheckForUpdateService) checkForUpdate: CheckForUpdateService) {\n checkForUpdate.start();\n }\n\n}\n","import {\n Component,\n OnInit,\n ChangeDetectionStrategy,\n Inject,\n OnDestroy\n} from '@angular/core';\nimport { UpdateAvailableEvent } from '@angular/service-worker';\nimport {\n MAT_DIALOG_DATA,\n MatDialogRef,\n MatDialogModule\n} from '@angular/material/dialog';\nimport {\n interval,\n Subscription\n} from 'rxjs';\nimport {\n tap,\n first\n} from 'rxjs/operators';\nimport { LifeCycleService } from '@rxap/life-cycle';\nimport { log } from '@rxap/utilities/rxjs';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\n@Component({\n selector: 'rxap-prompt-update',\n templateUrl: './prompt-update.component.html',\n styleUrls: [ './prompt-update.component.scss' ],\n changeDetection: ChangeDetectionStrategy.Default,\n standalone: true,\n imports: [\n MatDialogModule,\n MatProgressBarModule,\n MatTooltipModule,\n MatButtonModule\n ]\n})\nexport class PromptUpdateComponent implements OnInit, OnDestroy {\n public static AUTO_UPDATE_IN = 1000 * 60 * 1.5;\n\n public progress: number = 1;\n\n public subscription?: Subscription;\n\n constructor(\n @Inject(MAT_DIALOG_DATA) public readonly event: UpdateAvailableEvent,\n @Inject(MatDialogRef)\n private readonly dialogRef: MatDialogRef<boolean>,\n @Inject(LifeCycleService)\n private readonly lifecycle: LifeCycleService\n ) {}\n\n public ngOnInit(): void {\n this.subscription = this.lifecycle\n .whenReady(() =>\n interval(100).pipe(\n tap(\n (i) =>\n (this.progress = Math.floor(\n ((i + 1) / (PromptUpdateComponent.AUTO_UPDATE_IN / 100)) * 100\n ))\n ),\n first((i) => i >= PromptUpdateComponent.AUTO_UPDATE_IN / 100),\n log('start auto update'),\n tap(() => this.dialogRef.close(true))\n )\n )\n .subscribe();\n }\n\n public ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n}\n","<h2 mat-dialog-title>Update available</h2>\n<mat-dialog-content>\n <p>Ein neue Version der App steht zur Verfügung!</p>\n <p>Soll die neue Version heruntergeladen werden und aktiviert werden?</p>\n <table class=\"version\">\n <tr>\n <th>Aktuelle Version</th>\n <td>{{event.current.hash}}</td>\n </tr>\n <tr>\n <th>Neue Version</th>\n <td>{{event.available.hash}}</td>\n </tr>\n </table>\n <mat-progress-bar [value]=\"progress\" matTooltip=\"start auto update\" mode=\"determinate\"></mat-progress-bar>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button [mat-dialog-close]=\"false\" mat-button>Abbrechen</button>\n <!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->\n <button [mat-dialog-close]=\"true\" mat-button>Update</button>\n</mat-dialog-actions>\n","import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n SwUpdate,\n UpdateAvailableEvent\n} from '@angular/service-worker';\nimport {\n concatMap,\n filter,\n tap,\n map,\n take\n} from 'rxjs/operators';\nimport { MatDialog } from '@angular/material/dialog';\nimport { PromptUpdateComponent } from './prompt-update.component';\nimport { Observable } from 'rxjs';\nimport { log } from '@rxap/utilities/rxjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class PromptUpdateService {\n constructor(\n @Inject(MatDialog)\n private readonly dialog: MatDialog,\n @Inject(SwUpdate)\n private readonly updates: SwUpdate\n ) {}\n\n public start(): void {\n console.debug('start prompt update');\n this.updates.available\n .pipe(\n concatMap((event) => this.promptUser(event)),\n filter(Boolean),\n log('start app update'),\n tap(() =>\n this.updates.activateUpdate().then(() => {\n console.log('app update completed. Reload app.');\n document.location.reload();\n })\n )\n )\n .subscribe();\n }\n\n private promptUser(event: UpdateAvailableEvent): Observable<boolean> {\n const dialogRef = this.dialog.open<PromptUpdateComponent, any, boolean>(\n PromptUpdateComponent,\n {\n data: event,\n }\n );\n\n return dialogRef.afterClosed().pipe(map(Boolean), take(1));\n }\n}\n","import { NgModule } from '@angular/core';\nimport { PromptUpdateComponent } from './prompt-update.component';\nimport { PromptUpdateService } from './prompt-update.service';\n\n\n@NgModule({\n imports: [\n PromptUpdateComponent\n ],\n exports: [ PromptUpdateComponent ]\n})\nexport class PromptUpdateModule {\n\n constructor(promptUpdate: PromptUpdateService) {\n promptUpdate.start();\n }\n\n}\n","import {\n Injectable,\n NgModule,\n Inject\n} from '@angular/core';\nimport {\n SwUpdate,\n UpdateAvailableEvent\n} from '@angular/service-worker';\nimport {\n concatMap,\n tap\n} from 'rxjs/operators';\nimport { Observable } from 'rxjs';\nimport {\n MatSnackBar,\n MatSnackBarModule\n} from '@angular/material/snack-bar';\nimport { log } from '@rxap/utilities/rxjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SnackBarUpdateService {\n constructor(\n @Inject(MatSnackBar)\n private readonly snackBar: MatSnackBar,\n @Inject(SwUpdate)\n private readonly updates: SwUpdate\n ) {}\n\n public start(): void {\n console.debug('start prompt update');\n this.updates.available\n .pipe(\n concatMap((event) => this.openSnackBar(event)),\n log('start app update'),\n tap(() =>\n this.updates.activateUpdate().then(() => {\n console.log('app update completed. Reload app.');\n document.location.reload();\n })\n )\n )\n .subscribe();\n }\n\n private openSnackBar(event: UpdateAvailableEvent): Observable<void> {\n const snackBarRef = this.snackBar.open('New update available', 'update', {\n duration: 25 * 1000,\n data: event,\n });\n\n return snackBarRef.onAction();\n }\n}\n\n@NgModule({\n exports: [MatSnackBarModule],\n})\nexport class SnackBarUpdateServiceModule {\n constructor(\n @Inject(SnackBarUpdateService)\n snackBarUpdate: SnackBarUpdateService\n ) {\n snackBarUpdate.start();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2","i1.PromptUpdateService"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,MAGa,gBAAgB,CAAA;AAE3B,IAAA,WAAA,CAA6B,OAAiB,EAAA;QAAjB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAU;KAAI;IAE3C,KAAK,GAAA;AACV,QAAA,OAAO,CAAC,KAAK,CAAC,kBAAk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AAC,WAAW,CAAA;;0BAElB,MAAM;2BAAC,QAAQ,CAAA;;AA8BpB,MAGa,2BAA2B,CAAA;AACtC,IAAA,WAAA,CAEE,cAAqC,EAAA;QAErC,cAAc,CAAC,KAAK,EAAE,CAAC;KACxB;AANU,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,kBAE5B,qBAAqB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAFpB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,YAF5B,iBAAiB,CAAA,EAAA,CAAA,CAAA,EAAA;AAEhB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,YAF5B,iBAAiB,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAEhB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;AAC7B,iBAAA,CAAA;;0BAGI,MAAM;2BAAC,qBAAqB,CAAA;;;AC9DjC;;AAEG;;;;"}
1
+ {"version":3,"file":"rxap-service-worker.mjs","sources":["../../../../../packages/angular/service-worker/src/lib/service-worker-update-dialog/service-worker-update-dialog.component.ts","../../../../../packages/angular/service-worker/src/lib/service-worker-update-dialog/service-worker-update-dialog.component.html","../../../../../packages/angular/service-worker/src/lib/check-for-update.service.ts","../../../../../packages/angular/service-worker/src/lib/dialog-update.service.ts","../../../../../packages/angular/service-worker/src/lib/log-update.service.ts","../../../../../packages/angular/service-worker/src/lib/provide-service-worker-updater.ts","../../../../../packages/angular/service-worker/src/lib/unregister-service-worker.ts","../../../../../packages/angular/service-worker/src/index.ts","../../../../../packages/angular/service-worker/src/rxap-service-worker.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n inject,\n InjectionToken,\n Output,\n ViewChild,\n} from '@angular/core';\nimport { UpdateAvailableEvent } from '@angular/service-worker';\n\nexport const UPDATE_AVAILABLE_EVENT = new InjectionToken<UpdateAvailableEvent>('UPDATE_AVAILABLE_EVENT');\n\n@Component({\n selector: 'rxap-service-worker-update-dialog',\n standalone: true,\n imports: [],\n templateUrl: './service-worker-update-dialog.component.html',\n styleUrls: [ './service-worker-update-dialog.component.scss' ],\n})\nexport class ServiceWorkerUpdateDialogComponent implements AfterViewInit {\n\n @ViewChild('dialog', { static: true })\n public dialog!: ElementRef<HTMLDialogElement>;\n\n @Output()\n public closeDialog = new EventEmitter<void>();\n\n public readonly updateAvailableEvent = inject(UPDATE_AVAILABLE_EVENT);\n\n ngAfterViewInit() {\n this.dialog.nativeElement.showModal();\n }\n\n close() {\n this.dialog.nativeElement.close();\n this.closeDialog.emit();\n }\n\n}\n","<dialog #dialog\n class=\"max-w-6xl rounded overflow-auto drop-shadow-2xl dark:bg-black dark:text-white flex flex-col gap-3 p-6\">\n <h2 class=\"text-2xl font-bold\" i18n>A new application version is available</h2>\n <table class=\"table-auto\">\n <tr>\n <th>Current version hash</th>\n <td>{{updateAvailableEvent.current.hash}}</td>\n </tr>\n <tr>\n <th>New version hash</th>\n <td>{{updateAvailableEvent.available.hash}}</td>\n </tr>\n </table>\n <button (click)=\"close()\" class=\"px-4 py-2 rounded bg-primary-500\" i18n>Update</button>\n</dialog>\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { SwUpdate } from '@angular/service-worker';\nimport { LifeCycleService } from '@rxap/life-cycle';\nimport { interval } from 'rxjs';\nimport {\n startWith,\n tap,\n} from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CheckForUpdateService {\n\n private _started = false;\n\n constructor(\n @Inject(LifeCycleService) private readonly lifeCycle: LifeCycleService,\n @Inject(SwUpdate) private readonly updates: SwUpdate,\n ) {\n }\n\n public start(): void {\n if (this._started) {\n console.warn('check for update already started');\n return;\n }\n this._started = true;\n if (this.updates.isEnabled) {\n\n console.debug('start check for update');\n\n this.updates.checkForUpdate();\n\n this\n .lifeCycle\n .whenReady(() => interval(15 * 60 * 1000)\n .pipe(\n startWith(null),\n tap(() => console.log('check for update')),\n tap(() => this.updates.checkForUpdate()),\n ),\n )\n .subscribe();\n\n } else {\n console.warn('service worker updates are not enabled');\n }\n }\n\n}\n","import {\n ApplicationRef,\n createComponent,\n Inject,\n Injectable,\n Injector,\n} from '@angular/core';\nimport {\n SwUpdate,\n UpdateAvailableEvent,\n} from '@angular/service-worker';\nimport { Observable } from 'rxjs';\nimport {\n concatMap,\n tap,\n} from 'rxjs/operators';\nimport {\n ServiceWorkerUpdateDialogComponent,\n UPDATE_AVAILABLE_EVENT,\n} from './service-worker-update-dialog/service-worker-update-dialog.component';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DialogUpdateService {\n constructor(\n @Inject(ApplicationRef)\n private readonly applicationRef: ApplicationRef,\n @Inject(SwUpdate)\n private readonly updates: SwUpdate,\n ) {\n }\n\n public start(): void {\n console.debug('start dialog update service');\n this.updates.available\n .pipe(\n concatMap((event) => this.openUpdateDialog(event)),\n tap(() => console.log('start app update')),\n tap(() =>\n this.updates.activateUpdate().then(() => {\n console.log('app update completed. Reload app.');\n document.location.reload();\n }),\n ),\n )\n .subscribe();\n }\n\n private openUpdateDialog(event: UpdateAvailableEvent): Observable<void> {\n console.debug('open update dialog');\n const body = document.getElementsByTagName('body')[0];\n const div = document.createElement('div');\n body.appendChild(div);\n const componentRef = createComponent(ServiceWorkerUpdateDialogComponent, {\n hostElement: div,\n environmentInjector: this.applicationRef.injector,\n elementInjector: Injector.create({\n providers: [\n {\n provide: UPDATE_AVAILABLE_EVENT,\n useValue: event,\n },\n ],\n }),\n });\n this.applicationRef.attachView(componentRef.hostView);\n\n return componentRef.instance.closeDialog.pipe(\n tap(() => {\n componentRef.destroy();\n body.removeChild(div);\n div.remove();\n }),\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { SwUpdate } from '@angular/service-worker';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LogUpdateService {\n\n constructor(private readonly updates: SwUpdate) {\n }\n\n public start() {\n console.debug('start log update');\n this.updates.available.subscribe(event => {\n console.log('current version is', event.current);\n console.log('available version is', event.available);\n });\n this.updates.activated.subscribe(event => {\n console.log('old version was', event.previous);\n console.log('new version is', event.current);\n });\n }\n\n}\n\n","import {\n APP_INITIALIZER,\n Provider,\n} from '@angular/core';\nimport { CheckForUpdateService } from './check-for-update.service';\nimport { DialogUpdateService } from './dialog-update.service';\nimport { LogUpdateService } from './log-update.service';\n\nexport function ProvideServiceWorkerUpdater(...providers: Provider[]): Provider[] {\n return [\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: (checkForUpdate: CheckForUpdateService) => () => checkForUpdate.start(),\n deps: [ CheckForUpdateService ],\n },\n ...providers,\n ];\n}\n\nexport function withLogUpdater(): Provider {\n return {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: (logUpdateService: LogUpdateService) => () => logUpdateService.start(),\n deps: [ LogUpdateService ],\n };\n}\n\nexport function withDialogUpdater(): Provider {\n return {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: (dus: DialogUpdateService) => () => dus.start(),\n deps: [ DialogUpdateService ],\n };\n}\n","import { Environment } from '@rxap/environment';\n\nexport function UnregisterServiceWorker(environment: Environment) {\n if (!environment.serviceWorker) {\n navigator?.serviceWorker?.getRegistrations().then(async (registrations) => {\n await Promise.all(registrations.map((registration) => {\n console.log('unregister service worker: ' + registration.scope);\n return registration.unregister();\n }));\n if (registrations.length) {\n const response = confirm(\n 'All dangling service worker are unregistered. Should the application be reloaded to complete the migration');\n if (response) {\n location.reload();\n }\n }\n });\n }\n}\n","// region service-worker-update-dialog\nexport * from './lib/service-worker-update-dialog/service-worker-update-dialog.component';\n// endregion\n\n// region \nexport * from './lib/check-for-update.service';\nexport * from './lib/dialog-update.service';\nexport * from './lib/log-update.service';\nexport * from './lib/provide-service-worker-updater';\nexport * from './lib/unregister-service-worker';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;MAYa,sBAAsB,GAAG,IAAI,cAAc,CAAuB,wBAAwB,EAAE;MAS5F,kCAAkC,CAAA;AAP/C,IAAA,WAAA,GAAA;AAaS,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,YAAY,EAAQ,CAAC;AAE9B,QAAA,IAAA,CAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAWvE,KAAA;IATC,eAAe,GAAA;AACb,QAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;KACvC;IAED,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;AAClC,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;KACzB;8GAjBU,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kCAAkC,sPCrB/C,slBAeA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,EAAA;;2FDMa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AA,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,IAAI,CAAC,OAAO,aAAa,KAAI;YACxE,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,KAAI;gBACnD,OAAO,CAAC,GAAG,CAAC,6BAA6B,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AAChE,gBAAA,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC;aAClC,CAAC,CAAC,CAAC;YACJ,IAAI,aAAa,CAAC,MAAM,EAAE;AACxB,gBAAA,MAAM,QAAQ,GAAG,OAAO,CACtB,4GAA4G,CAAC,CAAC;AAChH,gBAAA,IAAI,QAAQ,EAAE;oBACZ,QAAQ,CAAC,MAAM,EAAE,CAAC;AACnB,iBAAA;AACF,aAAA;AACH,SAAC,CAAC,CAAC;AACJ,KAAA;AACH;;AClBA;AAUA;;ACVA;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from './lib/log-update.service';
1
+ export * from './lib/service-worker-update-dialog/service-worker-update-dialog.component';
2
2
  export * from './lib/check-for-update.service';
3
- export * from './lib/prompt-update/prompt-update.component.module';
4
- export * from './lib/prompt-update/prompt-update.component';
5
- export * from './lib/prompt-update/prompt-update.service';
6
- export * from './lib/snack-bar-update.service';
3
+ export * from './lib/dialog-update.service';
4
+ export * from './lib/log-update.service';
5
+ export * from './lib/provide-service-worker-updater';
6
+ export * from './lib/unregister-service-worker';
@@ -4,14 +4,9 @@ import * as i0 from "@angular/core";
4
4
  export declare class CheckForUpdateService {
5
5
  private readonly lifeCycle;
6
6
  private readonly updates;
7
+ private _started;
7
8
  constructor(lifeCycle: LifeCycleService, updates: SwUpdate);
8
9
  start(): void;
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<CheckForUpdateService, never>;
10
11
  static ɵprov: i0.ɵɵInjectableDeclaration<CheckForUpdateService>;
11
12
  }
12
- export declare class CheckForUpdateModule {
13
- constructor(checkForUpdate: CheckForUpdateService);
14
- static ɵfac: i0.ɵɵFactoryDeclaration<CheckForUpdateModule, never>;
15
- static ɵmod: i0.ɵɵNgModuleDeclaration<CheckForUpdateModule, never, never, never>;
16
- static ɵinj: i0.ɵɵInjectorDeclaration<CheckForUpdateModule>;
17
- }
@@ -0,0 +1,12 @@
1
+ import { ApplicationRef } from '@angular/core';
2
+ import { SwUpdate } from '@angular/service-worker';
3
+ import * as i0 from "@angular/core";
4
+ export declare class DialogUpdateService {
5
+ private readonly applicationRef;
6
+ private readonly updates;
7
+ constructor(applicationRef: ApplicationRef, updates: SwUpdate);
8
+ start(): void;
9
+ private openUpdateDialog;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogUpdateService, never>;
11
+ static ɵprov: i0.ɵɵInjectableDeclaration<DialogUpdateService>;
12
+ }
@@ -7,9 +7,3 @@ export declare class LogUpdateService {
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<LogUpdateService, never>;
8
8
  static ɵprov: i0.ɵɵInjectableDeclaration<LogUpdateService>;
9
9
  }
10
- export declare class LogUpdateModule {
11
- constructor(logUpdate: LogUpdateService);
12
- static ɵfac: i0.ɵɵFactoryDeclaration<LogUpdateModule, never>;
13
- static ɵmod: i0.ɵɵNgModuleDeclaration<LogUpdateModule, never, never, never>;
14
- static ɵinj: i0.ɵɵInjectorDeclaration<LogUpdateModule>;
15
- }
@@ -0,0 +1,4 @@
1
+ import { Provider } from '@angular/core';
2
+ export declare function ProvideServiceWorkerUpdater(...providers: Provider[]): Provider[];
3
+ export declare function withLogUpdater(): Provider;
4
+ export declare function withDialogUpdater(): Provider;
@@ -0,0 +1,13 @@
1
+ import { AfterViewInit, ElementRef, EventEmitter, InjectionToken } from '@angular/core';
2
+ import { UpdateAvailableEvent } from '@angular/service-worker';
3
+ import * as i0 from "@angular/core";
4
+ export declare const UPDATE_AVAILABLE_EVENT: InjectionToken<UpdateAvailableEvent>;
5
+ export declare class ServiceWorkerUpdateDialogComponent implements AfterViewInit {
6
+ dialog: ElementRef<HTMLDialogElement>;
7
+ closeDialog: EventEmitter<void>;
8
+ readonly updateAvailableEvent: UpdateAvailableEvent;
9
+ ngAfterViewInit(): void;
10
+ close(): void;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<ServiceWorkerUpdateDialogComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<ServiceWorkerUpdateDialogComponent, "rxap-service-worker-update-dialog", never, {}, { "closeDialog": "closeDialog"; }, never, never, true, never>;
13
+ }
@@ -0,0 +1,2 @@
1
+ import { Environment } from '@rxap/environment';
2
+ export declare function UnregisterServiceWorker(environment: Environment): void;