onesignal-vue 2.7.3 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -186,6 +186,7 @@ interface IOneSignalOneSignal {
186
186
  Debug: IOneSignalDebug;
187
187
  login(externalId: string, jwtToken?: string): Promise<void>;
188
188
  logout(): Promise<void>;
189
+ updateUserJwt(externalId: string, token: string): Promise<void>;
189
190
  init(options: IInitObject): Promise<void>;
190
191
  setConsentGiven(consent: boolean): Promise<void>;
191
192
  setConsentRequired(requiresConsent: boolean): Promise<void>;
@@ -226,6 +227,13 @@ Use listeners to react to OneSignal-related events:
226
227
  | ---------- | ---------------------- |
227
228
  | 'change' | boolean |
228
229
 
230
+ ### User Namespace
231
+
232
+ | Event Name | Callback Argument Type |
233
+ | -------------------- | ----------------------- |
234
+ | 'change' | UserChangeEvent |
235
+ | 'userJwtInvalidated' | UserJwtInvalidatedEvent |
236
+
229
237
  **Example**
230
238
 
231
239
  ```js
package/dist/index.cjs CHANGED
@@ -1,6 +1,5 @@
1
- //#endregion
2
1
  require("vue");
3
- //#region index.ts
2
+ // index.ts
4
3
  const ONESIGNAL_SDK_ID = "onesignal-sdk";
5
4
  const DEFAULT_SCRIPT_SRC = "https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js";
6
5
  let isOneSignalInitialized = false;
@@ -91,6 +90,17 @@ function oneSignalLogout() {
91
90
  });
92
91
  });
93
92
  }
93
+ function oneSignalUpdateUserJwt(externalId, token) {
94
+ return new Promise((resolve, reject) => {
95
+ if (isOneSignalScriptFailed) {
96
+ reject(/* @__PURE__ */ new Error("OneSignal script failed to load."));
97
+ return;
98
+ }
99
+ window.OneSignalDeferred?.push((OneSignal) => {
100
+ OneSignal.updateUserJwt(externalId, token).then(() => resolve()).catch((error) => reject(error));
101
+ });
102
+ });
103
+ }
94
104
  function oneSignalSetConsentGiven(consent) {
95
105
  return new Promise((resolve, reject) => {
96
106
  if (isOneSignalScriptFailed) {
@@ -377,6 +387,7 @@ function debugSetLogLevel(logLevel) {
377
387
  const OneSignalNamespace = {
378
388
  login: oneSignalLogin,
379
389
  logout: oneSignalLogout,
390
+ updateUserJwt: oneSignalUpdateUserJwt,
380
391
  init,
381
392
  setConsentGiven: oneSignalSetConsentGiven,
382
393
  setConsentRequired: oneSignalSetConsentRequired,
@@ -453,7 +464,6 @@ const OneSignalNamespace = {
453
464
  const OneSignalVuePlugin = { install(app) {
454
465
  app.prototype.$OneSignal = OneSignalNamespace;
455
466
  } };
456
- //#endregion
457
467
  module.exports = OneSignalVuePlugin;
458
468
 
459
469
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../index.ts"],"sourcesContent":["import Vue from 'vue';\n\nconst ONESIGNAL_SDK_ID = 'onesignal-sdk';\nconst DEFAULT_SCRIPT_SRC =\n 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js';\n\nlet isOneSignalInitialized = false;\nlet isOneSignalScriptFailed = false;\nlet pendingInitReject: ((reason?: unknown) => void) | undefined;\n\nconst VueApp: any = Vue;\n\nif (typeof window !== 'undefined') {\n window.OneSignalDeferred = window.OneSignalDeferred || [];\n}\n\n/* H E L P E R S */\n\nfunction handleOnError() {\n isOneSignalScriptFailed = true;\n pendingInitReject?.(new Error('OneSignal script failed to load.'));\n pendingInitReject = undefined;\n}\n\nfunction addSDKScript(scriptSrc?: string) {\n if (document.getElementById(ONESIGNAL_SDK_ID)) {\n return;\n }\n\n const script = document.createElement('script');\n script.id = ONESIGNAL_SDK_ID;\n script.defer = true;\n script.src = scriptSrc || DEFAULT_SCRIPT_SRC;\n\n // Always resolve whether or not the script is successfully initialized.\n // This is important for users who may block cdn.onesignal.com w/ adblock.\n script.onerror = () => {\n handleOnError();\n };\n\n document.head.appendChild(script);\n}\n\n/* T Y P E D E C L A R A T I O N S */\n\ndeclare module 'vue/types/vue' {\n interface Vue {\n $OneSignal: IOneSignalOneSignal;\n }\n}\n\ndeclare global {\n interface Window {\n OneSignalDeferred?: OneSignalDeferredLoadedCallback[];\n OneSignal?: IOneSignalOneSignal;\n safari?: {\n pushNotification: any;\n };\n }\n}\n\n/* O N E S I G N A L A P I */\n\n/**\n * @PublicApi\n */\nconst init = (options: IInitObject): Promise<void> => {\n if (isOneSignalInitialized) {\n return Promise.reject(`OneSignal is already initialized.`);\n }\n if (!options || !options.appId) {\n return Promise.reject('You need to provide your OneSignal appId.');\n }\n if (!document) {\n return Promise.reject(`Document is not defined.`);\n }\n\n // Required: the CDN script silently exits on unsupported browsers without\n // draining OneSignalDeferred, so init() would hang forever otherwise.\n if (!isPushNotificationsSupported()) {\n return Promise.reject(\n new Error('This browser does not support Web Push notifications.'),\n );\n }\n\n // Handle both disabled and disable keys for welcome notification\n if (options.welcomeNotification?.disabled !== undefined) {\n options.welcomeNotification.disable = options.welcomeNotification.disabled;\n }\n\n addSDKScript(options.scriptSrc);\n\n return new Promise<void>((resolve, reject) => {\n pendingInitReject = reject;\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.init(options)\n .then(() => {\n isOneSignalInitialized = true;\n pendingInitReject = undefined;\n resolve();\n })\n .catch((err) => {\n pendingInitReject = undefined;\n reject(err);\n });\n });\n });\n};\n\n/**\n * The following code is copied directly from the native SDK source file BrowserSupportsPush.ts\n * S T A R T\n */\n\n// Checks if the browser supports push notifications by checking if specific\n// classes and properties on them exist\nfunction isPushNotificationsSupported() {\n return supportsVapidPush() || supportsSafariPush();\n}\n\nfunction isMacOSSafariInIframe(): boolean {\n // Fallback detection for Safari on macOS in an iframe context\n return (\n window.top !== window && // isContextIframe\n navigator.vendor === 'Apple Computer, Inc.' && // isSafari\n navigator.platform === 'MacIntel'\n ); // isMacOS\n}\n\nfunction supportsSafariPush(): boolean {\n return (\n (window.safari && typeof window.safari.pushNotification !== 'undefined') ||\n isMacOSSafariInIframe()\n );\n}\n\n// Does the browser support the standard Push API\nfunction supportsVapidPush(): boolean {\n return (\n typeof PushSubscriptionOptions !== 'undefined' &&\n PushSubscriptionOptions.prototype.hasOwnProperty('applicationServerKey')\n );\n}\n/* E N D */\n\n/**\n * @PublicApi\n */\nconst isPushSupported = (): boolean => {\n return isPushNotificationsSupported();\n};\n\nexport interface AutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; slidedownPromptOptions?: IOneSignalAutoPromptOptions; }\nexport interface IOneSignalAutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; isInUpdateMode?: boolean; categoryOptions?: IOneSignalCategories; }\nexport interface IOneSignalCategories { positiveUpdateButton: string; negativeUpdateButton: string; savingButtonText: string; errorButtonText: string; updateMessage: string; tags: IOneSignalTagCategory[]; }\nexport interface IOneSignalTagCategory { tag: string; label: string; checked?: boolean; }\nexport type PushSubscriptionNamespaceProperties = { id: string | null | undefined; token: string | null | undefined; optedIn: boolean; };\nexport type SubscriptionChangeEvent = { previous: PushSubscriptionNamespaceProperties; current: PushSubscriptionNamespaceProperties; };\nexport type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';\nexport type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';\nexport type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;\nexport interface IOSNotification {\n /**\n * The OneSignal notification id;\n * - Primary id on OneSignal's REST API and dashboard\n */\n readonly notificationId: string;\n\n /**\n * Visible title text on the notification\n */\n readonly title?: string;\n\n /**\n * Visible body text on the notification\n */\n readonly body: string;\n\n /**\n * Visible icon the notification; URL format\n */\n readonly icon?: string;\n\n /**\n * Visible small badgeIcon that displays on some devices; URL format\n * Example: On Android's status bar\n */\n readonly badgeIcon?: string;\n\n /**\n * Visible image on the notification; URL format\n */\n readonly image?: string;\n\n /**\n * Visible buttons on the notification\n */\n readonly actionButtons?: IOSNotificationActionButton[];\n\n /**\n * If this value is the same as existing notification, it will replace it\n * Can be set when creating the notification with \"Web Push Topic\" on the dashboard\n * or web_push_topic from the REST API.\n */\n readonly topic?: string;\n\n /**\n * Custom object that was sent with the notification;\n * definable when creating the notification from the OneSignal REST API or dashboard\n */\n readonly additionalData?: object;\n\n /**\n * URL to open when clicking or tapping on the notification\n */\n readonly launchURL?: string;\n\n /**\n * Confirm the push was received by reporting back to OneSignal\n */\n readonly confirmDelivery: boolean;\n}\n\nexport interface IOSNotificationActionButton {\n /**\n * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker\n * and host page through events to identify which button was clicked.\n * e.g. 'like-button'\n */\n readonly actionId: string;\n /**\n * The notification action button's text.\n */\n readonly text: string;\n /**\n * A valid publicly reachable HTTPS URL to an image.\n */\n readonly icon?: string;\n /**\n * The URL to open the web browser to when this action button is clicked.\n */\n readonly launchURL?: string;\n}\n\nexport interface IDisplayableOSNotification extends IOSNotification {\n display(): void;\n}\n\nexport interface NotificationClickResult {\n readonly actionId?: string;\n readonly url?: string;\n}\n\nexport type NotificationEventTypeMap = {\n 'click': NotificationClickEvent;\n 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;\n 'dismiss': NotificationDismissEvent;\n 'permissionChange': boolean;\n 'permissionPromptDisplay': void;\n};\n\nexport interface NotificationForegroundWillDisplayEvent {\n readonly notification: IDisplayableOSNotification;\n preventDefault(): void;\n}\n\nexport interface NotificationDismissEvent {\n notification: IOSNotification;\n}\n\nexport interface NotificationClickEvent {\n readonly notification: IOSNotification;\n readonly result: NotificationClickResult;\n}\n\nexport type UserChangeEvent = {\n current: UserNamespaceProperties;\n};\nexport type UserNamespaceProperties = {\n onesignalId: string | undefined;\n externalId: string | undefined;\n};\n\nexport interface IInitObject {\n appId: string;\n requiresUserPrivacyConsent?: boolean;\n safari_web_id?: string;\n subdomainName?: string;\n promptOptions?: {\n slidedown: {\n prompts: {\n /**\n * Whether to automatically display the prompt.\n * `true` will display the prompt based on the delay options.\n * `false` will prevent the prompt from displaying until the Slidedowns methods are used.\n */\n autoPrompt: boolean;\n\n /**\n * Only available for type: category. Up to 10 categories.\n * @example\n * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see \"Local News\" in the prompt.\n */\n categories?: {\n /** Should identify the action. */\n tag: string;\n\n /** What the user will see. */\n label: string;\n }[];\n\n /**\n * The delay options for the prompt.\n * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.\n */\n delay: {\n /** The number of pages a user needs to visit before the prompt is displayed. */\n pageViews?: number;\n\n /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */\n timeDelay?: number;\n };\n\n /**\n * The text to display in the prompt.\n */\n text?: {\n /** The callout asking the user to opt-in. Up to 90 characters. */\n actionMessage?: string;\n\n /** Triggers the opt-in. Up to 15 characters. */\n acceptButton?: string;\n\n /** Cancels opt-in. Up to 15 characters. */\n cancelButton?: string;\n\n /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */\n confirmMessage?: string;\n\n /** Identifies the email text field. Up to 15 characters. */\n emailLabel?: string;\n\n /** Cancels the category update. Up to 15 characters. */\n negativeUpdateButton?: string;\n\n /** Saves the updated category tags. Up to 15 characters. */\n positiveUpdateButton?: string;\n\n /** Identifies the phone number text field. Up to 15 characters. */\n smsLabel?: string;\n\n /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */\n updateMessage?: string;\n };\n\n /**\n * The type of prompt to display.\n * `push` which is the Slide Prompt without categories.\n * `category` which is the Slide Prompt with categories.\n * `sms` only asks for phone number.\n * `email` only asks for email address.\n * `smsAndEmail` asks for both phone number and email address.\n */\n type: 'push' | 'category' | 'sms' | 'email' | 'smsAndEmail';\n }[];\n };\n };\n welcomeNotification?: {\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n * @deprecated Use 'disable' instead. This will be removed in a future version.\n */\n disabled?: boolean;\n\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n */\n disable?: boolean;\n\n /**\n * The welcome notification's message. You can localize this to your own language.\n * If left blank or set to blank, the default of 'Thanks for subscribing!' will be used.\n */\n message: string;\n\n /**\n * The welcome notification's title. You can localize this to your own language. If not set, or left blank, the site's title will be used.\n * Set to one space ' ' to clear the title, although this is not recommended.\n */\n title?: string;\n\n /**\n * By default, clicking the welcome notification does not open any link.\n * This is recommended because the user has just visited your site and subscribed.\n */\n url?: string;\n };\n\n /**\n * Will enable customization of the notify/subscription bell button.\n */\n notifyButton?: {\n /**\n * A function you define that returns true to show the Subscription Bell, or false to hide it.\n * Typically used the hide the Subscription Bell after the user is subscribed.\n * This function is not re-evaluated on every state change; this function is only evaluated once when the Subscription Bell begins to show.\n */\n displayPredicate?: () => boolean | Promise<boolean>;\n\n /**\n * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.\n */\n enable?: boolean;\n\n /** Specify CSS-valid pixel offsets using bottom, left, and right. */\n offset?: { bottom: string; left: string; right: string };\n\n /**\n * If `true`, the Subscription Bell will display an icon that there is 1 unread message.\n * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.\n */\n prenotify: boolean;\n\n /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */\n position?: 'bottom-left' | 'bottom-right';\n\n /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */\n showCredit: boolean;\n\n /**\n * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.\n */\n size?: 'small' | 'medium' | 'large';\n\n /** Customize the Subscription Bell text. */\n text: {\n 'dialog.blocked.message': string;\n 'dialog.blocked.title': string;\n 'dialog.main.button.subscribe': string;\n 'dialog.main.button.unsubscribe': string;\n 'dialog.main.title': string;\n 'message.action.resubscribed': string;\n 'message.action.subscribed': string;\n 'message.action.subscribing': string;\n 'message.action.unsubscribed': string;\n 'message.prenotify': string;\n 'tip.state.blocked': string;\n 'tip.state.subscribed': string;\n 'tip.state.unsubscribed': string;\n };\n };\n\n persistNotification?: boolean;\n webhooks?: {\n /**\n * Enable this setting only if your server has CORS enabled and supports non-simple CORS requests.\n * If this setting is disabled, your webhook will not need CORS to receive data, but it will not receive the custom headers.\n * The simplest option is to leave it disabled.\n * @default false\n */\n cors: boolean;\n\n /**\n * This event occurs after a notification is clicked.\n * @example https://site.com/hook\n */\n 'notification.clicked'?: string;\n\n /**\n * This event occurs after a notification is intentionally dismissed by the user (clicking the notification body or one of the notification action buttons does not trigger the dismissed webhook),\n * after a group of notifications are all dismissed (with this notification as part of that group), or after a notification expires on its own time and disappears. This event is supported on Chrome only.\n * @example https://site.com/hook\n */\n 'notification.dismissed'?: string;\n\n /**\n * This event occurs after a notification is displayed.\n * @example https://site.com/hook\n */\n 'notification.willDisplay'?: string;\n };\n autoResubscribe?: boolean;\n autoRegister?: boolean;\n notificationClickHandlerMatch?: 'exact' | 'origin';\n notificationClickHandlerAction?: 'navigate' | 'focus';\n path?: string;\n serviceWorkerParam?: { scope: string };\n serviceWorkerPath?: string;\n serviceWorkerOverrideForTypical?: boolean;\n /**\n * Overrides the default OneSignal SDK script URL.\n * Use this to self-host the SDK script on your own domain, e.g. to comply\n * with strict Cross-Origin-Embedder-Policy (COEP) or Content-Security-Policy (CSP) headers.\n * @default 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js'\n */\n scriptSrc?: string;\n [key: string]: unknown;\n}\n\nexport interface IOneSignalOneSignal {\n\tSlidedown: IOneSignalSlidedown;\n\tNotifications: IOneSignalNotifications;\n\tSession: IOneSignalSession;\n\tUser: IOneSignalUser;\n\tDebug: IOneSignalDebug;\n\tlogin(externalId: string, jwtToken?: string): Promise<void>;\n\tlogout(): Promise<void>;\n\tinit(options: IInitObject): Promise<void>;\n\tsetConsentGiven(consent: boolean): Promise<void>;\n\tsetConsentRequired(requiresConsent: boolean): Promise<void>;\n}\nexport interface IOneSignalNotifications {\n\tpermissionNative: NotificationPermission;\n\tpermission: boolean;\n\tsetDefaultUrl(url: string): Promise<void>;\n\tsetDefaultTitle(title: string): Promise<void>;\n\tisPushSupported(): boolean;\n\trequestPermission(): Promise<boolean>;\n\taddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n\tremoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n}\nexport interface IOneSignalSlidedown {\n\tpromptPush(options?: AutoPromptOptions): Promise<void>;\n\tpromptPushCategories(options?: AutoPromptOptions): Promise<void>;\n\tpromptSms(options?: AutoPromptOptions): Promise<void>;\n\tpromptEmail(options?: AutoPromptOptions): Promise<void>;\n\tpromptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;\n\taddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n\tremoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n}\nexport interface IOneSignalDebug {\n\tsetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;\n}\nexport interface IOneSignalSession {\n\tsendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;\n\tsendUniqueOutcome(outcomeName: string): Promise<void>;\n}\nexport interface IOneSignalUser {\n\tonesignalId: string | undefined;\n\texternalId: string | undefined;\n\tPushSubscription: IOneSignalPushSubscription;\n\taddAlias(label: string, id: string): void;\n\taddAliases(aliases: { [key: string]: string }): void;\n\tremoveAlias(label: string): void;\n\tremoveAliases(labels: string[]): void;\n\taddEmail(email: string): void;\n\tremoveEmail(email: string): void;\n\taddSms(smsNumber: string): void;\n\tremoveSms(smsNumber: string): void;\n\taddTag(key: string, value: string): void;\n\taddTags(tags: { [key: string]: string }): void;\n\tremoveTag(key: string): void;\n\tremoveTags(keys: string[]): void;\n\tgetTags(): { [key: string]: string };\n\taddEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;\n\tremoveEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;\n\tsetLanguage(language: string): void;\n\tgetLanguage(): string;\n\ttrackEvent(name: string, properties?: Record<string, unknown>): void;\n}\nexport interface IOneSignalPushSubscription {\n\tid: string | null | undefined;\n\ttoken: string | null | undefined;\n\toptedIn: boolean | undefined;\n\toptIn(): Promise<void>;\n\toptOut(): Promise<void>;\n\taddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n\tremoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n}\nfunction oneSignalLogin(externalId: string, jwtToken?: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.login(externalId, jwtToken)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalLogout(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.logout()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentGiven(consent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentGiven(consent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentRequired(requiresConsent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentRequired(requiresConsent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPush(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPush(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPushCategories(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPushCategories(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSms(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSms(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSmsAndEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSmsAndEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownAddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.addEventListener(event, listener);\n });\n \n}\nfunction slidedownRemoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.removeEventListener(event, listener);\n });\n \n}\nfunction notificationsSetDefaultUrl(url: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultUrl(url)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsSetDefaultTitle(title: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultTitle(title)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsRequestPermission(): Promise<boolean> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.requestPermission()\n .then(result => resolve(result))\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsAddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.addEventListener(event, listener);\n });\n \n}\nfunction notificationsRemoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.removeEventListener(event, listener);\n });\n \n}\nfunction sessionSendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendOutcome(outcomeName, outcomeWeight)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction sessionSendUniqueOutcome(outcomeName: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendUniqueOutcome(outcomeName)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction userAddAlias(label: string, id: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAlias(label, id);\n });\n \n}\nfunction userAddAliases(aliases: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAliases(aliases);\n });\n \n}\nfunction userRemoveAlias(label: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAlias(label);\n });\n \n}\nfunction userRemoveAliases(labels: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAliases(labels);\n });\n \n}\nfunction userAddEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEmail(email);\n });\n \n}\nfunction userRemoveEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEmail(email);\n });\n \n}\nfunction userAddSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addSms(smsNumber);\n });\n \n}\nfunction userRemoveSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeSms(smsNumber);\n });\n \n}\nfunction userAddTag(key: string, value: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTag(key, value);\n });\n \n}\nfunction userAddTags(tags: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTags(tags);\n });\n \n}\nfunction userRemoveTag(key: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTag(key);\n });\n \n}\nfunction userRemoveTags(keys: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTags(keys);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetTags(): { [key: string]: string } {\n let retVal: { [key: string]: string };\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getTags();\n });\n return retVal;\n}\nfunction userAddEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEventListener(event, listener);\n });\n \n}\nfunction userRemoveEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEventListener(event, listener);\n });\n \n}\nfunction userSetLanguage(language: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.setLanguage(language);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetLanguage(): string {\n let retVal: string;\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getLanguage();\n });\n return retVal;\n}\nfunction userTrackEvent(name: string, properties?: Record<string, unknown>): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.trackEvent(name, properties);\n });\n \n}\nfunction pushSubscriptionOptIn(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optIn()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionOptOut(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optOut()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionAddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.addEventListener(event, listener);\n });\n \n}\nfunction pushSubscriptionRemoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.removeEventListener(event, listener);\n });\n \n}\nfunction debugSetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Debug.setLogLevel(logLevel);\n });\n \n}\nconst PushSubscriptionNamespace: IOneSignalPushSubscription = {\n\tget id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id; },\n\tget token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token; },\n\tget optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn; },\n\toptIn: pushSubscriptionOptIn,\n\toptOut: pushSubscriptionOptOut,\n\taddEventListener: pushSubscriptionAddEventListener,\n\tremoveEventListener: pushSubscriptionRemoveEventListener,\n};\n\nconst UserNamespace: IOneSignalUser = {\n\tget onesignalId(): string | undefined { return window.OneSignal?.User?.onesignalId; },\n\tget externalId(): string | undefined { return window.OneSignal?.User?.externalId; },\n\taddAlias: userAddAlias,\n\taddAliases: userAddAliases,\n\tremoveAlias: userRemoveAlias,\n\tremoveAliases: userRemoveAliases,\n\taddEmail: userAddEmail,\n\tremoveEmail: userRemoveEmail,\n\taddSms: userAddSms,\n\tremoveSms: userRemoveSms,\n\taddTag: userAddTag,\n\taddTags: userAddTags,\n\tremoveTag: userRemoveTag,\n\tremoveTags: userRemoveTags,\n\tgetTags: userGetTags,\n\taddEventListener: userAddEventListener,\n\tremoveEventListener: userRemoveEventListener,\n\tsetLanguage: userSetLanguage,\n\tgetLanguage: userGetLanguage,\n\ttrackEvent: userTrackEvent,\n\tPushSubscription: PushSubscriptionNamespace,\n};\n\nconst SessionNamespace: IOneSignalSession = {\n\tsendOutcome: sessionSendOutcome,\n\tsendUniqueOutcome: sessionSendUniqueOutcome,\n};\n\nconst DebugNamespace: IOneSignalDebug = {\n\tsetLogLevel: debugSetLogLevel,\n};\n\nconst SlidedownNamespace: IOneSignalSlidedown = {\n\tpromptPush: slidedownPromptPush,\n\tpromptPushCategories: slidedownPromptPushCategories,\n\tpromptSms: slidedownPromptSms,\n\tpromptEmail: slidedownPromptEmail,\n\tpromptSmsAndEmail: slidedownPromptSmsAndEmail,\n\taddEventListener: slidedownAddEventListener,\n\tremoveEventListener: slidedownRemoveEventListener,\n};\n\nconst NotificationsNamespace: IOneSignalNotifications = {\n\tget permissionNative(): NotificationPermission { return window.OneSignal?.Notifications?.permissionNative ?? 'default'; },\n\tget permission(): boolean { return window.OneSignal?.Notifications?.permission ?? false; },\n\tsetDefaultUrl: notificationsSetDefaultUrl,\n\tsetDefaultTitle: notificationsSetDefaultTitle,\n\tisPushSupported,\n\trequestPermission: notificationsRequestPermission,\n\taddEventListener: notificationsAddEventListener,\n\tremoveEventListener: notificationsRemoveEventListener,\n};\n\nconst OneSignalNamespace: IOneSignalOneSignal = {\n\tlogin: oneSignalLogin,\n\tlogout: oneSignalLogout,\n\tinit,\n\tsetConsentGiven: oneSignalSetConsentGiven,\n\tsetConsentRequired: oneSignalSetConsentRequired,\n\tSlidedown: SlidedownNamespace,\n\tNotifications: NotificationsNamespace,\n\tSession: SessionNamespace,\n\tUser: UserNamespace,\n\tDebug: DebugNamespace,\n};\n\nconst OneSignalVuePlugin = {\n install(app: typeof VueApp) {\n app.prototype.$OneSignal = OneSignalNamespace as IOneSignalOneSignal;\n }\n}\n\nexport default OneSignalVuePlugin;\n"],"mappings":";;;AAEA,MAAM,mBAAmB;AACzB,MAAM,qBACJ;AAEF,IAAI,yBAAyB;AAC7B,IAAI,0BAA0B;AAC9B,IAAI;AAIJ,IAAI,OAAO,WAAW,aACpB,OAAO,oBAAoB,OAAO,qBAAqB,EAAE;AAK3D,SAAS,gBAAgB;CACvB,0BAA0B;CAC1B,oCAAoB,IAAI,MAAM,mCAAmC,CAA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W,eAAe,cAAc;;EAClF,eAAe;EACf,iBAAiB;EACjB;EACA,mBAAmB;EACnB,kBAAkB;EAClB,qBAAqB;EAUgB;CACrC,SAAS;EArCT,aAAa;EACb,mBAAmB;EAoCM;CACzB,MAAM;EA9DN,IAAI,cAAkC;GAAE,OAAO,OAAO,WAAW,MAAM;;EACvE,IAAI,aAAiC;GAAE,OAAO,OAAO,WAAW,MAAM;;EACtE,UAAU;EACV,YAAY;EACZ,aAAa;EACb,eAAe;EACf,UAAU;EACV,aAAa;EACb,QAAQ;EACR,WAAW;EACX,QAAQ;EACR,SAAS;EACT,WAAW;EACX,YAAY;EACZ,SAAS;EACT,kBAAkB;EAClB,qBAAqB;EACrB,aAAa;EACb,aAAa;EACb,YAAY;EACZ,kBAAkB;GA9BlB,IAAI,KAAgC;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;;GACvF,IAAI,QAAmC;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;;GAC1F,IAAI,UAA+B;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;;GACtF,OAAO;GACP,QAAQ;GACR,kBAAkB;GAClB,qBAAqB;GAwBsB;EA0CxB;CACnB,OAAO,EAlCP,aAAa,kBAkCQ;CACrB;AAED,MAAM,qBAAqB,EACzB,QAAQ,KAAoB;CAC1B,IAAI,UAAU,aAAa;GAE9B"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../index.ts"],"sourcesContent":["import Vue from 'vue';\n\nconst ONESIGNAL_SDK_ID = 'onesignal-sdk';\nconst DEFAULT_SCRIPT_SRC =\n 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js';\n\nlet isOneSignalInitialized = false;\nlet isOneSignalScriptFailed = false;\nlet pendingInitReject: ((reason?: unknown) => void) | undefined;\n\nconst VueApp: any = Vue;\n\nif (typeof window !== 'undefined') {\n window.OneSignalDeferred = window.OneSignalDeferred || [];\n}\n\n/* H E L P E R S */\n\nfunction handleOnError() {\n isOneSignalScriptFailed = true;\n pendingInitReject?.(new Error('OneSignal script failed to load.'));\n pendingInitReject = undefined;\n}\n\nfunction addSDKScript(scriptSrc?: string) {\n if (document.getElementById(ONESIGNAL_SDK_ID)) {\n return;\n }\n\n const script = document.createElement('script');\n script.id = ONESIGNAL_SDK_ID;\n script.defer = true;\n script.src = scriptSrc || DEFAULT_SCRIPT_SRC;\n\n // Always resolve whether or not the script is successfully initialized.\n // This is important for users who may block cdn.onesignal.com w/ adblock.\n script.onerror = () => {\n handleOnError();\n };\n\n document.head.appendChild(script);\n}\n\n/* T Y P E D E C L A R A T I O N S */\n\ndeclare module 'vue/types/vue' {\n interface Vue {\n $OneSignal: IOneSignalOneSignal;\n }\n}\n\ndeclare global {\n interface Window {\n OneSignalDeferred?: OneSignalDeferredLoadedCallback[];\n OneSignal?: IOneSignalOneSignal;\n safari?: {\n pushNotification: any;\n };\n }\n}\n\n/* O N E S I G N A L A P I */\n\n/**\n * @PublicApi\n */\nconst init = (options: IInitObject): Promise<void> => {\n if (isOneSignalInitialized) {\n return Promise.reject(`OneSignal is already initialized.`);\n }\n if (!options || !options.appId) {\n return Promise.reject('You need to provide your OneSignal appId.');\n }\n if (!document) {\n return Promise.reject(`Document is not defined.`);\n }\n\n // Required: the CDN script silently exits on unsupported browsers without\n // draining OneSignalDeferred, so init() would hang forever otherwise.\n if (!isPushNotificationsSupported()) {\n return Promise.reject(\n new Error('This browser does not support Web Push notifications.'),\n );\n }\n\n // Handle both disabled and disable keys for welcome notification\n if (options.welcomeNotification?.disabled !== undefined) {\n options.welcomeNotification.disable = options.welcomeNotification.disabled;\n }\n\n addSDKScript(options.scriptSrc);\n\n return new Promise<void>((resolve, reject) => {\n pendingInitReject = reject;\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.init(options)\n .then(() => {\n isOneSignalInitialized = true;\n pendingInitReject = undefined;\n resolve();\n })\n .catch((err) => {\n pendingInitReject = undefined;\n reject(err);\n });\n });\n });\n};\n\n/**\n * The following code is copied directly from the native SDK source file BrowserSupportsPush.ts\n * S T A R T\n */\n\n// Checks if the browser supports push notifications by checking if specific\n// classes and properties on them exist\nfunction isPushNotificationsSupported() {\n return supportsVapidPush() || supportsSafariPush();\n}\n\nfunction isMacOSSafariInIframe(): boolean {\n // Fallback detection for Safari on macOS in an iframe context\n return (\n window.top !== window && // isContextIframe\n navigator.vendor === 'Apple Computer, Inc.' && // isSafari\n navigator.platform === 'MacIntel'\n ); // isMacOS\n}\n\nfunction supportsSafariPush(): boolean {\n return (\n (window.safari && typeof window.safari.pushNotification !== 'undefined') ||\n isMacOSSafariInIframe()\n );\n}\n\n// Does the browser support the standard Push API\nfunction supportsVapidPush(): boolean {\n return (\n typeof PushSubscriptionOptions !== 'undefined' &&\n PushSubscriptionOptions.prototype.hasOwnProperty('applicationServerKey')\n );\n}\n/* E N D */\n\n/**\n * @PublicApi\n */\nconst isPushSupported = (): boolean => {\n return isPushNotificationsSupported();\n};\n\nexport interface AutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; slidedownPromptOptions?: IOneSignalAutoPromptOptions; }\nexport interface IOneSignalAutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; isInUpdateMode?: boolean; categoryOptions?: IOneSignalCategories; }\nexport interface IOneSignalCategories { positiveUpdateButton: string; negativeUpdateButton: string; savingButtonText: string; errorButtonText: string; updateMessage: string; tags: IOneSignalTagCategory[]; }\nexport interface IOneSignalTagCategory { tag: string; label: string; checked?: boolean; }\nexport type PushSubscriptionNamespaceProperties = { id: string | null | undefined; token: string | null | undefined; optedIn: boolean; };\nexport type SubscriptionChangeEvent = { previous: PushSubscriptionNamespaceProperties; current: PushSubscriptionNamespaceProperties; };\nexport type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';\nexport type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';\nexport type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;\nexport interface IOSNotification {\n /**\n * The OneSignal notification id;\n * - Primary id on OneSignal's REST API and dashboard\n */\n readonly notificationId: string;\n\n /**\n * Visible title text on the notification\n */\n readonly title?: string;\n\n /**\n * Visible body text on the notification\n */\n readonly body: string;\n\n /**\n * Visible icon the notification; URL format\n */\n readonly icon?: string;\n\n /**\n * Visible small badgeIcon that displays on some devices; URL format\n * Example: On Android's status bar\n */\n readonly badgeIcon?: string;\n\n /**\n * Visible image on the notification; URL format\n */\n readonly image?: string;\n\n /**\n * Visible buttons on the notification\n */\n readonly actionButtons?: IOSNotificationActionButton[];\n\n /**\n * If this value is the same as existing notification, it will replace it\n * Can be set when creating the notification with \"Web Push Topic\" on the dashboard\n * or web_push_topic from the REST API.\n */\n readonly topic?: string;\n\n /**\n * Custom object that was sent with the notification;\n * definable when creating the notification from the OneSignal REST API or dashboard\n */\n readonly additionalData?: object;\n\n /**\n * URL to open when clicking or tapping on the notification\n */\n readonly launchURL?: string;\n\n /**\n * Confirm the push was received by reporting back to OneSignal\n */\n readonly confirmDelivery: boolean;\n}\n\nexport interface IOSNotificationActionButton {\n /**\n * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker\n * and host page through events to identify which button was clicked.\n * e.g. 'like-button'\n */\n readonly actionId: string;\n /**\n * The notification action button's text.\n */\n readonly text: string;\n /**\n * A valid publicly reachable HTTPS URL to an image.\n */\n readonly icon?: string;\n /**\n * The URL to open the web browser to when this action button is clicked.\n */\n readonly launchURL?: string;\n}\n\nexport interface IDisplayableOSNotification extends IOSNotification {\n display(): void;\n}\n\nexport interface NotificationClickResult {\n readonly actionId?: string;\n readonly url?: string;\n}\n\nexport type NotificationEventTypeMap = {\n 'click': NotificationClickEvent;\n 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;\n 'dismiss': NotificationDismissEvent;\n 'permissionChange': boolean;\n 'permissionPromptDisplay': void;\n};\n\nexport interface NotificationForegroundWillDisplayEvent {\n readonly notification: IDisplayableOSNotification;\n preventDefault(): void;\n}\n\nexport interface NotificationDismissEvent {\n notification: IOSNotification;\n}\n\nexport interface NotificationClickEvent {\n readonly notification: IOSNotification;\n readonly result: NotificationClickResult;\n}\n\nexport type UserChangeEvent = {\n current: UserNamespaceProperties;\n};\nexport type UserJwtInvalidatedEvent = {\n externalId: string;\n};\nexport type UserEventName = 'change' | 'userJwtInvalidated';\nexport type UserEventTypeMap = {\n change: UserChangeEvent;\n userJwtInvalidated: UserJwtInvalidatedEvent;\n};\nexport type UserNamespaceProperties = {\n onesignalId: string | undefined;\n externalId: string | undefined;\n};\n\nexport interface IInitObject {\n appId: string;\n requiresUserPrivacyConsent?: boolean;\n safari_web_id?: string;\n subdomainName?: string;\n promptOptions?: {\n slidedown: {\n prompts: {\n /**\n * Whether to automatically display the prompt.\n * `true` will display the prompt based on the delay options.\n * `false` will prevent the prompt from displaying until the Slidedowns methods are used.\n */\n autoPrompt: boolean;\n\n /**\n * Only available for type: category. Up to 10 categories.\n * @example\n * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see \"Local News\" in the prompt.\n */\n categories?: {\n /** Should identify the action. */\n tag: string;\n\n /** What the user will see. */\n label: string;\n }[];\n\n /**\n * The delay options for the prompt.\n * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.\n */\n delay: {\n /** The number of pages a user needs to visit before the prompt is displayed. */\n pageViews?: number;\n\n /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */\n timeDelay?: number;\n };\n\n /**\n * The text to display in the prompt.\n */\n text?: {\n /** The callout asking the user to opt-in. Up to 90 characters. */\n actionMessage?: string;\n\n /** Triggers the opt-in. Up to 15 characters. */\n acceptButton?: string;\n\n /** Cancels opt-in. Up to 15 characters. */\n cancelButton?: string;\n\n /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */\n confirmMessage?: string;\n\n /** Identifies the email text field. Up to 15 characters. */\n emailLabel?: string;\n\n /** Cancels the category update. Up to 15 characters. */\n negativeUpdateButton?: string;\n\n /** Saves the updated category tags. Up to 15 characters. */\n positiveUpdateButton?: string;\n\n /** Identifies the phone number text field. Up to 15 characters. */\n smsLabel?: string;\n\n /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */\n updateMessage?: string;\n };\n\n /**\n * The type of prompt to display.\n * `push` which is the Slide Prompt without categories.\n * `category` which is the Slide Prompt with categories.\n * `sms` only asks for phone number.\n * `email` only asks for email address.\n * `smsAndEmail` asks for both phone number and email address.\n */\n type: 'push' | 'category' | 'sms' | 'email' | 'smsAndEmail';\n }[];\n };\n };\n welcomeNotification?: {\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n * @deprecated Use 'disable' instead. This will be removed in a future version.\n */\n disabled?: boolean;\n\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n */\n disable?: boolean;\n\n /**\n * The welcome notification's message. You can localize this to your own language.\n * If left blank or set to blank, the default of 'Thanks for subscribing!' will be used.\n */\n message: string;\n\n /**\n * The welcome notification's title. You can localize this to your own language. If not set, or left blank, the site's title will be used.\n * Set to one space ' ' to clear the title, although this is not recommended.\n */\n title?: string;\n\n /**\n * By default, clicking the welcome notification does not open any link.\n * This is recommended because the user has just visited your site and subscribed.\n */\n url?: string;\n };\n\n /**\n * Will enable customization of the notify/subscription bell button.\n */\n notifyButton?: {\n /**\n * A function you define that returns true to show the Subscription Bell, or false to hide it.\n * Typically used the hide the Subscription Bell after the user is subscribed.\n * This function is not re-evaluated on every state change; this function is only evaluated once when the Subscription Bell begins to show.\n */\n displayPredicate?: () => boolean | Promise<boolean>;\n\n /**\n * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.\n */\n enable?: boolean;\n\n /** Specify CSS-valid pixel offsets using bottom, left, and right. */\n offset?: { bottom: string; left: string; right: string };\n\n /**\n * If `true`, the Subscription Bell will display an icon that there is 1 unread message.\n * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.\n */\n prenotify: boolean;\n\n /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */\n position?: 'bottom-left' | 'bottom-right';\n\n /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */\n showCredit: boolean;\n\n /**\n * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.\n */\n size?: 'small' | 'medium' | 'large';\n\n /** Customize the Subscription Bell text. */\n text: {\n 'dialog.blocked.message': string;\n 'dialog.blocked.title': string;\n 'dialog.main.button.subscribe': string;\n 'dialog.main.button.unsubscribe': string;\n 'dialog.main.title': string;\n 'message.action.resubscribed': string;\n 'message.action.subscribed': string;\n 'message.action.subscribing': string;\n 'message.action.unsubscribed': string;\n 'message.prenotify': string;\n 'tip.state.blocked': string;\n 'tip.state.subscribed': string;\n 'tip.state.unsubscribed': string;\n };\n };\n\n persistNotification?: boolean;\n webhooks?: {\n /**\n * Enable this setting only if your server has CORS enabled and supports non-simple CORS requests.\n * If this setting is disabled, your webhook will not need CORS to receive data, but it will not receive the custom headers.\n * The simplest option is to leave it disabled.\n * @default false\n */\n cors: boolean;\n\n /**\n * This event occurs after a notification is clicked.\n * @example https://site.com/hook\n */\n 'notification.clicked'?: string;\n\n /**\n * This event occurs after a notification is intentionally dismissed by the user (clicking the notification body or one of the notification action buttons does not trigger the dismissed webhook),\n * after a group of notifications are all dismissed (with this notification as part of that group), or after a notification expires on its own time and disappears. This event is supported on Chrome only.\n * @example https://site.com/hook\n */\n 'notification.dismissed'?: string;\n\n /**\n * This event occurs after a notification is displayed.\n * @example https://site.com/hook\n */\n 'notification.willDisplay'?: string;\n };\n autoResubscribe?: boolean;\n autoRegister?: boolean;\n notificationClickHandlerMatch?: 'exact' | 'origin';\n notificationClickHandlerAction?: 'navigate' | 'focus';\n path?: string;\n serviceWorkerParam?: { scope: string };\n serviceWorkerPath?: string;\n serviceWorkerOverrideForTypical?: boolean;\n /**\n * Overrides the default OneSignal SDK script URL.\n * Use this to self-host the SDK script on your own domain, e.g. to comply\n * with strict Cross-Origin-Embedder-Policy (COEP) or Content-Security-Policy (CSP) headers.\n * @default 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js'\n */\n scriptSrc?: string;\n [key: string]: unknown;\n}\n\nexport interface IOneSignalOneSignal {\n\tSlidedown: IOneSignalSlidedown;\n\tNotifications: IOneSignalNotifications;\n\tSession: IOneSignalSession;\n\tUser: IOneSignalUser;\n\tDebug: IOneSignalDebug;\n\tlogin(externalId: string, jwtToken?: string): Promise<void>;\n\tlogout(): Promise<void>;\n\tupdateUserJwt(externalId: string, token: string): Promise<void>;\n\tinit(options: IInitObject): Promise<void>;\n\tsetConsentGiven(consent: boolean): Promise<void>;\n\tsetConsentRequired(requiresConsent: boolean): Promise<void>;\n}\nexport interface IOneSignalNotifications {\n\tpermissionNative: NotificationPermission;\n\tpermission: boolean;\n\tsetDefaultUrl(url: string): Promise<void>;\n\tsetDefaultTitle(title: string): Promise<void>;\n\tisPushSupported(): boolean;\n\trequestPermission(): Promise<boolean>;\n\taddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n\tremoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n}\nexport interface IOneSignalSlidedown {\n\tpromptPush(options?: AutoPromptOptions): Promise<void>;\n\tpromptPushCategories(options?: AutoPromptOptions): Promise<void>;\n\tpromptSms(options?: AutoPromptOptions): Promise<void>;\n\tpromptEmail(options?: AutoPromptOptions): Promise<void>;\n\tpromptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;\n\taddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n\tremoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n}\nexport interface IOneSignalDebug {\n\tsetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;\n}\nexport interface IOneSignalSession {\n\tsendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;\n\tsendUniqueOutcome(outcomeName: string): Promise<void>;\n}\nexport interface IOneSignalUser {\n\tonesignalId: string | undefined;\n\texternalId: string | undefined;\n\tPushSubscription: IOneSignalPushSubscription;\n\taddAlias(label: string, id: string): void;\n\taddAliases(aliases: { [key: string]: string }): void;\n\tremoveAlias(label: string): void;\n\tremoveAliases(labels: string[]): void;\n\taddEmail(email: string): void;\n\tremoveEmail(email: string): void;\n\taddSms(smsNumber: string): void;\n\tremoveSms(smsNumber: string): void;\n\taddTag(key: string, value: string): void;\n\taddTags(tags: { [key: string]: string }): void;\n\tremoveTag(key: string): void;\n\tremoveTags(keys: string[]): void;\n\tgetTags(): { [key: string]: string };\n\taddEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;\n\tremoveEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;\n\tsetLanguage(language: string): void;\n\tgetLanguage(): string;\n\ttrackEvent(name: string, properties?: Record<string, unknown>): void;\n}\nexport interface IOneSignalPushSubscription {\n\tid: string | null | undefined;\n\ttoken: string | null | undefined;\n\toptedIn: boolean | undefined;\n\toptIn(): Promise<void>;\n\toptOut(): Promise<void>;\n\taddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n\tremoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n}\nfunction oneSignalLogin(externalId: string, jwtToken?: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.login(externalId, jwtToken)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalLogout(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.logout()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalUpdateUserJwt(externalId: string, token: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.updateUserJwt(externalId, token)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentGiven(consent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentGiven(consent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentRequired(requiresConsent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentRequired(requiresConsent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPush(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPush(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPushCategories(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPushCategories(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSms(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSms(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSmsAndEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSmsAndEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownAddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.addEventListener(event, listener);\n });\n \n}\nfunction slidedownRemoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.removeEventListener(event, listener);\n });\n \n}\nfunction notificationsSetDefaultUrl(url: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultUrl(url)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsSetDefaultTitle(title: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultTitle(title)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsRequestPermission(): Promise<boolean> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.requestPermission()\n .then(result => resolve(result))\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsAddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.addEventListener(event, listener);\n });\n \n}\nfunction notificationsRemoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.removeEventListener(event, listener);\n });\n \n}\nfunction sessionSendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendOutcome(outcomeName, outcomeWeight)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction sessionSendUniqueOutcome(outcomeName: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendUniqueOutcome(outcomeName)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction userAddAlias(label: string, id: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAlias(label, id);\n });\n \n}\nfunction userAddAliases(aliases: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAliases(aliases);\n });\n \n}\nfunction userRemoveAlias(label: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAlias(label);\n });\n \n}\nfunction userRemoveAliases(labels: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAliases(labels);\n });\n \n}\nfunction userAddEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEmail(email);\n });\n \n}\nfunction userRemoveEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEmail(email);\n });\n \n}\nfunction userAddSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addSms(smsNumber);\n });\n \n}\nfunction userRemoveSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeSms(smsNumber);\n });\n \n}\nfunction userAddTag(key: string, value: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTag(key, value);\n });\n \n}\nfunction userAddTags(tags: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTags(tags);\n });\n \n}\nfunction userRemoveTag(key: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTag(key);\n });\n \n}\nfunction userRemoveTags(keys: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTags(keys);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetTags(): { [key: string]: string } {\n let retVal: { [key: string]: string };\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getTags();\n });\n return retVal;\n}\nfunction userAddEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEventListener(event, listener);\n });\n \n}\nfunction userRemoveEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEventListener(event, listener);\n });\n \n}\nfunction userSetLanguage(language: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.setLanguage(language);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetLanguage(): string {\n let retVal: string;\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getLanguage();\n });\n return retVal;\n}\nfunction userTrackEvent(name: string, properties?: Record<string, unknown>): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.trackEvent(name, properties);\n });\n \n}\nfunction pushSubscriptionOptIn(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optIn()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionOptOut(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optOut()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionAddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.addEventListener(event, listener);\n });\n \n}\nfunction pushSubscriptionRemoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.removeEventListener(event, listener);\n });\n \n}\nfunction debugSetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Debug.setLogLevel(logLevel);\n });\n \n}\nconst PushSubscriptionNamespace: IOneSignalPushSubscription = {\n\tget id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id; },\n\tget token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token; },\n\tget optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn; },\n\toptIn: pushSubscriptionOptIn,\n\toptOut: pushSubscriptionOptOut,\n\taddEventListener: pushSubscriptionAddEventListener,\n\tremoveEventListener: pushSubscriptionRemoveEventListener,\n};\n\nconst UserNamespace: IOneSignalUser = {\n\tget onesignalId(): string | undefined { return window.OneSignal?.User?.onesignalId; },\n\tget externalId(): string | undefined { return window.OneSignal?.User?.externalId; },\n\taddAlias: userAddAlias,\n\taddAliases: userAddAliases,\n\tremoveAlias: userRemoveAlias,\n\tremoveAliases: userRemoveAliases,\n\taddEmail: userAddEmail,\n\tremoveEmail: userRemoveEmail,\n\taddSms: userAddSms,\n\tremoveSms: userRemoveSms,\n\taddTag: userAddTag,\n\taddTags: userAddTags,\n\tremoveTag: userRemoveTag,\n\tremoveTags: userRemoveTags,\n\tgetTags: userGetTags,\n\taddEventListener: userAddEventListener,\n\tremoveEventListener: userRemoveEventListener,\n\tsetLanguage: userSetLanguage,\n\tgetLanguage: userGetLanguage,\n\ttrackEvent: userTrackEvent,\n\tPushSubscription: PushSubscriptionNamespace,\n};\n\nconst SessionNamespace: IOneSignalSession = {\n\tsendOutcome: sessionSendOutcome,\n\tsendUniqueOutcome: sessionSendUniqueOutcome,\n};\n\nconst DebugNamespace: IOneSignalDebug = {\n\tsetLogLevel: debugSetLogLevel,\n};\n\nconst SlidedownNamespace: IOneSignalSlidedown = {\n\tpromptPush: slidedownPromptPush,\n\tpromptPushCategories: slidedownPromptPushCategories,\n\tpromptSms: slidedownPromptSms,\n\tpromptEmail: slidedownPromptEmail,\n\tpromptSmsAndEmail: slidedownPromptSmsAndEmail,\n\taddEventListener: slidedownAddEventListener,\n\tremoveEventListener: slidedownRemoveEventListener,\n};\n\nconst NotificationsNamespace: IOneSignalNotifications = {\n\tget permissionNative(): NotificationPermission { return window.OneSignal?.Notifications?.permissionNative ?? 'default'; },\n\tget permission(): boolean { return window.OneSignal?.Notifications?.permission ?? false; },\n\tsetDefaultUrl: notificationsSetDefaultUrl,\n\tsetDefaultTitle: notificationsSetDefaultTitle,\n\tisPushSupported,\n\trequestPermission: notificationsRequestPermission,\n\taddEventListener: notificationsAddEventListener,\n\tremoveEventListener: notificationsRemoveEventListener,\n};\n\nconst OneSignalNamespace: IOneSignalOneSignal = {\n\tlogin: oneSignalLogin,\n\tlogout: oneSignalLogout,\n\tupdateUserJwt: oneSignalUpdateUserJwt,\n\tinit,\n\tsetConsentGiven: oneSignalSetConsentGiven,\n\tsetConsentRequired: oneSignalSetConsentRequired,\n\tSlidedown: SlidedownNamespace,\n\tNotifications: NotificationsNamespace,\n\tSession: SessionNamespace,\n\tUser: UserNamespace,\n\tDebug: DebugNamespace,\n};\n\nconst OneSignalVuePlugin = {\n install(app: typeof VueApp) {\n app.prototype.$OneSignal = OneSignalNamespace as IOneSignalOneSignal;\n }\n}\n\nexport default OneSignalVuePlugin;\n"],"mappings":";;AAEA,MAAM,mBAAmB;AACzB,MAAM,qBACJ;AAEF,IAAI,yBAAyB;AAC7B,IAAI,0BAA0B;AAC9B,IAAI;AAIJ,IAAI,OAAO,WAAW,aACpB,OAAO,oBAAoB,OAAO,qBAAqB,CAAC;AAK1D,SAAS,gBAAgB;CACvB,0BAA0B;CAC1B,oCAAoB,IAAI,MAAM,kCAAkC,CAAC;CACjE,oBAAoB,KAAA;AACtB;AAEA,SAAS,aAAa,WAAoB;CACxC,IAAI,SAAS,eAAe,gBAAgB,GAC1C;CAGF,MAAM,SAAS,SAAS,cAAc,QAAQ;CAC9C,OAAO,KAAK;CACZ,OAAO,QAAQ;CACf,OAAO,MAAM,aAAa;CAI1B,OAAO,gBAAgB;EACrB,cAAc;CAChB;CAEA,SAAS,KAAK,YAAY,MAAM;AAClC;;;;AAyBA,MAAM,QAAQ,YAAwC;CACpD,IAAI,wBACF,OAAO,Q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,YAAY;EACZ,kBAAkB;GA9BlB,IAAI,KAAgC;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;GAAI;GAC3F,IAAI,QAAmC;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;GAAO;GACjG,IAAI,UAA+B;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;GAAS;GAC/F,OAAO;GACP,QAAQ;GACR,kBAAkB;GAClB,qBAAqB;EAwBqB;CA2CxB;CAClB,OAAO,EAnCP,aAAa,iBAmCO;AACrB;AAEA,MAAM,qBAAqB,EACzB,QAAQ,KAAoB;CAC1B,IAAI,UAAU,aAAa;AAC7B,EACF"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region index.d.ts
2
1
  declare const VueApp: any;
3
2
  declare module 'vue/types/vue' {
4
3
  interface Vue {
@@ -14,18 +13,18 @@ declare global {
14
13
  };
15
14
  }
16
15
  }
17
- interface AutoPromptOptions {
16
+ export interface AutoPromptOptions {
18
17
  force?: boolean;
19
18
  forceSlidedownOverNative?: boolean;
20
19
  slidedownPromptOptions?: IOneSignalAutoPromptOptions;
21
20
  }
22
- interface IOneSignalAutoPromptOptions {
21
+ export interface IOneSignalAutoPromptOptions {
23
22
  force?: boolean;
24
23
  forceSlidedownOverNative?: boolean;
25
24
  isInUpdateMode?: boolean;
26
25
  categoryOptions?: IOneSignalCategories;
27
26
  }
28
- interface IOneSignalCategories {
27
+ export interface IOneSignalCategories {
29
28
  positiveUpdateButton: string;
30
29
  negativeUpdateButton: string;
31
30
  savingButtonText: string;
@@ -33,24 +32,24 @@ interface IOneSignalCategories {
33
32
  updateMessage: string;
34
33
  tags: IOneSignalTagCategory[];
35
34
  }
36
- interface IOneSignalTagCategory {
35
+ export interface IOneSignalTagCategory {
37
36
  tag: string;
38
37
  label: string;
39
38
  checked?: boolean;
40
39
  }
41
- type PushSubscriptionNamespaceProperties = {
40
+ export type PushSubscriptionNamespaceProperties = {
42
41
  id: string | null | undefined;
43
42
  token: string | null | undefined;
44
43
  optedIn: boolean;
45
44
  };
46
- type SubscriptionChangeEvent = {
45
+ export type SubscriptionChangeEvent = {
47
46
  previous: PushSubscriptionNamespaceProperties;
48
47
  current: PushSubscriptionNamespaceProperties;
49
48
  };
50
- type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
51
- type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';
52
- type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
53
- interface IOSNotification {
49
+ export type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
50
+ export type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';
51
+ export type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
52
+ export interface IOSNotification {
54
53
  /**
55
54
  * The OneSignal notification id;
56
55
  * - Primary id on OneSignal's REST API and dashboard
@@ -101,7 +100,7 @@ interface IOSNotification {
101
100
  */
102
101
  readonly confirmDelivery: boolean;
103
102
  }
104
- interface IOSNotificationActionButton {
103
+ export interface IOSNotificationActionButton {
105
104
  /**
106
105
  * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker
107
106
  * and host page through events to identify which button was clicked.
@@ -121,39 +120,47 @@ interface IOSNotificationActionButton {
121
120
  */
122
121
  readonly launchURL?: string;
123
122
  }
124
- interface IDisplayableOSNotification extends IOSNotification {
123
+ export interface IDisplayableOSNotification extends IOSNotification {
125
124
  display(): void;
126
125
  }
127
- interface NotificationClickResult {
126
+ export interface NotificationClickResult {
128
127
  readonly actionId?: string;
129
128
  readonly url?: string;
130
129
  }
131
- type NotificationEventTypeMap = {
130
+ export type NotificationEventTypeMap = {
132
131
  'click': NotificationClickEvent;
133
132
  'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;
134
133
  'dismiss': NotificationDismissEvent;
135
134
  'permissionChange': boolean;
136
135
  'permissionPromptDisplay': void;
137
136
  };
138
- interface NotificationForegroundWillDisplayEvent {
137
+ export interface NotificationForegroundWillDisplayEvent {
139
138
  readonly notification: IDisplayableOSNotification;
140
139
  preventDefault(): void;
141
140
  }
142
- interface NotificationDismissEvent {
141
+ export interface NotificationDismissEvent {
143
142
  notification: IOSNotification;
144
143
  }
145
- interface NotificationClickEvent {
144
+ export interface NotificationClickEvent {
146
145
  readonly notification: IOSNotification;
147
146
  readonly result: NotificationClickResult;
148
147
  }
149
- type UserChangeEvent = {
148
+ export type UserChangeEvent = {
150
149
  current: UserNamespaceProperties;
151
150
  };
152
- type UserNamespaceProperties = {
151
+ export type UserJwtInvalidatedEvent = {
152
+ externalId: string;
153
+ };
154
+ export type UserEventName = 'change' | 'userJwtInvalidated';
155
+ export type UserEventTypeMap = {
156
+ change: UserChangeEvent;
157
+ userJwtInvalidated: UserJwtInvalidatedEvent;
158
+ };
159
+ export type UserNamespaceProperties = {
153
160
  onesignalId: string | undefined;
154
161
  externalId: string | undefined;
155
162
  };
156
- interface IInitObject {
163
+ export interface IInitObject {
157
164
  appId: string;
158
165
  requiresUserPrivacyConsent?: boolean;
159
166
  safari_web_id?: string;
@@ -173,7 +180,9 @@ interface IInitObject {
173
180
  * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see "Local News" in the prompt.
174
181
  */
175
182
  categories?: {
176
- /** Should identify the action. */tag: string; /** What the user will see. */
183
+ /** Should identify the action. */
184
+ tag: string;
185
+ /** What the user will see. */
177
186
  label: string;
178
187
  }[];
179
188
  /**
@@ -181,21 +190,32 @@ interface IInitObject {
181
190
  * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.
182
191
  */
183
192
  delay: {
184
- /** The number of pages a user needs to visit before the prompt is displayed. */pageViews?: number; /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */
193
+ /** The number of pages a user needs to visit before the prompt is displayed. */
194
+ pageViews?: number;
195
+ /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */
185
196
  timeDelay?: number;
186
197
  };
187
198
  /**
188
199
  * The text to display in the prompt.
189
200
  */
190
201
  text?: {
191
- /** The callout asking the user to opt-in. Up to 90 characters. */actionMessage?: string; /** Triggers the opt-in. Up to 15 characters. */
192
- acceptButton?: string; /** Cancels opt-in. Up to 15 characters. */
193
- cancelButton?: string; /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */
194
- confirmMessage?: string; /** Identifies the email text field. Up to 15 characters. */
195
- emailLabel?: string; /** Cancels the category update. Up to 15 characters. */
196
- negativeUpdateButton?: string; /** Saves the updated category tags. Up to 15 characters. */
197
- positiveUpdateButton?: string; /** Identifies the phone number text field. Up to 15 characters. */
198
- smsLabel?: string; /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */
202
+ /** The callout asking the user to opt-in. Up to 90 characters. */
203
+ actionMessage?: string;
204
+ /** Triggers the opt-in. Up to 15 characters. */
205
+ acceptButton?: string;
206
+ /** Cancels opt-in. Up to 15 characters. */
207
+ cancelButton?: string;
208
+ /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */
209
+ confirmMessage?: string;
210
+ /** Identifies the email text field. Up to 15 characters. */
211
+ emailLabel?: string;
212
+ /** Cancels the category update. Up to 15 characters. */
213
+ negativeUpdateButton?: string;
214
+ /** Saves the updated category tags. Up to 15 characters. */
215
+ positiveUpdateButton?: string;
216
+ /** Identifies the phone number text field. Up to 15 characters. */
217
+ smsLabel?: string;
218
+ /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */
199
219
  updateMessage?: string;
200
220
  };
201
221
  /**
@@ -249,7 +269,8 @@ interface IInitObject {
249
269
  /**
250
270
  * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.
251
271
  */
252
- enable?: boolean; /** Specify CSS-valid pixel offsets using bottom, left, and right. */
272
+ enable?: boolean;
273
+ /** Specify CSS-valid pixel offsets using bottom, left, and right. */
253
274
  offset?: {
254
275
  bottom: string;
255
276
  left: string;
@@ -259,13 +280,16 @@ interface IInitObject {
259
280
  * If `true`, the Subscription Bell will display an icon that there is 1 unread message.
260
281
  * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.
261
282
  */
262
- prenotify: boolean; /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */
263
- position?: 'bottom-left' | 'bottom-right'; /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */
283
+ prenotify: boolean;
284
+ /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */
285
+ position?: 'bottom-left' | 'bottom-right';
286
+ /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */
264
287
  showCredit: boolean;
265
288
  /**
266
289
  * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.
267
290
  */
268
- size?: 'small' | 'medium' | 'large'; /** Customize the Subscription Bell text. */
291
+ size?: 'small' | 'medium' | 'large';
292
+ /** Customize the Subscription Bell text. */
269
293
  text: {
270
294
  'dialog.blocked.message': string;
271
295
  'dialog.blocked.title': string;
@@ -327,7 +351,7 @@ interface IInitObject {
327
351
  scriptSrc?: string;
328
352
  [key: string]: unknown;
329
353
  }
330
- interface IOneSignalOneSignal {
354
+ export interface IOneSignalOneSignal {
331
355
  Slidedown: IOneSignalSlidedown;
332
356
  Notifications: IOneSignalNotifications;
333
357
  Session: IOneSignalSession;
@@ -335,11 +359,12 @@ interface IOneSignalOneSignal {
335
359
  Debug: IOneSignalDebug;
336
360
  login(externalId: string, jwtToken?: string): Promise<void>;
337
361
  logout(): Promise<void>;
362
+ updateUserJwt(externalId: string, token: string): Promise<void>;
338
363
  init(options: IInitObject): Promise<void>;
339
364
  setConsentGiven(consent: boolean): Promise<void>;
340
365
  setConsentRequired(requiresConsent: boolean): Promise<void>;
341
366
  }
342
- interface IOneSignalNotifications {
367
+ export interface IOneSignalNotifications {
343
368
  permissionNative: NotificationPermission;
344
369
  permission: boolean;
345
370
  setDefaultUrl(url: string): Promise<void>;
@@ -349,7 +374,7 @@ interface IOneSignalNotifications {
349
374
  addEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
350
375
  removeEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
351
376
  }
352
- interface IOneSignalSlidedown {
377
+ export interface IOneSignalSlidedown {
353
378
  promptPush(options?: AutoPromptOptions): Promise<void>;
354
379
  promptPushCategories(options?: AutoPromptOptions): Promise<void>;
355
380
  promptSms(options?: AutoPromptOptions): Promise<void>;
@@ -358,14 +383,14 @@ interface IOneSignalSlidedown {
358
383
  addEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
359
384
  removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
360
385
  }
361
- interface IOneSignalDebug {
386
+ export interface IOneSignalDebug {
362
387
  setLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;
363
388
  }
364
- interface IOneSignalSession {
389
+ export interface IOneSignalSession {
365
390
  sendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;
366
391
  sendUniqueOutcome(outcomeName: string): Promise<void>;
367
392
  }
368
- interface IOneSignalUser {
393
+ export interface IOneSignalUser {
369
394
  onesignalId: string | undefined;
370
395
  externalId: string | undefined;
371
396
  PushSubscription: IOneSignalPushSubscription;
@@ -388,13 +413,13 @@ interface IOneSignalUser {
388
413
  getTags(): {
389
414
  [key: string]: string;
390
415
  };
391
- addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
392
- removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
416
+ addEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;
417
+ removeEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;
393
418
  setLanguage(language: string): void;
394
419
  getLanguage(): string;
395
420
  trackEvent(name: string, properties?: Record<string, unknown>): void;
396
421
  }
397
- interface IOneSignalPushSubscription {
422
+ export interface IOneSignalPushSubscription {
398
423
  id: string | null | undefined;
399
424
  token: string | null | undefined;
400
425
  optedIn: boolean | undefined;
@@ -406,6 +431,5 @@ interface IOneSignalPushSubscription {
406
431
  declare const OneSignalVuePlugin: {
407
432
  install(app: typeof VueApp): void;
408
433
  };
409
- //#endregion
410
- export { AutoPromptOptions, IDisplayableOSNotification, IInitObject, IOSNotification, IOSNotificationActionButton, IOneSignalAutoPromptOptions, IOneSignalCategories, IOneSignalDebug, IOneSignalNotifications, IOneSignalOneSignal, IOneSignalPushSubscription, IOneSignalSession, IOneSignalSlidedown, IOneSignalTagCategory, IOneSignalUser, NotificationClickEvent, NotificationClickResult, NotificationDismissEvent, NotificationEventName, NotificationEventTypeMap, NotificationForegroundWillDisplayEvent, OneSignalDeferredLoadedCallback, PushSubscriptionNamespaceProperties, SlidedownEventName, SubscriptionChangeEvent, UserChangeEvent, UserNamespaceProperties, OneSignalVuePlugin as default };
434
+ export { OneSignalVuePlugin as default };
411
435
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region index.d.ts
2
1
  declare const VueApp: any;
3
2
  declare module 'vue/types/vue' {
4
3
  interface Vue {
@@ -14,18 +13,18 @@ declare global {
14
13
  };
15
14
  }
16
15
  }
17
- interface AutoPromptOptions {
16
+ export interface AutoPromptOptions {
18
17
  force?: boolean;
19
18
  forceSlidedownOverNative?: boolean;
20
19
  slidedownPromptOptions?: IOneSignalAutoPromptOptions;
21
20
  }
22
- interface IOneSignalAutoPromptOptions {
21
+ export interface IOneSignalAutoPromptOptions {
23
22
  force?: boolean;
24
23
  forceSlidedownOverNative?: boolean;
25
24
  isInUpdateMode?: boolean;
26
25
  categoryOptions?: IOneSignalCategories;
27
26
  }
28
- interface IOneSignalCategories {
27
+ export interface IOneSignalCategories {
29
28
  positiveUpdateButton: string;
30
29
  negativeUpdateButton: string;
31
30
  savingButtonText: string;
@@ -33,24 +32,24 @@ interface IOneSignalCategories {
33
32
  updateMessage: string;
34
33
  tags: IOneSignalTagCategory[];
35
34
  }
36
- interface IOneSignalTagCategory {
35
+ export interface IOneSignalTagCategory {
37
36
  tag: string;
38
37
  label: string;
39
38
  checked?: boolean;
40
39
  }
41
- type PushSubscriptionNamespaceProperties = {
40
+ export type PushSubscriptionNamespaceProperties = {
42
41
  id: string | null | undefined;
43
42
  token: string | null | undefined;
44
43
  optedIn: boolean;
45
44
  };
46
- type SubscriptionChangeEvent = {
45
+ export type SubscriptionChangeEvent = {
47
46
  previous: PushSubscriptionNamespaceProperties;
48
47
  current: PushSubscriptionNamespaceProperties;
49
48
  };
50
- type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
51
- type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';
52
- type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
53
- interface IOSNotification {
49
+ export type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
50
+ export type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';
51
+ export type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
52
+ export interface IOSNotification {
54
53
  /**
55
54
  * The OneSignal notification id;
56
55
  * - Primary id on OneSignal's REST API and dashboard
@@ -101,7 +100,7 @@ interface IOSNotification {
101
100
  */
102
101
  readonly confirmDelivery: boolean;
103
102
  }
104
- interface IOSNotificationActionButton {
103
+ export interface IOSNotificationActionButton {
105
104
  /**
106
105
  * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker
107
106
  * and host page through events to identify which button was clicked.
@@ -121,39 +120,47 @@ interface IOSNotificationActionButton {
121
120
  */
122
121
  readonly launchURL?: string;
123
122
  }
124
- interface IDisplayableOSNotification extends IOSNotification {
123
+ export interface IDisplayableOSNotification extends IOSNotification {
125
124
  display(): void;
126
125
  }
127
- interface NotificationClickResult {
126
+ export interface NotificationClickResult {
128
127
  readonly actionId?: string;
129
128
  readonly url?: string;
130
129
  }
131
- type NotificationEventTypeMap = {
130
+ export type NotificationEventTypeMap = {
132
131
  'click': NotificationClickEvent;
133
132
  'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;
134
133
  'dismiss': NotificationDismissEvent;
135
134
  'permissionChange': boolean;
136
135
  'permissionPromptDisplay': void;
137
136
  };
138
- interface NotificationForegroundWillDisplayEvent {
137
+ export interface NotificationForegroundWillDisplayEvent {
139
138
  readonly notification: IDisplayableOSNotification;
140
139
  preventDefault(): void;
141
140
  }
142
- interface NotificationDismissEvent {
141
+ export interface NotificationDismissEvent {
143
142
  notification: IOSNotification;
144
143
  }
145
- interface NotificationClickEvent {
144
+ export interface NotificationClickEvent {
146
145
  readonly notification: IOSNotification;
147
146
  readonly result: NotificationClickResult;
148
147
  }
149
- type UserChangeEvent = {
148
+ export type UserChangeEvent = {
150
149
  current: UserNamespaceProperties;
151
150
  };
152
- type UserNamespaceProperties = {
151
+ export type UserJwtInvalidatedEvent = {
152
+ externalId: string;
153
+ };
154
+ export type UserEventName = 'change' | 'userJwtInvalidated';
155
+ export type UserEventTypeMap = {
156
+ change: UserChangeEvent;
157
+ userJwtInvalidated: UserJwtInvalidatedEvent;
158
+ };
159
+ export type UserNamespaceProperties = {
153
160
  onesignalId: string | undefined;
154
161
  externalId: string | undefined;
155
162
  };
156
- interface IInitObject {
163
+ export interface IInitObject {
157
164
  appId: string;
158
165
  requiresUserPrivacyConsent?: boolean;
159
166
  safari_web_id?: string;
@@ -173,7 +180,9 @@ interface IInitObject {
173
180
  * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see "Local News" in the prompt.
174
181
  */
175
182
  categories?: {
176
- /** Should identify the action. */tag: string; /** What the user will see. */
183
+ /** Should identify the action. */
184
+ tag: string;
185
+ /** What the user will see. */
177
186
  label: string;
178
187
  }[];
179
188
  /**
@@ -181,21 +190,32 @@ interface IInitObject {
181
190
  * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.
182
191
  */
183
192
  delay: {
184
- /** The number of pages a user needs to visit before the prompt is displayed. */pageViews?: number; /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */
193
+ /** The number of pages a user needs to visit before the prompt is displayed. */
194
+ pageViews?: number;
195
+ /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */
185
196
  timeDelay?: number;
186
197
  };
187
198
  /**
188
199
  * The text to display in the prompt.
189
200
  */
190
201
  text?: {
191
- /** The callout asking the user to opt-in. Up to 90 characters. */actionMessage?: string; /** Triggers the opt-in. Up to 15 characters. */
192
- acceptButton?: string; /** Cancels opt-in. Up to 15 characters. */
193
- cancelButton?: string; /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */
194
- confirmMessage?: string; /** Identifies the email text field. Up to 15 characters. */
195
- emailLabel?: string; /** Cancels the category update. Up to 15 characters. */
196
- negativeUpdateButton?: string; /** Saves the updated category tags. Up to 15 characters. */
197
- positiveUpdateButton?: string; /** Identifies the phone number text field. Up to 15 characters. */
198
- smsLabel?: string; /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */
202
+ /** The callout asking the user to opt-in. Up to 90 characters. */
203
+ actionMessage?: string;
204
+ /** Triggers the opt-in. Up to 15 characters. */
205
+ acceptButton?: string;
206
+ /** Cancels opt-in. Up to 15 characters. */
207
+ cancelButton?: string;
208
+ /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */
209
+ confirmMessage?: string;
210
+ /** Identifies the email text field. Up to 15 characters. */
211
+ emailLabel?: string;
212
+ /** Cancels the category update. Up to 15 characters. */
213
+ negativeUpdateButton?: string;
214
+ /** Saves the updated category tags. Up to 15 characters. */
215
+ positiveUpdateButton?: string;
216
+ /** Identifies the phone number text field. Up to 15 characters. */
217
+ smsLabel?: string;
218
+ /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */
199
219
  updateMessage?: string;
200
220
  };
201
221
  /**
@@ -249,7 +269,8 @@ interface IInitObject {
249
269
  /**
250
270
  * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.
251
271
  */
252
- enable?: boolean; /** Specify CSS-valid pixel offsets using bottom, left, and right. */
272
+ enable?: boolean;
273
+ /** Specify CSS-valid pixel offsets using bottom, left, and right. */
253
274
  offset?: {
254
275
  bottom: string;
255
276
  left: string;
@@ -259,13 +280,16 @@ interface IInitObject {
259
280
  * If `true`, the Subscription Bell will display an icon that there is 1 unread message.
260
281
  * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.
261
282
  */
262
- prenotify: boolean; /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */
263
- position?: 'bottom-left' | 'bottom-right'; /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */
283
+ prenotify: boolean;
284
+ /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */
285
+ position?: 'bottom-left' | 'bottom-right';
286
+ /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */
264
287
  showCredit: boolean;
265
288
  /**
266
289
  * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.
267
290
  */
268
- size?: 'small' | 'medium' | 'large'; /** Customize the Subscription Bell text. */
291
+ size?: 'small' | 'medium' | 'large';
292
+ /** Customize the Subscription Bell text. */
269
293
  text: {
270
294
  'dialog.blocked.message': string;
271
295
  'dialog.blocked.title': string;
@@ -327,7 +351,7 @@ interface IInitObject {
327
351
  scriptSrc?: string;
328
352
  [key: string]: unknown;
329
353
  }
330
- interface IOneSignalOneSignal {
354
+ export interface IOneSignalOneSignal {
331
355
  Slidedown: IOneSignalSlidedown;
332
356
  Notifications: IOneSignalNotifications;
333
357
  Session: IOneSignalSession;
@@ -335,11 +359,12 @@ interface IOneSignalOneSignal {
335
359
  Debug: IOneSignalDebug;
336
360
  login(externalId: string, jwtToken?: string): Promise<void>;
337
361
  logout(): Promise<void>;
362
+ updateUserJwt(externalId: string, token: string): Promise<void>;
338
363
  init(options: IInitObject): Promise<void>;
339
364
  setConsentGiven(consent: boolean): Promise<void>;
340
365
  setConsentRequired(requiresConsent: boolean): Promise<void>;
341
366
  }
342
- interface IOneSignalNotifications {
367
+ export interface IOneSignalNotifications {
343
368
  permissionNative: NotificationPermission;
344
369
  permission: boolean;
345
370
  setDefaultUrl(url: string): Promise<void>;
@@ -349,7 +374,7 @@ interface IOneSignalNotifications {
349
374
  addEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
350
375
  removeEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
351
376
  }
352
- interface IOneSignalSlidedown {
377
+ export interface IOneSignalSlidedown {
353
378
  promptPush(options?: AutoPromptOptions): Promise<void>;
354
379
  promptPushCategories(options?: AutoPromptOptions): Promise<void>;
355
380
  promptSms(options?: AutoPromptOptions): Promise<void>;
@@ -358,14 +383,14 @@ interface IOneSignalSlidedown {
358
383
  addEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
359
384
  removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
360
385
  }
361
- interface IOneSignalDebug {
386
+ export interface IOneSignalDebug {
362
387
  setLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;
363
388
  }
364
- interface IOneSignalSession {
389
+ export interface IOneSignalSession {
365
390
  sendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;
366
391
  sendUniqueOutcome(outcomeName: string): Promise<void>;
367
392
  }
368
- interface IOneSignalUser {
393
+ export interface IOneSignalUser {
369
394
  onesignalId: string | undefined;
370
395
  externalId: string | undefined;
371
396
  PushSubscription: IOneSignalPushSubscription;
@@ -388,13 +413,13 @@ interface IOneSignalUser {
388
413
  getTags(): {
389
414
  [key: string]: string;
390
415
  };
391
- addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
392
- removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
416
+ addEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;
417
+ removeEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;
393
418
  setLanguage(language: string): void;
394
419
  getLanguage(): string;
395
420
  trackEvent(name: string, properties?: Record<string, unknown>): void;
396
421
  }
397
- interface IOneSignalPushSubscription {
422
+ export interface IOneSignalPushSubscription {
398
423
  id: string | null | undefined;
399
424
  token: string | null | undefined;
400
425
  optedIn: boolean | undefined;
@@ -406,6 +431,5 @@ interface IOneSignalPushSubscription {
406
431
  declare const OneSignalVuePlugin: {
407
432
  install(app: typeof VueApp): void;
408
433
  };
409
- //#endregion
410
- export { AutoPromptOptions, IDisplayableOSNotification, IInitObject, IOSNotification, IOSNotificationActionButton, IOneSignalAutoPromptOptions, IOneSignalCategories, IOneSignalDebug, IOneSignalNotifications, IOneSignalOneSignal, IOneSignalPushSubscription, IOneSignalSession, IOneSignalSlidedown, IOneSignalTagCategory, IOneSignalUser, NotificationClickEvent, NotificationClickResult, NotificationDismissEvent, NotificationEventName, NotificationEventTypeMap, NotificationForegroundWillDisplayEvent, OneSignalDeferredLoadedCallback, PushSubscriptionNamespaceProperties, SlidedownEventName, SubscriptionChangeEvent, UserChangeEvent, UserNamespaceProperties, OneSignalVuePlugin as default };
434
+ export { OneSignalVuePlugin as default };
411
435
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- //#region index.ts
2
+ // index.ts
3
3
  const ONESIGNAL_SDK_ID = "onesignal-sdk";
4
4
  const DEFAULT_SCRIPT_SRC = "https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js";
5
5
  let isOneSignalInitialized = false;
@@ -90,6 +90,17 @@ function oneSignalLogout() {
90
90
  });
91
91
  });
92
92
  }
93
+ function oneSignalUpdateUserJwt(externalId, token) {
94
+ return new Promise((resolve, reject) => {
95
+ if (isOneSignalScriptFailed) {
96
+ reject(/* @__PURE__ */ new Error("OneSignal script failed to load."));
97
+ return;
98
+ }
99
+ window.OneSignalDeferred?.push((OneSignal) => {
100
+ OneSignal.updateUserJwt(externalId, token).then(() => resolve()).catch((error) => reject(error));
101
+ });
102
+ });
103
+ }
93
104
  function oneSignalSetConsentGiven(consent) {
94
105
  return new Promise((resolve, reject) => {
95
106
  if (isOneSignalScriptFailed) {
@@ -376,6 +387,7 @@ function debugSetLogLevel(logLevel) {
376
387
  const OneSignalNamespace = {
377
388
  login: oneSignalLogin,
378
389
  logout: oneSignalLogout,
390
+ updateUserJwt: oneSignalUpdateUserJwt,
379
391
  init,
380
392
  setConsentGiven: oneSignalSetConsentGiven,
381
393
  setConsentRequired: oneSignalSetConsentRequired,
@@ -452,7 +464,6 @@ const OneSignalNamespace = {
452
464
  const OneSignalVuePlugin = { install(app) {
453
465
  app.prototype.$OneSignal = OneSignalNamespace;
454
466
  } };
455
- //#endregion
456
467
  export { OneSignalVuePlugin as default };
457
468
 
458
469
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import Vue from 'vue';\n\nconst ONESIGNAL_SDK_ID = 'onesignal-sdk';\nconst DEFAULT_SCRIPT_SRC =\n 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js';\n\nlet isOneSignalInitialized = false;\nlet isOneSignalScriptFailed = false;\nlet pendingInitReject: ((reason?: unknown) => void) | undefined;\n\nconst VueApp: any = Vue;\n\nif (typeof window !== 'undefined') {\n window.OneSignalDeferred = window.OneSignalDeferred || [];\n}\n\n/* H E L P E R S */\n\nfunction handleOnError() {\n isOneSignalScriptFailed = true;\n pendingInitReject?.(new Error('OneSignal script failed to load.'));\n pendingInitReject = undefined;\n}\n\nfunction addSDKScript(scriptSrc?: string) {\n if (document.getElementById(ONESIGNAL_SDK_ID)) {\n return;\n }\n\n const script = document.createElement('script');\n script.id = ONESIGNAL_SDK_ID;\n script.defer = true;\n script.src = scriptSrc || DEFAULT_SCRIPT_SRC;\n\n // Always resolve whether or not the script is successfully initialized.\n // This is important for users who may block cdn.onesignal.com w/ adblock.\n script.onerror = () => {\n handleOnError();\n };\n\n document.head.appendChild(script);\n}\n\n/* T Y P E D E C L A R A T I O N S */\n\ndeclare module 'vue/types/vue' {\n interface Vue {\n $OneSignal: IOneSignalOneSignal;\n }\n}\n\ndeclare global {\n interface Window {\n OneSignalDeferred?: OneSignalDeferredLoadedCallback[];\n OneSignal?: IOneSignalOneSignal;\n safari?: {\n pushNotification: any;\n };\n }\n}\n\n/* O N E S I G N A L A P I */\n\n/**\n * @PublicApi\n */\nconst init = (options: IInitObject): Promise<void> => {\n if (isOneSignalInitialized) {\n return Promise.reject(`OneSignal is already initialized.`);\n }\n if (!options || !options.appId) {\n return Promise.reject('You need to provide your OneSignal appId.');\n }\n if (!document) {\n return Promise.reject(`Document is not defined.`);\n }\n\n // Required: the CDN script silently exits on unsupported browsers without\n // draining OneSignalDeferred, so init() would hang forever otherwise.\n if (!isPushNotificationsSupported()) {\n return Promise.reject(\n new Error('This browser does not support Web Push notifications.'),\n );\n }\n\n // Handle both disabled and disable keys for welcome notification\n if (options.welcomeNotification?.disabled !== undefined) {\n options.welcomeNotification.disable = options.welcomeNotification.disabled;\n }\n\n addSDKScript(options.scriptSrc);\n\n return new Promise<void>((resolve, reject) => {\n pendingInitReject = reject;\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.init(options)\n .then(() => {\n isOneSignalInitialized = true;\n pendingInitReject = undefined;\n resolve();\n })\n .catch((err) => {\n pendingInitReject = undefined;\n reject(err);\n });\n });\n });\n};\n\n/**\n * The following code is copied directly from the native SDK source file BrowserSupportsPush.ts\n * S T A R T\n */\n\n// Checks if the browser supports push notifications by checking if specific\n// classes and properties on them exist\nfunction isPushNotificationsSupported() {\n return supportsVapidPush() || supportsSafariPush();\n}\n\nfunction isMacOSSafariInIframe(): boolean {\n // Fallback detection for Safari on macOS in an iframe context\n return (\n window.top !== window && // isContextIframe\n navigator.vendor === 'Apple Computer, Inc.' && // isSafari\n navigator.platform === 'MacIntel'\n ); // isMacOS\n}\n\nfunction supportsSafariPush(): boolean {\n return (\n (window.safari && typeof window.safari.pushNotification !== 'undefined') ||\n isMacOSSafariInIframe()\n );\n}\n\n// Does the browser support the standard Push API\nfunction supportsVapidPush(): boolean {\n return (\n typeof PushSubscriptionOptions !== 'undefined' &&\n PushSubscriptionOptions.prototype.hasOwnProperty('applicationServerKey')\n );\n}\n/* E N D */\n\n/**\n * @PublicApi\n */\nconst isPushSupported = (): boolean => {\n return isPushNotificationsSupported();\n};\n\nexport interface AutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; slidedownPromptOptions?: IOneSignalAutoPromptOptions; }\nexport interface IOneSignalAutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; isInUpdateMode?: boolean; categoryOptions?: IOneSignalCategories; }\nexport interface IOneSignalCategories { positiveUpdateButton: string; negativeUpdateButton: string; savingButtonText: string; errorButtonText: string; updateMessage: string; tags: IOneSignalTagCategory[]; }\nexport interface IOneSignalTagCategory { tag: string; label: string; checked?: boolean; }\nexport type PushSubscriptionNamespaceProperties = { id: string | null | undefined; token: string | null | undefined; optedIn: boolean; };\nexport type SubscriptionChangeEvent = { previous: PushSubscriptionNamespaceProperties; current: PushSubscriptionNamespaceProperties; };\nexport type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';\nexport type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';\nexport type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;\nexport interface IOSNotification {\n /**\n * The OneSignal notification id;\n * - Primary id on OneSignal's REST API and dashboard\n */\n readonly notificationId: string;\n\n /**\n * Visible title text on the notification\n */\n readonly title?: string;\n\n /**\n * Visible body text on the notification\n */\n readonly body: string;\n\n /**\n * Visible icon the notification; URL format\n */\n readonly icon?: string;\n\n /**\n * Visible small badgeIcon that displays on some devices; URL format\n * Example: On Android's status bar\n */\n readonly badgeIcon?: string;\n\n /**\n * Visible image on the notification; URL format\n */\n readonly image?: string;\n\n /**\n * Visible buttons on the notification\n */\n readonly actionButtons?: IOSNotificationActionButton[];\n\n /**\n * If this value is the same as existing notification, it will replace it\n * Can be set when creating the notification with \"Web Push Topic\" on the dashboard\n * or web_push_topic from the REST API.\n */\n readonly topic?: string;\n\n /**\n * Custom object that was sent with the notification;\n * definable when creating the notification from the OneSignal REST API or dashboard\n */\n readonly additionalData?: object;\n\n /**\n * URL to open when clicking or tapping on the notification\n */\n readonly launchURL?: string;\n\n /**\n * Confirm the push was received by reporting back to OneSignal\n */\n readonly confirmDelivery: boolean;\n}\n\nexport interface IOSNotificationActionButton {\n /**\n * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker\n * and host page through events to identify which button was clicked.\n * e.g. 'like-button'\n */\n readonly actionId: string;\n /**\n * The notification action button's text.\n */\n readonly text: string;\n /**\n * A valid publicly reachable HTTPS URL to an image.\n */\n readonly icon?: string;\n /**\n * The URL to open the web browser to when this action button is clicked.\n */\n readonly launchURL?: string;\n}\n\nexport interface IDisplayableOSNotification extends IOSNotification {\n display(): void;\n}\n\nexport interface NotificationClickResult {\n readonly actionId?: string;\n readonly url?: string;\n}\n\nexport type NotificationEventTypeMap = {\n 'click': NotificationClickEvent;\n 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;\n 'dismiss': NotificationDismissEvent;\n 'permissionChange': boolean;\n 'permissionPromptDisplay': void;\n};\n\nexport interface NotificationForegroundWillDisplayEvent {\n readonly notification: IDisplayableOSNotification;\n preventDefault(): void;\n}\n\nexport interface NotificationDismissEvent {\n notification: IOSNotification;\n}\n\nexport interface NotificationClickEvent {\n readonly notification: IOSNotification;\n readonly result: NotificationClickResult;\n}\n\nexport type UserChangeEvent = {\n current: UserNamespaceProperties;\n};\nexport type UserNamespaceProperties = {\n onesignalId: string | undefined;\n externalId: string | undefined;\n};\n\nexport interface IInitObject {\n appId: string;\n requiresUserPrivacyConsent?: boolean;\n safari_web_id?: string;\n subdomainName?: string;\n promptOptions?: {\n slidedown: {\n prompts: {\n /**\n * Whether to automatically display the prompt.\n * `true` will display the prompt based on the delay options.\n * `false` will prevent the prompt from displaying until the Slidedowns methods are used.\n */\n autoPrompt: boolean;\n\n /**\n * Only available for type: category. Up to 10 categories.\n * @example\n * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see \"Local News\" in the prompt.\n */\n categories?: {\n /** Should identify the action. */\n tag: string;\n\n /** What the user will see. */\n label: string;\n }[];\n\n /**\n * The delay options for the prompt.\n * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.\n */\n delay: {\n /** The number of pages a user needs to visit before the prompt is displayed. */\n pageViews?: number;\n\n /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */\n timeDelay?: number;\n };\n\n /**\n * The text to display in the prompt.\n */\n text?: {\n /** The callout asking the user to opt-in. Up to 90 characters. */\n actionMessage?: string;\n\n /** Triggers the opt-in. Up to 15 characters. */\n acceptButton?: string;\n\n /** Cancels opt-in. Up to 15 characters. */\n cancelButton?: string;\n\n /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */\n confirmMessage?: string;\n\n /** Identifies the email text field. Up to 15 characters. */\n emailLabel?: string;\n\n /** Cancels the category update. Up to 15 characters. */\n negativeUpdateButton?: string;\n\n /** Saves the updated category tags. Up to 15 characters. */\n positiveUpdateButton?: string;\n\n /** Identifies the phone number text field. Up to 15 characters. */\n smsLabel?: string;\n\n /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */\n updateMessage?: string;\n };\n\n /**\n * The type of prompt to display.\n * `push` which is the Slide Prompt without categories.\n * `category` which is the Slide Prompt with categories.\n * `sms` only asks for phone number.\n * `email` only asks for email address.\n * `smsAndEmail` asks for both phone number and email address.\n */\n type: 'push' | 'category' | 'sms' | 'email' | 'smsAndEmail';\n }[];\n };\n };\n welcomeNotification?: {\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n * @deprecated Use 'disable' instead. This will be removed in a future version.\n */\n disabled?: boolean;\n\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n */\n disable?: boolean;\n\n /**\n * The welcome notification's message. You can localize this to your own language.\n * If left blank or set to blank, the default of 'Thanks for subscribing!' will be used.\n */\n message: string;\n\n /**\n * The welcome notification's title. You can localize this to your own language. If not set, or left blank, the site's title will be used.\n * Set to one space ' ' to clear the title, although this is not recommended.\n */\n title?: string;\n\n /**\n * By default, clicking the welcome notification does not open any link.\n * This is recommended because the user has just visited your site and subscribed.\n */\n url?: string;\n };\n\n /**\n * Will enable customization of the notify/subscription bell button.\n */\n notifyButton?: {\n /**\n * A function you define that returns true to show the Subscription Bell, or false to hide it.\n * Typically used the hide the Subscription Bell after the user is subscribed.\n * This function is not re-evaluated on every state change; this function is only evaluated once when the Subscription Bell begins to show.\n */\n displayPredicate?: () => boolean | Promise<boolean>;\n\n /**\n * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.\n */\n enable?: boolean;\n\n /** Specify CSS-valid pixel offsets using bottom, left, and right. */\n offset?: { bottom: string; left: string; right: string };\n\n /**\n * If `true`, the Subscription Bell will display an icon that there is 1 unread message.\n * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.\n */\n prenotify: boolean;\n\n /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */\n position?: 'bottom-left' | 'bottom-right';\n\n /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */\n showCredit: boolean;\n\n /**\n * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.\n */\n size?: 'small' | 'medium' | 'large';\n\n /** Customize the Subscription Bell text. */\n text: {\n 'dialog.blocked.message': string;\n 'dialog.blocked.title': string;\n 'dialog.main.button.subscribe': string;\n 'dialog.main.button.unsubscribe': string;\n 'dialog.main.title': string;\n 'message.action.resubscribed': string;\n 'message.action.subscribed': string;\n 'message.action.subscribing': string;\n 'message.action.unsubscribed': string;\n 'message.prenotify': string;\n 'tip.state.blocked': string;\n 'tip.state.subscribed': string;\n 'tip.state.unsubscribed': string;\n };\n };\n\n persistNotification?: boolean;\n webhooks?: {\n /**\n * Enable this setting only if your server has CORS enabled and supports non-simple CORS requests.\n * If this setting is disabled, your webhook will not need CORS to receive data, but it will not receive the custom headers.\n * The simplest option is to leave it disabled.\n * @default false\n */\n cors: boolean;\n\n /**\n * This event occurs after a notification is clicked.\n * @example https://site.com/hook\n */\n 'notification.clicked'?: string;\n\n /**\n * This event occurs after a notification is intentionally dismissed by the user (clicking the notification body or one of the notification action buttons does not trigger the dismissed webhook),\n * after a group of notifications are all dismissed (with this notification as part of that group), or after a notification expires on its own time and disappears. This event is supported on Chrome only.\n * @example https://site.com/hook\n */\n 'notification.dismissed'?: string;\n\n /**\n * This event occurs after a notification is displayed.\n * @example https://site.com/hook\n */\n 'notification.willDisplay'?: string;\n };\n autoResubscribe?: boolean;\n autoRegister?: boolean;\n notificationClickHandlerMatch?: 'exact' | 'origin';\n notificationClickHandlerAction?: 'navigate' | 'focus';\n path?: string;\n serviceWorkerParam?: { scope: string };\n serviceWorkerPath?: string;\n serviceWorkerOverrideForTypical?: boolean;\n /**\n * Overrides the default OneSignal SDK script URL.\n * Use this to self-host the SDK script on your own domain, e.g. to comply\n * with strict Cross-Origin-Embedder-Policy (COEP) or Content-Security-Policy (CSP) headers.\n * @default 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js'\n */\n scriptSrc?: string;\n [key: string]: unknown;\n}\n\nexport interface IOneSignalOneSignal {\n\tSlidedown: IOneSignalSlidedown;\n\tNotifications: IOneSignalNotifications;\n\tSession: IOneSignalSession;\n\tUser: IOneSignalUser;\n\tDebug: IOneSignalDebug;\n\tlogin(externalId: string, jwtToken?: string): Promise<void>;\n\tlogout(): Promise<void>;\n\tinit(options: IInitObject): Promise<void>;\n\tsetConsentGiven(consent: boolean): Promise<void>;\n\tsetConsentRequired(requiresConsent: boolean): Promise<void>;\n}\nexport interface IOneSignalNotifications {\n\tpermissionNative: NotificationPermission;\n\tpermission: boolean;\n\tsetDefaultUrl(url: string): Promise<void>;\n\tsetDefaultTitle(title: string): Promise<void>;\n\tisPushSupported(): boolean;\n\trequestPermission(): Promise<boolean>;\n\taddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n\tremoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n}\nexport interface IOneSignalSlidedown {\n\tpromptPush(options?: AutoPromptOptions): Promise<void>;\n\tpromptPushCategories(options?: AutoPromptOptions): Promise<void>;\n\tpromptSms(options?: AutoPromptOptions): Promise<void>;\n\tpromptEmail(options?: AutoPromptOptions): Promise<void>;\n\tpromptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;\n\taddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n\tremoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n}\nexport interface IOneSignalDebug {\n\tsetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;\n}\nexport interface IOneSignalSession {\n\tsendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;\n\tsendUniqueOutcome(outcomeName: string): Promise<void>;\n}\nexport interface IOneSignalUser {\n\tonesignalId: string | undefined;\n\texternalId: string | undefined;\n\tPushSubscription: IOneSignalPushSubscription;\n\taddAlias(label: string, id: string): void;\n\taddAliases(aliases: { [key: string]: string }): void;\n\tremoveAlias(label: string): void;\n\tremoveAliases(labels: string[]): void;\n\taddEmail(email: string): void;\n\tremoveEmail(email: string): void;\n\taddSms(smsNumber: string): void;\n\tremoveSms(smsNumber: string): void;\n\taddTag(key: string, value: string): void;\n\taddTags(tags: { [key: string]: string }): void;\n\tremoveTag(key: string): void;\n\tremoveTags(keys: string[]): void;\n\tgetTags(): { [key: string]: string };\n\taddEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;\n\tremoveEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;\n\tsetLanguage(language: string): void;\n\tgetLanguage(): string;\n\ttrackEvent(name: string, properties?: Record<string, unknown>): void;\n}\nexport interface IOneSignalPushSubscription {\n\tid: string | null | undefined;\n\ttoken: string | null | undefined;\n\toptedIn: boolean | undefined;\n\toptIn(): Promise<void>;\n\toptOut(): Promise<void>;\n\taddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n\tremoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n}\nfunction oneSignalLogin(externalId: string, jwtToken?: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.login(externalId, jwtToken)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalLogout(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.logout()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentGiven(consent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentGiven(consent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentRequired(requiresConsent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentRequired(requiresConsent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPush(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPush(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPushCategories(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPushCategories(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSms(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSms(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSmsAndEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSmsAndEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownAddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.addEventListener(event, listener);\n });\n \n}\nfunction slidedownRemoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.removeEventListener(event, listener);\n });\n \n}\nfunction notificationsSetDefaultUrl(url: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultUrl(url)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsSetDefaultTitle(title: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultTitle(title)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsRequestPermission(): Promise<boolean> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.requestPermission()\n .then(result => resolve(result))\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsAddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.addEventListener(event, listener);\n });\n \n}\nfunction notificationsRemoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.removeEventListener(event, listener);\n });\n \n}\nfunction sessionSendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendOutcome(outcomeName, outcomeWeight)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction sessionSendUniqueOutcome(outcomeName: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendUniqueOutcome(outcomeName)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction userAddAlias(label: string, id: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAlias(label, id);\n });\n \n}\nfunction userAddAliases(aliases: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAliases(aliases);\n });\n \n}\nfunction userRemoveAlias(label: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAlias(label);\n });\n \n}\nfunction userRemoveAliases(labels: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAliases(labels);\n });\n \n}\nfunction userAddEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEmail(email);\n });\n \n}\nfunction userRemoveEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEmail(email);\n });\n \n}\nfunction userAddSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addSms(smsNumber);\n });\n \n}\nfunction userRemoveSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeSms(smsNumber);\n });\n \n}\nfunction userAddTag(key: string, value: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTag(key, value);\n });\n \n}\nfunction userAddTags(tags: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTags(tags);\n });\n \n}\nfunction userRemoveTag(key: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTag(key);\n });\n \n}\nfunction userRemoveTags(keys: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTags(keys);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetTags(): { [key: string]: string } {\n let retVal: { [key: string]: string };\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getTags();\n });\n return retVal;\n}\nfunction userAddEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEventListener(event, listener);\n });\n \n}\nfunction userRemoveEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEventListener(event, listener);\n });\n \n}\nfunction userSetLanguage(language: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.setLanguage(language);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetLanguage(): string {\n let retVal: string;\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getLanguage();\n });\n return retVal;\n}\nfunction userTrackEvent(name: string, properties?: Record<string, unknown>): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.trackEvent(name, properties);\n });\n \n}\nfunction pushSubscriptionOptIn(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optIn()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionOptOut(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optOut()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionAddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.addEventListener(event, listener);\n });\n \n}\nfunction pushSubscriptionRemoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.removeEventListener(event, listener);\n });\n \n}\nfunction debugSetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Debug.setLogLevel(logLevel);\n });\n \n}\nconst PushSubscriptionNamespace: IOneSignalPushSubscription = {\n\tget id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id; },\n\tget token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token; },\n\tget optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn; },\n\toptIn: pushSubscriptionOptIn,\n\toptOut: pushSubscriptionOptOut,\n\taddEventListener: pushSubscriptionAddEventListener,\n\tremoveEventListener: pushSubscriptionRemoveEventListener,\n};\n\nconst UserNamespace: IOneSignalUser = {\n\tget onesignalId(): string | undefined { return window.OneSignal?.User?.onesignalId; },\n\tget externalId(): string | undefined { return window.OneSignal?.User?.externalId; },\n\taddAlias: userAddAlias,\n\taddAliases: userAddAliases,\n\tremoveAlias: userRemoveAlias,\n\tremoveAliases: userRemoveAliases,\n\taddEmail: userAddEmail,\n\tremoveEmail: userRemoveEmail,\n\taddSms: userAddSms,\n\tremoveSms: userRemoveSms,\n\taddTag: userAddTag,\n\taddTags: userAddTags,\n\tremoveTag: userRemoveTag,\n\tremoveTags: userRemoveTags,\n\tgetTags: userGetTags,\n\taddEventListener: userAddEventListener,\n\tremoveEventListener: userRemoveEventListener,\n\tsetLanguage: userSetLanguage,\n\tgetLanguage: userGetLanguage,\n\ttrackEvent: userTrackEvent,\n\tPushSubscription: PushSubscriptionNamespace,\n};\n\nconst SessionNamespace: IOneSignalSession = {\n\tsendOutcome: sessionSendOutcome,\n\tsendUniqueOutcome: sessionSendUniqueOutcome,\n};\n\nconst DebugNamespace: IOneSignalDebug = {\n\tsetLogLevel: debugSetLogLevel,\n};\n\nconst SlidedownNamespace: IOneSignalSlidedown = {\n\tpromptPush: slidedownPromptPush,\n\tpromptPushCategories: slidedownPromptPushCategories,\n\tpromptSms: slidedownPromptSms,\n\tpromptEmail: slidedownPromptEmail,\n\tpromptSmsAndEmail: slidedownPromptSmsAndEmail,\n\taddEventListener: slidedownAddEventListener,\n\tremoveEventListener: slidedownRemoveEventListener,\n};\n\nconst NotificationsNamespace: IOneSignalNotifications = {\n\tget permissionNative(): NotificationPermission { return window.OneSignal?.Notifications?.permissionNative ?? 'default'; },\n\tget permission(): boolean { return window.OneSignal?.Notifications?.permission ?? false; },\n\tsetDefaultUrl: notificationsSetDefaultUrl,\n\tsetDefaultTitle: notificationsSetDefaultTitle,\n\tisPushSupported,\n\trequestPermission: notificationsRequestPermission,\n\taddEventListener: notificationsAddEventListener,\n\tremoveEventListener: notificationsRemoveEventListener,\n};\n\nconst OneSignalNamespace: IOneSignalOneSignal = {\n\tlogin: oneSignalLogin,\n\tlogout: oneSignalLogout,\n\tinit,\n\tsetConsentGiven: oneSignalSetConsentGiven,\n\tsetConsentRequired: oneSignalSetConsentRequired,\n\tSlidedown: SlidedownNamespace,\n\tNotifications: NotificationsNamespace,\n\tSession: SessionNamespace,\n\tUser: UserNamespace,\n\tDebug: DebugNamespace,\n};\n\nconst OneSignalVuePlugin = {\n install(app: typeof VueApp) {\n app.prototype.$OneSignal = OneSignalNamespace as IOneSignalOneSignal;\n }\n}\n\nexport default OneSignalVuePlugin;\n"],"mappings":";;AAEA,MAAM,mBAAmB;AACzB,MAAM,qBACJ;AAEF,IAAI,yBAAyB;AAC7B,IAAI,0BAA0B;AAC9B,IAAI;AAIJ,IAAI,OAAO,WAAW,aACpB,OAAO,oBAAoB,OAAO,qBAAqB,EAAE;AAK3D,SAAS,gBAAgB;CACvB,0BAA0B;CAC1B,oCAAoB,IAAI,MAAM,mCAAmC,CAAC;CAClE,oBAAoB,KAAA;;AAGtB,SAAS,aAAa,WAAoB;CACxC,IAAI,SAAS,eAAe,iBAAiB,EAC3C;CAGF,MAAM,SAAS,SAAS,cAAc,SAAS;CAC/C,OAAO,KAAK;CACZ,OAAO,QAAQ;CACf,OAAO,MAAM,aAAa;CAI1B,OAAO,gBAAgB;EACrB,eAAe;;CAGjB,SAAS,KAAK,YAAY,OAAO;;;;;AA0BnC,MAAM,QAAQ,YAAwC;CACpD,IAAI,wBACF,OAAO,QAAQ,OAAO,oCAAoC;CAE5D,IAAI,CAAC,WAAW,CAAC,QAAQ,OACvB,OAAO,QAAQ,OAAO,4CAA4C;CAEpE,IAAI,CAAC,UACH,OAAO,QAAQ,OAAO,2BAA2B;CAKnD,IAAI,CAAC,8BAA8B,EACjC,OAAO,QAAQ,uBACb,IAAI,MAAM,wDAAwD,CACnE;CAIH,IAAI,QAAQ,qBAAqB,aAAa,KAAA,GAC5C,QAAQ,oBAAoB,UAAU,QAAQ,oBAAoB;CAGpE,aAAa,QAAQ,UAAU;CAE/B,OAAO,IAAI,SAAe,SAAS,WAAW;EAC5C,oBAAoB;EACpB,OAAO,mBAAm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EA0CxB;CACnB,OAAO,EAlCP,aAAa,kBAkCQ;CACrB;AAED,MAAM,qBAAqB,EACzB,QAAQ,KAAoB;CAC1B,IAAI,UAAU,aAAa;GAE9B"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import Vue from 'vue';\n\nconst ONESIGNAL_SDK_ID = 'onesignal-sdk';\nconst DEFAULT_SCRIPT_SRC =\n 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js';\n\nlet isOneSignalInitialized = false;\nlet isOneSignalScriptFailed = false;\nlet pendingInitReject: ((reason?: unknown) => void) | undefined;\n\nconst VueApp: any = Vue;\n\nif (typeof window !== 'undefined') {\n window.OneSignalDeferred = window.OneSignalDeferred || [];\n}\n\n/* H E L P E R S */\n\nfunction handleOnError() {\n isOneSignalScriptFailed = true;\n pendingInitReject?.(new Error('OneSignal script failed to load.'));\n pendingInitReject = undefined;\n}\n\nfunction addSDKScript(scriptSrc?: string) {\n if (document.getElementById(ONESIGNAL_SDK_ID)) {\n return;\n }\n\n const script = document.createElement('script');\n script.id = ONESIGNAL_SDK_ID;\n script.defer = true;\n script.src = scriptSrc || DEFAULT_SCRIPT_SRC;\n\n // Always resolve whether or not the script is successfully initialized.\n // This is important for users who may block cdn.onesignal.com w/ adblock.\n script.onerror = () => {\n handleOnError();\n };\n\n document.head.appendChild(script);\n}\n\n/* T Y P E D E C L A R A T I O N S */\n\ndeclare module 'vue/types/vue' {\n interface Vue {\n $OneSignal: IOneSignalOneSignal;\n }\n}\n\ndeclare global {\n interface Window {\n OneSignalDeferred?: OneSignalDeferredLoadedCallback[];\n OneSignal?: IOneSignalOneSignal;\n safari?: {\n pushNotification: any;\n };\n }\n}\n\n/* O N E S I G N A L A P I */\n\n/**\n * @PublicApi\n */\nconst init = (options: IInitObject): Promise<void> => {\n if (isOneSignalInitialized) {\n return Promise.reject(`OneSignal is already initialized.`);\n }\n if (!options || !options.appId) {\n return Promise.reject('You need to provide your OneSignal appId.');\n }\n if (!document) {\n return Promise.reject(`Document is not defined.`);\n }\n\n // Required: the CDN script silently exits on unsupported browsers without\n // draining OneSignalDeferred, so init() would hang forever otherwise.\n if (!isPushNotificationsSupported()) {\n return Promise.reject(\n new Error('This browser does not support Web Push notifications.'),\n );\n }\n\n // Handle both disabled and disable keys for welcome notification\n if (options.welcomeNotification?.disabled !== undefined) {\n options.welcomeNotification.disable = options.welcomeNotification.disabled;\n }\n\n addSDKScript(options.scriptSrc);\n\n return new Promise<void>((resolve, reject) => {\n pendingInitReject = reject;\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.init(options)\n .then(() => {\n isOneSignalInitialized = true;\n pendingInitReject = undefined;\n resolve();\n })\n .catch((err) => {\n pendingInitReject = undefined;\n reject(err);\n });\n });\n });\n};\n\n/**\n * The following code is copied directly from the native SDK source file BrowserSupportsPush.ts\n * S T A R T\n */\n\n// Checks if the browser supports push notifications by checking if specific\n// classes and properties on them exist\nfunction isPushNotificationsSupported() {\n return supportsVapidPush() || supportsSafariPush();\n}\n\nfunction isMacOSSafariInIframe(): boolean {\n // Fallback detection for Safari on macOS in an iframe context\n return (\n window.top !== window && // isContextIframe\n navigator.vendor === 'Apple Computer, Inc.' && // isSafari\n navigator.platform === 'MacIntel'\n ); // isMacOS\n}\n\nfunction supportsSafariPush(): boolean {\n return (\n (window.safari && typeof window.safari.pushNotification !== 'undefined') ||\n isMacOSSafariInIframe()\n );\n}\n\n// Does the browser support the standard Push API\nfunction supportsVapidPush(): boolean {\n return (\n typeof PushSubscriptionOptions !== 'undefined' &&\n PushSubscriptionOptions.prototype.hasOwnProperty('applicationServerKey')\n );\n}\n/* E N D */\n\n/**\n * @PublicApi\n */\nconst isPushSupported = (): boolean => {\n return isPushNotificationsSupported();\n};\n\nexport interface AutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; slidedownPromptOptions?: IOneSignalAutoPromptOptions; }\nexport interface IOneSignalAutoPromptOptions { force?: boolean; forceSlidedownOverNative?: boolean; isInUpdateMode?: boolean; categoryOptions?: IOneSignalCategories; }\nexport interface IOneSignalCategories { positiveUpdateButton: string; negativeUpdateButton: string; savingButtonText: string; errorButtonText: string; updateMessage: string; tags: IOneSignalTagCategory[]; }\nexport interface IOneSignalTagCategory { tag: string; label: string; checked?: boolean; }\nexport type PushSubscriptionNamespaceProperties = { id: string | null | undefined; token: string | null | undefined; optedIn: boolean; };\nexport type SubscriptionChangeEvent = { previous: PushSubscriptionNamespaceProperties; current: PushSubscriptionNamespaceProperties; };\nexport type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';\nexport type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown';\nexport type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;\nexport interface IOSNotification {\n /**\n * The OneSignal notification id;\n * - Primary id on OneSignal's REST API and dashboard\n */\n readonly notificationId: string;\n\n /**\n * Visible title text on the notification\n */\n readonly title?: string;\n\n /**\n * Visible body text on the notification\n */\n readonly body: string;\n\n /**\n * Visible icon the notification; URL format\n */\n readonly icon?: string;\n\n /**\n * Visible small badgeIcon that displays on some devices; URL format\n * Example: On Android's status bar\n */\n readonly badgeIcon?: string;\n\n /**\n * Visible image on the notification; URL format\n */\n readonly image?: string;\n\n /**\n * Visible buttons on the notification\n */\n readonly actionButtons?: IOSNotificationActionButton[];\n\n /**\n * If this value is the same as existing notification, it will replace it\n * Can be set when creating the notification with \"Web Push Topic\" on the dashboard\n * or web_push_topic from the REST API.\n */\n readonly topic?: string;\n\n /**\n * Custom object that was sent with the notification;\n * definable when creating the notification from the OneSignal REST API or dashboard\n */\n readonly additionalData?: object;\n\n /**\n * URL to open when clicking or tapping on the notification\n */\n readonly launchURL?: string;\n\n /**\n * Confirm the push was received by reporting back to OneSignal\n */\n readonly confirmDelivery: boolean;\n}\n\nexport interface IOSNotificationActionButton {\n /**\n * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker\n * and host page through events to identify which button was clicked.\n * e.g. 'like-button'\n */\n readonly actionId: string;\n /**\n * The notification action button's text.\n */\n readonly text: string;\n /**\n * A valid publicly reachable HTTPS URL to an image.\n */\n readonly icon?: string;\n /**\n * The URL to open the web browser to when this action button is clicked.\n */\n readonly launchURL?: string;\n}\n\nexport interface IDisplayableOSNotification extends IOSNotification {\n display(): void;\n}\n\nexport interface NotificationClickResult {\n readonly actionId?: string;\n readonly url?: string;\n}\n\nexport type NotificationEventTypeMap = {\n 'click': NotificationClickEvent;\n 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;\n 'dismiss': NotificationDismissEvent;\n 'permissionChange': boolean;\n 'permissionPromptDisplay': void;\n};\n\nexport interface NotificationForegroundWillDisplayEvent {\n readonly notification: IDisplayableOSNotification;\n preventDefault(): void;\n}\n\nexport interface NotificationDismissEvent {\n notification: IOSNotification;\n}\n\nexport interface NotificationClickEvent {\n readonly notification: IOSNotification;\n readonly result: NotificationClickResult;\n}\n\nexport type UserChangeEvent = {\n current: UserNamespaceProperties;\n};\nexport type UserJwtInvalidatedEvent = {\n externalId: string;\n};\nexport type UserEventName = 'change' | 'userJwtInvalidated';\nexport type UserEventTypeMap = {\n change: UserChangeEvent;\n userJwtInvalidated: UserJwtInvalidatedEvent;\n};\nexport type UserNamespaceProperties = {\n onesignalId: string | undefined;\n externalId: string | undefined;\n};\n\nexport interface IInitObject {\n appId: string;\n requiresUserPrivacyConsent?: boolean;\n safari_web_id?: string;\n subdomainName?: string;\n promptOptions?: {\n slidedown: {\n prompts: {\n /**\n * Whether to automatically display the prompt.\n * `true` will display the prompt based on the delay options.\n * `false` will prevent the prompt from displaying until the Slidedowns methods are used.\n */\n autoPrompt: boolean;\n\n /**\n * Only available for type: category. Up to 10 categories.\n * @example\n * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see \"Local News\" in the prompt.\n */\n categories?: {\n /** Should identify the action. */\n tag: string;\n\n /** What the user will see. */\n label: string;\n }[];\n\n /**\n * The delay options for the prompt.\n * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.\n */\n delay: {\n /** The number of pages a user needs to visit before the prompt is displayed. */\n pageViews?: number;\n\n /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */\n timeDelay?: number;\n };\n\n /**\n * The text to display in the prompt.\n */\n text?: {\n /** The callout asking the user to opt-in. Up to 90 characters. */\n actionMessage?: string;\n\n /** Triggers the opt-in. Up to 15 characters. */\n acceptButton?: string;\n\n /** Cancels opt-in. Up to 15 characters. */\n cancelButton?: string;\n\n /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */\n confirmMessage?: string;\n\n /** Identifies the email text field. Up to 15 characters. */\n emailLabel?: string;\n\n /** Cancels the category update. Up to 15 characters. */\n negativeUpdateButton?: string;\n\n /** Saves the updated category tags. Up to 15 characters. */\n positiveUpdateButton?: string;\n\n /** Identifies the phone number text field. Up to 15 characters. */\n smsLabel?: string;\n\n /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */\n updateMessage?: string;\n };\n\n /**\n * The type of prompt to display.\n * `push` which is the Slide Prompt without categories.\n * `category` which is the Slide Prompt with categories.\n * `sms` only asks for phone number.\n * `email` only asks for email address.\n * `smsAndEmail` asks for both phone number and email address.\n */\n type: 'push' | 'category' | 'sms' | 'email' | 'smsAndEmail';\n }[];\n };\n };\n welcomeNotification?: {\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n * @deprecated Use 'disable' instead. This will be removed in a future version.\n */\n disabled?: boolean;\n\n /**\n * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.\n */\n disable?: boolean;\n\n /**\n * The welcome notification's message. You can localize this to your own language.\n * If left blank or set to blank, the default of 'Thanks for subscribing!' will be used.\n */\n message: string;\n\n /**\n * The welcome notification's title. You can localize this to your own language. If not set, or left blank, the site's title will be used.\n * Set to one space ' ' to clear the title, although this is not recommended.\n */\n title?: string;\n\n /**\n * By default, clicking the welcome notification does not open any link.\n * This is recommended because the user has just visited your site and subscribed.\n */\n url?: string;\n };\n\n /**\n * Will enable customization of the notify/subscription bell button.\n */\n notifyButton?: {\n /**\n * A function you define that returns true to show the Subscription Bell, or false to hide it.\n * Typically used the hide the Subscription Bell after the user is subscribed.\n * This function is not re-evaluated on every state change; this function is only evaluated once when the Subscription Bell begins to show.\n */\n displayPredicate?: () => boolean | Promise<boolean>;\n\n /**\n * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.\n */\n enable?: boolean;\n\n /** Specify CSS-valid pixel offsets using bottom, left, and right. */\n offset?: { bottom: string; left: string; right: string };\n\n /**\n * If `true`, the Subscription Bell will display an icon that there is 1 unread message.\n * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.\n */\n prenotify: boolean;\n\n /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */\n position?: 'bottom-left' | 'bottom-right';\n\n /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */\n showCredit: boolean;\n\n /**\n * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.\n */\n size?: 'small' | 'medium' | 'large';\n\n /** Customize the Subscription Bell text. */\n text: {\n 'dialog.blocked.message': string;\n 'dialog.blocked.title': string;\n 'dialog.main.button.subscribe': string;\n 'dialog.main.button.unsubscribe': string;\n 'dialog.main.title': string;\n 'message.action.resubscribed': string;\n 'message.action.subscribed': string;\n 'message.action.subscribing': string;\n 'message.action.unsubscribed': string;\n 'message.prenotify': string;\n 'tip.state.blocked': string;\n 'tip.state.subscribed': string;\n 'tip.state.unsubscribed': string;\n };\n };\n\n persistNotification?: boolean;\n webhooks?: {\n /**\n * Enable this setting only if your server has CORS enabled and supports non-simple CORS requests.\n * If this setting is disabled, your webhook will not need CORS to receive data, but it will not receive the custom headers.\n * The simplest option is to leave it disabled.\n * @default false\n */\n cors: boolean;\n\n /**\n * This event occurs after a notification is clicked.\n * @example https://site.com/hook\n */\n 'notification.clicked'?: string;\n\n /**\n * This event occurs after a notification is intentionally dismissed by the user (clicking the notification body or one of the notification action buttons does not trigger the dismissed webhook),\n * after a group of notifications are all dismissed (with this notification as part of that group), or after a notification expires on its own time and disappears. This event is supported on Chrome only.\n * @example https://site.com/hook\n */\n 'notification.dismissed'?: string;\n\n /**\n * This event occurs after a notification is displayed.\n * @example https://site.com/hook\n */\n 'notification.willDisplay'?: string;\n };\n autoResubscribe?: boolean;\n autoRegister?: boolean;\n notificationClickHandlerMatch?: 'exact' | 'origin';\n notificationClickHandlerAction?: 'navigate' | 'focus';\n path?: string;\n serviceWorkerParam?: { scope: string };\n serviceWorkerPath?: string;\n serviceWorkerOverrideForTypical?: boolean;\n /**\n * Overrides the default OneSignal SDK script URL.\n * Use this to self-host the SDK script on your own domain, e.g. to comply\n * with strict Cross-Origin-Embedder-Policy (COEP) or Content-Security-Policy (CSP) headers.\n * @default 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js'\n */\n scriptSrc?: string;\n [key: string]: unknown;\n}\n\nexport interface IOneSignalOneSignal {\n\tSlidedown: IOneSignalSlidedown;\n\tNotifications: IOneSignalNotifications;\n\tSession: IOneSignalSession;\n\tUser: IOneSignalUser;\n\tDebug: IOneSignalDebug;\n\tlogin(externalId: string, jwtToken?: string): Promise<void>;\n\tlogout(): Promise<void>;\n\tupdateUserJwt(externalId: string, token: string): Promise<void>;\n\tinit(options: IInitObject): Promise<void>;\n\tsetConsentGiven(consent: boolean): Promise<void>;\n\tsetConsentRequired(requiresConsent: boolean): Promise<void>;\n}\nexport interface IOneSignalNotifications {\n\tpermissionNative: NotificationPermission;\n\tpermission: boolean;\n\tsetDefaultUrl(url: string): Promise<void>;\n\tsetDefaultTitle(title: string): Promise<void>;\n\tisPushSupported(): boolean;\n\trequestPermission(): Promise<boolean>;\n\taddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n\tremoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n}\nexport interface IOneSignalSlidedown {\n\tpromptPush(options?: AutoPromptOptions): Promise<void>;\n\tpromptPushCategories(options?: AutoPromptOptions): Promise<void>;\n\tpromptSms(options?: AutoPromptOptions): Promise<void>;\n\tpromptEmail(options?: AutoPromptOptions): Promise<void>;\n\tpromptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;\n\taddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n\tremoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;\n}\nexport interface IOneSignalDebug {\n\tsetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;\n}\nexport interface IOneSignalSession {\n\tsendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;\n\tsendUniqueOutcome(outcomeName: string): Promise<void>;\n}\nexport interface IOneSignalUser {\n\tonesignalId: string | undefined;\n\texternalId: string | undefined;\n\tPushSubscription: IOneSignalPushSubscription;\n\taddAlias(label: string, id: string): void;\n\taddAliases(aliases: { [key: string]: string }): void;\n\tremoveAlias(label: string): void;\n\tremoveAliases(labels: string[]): void;\n\taddEmail(email: string): void;\n\tremoveEmail(email: string): void;\n\taddSms(smsNumber: string): void;\n\tremoveSms(smsNumber: string): void;\n\taddTag(key: string, value: string): void;\n\taddTags(tags: { [key: string]: string }): void;\n\tremoveTag(key: string): void;\n\tremoveTags(keys: string[]): void;\n\tgetTags(): { [key: string]: string };\n\taddEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;\n\tremoveEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void;\n\tsetLanguage(language: string): void;\n\tgetLanguage(): string;\n\ttrackEvent(name: string, properties?: Record<string, unknown>): void;\n}\nexport interface IOneSignalPushSubscription {\n\tid: string | null | undefined;\n\ttoken: string | null | undefined;\n\toptedIn: boolean | undefined;\n\toptIn(): Promise<void>;\n\toptOut(): Promise<void>;\n\taddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n\tremoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;\n}\nfunction oneSignalLogin(externalId: string, jwtToken?: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.login(externalId, jwtToken)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalLogout(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.logout()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalUpdateUserJwt(externalId: string, token: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.updateUserJwt(externalId, token)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentGiven(consent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentGiven(consent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction oneSignalSetConsentRequired(requiresConsent: boolean): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.setConsentRequired(requiresConsent)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPush(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPush(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptPushCategories(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptPushCategories(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSms(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSms(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownPromptSmsAndEmail(options?: AutoPromptOptions): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.promptSmsAndEmail(options)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction slidedownAddEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.addEventListener(event, listener);\n });\n \n}\nfunction slidedownRemoveEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Slidedown.removeEventListener(event, listener);\n });\n \n}\nfunction notificationsSetDefaultUrl(url: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultUrl(url)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsSetDefaultTitle(title: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.setDefaultTitle(title)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsRequestPermission(): Promise<boolean> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.requestPermission()\n .then(result => resolve(result))\n .catch(error => reject(error));\n });\n });\n}\nfunction notificationsAddEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.addEventListener(event, listener);\n });\n \n}\nfunction notificationsRemoveEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Notifications.removeEventListener(event, listener);\n });\n \n}\nfunction sessionSendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendOutcome(outcomeName, outcomeWeight)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction sessionSendUniqueOutcome(outcomeName: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Session.sendUniqueOutcome(outcomeName)\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction userAddAlias(label: string, id: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAlias(label, id);\n });\n \n}\nfunction userAddAliases(aliases: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addAliases(aliases);\n });\n \n}\nfunction userRemoveAlias(label: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAlias(label);\n });\n \n}\nfunction userRemoveAliases(labels: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeAliases(labels);\n });\n \n}\nfunction userAddEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEmail(email);\n });\n \n}\nfunction userRemoveEmail(email: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEmail(email);\n });\n \n}\nfunction userAddSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addSms(smsNumber);\n });\n \n}\nfunction userRemoveSms(smsNumber: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeSms(smsNumber);\n });\n \n}\nfunction userAddTag(key: string, value: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTag(key, value);\n });\n \n}\nfunction userAddTags(tags: { [key: string]: string }): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addTags(tags);\n });\n \n}\nfunction userRemoveTag(key: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTag(key);\n });\n \n}\nfunction userRemoveTags(keys: string[]): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeTags(keys);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetTags(): { [key: string]: string } {\n let retVal: { [key: string]: string };\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getTags();\n });\n return retVal;\n}\nfunction userAddEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.addEventListener(event, listener);\n });\n \n}\nfunction userRemoveEventListener<K extends UserEventName>(event: K, listener: (obj: UserEventTypeMap[K]) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.removeEventListener(event, listener);\n });\n \n}\nfunction userSetLanguage(language: string): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.setLanguage(language);\n });\n \n}\n// @ts-expect-error - return non-Promise type despite needing to await OneSignalDeferred\nasync function userGetLanguage(): string {\n let retVal: string;\n await window.OneSignalDeferred?.push((OneSignal) => {\n retVal = OneSignal.User.getLanguage();\n });\n return retVal;\n}\nfunction userTrackEvent(name: string, properties?: Record<string, unknown>): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.trackEvent(name, properties);\n });\n \n}\nfunction pushSubscriptionOptIn(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optIn()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionOptOut(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (isOneSignalScriptFailed) {\n reject(new Error('OneSignal script failed to load.'));\n return;\n }\n\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.optOut()\n .then(() => resolve())\n .catch(error => reject(error));\n });\n });\n}\nfunction pushSubscriptionAddEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.addEventListener(event, listener);\n });\n \n}\nfunction pushSubscriptionRemoveEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.PushSubscription.removeEventListener(event, listener);\n });\n \n}\nfunction debugSetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.Debug.setLogLevel(logLevel);\n });\n \n}\nconst PushSubscriptionNamespace: IOneSignalPushSubscription = {\n\tget id(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.id; },\n\tget token(): string | null | undefined { return window.OneSignal?.User?.PushSubscription?.token; },\n\tget optedIn(): boolean | undefined { return window.OneSignal?.User?.PushSubscription?.optedIn; },\n\toptIn: pushSubscriptionOptIn,\n\toptOut: pushSubscriptionOptOut,\n\taddEventListener: pushSubscriptionAddEventListener,\n\tremoveEventListener: pushSubscriptionRemoveEventListener,\n};\n\nconst UserNamespace: IOneSignalUser = {\n\tget onesignalId(): string | undefined { return window.OneSignal?.User?.onesignalId; },\n\tget externalId(): string | undefined { return window.OneSignal?.User?.externalId; },\n\taddAlias: userAddAlias,\n\taddAliases: userAddAliases,\n\tremoveAlias: userRemoveAlias,\n\tremoveAliases: userRemoveAliases,\n\taddEmail: userAddEmail,\n\tremoveEmail: userRemoveEmail,\n\taddSms: userAddSms,\n\tremoveSms: userRemoveSms,\n\taddTag: userAddTag,\n\taddTags: userAddTags,\n\tremoveTag: userRemoveTag,\n\tremoveTags: userRemoveTags,\n\tgetTags: userGetTags,\n\taddEventListener: userAddEventListener,\n\tremoveEventListener: userRemoveEventListener,\n\tsetLanguage: userSetLanguage,\n\tgetLanguage: userGetLanguage,\n\ttrackEvent: userTrackEvent,\n\tPushSubscription: PushSubscriptionNamespace,\n};\n\nconst SessionNamespace: IOneSignalSession = {\n\tsendOutcome: sessionSendOutcome,\n\tsendUniqueOutcome: sessionSendUniqueOutcome,\n};\n\nconst DebugNamespace: IOneSignalDebug = {\n\tsetLogLevel: debugSetLogLevel,\n};\n\nconst SlidedownNamespace: IOneSignalSlidedown = {\n\tpromptPush: slidedownPromptPush,\n\tpromptPushCategories: slidedownPromptPushCategories,\n\tpromptSms: slidedownPromptSms,\n\tpromptEmail: slidedownPromptEmail,\n\tpromptSmsAndEmail: slidedownPromptSmsAndEmail,\n\taddEventListener: slidedownAddEventListener,\n\tremoveEventListener: slidedownRemoveEventListener,\n};\n\nconst NotificationsNamespace: IOneSignalNotifications = {\n\tget permissionNative(): NotificationPermission { return window.OneSignal?.Notifications?.permissionNative ?? 'default'; },\n\tget permission(): boolean { return window.OneSignal?.Notifications?.permission ?? false; },\n\tsetDefaultUrl: notificationsSetDefaultUrl,\n\tsetDefaultTitle: notificationsSetDefaultTitle,\n\tisPushSupported,\n\trequestPermission: notificationsRequestPermission,\n\taddEventListener: notificationsAddEventListener,\n\tremoveEventListener: notificationsRemoveEventListener,\n};\n\nconst OneSignalNamespace: IOneSignalOneSignal = {\n\tlogin: oneSignalLogin,\n\tlogout: oneSignalLogout,\n\tupdateUserJwt: oneSignalUpdateUserJwt,\n\tinit,\n\tsetConsentGiven: oneSignalSetConsentGiven,\n\tsetConsentRequired: oneSignalSetConsentRequired,\n\tSlidedown: SlidedownNamespace,\n\tNotifications: NotificationsNamespace,\n\tSession: SessionNamespace,\n\tUser: UserNamespace,\n\tDebug: DebugNamespace,\n};\n\nconst OneSignalVuePlugin = {\n install(app: typeof VueApp) {\n app.prototype.$OneSignal = OneSignalNamespace as IOneSignalOneSignal;\n }\n}\n\nexport default OneSignalVuePlugin;\n"],"mappings":";;AAEA,MAAM,mBAAmB;AACzB,MAAM,qBACJ;AAEF,IAAI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EACxH,IAAI,aAAsB;GAAE,OAAO,OAAO,WAAW,eAAe,cAAc;EAAO;EACzF,eAAe;EACf,iBAAiB;EACjB;EACA,mBAAmB;EACnB,kBAAkB;EAClB,qBAAqB;CAWe;CACpC,SAAS;EAtCT,aAAa;EACb,mBAAmB;CAqCK;CACxB,MAAM;EA/DN,IAAI,cAAkC;GAAE,OAAO,OAAO,WAAW,MAAM;EAAa;EACpF,IAAI,aAAiC;GAAE,OAAO,OAAO,WAAW,MAAM;EAAY;EAClF,UAAU;EACV,YAAY;EACZ,aAAa;EACb,eAAe;EACf,UAAU;EACV,aAAa;EACb,QAAQ;EACR,WAAW;EACX,QAAQ;EACR,SAAS;EACT,WAAW;EACX,YAAY;EACZ,SAAS;EACT,kBAAkB;EAClB,qBAAqB;EACrB,aAAa;EACb,aAAa;EACb,YAAY;EACZ,kBAAkB;GA9BlB,IAAI,KAAgC;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;GAAI;GAC3F,IAAI,QAAmC;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;GAAO;GACjG,IAAI,UAA+B;IAAE,OAAO,OAAO,WAAW,MAAM,kBAAkB;GAAS;GAC/F,OAAO;GACP,QAAQ;GACR,kBAAkB;GAClB,qBAAqB;EAwBqB;CA2CxB;CAClB,OAAO,EAnCP,aAAa,iBAmCO;AACrB;AAEA,MAAM,qBAAqB,EACzB,QAAQ,KAAoB;CAC1B,IAAI,UAAU,aAAa;AAC7B,EACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onesignal-vue",
3
- "version": "2.7.3",
3
+ "version": "2.8.0",
4
4
  "description": "Vue OneSignal Plugin: Make it easy to integrate OneSignal with your Vue App!",
5
5
  "type": "module",
6
6
  "contributors": [
@@ -28,11 +28,12 @@
28
28
  "vue": "^2.6.14"
29
29
  },
30
30
  "overrides": {
31
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.21"
31
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "typescript": "^6.0.3",
35
- "vite-plus": "0.1.21"
35
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
36
+ "vite-plus": "1.5.1"
36
37
  },
37
38
  "files": [
38
39
  "dist"
@@ -44,5 +45,5 @@
44
45
  "push notification",
45
46
  "vue"
46
47
  ],
47
- "packageManager": "bun@1.3.13"
48
+ "packageManager": "bun@1.4.5"
48
49
  }