Files
doneit-web/.angular/cache/14.2.12/babel-webpack/2cd0b3db0194b305d03dc87f3cb34e35.json
T

1 line
26 KiB
JSON
Raw Normal View History

2023-06-30 09:54:21 +01:00
{"ast":null,"code":"import { __awaiter } from 'tslib';\nimport * as i0 from '@angular/core';\nimport { InjectionToken, Injectable, Inject, Optional, PLATFORM_ID, NgZone, NgModule } from '@angular/core';\nimport firebase from 'firebase/app';\nimport { of, EMPTY, throwError, Observable, concat } from 'rxjs';\nimport { subscribeOn, observeOn, switchMap, map, shareReplay, switchMapTo, catchError, mergeMap, defaultIfEmpty } from 'rxjs/operators';\nimport * as i1 from '@angular/fire';\nimport { ɵAngularFireSchedulers, ɵfirebaseAppFactory, ɵfetchInstance, ɵlazySDKProxy, FIREBASE_OPTIONS, FIREBASE_APP_NAME, ɵapplyMixins } from '@angular/fire';\nimport { isPlatformServer } from '@angular/common';\nimport * as ɵngcc0 from '@angular/core';\nconst proxyPolyfillCompat = {\n deleteToken: null,\n getToken: null,\n onMessage: null,\n onBackgroundMessage: null,\n onTokenRefresh: null,\n requestPermission: null,\n setBackgroundMessageHandler: null,\n useServiceWorker: null,\n usePublicVapidKey: null\n};\nconst VAPID_KEY = new InjectionToken('angularfire2.messaging.vapid-key');\nconst SERVICE_WORKER = new InjectionToken('angularfire2.messaging.service-worker-registeration');\n// SEMVER(7): drop\nconst firebaseLTv8 = parseInt(firebase.SDK_VERSION, 10) < 8;\nclass AngularFireMessaging {\n constructor(options, nameOrConfig,\n // tslint:disable-next-line:ban-types\n platformId, zone, vapidKey, _serviceWorker) {\n const schedulers = new ɵAngularFireSchedulers(zone);\n const serviceWorker = _serviceWorker;\n const messaging = of(undefined).pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular), switchMap(() => isPlatformServer(platformId) ? EMPTY : import('firebase/messaging')), map(() => ɵfirebaseAppFactory(options, zone, nameOrConfig)), switchMap(app => ɵfetchInstance(`${app.name}.messaging`, 'AngularFireMessaging', app, () => __awaiter(this, void 0, void 0, function* () {\n const messaging = app.messaging();\n if (firebaseLTv8) {\n if (vapidKey) {\n messaging.usePublicVapidKey(vapidKey);\n }\n if (serviceWorker) {\n messaging.useServiceWorker(yield serviceWorker);\n }\n }\n return messaging;\n }), [vapidKey, serviceWorker])), shareReplay({\n bufferSize: 1,\n refCount: false\n }));\n this.requestPermission = messaging.pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular),\n // tslint:disable-next-line\n switchMap(messaging => firebase.messaging.isSupported() ? messaging.requestPermission() : throwError('Not supported.')));\n this.getToken = messaging.pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular), switchMap(messaging => __awaiter(this, void 0, void 0, function* () {\n if (firebase.messaging.isSupported() && Notification.permission === 'granted') {\n if (firebaseLTv8) {\n return yield messaging.getToken();\n } else {\n const serviceWorkerRegistration = serviceWorker ? yield serviceWorker : null;\n return yield messaging.getToken({\n vapidKey,\n serviceWorkerRegistration\n });\n }\n } else {\n return null;\n }\n })));\n const notificationPermission$ = new Observable(emitter => {\n navigator.permissions.query({\n name: 'notifications'\n }).then(notificationPerm => {\n notificationPerm.onchange = () => emitter.next();\n });\n });\n const tokenChange$ = messaging.pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular), switchMapTo(notificationPermission$), switchMapTo(this.getToken));\n this.tokenChanges = messaging.pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular), switchMap(() => firebase.messaging.isSupported() ? concat(this.getToken, tokenChange$) : EMPTY));\n this.messages = messaging.pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular), switchMap(messaging => firebase.messaging.isSupported() ? new Observabl