diff --git a/index.ts b/index.ts index 9112e11..d3904f9 100644 --- a/index.ts +++ b/index.ts @@ -45,6 +45,7 @@ declare module '@vue/runtime-core' { declare global { interface Window { OneSignalDeferred?: OneSignalDeferredLoadedCallback[]; + OneSignal?: IOneSignalOneSignal; safari?: { pushNotification: any; }; @@ -201,6 +202,9 @@ interface IOneSignalUser { removeSms(smsNumber: string): void; } interface IOneSignalPushSubscription { + id: string | null | undefined; + token: string | null | undefined; + optedIn: boolean | undefined; optIn(): Promise; optOut(): Promise; addEventListener(event: 'subscriptionChange', listener: (change: SubscriptionChangeEvent) => void): void; @@ -611,6 +615,9 @@ function debugSetLogLevel(logLevel: string): void { }); } const PushSubscriptionNamespace: IOneSignalPushSubscription = { + get id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id }, + get token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token }, + get optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn }, optIn: pushSubscriptionOptIn, optOut: pushSubscriptionOptOut, addEventListener: pushSubscriptionAddEventListener, diff --git a/package.json b/package.json index 1cb9ffd..e09789f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onesignal/onesignal-vue3", - "version": "2.0.0-beta.1", + "version": "2.0.0-beta.2", "description": "Vue 3 OneSignal Plugin: Make it easy to integrate OneSignal with your Vue App!", "author": "rgomezp", "contributors": [