react-onesignal 3.1.1 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,245 +1,402 @@
1
- declare global {
2
- interface Window {
3
- OneSignalDeferred?: OneSignalDeferredLoadedCallback[];
4
- OneSignal?: IOneSignalOneSignal;
5
- safari?: {
6
- pushNotification: any;
7
- };
8
- }
9
- }
10
- interface AutoPromptOptions {
11
- force?: boolean;
12
- forceSlidedownOverNative?: boolean;
13
- slidedownPromptOptions?: IOneSignalAutoPromptOptions;
14
- }
15
- interface IOneSignalAutoPromptOptions {
16
- force?: boolean;
17
- forceSlidedownOverNative?: boolean;
18
- isInUpdateMode?: boolean;
19
- categoryOptions?: IOneSignalCategories;
20
- }
21
- interface IOneSignalCategories {
22
- positiveUpdateButton: string;
23
- negativeUpdateButton: string;
24
- savingButtonText: string;
25
- errorButtonText: string;
26
- updateMessage: string;
27
- tags: IOneSignalTagCategory[];
28
- }
29
- interface IOneSignalTagCategory {
30
- tag: string;
31
- label: string;
32
- checked?: boolean;
33
- }
34
- declare type PushSubscriptionNamespaceProperties = {
35
- id: string | null | undefined;
36
- token: string | null | undefined;
37
- optedIn: boolean;
38
- };
39
- declare type SubscriptionChangeEvent = {
40
- previous: PushSubscriptionNamespaceProperties;
41
- current: PushSubscriptionNamespaceProperties;
42
- };
43
- declare type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
44
- declare type SlidedownEventName = 'slidedownShown';
45
- declare type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
46
- interface IOSNotification {
47
- /**
48
- * The OneSignal notification id;
49
- * - Primary id on OneSignal's REST API and dashboard
50
- */
51
- readonly notificationId: string;
52
- /**
53
- * Visible title text on the notification
54
- */
55
- readonly title?: string;
56
- /**
57
- * Visible body text on the notification
58
- */
59
- readonly body: string;
60
- /**
61
- * Visible icon the notification; URL format
62
- */
63
- readonly icon?: string;
64
- /**
65
- * Visible small badgeIcon that displays on some devices; URL format
66
- * Example: On Android's status bar
67
- */
68
- readonly badgeIcon?: string;
69
- /**
70
- * Visible image on the notification; URL format
71
- */
72
- readonly image?: string;
73
- /**
74
- * Visible buttons on the notification
75
- */
76
- readonly actionButtons?: IOSNotificationActionButton[];
77
- /**
78
- * If this value is the same as existing notification, it will replace it
79
- * Can be set when creating the notification with "Web Push Topic" on the dashboard
80
- * or web_push_topic from the REST API.
81
- */
82
- readonly topic?: string;
83
- /**
84
- * Custom object that was sent with the notification;
85
- * definable when creating the notification from the OneSignal REST API or dashboard
86
- */
87
- readonly additionalData?: object;
88
- /**
89
- * URL to open when clicking or tapping on the notification
90
- */
91
- readonly launchURL?: string;
92
- /**
93
- * Confirm the push was received by reporting back to OneSignal
94
- */
95
- readonly confirmDelivery: boolean;
96
- }
97
- interface IOSNotificationActionButton {
98
- /**
99
- * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker
100
- * and host page through events to identify which button was clicked.
101
- * e.g. 'like-button'
102
- */
103
- readonly actionId: string;
104
- /**
105
- * The notification action button's text.
106
- */
107
- readonly text: string;
108
- /**
109
- * A valid publicly reachable HTTPS URL to an image.
110
- */
111
- readonly icon?: string;
112
- /**
113
- * The URL to open the web browser to when this action button is clicked.
114
- */
115
- readonly launchURL?: string;
116
- }
117
- interface NotificationClickResult {
118
- readonly actionId?: string;
119
- readonly url?: string;
120
- }
121
- declare type NotificationEventTypeMap = {
122
- 'click': NotificationClickEvent;
123
- 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;
124
- 'dismiss': NotificationDismissEvent;
125
- 'permissionChange': boolean;
126
- 'permissionPromptDisplay': void;
127
- };
128
- interface NotificationForegroundWillDisplayEvent {
129
- readonly notification: IOSNotification;
130
- preventDefault(): void;
131
- }
132
- interface NotificationDismissEvent {
133
- notification: IOSNotification;
134
- }
135
- interface NotificationClickEvent {
136
- readonly notification: IOSNotification;
137
- readonly result: NotificationClickResult;
138
- }
139
- declare type UserChangeEvent = {
140
- current: UserNamespaceProperties;
141
- };
142
- declare type UserNamespaceProperties = {
143
- onesignalId: string | undefined;
144
- externalId: string | undefined;
145
- };
146
- interface IInitObject {
147
- appId: string;
148
- subdomainName?: string;
149
- requiresUserPrivacyConsent?: boolean;
150
- promptOptions?: object;
151
- welcomeNotification?: object;
152
- notifyButton?: object;
153
- persistNotification?: boolean;
154
- webhooks?: object;
155
- autoResubscribe?: boolean;
156
- autoRegister?: boolean;
157
- notificationClickHandlerMatch?: string;
158
- notificationClickHandlerAction?: string;
159
- path?: string;
160
- serviceWorkerParam?: {
161
- scope: string;
162
- };
163
- serviceWorkerPath?: string;
164
- serviceWorkerOverrideForTypical?: boolean;
165
- serviceWorkerUpdaterPath?: string;
166
- allowLocalhostAsSecureOrigin?: boolean;
167
- [key: string]: any;
168
- }
169
- interface IOneSignalOneSignal {
170
- Slidedown: IOneSignalSlidedown;
171
- Notifications: IOneSignalNotifications;
172
- Session: IOneSignalSession;
173
- User: IOneSignalUser;
174
- Debug: IOneSignalDebug;
175
- login(externalId: string, jwtToken?: string): Promise<void>;
176
- logout(): Promise<void>;
177
- init(options: IInitObject): Promise<void>;
178
- setConsentGiven(consent: boolean): Promise<void>;
179
- setConsentRequired(requiresConsent: boolean): Promise<void>;
180
- }
181
- interface IOneSignalNotifications {
182
- permissionNative: NotificationPermission;
183
- permission: boolean;
184
- setDefaultUrl(url: string): Promise<void>;
185
- setDefaultTitle(title: string): Promise<void>;
186
- isPushSupported(): boolean;
187
- requestPermission(): Promise<void>;
188
- addEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
189
- removeEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
190
- }
191
- interface IOneSignalSlidedown {
192
- promptPush(options?: AutoPromptOptions): Promise<void>;
193
- promptPushCategories(options?: AutoPromptOptions): Promise<void>;
194
- promptSms(options?: AutoPromptOptions): Promise<void>;
195
- promptEmail(options?: AutoPromptOptions): Promise<void>;
196
- promptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;
197
- addEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
198
- removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
199
- }
200
- interface IOneSignalDebug {
201
- setLogLevel(logLevel: string): void;
202
- }
203
- interface IOneSignalSession {
204
- sendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;
205
- sendUniqueOutcome(outcomeName: string): Promise<void>;
206
- }
207
- interface IOneSignalUser {
208
- onesignalId: string | undefined;
209
- externalId: string | undefined;
210
- PushSubscription: IOneSignalPushSubscription;
211
- addAlias(label: string, id: string): void;
212
- addAliases(aliases: {
213
- [key: string]: string;
214
- }): void;
215
- removeAlias(label: string): void;
216
- removeAliases(labels: string[]): void;
217
- addEmail(email: string): void;
218
- removeEmail(email: string): void;
219
- addSms(smsNumber: string): void;
220
- removeSms(smsNumber: string): void;
221
- addTag(key: string, value: string): void;
222
- addTags(tags: {
223
- [key: string]: string;
224
- }): void;
225
- removeTag(key: string): void;
226
- removeTags(keys: string[]): void;
227
- getTags(): {
228
- [key: string]: string;
229
- };
230
- addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
231
- removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
232
- setLanguage(language: string): void;
233
- getLanguage(): string;
234
- }
235
- interface IOneSignalPushSubscription {
236
- id: string | null | undefined;
237
- token: string | null | undefined;
238
- optedIn: boolean | undefined;
239
- optIn(): Promise<void>;
240
- optOut(): Promise<void>;
241
- addEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;
242
- removeEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;
243
- }
244
- declare const OneSignal: IOneSignalOneSignal;
245
- export default OneSignal;
1
+ declare global {
2
+ interface Window {
3
+ OneSignalDeferred?: OneSignalDeferredLoadedCallback[];
4
+ OneSignal?: IOneSignalOneSignal;
5
+ safari?: {
6
+ pushNotification: any;
7
+ };
8
+ }
9
+ }
10
+ export interface AutoPromptOptions {
11
+ force?: boolean;
12
+ forceSlidedownOverNative?: boolean;
13
+ slidedownPromptOptions?: IOneSignalAutoPromptOptions;
14
+ }
15
+ export interface IOneSignalAutoPromptOptions {
16
+ force?: boolean;
17
+ forceSlidedownOverNative?: boolean;
18
+ isInUpdateMode?: boolean;
19
+ categoryOptions?: IOneSignalCategories;
20
+ }
21
+ export interface IOneSignalCategories {
22
+ positiveUpdateButton: string;
23
+ negativeUpdateButton: string;
24
+ savingButtonText: string;
25
+ errorButtonText: string;
26
+ updateMessage: string;
27
+ tags: IOneSignalTagCategory[];
28
+ }
29
+ export interface IOneSignalTagCategory {
30
+ tag: string;
31
+ label: string;
32
+ checked?: boolean;
33
+ }
34
+ export type PushSubscriptionNamespaceProperties = {
35
+ id: string | null | undefined;
36
+ token: string | null | undefined;
37
+ optedIn: boolean;
38
+ };
39
+ export type SubscriptionChangeEvent = {
40
+ previous: PushSubscriptionNamespaceProperties;
41
+ current: PushSubscriptionNamespaceProperties;
42
+ };
43
+ export type NotificationEventName = 'click' | 'foregroundWillDisplay' | 'dismiss' | 'permissionChange' | 'permissionPromptDisplay';
44
+ export type SlidedownEventName = 'slidedownShown';
45
+ export type OneSignalDeferredLoadedCallback = (onesignal: IOneSignalOneSignal) => void;
46
+ export interface IOSNotification {
47
+ /**
48
+ * The OneSignal notification id;
49
+ * - Primary id on OneSignal's REST API and dashboard
50
+ */
51
+ readonly notificationId: string;
52
+ /**
53
+ * Visible title text on the notification
54
+ */
55
+ readonly title?: string;
56
+ /**
57
+ * Visible body text on the notification
58
+ */
59
+ readonly body: string;
60
+ /**
61
+ * Visible icon the notification; URL format
62
+ */
63
+ readonly icon?: string;
64
+ /**
65
+ * Visible small badgeIcon that displays on some devices; URL format
66
+ * Example: On Android's status bar
67
+ */
68
+ readonly badgeIcon?: string;
69
+ /**
70
+ * Visible image on the notification; URL format
71
+ */
72
+ readonly image?: string;
73
+ /**
74
+ * Visible buttons on the notification
75
+ */
76
+ readonly actionButtons?: IOSNotificationActionButton[];
77
+ /**
78
+ * If this value is the same as existing notification, it will replace it
79
+ * Can be set when creating the notification with "Web Push Topic" on the dashboard
80
+ * or web_push_topic from the REST API.
81
+ */
82
+ readonly topic?: string;
83
+ /**
84
+ * Custom object that was sent with the notification;
85
+ * definable when creating the notification from the OneSignal REST API or dashboard
86
+ */
87
+ readonly additionalData?: object;
88
+ /**
89
+ * URL to open when clicking or tapping on the notification
90
+ */
91
+ readonly launchURL?: string;
92
+ /**
93
+ * Confirm the push was received by reporting back to OneSignal
94
+ */
95
+ readonly confirmDelivery: boolean;
96
+ }
97
+ export interface IOSNotificationActionButton {
98
+ /**
99
+ * Any unique identifier to represent which button was clicked. This is typically passed back to the service worker
100
+ * and host page through events to identify which button was clicked.
101
+ * e.g. 'like-button'
102
+ */
103
+ readonly actionId: string;
104
+ /**
105
+ * The notification action button's text.
106
+ */
107
+ readonly text: string;
108
+ /**
109
+ * A valid publicly reachable HTTPS URL to an image.
110
+ */
111
+ readonly icon?: string;
112
+ /**
113
+ * The URL to open the web browser to when this action button is clicked.
114
+ */
115
+ readonly launchURL?: string;
116
+ }
117
+ export interface NotificationClickResult {
118
+ readonly actionId?: string;
119
+ readonly url?: string;
120
+ }
121
+ export type NotificationEventTypeMap = {
122
+ 'click': NotificationClickEvent;
123
+ 'foregroundWillDisplay': NotificationForegroundWillDisplayEvent;
124
+ 'dismiss': NotificationDismissEvent;
125
+ 'permissionChange': boolean;
126
+ 'permissionPromptDisplay': void;
127
+ };
128
+ export interface NotificationForegroundWillDisplayEvent {
129
+ readonly notification: IOSNotification;
130
+ preventDefault(): void;
131
+ }
132
+ export interface NotificationDismissEvent {
133
+ notification: IOSNotification;
134
+ }
135
+ export interface NotificationClickEvent {
136
+ readonly notification: IOSNotification;
137
+ readonly result: NotificationClickResult;
138
+ }
139
+ export type UserChangeEvent = {
140
+ current: UserNamespaceProperties;
141
+ };
142
+ export type UserNamespaceProperties = {
143
+ onesignalId: string | undefined;
144
+ externalId: string | undefined;
145
+ };
146
+ export interface IInitObject {
147
+ appId: string;
148
+ subdomainName?: string;
149
+ requiresUserPrivacyConsent?: boolean;
150
+ promptOptions?: {
151
+ slidedown: {
152
+ prompts: {
153
+ /**
154
+ * Whether to automatically display the prompt.
155
+ * `true` will display the prompt based on the delay options.
156
+ * `false` will prevent the prompt from displaying until the Slidedowns methods are used.
157
+ */
158
+ autoPrompt: boolean;
159
+ /**
160
+ * Only available for type: category. Up to 10 categories.
161
+ * @example
162
+ * categories: [{ tag: 'local_news', label: 'Local News' }] // The user will be tagged with local_news but will see "Local News" in the prompt.
163
+ */
164
+ categories: {
165
+ /** Should identify the action. */
166
+ tag: string;
167
+ /** What the user will see. */
168
+ label: string;
169
+ }[];
170
+ /**
171
+ * The delay options for the prompt.
172
+ * @example delay: { pageViews: 3, timeDelay: 20 } // The user will not be shown the prompt until 20 seconds after the 3rd page view.
173
+ */
174
+ delay: {
175
+ /** The number of pages a user needs to visit before the prompt is displayed. */
176
+ pageViews?: number;
177
+ /** The number of seconds a user needs to wait before the prompt is displayed.Both options must be satisfied for the prompt to display */
178
+ timeDelay?: number;
179
+ };
180
+ /**
181
+ * The text to display in the prompt.
182
+ */
183
+ text?: {
184
+ /** The callout asking the user to opt-in. Up to 90 characters. */
185
+ actionMessage?: string;
186
+ /** Triggers the opt-in. Up to 15 characters. */
187
+ acceptButton?: string;
188
+ /** Cancels opt-in. Up to 15 characters. */
189
+ cancelMessage?: string;
190
+ /** The message of the confirmation prompt displayed after the email and/or phone number is provided. Up to 90 characters. */
191
+ confirmMessage?: string;
192
+ /** Identifies the email text field. Up to 15 characters. */
193
+ emailLabel?: string;
194
+ /** Cancels the category update. Up to 15 characters. */
195
+ negativeUpdateButton?: string;
196
+ /** Saves the updated category tags. Up to 15 characters. */
197
+ positiveUpdateButton?: string;
198
+ /** Identifies the phone number text field. Up to 15 characters. */
199
+ smsLabel?: string;
200
+ /** A different message shown to subscribers presented the prompt again to update categories. Up to 90 characters. */
201
+ updateMessage?: string;
202
+ };
203
+ /**
204
+ * The type of prompt to display.
205
+ * `push` which is the Slide Prompt without categories.
206
+ * `category` which is the Slide Prompt with categories.
207
+ * `sms` only asks for phone number.
208
+ * `email` only asks for email address.
209
+ * `smsAndEmail` asks for both phone number and email address.
210
+ */
211
+ type: 'push' | 'category' | 'sms' | 'email' | 'smsAndEmail';
212
+ }[];
213
+ };
214
+ };
215
+ welcomeNotification?: {
216
+ /**
217
+ * Disables sending a welcome notification to new site visitors. If you want to disable welcome notifications, this is the only option you need.
218
+ */
219
+ disabled?: boolean;
220
+ /**
221
+ * The welcome notification's message. You can localize this to your own language.
222
+ * If left blank or set to blank, the default of 'Thanks for subscribing!' will be used.
223
+ */
224
+ message: string;
225
+ /**
226
+ * 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.
227
+ * Set to one space ' ' to clear the title, although this is not recommended.
228
+ */
229
+ title?: string;
230
+ /**
231
+ * By default, clicking the welcome notification does not open any link.
232
+ * This is recommended because the user has just visited your site and subscribed.
233
+ */
234
+ url: string;
235
+ };
236
+ /**
237
+ * Will enable customization of the notify/subscription bell button.
238
+ */
239
+ notifyButton?: {
240
+ /**
241
+ * A function you define that returns true to show the Subscription Bell, or false to hide it.
242
+ * Typically used the hide the Subscription Bell after the user is subscribed.
243
+ * This function is not re-evaluated on every state change; this function is only evaluated once when the Subscription Bell begins to show.
244
+ */
245
+ displayPredicate?: () => boolean | Promise<boolean>;
246
+ /**
247
+ * Enable the Subscription Bell. The Subscription Bell is otherwise disabled by default.
248
+ */
249
+ enable?: boolean;
250
+ /** Specify CSS-valid pixel offsets using bottom, left, and right. */
251
+ offset?: {
252
+ bottom: string;
253
+ left: string;
254
+ right: string;
255
+ };
256
+ /**
257
+ * If `true`, the Subscription Bell will display an icon that there is 1 unread message.
258
+ * When hovering over the Subscription Bell, the user will see custom text set by message.prenotify.
259
+ */
260
+ prenotify: boolean;
261
+ /** Either `bottom-left` or `bottom-right`. The Subscription Bell will be fixed at this location on your page. */
262
+ position?: 'bottom-left' | 'bottom-right';
263
+ /** Set `false` to hide the 'Powered by OneSignal' text in the Subscription Bell dialog popup. */
264
+ showCredit: boolean;
265
+ /**
266
+ * The Subscription Bell will initially appear at one of these sizes, and then shrink down to size `small` after the user subscribes.
267
+ */
268
+ size?: 'small' | 'medium' | 'large';
269
+ /** Customize the Subscription Bell text. */
270
+ text: {
271
+ 'dialog.blocked.message': string;
272
+ 'dialog.blocked.title': string;
273
+ 'dialog.main.button.subscribe': string;
274
+ 'dialog.main.button.unsubscribe': string;
275
+ 'dialog.main.title': string;
276
+ 'message.action.resubscribed': string;
277
+ 'message.action.subscribed': string;
278
+ 'message.action.subscribing': string;
279
+ 'message.action.unsubscribed': string;
280
+ 'message.prenotify': string;
281
+ 'tip.state.blocked': string;
282
+ 'tip.state.subscribed': string;
283
+ 'tip.state.unsubscribed': string;
284
+ };
285
+ };
286
+ persistNotification?: boolean;
287
+ webhooks?: {
288
+ /**
289
+ * Enable this setting only if your server has CORS enabled and supports non-simple CORS requests.
290
+ * If this setting is disabled, your webhook will not need CORS to receive data, but it will not receive the custom headers.
291
+ * The simplest option is to leave it disabled.
292
+ * @default false
293
+ */
294
+ cors: boolean;
295
+ /**
296
+ * This event occurs after a notification is clicked.
297
+ * @example https://site.com/hook
298
+ */
299
+ 'notification.clicked'?: string;
300
+ /**
301
+ * 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),
302
+ * 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.
303
+ * @example https://site.com/hook
304
+ */
305
+ 'notification.dismissed'?: string;
306
+ /**
307
+ * This event occurs after a notification is displayed.
308
+ * @example https://site.com/hook
309
+ */
310
+ 'notification.willDisplay'?: string;
311
+ };
312
+ autoResubscribe?: boolean;
313
+ autoRegister?: boolean;
314
+ notificationClickHandlerMatch?: string;
315
+ notificationClickHandlerAction?: string;
316
+ path?: string;
317
+ serviceWorkerParam?: {
318
+ scope: string;
319
+ };
320
+ serviceWorkerPath?: string;
321
+ serviceWorkerOverrideForTypical?: boolean;
322
+ serviceWorkerUpdaterPath?: string;
323
+ allowLocalhostAsSecureOrigin?: boolean;
324
+ [key: string]: any;
325
+ }
326
+ export interface IOneSignalOneSignal {
327
+ Slidedown: IOneSignalSlidedown;
328
+ Notifications: IOneSignalNotifications;
329
+ Session: IOneSignalSession;
330
+ User: IOneSignalUser;
331
+ Debug: IOneSignalDebug;
332
+ login(externalId: string, jwtToken?: string): Promise<void>;
333
+ logout(): Promise<void>;
334
+ init(options: IInitObject): Promise<void>;
335
+ setConsentGiven(consent: boolean): Promise<void>;
336
+ setConsentRequired(requiresConsent: boolean): Promise<void>;
337
+ }
338
+ export interface IOneSignalNotifications {
339
+ permissionNative: NotificationPermission;
340
+ permission: boolean;
341
+ setDefaultUrl(url: string): Promise<void>;
342
+ setDefaultTitle(title: string): Promise<void>;
343
+ isPushSupported(): boolean;
344
+ requestPermission(): Promise<void>;
345
+ addEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
346
+ removeEventListener<K extends NotificationEventName>(event: K, listener: (obj: NotificationEventTypeMap[K]) => void): void;
347
+ }
348
+ export interface IOneSignalSlidedown {
349
+ promptPush(options?: AutoPromptOptions): Promise<void>;
350
+ promptPushCategories(options?: AutoPromptOptions): Promise<void>;
351
+ promptSms(options?: AutoPromptOptions): Promise<void>;
352
+ promptEmail(options?: AutoPromptOptions): Promise<void>;
353
+ promptSmsAndEmail(options?: AutoPromptOptions): Promise<void>;
354
+ addEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
355
+ removeEventListener(event: SlidedownEventName, listener: (wasShown: boolean) => void): void;
356
+ }
357
+ export interface IOneSignalDebug {
358
+ setLogLevel(logLevel: string): void;
359
+ }
360
+ export interface IOneSignalSession {
361
+ sendOutcome(outcomeName: string, outcomeWeight?: number): Promise<void>;
362
+ sendUniqueOutcome(outcomeName: string): Promise<void>;
363
+ }
364
+ export interface IOneSignalUser {
365
+ onesignalId: string | undefined;
366
+ externalId: string | undefined;
367
+ PushSubscription: IOneSignalPushSubscription;
368
+ addAlias(label: string, id: string): void;
369
+ addAliases(aliases: {
370
+ [key: string]: string;
371
+ }): void;
372
+ removeAlias(label: string): void;
373
+ removeAliases(labels: string[]): void;
374
+ addEmail(email: string): void;
375
+ removeEmail(email: string): void;
376
+ addSms(smsNumber: string): void;
377
+ removeSms(smsNumber: string): void;
378
+ addTag(key: string, value: string): void;
379
+ addTags(tags: {
380
+ [key: string]: string;
381
+ }): void;
382
+ removeTag(key: string): void;
383
+ removeTags(keys: string[]): void;
384
+ getTags(): {
385
+ [key: string]: string;
386
+ };
387
+ addEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
388
+ removeEventListener(event: 'change', listener: (change: UserChangeEvent) => void): void;
389
+ setLanguage(language: string): void;
390
+ getLanguage(): string;
391
+ }
392
+ export interface IOneSignalPushSubscription {
393
+ id: string | null | undefined;
394
+ token: string | null | undefined;
395
+ optedIn: boolean | undefined;
396
+ optIn(): Promise<void>;
397
+ optOut(): Promise<void>;
398
+ addEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;
399
+ removeEventListener(event: 'change', listener: (change: SubscriptionChangeEvent) => void): void;
400
+ }
401
+ declare const OneSignal: IOneSignalOneSignal;
402
+ export default OneSignal;