Skip to content

Commit 261a9f3

Browse files
chore(release): 2.1.0
## [2.1.0](2.0.1...2.1.0) (2025-03-18) ### Features * sync with web-shim-codegen v3.0.1 ([ce65df3](ce65df3)), closes [#143](https://github.com/OneSignal/onesignal-vue3/issues/143) [skip ci]
1 parent a3a3e40 commit 261a9f3

File tree

5 files changed

+868
-3
lines changed

5 files changed

+868
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## [2.1.0](https://github.com/OneSignal/onesignal-vue3/compare/2.0.1...2.1.0) (2025-03-18)
4+
5+
### Features
6+
7+
* sync with web-shim-codegen v3.0.1 ([ce65df3](https://github.com/OneSignal/onesignal-vue3/commit/ce65df3d95781939b291ca79fed9639f29bf8a3e)), closes [#143](https://github.com/OneSignal/onesignal-vue3/issues/143)

dist/index.d.ts

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
import { App } from 'vue';
2+
declare module '@vue/runtime-core' {
3+
interface ComponentCustomProperties {
4+
$OneSignal: IOneSignalOneSignal;
5+
}
6+
}
7+
declare global {
8+
interface Window {
9+
OneSignalDeferred?: OneSignalDeferredLoadedCallback[];
10+
OneSignal?: IOneSignalOneSignal;
11+
safari?: {
12+
pushNotification: any;
13+
};
14+
}
15+
}
16+
interface AutoPromptOptions {
17+
force?: boolean;
18+
forceSlidedownOverNative?: boolean;
19+
slidedownPromptOptions?: IOneSignalAutoPromptOptions;
20+
}
21+
interface IOneSignalAutoPromptOptions {
22+
force?: boolean;
23+
forceSlidedownOverNative?: boolean;
24+
isInUpdateMode?: boolean;
25+
categoryOptions?: IOneSignalCategories;
26+
}
27+
interface IOneSignalCategories {
28+
positiveUpdateButton: string;
29+
negativeUpdateButton: string;
30+
savingButtonText: string;
31+
errorButtonText: string;
32+
updateMessage: string;
33+
tags: IOneSignalTagCategory[];
34+
}
35+
interface IOneSignalTagCategory {
36+
tag: string;
37+
label: string;
38+
checked?: boolean;
39+
}
40+
declare type PushSubscriptionNamespaceProperties = {
41+
id: string | null | undefined;
42+
token: string | null | undefined;
43+
optedIn: boolean;
44+
};
45+
declare type SubscriptionChangeEvent = {
46+
previous: PushSubscriptionNamespaceProperties;
47+
current: PushSubscriptionNamespaceProperties;
48+
};
49+
declare type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
50+
declare type SlidedownEventName = 'slidedownShown';
51+
declare type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
52+
interface IOSNotification {
53+
/**
54+
* The OneSignal notification id;
55+
* - Primary id on OneSignal's REST API and dashboard
56+
*/
57+
readonly notificationId: string;
58+
/**
59+
* Visible title text on the notification
60+
*/
61+
readonly title?: string;
62+
/**
63+
* Visible body text on the notification
64+
*/
65+
readonly body: string;
66+
/**
67+
* Visible icon the notification; URL format
68+
*/
69+
readonly icon?: string;
70+
/**
71+
* Visible small badgeIcon that displays on some devices; URL format
72+
* Example: On Android's status bar
73+
*/
74+
readonly badgeIcon?: string;
75+
/**
76+
* Visible image on the notification; URL format
77+
*/
78+
readonly image?: string;
79+
/**
80+
* Visible buttons on the notification
81+
*/
82+
readonly actionButtons?: IOSNotificationActionButton[];
83+
/**
84+
* If this value is the same as existing notification, it will replace it
85+
* Can be set when creating the notification with "Web Push Topic" on the dashboard
86+
* or web_push_topic from the REST API.
87+
*/
88+
readonly topic?: string;
89+
/**
90+
* Custom object that was sent with the notification;
91+
* definable when creating the notification from the OneSignal REST API or dashboard
92+
*/
93+
readonly additionalData?: object;
94+
/**
95+
* URL to open when clicking or tapping on the notification
96+
*/
97+
readonly launchURL?: string;
98+
/**
99+
* Confirm the push was received by reporting back to OneSignal
100+
*/
101+
readonly confirmDelivery: boolean;
102+
}
103+
interface IOSNotificationActionButton {
104+
/**
105+
* Any unique identifier to represent which button was clicked. This is typically passed back to the service worker
106+
* and host page through events to identify which button was clicked.
107+
* e.g. 'like-button'
108+
*/
109+
readonly actionId: string;
110+
/**
111+
* The notification action button's text.
112+
*/
113+
readonly text: string;
114+
/**
115+
* A valid publicly reachable HTTPS URL to an image.
116+
*/
117+
readonly icon?: string;
118+
/**
119+
* The URL to open the web browser to when this action button is clicked.
120+
*/
121+
readonly launchURL?: string;
122+
}
123+
interface NotificationClickResult {
124+
readonly actionId?: string;
125+
readonly url?: string;
126+
}
127+
declare type NotificationEventTypeMap = {
128+
'click': NotificationClickEvent;
129+
'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;
130+
'dismiss': NotificationDismissEvent;
131+
'permissionChange': boolean;
132+
'permissionPromptDisplay': void;
133+
};
134+
interface NotificationForegroundWillDisplayEvent {
135+
readonly notification: IOSNotification;
136+
preventDefault(): void;
137+
}
138+
interface NotificationDismissEvent {
139+
notification: IOSNotification;
140+
}
141+
interface NotificationClickEvent {
142+
readonly notification: IOSNotification;
143+
readonly result: NotificationClickResult;
144+
}
145+
declare type UserChangeEvent = {
146+
current: UserNamespaceProperties;
147+
};
148+
declare type UserNamespaceProperties = {
149+
onesignalId: string | undefined;
150+
externalId: string | undefined;
151+
};
152+
interface IInitObject {
153+
appId: string;
154+
subdomainName?: string;
155+
requiresUserPrivacyConsent?: boolean;
156+
promptOptions?: object;
157+
welcomeNotification?: object;
158+
notifyButton?: object;
159+
persistNotification?: boolean;
160+
webhooks?: object;
161+
autoResubscribe?: boolean;
162+
autoRegister?: boolean;
163+
notificationClickHandlerMatch?: string;
164+
notificationClickHandlerAction?: string;
165+
path?: string;
166+
serviceWorkerParam?: {
167+
scope: string;
168+
};
169+
serviceWorkerPath?: string;
170+
serviceWorkerOverrideForTypical?: boolean;
171+
serviceWorkerUpdaterPath?: string;
172+
allowLocalhostAsSecureOrigin?: boolean;
173+
[key: string]: any;
174+
}
175+
interface IOneSignalOneSignal {
176+
Slidedown: IOneSignalSlidedown;
177+
Notifications: IOneSignalNotifications;
178+
Session: IOneSignalSession;
179+
User: IOneSignalUser;
180+
Debug: IOneSignalDebug;
181+
login(externalId: string, jwtToken?: string): Promise<void>;
182+
logout(): Promise<void>;
183+
init(options: IInitObject): Promise<void>;
184+
setConsentGiven(consent: boolean): Promise<void>;
185+
setConsentRequired(requiresConsent: boolean): Promise<void>;
186+
}
187+
interface IOneSignalNotifications {
188+
permissionNative: NotificationPermission;
189+
permission: boolean;
190+
setDefaultUrl(url: string): Promise<void>;
191+
setDefaultTitle(title: string): Promise<void>;
192+
isPushSupported(): boolean;
193+
requestPermission(): Promise<void>;
194+
addEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
195+
removeEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
196+
}
197+
interface IOneSignalSlidedown {
198+
promptPush(options?: AutoPromptOptions): Promise<void>;
199+
promptPushCategories(options?: AutoPromptOptions): Promise<void>;
200+
promptSms(options?: AutoPromptOptions): Promise<void>;
201+
promptEmail(options?: AutoPromptOptions): Promise<void>;
202+
promptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;
203+
addEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
204+
removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
205+
}
206+
interface IOneSignalDebug {
207+
setLogLevel(logLevel: string): void;
208+
}
209+
interface IOneSignalSession {
210+
sendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;
211+
sendUniqueOutcome(outcomeName: string): Promise<void>;
212+
}
213+
interface IOneSignalUser {
214+
onesignalId: string | undefined;
215+
externalId: string | undefined;
216+
PushSubscription: IOneSignalPushSubscription;
217+
addAlias(label: string, id: string): void;
218+
addAliases(aliases: {
219+
[key: string]: string;
220+
}): void;
221+
removeAlias(label: string): void;
222+
removeAliases(labels: string[]): void;
223+
addEmail(email: string): void;
224+
removeEmail(email: string): void;
225+
addSms(smsNumber: string): void;
226+
removeSms(smsNumber: string): void;
227+
addTag(key: string, value: string): void;
228+
addTags(tags: {
229+
[key: string]: string;
230+
}): void;
231+
removeTag(key: string): void;
232+
removeTags(keys: string[]): void;
233+
getTags(): {
234+
[key: string]: string;
235+
};
236+
addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
237+
removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
238+
setLanguage(language: string): void;
239+
getLanguage(): string;
240+
}
241+
interface IOneSignalPushSubscription {
242+
id: string | null | undefined;
243+
token: string | null | undefined;
244+
optedIn: boolean | undefined;
245+
optIn(): Promise<void>;
246+
optOut(): Promise<void>;
247+
addEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;
248+
removeEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;
249+
}
250+
export declare const useOneSignal: () => IOneSignalOneSignal;
251+
declare const OneSignalVuePlugin: {
252+
install(app: App, options: IInitObject): void;
253+
};
254+
export default OneSignalVuePlugin;

0 commit comments

Comments
 (0)