@symbiote-native/notifications 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +258 -0
  3. package/build/angular/index.d.ts +1 -0
  4. package/build/angular/index.js +1 -0
  5. package/build/core/background-task.d.ts +9 -0
  6. package/build/core/background-task.js +28 -0
  7. package/build/core/badge.d.ts +7 -0
  8. package/build/core/badge.js +23 -0
  9. package/build/core/categories.d.ts +10 -0
  10. package/build/core/categories.js +28 -0
  11. package/build/core/channels.d.ts +20 -0
  12. package/build/core/channels.js +106 -0
  13. package/build/core/emitter.d.ts +24 -0
  14. package/build/core/emitter.js +58 -0
  15. package/build/core/handler.d.ts +15 -0
  16. package/build/core/handler.js +50 -0
  17. package/build/core/index.d.ts +12 -0
  18. package/build/core/index.js +11 -0
  19. package/build/core/native-modules.d.ts +82 -0
  20. package/build/core/native-modules.js +33 -0
  21. package/build/core/permissions.d.ts +8 -0
  22. package/build/core/permissions.js +30 -0
  23. package/build/core/presenter.d.ts +7 -0
  24. package/build/core/presenter.js +27 -0
  25. package/build/core/scheduler.d.ts +13 -0
  26. package/build/core/scheduler.js +193 -0
  27. package/build/core/tokens.d.ts +30 -0
  28. package/build/core/tokens.js +192 -0
  29. package/build/core/types.d.ts +633 -0
  30. package/build/core/types.js +116 -0
  31. package/build/core/utils.d.ts +6 -0
  32. package/build/core/utils.js +53 -0
  33. package/build-ngc/angular/index.d.ts +1 -0
  34. package/build-ngc/angular/index.js +2 -0
  35. package/build-ngc/angular/index.js.map +1 -0
  36. package/build-ngc/core/background-task.d.ts +9 -0
  37. package/build-ngc/core/background-task.js +29 -0
  38. package/build-ngc/core/background-task.js.map +1 -0
  39. package/build-ngc/core/badge.d.ts +7 -0
  40. package/build-ngc/core/badge.js +24 -0
  41. package/build-ngc/core/badge.js.map +1 -0
  42. package/build-ngc/core/categories.d.ts +10 -0
  43. package/build-ngc/core/categories.js +29 -0
  44. package/build-ngc/core/categories.js.map +1 -0
  45. package/build-ngc/core/channels.d.ts +20 -0
  46. package/build-ngc/core/channels.js +107 -0
  47. package/build-ngc/core/channels.js.map +1 -0
  48. package/build-ngc/core/emitter.d.ts +24 -0
  49. package/build-ngc/core/emitter.js +59 -0
  50. package/build-ngc/core/emitter.js.map +1 -0
  51. package/build-ngc/core/handler.d.ts +15 -0
  52. package/build-ngc/core/handler.js +51 -0
  53. package/build-ngc/core/handler.js.map +1 -0
  54. package/build-ngc/core/index.d.ts +12 -0
  55. package/build-ngc/core/index.js +12 -0
  56. package/build-ngc/core/index.js.map +1 -0
  57. package/build-ngc/core/native-modules.d.ts +82 -0
  58. package/build-ngc/core/native-modules.js +34 -0
  59. package/build-ngc/core/native-modules.js.map +1 -0
  60. package/build-ngc/core/permissions.d.ts +8 -0
  61. package/build-ngc/core/permissions.js +31 -0
  62. package/build-ngc/core/permissions.js.map +1 -0
  63. package/build-ngc/core/presenter.d.ts +7 -0
  64. package/build-ngc/core/presenter.js +28 -0
  65. package/build-ngc/core/presenter.js.map +1 -0
  66. package/build-ngc/core/scheduler.d.ts +13 -0
  67. package/build-ngc/core/scheduler.js +194 -0
  68. package/build-ngc/core/scheduler.js.map +1 -0
  69. package/build-ngc/core/tokens.d.ts +30 -0
  70. package/build-ngc/core/tokens.js +193 -0
  71. package/build-ngc/core/tokens.js.map +1 -0
  72. package/build-ngc/core/types.d.ts +633 -0
  73. package/build-ngc/core/types.js +117 -0
  74. package/build-ngc/core/types.js.map +1 -0
  75. package/build-ngc/core/utils.d.ts +6 -0
  76. package/build-ngc/core/utils.js +54 -0
  77. package/build-ngc/core/utils.js.map +1 -0
  78. package/native-link.json +88 -0
  79. package/package.json +150 -0
  80. package/src/angular/index.ts +1 -0
  81. package/src/core/background-task.ts +32 -0
  82. package/src/core/badge.ts +26 -0
  83. package/src/core/categories.ts +60 -0
  84. package/src/core/channels.ts +183 -0
  85. package/src/core/emitter.ts +95 -0
  86. package/src/core/handler.ts +95 -0
  87. package/src/core/index.ts +144 -0
  88. package/src/core/native-modules.ts +209 -0
  89. package/src/core/permissions.ts +46 -0
  90. package/src/core/presenter.ts +45 -0
  91. package/src/core/scheduler.ts +265 -0
  92. package/src/core/tokens.ts +272 -0
  93. package/src/core/types.ts +767 -0
  94. package/src/core/utils.ts +82 -0
@@ -0,0 +1,767 @@
1
+ // Hand-ported from expo-notifications @ sdk-57 (Notifications.types.ts / Tokens.types.ts /
2
+ // NotificationChannelManager.types.ts / NotificationChannelGroupManager.types.ts /
3
+ // NotificationScheduler.types.ts) — this repo's own `I`-prefix convention for public types.
4
+ //
5
+ // PermissionResponse/PermissionStatus/PermissionExpiration come straight from
6
+ // expo-modules-core (the same precedent packages/sensors and packages/local-auth already use),
7
+ // not redeclared here.
8
+ import {
9
+ PermissionStatus,
10
+ type PermissionExpiration,
11
+ type PermissionResponse,
12
+ } from 'expo-modules-core';
13
+
14
+ export { PermissionStatus };
15
+ export type { PermissionExpiration, PermissionResponse };
16
+
17
+ // ---------------------------------------------------------------------------
18
+ // Permissions
19
+ // ---------------------------------------------------------------------------
20
+
21
+ /** @platform ios */
22
+ export enum IosAlertStyle {
23
+ NONE = 0,
24
+ BANNER = 1,
25
+ ALERT = 2,
26
+ }
27
+
28
+ /** @platform ios */
29
+ export enum IosAllowsPreviews {
30
+ NEVER = 0,
31
+ ALWAYS = 1,
32
+ WHEN_AUTHENTICATED = 2,
33
+ }
34
+
35
+ /** @platform ios */
36
+ export enum IosAuthorizationStatus {
37
+ NOT_DETERMINED = 0,
38
+ DENIED = 1,
39
+ AUTHORIZED = 2,
40
+ PROVISIONAL = 3,
41
+ EPHEMERAL = 4,
42
+ }
43
+
44
+ export interface INotificationPermissionsStatus extends PermissionResponse {
45
+ android?: {
46
+ importance: number;
47
+ interruptionFilter?: number;
48
+ };
49
+ ios?: {
50
+ status: IosAuthorizationStatus;
51
+ allowsDisplayInNotificationCenter: boolean | null;
52
+ allowsDisplayOnLockScreen: boolean | null;
53
+ allowsDisplayInCarPlay: boolean | null;
54
+ allowsAlert: boolean | null;
55
+ allowsBadge: boolean | null;
56
+ allowsSound: boolean | null;
57
+ allowsCriticalAlerts: boolean | null;
58
+ alertStyle: IosAlertStyle;
59
+ allowsPreviews: IosAllowsPreviews | null;
60
+ providesAppNotificationSettings: boolean | null;
61
+ allowsAnnouncements: boolean | null;
62
+ };
63
+ }
64
+
65
+ /** @platform ios */
66
+ export interface IIosNotificationPermissionsRequest {
67
+ allowAlert?: boolean;
68
+ allowBadge?: boolean;
69
+ allowSound?: boolean;
70
+ allowDisplayInCarPlay?: boolean;
71
+ allowCriticalAlerts?: boolean;
72
+ provideAppNotificationSettings?: boolean;
73
+ allowProvisional?: boolean;
74
+ }
75
+
76
+ export interface INotificationPermissionsRequest {
77
+ ios?: IIosNotificationPermissionsRequest;
78
+ /** On Android all permissions are granted by default; there is nothing to request. */
79
+ android?: object;
80
+ }
81
+
82
+ // ---------------------------------------------------------------------------
83
+ // Tokens
84
+ // ---------------------------------------------------------------------------
85
+
86
+ export interface INativeDevicePushToken {
87
+ type: 'ios' | 'android';
88
+ data: string;
89
+ }
90
+
91
+ export type IDevicePushToken = INativeDevicePushToken;
92
+
93
+ export interface IExpoPushToken {
94
+ type: 'expo';
95
+ data: string;
96
+ }
97
+
98
+ export interface IExpoPushTokenOptions {
99
+ baseUrl?: string;
100
+ url?: string;
101
+ type?: string;
102
+ deviceId?: string;
103
+ /** @platform ios */
104
+ development?: boolean;
105
+ /**
106
+ * ponytail: upstream defaults this from `expo-constants`' `Constants.expoConfig.extra.eas.
107
+ * projectId`; that package is not part of this port, so it must be passed explicitly here.
108
+ */
109
+ projectId?: string;
110
+ /**
111
+ * ponytail: upstream defaults this from `expo-application`'s `Application.applicationId`;
112
+ * pass `@symbiote-native/application`'s own `applicationId` export, or a literal.
113
+ */
114
+ applicationId?: string;
115
+ devicePushToken?: IDevicePushToken;
116
+ }
117
+
118
+ // ---------------------------------------------------------------------------
119
+ // Notification content / triggers
120
+ // ---------------------------------------------------------------------------
121
+
122
+ export type IPushNotificationTrigger = {
123
+ type: 'push';
124
+ /** @platform ios */
125
+ payload?: Record<string, unknown>;
126
+ /** @platform android */
127
+ remoteMessage?: IFirebaseRemoteMessage;
128
+ };
129
+
130
+ /** @platform ios */
131
+ export interface ICalendarNotificationTrigger {
132
+ type: 'calendar';
133
+ repeats: boolean;
134
+ dateComponents: {
135
+ era?: number;
136
+ year?: number;
137
+ month?: number;
138
+ day?: number;
139
+ hour?: number;
140
+ minute?: number;
141
+ second?: number;
142
+ weekday?: number;
143
+ weekdayOrdinal?: number;
144
+ quarter?: number;
145
+ weekOfMonth?: number;
146
+ weekOfYear?: number;
147
+ yearForWeekOfYear?: number;
148
+ nanosecond?: number;
149
+ isLeapMonth: boolean;
150
+ isRepeatedDay: boolean;
151
+ timeZone?: string;
152
+ calendar?: string;
153
+ };
154
+ }
155
+
156
+ /** @platform ios */
157
+ export interface IRegion {
158
+ type: string;
159
+ identifier: string;
160
+ notifyOnEntry: boolean;
161
+ notifyOnExit: boolean;
162
+ }
163
+
164
+ /** @platform ios */
165
+ export interface ICircularRegion extends IRegion {
166
+ type: 'circular';
167
+ radius: number;
168
+ center: { latitude: number; longitude: number };
169
+ }
170
+
171
+ /** @platform ios */
172
+ export interface IBeaconRegion extends IRegion {
173
+ type: 'beacon';
174
+ notifyEntryStateOnDisplay: boolean;
175
+ major: number | null;
176
+ minor: number | null;
177
+ uuid?: string;
178
+ beaconIdentityConstraint?: {
179
+ uuid: string;
180
+ major: number | null;
181
+ minor: number | null;
182
+ };
183
+ }
184
+
185
+ /** @platform ios */
186
+ export interface ILocationNotificationTrigger {
187
+ type: 'location';
188
+ repeats: boolean;
189
+ region: ICircularRegion | IBeaconRegion;
190
+ }
191
+
192
+ export interface ITimeIntervalNotificationTrigger {
193
+ type: 'timeInterval';
194
+ repeats: boolean;
195
+ seconds: number;
196
+ }
197
+
198
+ /** @platform android — iOS achieves this with a CalendarNotificationTrigger. */
199
+ export interface IDailyNotificationTrigger {
200
+ type: 'daily';
201
+ hour: number;
202
+ minute: number;
203
+ }
204
+
205
+ /** @platform android */
206
+ export interface IWeeklyNotificationTrigger {
207
+ type: 'weekly';
208
+ weekday: number;
209
+ hour: number;
210
+ minute: number;
211
+ }
212
+
213
+ /** @platform android */
214
+ export interface IMonthlyNotificationTrigger {
215
+ type: 'monthly';
216
+ day: number;
217
+ hour: number;
218
+ minute: number;
219
+ }
220
+
221
+ /** @platform android */
222
+ export interface IYearlyNotificationTrigger {
223
+ type: 'yearly';
224
+ day: number;
225
+ month: number;
226
+ hour: number;
227
+ minute: number;
228
+ }
229
+
230
+ export interface IFirebaseRemoteMessageNotification {
231
+ body: string | null;
232
+ bodyLocalizationArgs: string[] | null;
233
+ bodyLocalizationKey: string | null;
234
+ channelId: string | null;
235
+ clickAction: string | null;
236
+ color: string | null;
237
+ usesDefaultLightSettings: boolean;
238
+ usesDefaultSound: boolean;
239
+ usesDefaultVibrateSettings: boolean;
240
+ eventTime: number | null;
241
+ icon: string | null;
242
+ imageUrl: string | null;
243
+ lightSettings: number[] | null;
244
+ link: string | null;
245
+ localOnly: boolean;
246
+ notificationCount: number | null;
247
+ notificationPriority: number | null;
248
+ sound: string | null;
249
+ sticky: boolean;
250
+ tag: string | null;
251
+ ticker: string | null;
252
+ title: string | null;
253
+ titleLocalizationArgs: string[] | null;
254
+ titleLocalizationKey: string | null;
255
+ vibrateTimings: number[] | null;
256
+ visibility: number | null;
257
+ }
258
+
259
+ export interface IFirebaseRemoteMessage {
260
+ collapseKey: string | null;
261
+ data: Record<string, string>;
262
+ from: string | null;
263
+ messageId: string | null;
264
+ messageType: string | null;
265
+ originalPriority: number;
266
+ priority: number;
267
+ sentTime: number;
268
+ to: string | null;
269
+ ttl: number;
270
+ notification: null | IFirebaseRemoteMessageNotification;
271
+ }
272
+
273
+ export interface IUnknownNotificationTrigger {
274
+ type: 'unknown';
275
+ }
276
+
277
+ export type INotificationTrigger =
278
+ | IPushNotificationTrigger
279
+ | ILocationNotificationTrigger
280
+ | INotificationTriggerInput
281
+ | IUnknownNotificationTrigger;
282
+
283
+ export type IChannelAwareTriggerInput = { channelId: string };
284
+
285
+ export enum SchedulableTriggerInputTypes {
286
+ CALENDAR = 'calendar',
287
+ DAILY = 'daily',
288
+ WEEKLY = 'weekly',
289
+ MONTHLY = 'monthly',
290
+ YEARLY = 'yearly',
291
+ DATE = 'date',
292
+ TIME_INTERVAL = 'timeInterval',
293
+ }
294
+
295
+ /** @platform ios */
296
+ export type ICalendarTriggerInput = {
297
+ type: SchedulableTriggerInputTypes.CALENDAR;
298
+ channelId?: string;
299
+ repeats?: boolean;
300
+ seconds?: number;
301
+ timezone?: string;
302
+ year?: number;
303
+ month?: number;
304
+ weekday?: number;
305
+ weekOfMonth?: number;
306
+ weekOfYear?: number;
307
+ weekdayOrdinal?: number;
308
+ day?: number;
309
+ hour?: number;
310
+ minute?: number;
311
+ second?: number;
312
+ };
313
+
314
+ export type IDailyTriggerInput = {
315
+ type: SchedulableTriggerInputTypes.DAILY;
316
+ channelId?: string;
317
+ hour: number;
318
+ minute: number;
319
+ };
320
+
321
+ /** Weekdays are 1-7, with 1 = Sunday. */
322
+ export type IWeeklyTriggerInput = {
323
+ type: SchedulableTriggerInputTypes.WEEKLY;
324
+ channelId?: string;
325
+ weekday: number;
326
+ hour: number;
327
+ minute: number;
328
+ };
329
+
330
+ export type IMonthlyTriggerInput = {
331
+ type: SchedulableTriggerInputTypes.MONTHLY;
332
+ channelId?: string;
333
+ day: number;
334
+ hour: number;
335
+ minute: number;
336
+ };
337
+
338
+ export type IYearlyTriggerInput = {
339
+ type: SchedulableTriggerInputTypes.YEARLY;
340
+ channelId?: string;
341
+ day: number;
342
+ month: number;
343
+ hour: number;
344
+ minute: number;
345
+ };
346
+
347
+ export type IDateTriggerInput = {
348
+ type: SchedulableTriggerInputTypes.DATE;
349
+ date: Date | number;
350
+ channelId?: string;
351
+ };
352
+
353
+ /** On iOS, a repeating time-interval trigger must be 60 seconds or greater. */
354
+ export type ITimeIntervalTriggerInput = {
355
+ type: SchedulableTriggerInputTypes.TIME_INTERVAL;
356
+ channelId?: string;
357
+ repeats?: boolean;
358
+ seconds: number;
359
+ };
360
+
361
+ export type ISchedulableNotificationTriggerInput =
362
+ | ICalendarTriggerInput
363
+ | ITimeIntervalTriggerInput
364
+ | IDailyTriggerInput
365
+ | IWeeklyTriggerInput
366
+ | IMonthlyTriggerInput
367
+ | IYearlyTriggerInput
368
+ | IDateTriggerInput;
369
+
370
+ /** `null` means "deliver immediately". A `number`/`Date` is shorthand for a `DATE` trigger. */
371
+ export type INotificationTriggerInput =
372
+ null | IChannelAwareTriggerInput | ISchedulableNotificationTriggerInput;
373
+
374
+ /** @platform android */
375
+ export enum AndroidNotificationPriority {
376
+ MIN = 'min',
377
+ LOW = 'low',
378
+ DEFAULT = 'default',
379
+ HIGH = 'high',
380
+ MAX = 'max',
381
+ }
382
+
383
+ /** @platform ios */
384
+ export type INotificationContentAttachmentIos = {
385
+ identifier: string | null;
386
+ url: string | null;
387
+ type: string | null;
388
+ typeHint?: string;
389
+ hideThumbnail?: boolean;
390
+ thumbnailClipArea?: { x: number; y: number; width: number; height: number };
391
+ thumbnailTime?: number;
392
+ };
393
+
394
+ /** @platform ios */
395
+ export type IInterruptionLevel =
396
+ 'passive' | 'active' | 'timeSensitive' | 'critical';
397
+
398
+ /** @platform ios */
399
+ export type INotificationContentIos = {
400
+ launchImageName: string | null;
401
+ badge: number | null;
402
+ attachments: INotificationContentAttachmentIos[];
403
+ summaryArgument?: string | null;
404
+ summaryArgumentCount?: number;
405
+ threadIdentifier: string | null;
406
+ targetContentIdentifier?: string;
407
+ interruptionLevel?: IInterruptionLevel;
408
+ };
409
+
410
+ /** @platform android */
411
+ export type INotificationContentAndroid = {
412
+ badge?: number;
413
+ /** `#AARRGGBB` or `#RRGGBB`. */
414
+ color?: string;
415
+ priority?: AndroidNotificationPriority;
416
+ vibrationPattern?: number[];
417
+ };
418
+
419
+ /** As read back from native — see `INotificationContentInput` for the write-side type. */
420
+ export type INotificationContent = {
421
+ title: string | null;
422
+ subtitle: string | null;
423
+ body: string | null;
424
+ data?: Record<string, unknown>;
425
+ categoryIdentifier: string | null;
426
+ sound: 'default' | 'defaultCritical' | 'custom' | 'defaultRingtone' | null;
427
+ } & (INotificationContentIos | INotificationContentAndroid);
428
+
429
+ export interface INotificationRequest {
430
+ identifier: string;
431
+ content: INotificationContent;
432
+ trigger: INotificationTrigger;
433
+ }
434
+
435
+ /** What you pass in to `scheduleNotificationAsync`/`presentNotificationAsync`. */
436
+ export type INotificationContentInput = {
437
+ title?: string | null;
438
+ subtitle?: string | null;
439
+ body?: string | null;
440
+ data?: Record<string, unknown>;
441
+ /** @platform ios */
442
+ badge?: number;
443
+ /**
444
+ * `false` for a silent notification. On Android 8+, control sound via notification channels
445
+ * instead. `defaultCritical`/`defaultRingtone` are iOS-only; `defaultCritical` needs the
446
+ * critical-alerts entitlement. A custom filename must be added via `sounds` in
447
+ * `native-link.json`'s app-level config plugin step — see this package's README.
448
+ */
449
+ sound?:
450
+ boolean | 'default' | 'defaultCritical' | 'defaultRingtone' | (string & {});
451
+ launchImageName?: string;
452
+ /** @platform android */
453
+ vibrate?: number[];
454
+ /** @platform android */
455
+ priority?: string;
456
+ /** @platform android — `#AARRGGBB` or `#RRGGBB`. */
457
+ color?: string;
458
+ /** @platform android — corresponds to `Notification.Builder#setAutoCancel`. */
459
+ autoDismiss?: boolean;
460
+ /** @platform ios */
461
+ categoryIdentifier?: string;
462
+ /** @platform android — corresponds to `Notification.Builder#setOngoing`. */
463
+ sticky?: boolean;
464
+ /** @platform ios */
465
+ attachments?: INotificationContentAttachmentIos[];
466
+ /** @platform ios */
467
+ interruptionLevel?: IInterruptionLevel;
468
+ };
469
+
470
+ export interface INotificationRequestInput {
471
+ identifier?: string;
472
+ content: INotificationContentInput;
473
+ trigger: INotificationTriggerInput;
474
+ }
475
+
476
+ export interface INotification {
477
+ date: number;
478
+ request: INotificationRequest;
479
+ }
480
+
481
+ /** If the user tapped the notification, `actionIdentifier` equals `DEFAULT_ACTION_IDENTIFIER`. */
482
+ export interface INotificationResponse {
483
+ notification: INotification;
484
+ actionIdentifier: string;
485
+ userText?: string;
486
+ }
487
+
488
+ export interface INotificationBehavior {
489
+ /** @deprecated specify `shouldShowBanner`/`shouldShowList` instead. */
490
+ shouldShowAlert?: boolean;
491
+ shouldShowBanner: boolean;
492
+ shouldShowList: boolean;
493
+ shouldPlaySound: boolean;
494
+ /** @platform ios */
495
+ shouldSetBadge: boolean;
496
+ priority?: AndroidNotificationPriority;
497
+ }
498
+
499
+ export interface INotificationAction {
500
+ identifier: string;
501
+ buttonTitle: string;
502
+ textInput?: {
503
+ /** @platform ios */
504
+ submitButtonTitle: string;
505
+ placeholder: string;
506
+ };
507
+ options?: {
508
+ /** @platform ios */
509
+ isDestructive?: boolean;
510
+ /** @platform ios */
511
+ isAuthenticationRequired?: boolean;
512
+ /** @default true */
513
+ opensAppToForeground?: boolean;
514
+ };
515
+ }
516
+
517
+ /** @platform ios */
518
+ export type INotificationCategoryOptions = {
519
+ previewPlaceholder?: string;
520
+ intentIdentifiers?: string[];
521
+ categorySummaryFormat?: string;
522
+ customDismissAction?: boolean;
523
+ allowInCarPlay?: boolean;
524
+ showTitle?: boolean;
525
+ showSubtitle?: boolean;
526
+ /** @deprecated ignored by iOS. */
527
+ allowAnnouncement?: boolean;
528
+ };
529
+
530
+ export interface INotificationCategory {
531
+ identifier: string;
532
+ actions: INotificationAction[];
533
+ options?: INotificationCategoryOptions;
534
+ }
535
+
536
+ export type IMaybeNotificationResponse =
537
+ INotificationResponse | null | undefined;
538
+
539
+ /**
540
+ * Payload the background notification task executor receives — a `INotificationResponse` for a
541
+ * user interaction, or a raw remote-notification payload for a headless delivery.
542
+ */
543
+ export type INotificationTaskPayload =
544
+ | INotificationResponse
545
+ | {
546
+ /** `null` for headless background notifications. */
547
+ notification: Record<string, unknown> | null;
548
+ data: { dataString?: string; [key: string]: unknown };
549
+ /** @platform ios */
550
+ aps?: Record<string, unknown>;
551
+ };
552
+
553
+ // ---------------------------------------------------------------------------
554
+ // Android channels / channel groups
555
+ // ---------------------------------------------------------------------------
556
+
557
+ /** @platform android */
558
+ export enum AndroidNotificationVisibility {
559
+ UNKNOWN = 0,
560
+ PUBLIC = 1,
561
+ PRIVATE = 2,
562
+ SECRET = 3,
563
+ }
564
+
565
+ /** @platform android */
566
+ export enum AndroidAudioContentType {
567
+ UNKNOWN = 0,
568
+ SPEECH = 1,
569
+ MUSIC = 2,
570
+ MOVIE = 3,
571
+ SONIFICATION = 4,
572
+ }
573
+
574
+ /** @platform android */
575
+ export enum AndroidImportance {
576
+ UNKNOWN = 0,
577
+ /** Use `DEFAULT` instead — present for compatibility only. */
578
+ UNSPECIFIED = 1,
579
+ NONE = 2,
580
+ MIN = 3,
581
+ LOW = 4,
582
+ DEFAULT = 5,
583
+ HIGH = 6,
584
+ MAX = 7,
585
+ }
586
+
587
+ /** @platform android */
588
+ export enum AndroidAudioUsage {
589
+ UNKNOWN = 0,
590
+ MEDIA = 1,
591
+ VOICE_COMMUNICATION = 2,
592
+ VOICE_COMMUNICATION_SIGNALLING = 3,
593
+ ALARM = 4,
594
+ NOTIFICATION = 5,
595
+ NOTIFICATION_RINGTONE = 6,
596
+ NOTIFICATION_COMMUNICATION_REQUEST = 7,
597
+ NOTIFICATION_COMMUNICATION_INSTANT = 8,
598
+ NOTIFICATION_COMMUNICATION_DELAYED = 9,
599
+ NOTIFICATION_EVENT = 10,
600
+ ASSISTANCE_ACCESSIBILITY = 11,
601
+ ASSISTANCE_NAVIGATION_GUIDANCE = 12,
602
+ ASSISTANCE_SONIFICATION = 13,
603
+ GAME = 14,
604
+ }
605
+
606
+ /** @platform android */
607
+ export interface IAudioAttributes {
608
+ usage: AndroidAudioUsage;
609
+ contentType: AndroidAudioContentType;
610
+ flags: {
611
+ enforceAudibility: boolean;
612
+ requestHardwareAudioVideoSynchronization: boolean;
613
+ };
614
+ }
615
+
616
+ export type IAudioAttributesInput = Partial<IAudioAttributes>;
617
+
618
+ /** @platform android */
619
+ export interface INotificationChannel {
620
+ id: string;
621
+ name: string | null;
622
+ importance: AndroidImportance;
623
+ bypassDnd: boolean;
624
+ description: string | null;
625
+ groupId?: string | null;
626
+ lightColor: string;
627
+ lockscreenVisibility: AndroidNotificationVisibility;
628
+ showBadge: boolean;
629
+ sound: 'default' | 'custom' | null;
630
+ audioAttributes: IAudioAttributes;
631
+ vibrationPattern: number[] | null;
632
+ enableLights: boolean;
633
+ enableVibrate: boolean;
634
+ }
635
+
636
+ type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> &
637
+ Required<Pick<T, K>>;
638
+
639
+ /** @platform android */
640
+ export type INotificationChannelInput = RequiredBy<
641
+ Omit<INotificationChannel, 'id' | 'audioAttributes' | 'sound'> & {
642
+ audioAttributes?: IAudioAttributesInput;
643
+ sound?: string | null;
644
+ },
645
+ 'name' | 'importance'
646
+ >;
647
+
648
+ /** @platform android */
649
+ export interface INotificationChannelGroup {
650
+ id: string;
651
+ name: string | null;
652
+ description?: string | null;
653
+ isBlocked?: boolean;
654
+ channels: INotificationChannel[];
655
+ }
656
+
657
+ /** @platform android */
658
+ export interface INotificationChannelGroupInput {
659
+ name: string | null;
660
+ description?: string | null;
661
+ }
662
+
663
+ // ---------------------------------------------------------------------------
664
+ // Scheduler — native-facing trigger shapes (see scheduler.ts's parseTrigger)
665
+ // ---------------------------------------------------------------------------
666
+
667
+ export interface INativeChannelAwareTriggerInput {
668
+ type: 'channel';
669
+ channelId?: string;
670
+ }
671
+
672
+ export interface INativeCalendarTriggerInput {
673
+ type: 'calendar';
674
+ channelId?: string;
675
+ repeats?: boolean;
676
+ timezone?: string;
677
+ year?: number;
678
+ month?: number;
679
+ weekday?: number;
680
+ weekOfMonth?: number;
681
+ weekOfYear?: number;
682
+ weekdayOrdinal?: number;
683
+ day?: number;
684
+ hour?: number;
685
+ minute?: number;
686
+ second?: number;
687
+ }
688
+
689
+ export interface INativeTimeIntervalTriggerInput {
690
+ type: 'timeInterval';
691
+ channelId?: string;
692
+ repeats: boolean;
693
+ seconds: number;
694
+ }
695
+
696
+ export interface INativeDailyTriggerInput {
697
+ type: 'daily';
698
+ channelId?: string;
699
+ hour: number;
700
+ minute: number;
701
+ }
702
+
703
+ export interface INativeWeeklyTriggerInput {
704
+ type: 'weekly';
705
+ channelId?: string;
706
+ weekday: number;
707
+ hour: number;
708
+ minute: number;
709
+ }
710
+
711
+ export interface INativeYearlyTriggerInput {
712
+ type: 'yearly';
713
+ channelId?: string;
714
+ day: number;
715
+ month: number;
716
+ hour: number;
717
+ minute: number;
718
+ }
719
+
720
+ export interface INativeMonthlyTriggerInput {
721
+ type: 'monthly';
722
+ channelId?: string;
723
+ day: number;
724
+ hour: number;
725
+ minute: number;
726
+ }
727
+
728
+ export interface INativeDateTriggerInput {
729
+ type: 'date';
730
+ channelId?: string;
731
+ /** Milliseconds since epoch. */
732
+ timestamp: number;
733
+ }
734
+
735
+ export type INativeNotificationTriggerInput =
736
+ | null
737
+ | INativeChannelAwareTriggerInput
738
+ | INativeDateTriggerInput
739
+ | INativeCalendarTriggerInput
740
+ | INativeTimeIntervalTriggerInput
741
+ | INativeDailyTriggerInput
742
+ | INativeWeeklyTriggerInput
743
+ | INativeMonthlyTriggerInput
744
+ | INativeYearlyTriggerInput;
745
+
746
+ // ---------------------------------------------------------------------------
747
+ // Handler
748
+ // ---------------------------------------------------------------------------
749
+
750
+ export interface INotificationHandler {
751
+ handleNotification: (
752
+ notification: INotification,
753
+ ) => Promise<INotificationBehavior>;
754
+ handleSuccess?: (notificationId: string) => void;
755
+ handleError?: (notificationId: string, error: Error) => void;
756
+ }
757
+
758
+ // ---------------------------------------------------------------------------
759
+ // Background task
760
+ // ---------------------------------------------------------------------------
761
+
762
+ /** Corresponds to `UIBackgroundFetchResult`. @platform ios */
763
+ export enum BackgroundNotificationTaskResult {
764
+ NewData = 0,
765
+ NoData = 1,
766
+ Failed = 2,
767
+ }