diff --git a/.github/ISSUE_TEMPLATE/workflows/release-drafter.yml b/.github/ISSUE_TEMPLATE/workflows/release-drafter.yml deleted file mode 100644 index 82e66d26..00000000 --- a/.github/ISSUE_TEMPLATE/workflows/release-drafter.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Release Drafter - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - main - # pull_request event is required only for autolabeler - pull_request: - # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] - # pull_request_target event is required for autolabeler to support PRs from forks - # pull_request_target: - # types: [opened, reopened, synchronize] - -permissions: - contents: read - -jobs: - update_release_draft: - permissions: - # write permission is required to create a github release - contents: write - # write permission is required for autolabeler - # otherwise, read permission is required at least - pull-requests: write - runs-on: ubuntu-latest - steps: - # (Optional) GitHub Enterprise requires GHE_HOST variable set - #- name: Set GHE_HOST - # run: | - # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV - - # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: release-drafter/release-drafter@v5 - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index a7a42bde..00000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,27 +0,0 @@ -name-template: $RESOLVED_VERSION -tag-template: $RESOLVED_VERSION -categories: - - title: 🚀 Features - label: Enhancement / Feature - - title: 🐛 Bug Fixes - label: Bug - - title: 🧰 Improvements - label: Improvement - - title: down arrow Dependency Updates - label: Dependencies -change-template: '- $TITLE (#$NUMBER)' -version-resolver: - major: - labels: - - 'major' - minor: - labels: - - 'minor' - patch: - labels: - - 'patch' - default: patch -template: | - ## Other Changes - - $CHANGES diff --git a/.releaserc.json b/.releaserc.json index b1b9a2ab..3787f2e0 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -54,7 +54,7 @@ "@semantic-release/release-notes-generator", { "preset": "conventionalcommits", - "writerOpts": { + "presetConfig": { "types": [ { "type": "feat", diff --git a/dist/index.cjs b/dist/index.cjs deleted file mode 100644 index 2ab7cbc7..00000000 --- a/dist/index.cjs +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";const u="onesignal-sdk",l="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js";let d=!1,s=!1;typeof window<"u"&&(window.OneSignalDeferred=window.OneSignalDeferred||[],c());function f(){s=!0}function c(){const n=document.createElement("script");n.id=u,n.defer=!0,n.src=l,n.onerror=()=>{f()},document.head.appendChild(n)}function w(){return g()||S()}function p(){return window.top!==window&&navigator.vendor==="Apple Computer, Inc."&&navigator.platform==="MacIntel"}function S(){return window.safari&&typeof window.safari.pushNotification<"u"||p()}function g(){return typeof PushSubscriptionOptions<"u"&&PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey")}const m=()=>w(),h=n=>{var e;return d?Promise.reject("OneSignal is already initialized."):!n||!n.appId?Promise.reject("You need to provide your OneSignal appId."):document?(((e=n.welcomeNotification)==null?void 0:e.disabled)!==void 0&&(n.welcomeNotification.disable=n.welcomeNotification.disabled),new Promise((i,r)=>{var t;(t=window.OneSignalDeferred)==null||t.push(o=>{o.init(n).then(()=>{d=!0,i()}).catch(r)})})):Promise.reject("Document is not defined.")};function O(n,e){return new Promise((i,r)=>{var t;if(s){r(new Error("OneSignal script failed to load."));return}(t=window.OneSignalDeferred)==null||t.push(o=>{o.login(n,e).then(()=>i()).catch(a=>r(a))})})}function v(){return new Promise((n,e)=>{var i;if(s){e(new Error("OneSignal script failed to load."));return}(i=window.OneSignalDeferred)==null||i.push(r=>{r.logout().then(()=>n()).catch(t=>e(t))})})}function E(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.setConsentGiven(n).then(()=>e()).catch(o=>i(o))})})}function D(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.setConsentRequired(n).then(()=>e()).catch(o=>i(o))})})}function P(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Slidedown.promptPush(n).then(()=>e()).catch(o=>i(o))})})}function L(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Slidedown.promptPushCategories(n).then(()=>e()).catch(o=>i(o))})})}function U(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Slidedown.promptSms(n).then(()=>e()).catch(o=>i(o))})})}function A(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Slidedown.promptEmail(n).then(()=>e()).catch(o=>i(o))})})}function N(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Slidedown.promptSmsAndEmail(n).then(()=>e()).catch(o=>i(o))})})}function b(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.Slidedown.addEventListener(n,e)})}function I(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.Slidedown.removeEventListener(n,e)})}function T(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Notifications.setDefaultUrl(n).then(()=>e()).catch(o=>i(o))})})}function R(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Notifications.setDefaultTitle(n).then(()=>e()).catch(o=>i(o))})})}function C(){return new Promise((n,e)=>{var i;if(s){e(new Error("OneSignal script failed to load."));return}(i=window.OneSignalDeferred)==null||i.push(r=>{r.Notifications.requestPermission().then(t=>n(t)).catch(t=>e(t))})})}function y(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.Notifications.addEventListener(n,e)})}function q(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.Notifications.removeEventListener(n,e)})}function k(n,e){return new Promise((i,r)=>{var t;if(s){r(new Error("OneSignal script failed to load."));return}(t=window.OneSignalDeferred)==null||t.push(o=>{o.Session.sendOutcome(n,e).then(()=>i()).catch(a=>r(a))})})}function G(n){return new Promise((e,i)=>{var r;if(s){i(new Error("OneSignal script failed to load."));return}(r=window.OneSignalDeferred)==null||r.push(t=>{t.Session.sendUniqueOutcome(n).then(()=>e()).catch(o=>i(o))})})}function _(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.addAlias(n,e)})}function K(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.addAliases(n)})}function x(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.removeAlias(n)})}function V(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.removeAliases(n)})}function z(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.addEmail(n)})}function M(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.removeEmail(n)})}function F(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.addSms(n)})}function Y(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.removeSms(n)})}function B(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.addTag(n,e)})}function H(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.addTags(n)})}function J(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.removeTag(n)})}function Q(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.removeTags(n)})}async function W(){var e;let n;return await((e=window.OneSignalDeferred)==null?void 0:e.push(i=>{n=i.User.getTags()})),n}function X(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.addEventListener(n,e)})}function Z(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.removeEventListener(n,e)})}function $(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.User.setLanguage(n)})}async function j(){var e;let n;return await((e=window.OneSignalDeferred)==null?void 0:e.push(i=>{n=i.User.getLanguage()})),n}function ee(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.trackEvent(n,e)})}function ne(){return new Promise((n,e)=>{var i;if(s){e(new Error("OneSignal script failed to load."));return}(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.PushSubscription.optIn().then(()=>n()).catch(t=>e(t))})})}function ie(){return new Promise((n,e)=>{var i;if(s){e(new Error("OneSignal script failed to load."));return}(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.PushSubscription.optOut().then(()=>n()).catch(t=>e(t))})})}function re(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.PushSubscription.addEventListener(n,e)})}function te(n,e){var i;(i=window.OneSignalDeferred)==null||i.push(r=>{r.User.PushSubscription.removeEventListener(n,e)})}function oe(n){var e;(e=window.OneSignalDeferred)==null||e.push(i=>{i.Debug.setLogLevel(n)})}const se={get id(){var n,e,i;return(i=(e=(n=window.OneSignal)==null?void 0:n.User)==null?void 0:e.PushSubscription)==null?void 0:i.id},get token(){var n,e,i;return(i=(e=(n=window.OneSignal)==null?void 0:n.User)==null?void 0:e.PushSubscription)==null?void 0:i.token},get optedIn(){var n,e,i;return(i=(e=(n=window.OneSignal)==null?void 0:n.User)==null?void 0:e.PushSubscription)==null?void 0:i.optedIn},optIn:ne,optOut:ie,addEventListener:re,removeEventListener:te},ae={get onesignalId(){var n,e;return(e=(n=window.OneSignal)==null?void 0:n.User)==null?void 0:e.onesignalId},get externalId(){var n,e;return(e=(n=window.OneSignal)==null?void 0:n.User)==null?void 0:e.externalId},addAlias:_,addAliases:K,removeAlias:x,removeAliases:V,addEmail:z,removeEmail:M,addSms:F,removeSms:Y,addTag:B,addTags:H,removeTag:J,removeTags:Q,getTags:W,addEventListener:X,removeEventListener:Z,setLanguage:$,getLanguage:j,trackEvent:ee,PushSubscription:se},de={sendOutcome:k,sendUniqueOutcome:G},ue={setLogLevel:oe},le={promptPush:P,promptPushCategories:L,promptSms:U,promptEmail:A,promptSmsAndEmail:N,addEventListener:b,removeEventListener:I},fe={get permissionNative(){var n,e;return((e=(n=window.OneSignal)==null?void 0:n.Notifications)==null?void 0:e.permissionNative)??"default"},get permission(){var n,e;return((e=(n=window.OneSignal)==null?void 0:n.Notifications)==null?void 0:e.permission)??!1},setDefaultUrl:T,setDefaultTitle:R,isPushSupported:m,requestPermission:C,addEventListener:y,removeEventListener:q},ce={login:O,logout:v,init:h,setConsentGiven:E,setConsentRequired:D,Slidedown:le,Notifications:fe,Session:de,User:ae,Debug:ue},we=ce;module.exports=we; -//# sourceMappingURL=index.cjs.map diff --git a/dist/index.cjs.map b/dist/index.cjs.map deleted file mode 100644 index 748ea18b..00000000 --- a/dist/index.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.cjs","sources":["../index.ts"],"sourcesContent":["const ONESIGNAL_SDK_ID = 'onesignal-sdk';\nconst ONE_SIGNAL_SCRIPT_SRC =\n 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js';\n\n// true if the script is successfully loaded from CDN.\nlet isOneSignalInitialized = false;\n// true if the script fails to load from CDN. A separate flag is necessary\n// to disambiguate between a CDN load failure and a delayed call to\n// OneSignal#init.\nlet isOneSignalScriptFailed = false;\n\nif (typeof window !== 'undefined') {\n window.OneSignalDeferred = window.OneSignalDeferred || [];\n addSDKScript();\n}\n\ndeclare global {\n interface Window {\n OneSignalDeferred?: OneSignalDeferredLoadedCallback[];\n OneSignal?: IOneSignalOneSignal;\n safari?: {\n pushNotification: any;\n };\n }\n}\n\n/* H E L P E R S */\n\nfunction handleOnError() {\n isOneSignalScriptFailed = true;\n}\n\nfunction addSDKScript() {\n const script = document.createElement('script');\n script.id = ONESIGNAL_SDK_ID;\n script.defer = true;\n script.src = ONE_SIGNAL_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/**\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 * This is a SPECIAL FUNCTION\n * It is a hardcoded implementation copied from the upstream/native WebSDK since we want to return a boolean immediately\n * Natively, this is done via the shimloading mechanism (i.e. if the SDK loads, push is supported)\n * @PublicApi\n */\nconst isPushSupported = (): boolean => {\n return isPushNotificationsSupported();\n};\n\n/**\n * @PublicApi\n */\nconst init = (options: IInitObject): Promise => {\n if (isOneSignalInitialized) {\n return Promise.reject(`OneSignal is already initialized.`);\n }\n\n if (!options || !options.appId) {\n return Promise.reject('You need to provide your OneSignal appId.');\n }\n\n if (!document) {\n return Promise.reject(`Document is not defined.`);\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 return new Promise((resolve, reject) => {\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.init(options)\n .then(() => {\n isOneSignalInitialized = true;\n resolve();\n })\n .catch(reject);\n });\n });\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 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: IOSNotification;\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 subdomainName?: string;\n requiresUserPrivacyConsent?: boolean;\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 cancelMessage?: 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;\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?: string;\n notificationClickHandlerAction?: string;\n path?: string;\n serviceWorkerParam?: { scope: string };\n serviceWorkerPath?: string;\n serviceWorkerOverrideForTypical?: boolean;\n serviceWorkerUpdaterPath?: string;\n allowLocalhostAsSecureOrigin?: boolean;\n [key: string]: any;\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;\n\tlogout(): Promise;\n\tinit(options: IInitObject): Promise;\n\tsetConsentGiven(consent: boolean): Promise;\n\tsetConsentRequired(requiresConsent: boolean): Promise;\n}\nexport interface IOneSignalNotifications {\n\tpermissionNative: NotificationPermission;\n\tpermission: boolean;\n\tsetDefaultUrl(url: string): Promise;\n\tsetDefaultTitle(title: string): Promise;\n\tisPushSupported(): boolean;\n\trequestPermission(): Promise;\n\taddEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n\tremoveEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n}\nexport interface IOneSignalSlidedown {\n\tpromptPush(options?: AutoPromptOptions): Promise;\n\tpromptPushCategories(options?: AutoPromptOptions): Promise;\n\tpromptSms(options?: AutoPromptOptions): Promise;\n\tpromptEmail(options?: AutoPromptOptions): Promise;\n\tpromptSmsAndEmail(options?: AutoPromptOptions): Promise;\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;\n\tsendUniqueOutcome(outcomeName: string): Promise;\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): void;\n}\nexport interface IOneSignalPushSubscription {\n\tid: string | null | undefined;\n\ttoken: string | null | undefined;\n\toptedIn: boolean | undefined;\n\toptIn(): Promise;\n\toptOut(): Promise;\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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(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(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 {\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 {\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): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.trackEvent(name, properties);\n });\n \n}\nfunction pushSubscriptionOptIn(): Promise {\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 {\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 OneSignal = OneSignalNamespace;\nexport default OneSignal;\n"],"names":["ONESIGNAL_SDK_ID","ONE_SIGNAL_SCRIPT_SRC","isOneSignalInitialized","isOneSignalScriptFailed","addSDKScript","handleOnError","script","isPushNotificationsSupported","supportsVapidPush","supportsSafariPush","isMacOSSafariInIframe","isPushSupported","init","options","_a","resolve","reject","OneSignal","oneSignalLogin","externalId","jwtToken","error","oneSignalLogout","oneSignalSetConsentGiven","consent","oneSignalSetConsentRequired","requiresConsent","slidedownPromptPush","slidedownPromptPushCategories","slidedownPromptSms","slidedownPromptEmail","slidedownPromptSmsAndEmail","slidedownAddEventListener","event","listener","slidedownRemoveEventListener","notificationsSetDefaultUrl","url","notificationsSetDefaultTitle","title","notificationsRequestPermission","result","notificationsAddEventListener","notificationsRemoveEventListener","sessionSendOutcome","outcomeName","outcomeWeight","sessionSendUniqueOutcome","userAddAlias","label","id","userAddAliases","aliases","userRemoveAlias","userRemoveAliases","labels","userAddEmail","email","userRemoveEmail","userAddSms","smsNumber","userRemoveSms","userAddTag","key","value","userAddTags","tags","userRemoveTag","userRemoveTags","keys","userGetTags","retVal","userAddEventListener","userRemoveEventListener","userSetLanguage","language","userGetLanguage","userTrackEvent","name","properties","pushSubscriptionOptIn","pushSubscriptionOptOut","pushSubscriptionAddEventListener","pushSubscriptionRemoveEventListener","debugSetLogLevel","logLevel","PushSubscriptionNamespace","_c","_b","UserNamespace","SessionNamespace","DebugNamespace","SlidedownNamespace","NotificationsNamespace","OneSignalNamespace"],"mappings":"aAAA,MAAMA,EAAmB,gBACnBC,EACJ,8DAGF,IAAIC,EAAyB,GAIzBC,EAA0B,GAE1B,OAAO,OAAW,MACb,OAAA,kBAAoB,OAAO,mBAAqB,CAAC,EAC3CC,EAAA,GAef,SAASC,GAAgB,CACGF,EAAA,EAC5B,CAEA,SAASC,GAAe,CAChB,MAAAE,EAAS,SAAS,cAAc,QAAQ,EAC9CA,EAAO,GAAKN,EACZM,EAAO,MAAQ,GACfA,EAAO,IAAML,EAIbK,EAAO,QAAU,IAAM,CACPD,EAAA,CAChB,EAES,SAAA,KAAK,YAAYC,CAAM,CAClC,CASA,SAASC,GAA+B,CAC/B,OAAAC,KAAuBC,EAAmB,CACnD,CAEA,SAASC,GAAiC,CAExC,OACE,OAAO,MAAQ,QACf,UAAU,SAAW,wBACrB,UAAU,WAAa,UAE3B,CAEA,SAASD,GAA8B,CACrC,OACG,OAAO,QAAU,OAAO,OAAO,OAAO,iBAAqB,KAC5DC,EAAsB,CAE1B,CAGA,SAASF,GAA6B,CACpC,OACE,OAAO,wBAA4B,KACnC,wBAAwB,UAAU,eAAe,sBAAsB,CAE3E,CASA,MAAMG,EAAkB,IACfJ,EAA6B,EAMhCK,EAAQC,GAAwC,OACpD,OAAIX,EACK,QAAQ,OAAO,mCAAmC,EAGvD,CAACW,GAAW,CAACA,EAAQ,MAChB,QAAQ,OAAO,2CAA2C,EAG9D,YAKDC,EAAAD,EAAQ,sBAAR,YAAAC,EAA6B,YAAa,SACpCD,EAAA,oBAAoB,QAAUA,EAAQ,oBAAoB,UAG7D,IAAI,QAAc,CAACE,EAASC,IAAW,QACrCF,EAAA,OAAA,oBAAA,MAAAA,EAAmB,KAAMG,GAAc,CAC5CA,EAAU,KAAKJ,CAAO,EACnB,KAAK,IAAM,CACeX,EAAA,GACjBa,EAAA,CAAA,CACT,EACA,MAAMC,CAAM,CAAA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YAAaC,EACb,kBAAmBC,EACnB,iBAAkBC,EAClB,oBAAqBG,CACtB,EAEM0D,GAAkD,CACvD,IAAI,kBAA2C,SAAS,QAAAL,GAAA1E,EAAA,OAAO,YAAP,YAAAA,EAAkB,gBAAlB,YAAA0E,EAAiC,mBAAoB,SAAW,EACxH,IAAI,YAAsB,SAAS,QAAAA,GAAA1E,EAAA,OAAO,YAAP,YAAAA,EAAkB,gBAAlB,YAAA0E,EAAiC,aAAc,EAAO,EACzF,cAAepD,EACf,gBAAiBE,EACjB,gBAAA3B,EACA,kBAAmB6B,EACnB,iBAAkBE,EAClB,oBAAqBC,CACtB,EAEMmD,GAA0C,CAC/C,MAAO5E,EACP,OAAQI,EACR,KAAAV,EACA,gBAAiBW,EACjB,mBAAoBE,EACpB,UAAWmE,GACX,cAAeC,GACf,QAASH,GACT,KAAMD,GACN,MAAOE,EACR,EAEM1E,GAAY6E"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 16b13a07..00000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,408 +0,0 @@ -declare global { - interface Window { - OneSignalDeferred?: OneSignalDeferredLoadedCallback[]; - OneSignal?: IOneSignalOneSignal; - safari?: { - pushNotification: any; - }; - } -} -export interface AutoPromptOptions { - force?: boolean; - forceSlidedownOverNative?: boolean; - slidedownPromptOptions?: IOneSignalAutoPromptOptions; -} -export interface IOneSignalAutoPromptOptions { - force?: boolean; - forceSlidedownOverNative?: boolean; - isInUpdateMode?: boolean; - categoryOptions?: IOneSignalCategories; -} -export interface IOneSignalCategories { - positiveUpdateButton: string; - negativeUpdateButton: string; - savingButtonText: string; - errorButtonText: string; - updateMessage: string; - tags: IOneSignalTagCategory[]; -} -export interface IOneSignalTagCategory { - tag: string; - label: string; - checked?: boolean; -} -export type PushSubscriptionNamespaceProperties = { - id: string | null | undefined; - token: string | null | undefined; - optedIn: boolean; -}; -export type SubscriptionChangeEvent = { - previous: PushSubscriptionNamespaceProperties; - current: PushSubscriptionNamespaceProperties; -}; -export type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay'; -export type SlidedownEventName = 'slidedownAllowClick' | 'slidedownCancelClick' | 'slidedownClosed' | 'slidedownQueued' | 'slidedownShown'; -export type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void; -export interface IOSNotification { - /** - * The OneSignal notification id; - * - Primary id on OneSignal's REST API and dashboard - */ - readonly notificationId: string; - /** - * Visible title text on the notification - */ - readonly title?: string; - /** - * Visible body text on the notification - */ - readonly body: string; - /** - * Visible icon the notification; URL format - */ - readonly icon?: string; - /** - * Visible small badgeIcon that displays on some devices; URL format - * Example: On Android's status bar - */ - readonly badgeIcon?: string; - /** - * Visible image on the notification; URL format - */ - readonly image?: string; - /** - * Visible buttons on the notification - */ - readonly actionButtons?: IOSNotificationActionButton[]; - /** - * If this value is the same as existing notification, it will replace it - * Can be set when creating the notification with "Web Push Topic" on the dashboard - * or web_push_topic from the REST API. - */ - readonly topic?: string; - /** - * Custom object that was sent with the notification; - * definable when creating the notification from the OneSignal REST API or dashboard - */ - readonly additionalData?: object; - /** - * URL to open when clicking or tapping on the notification - */ - readonly launchURL?: string; - /** - * Confirm the push was received by reporting back to OneSignal - */ - readonly confirmDelivery: boolean; -} -export interface IOSNotificationActionButton { - /** - * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker - * and host page through events to identify which button was clicked. - * e.g. 'like-button' - */ - readonly actionId: string; - /** - * The notification action button's text. - */ - readonly text: string; - /** - * A valid publicly reachable HTTPS URL to an image. - */ - readonly icon?: string; - /** - * The URL to open the web browser to when this action button is clicked. - */ - readonly launchURL?: string; -} -export interface NotificationClickResult { - readonly actionId?: string; - readonly url?: string; -} -export type NotificationEventTypeMap = { - 'click': NotificationClickEvent; - 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent; - 'dismiss': NotificationDismissEvent; - 'permissionChange': boolean; - 'permissionPromptDisplay': void; -}; -export interface NotificationForegroundWillDisplayEvent { - readonly notification: IOSNotification; - preventDefault(): void; -} -export interface NotificationDismissEvent { - notification: IOSNotification; -} -export interface NotificationClickEvent { - readonly notification: IOSNotification; - readonly result: NotificationClickResult; -} -export type UserChangeEvent = { - current: UserNamespaceProperties; -}; -export type UserNamespaceProperties = { - onesignalId: string | undefined; - externalId: string | undefined; -}; -export interface IInitObject { - appId: string; - subdomainName?: string; - requiresUserPrivacyConsent?: boolean; - promptOptions?: { - slidedown: { - prompts: { - /** - * Whether to automatically display the prompt. - * `true` will display the prompt based on the delay options. - * `false` will prevent the prompt from displaying until the Slidedowns methods are used. - */ - autoPrompt: boolean; - /** - * Only available for type: category. Up to 10 categories. - * @example - * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see "Local News" in the prompt. - */ - categories: { - /** Should identify the action. */ - tag: string; - /** What the user will see. */ - label: string; - }[]; - /** - * The delay options for the prompt. - * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view. - */ - delay: { - /** 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 */ - timeDelay?: number; - }; - /** - * The text to display in the prompt. - */ - text?: { - /** The callout asking the user to opt-in. Up to 90 characters. */ - actionMessage?: string; - /** Triggers the opt-in. Up to 15 characters. */ - acceptButton?: string; - /** Cancels opt-in. Up to 15 characters. */ - cancelMessage?: string; - /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */ - confirmMessage?: string; - /** Identifies the email text field. Up to 15 characters. */ - emailLabel?: string; - /** Cancels the category update. Up to 15 characters. */ - negativeUpdateButton?: string; - /** Saves the updated category tags. Up to 15 characters. */ - positiveUpdateButton?: string; - /** Identifies the phone number text field. Up to 15 characters. */ - smsLabel?: string; - /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */ - updateMessage?: string; - }; - /** - * The type of prompt to display. - * `push` which is the Slide Prompt without categories. - * `category` which is the Slide Prompt with categories. - * `sms` only asks for phone number. - * `email` only asks for email address. - * `smsAndEmail` asks for both phone number and email address. - */ - type: 'push' | 'category' | 'sms' | 'email' | 'smsAndEmail'; - }[]; - }; - }; - welcomeNotification?: { - /** - * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need. - * @deprecated Use 'disable' instead. This will be removed in a future version. - */ - disabled?: boolean; - /** - * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need. - */ - disable?: boolean; - /** - * The welcome notification's message. You can localize this to your own language. - * If left blank or set to blank, the default of 'Thanks for subscribing!' will be used. - */ - message: string; - /** - * 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. - * Set to one space ' ' to clear the title, although this is not recommended. - */ - title?: string; - /** - * By default, clicking the welcome notification does not open any link. - * This is recommended because the user has just visited your site and subscribed. - */ - url?: string; - }; - /** - * Will enable customization of the notify/subscription bell button. - */ - notifyButton?: { - /** - * A function you define that returns true to show the Subscription Bell, or false to hide it. - * Typically used the hide the Subscription Bell after the user is subscribed. - * This function is not re-evaluated on every state change; this function is only evaluated once when the Subscription Bell begins to show. - */ - displayPredicate?: () => boolean | Promise; - /** - * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default. - */ - enable?: boolean; - /** Specify CSS-valid pixel offsets using bottom, left, and right. */ - offset?: { - bottom: string; - left: string; - right: string; - }; - /** - * If `true`, the Subscription Bell will display an icon that there is 1 unread message. - * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify. - */ - prenotify: boolean; - /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */ - position?: 'bottom-left' | 'bottom-right'; - /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */ - showCredit: boolean; - /** - * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes. - */ - size?: 'small' | 'medium' | 'large'; - /** Customize the Subscription Bell text. */ - text: { - 'dialog.blocked.message': string; - 'dialog.blocked.title': string; - 'dialog.main.button.subscribe': string; - 'dialog.main.button.unsubscribe': string; - 'dialog.main.title': string; - 'message.action.resubscribed': string; - 'message.action.subscribed': string; - 'message.action.subscribing': string; - 'message.action.unsubscribed': string; - 'message.prenotify': string; - 'tip.state.blocked': string; - 'tip.state.subscribed': string; - 'tip.state.unsubscribed': string; - }; - }; - persistNotification?: boolean; - webhooks?: { - /** - * Enable this setting only if your server has CORS enabled and supports non-simple CORS requests. - * If this setting is disabled, your webhook will not need CORS to receive data, but it will not receive the custom headers. - * The simplest option is to leave it disabled. - * @default false - */ - cors: boolean; - /** - * This event occurs after a notification is clicked. - * @example https://site.com/hook - */ - 'notification.clicked'?: string; - /** - * 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), - * 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. - * @example https://site.com/hook - */ - 'notification.dismissed'?: string; - /** - * This event occurs after a notification is displayed. - * @example https://site.com/hook - */ - 'notification.willDisplay'?: string; - }; - autoResubscribe?: boolean; - autoRegister?: boolean; - notificationClickHandlerMatch?: string; - notificationClickHandlerAction?: string; - path?: string; - serviceWorkerParam?: { - scope: string; - }; - serviceWorkerPath?: string; - serviceWorkerOverrideForTypical?: boolean; - serviceWorkerUpdaterPath?: string; - allowLocalhostAsSecureOrigin?: boolean; - [key: string]: any; -} -export interface IOneSignalOneSignal { - Slidedown: IOneSignalSlidedown; - Notifications: IOneSignalNotifications; - Session: IOneSignalSession; - User: IOneSignalUser; - Debug: IOneSignalDebug; - login(externalId: string, jwtToken?: string): Promise; - logout(): Promise; - init(options: IInitObject): Promise; - setConsentGiven(consent: boolean): Promise; - setConsentRequired(requiresConsent: boolean): Promise; -} -export interface IOneSignalNotifications { - permissionNative: NotificationPermission; - permission: boolean; - setDefaultUrl(url: string): Promise; - setDefaultTitle(title: string): Promise; - isPushSupported(): boolean; - requestPermission(): Promise; - addEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void; - removeEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void; -} -export interface IOneSignalSlidedown { - promptPush(options?: AutoPromptOptions): Promise; - promptPushCategories(options?: AutoPromptOptions): Promise; - promptSms(options?: AutoPromptOptions): Promise; - promptEmail(options?: AutoPromptOptions): Promise; - promptSmsAndEmail(options?: AutoPromptOptions): Promise; - addEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void; - removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void; -} -export interface IOneSignalDebug { - setLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void; -} -export interface IOneSignalSession { - sendOutcome(outcomeName: string, outcomeWeight?: number): Promise; - sendUniqueOutcome(outcomeName: string): Promise; -} -export interface IOneSignalUser { - onesignalId: string | undefined; - externalId: string | undefined; - PushSubscription: IOneSignalPushSubscription; - addAlias(label: string, id: string): void; - addAliases(aliases: { - [key: string]: string; - }): void; - removeAlias(label: string): void; - removeAliases(labels: string[]): void; - addEmail(email: string): void; - removeEmail(email: string): void; - addSms(smsNumber: string): void; - removeSms(smsNumber: string): void; - addTag(key: string, value: string): void; - addTags(tags: { - [key: string]: string; - }): void; - removeTag(key: string): void; - removeTags(keys: string[]): void; - getTags(): { - [key: string]: string; - }; - addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void; - removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void; - setLanguage(language: string): void; - getLanguage(): string; - trackEvent(name: string, properties?: Record): void; -} -export interface IOneSignalPushSubscription { - id: string | null | undefined; - token: string | null | undefined; - optedIn: boolean | undefined; - optIn(): Promise; - optOut(): Promise; - addEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void; - removeEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void; -} -declare const OneSignal: IOneSignalOneSignal; -export default OneSignal; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6061675a..00000000 --- a/dist/index.js +++ /dev/null @@ -1,470 +0,0 @@ -const u = "onesignal-sdk", l = "https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js"; -let d = !1, s = !1; -typeof window < "u" && (window.OneSignalDeferred = window.OneSignalDeferred || [], c()); -function f() { - s = !0; -} -function c() { - const n = document.createElement("script"); - n.id = u, n.defer = !0, n.src = l, n.onerror = () => { - f(); - }, document.head.appendChild(n); -} -function w() { - return g() || S(); -} -function p() { - return window.top !== window && // isContextIframe - navigator.vendor === "Apple Computer, Inc." && // isSafari - navigator.platform === "MacIntel"; -} -function S() { - return window.safari && typeof window.safari.pushNotification < "u" || p(); -} -function g() { - return typeof PushSubscriptionOptions < "u" && PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey"); -} -const m = () => w(), h = (n) => { - var e; - return d ? Promise.reject("OneSignal is already initialized.") : !n || !n.appId ? Promise.reject("You need to provide your OneSignal appId.") : document ? (((e = n.welcomeNotification) == null ? void 0 : e.disabled) !== void 0 && (n.welcomeNotification.disable = n.welcomeNotification.disabled), new Promise((i, r) => { - var t; - (t = window.OneSignalDeferred) == null || t.push((o) => { - o.init(n).then(() => { - d = !0, i(); - }).catch(r); - }); - })) : Promise.reject("Document is not defined."); -}; -function O(n, e) { - return new Promise((i, r) => { - var t; - if (s) { - r(new Error("OneSignal script failed to load.")); - return; - } - (t = window.OneSignalDeferred) == null || t.push((o) => { - o.login(n, e).then(() => i()).catch((a) => r(a)); - }); - }); -} -function v() { - return new Promise((n, e) => { - var i; - if (s) { - e(new Error("OneSignal script failed to load.")); - return; - } - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.logout().then(() => n()).catch((t) => e(t)); - }); - }); -} -function E(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.setConsentGiven(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function D(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.setConsentRequired(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function P(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Slidedown.promptPush(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function L(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Slidedown.promptPushCategories(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function U(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Slidedown.promptSms(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function A(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Slidedown.promptEmail(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function N(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Slidedown.promptSmsAndEmail(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function b(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.Slidedown.addEventListener(n, e); - }); -} -function I(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.Slidedown.removeEventListener(n, e); - }); -} -function T(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Notifications.setDefaultUrl(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function R(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Notifications.setDefaultTitle(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function C() { - return new Promise((n, e) => { - var i; - if (s) { - e(new Error("OneSignal script failed to load.")); - return; - } - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.Notifications.requestPermission().then((t) => n(t)).catch((t) => e(t)); - }); - }); -} -function y(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.Notifications.addEventListener(n, e); - }); -} -function q(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.Notifications.removeEventListener(n, e); - }); -} -function k(n, e) { - return new Promise((i, r) => { - var t; - if (s) { - r(new Error("OneSignal script failed to load.")); - return; - } - (t = window.OneSignalDeferred) == null || t.push((o) => { - o.Session.sendOutcome(n, e).then(() => i()).catch((a) => r(a)); - }); - }); -} -function G(n) { - return new Promise((e, i) => { - var r; - if (s) { - i(new Error("OneSignal script failed to load.")); - return; - } - (r = window.OneSignalDeferred) == null || r.push((t) => { - t.Session.sendUniqueOutcome(n).then(() => e()).catch((o) => i(o)); - }); - }); -} -function _(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.addAlias(n, e); - }); -} -function K(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.addAliases(n); - }); -} -function x(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.removeAlias(n); - }); -} -function V(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.removeAliases(n); - }); -} -function z(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.addEmail(n); - }); -} -function M(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.removeEmail(n); - }); -} -function F(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.addSms(n); - }); -} -function Y(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.removeSms(n); - }); -} -function B(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.addTag(n, e); - }); -} -function H(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.addTags(n); - }); -} -function J(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.removeTag(n); - }); -} -function Q(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.removeTags(n); - }); -} -async function W() { - var e; - let n; - return await ((e = window.OneSignalDeferred) == null ? void 0 : e.push((i) => { - n = i.User.getTags(); - })), n; -} -function X(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.addEventListener(n, e); - }); -} -function Z(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.removeEventListener(n, e); - }); -} -function $(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.User.setLanguage(n); - }); -} -async function j() { - var e; - let n; - return await ((e = window.OneSignalDeferred) == null ? void 0 : e.push((i) => { - n = i.User.getLanguage(); - })), n; -} -function ee(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.trackEvent(n, e); - }); -} -function ne() { - return new Promise((n, e) => { - var i; - if (s) { - e(new Error("OneSignal script failed to load.")); - return; - } - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.PushSubscription.optIn().then(() => n()).catch((t) => e(t)); - }); - }); -} -function ie() { - return new Promise((n, e) => { - var i; - if (s) { - e(new Error("OneSignal script failed to load.")); - return; - } - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.PushSubscription.optOut().then(() => n()).catch((t) => e(t)); - }); - }); -} -function re(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.PushSubscription.addEventListener(n, e); - }); -} -function te(n, e) { - var i; - (i = window.OneSignalDeferred) == null || i.push((r) => { - r.User.PushSubscription.removeEventListener(n, e); - }); -} -function oe(n) { - var e; - (e = window.OneSignalDeferred) == null || e.push((i) => { - i.Debug.setLogLevel(n); - }); -} -const se = { - get id() { - var n, e, i; - return (i = (e = (n = window.OneSignal) == null ? void 0 : n.User) == null ? void 0 : e.PushSubscription) == null ? void 0 : i.id; - }, - get token() { - var n, e, i; - return (i = (e = (n = window.OneSignal) == null ? void 0 : n.User) == null ? void 0 : e.PushSubscription) == null ? void 0 : i.token; - }, - get optedIn() { - var n, e, i; - return (i = (e = (n = window.OneSignal) == null ? void 0 : n.User) == null ? void 0 : e.PushSubscription) == null ? void 0 : i.optedIn; - }, - optIn: ne, - optOut: ie, - addEventListener: re, - removeEventListener: te -}, ae = { - get onesignalId() { - var n, e; - return (e = (n = window.OneSignal) == null ? void 0 : n.User) == null ? void 0 : e.onesignalId; - }, - get externalId() { - var n, e; - return (e = (n = window.OneSignal) == null ? void 0 : n.User) == null ? void 0 : e.externalId; - }, - addAlias: _, - addAliases: K, - removeAlias: x, - removeAliases: V, - addEmail: z, - removeEmail: M, - addSms: F, - removeSms: Y, - addTag: B, - addTags: H, - removeTag: J, - removeTags: Q, - getTags: W, - addEventListener: X, - removeEventListener: Z, - setLanguage: $, - getLanguage: j, - trackEvent: ee, - PushSubscription: se -}, de = { - sendOutcome: k, - sendUniqueOutcome: G -}, ue = { - setLogLevel: oe -}, le = { - promptPush: P, - promptPushCategories: L, - promptSms: U, - promptEmail: A, - promptSmsAndEmail: N, - addEventListener: b, - removeEventListener: I -}, fe = { - get permissionNative() { - var n, e; - return ((e = (n = window.OneSignal) == null ? void 0 : n.Notifications) == null ? void 0 : e.permissionNative) ?? "default"; - }, - get permission() { - var n, e; - return ((e = (n = window.OneSignal) == null ? void 0 : n.Notifications) == null ? void 0 : e.permission) ?? !1; - }, - setDefaultUrl: T, - setDefaultTitle: R, - isPushSupported: m, - requestPermission: C, - addEventListener: y, - removeEventListener: q -}, ce = { - login: O, - logout: v, - init: h, - setConsentGiven: E, - setConsentRequired: D, - Slidedown: le, - Notifications: fe, - Session: de, - User: ae, - Debug: ue -}, we = ce; -export { - we as default -}; -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 58edc90d..00000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["const ONESIGNAL_SDK_ID = 'onesignal-sdk';\nconst ONE_SIGNAL_SCRIPT_SRC =\n 'https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js';\n\n// true if the script is successfully loaded from CDN.\nlet isOneSignalInitialized = false;\n// true if the script fails to load from CDN. A separate flag is necessary\n// to disambiguate between a CDN load failure and a delayed call to\n// OneSignal#init.\nlet isOneSignalScriptFailed = false;\n\nif (typeof window !== 'undefined') {\n window.OneSignalDeferred = window.OneSignalDeferred || [];\n addSDKScript();\n}\n\ndeclare global {\n interface Window {\n OneSignalDeferred?: OneSignalDeferredLoadedCallback[];\n OneSignal?: IOneSignalOneSignal;\n safari?: {\n pushNotification: any;\n };\n }\n}\n\n/* H E L P E R S */\n\nfunction handleOnError() {\n isOneSignalScriptFailed = true;\n}\n\nfunction addSDKScript() {\n const script = document.createElement('script');\n script.id = ONESIGNAL_SDK_ID;\n script.defer = true;\n script.src = ONE_SIGNAL_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/**\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 * This is a SPECIAL FUNCTION\n * It is a hardcoded implementation copied from the upstream/native WebSDK since we want to return a boolean immediately\n * Natively, this is done via the shimloading mechanism (i.e. if the SDK loads, push is supported)\n * @PublicApi\n */\nconst isPushSupported = (): boolean => {\n return isPushNotificationsSupported();\n};\n\n/**\n * @PublicApi\n */\nconst init = (options: IInitObject): Promise => {\n if (isOneSignalInitialized) {\n return Promise.reject(`OneSignal is already initialized.`);\n }\n\n if (!options || !options.appId) {\n return Promise.reject('You need to provide your OneSignal appId.');\n }\n\n if (!document) {\n return Promise.reject(`Document is not defined.`);\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 return new Promise((resolve, reject) => {\n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.init(options)\n .then(() => {\n isOneSignalInitialized = true;\n resolve();\n })\n .catch(reject);\n });\n });\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 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: IOSNotification;\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 subdomainName?: string;\n requiresUserPrivacyConsent?: boolean;\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 cancelMessage?: 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;\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?: string;\n notificationClickHandlerAction?: string;\n path?: string;\n serviceWorkerParam?: { scope: string };\n serviceWorkerPath?: string;\n serviceWorkerOverrideForTypical?: boolean;\n serviceWorkerUpdaterPath?: string;\n allowLocalhostAsSecureOrigin?: boolean;\n [key: string]: any;\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;\n\tlogout(): Promise;\n\tinit(options: IInitObject): Promise;\n\tsetConsentGiven(consent: boolean): Promise;\n\tsetConsentRequired(requiresConsent: boolean): Promise;\n}\nexport interface IOneSignalNotifications {\n\tpermissionNative: NotificationPermission;\n\tpermission: boolean;\n\tsetDefaultUrl(url: string): Promise;\n\tsetDefaultTitle(title: string): Promise;\n\tisPushSupported(): boolean;\n\trequestPermission(): Promise;\n\taddEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n\tremoveEventListener(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;\n}\nexport interface IOneSignalSlidedown {\n\tpromptPush(options?: AutoPromptOptions): Promise;\n\tpromptPushCategories(options?: AutoPromptOptions): Promise;\n\tpromptSms(options?: AutoPromptOptions): Promise;\n\tpromptEmail(options?: AutoPromptOptions): Promise;\n\tpromptSmsAndEmail(options?: AutoPromptOptions): Promise;\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;\n\tsendUniqueOutcome(outcomeName: string): Promise;\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): void;\n}\nexport interface IOneSignalPushSubscription {\n\tid: string | null | undefined;\n\ttoken: string | null | undefined;\n\toptedIn: boolean | undefined;\n\toptIn(): Promise;\n\toptOut(): Promise;\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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 {\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(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(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 {\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 {\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): void {\n \n window.OneSignalDeferred?.push((OneSignal) => {\n OneSignal.User.trackEvent(name, properties);\n });\n \n}\nfunction pushSubscriptionOptIn(): Promise {\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 {\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 OneSignal = OneSignalNamespace;\nexport default OneSignal;\n"],"names":["ONESIGNAL_SDK_ID","ONE_SIGNAL_SCRIPT_SRC","isOneSignalInitialized","isOneSignalScriptFailed","addSDKScript","handleOnError","script","isPushNotificationsSupported","supportsVapidPush","supportsSafariPush","isMacOSSafariInIframe","isPushSupported","init","options","_a","resolve","reject","OneSignal","oneSignalLogin","externalId","jwtToken","error","oneSignalLogout","oneSignalSetConsentGiven","consent","oneSignalSetConsentRequired","requiresConsent","slidedownPromptPush","slidedownPromptPushCategories","slidedownPromptSms","slidedownPromptEmail","slidedownPromptSmsAndEmail","slidedownAddEventListener","event","listener","slidedownRemoveEventListener","notificationsSetDefaultUrl","url","notificationsSetDefaultTitle","title","notificationsRequestPermission","result","notificationsAddEventListener","notificationsRemoveEventListener","sessionSendOutcome","outcomeName","outcomeWeight","sessionSendUniqueOutcome","userAddAlias","label","id","userAddAliases","aliases","userRemoveAlias","userRemoveAliases","labels","userAddEmail","email","userRemoveEmail","userAddSms","smsNumber","userRemoveSms","userAddTag","key","value","userAddTags","tags","userRemoveTag","userRemoveTags","keys","userGetTags","retVal","userAddEventListener","userRemoveEventListener","userSetLanguage","language","userGetLanguage","userTrackEvent","name","properties","pushSubscriptionOptIn","pushSubscriptionOptOut","pushSubscriptionAddEventListener","pushSubscriptionRemoveEventListener","debugSetLogLevel","logLevel","PushSubscriptionNamespace","_b","_c","UserNamespace","SessionNamespace","DebugNamespace","SlidedownNamespace","NotificationsNamespace","OneSignalNamespace"],"mappings":"AAAA,MAAMA,IAAmB,iBACnBC,IACJ;AAGF,IAAIC,IAAyB,IAIzBC,IAA0B;AAE1B,OAAO,SAAW,QACb,OAAA,oBAAoB,OAAO,qBAAqB,CAAC,GAC3CC,EAAA;AAef,SAASC,IAAgB;AACG,EAAAF,IAAA;AAC5B;AAEA,SAASC,IAAe;AAChB,QAAAE,IAAS,SAAS,cAAc,QAAQ;AAC9C,EAAAA,EAAO,KAAKN,GACZM,EAAO,QAAQ,IACfA,EAAO,MAAML,GAIbK,EAAO,UAAU,MAAM;AACP,IAAAD,EAAA;AAAA,EAChB,GAES,SAAA,KAAK,YAAYC,CAAM;AAClC;AASA,SAASC,IAA+B;AAC/B,SAAAC,OAAuBC,EAAmB;AACnD;AAEA,SAASC,I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BAAAyE,EAAiC,eAAc;AAAA,EAAO;AAAA,EACzF,eAAenD;AAAA,EACf,iBAAiBE;AAAA,EACjB,iBAAA3B;AAAA,EACA,mBAAmB6B;AAAA,EACnB,kBAAkBE;AAAA,EAClB,qBAAqBC;AACtB,GAEMmD,KAA0C;AAAA,EAC/C,OAAO5E;AAAA,EACP,QAAQI;AAAA,EACR,MAAAV;AAAA,EACA,iBAAiBW;AAAA,EACjB,oBAAoBE;AAAA,EACpB,WAAWmE;AAAA,EACX,eAAeC;AAAA,EACf,SAASH;AAAA,EACT,MAAMD;AAAA,EACN,OAAOE;AACR,GAEM1E,KAAY6E;"} \ No newline at end of file diff --git a/dist/index.test.d.ts b/dist/index.test.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/index.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/package-lock.json b/package-lock.json index a83d9802..7ffd6cea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-onesignal", - "version": "3.4.1", + "version": "3.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "react-onesignal", - "version": "3.4.1", + "version": "3.4.2", "license": "MIT", "devDependencies": { "@typescript-eslint/eslint-plugin": "^8.28.0",