Skip to content

Commit d66cf88

Browse files
author
OneSignal
committed
feat: sync with web-shim-codegen v3.0.4
1 parent 124f5dd commit d66cf88

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- 🏠 [Homepage](https://onesignal.com)
2020
- 🖤 [npm](https://www.npmjs.com/package/@onesignal/onesignal-vue3)
2121

22-
OneSignal is the world's leader for Mobile Push Notifications, Web Push, and In-App Messaging. It is trusted by 2 million+ businesses to send 9 billion Push Notifications per day.
22+
OneSignal is the world's leader for Mobile Push Notifications, Web Push, and In-App Messaging. It is trusted by 2 million+ developers to send 12 billion Push Notifications per day.
2323

2424
You can find more information on OneSignal [here](https://onesignal.com/).
2525

@@ -130,7 +130,7 @@ this.$OneSignal
130130

131131
### Init Options
132132

133-
You can pass other [options](https://documentation.onesignal.com/v11.0/docs/web-sdk#initializing-the-sdk) to the `init` function. Use these options to configure personalized prompt options, auto-resubscribe, and more.
133+
You can pass other [options](https://documentation.onesignal.com/docs/web-sdk-reference#init) to the `init` function. Use these options to configure personalized prompt options, auto-resubscribe, and more.
134134

135135
<details>
136136
<summary>Expand to see more options</summary>
@@ -205,7 +205,7 @@ interface IOneSignalOneSignal {
205205

206206
### OneSignal API
207207

208-
See the official [OneSignal WebSDK reference](https://documentation.onesignal.com/v11.0/docs/web-sdk) for information on all available SDK functions.
208+
See the official [OneSignal WebSDK reference](https://documentation.onesignal.com/docs/web-sdk) for information on all available SDK functions.
209209

210210
---
211211

@@ -245,7 +245,7 @@ this.$OneSignal.Notifications.addEventListener('change', (event) => {
245245
});
246246
```
247247

248-
See the [OneSignal WebSDK Reference](https://documentation.onesignal.com/v11.0/docs/web-sdk) for all available event listeners.
248+
See the [OneSignal WebSDK Reference](https://documentation.onesignal.com/docs/web-sdk-reference#addeventlistener-push-notification) for all available event listeners.
249249

250250
---
251251

index.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ const init = (options: IInitObject): Promise<void> => {
7272
return Promise.reject(`Document is not defined.`);
7373
}
7474

75+
// Handle both disabled and disable keys for welcome notification
76+
if (options.welcomeNotification?.disabled !== undefined) {
77+
options.welcomeNotification.disable = options.welcomeNotification.disabled;
78+
}
79+
7580
return new Promise<void>((resolve, reject) => {
7681
window.OneSignalDeferred?.push((OneSignal) => {
7782
OneSignal.init(options)
@@ -340,9 +345,15 @@ export interface IInitObject {
340345
welcomeNotification?: {
341346
/**
342347
* Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.
348+
* @deprecated Use 'disable' instead. This will be removed in a future version.
343349
*/
344350
disabled?: boolean;
345351

352+
/**
353+
* Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.
354+
*/
355+
disable?: boolean;
356+
346357
/**
347358
* The welcome notification's message. You can localize this to your own language.
348359
* If left blank or set to blank, the default of 'Thanks for subscribing!' will be used.
@@ -359,7 +370,7 @@ export interface IInitObject {
359370
* By default, clicking the welcome notification does not open any link.
360371
* This is recommended because the user has just visited your site and subscribed.
361372
*/
362-
url: string;
373+
url?: string;
363374
};
364375

365376
/**
@@ -490,7 +501,7 @@ export interface IOneSignalSlidedown {
490501
removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
491502
}
492503
export interface IOneSignalDebug {
493-
setLogLevel(logLevel: string): void;
504+
setLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void;
494505
}
495506
export interface IOneSignalSession {
496507
sendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;
@@ -960,7 +971,7 @@ function pushSubscriptionRemoveEventListener(event: 'change', listener: (change:
960971
});
961972

962973
}
963-
function debugSetLogLevel(logLevel: string): void {
974+
function debugSetLogLevel(logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error'): void {
964975

965976
window.OneSignalDeferred?.push((OneSignal) => {
966977
OneSignal.Debug.setLogLevel(logLevel);

0 commit comments

Comments
 (0)