@molecule/app-push 1.0.2 → 1.0.3

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 (3) hide show
  1. package/LICENSE +111 -24
  2. package/README.md +181 -173
  3. package/package.json +5 -5
package/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  Apache License
2
3
  Version 2.0, January 2004
3
4
  http://www.apache.org/licenses/
@@ -34,21 +35,33 @@
34
35
 
35
36
  "Work" shall mean the work of authorship, whether in Source or
36
37
  Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work.
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
38
40
 
39
41
  "Derivative Works" shall mean any work, whether in Source or Object
40
42
  form, that is based on (or derived from) the Work and for which the
41
43
  editorial revisions, annotations, elaborations, or other modifications
42
- represent, as a whole, an original work of authorship.
43
-
44
- "Contribution" shall mean any work of authorship, including the
45
- original version of the Work and any modifications or additions
46
- to that Work, that is intentionally submitted to the Licensor for
47
- inclusion in the Work by the copyright owner or by an individual or
48
- Legal Entity authorized to submit on behalf of the copyright owner.
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
49
62
 
50
63
  "Contributor" shall mean Licensor and any individual or Legal Entity
51
- on behalf of whom a Contribution has been received by the Licensor and
64
+ on behalf of whom a Contribution has been received by Licensor and
52
65
  subsequently incorporated within the Work.
53
66
 
54
67
  2. Grant of Copyright License. Subject to the terms and conditions of
@@ -61,8 +74,18 @@
61
74
  3. Grant of Patent License. Subject to the terms and conditions of
62
75
  this License, each Contributor hereby grants to You a perpetual,
63
76
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
- patent license to make, have made, use, offer to sell, sell, import,
65
- and otherwise transfer the Work.
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
66
89
 
67
90
  4. Redistribution. You may reproduce and distribute copies of the
68
91
  Work or Derivative Works thereof in any medium, with or without
@@ -84,23 +107,87 @@
84
107
  (d) If the Work includes a "NOTICE" text file as part of its
85
108
  distribution, then any Derivative Works that You distribute must
86
109
  include a readable copy of the attribution notices contained
87
- within such NOTICE file.
88
-
89
- 5. Submission of Contributions.
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
90
138
 
91
139
  6. Trademarks. This License does not grant permission to use the trade
92
- names, trademarks, service marks, or product names of the Licensor.
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
93
143
 
94
144
  7. Disclaimer of Warranty. Unless required by applicable law or
95
- agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
-
98
- 8. Limitation of Liability. In no event and under no legal theory shall
99
- any Contributor be liable to You for damages.
100
-
101
- 9. Accepting Warranty or Additional Liability.
102
-
103
- Copyright 2026 Molecule Dev, Inc.
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
104
191
 
105
192
  Licensed under the Apache License, Version 2.0 (the "License");
106
193
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-08-04T01:52:23.687Z
6
+ Generated: 2026-10-16T23:37:16.047Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-push
10
10
 
11
- > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
- > It is written to be read by coding agents as much as by people, and is generated from this
13
- > package's source — edit `src/index.ts` JSDoc, not this file.
14
-
15
11
  Client-side push notifications interface for molecule.dev.
16
12
 
17
13
  Provides a unified API for push notifications across platforms (web,
@@ -22,6 +18,10 @@ notifications (`scheduleLocal`), and badges (`setBadge`, `clearBadge`).
22
18
  The device token is what your API's `@molecule/api-push-notifications`
23
19
  bond sends to.
24
20
 
21
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
22
+ > It is written to be read by coding agents as much as by people, and is generated from this
23
+ > package's source — edit `src/index.ts` JSDoc, not this file.
24
+
25
25
  ## Quick Start
26
26
 
27
27
  ```typescript
@@ -54,16 +54,16 @@ npm install @molecule/app-push @molecule/app-bond @molecule/app-i18n
54
54
 
55
55
  ### Interfaces
56
56
 
57
- #### `LocalNotificationOptions`
57
+ #### `PushNotification`
58
58
 
59
- Options for scheduling a local notification.
59
+ Push notification payload.
60
60
 
61
61
  ```typescript
62
- interface LocalNotificationOptions {
62
+ interface PushNotification {
63
63
  /**
64
64
  * Notification ID.
65
65
  */
66
- id?: string
66
+ id: string
67
67
 
68
68
  /**
69
69
  * Notification title.
@@ -71,62 +71,105 @@ interface LocalNotificationOptions {
71
71
  title: string
72
72
 
73
73
  /**
74
- * Notification body.
74
+ * Notification body/message.
75
75
  */
76
76
  body?: string
77
77
 
78
78
  /**
79
- * Schedule at a specific time.
79
+ * Notification data payload.
80
80
  */
81
- at?: Date
81
+ data?: Record<string, unknown>
82
82
 
83
83
  /**
84
- * Repeat interval.
84
+ * Badge count.
85
85
  */
86
- repeat?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'
86
+ badge?: number
87
87
 
88
88
  /**
89
- * Extra data.
89
+ * Sound to play.
90
90
  */
91
- extra?: Record<string, unknown>
91
+ sound?: string
92
92
 
93
93
  /**
94
- * Sound to play.
94
+ * Icon URL.
95
95
  */
96
- sound?: string
96
+ icon?: string
97
97
 
98
98
  /**
99
- * Badge count.
99
+ * Image URL.
100
100
  */
101
- badge?: number
101
+ image?: string
102
102
 
103
103
  /**
104
- * Notification channel (Android).
104
+ * Click action/URL.
105
105
  */
106
- channelId?: string
106
+ clickAction?: string
107
107
 
108
108
  /**
109
- * Actions/buttons.
109
+ * Notification tag (for grouping).
110
+ */
111
+ tag?: string
112
+
113
+ /**
114
+ * Whether the notification requires interaction.
115
+ */
116
+ requireInteraction?: boolean
117
+
118
+ /**
119
+ * Notification timestamp.
120
+ */
121
+ timestamp?: number
122
+
123
+ /**
124
+ * Notification actions (buttons).
110
125
  */
111
126
  actions?: PushNotificationAction[]
112
127
  }
113
128
  ```
114
129
 
115
- #### `NotificationActionEvent`
130
+ #### `PushNotificationAction`
116
131
 
117
- Notification action event.
132
+ Notification action button.
118
133
 
119
134
  ```typescript
120
- interface NotificationActionEvent {
135
+ interface PushNotificationAction {
121
136
  /**
122
- * The notification.
137
+ * Action ID.
123
138
  */
124
- notification: PushNotification
139
+ id: string
125
140
 
126
141
  /**
127
- * Action that was triggered.
142
+ * Action title.
128
143
  */
129
- actionId?: string
144
+ title: string
145
+
146
+ /**
147
+ * Action icon.
148
+ */
149
+ icon?: string
150
+ }
151
+ ```
152
+
153
+ #### `PushToken`
154
+
155
+ Push token info.
156
+
157
+ ```typescript
158
+ interface PushToken {
159
+ /**
160
+ * Token value.
161
+ */
162
+ value: string
163
+
164
+ /**
165
+ * Platform the token is for.
166
+ */
167
+ platform: 'web' | 'ios' | 'android'
168
+
169
+ /**
170
+ * When the token was obtained.
171
+ */
172
+ timestamp: number
130
173
  }
131
174
  ```
132
175
 
@@ -148,99 +191,97 @@ interface NotificationReceivedEvent {
148
191
  }
149
192
  ```
150
193
 
151
- #### `PushNotification`
194
+ #### `NotificationActionEvent`
152
195
 
153
- Push notification payload.
196
+ Notification action event.
154
197
 
155
198
  ```typescript
156
- interface PushNotification {
199
+ interface NotificationActionEvent {
157
200
  /**
158
- * Notification ID.
201
+ * The notification.
159
202
  */
160
- id: string
203
+ notification: PushNotification
161
204
 
162
205
  /**
163
- * Notification title.
206
+ * Action that was triggered.
164
207
  */
165
- title: string
208
+ actionId?: string
209
+ }
210
+ ```
166
211
 
167
- /**
168
- * Notification body/message.
169
- */
170
- body?: string
212
+ #### `LocalNotificationOptions`
213
+
214
+ Options for scheduling a local notification.
171
215
 
216
+ ```typescript
217
+ interface LocalNotificationOptions {
172
218
  /**
173
- * Notification data payload.
219
+ * Notification ID.
174
220
  */
175
- data?: Record<string, unknown>
221
+ id?: string
176
222
 
177
223
  /**
178
- * Badge count.
224
+ * Notification title.
179
225
  */
180
- badge?: number
226
+ title: string
181
227
 
182
228
  /**
183
- * Sound to play.
229
+ * Notification body.
184
230
  */
185
- sound?: string
231
+ body?: string
186
232
 
187
233
  /**
188
- * Icon URL.
234
+ * Schedule at a specific time.
189
235
  */
190
- icon?: string
236
+ at?: Date
191
237
 
192
238
  /**
193
- * Image URL.
239
+ * Repeat interval.
194
240
  */
195
- image?: string
241
+ repeat?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'
196
242
 
197
243
  /**
198
- * Click action/URL.
244
+ * Extra data.
199
245
  */
200
- clickAction?: string
246
+ extra?: Record<string, unknown>
201
247
 
202
248
  /**
203
- * Notification tag (for grouping).
249
+ * Sound to play.
204
250
  */
205
- tag?: string
251
+ sound?: string
206
252
 
207
253
  /**
208
- * Whether the notification requires interaction.
254
+ * Badge count.
209
255
  */
210
- requireInteraction?: boolean
256
+ badge?: number
211
257
 
212
258
  /**
213
- * Notification timestamp.
259
+ * Notification channel (Android).
214
260
  */
215
- timestamp?: number
261
+ channelId?: string
216
262
 
217
263
  /**
218
- * Notification actions (buttons).
264
+ * Actions/buttons.
219
265
  */
220
266
  actions?: PushNotificationAction[]
221
267
  }
222
268
  ```
223
269
 
224
- #### `PushNotificationAction`
270
+ #### `PushRegisterOptions`
225
271
 
226
- Notification action button.
272
+ Options for {@link PushProvider.register}.
227
273
 
228
274
  ```typescript
229
- interface PushNotificationAction {
230
- /**
231
- * Action ID.
232
- */
233
- id: string
234
-
235
- /**
236
- * Action title.
237
- */
238
- title: string
239
-
275
+ interface PushRegisterOptions {
240
276
  /**
241
- * Action icon.
277
+ * VAPID public key (URL-safe base64) used as the `applicationServerKey`
278
+ * when subscribing on the web. Chromium rejects keyless subscriptions, so
279
+ * web apps should deliver the server's key at runtime (e.g. from
280
+ * `GET /api/devices/push/public-key`) and pass it here. Takes precedence
281
+ * over any key the provider was constructed with. Ignored by providers
282
+ * whose platform does not use VAPID (e.g. FCM/APNs native providers).
242
283
  */
243
- icon?: string
284
+ vapidPublicKey?: string
244
285
  }
245
286
  ```
246
287
 
@@ -353,55 +394,14 @@ interface PushProvider {
353
394
  }
354
395
  ```
355
396
 
356
- #### `PushRegisterOptions`
357
-
358
- Options for {@link PushProvider.register}.
359
-
360
- ```typescript
361
- interface PushRegisterOptions {
362
- /**
363
- * VAPID public key (URL-safe base64) used as the `applicationServerKey`
364
- * when subscribing on the web. Chromium rejects keyless subscriptions, so
365
- * web apps should deliver the server's key at runtime (e.g. from
366
- * `GET /api/devices/push/public-key`) and pass it here. Takes precedence
367
- * over any key the provider was constructed with. Ignored by providers
368
- * whose platform does not use VAPID (e.g. FCM/APNs native providers).
369
- */
370
- vapidPublicKey?: string
371
- }
372
- ```
373
-
374
- #### `PushToken`
375
-
376
- Push token info.
377
-
378
- ```typescript
379
- interface PushToken {
380
- /**
381
- * Token value.
382
- */
383
- value: string
384
-
385
- /**
386
- * Platform the token is for.
387
- */
388
- platform: 'web' | 'ios' | 'android'
389
-
390
- /**
391
- * When the token was obtained.
392
- */
393
- timestamp: number
394
- }
395
- ```
396
-
397
397
  ### Types
398
398
 
399
- #### `NotificationActionListener`
399
+ #### `PermissionStatus`
400
400
 
401
- Notification Action Listener type.
401
+ Push notification permission status.
402
402
 
403
403
  ```typescript
404
- type NotificationActionListener = (event: NotificationActionEvent) => void
404
+ type PermissionStatus = 'granted' | 'denied' | 'default' | 'prompt'
405
405
  ```
406
406
 
407
407
  #### `NotificationReceivedListener`
@@ -412,12 +412,14 @@ Listener invoked when a push notification is received.
412
412
  type NotificationReceivedListener = (event: NotificationReceivedEvent) => void
413
413
  ```
414
414
 
415
- #### `PermissionStatus`
415
+ - `event` — The received notification and foreground state.
416
416
 
417
- Push notification permission status.
417
+ #### `NotificationActionListener`
418
+
419
+ Notification Action Listener type.
418
420
 
419
421
  ```typescript
420
- type PermissionStatus = 'granted' | 'denied' | 'default' | 'prompt'
422
+ type NotificationActionListener = (event: NotificationActionEvent) => void
421
423
  ```
422
424
 
423
425
  #### `TokenChangeListener`
@@ -430,79 +432,77 @@ type TokenChangeListener = (token: PushToken) => void
430
432
 
431
433
  ### Functions
432
434
 
433
- #### `checkPermission()`
435
+ #### `setProvider(provider)`
434
436
 
435
- Checks the current notification permission status.
437
+ Sets the push provider implementation.
436
438
 
437
439
  ```typescript
438
- function checkPermission(): Promise<PermissionStatus>
440
+ function setProvider(provider: PushProvider): void
439
441
  ```
440
442
 
441
- **Returns:** The current permission status (granted, denied, default, or prompt).
443
+ - `provider` — The push provider to bond as the active implementation.
442
444
 
443
- #### `clearBadge()`
445
+ #### `getProvider()`
444
446
 
445
- Clears the app icon badge count.
447
+ Gets the current push provider, creating a default web provider if none is bonded.
446
448
 
447
449
  ```typescript
448
- function clearBadge(): Promise<void>
450
+ function getProvider(): PushProvider
449
451
  ```
450
452
 
451
- **Returns:** A promise that resolves when the badge count is cleared.
453
+ **Returns:** The active push provider instance.
452
454
 
453
- #### `createWebPushProvider(vapidPublicKey)`
455
+ #### `hasProvider()`
454
456
 
455
- Creates a web push provider using the browser Push API and Notification API.
457
+ Checks if a push provider has been bonded.
456
458
 
457
459
  ```typescript
458
- function createWebPushProvider(vapidPublicKey?: string): PushProvider
460
+ function hasProvider(): boolean
459
461
  ```
460
462
 
461
- - `vapidPublicKey` — Optional VAPID public key for server-authenticated subscriptions.
462
-
463
- **Returns:** A {@link PushProvider} backed by the Web Push API.
463
+ **Returns:** Whether a push provider is currently registered.
464
464
 
465
- #### `getProvider()`
465
+ #### `checkPermission()`
466
466
 
467
- Gets the current push provider, creating a default web provider if none is bonded.
467
+ Checks the current notification permission status.
468
468
 
469
469
  ```typescript
470
- function getProvider(): PushProvider
470
+ function checkPermission(): Promise<PermissionStatus>
471
471
  ```
472
472
 
473
- **Returns:** The active push provider instance.
473
+ **Returns:** The current permission status (granted, denied, default, or prompt).
474
474
 
475
- #### `getToken()`
475
+ #### `requestPermission()`
476
476
 
477
- Gets the current push token.
477
+ Requests notification permission from the user.
478
478
 
479
479
  ```typescript
480
- function getToken(): Promise<PushToken | null>
480
+ function requestPermission(): Promise<PermissionStatus>
481
481
  ```
482
482
 
483
- **Returns:** The current token, or `null` if not registered.
483
+ **Returns:** The resulting permission status after the user responds.
484
484
 
485
- #### `hasProvider()`
485
+ #### `register(options)`
486
486
 
487
- Checks if a push provider has been bonded.
487
+ Registers for push notifications and obtains a device token.
488
488
 
489
489
  ```typescript
490
- function hasProvider(): boolean
490
+ function register(options?: PushRegisterOptions): Promise<PushToken>
491
491
  ```
492
492
 
493
- **Returns:** Whether a push provider is currently registered.
493
+ - `options` — Optional registration options (e.g. a runtime VAPID public key).
494
494
 
495
- #### `onNotificationAction(listener)`
495
+ **Returns:** The push token for this device.
496
496
 
497
- Subscribes to notification action events (taps, button clicks).
497
+ #### `getToken()`
498
+
499
+ Gets the current push token.
498
500
 
499
501
  ```typescript
500
- function onNotificationAction(listener: NotificationActionListener): () => void
502
+ function getToken(): Promise<PushToken | null>
501
503
  ```
502
504
 
503
- - `listener` — Callback invoked when a notification action is triggered.
504
-
505
- **Returns:** An unsubscribe function to remove the listener.
505
+ **Returns:** The current token, or `null` if not registered.
506
506
 
507
507
  #### `onNotificationReceived(listener)`
508
508
 
@@ -516,27 +516,17 @@ function onNotificationReceived(listener: NotificationReceivedListener): () => v
516
516
 
517
517
  **Returns:** An unsubscribe function to remove the listener.
518
518
 
519
- #### `register(options)`
519
+ #### `onNotificationAction(listener)`
520
520
 
521
- Registers for push notifications and obtains a device token.
521
+ Subscribes to notification action events (taps, button clicks).
522
522
 
523
523
  ```typescript
524
- function register(options?: PushRegisterOptions): Promise<PushToken>
524
+ function onNotificationAction(listener: NotificationActionListener): () => void
525
525
  ```
526
526
 
527
- - `options` — Optional registration options (e.g. a runtime VAPID public key).
528
-
529
- **Returns:** The push token for this device.
530
-
531
- #### `requestPermission()`
532
-
533
- Requests notification permission from the user.
534
-
535
- ```typescript
536
- function requestPermission(): Promise<PermissionStatus>
537
- ```
527
+ - `listener` — Callback invoked when a notification action is triggered.
538
528
 
539
- **Returns:** The resulting permission status after the user responds.
529
+ **Returns:** An unsubscribe function to remove the listener.
540
530
 
541
531
  #### `scheduleLocal(options)`
542
532
 
@@ -562,15 +552,33 @@ function setBadge(count: number): Promise<void>
562
552
 
563
553
  **Returns:** A promise that resolves when the badge count is set.
564
554
 
565
- #### `setProvider(provider)`
555
+ #### `clearBadge()`
566
556
 
567
- Sets the push provider implementation.
557
+ Clears the app icon badge count.
568
558
 
569
559
  ```typescript
570
- function setProvider(provider: PushProvider): void
560
+ function clearBadge(): Promise<void>
571
561
  ```
572
562
 
573
- - `provider` — The push provider to bond as the active implementation.
563
+ **Returns:** A promise that resolves when the badge count is cleared.
564
+
565
+ #### `createWebPushProvider(vapidPublicKey)`
566
+
567
+ Creates a web push provider using the browser Push API and Notification API.
568
+
569
+ ```typescript
570
+ function createWebPushProvider(vapidPublicKey?: string): PushProvider
571
+ ```
572
+
573
+ - `vapidPublicKey` — Optional VAPID public key for server-authenticated subscriptions.
574
+
575
+ **Returns:** A {@link PushProvider} backed by the Web Push API.
576
+
577
+ ## Available Providers
578
+
579
+ | Provider | Package |
580
+ | ----------------- | --------------------------------- |
581
+ | React Native Push | `@molecule/app-push-react-native` |
574
582
 
575
583
  ## Injection Notes
576
584
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-push",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Client-side push notifications interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,11 +32,11 @@
32
32
  "@molecule/app-i18n": "^1.0.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@molecule/app-bond": "1.0.2",
36
- "@molecule/app-i18n": "1.0.2",
37
- "@types/node": "26.1.2",
35
+ "@molecule/app-bond": "1.0.3",
36
+ "@molecule/app-i18n": "1.0.4",
37
+ "@types/node": "26.6.5",
38
38
  "typescript": "6.0.3",
39
- "vitest": "4.1.11"
39
+ "vitest": "4.1.12"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",