@firebase/messaging 0.13.1 → 0.13.2
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/esm/index.esm.js +1 -1
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/index.sw.esm.js +1 -1
- package/dist/esm/index.sw.esm.js.map +1 -1
- package/dist/index-public.d.ts +122 -86
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.sw.cjs +1 -1
- package/dist/index.sw.cjs.map +1 -1
- package/dist/sw/index-public.d.ts +114 -85
- package/package.json +6 -6
package/dist/index-public.d.ts
CHANGED
|
@@ -4,9 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
import { FirebaseApp } from '@firebase/app';
|
|
8
9
|
|
|
9
|
-
import { NextFn
|
|
10
|
+
import { NextFn } from '@firebase/util';
|
|
11
|
+
|
|
12
|
+
import { Observer } from '@firebase/util';
|
|
13
|
+
|
|
14
|
+
import { Unsubscribe } from '@firebase/util';
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* Deletes the registration token associated with this {@link Messaging} instance and unsubscribes
|
|
@@ -27,6 +32,7 @@ import { NextFn , Observer , Unsubscribe } from '@firebase/util';
|
|
|
27
32
|
* @public
|
|
28
33
|
*/
|
|
29
34
|
export declare function deleteToken(messaging: Messaging): Promise<boolean>;
|
|
35
|
+
|
|
30
36
|
/**
|
|
31
37
|
* Options for features provided by the FCM SDK for Web. See {@link
|
|
32
38
|
* https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
|
|
@@ -35,16 +41,18 @@ export declare function deleteToken(messaging: Messaging): Promise<boolean>;
|
|
|
35
41
|
* @public
|
|
36
42
|
*/
|
|
37
43
|
export declare interface FcmOptions {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The link to open when the user clicks on the notification.
|
|
46
|
+
*/
|
|
47
|
+
link?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The label associated with the message's analytics data.
|
|
50
|
+
*/
|
|
51
|
+
analyticsLabel?: string;
|
|
46
52
|
}
|
|
53
|
+
|
|
47
54
|
/* Excluded from this release type: _FirebaseMessagingName */
|
|
55
|
+
|
|
48
56
|
/**
|
|
49
57
|
* Retrieves a Firebase Cloud Messaging instance.
|
|
50
58
|
*
|
|
@@ -53,6 +61,7 @@ export declare interface FcmOptions {
|
|
|
53
61
|
* @public
|
|
54
62
|
*/
|
|
55
63
|
export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
64
|
+
|
|
56
65
|
/**
|
|
57
66
|
* Subscribes the {@link Messaging} instance to push notifications. Returns a Firebase Cloud
|
|
58
67
|
* Messaging registration token that can be used to send push messages to that {@link Messaging}
|
|
@@ -71,34 +80,39 @@ export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
|
71
80
|
*
|
|
72
81
|
* @public
|
|
73
82
|
*/
|
|
74
|
-
export declare function getToken(
|
|
83
|
+
export declare function getToken(
|
|
84
|
+
messaging: Messaging,
|
|
85
|
+
options?: GetTokenOptions
|
|
86
|
+
): Promise<string>;
|
|
87
|
+
|
|
75
88
|
/**
|
|
76
89
|
* Options for {@link getToken}.
|
|
77
90
|
*
|
|
78
91
|
* @public
|
|
79
92
|
*/
|
|
80
93
|
export declare interface GetTokenOptions {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
/**
|
|
95
|
+
* The public server key provided to push services. The key is used to
|
|
96
|
+
* authenticate push subscribers to receive push messages only from sending servers that hold
|
|
97
|
+
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
|
|
98
|
+
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
|
|
99
|
+
* to generate and import a VAPID key for your project with
|
|
100
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
|
|
101
|
+
* See
|
|
102
|
+
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
|
|
103
|
+
* for details on web push services.
|
|
104
|
+
*/
|
|
105
|
+
vapidKey?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The service worker registration for receiving push
|
|
108
|
+
* messaging. If the registration is not provided explicitly, you need to have a
|
|
109
|
+
* `firebase-messaging-sw.js` at your root location. See
|
|
110
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
|
|
111
|
+
* for more details.
|
|
112
|
+
*/
|
|
113
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
101
114
|
}
|
|
115
|
+
|
|
102
116
|
/**
|
|
103
117
|
* @license
|
|
104
118
|
* Copyright 2020 Google LLC
|
|
@@ -122,6 +136,7 @@ export declare interface GetTokenOptions {
|
|
|
122
136
|
* @public
|
|
123
137
|
*/
|
|
124
138
|
export declare function isSupported(): Promise<boolean>;
|
|
139
|
+
|
|
125
140
|
/**
|
|
126
141
|
* Message payload that contains the notification payload that is represented with
|
|
127
142
|
* {@link NotificationPayload} and the data payload that contains an arbitrary
|
|
@@ -131,46 +146,48 @@ export declare function isSupported(): Promise<boolean>;
|
|
|
131
146
|
* @public
|
|
132
147
|
*/
|
|
133
148
|
export declare interface MessagePayload {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
149
|
+
/**
|
|
150
|
+
* {@inheritdoc NotificationPayload}
|
|
151
|
+
*/
|
|
152
|
+
notification?: NotificationPayload;
|
|
153
|
+
/**
|
|
154
|
+
* Arbitrary key/value payload.
|
|
155
|
+
*/
|
|
156
|
+
data?: {
|
|
157
|
+
[key: string]: string;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* {@inheritdoc FcmOptions}
|
|
161
|
+
*/
|
|
162
|
+
fcmOptions?: FcmOptions;
|
|
163
|
+
/**
|
|
164
|
+
* The sender of this message.
|
|
165
|
+
*/
|
|
166
|
+
from: string;
|
|
167
|
+
/**
|
|
168
|
+
* The collapse key of the message. See
|
|
169
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
|
|
170
|
+
*/
|
|
171
|
+
collapseKey: string;
|
|
172
|
+
/**
|
|
173
|
+
* The message ID of a message.
|
|
174
|
+
*/
|
|
175
|
+
messageId: string;
|
|
161
176
|
}
|
|
177
|
+
|
|
162
178
|
/**
|
|
163
179
|
* Public interface of the Firebase Cloud Messaging SDK.
|
|
164
180
|
*
|
|
165
181
|
* @public
|
|
166
182
|
*/
|
|
167
183
|
export declare interface Messaging {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
184
|
+
/**
|
|
185
|
+
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
|
|
186
|
+
*/
|
|
187
|
+
app: FirebaseApp;
|
|
172
188
|
}
|
|
173
189
|
export { NextFn };
|
|
190
|
+
|
|
174
191
|
/**
|
|
175
192
|
* Display notification details. Details are sent through the
|
|
176
193
|
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
@@ -178,25 +195,26 @@ export { NextFn };
|
|
|
178
195
|
* @public
|
|
179
196
|
*/
|
|
180
197
|
export declare interface NotificationPayload {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
/**
|
|
199
|
+
* The notification's title.
|
|
200
|
+
*/
|
|
201
|
+
title?: string;
|
|
202
|
+
/**
|
|
203
|
+
* The notification's body text.
|
|
204
|
+
*/
|
|
205
|
+
body?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The URL of an image that is downloaded on the device and displayed in the notification.
|
|
208
|
+
*/
|
|
209
|
+
image?: string;
|
|
210
|
+
/**
|
|
211
|
+
* The URL to use for the notification's icon. If you don't send this key in the request,
|
|
212
|
+
* FCM displays the launcher icon specified in your app manifest.
|
|
213
|
+
*/
|
|
214
|
+
icon?: string;
|
|
198
215
|
}
|
|
199
216
|
export { Observer };
|
|
217
|
+
|
|
200
218
|
/**
|
|
201
219
|
* When a push message is received and the user is currently on a page for your origin, the
|
|
202
220
|
* message is passed to the page and an `onMessage()` event is dispatched with the payload of
|
|
@@ -210,7 +228,11 @@ export { Observer };
|
|
|
210
228
|
*
|
|
211
229
|
* @public
|
|
212
230
|
*/
|
|
213
|
-
export declare function onMessage(
|
|
231
|
+
export declare function onMessage(
|
|
232
|
+
messaging: Messaging,
|
|
233
|
+
nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>
|
|
234
|
+
): Unsubscribe;
|
|
235
|
+
|
|
214
236
|
/**
|
|
215
237
|
* Subscribes to an event that the app instance is registered with FCM via Firebase Installation ID (FID).
|
|
216
238
|
* Use the FID passed to the callback to upload it to your application server. When you receive an FID
|
|
@@ -222,7 +244,11 @@ export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<M
|
|
|
222
244
|
*
|
|
223
245
|
* @public
|
|
224
246
|
*/
|
|
225
|
-
export declare function onRegistered(
|
|
247
|
+
export declare function onRegistered(
|
|
248
|
+
messaging: Messaging,
|
|
249
|
+
nextOrObserver: NextFn<string> | Observer<string>
|
|
250
|
+
): Unsubscribe;
|
|
251
|
+
|
|
226
252
|
/**
|
|
227
253
|
* Subscribes to an event that the app instance is unregistered from FCM (FID no longer active).
|
|
228
254
|
* Use this to notify your backend to remove this FID to prevent 404 errors on send.
|
|
@@ -233,7 +259,11 @@ export declare function onRegistered(messaging: Messaging, nextOrObserver: NextF
|
|
|
233
259
|
*
|
|
234
260
|
* @public
|
|
235
261
|
*/
|
|
236
|
-
export declare function onUnregistered(
|
|
262
|
+
export declare function onUnregistered(
|
|
263
|
+
messaging: Messaging,
|
|
264
|
+
nextOrObserver: NextFn<string> | Observer<string>
|
|
265
|
+
): Unsubscribe;
|
|
266
|
+
|
|
237
267
|
/**
|
|
238
268
|
* Registers the app instance with FCM using its Firebase Installation ID (FID). The FID is
|
|
239
269
|
* delivered via the {@link onRegistered} callback, not as a return value. Call this to establish
|
|
@@ -247,18 +277,23 @@ export declare function onUnregistered(messaging: Messaging, nextOrObserver: Nex
|
|
|
247
277
|
*
|
|
248
278
|
* @public
|
|
249
279
|
*/
|
|
250
|
-
export declare function register(
|
|
280
|
+
export declare function register(
|
|
281
|
+
messaging: Messaging,
|
|
282
|
+
options?: RegisterOptions
|
|
283
|
+
): Promise<void>;
|
|
284
|
+
|
|
251
285
|
/**
|
|
252
286
|
* Options for {@link register}. Same shape as GetTokenOptions for SW and VAPID configuration.
|
|
253
287
|
*
|
|
254
288
|
* @public
|
|
255
289
|
*/
|
|
256
290
|
export declare interface RegisterOptions {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
291
|
+
/** Optional VAPID key. See {@link GetTokenOptions.vapidKey}. */
|
|
292
|
+
vapidKey?: string;
|
|
293
|
+
/** Optional service worker registration. See {@link GetTokenOptions.serviceWorkerRegistration}. */
|
|
294
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
261
295
|
}
|
|
296
|
+
|
|
262
297
|
/**
|
|
263
298
|
* Unregisters the app instance from FCM by deleting its FID-based registration.
|
|
264
299
|
* On success, triggers {@link onUnregistered} (if registered) with the unregistered FID.
|
|
@@ -269,4 +304,5 @@ export declare interface RegisterOptions {
|
|
|
269
304
|
*/
|
|
270
305
|
export declare function unregister(messaging: Messaging): Promise<void>;
|
|
271
306
|
export { Unsubscribe };
|
|
307
|
+
|
|
272
308
|
export {};
|