@kolektor/nucleus-notifications 0.1.1175 → 0.1.2191
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.
|
@@ -409,10 +409,10 @@ class NucleusNotificationsService {
|
|
|
409
409
|
});
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
413
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
412
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsService, deps: [{ token: i1.HttpClient }, { token: i2.SwPush }, { token: i3.NucleusAppService }, { token: NucleusNotificationsConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
413
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsService, providedIn: 'root' }); }
|
|
414
414
|
}
|
|
415
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsService, decorators: [{
|
|
416
416
|
type: Injectable,
|
|
417
417
|
args: [{
|
|
418
418
|
providedIn: 'root',
|
|
@@ -426,11 +426,11 @@ class NucleusNotificationsModule {
|
|
|
426
426
|
providers: [{ provide: NucleusNotificationsConfig, useValue: config }],
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
430
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
431
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
429
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
430
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsModule }); }
|
|
431
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsModule }); }
|
|
432
432
|
}
|
|
433
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusNotificationsModule, decorators: [{
|
|
434
434
|
type: NgModule,
|
|
435
435
|
args: [{
|
|
436
436
|
declarations: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kolektor-nucleus-notifications.mjs","sources":["../../../../../../libs/ng/nucleus/nucleus-notifications/src/lib/models.ts","../../../../../../libs/ng/nucleus/nucleus-notifications/src/lib/nucleus-notifications.service.ts","../../../../../../libs/ng/nucleus/nucleus-notifications/src/lib/nucleus-notifications.module.ts","../../../../../../libs/ng/nucleus/nucleus-notifications/src/kolektor-nucleus-notifications.ts"],"sourcesContent":["export class Notification {\n public id: string;\n public sender: Identity;\n public data: NotificationData;\n public isRead: boolean;\n public dateCreated: Date;\n public expirationDate: Date;\n}\n\nexport class Identity {\n public subject: string;\n public name: string;\n public pictureUrl: string;\n}\n\nexport class Recipient {\n public attributeName: string;\n public directoryName: string;\n public attributeValue: string;\n}\n\nexport class NotificationData {\n title: string;\n message: string;\n htmlMessage: string;\n preventDismissal: boolean;\n deepLink: string;\n}\n\nexport class WebKey {\n publicKey: string;\n}\n\nexport class Registration {\n id: string;\n token: string;\n platform: PlatformValue;\n}\n\nexport class RegistrationResult {\n id: string;\n}\n\nexport class PayloadData {\n notificationId: string;\n eventType: NotificationEventType;\n}\n\nexport class NucleusNotificationsConfig {\n serverApiUrl: string;\n}\n\nexport class NotificationClick {\n id: string;\n type: NotificationType;\n routerLink?: string;\n}\n\nexport type NotificationEventType =\n | 'new'\n | 'updated'\n | 'deleted'\n | 'deletedAll'\n | 'updatedAll'\n | 'newSilent';\n\nexport type PlatformValue = 'ios' | 'android' | 'web' | 'none';\n\nexport type NotificationType = 'default' | 'deeplink';\n\nexport interface ChannelId {\n senderId: string;\n channelId: string;\n}\n\nexport class UserChannelConfig {\n channelId: string;\n displayName: string;\n isSubscribed: boolean;\n subscriptionType: ChannelSubscriptionType;\n methods: NotifyMethod[];\n allowedMethods: NotifyMethod[];\n}\n\nexport type ChannelSubscriptionType = 'invariant' | 'optIn' | 'optOut';\n\nexport type NotifyMethod = 'push' | 'email' | 'sms';\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { SwPush } from '@angular/service-worker';\nimport {\n PushNotifications,\n PushNotificationSchema,\n} from '@capacitor/push-notifications';\nimport { NucleusAppService } from '@kolektor/nucleus-common';\nimport { Observable, of, Subject } from 'rxjs';\nimport {\n ChannelId,\n Notification,\n NotificationClick,\n NotificationEventType,\n NotificationType,\n NucleusNotificationsConfig,\n PayloadData,\n PlatformValue,\n Registration,\n RegistrationResult,\n UserChannelConfig,\n WebKey,\n} from './models';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NucleusNotificationsService {\n constructor(\n private http: HttpClient,\n private swPush: SwPush,\n private appService: NucleusAppService,\n config: NucleusNotificationsConfig\n ) {\n let url = config.serverApiUrl;\n if (!url.endsWith('/')) {\n url += '/';\n }\n this.apiUrl = url;\n }\n\n private apiUrl: string;\n private readonly registrationStorageKey = 'NucleusNotificationsRegistrationId';\n private readonly notificationsStorageKey = 'NucleusNotificationsLocalCache';\n private _platform: PlatformValue;\n private _isInitialized = false;\n private _newNotifications = new Subject<Notification>();\n private _clicksSubject = new Subject<NotificationClick>();\n private _stateChangesSubject = new Subject<void>();\n\n public notifications: Notification[] = [];\n\n public get unreadCount() {\n return this.notifications.filter((x) => !x.isRead).length;\n }\n\n public get newNotifications() {\n return this._newNotifications.asObservable();\n }\n\n public get clicks() {\n return this._clicksSubject.asObservable();\n }\n public get stateChanges() {\n return this._stateChangesSubject.asObservable();\n }\n\n public get isInitialized() {\n return this._isInitialized;\n }\n\n public async initialize() {\n // make sure app service has finished initializing\n await this.appService.init();\n\n this.loadFromStorage();\n\n if (this.appService.isNative) {\n this._platform = this.appService.deviceInfo.platform as PlatformValue;\n await this.registerCapacitorEvents();\n } else if (this.swPush.isEnabled) {\n this._platform = 'web';\n this.registerWebPushEvents();\n } else {\n console.warn(\n 'Nucleus.Notifications: There is no push capability, timer will be used to update notifications'\n );\n setInterval(() => {\n console.log('Updating notifications...');\n this.refresh(true);\n }, 5 * 60 * 1000);\n }\n this._isInitialized = true;\n this.refresh();\n }\n\n public register(): Promise<any> {\n return new Promise((_resolve, _reject) => {\n this.getRegistrationInfo()\n .then((info) => {\n this.http\n .post<RegistrationResult>(this.apiUrl + 'registration', info)\n .subscribe({\n next: (regResult) => {\n window.localStorage.setItem(\n this.registrationStorageKey,\n regResult.id\n );\n _resolve(null);\n },\n error: (error) => {\n console.log(\n 'Nucleus.Notifications: Failed to send notification registration to server.',\n error\n );\n _reject(error);\n }\n });\n })\n .catch((error) => _reject(error));\n });\n }\n\n public unregister(): Promise<any> {\n return new Promise((_resolve, _reject) => {\n this.getRegistrationInfo()\n .then((info) => {\n this.http\n .request<any>('DELETE', this.apiUrl + 'registration', {\n body: info,\n })\n .subscribe({\n next: () => {\n window.localStorage.removeItem(this.registrationStorageKey);\n _resolve(null);\n },\n error: (error) => {\n console.log(\n 'Nucleus.Notifications: Failed to remove registration from server.',\n error\n );\n _reject(error);\n }\n });\n })\n .catch((error) => _reject(error));\n });\n }\n\n public refresh(notifyAboutNew = false) {\n this.http\n .get<Notification[]>(this.apiUrl + 'notifications')\n .subscribe((res) => {\n this.updateNotifications(res, notifyAboutNew);\n });\n }\n\n public getNotification(id: string): Observable<Notification> {\n const localNotification = this.notifications.find((x) => x.id === id);\n if (localNotification) {\n return of(localNotification);\n }\n return this.http.get<Notification>(this.apiUrl + 'notifications/' + id);\n }\n\n public readNotification(id: string) {\n const n = this.notifications.find((x) => x.id === id);\n if (n && !n.isRead) {\n n.isRead = true;\n this.notifyStateChanged();\n }\n this.http.get(this.apiUrl + 'notifications/read/' + id).subscribe();\n }\n\n public dismissNotification(id: string) {\n this.deleteNotificaton(id);\n this.http.delete(this.apiUrl + 'notifications/' + id).subscribe();\n this.removeDeliveredNotification(id);\n }\n\n public dismissAll() {\n this.notifications.splice(0);\n this.notifyStateChanged();\n this.http.delete(this.apiUrl + 'notifications/all').subscribe();\n if (this._platform === 'ios' || this._platform === 'android') {\n PushNotifications.removeAllDeliveredNotifications();\n } else if (this._platform === 'web') {\n // TODO: remove all web push notifications\n }\n }\n\n public readAll() {\n for (const n of this.notifications) {\n n.isRead = true;\n }\n this.notifyStateChanged();\n this.http.get(this.apiUrl + 'notifications/read/all').subscribe();\n }\n\n public getChannelConfig(\n senderId: string,\n channelId: string,\n language?: string\n ) {\n return this.http.get<UserChannelConfig>(\n this.apiUrl +\n `settings/channel/${senderId}/${channelId}?language=${language}`\n );\n }\n\n public getChannelConfigsForSender(\n senderId: string,\n channelIds: string[],\n language?: string\n ) {\n const idsStr = channelIds.map((x) => senderId + ',' + x).join(';');\n return this.getChannelConfigsInternal(idsStr, language);\n }\n\n public getChannelConfigs(ids: ChannelId[], language?: string) {\n const idsStr = ids.map((x) => x.senderId + ',' + x.channelId).join(';');\n return this.getChannelConfigsInternal(idsStr, language);\n }\n\n public setChannelConfig(senderId: string, config: UserChannelConfig) {\n return this.http.post<void>(\n `${this.apiUrl}settings/channel/${senderId}`,\n config\n );\n }\n\n public setChannelConfigs(configs: UserChannelConfig[]) {\n return this.http.post<void>(`${this.apiUrl}settings/channels`, configs);\n }\n\n private getChannelConfigsInternal(ids: string, language?: string) {\n return this.http.get<UserChannelConfig[]>(\n `${this.apiUrl}settings/channels?ids=${ids}&language=${language}`\n );\n }\n\n private updateNotifications(\n newNotifications: Notification[],\n notifyAboutNew = false\n ) {\n let stateChanged = false;\n for (const n of newNotifications) {\n const existing = this.notifications.find((x) => x.id === n.id);\n if (existing) {\n if (existing.isRead !== n.isRead) {\n existing.isRead = n.isRead;\n stateChanged = true;\n }\n } else {\n let i = 0;\n while (\n i < this.notifications.length &&\n n.dateCreated < this.notifications[i].dateCreated\n ) {\n i++;\n }\n this.notifications.splice(i, 0, n);\n stateChanged = true;\n if (notifyAboutNew) {\n this._newNotifications.next(n);\n }\n }\n }\n\n const now = Date.now();\n for (let i = this.notifications.length - 1; i >= 0; i--) {\n const n = this.notifications[i];\n if (\n new Date(n.expirationDate).getTime() < now ||\n !newNotifications.find((x) => x.id === n.id)\n ) {\n this.notifications.splice(i, 1);\n stateChanged = true;\n }\n }\n\n if (stateChanged) {\n this.notifyStateChanged();\n }\n }\n\n private saveToStorage() {\n const str = JSON.stringify(this.notifications);\n window.localStorage.setItem(this.notificationsStorageKey, str);\n }\n\n private loadFromStorage() {\n try {\n const str = window.localStorage.getItem(this.notificationsStorageKey);\n if (str) {\n const notifications = JSON.parse(str) as Notification[];\n this.notifications = notifications.filter((x) => !!x);\n // precaution for notification.isRead of undefined error\n this.notifyStateChanged(false);\n }\n } catch {\n /* empty */\n }\n }\n\n private handleNotificationEvent(\n id: string,\n eventType: NotificationEventType\n ) {\n if (eventType.startsWith('new') || eventType === 'updated') {\n // we are handling new and newSilent\n this.getNotification(id).subscribe((n) => {\n if (eventType.startsWith('new') && !n.isRead) {\n this._newNotifications.next(n);\n }\n const existing = this.notifications.find((x) => x.id === n.id);\n if (existing) {\n existing.isRead = n.isRead;\n } else {\n this.notifications.splice(0, 0, n);\n }\n this.notifyStateChanged();\n });\n } else if (eventType === 'deleted') {\n this.deleteNotificaton(id);\n } else {\n this.refresh();\n }\n }\n\n private deleteNotificaton(id: string) {\n const i = this.notifications.findIndex((x) => x.id === id);\n if (i >= 0) {\n this.notifications.splice(i, 1);\n this.notifyStateChanged();\n }\n }\n\n private notifyStateChanged(persistState = true) {\n if (persistState) {\n this.saveToStorage();\n }\n this._stateChangesSubject.next();\n }\n\n private handleNotificationAction(notificationAction: string | undefined) {\n if (!notificationAction) {\n throw new Error('Notification action is empty!');\n }\n\n const arr = notificationAction.split(':');\n const notificationClick: NotificationClick = {\n id: arr[0],\n type: arr[1] as NotificationType,\n routerLink: arr[2],\n };\n\n const validNotificationClickTypes = ['default', 'deeplink'];\n if (validNotificationClickTypes.includes(notificationClick.type)) {\n this._clicksSubject.next(notificationClick);\n } else {\n console.error(\n `Nucleus.Notifications: Unknown notification action: '${notificationAction}'.`\n );\n }\n }\n\n private removeDeliveredNotification(id: string) {\n if (this._platform === 'ios' || this._platform === 'android') {\n PushNotifications.getDeliveredNotifications().then((list) => {\n const toRemove = list.notifications.filter((n) => {\n const data = this.getNotificationPayloadData(n);\n return data.notificationId === id;\n });\n\n // TODO: On Android this does not currently work because notificationID is not set.\n // This my solve the issue: https://github.com/ionic-team/capacitor/pull/3523\n PushNotifications.removeDeliveredNotifications({\n notifications: toRemove,\n });\n });\n } else if (this._platform === 'web') {\n // TODO: remove web push notification\n }\n }\n\n private getNotificationPayloadData(\n pushNotification: PushNotificationSchema\n ): PayloadData {\n return this._platform === 'ios'\n ? pushNotification.data.data\n : pushNotification.data;\n }\n\n private async registerCapacitorEvents() {\n await PushNotifications.addListener('pushNotificationReceived', (n) => {\n const data = this.getNotificationPayloadData(n);\n console.log(\n 'Nucleus.Notifications: Received capacitor push event: ' +\n data.eventType,\n n\n );\n this.handleNotificationEvent(data.notificationId, data.eventType);\n });\n\n await PushNotifications.addListener(\n 'pushNotificationActionPerformed',\n (a) => {\n let action = (a as any).notification.data.notificationAction;\n if (this._platform === 'ios') {\n action = (a as any).notification.data.data.notificationAction;\n }\n console.log(\n 'Nucleus.Notifications: Received capacitor action event',\n action\n );\n this.handleNotificationAction(action);\n }\n );\n }\n\n private registerWebPushEvents() {\n this.swPush.messages.subscribe((n) => {\n const data: PayloadData = (n as any).data;\n console.log(\n 'Nucleus.Notifications: Received WebPush event: ' + data.eventType,\n n\n );\n this.handleNotificationEvent(data.notificationId, data.eventType);\n });\n\n this.swPush.notificationClicks.subscribe((action) => {\n console.log(\n 'Nucleus.Notifications: Received WebPush action event',\n action\n );\n const tag = action.notification.tag;\n this.handleNotificationAction(tag);\n });\n }\n\n private getRegistrationInfo(): Promise<Registration> {\n return new Promise((_resolve, _reject) => {\n const registrationId = window.localStorage.getItem(\n this.registrationStorageKey\n ) as string;\n if (this._platform === 'android' || this._platform === 'ios') {\n // capacitor platform\n PushNotifications.addListener('registration', (token) => {\n _resolve({\n id: registrationId,\n token: token.value,\n platform: this._platform,\n });\n })\n .then(listener => {\n listener.remove();\n return PushNotifications.register();\n })\n .catch((error) =>\n _reject('Could not register for notifications:' + error)\n );\n } else if (this._platform === 'web') {\n // Web Push API\n this.http.get<WebKey>(this.apiUrl + 'registration/webkey').subscribe({\n next: (key) => {\n this.getWebPushSubscription(key.publicKey).then((subscription) => {\n const t = JSON.stringify(subscription.toJSON());\n _resolve({ id: registrationId, token: t, platform: 'web' });\n });\n },\n error: (error) => _reject(error)\n });\n } else {\n _reject(`Nucleus.Notifications: Platform is not supported`);\n }\n });\n }\n\n private getWebPushSubscription(publicKey: string): Promise<PushSubscription> {\n return new Promise((_resolve, _reject) => {\n this.swPush.subscription.subscribe({\n next: (subscription) => {\n if (subscription != null) {\n _resolve(subscription);\n } else {\n this.swPush\n .requestSubscription({ serverPublicKey: publicKey })\n .then((s) => _resolve(s))\n .catch((e) => _reject(e));\n }\n },\n error: (error) => {\n console.error(\n 'Nucleus.Notifications: Cannot get web push subscription',\n error\n );\n _reject(error);\n }\n });\n });\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { NucleusNotificationsConfig } from './models';\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n})\nexport class NucleusNotificationsModule {\n static forRoot(\n config: NucleusNotificationsConfig\n ): ModuleWithProviders<NucleusNotificationsModule> {\n return {\n ngModule: NucleusNotificationsModule,\n providers: [{ provide: NucleusNotificationsConfig, useValue: config }],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i4.NucleusNotificationsConfig"],"mappings":";;;;;;;;MAAa,YAAY,CAAA;AAOxB,CAAA;MAEY,QAAQ,CAAA;AAIpB,CAAA;MAEY,SAAS,CAAA;AAIrB,CAAA;MAEY,gBAAgB,CAAA;AAM5B,CAAA;MAEY,MAAM,CAAA;AAElB,CAAA;MAEY,YAAY,CAAA;AAIxB,CAAA;MAEY,kBAAkB,CAAA;AAE9B,CAAA;MAEY,WAAW,CAAA;AAGvB,CAAA;MAEY,0BAA0B,CAAA;AAEtC,CAAA;MAEY,iBAAiB,CAAA;AAI7B,CAAA;MAmBY,iBAAiB,CAAA;AAO7B;;AClFD;MA4Ba,2BAA2B,CAAA;AACtC,IAAA,WAAA,CACU,IAAgB,EAChB,MAAc,EACd,UAA6B,EACrC,MAAkC,EAAA;QAH1B,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QAChB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;QACd,IAAU,CAAA,UAAA,GAAV,UAAU,CAAmB;QAWtB,IAAsB,CAAA,sBAAA,GAAG,oCAAoC,CAAC;QAC9D,IAAuB,CAAA,uBAAA,GAAG,gCAAgC,CAAC;QAEpE,IAAc,CAAA,cAAA,GAAG,KAAK,CAAC;AACvB,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,OAAO,EAAgB,CAAC;AAChD,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,OAAO,EAAqB,CAAC;AAClD,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,OAAO,EAAQ,CAAC;QAE5C,IAAa,CAAA,aAAA,GAAmB,EAAE,CAAC;AAhBxC,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,CAAA;;;MCnBY,0BAA0B,CAAA;IACrC,OAAO,OAAO,CACZ,MAAkC,EAAA;QAElC,OAAO;AACL,YAAA,QAAQ,EAAE,0BAA0B;YACpC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SACvE,CAAC;KACH;8GARU,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;+GAA1B,0BAA0B,EAAA,CAAA,CAAA,EAAA;+GAA1B,0BAA0B,EAAA,CAAA,CAAA,EAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBALtC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA,CAAA;;;ACPD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"kolektor-nucleus-notifications.mjs","sources":["../../../../../../libs/ng/nucleus/nucleus-notifications/src/lib/models.ts","../../../../../../libs/ng/nucleus/nucleus-notifications/src/lib/nucleus-notifications.service.ts","../../../../../../libs/ng/nucleus/nucleus-notifications/src/lib/nucleus-notifications.module.ts","../../../../../../libs/ng/nucleus/nucleus-notifications/src/kolektor-nucleus-notifications.ts"],"sourcesContent":["export class Notification {\n public id: string;\n public sender: Identity;\n public data: NotificationData;\n public isRead: boolean;\n public dateCreated: Date;\n public expirationDate: Date;\n}\n\nexport class Identity {\n public subject: string;\n public name: string;\n public pictureUrl: string;\n}\n\nexport class Recipient {\n public attributeName: string;\n public directoryName: string;\n public attributeValue: string;\n}\n\nexport class NotificationData {\n title: string;\n message: string;\n htmlMessage: string;\n preventDismissal: boolean;\n deepLink: string;\n}\n\nexport class WebKey {\n publicKey: string;\n}\n\nexport class Registration {\n id: string;\n token: string;\n platform: PlatformValue;\n}\n\nexport class RegistrationResult {\n id: string;\n}\n\nexport class PayloadData {\n notificationId: string;\n eventType: NotificationEventType;\n}\n\nexport class NucleusNotificationsConfig {\n serverApiUrl: string;\n}\n\nexport class NotificationClick {\n id: string;\n type: NotificationType;\n routerLink?: string;\n}\n\nexport type NotificationEventType =\n | 'new'\n | 'updated'\n | 'deleted'\n | 'deletedAll'\n | 'updatedAll'\n | 'newSilent';\n\nexport type PlatformValue = 'ios' | 'android' | 'web' | 'none';\n\nexport type NotificationType = 'default' | 'deeplink';\n\nexport interface ChannelId {\n senderId: string;\n channelId: string;\n}\n\nexport class UserChannelConfig {\n channelId: string;\n displayName: string;\n isSubscribed: boolean;\n subscriptionType: ChannelSubscriptionType;\n methods: NotifyMethod[];\n allowedMethods: NotifyMethod[];\n}\n\nexport type ChannelSubscriptionType = 'invariant' | 'optIn' | 'optOut';\n\nexport type NotifyMethod = 'push' | 'email' | 'sms';\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { SwPush } from '@angular/service-worker';\nimport {\n PushNotifications,\n PushNotificationSchema,\n} from '@capacitor/push-notifications';\nimport { NucleusAppService } from '@kolektor/nucleus-common';\nimport { Observable, of, Subject } from 'rxjs';\nimport {\n ChannelId,\n Notification,\n NotificationClick,\n NotificationEventType,\n NotificationType,\n NucleusNotificationsConfig,\n PayloadData,\n PlatformValue,\n Registration,\n RegistrationResult,\n UserChannelConfig,\n WebKey,\n} from './models';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NucleusNotificationsService {\n constructor(\n private http: HttpClient,\n private swPush: SwPush,\n private appService: NucleusAppService,\n config: NucleusNotificationsConfig\n ) {\n let url = config.serverApiUrl;\n if (!url.endsWith('/')) {\n url += '/';\n }\n this.apiUrl = url;\n }\n\n private apiUrl: string;\n private readonly registrationStorageKey = 'NucleusNotificationsRegistrationId';\n private readonly notificationsStorageKey = 'NucleusNotificationsLocalCache';\n private _platform: PlatformValue;\n private _isInitialized = false;\n private _newNotifications = new Subject<Notification>();\n private _clicksSubject = new Subject<NotificationClick>();\n private _stateChangesSubject = new Subject<void>();\n\n public notifications: Notification[] = [];\n\n public get unreadCount() {\n return this.notifications.filter((x) => !x.isRead).length;\n }\n\n public get newNotifications() {\n return this._newNotifications.asObservable();\n }\n\n public get clicks() {\n return this._clicksSubject.asObservable();\n }\n public get stateChanges() {\n return this._stateChangesSubject.asObservable();\n }\n\n public get isInitialized() {\n return this._isInitialized;\n }\n\n public async initialize() {\n // make sure app service has finished initializing\n await this.appService.init();\n\n this.loadFromStorage();\n\n if (this.appService.isNative) {\n this._platform = this.appService.deviceInfo.platform as PlatformValue;\n await this.registerCapacitorEvents();\n } else if (this.swPush.isEnabled) {\n this._platform = 'web';\n this.registerWebPushEvents();\n } else {\n console.warn(\n 'Nucleus.Notifications: There is no push capability, timer will be used to update notifications'\n );\n setInterval(() => {\n console.log('Updating notifications...');\n this.refresh(true);\n }, 5 * 60 * 1000);\n }\n this._isInitialized = true;\n this.refresh();\n }\n\n public register(): Promise<any> {\n return new Promise((_resolve, _reject) => {\n this.getRegistrationInfo()\n .then((info) => {\n this.http\n .post<RegistrationResult>(this.apiUrl + 'registration', info)\n .subscribe({\n next: (regResult) => {\n window.localStorage.setItem(\n this.registrationStorageKey,\n regResult.id\n );\n _resolve(null);\n },\n error: (error) => {\n console.log(\n 'Nucleus.Notifications: Failed to send notification registration to server.',\n error\n );\n _reject(error);\n }\n });\n })\n .catch((error) => _reject(error));\n });\n }\n\n public unregister(): Promise<any> {\n return new Promise((_resolve, _reject) => {\n this.getRegistrationInfo()\n .then((info) => {\n this.http\n .request<any>('DELETE', this.apiUrl + 'registration', {\n body: info,\n })\n .subscribe({\n next: () => {\n window.localStorage.removeItem(this.registrationStorageKey);\n _resolve(null);\n },\n error: (error) => {\n console.log(\n 'Nucleus.Notifications: Failed to remove registration from server.',\n error\n );\n _reject(error);\n }\n });\n })\n .catch((error) => _reject(error));\n });\n }\n\n public refresh(notifyAboutNew = false) {\n this.http\n .get<Notification[]>(this.apiUrl + 'notifications')\n .subscribe((res) => {\n this.updateNotifications(res, notifyAboutNew);\n });\n }\n\n public getNotification(id: string): Observable<Notification> {\n const localNotification = this.notifications.find((x) => x.id === id);\n if (localNotification) {\n return of(localNotification);\n }\n return this.http.get<Notification>(this.apiUrl + 'notifications/' + id);\n }\n\n public readNotification(id: string) {\n const n = this.notifications.find((x) => x.id === id);\n if (n && !n.isRead) {\n n.isRead = true;\n this.notifyStateChanged();\n }\n this.http.get(this.apiUrl + 'notifications/read/' + id).subscribe();\n }\n\n public dismissNotification(id: string) {\n this.deleteNotificaton(id);\n this.http.delete(this.apiUrl + 'notifications/' + id).subscribe();\n this.removeDeliveredNotification(id);\n }\n\n public dismissAll() {\n this.notifications.splice(0);\n this.notifyStateChanged();\n this.http.delete(this.apiUrl + 'notifications/all').subscribe();\n if (this._platform === 'ios' || this._platform === 'android') {\n PushNotifications.removeAllDeliveredNotifications();\n } else if (this._platform === 'web') {\n // TODO: remove all web push notifications\n }\n }\n\n public readAll() {\n for (const n of this.notifications) {\n n.isRead = true;\n }\n this.notifyStateChanged();\n this.http.get(this.apiUrl + 'notifications/read/all').subscribe();\n }\n\n public getChannelConfig(\n senderId: string,\n channelId: string,\n language?: string\n ) {\n return this.http.get<UserChannelConfig>(\n this.apiUrl +\n `settings/channel/${senderId}/${channelId}?language=${language}`\n );\n }\n\n public getChannelConfigsForSender(\n senderId: string,\n channelIds: string[],\n language?: string\n ) {\n const idsStr = channelIds.map((x) => senderId + ',' + x).join(';');\n return this.getChannelConfigsInternal(idsStr, language);\n }\n\n public getChannelConfigs(ids: ChannelId[], language?: string) {\n const idsStr = ids.map((x) => x.senderId + ',' + x.channelId).join(';');\n return this.getChannelConfigsInternal(idsStr, language);\n }\n\n public setChannelConfig(senderId: string, config: UserChannelConfig) {\n return this.http.post<void>(\n `${this.apiUrl}settings/channel/${senderId}`,\n config\n );\n }\n\n public setChannelConfigs(configs: UserChannelConfig[]) {\n return this.http.post<void>(`${this.apiUrl}settings/channels`, configs);\n }\n\n private getChannelConfigsInternal(ids: string, language?: string) {\n return this.http.get<UserChannelConfig[]>(\n `${this.apiUrl}settings/channels?ids=${ids}&language=${language}`\n );\n }\n\n private updateNotifications(\n newNotifications: Notification[],\n notifyAboutNew = false\n ) {\n let stateChanged = false;\n for (const n of newNotifications) {\n const existing = this.notifications.find((x) => x.id === n.id);\n if (existing) {\n if (existing.isRead !== n.isRead) {\n existing.isRead = n.isRead;\n stateChanged = true;\n }\n } else {\n let i = 0;\n while (\n i < this.notifications.length &&\n n.dateCreated < this.notifications[i].dateCreated\n ) {\n i++;\n }\n this.notifications.splice(i, 0, n);\n stateChanged = true;\n if (notifyAboutNew) {\n this._newNotifications.next(n);\n }\n }\n }\n\n const now = Date.now();\n for (let i = this.notifications.length - 1; i >= 0; i--) {\n const n = this.notifications[i];\n if (\n new Date(n.expirationDate).getTime() < now ||\n !newNotifications.find((x) => x.id === n.id)\n ) {\n this.notifications.splice(i, 1);\n stateChanged = true;\n }\n }\n\n if (stateChanged) {\n this.notifyStateChanged();\n }\n }\n\n private saveToStorage() {\n const str = JSON.stringify(this.notifications);\n window.localStorage.setItem(this.notificationsStorageKey, str);\n }\n\n private loadFromStorage() {\n try {\n const str = window.localStorage.getItem(this.notificationsStorageKey);\n if (str) {\n const notifications = JSON.parse(str) as Notification[];\n this.notifications = notifications.filter((x) => !!x);\n // precaution for notification.isRead of undefined error\n this.notifyStateChanged(false);\n }\n } catch {\n /* empty */\n }\n }\n\n private handleNotificationEvent(\n id: string,\n eventType: NotificationEventType\n ) {\n if (eventType.startsWith('new') || eventType === 'updated') {\n // we are handling new and newSilent\n this.getNotification(id).subscribe((n) => {\n if (eventType.startsWith('new') && !n.isRead) {\n this._newNotifications.next(n);\n }\n const existing = this.notifications.find((x) => x.id === n.id);\n if (existing) {\n existing.isRead = n.isRead;\n } else {\n this.notifications.splice(0, 0, n);\n }\n this.notifyStateChanged();\n });\n } else if (eventType === 'deleted') {\n this.deleteNotificaton(id);\n } else {\n this.refresh();\n }\n }\n\n private deleteNotificaton(id: string) {\n const i = this.notifications.findIndex((x) => x.id === id);\n if (i >= 0) {\n this.notifications.splice(i, 1);\n this.notifyStateChanged();\n }\n }\n\n private notifyStateChanged(persistState = true) {\n if (persistState) {\n this.saveToStorage();\n }\n this._stateChangesSubject.next();\n }\n\n private handleNotificationAction(notificationAction: string | undefined) {\n if (!notificationAction) {\n throw new Error('Notification action is empty!');\n }\n\n const arr = notificationAction.split(':');\n const notificationClick: NotificationClick = {\n id: arr[0],\n type: arr[1] as NotificationType,\n routerLink: arr[2],\n };\n\n const validNotificationClickTypes = ['default', 'deeplink'];\n if (validNotificationClickTypes.includes(notificationClick.type)) {\n this._clicksSubject.next(notificationClick);\n } else {\n console.error(\n `Nucleus.Notifications: Unknown notification action: '${notificationAction}'.`\n );\n }\n }\n\n private removeDeliveredNotification(id: string) {\n if (this._platform === 'ios' || this._platform === 'android') {\n PushNotifications.getDeliveredNotifications().then((list) => {\n const toRemove = list.notifications.filter((n) => {\n const data = this.getNotificationPayloadData(n);\n return data.notificationId === id;\n });\n\n // TODO: On Android this does not currently work because notificationID is not set.\n // This my solve the issue: https://github.com/ionic-team/capacitor/pull/3523\n PushNotifications.removeDeliveredNotifications({\n notifications: toRemove,\n });\n });\n } else if (this._platform === 'web') {\n // TODO: remove web push notification\n }\n }\n\n private getNotificationPayloadData(\n pushNotification: PushNotificationSchema\n ): PayloadData {\n return this._platform === 'ios'\n ? pushNotification.data.data\n : pushNotification.data;\n }\n\n private async registerCapacitorEvents() {\n await PushNotifications.addListener('pushNotificationReceived', (n) => {\n const data = this.getNotificationPayloadData(n);\n console.log(\n 'Nucleus.Notifications: Received capacitor push event: ' +\n data.eventType,\n n\n );\n this.handleNotificationEvent(data.notificationId, data.eventType);\n });\n\n await PushNotifications.addListener(\n 'pushNotificationActionPerformed',\n (a) => {\n let action = (a as any).notification.data.notificationAction;\n if (this._platform === 'ios') {\n action = (a as any).notification.data.data.notificationAction;\n }\n console.log(\n 'Nucleus.Notifications: Received capacitor action event',\n action\n );\n this.handleNotificationAction(action);\n }\n );\n }\n\n private registerWebPushEvents() {\n this.swPush.messages.subscribe((n) => {\n const data: PayloadData = (n as any).data;\n console.log(\n 'Nucleus.Notifications: Received WebPush event: ' + data.eventType,\n n\n );\n this.handleNotificationEvent(data.notificationId, data.eventType);\n });\n\n this.swPush.notificationClicks.subscribe((action) => {\n console.log(\n 'Nucleus.Notifications: Received WebPush action event',\n action\n );\n const tag = action.notification.tag;\n this.handleNotificationAction(tag);\n });\n }\n\n private getRegistrationInfo(): Promise<Registration> {\n return new Promise((_resolve, _reject) => {\n const registrationId = window.localStorage.getItem(\n this.registrationStorageKey\n ) as string;\n if (this._platform === 'android' || this._platform === 'ios') {\n // capacitor platform\n PushNotifications.addListener('registration', (token) => {\n _resolve({\n id: registrationId,\n token: token.value,\n platform: this._platform,\n });\n })\n .then(listener => {\n listener.remove();\n return PushNotifications.register();\n })\n .catch((error) =>\n _reject('Could not register for notifications:' + error)\n );\n } else if (this._platform === 'web') {\n // Web Push API\n this.http.get<WebKey>(this.apiUrl + 'registration/webkey').subscribe({\n next: (key) => {\n this.getWebPushSubscription(key.publicKey).then((subscription) => {\n const t = JSON.stringify(subscription.toJSON());\n _resolve({ id: registrationId, token: t, platform: 'web' });\n });\n },\n error: (error) => _reject(error)\n });\n } else {\n _reject(`Nucleus.Notifications: Platform is not supported`);\n }\n });\n }\n\n private getWebPushSubscription(publicKey: string): Promise<PushSubscription> {\n return new Promise((_resolve, _reject) => {\n this.swPush.subscription.subscribe({\n next: (subscription) => {\n if (subscription != null) {\n _resolve(subscription);\n } else {\n this.swPush\n .requestSubscription({ serverPublicKey: publicKey })\n .then((s) => _resolve(s))\n .catch((e) => _reject(e));\n }\n },\n error: (error) => {\n console.error(\n 'Nucleus.Notifications: Cannot get web push subscription',\n error\n );\n _reject(error);\n }\n });\n });\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { NucleusNotificationsConfig } from './models';\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n})\nexport class NucleusNotificationsModule {\n static forRoot(\n config: NucleusNotificationsConfig\n ): ModuleWithProviders<NucleusNotificationsModule> {\n return {\n ngModule: NucleusNotificationsModule,\n providers: [{ provide: NucleusNotificationsConfig, useValue: config }],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i4.NucleusNotificationsConfig"],"mappings":";;;;;;;;MAAa,YAAY,CAAA;AAOxB;MAEY,QAAQ,CAAA;AAIpB;MAEY,SAAS,CAAA;AAIrB;MAEY,gBAAgB,CAAA;AAM5B;MAEY,MAAM,CAAA;AAElB;MAEY,YAAY,CAAA;AAIxB;MAEY,kBAAkB,CAAA;AAE9B;MAEY,WAAW,CAAA;AAGvB;MAEY,0BAA0B,CAAA;AAEtC;MAEY,iBAAiB,CAAA;AAI7B;MAmBY,iBAAiB,CAAA;AAO7B;;AClFD;MA4Ba,2BAA2B,CAAA;AACtC,IAAA,WAAA,CACU,IAAgB,EAChB,MAAc,EACd,UAA6B,EACrC,MAAkC,EAAA;QAH1B,IAAA,CAAA,IAAI,GAAJ,IAAI;QACJ,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,UAAU,GAAV,UAAU;QAWH,IAAA,CAAA,sBAAsB,GAAG,oCAAoC;QAC7D,IAAA,CAAA,uBAAuB,GAAG,gCAAgC;QAEnE,IAAA,CAAA,cAAc,GAAG,KAAK;AACtB,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,OAAO,EAAgB;AAC/C,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,OAAO,EAAqB;AACjD,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,OAAO,EAAQ;QAE3C,IAAA,CAAA,aAAa,GAAmB,EAAE;AAhBvC,QAAA,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY;QAC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AA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cAF1B,MAAM,EAAA,CAAA,CAAA;;4FAEP,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAHvC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;MCnBY,0BAA0B,CAAA;IACrC,OAAO,OAAO,CACZ,MAAkC,EAAA;QAElC,OAAO;AACL,YAAA,QAAQ,EAAE,0BAA0B;YACpC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SACvE;IACH;+GARW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAA1B,0BAA0B,EAAA,CAAA,CAAA;gHAA1B,0BAA0B,EAAA,CAAA,CAAA;;4FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBALtC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA;;;ACPD;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { SwPush } from '@angular/service-worker';
|
|
3
|
+
import { NucleusAppService } from '@kolektor/nucleus-common';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
7
|
+
|
|
8
|
+
declare class Notification {
|
|
9
|
+
id: string;
|
|
10
|
+
sender: Identity;
|
|
11
|
+
data: NotificationData;
|
|
12
|
+
isRead: boolean;
|
|
13
|
+
dateCreated: Date;
|
|
14
|
+
expirationDate: Date;
|
|
15
|
+
}
|
|
16
|
+
declare class Identity {
|
|
17
|
+
subject: string;
|
|
18
|
+
name: string;
|
|
19
|
+
pictureUrl: string;
|
|
20
|
+
}
|
|
21
|
+
declare class Recipient {
|
|
22
|
+
attributeName: string;
|
|
23
|
+
directoryName: string;
|
|
24
|
+
attributeValue: string;
|
|
25
|
+
}
|
|
26
|
+
declare class NotificationData {
|
|
27
|
+
title: string;
|
|
28
|
+
message: string;
|
|
29
|
+
htmlMessage: string;
|
|
30
|
+
preventDismissal: boolean;
|
|
31
|
+
deepLink: string;
|
|
32
|
+
}
|
|
33
|
+
declare class WebKey {
|
|
34
|
+
publicKey: string;
|
|
35
|
+
}
|
|
36
|
+
declare class Registration {
|
|
37
|
+
id: string;
|
|
38
|
+
token: string;
|
|
39
|
+
platform: PlatformValue;
|
|
40
|
+
}
|
|
41
|
+
declare class RegistrationResult {
|
|
42
|
+
id: string;
|
|
43
|
+
}
|
|
44
|
+
declare class PayloadData {
|
|
45
|
+
notificationId: string;
|
|
46
|
+
eventType: NotificationEventType;
|
|
47
|
+
}
|
|
48
|
+
declare class NucleusNotificationsConfig {
|
|
49
|
+
serverApiUrl: string;
|
|
50
|
+
}
|
|
51
|
+
declare class NotificationClick {
|
|
52
|
+
id: string;
|
|
53
|
+
type: NotificationType;
|
|
54
|
+
routerLink?: string;
|
|
55
|
+
}
|
|
56
|
+
type NotificationEventType = 'new' | 'updated' | 'deleted' | 'deletedAll' | 'updatedAll' | 'newSilent';
|
|
57
|
+
type PlatformValue = 'ios' | 'android' | 'web' | 'none';
|
|
58
|
+
type NotificationType = 'default' | 'deeplink';
|
|
59
|
+
interface ChannelId {
|
|
60
|
+
senderId: string;
|
|
61
|
+
channelId: string;
|
|
62
|
+
}
|
|
63
|
+
declare class UserChannelConfig {
|
|
64
|
+
channelId: string;
|
|
65
|
+
displayName: string;
|
|
66
|
+
isSubscribed: boolean;
|
|
67
|
+
subscriptionType: ChannelSubscriptionType;
|
|
68
|
+
methods: NotifyMethod[];
|
|
69
|
+
allowedMethods: NotifyMethod[];
|
|
70
|
+
}
|
|
71
|
+
type ChannelSubscriptionType = 'invariant' | 'optIn' | 'optOut';
|
|
72
|
+
type NotifyMethod = 'push' | 'email' | 'sms';
|
|
73
|
+
|
|
74
|
+
declare class NucleusNotificationsService {
|
|
75
|
+
private http;
|
|
76
|
+
private swPush;
|
|
77
|
+
private appService;
|
|
78
|
+
constructor(http: HttpClient, swPush: SwPush, appService: NucleusAppService, config: NucleusNotificationsConfig);
|
|
79
|
+
private apiUrl;
|
|
80
|
+
private readonly registrationStorageKey;
|
|
81
|
+
private readonly notificationsStorageKey;
|
|
82
|
+
private _platform;
|
|
83
|
+
private _isInitialized;
|
|
84
|
+
private _newNotifications;
|
|
85
|
+
private _clicksSubject;
|
|
86
|
+
private _stateChangesSubject;
|
|
87
|
+
notifications: Notification[];
|
|
88
|
+
get unreadCount(): number;
|
|
89
|
+
get newNotifications(): Observable<Notification>;
|
|
90
|
+
get clicks(): Observable<NotificationClick>;
|
|
91
|
+
get stateChanges(): Observable<void>;
|
|
92
|
+
get isInitialized(): boolean;
|
|
93
|
+
initialize(): Promise<void>;
|
|
94
|
+
register(): Promise<any>;
|
|
95
|
+
unregister(): Promise<any>;
|
|
96
|
+
refresh(notifyAboutNew?: boolean): void;
|
|
97
|
+
getNotification(id: string): Observable<Notification>;
|
|
98
|
+
readNotification(id: string): void;
|
|
99
|
+
dismissNotification(id: string): void;
|
|
100
|
+
dismissAll(): void;
|
|
101
|
+
readAll(): void;
|
|
102
|
+
getChannelConfig(senderId: string, channelId: string, language?: string): Observable<UserChannelConfig>;
|
|
103
|
+
getChannelConfigsForSender(senderId: string, channelIds: string[], language?: string): Observable<UserChannelConfig[]>;
|
|
104
|
+
getChannelConfigs(ids: ChannelId[], language?: string): Observable<UserChannelConfig[]>;
|
|
105
|
+
setChannelConfig(senderId: string, config: UserChannelConfig): Observable<void>;
|
|
106
|
+
setChannelConfigs(configs: UserChannelConfig[]): Observable<void>;
|
|
107
|
+
private getChannelConfigsInternal;
|
|
108
|
+
private updateNotifications;
|
|
109
|
+
private saveToStorage;
|
|
110
|
+
private loadFromStorage;
|
|
111
|
+
private handleNotificationEvent;
|
|
112
|
+
private deleteNotificaton;
|
|
113
|
+
private notifyStateChanged;
|
|
114
|
+
private handleNotificationAction;
|
|
115
|
+
private removeDeliveredNotification;
|
|
116
|
+
private getNotificationPayloadData;
|
|
117
|
+
private registerCapacitorEvents;
|
|
118
|
+
private registerWebPushEvents;
|
|
119
|
+
private getRegistrationInfo;
|
|
120
|
+
private getWebPushSubscription;
|
|
121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NucleusNotificationsService, never>;
|
|
122
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NucleusNotificationsService>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
declare class NucleusNotificationsModule {
|
|
126
|
+
static forRoot(config: NucleusNotificationsConfig): ModuleWithProviders<NucleusNotificationsModule>;
|
|
127
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NucleusNotificationsModule, never>;
|
|
128
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NucleusNotificationsModule, never, never, never>;
|
|
129
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NucleusNotificationsModule>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { Identity, Notification, NotificationClick, NotificationData, NucleusNotificationsConfig, NucleusNotificationsModule, NucleusNotificationsService, PayloadData, Recipient, Registration, RegistrationResult, UserChannelConfig, WebKey };
|
|
133
|
+
export type { ChannelId, ChannelSubscriptionType, NotificationEventType, NotificationType, NotifyMethod, PlatformValue };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolektor/nucleus-notifications",
|
|
3
3
|
"peerDependencies": {
|
|
4
|
-
"@angular/common": "^
|
|
5
|
-
"@angular/core": "^
|
|
6
|
-
"@angular/service-worker": "^
|
|
4
|
+
"@angular/common": "^20.3.0",
|
|
5
|
+
"@angular/core": "^20.3.0",
|
|
6
|
+
"@angular/service-worker": "^20.3.0",
|
|
7
7
|
"@kolektor/nucleus-common": "0.1.x",
|
|
8
|
-
"@capacitor/push-notifications": "^
|
|
8
|
+
"@capacitor/push-notifications": "^7.0.0",
|
|
9
9
|
"rxjs": "~7.8.0"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|
|
@@ -17,13 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./index.d.ts",
|
|
20
|
-
"esm2022": "./esm2022/kolektor-nucleus-notifications.mjs",
|
|
21
|
-
"esm": "./esm2022/kolektor-nucleus-notifications.mjs",
|
|
22
20
|
"default": "./fesm2022/kolektor-nucleus-notifications.mjs"
|
|
23
21
|
}
|
|
24
22
|
},
|
|
25
23
|
"dependencies": {
|
|
26
24
|
"tslib": "^2.3.0"
|
|
27
25
|
},
|
|
28
|
-
"version": "0.1.
|
|
26
|
+
"version": "0.1.2191"
|
|
29
27
|
}
|