@firebase/messaging 0.13.2 → 0.13.3-crashlytics2.142b40983
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.sw.esm.js +1 -1
- package/dist/index-public.d.ts +92 -107
- package/dist/index.cjs.js +1 -1
- package/dist/index.sw.cjs +1 -1
- package/dist/internal.d.ts +3 -0
- package/dist/src/tsdoc-metadata.json +1 -1
- package/dist/sw/index-public.d.ts +91 -103
- package/dist/sw/internal.d.ts +3 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +10 -11
- package/dist/private.d.ts +0 -290
- package/dist/sw/private.d.ts +0 -214
package/dist/esm/index.esm.js
CHANGED
package/dist/esm/index.sw.esm.js
CHANGED
package/dist/index-public.d.ts
CHANGED
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { FirebaseApp } from '@firebase/app';
|
|
9
|
-
|
|
10
9
|
import { NextFn } from '@firebase/util';
|
|
11
|
-
|
|
12
10
|
import { Observer } from '@firebase/util';
|
|
13
|
-
|
|
14
11
|
import { Unsubscribe } from '@firebase/util';
|
|
15
12
|
|
|
16
13
|
/**
|
|
@@ -41,14 +38,14 @@ export declare function deleteToken(messaging: Messaging): Promise<boolean>;
|
|
|
41
38
|
* @public
|
|
42
39
|
*/
|
|
43
40
|
export declare interface FcmOptions {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The link to open when the user clicks on the notification.
|
|
43
|
+
*/
|
|
44
|
+
link?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The label associated with the message's analytics data.
|
|
47
|
+
*/
|
|
48
|
+
analyticsLabel?: string;
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
/* Excluded from this release type: _FirebaseMessagingName */
|
|
@@ -80,10 +77,7 @@ export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
|
80
77
|
*
|
|
81
78
|
* @public
|
|
82
79
|
*/
|
|
83
|
-
export declare function getToken(
|
|
84
|
-
messaging: Messaging,
|
|
85
|
-
options?: GetTokenOptions
|
|
86
|
-
): Promise<string>;
|
|
80
|
+
export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
|
|
87
81
|
|
|
88
82
|
/**
|
|
89
83
|
* Options for {@link getToken}.
|
|
@@ -91,26 +85,26 @@ export declare function getToken(
|
|
|
91
85
|
* @public
|
|
92
86
|
*/
|
|
93
87
|
export declare interface GetTokenOptions {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
88
|
+
/**
|
|
89
|
+
* The public server key provided to push services. The key is used to
|
|
90
|
+
* authenticate push subscribers to receive push messages only from sending servers that hold
|
|
91
|
+
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
|
|
92
|
+
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
|
|
93
|
+
* to generate and import a VAPID key for your project with
|
|
94
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
|
|
95
|
+
* See
|
|
96
|
+
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
|
|
97
|
+
* for details on web push services.
|
|
98
|
+
*/
|
|
99
|
+
vapidKey?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The service worker registration for receiving push
|
|
102
|
+
* messaging. If the registration is not provided explicitly, you need to have a
|
|
103
|
+
* `firebase-messaging-sw.js` at your root location. See
|
|
104
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
|
|
105
|
+
* for more details.
|
|
106
|
+
*/
|
|
107
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
114
108
|
}
|
|
115
109
|
|
|
116
110
|
/**
|
|
@@ -146,33 +140,33 @@ export declare function isSupported(): Promise<boolean>;
|
|
|
146
140
|
* @public
|
|
147
141
|
*/
|
|
148
142
|
export declare interface MessagePayload {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
143
|
+
/**
|
|
144
|
+
* {@inheritdoc NotificationPayload}
|
|
145
|
+
*/
|
|
146
|
+
notification?: NotificationPayload;
|
|
147
|
+
/**
|
|
148
|
+
* Arbitrary key/value payload.
|
|
149
|
+
*/
|
|
150
|
+
data?: {
|
|
151
|
+
[key: string]: string;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* {@inheritdoc FcmOptions}
|
|
155
|
+
*/
|
|
156
|
+
fcmOptions?: FcmOptions;
|
|
157
|
+
/**
|
|
158
|
+
* The sender of this message.
|
|
159
|
+
*/
|
|
160
|
+
from: string;
|
|
161
|
+
/**
|
|
162
|
+
* The collapse key of the message. See
|
|
163
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
|
|
164
|
+
*/
|
|
165
|
+
collapseKey: string;
|
|
166
|
+
/**
|
|
167
|
+
* The message ID of a message.
|
|
168
|
+
*/
|
|
169
|
+
messageId: string;
|
|
176
170
|
}
|
|
177
171
|
|
|
178
172
|
/**
|
|
@@ -181,12 +175,13 @@ export declare interface MessagePayload {
|
|
|
181
175
|
* @public
|
|
182
176
|
*/
|
|
183
177
|
export declare interface Messaging {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
178
|
+
/**
|
|
179
|
+
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
|
|
180
|
+
*/
|
|
181
|
+
app: FirebaseApp;
|
|
188
182
|
}
|
|
189
|
-
|
|
183
|
+
|
|
184
|
+
export { NextFn }
|
|
190
185
|
|
|
191
186
|
/**
|
|
192
187
|
* Display notification details. Details are sent through the
|
|
@@ -195,25 +190,26 @@ export { NextFn };
|
|
|
195
190
|
* @public
|
|
196
191
|
*/
|
|
197
192
|
export declare interface NotificationPayload {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
193
|
+
/**
|
|
194
|
+
* The notification's title.
|
|
195
|
+
*/
|
|
196
|
+
title?: string;
|
|
197
|
+
/**
|
|
198
|
+
* The notification's body text.
|
|
199
|
+
*/
|
|
200
|
+
body?: string;
|
|
201
|
+
/**
|
|
202
|
+
* The URL of an image that is downloaded on the device and displayed in the notification.
|
|
203
|
+
*/
|
|
204
|
+
image?: string;
|
|
205
|
+
/**
|
|
206
|
+
* The URL to use for the notification's icon. If you don't send this key in the request,
|
|
207
|
+
* FCM displays the launcher icon specified in your app manifest.
|
|
208
|
+
*/
|
|
209
|
+
icon?: string;
|
|
215
210
|
}
|
|
216
|
-
|
|
211
|
+
|
|
212
|
+
export { Observer }
|
|
217
213
|
|
|
218
214
|
/**
|
|
219
215
|
* When a push message is received and the user is currently on a page for your origin, the
|
|
@@ -228,10 +224,7 @@ export { Observer };
|
|
|
228
224
|
*
|
|
229
225
|
* @public
|
|
230
226
|
*/
|
|
231
|
-
export declare function onMessage(
|
|
232
|
-
messaging: Messaging,
|
|
233
|
-
nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>
|
|
234
|
-
): Unsubscribe;
|
|
227
|
+
export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
235
228
|
|
|
236
229
|
/**
|
|
237
230
|
* Subscribes to an event that the app instance is registered with FCM via Firebase Installation ID (FID).
|
|
@@ -244,10 +237,7 @@ export declare function onMessage(
|
|
|
244
237
|
*
|
|
245
238
|
* @public
|
|
246
239
|
*/
|
|
247
|
-
export declare function onRegistered(
|
|
248
|
-
messaging: Messaging,
|
|
249
|
-
nextOrObserver: NextFn<string> | Observer<string>
|
|
250
|
-
): Unsubscribe;
|
|
240
|
+
export declare function onRegistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
251
241
|
|
|
252
242
|
/**
|
|
253
243
|
* Subscribes to an event that the app instance is unregistered from FCM (FID no longer active).
|
|
@@ -259,10 +249,7 @@ export declare function onRegistered(
|
|
|
259
249
|
*
|
|
260
250
|
* @public
|
|
261
251
|
*/
|
|
262
|
-
export declare function onUnregistered(
|
|
263
|
-
messaging: Messaging,
|
|
264
|
-
nextOrObserver: NextFn<string> | Observer<string>
|
|
265
|
-
): Unsubscribe;
|
|
252
|
+
export declare function onUnregistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
266
253
|
|
|
267
254
|
/**
|
|
268
255
|
* Registers the app instance with FCM using its Firebase Installation ID (FID). The FID is
|
|
@@ -277,10 +264,7 @@ export declare function onUnregistered(
|
|
|
277
264
|
*
|
|
278
265
|
* @public
|
|
279
266
|
*/
|
|
280
|
-
export declare function register(
|
|
281
|
-
messaging: Messaging,
|
|
282
|
-
options?: RegisterOptions
|
|
283
|
-
): Promise<void>;
|
|
267
|
+
export declare function register(messaging: Messaging, options?: RegisterOptions): Promise<void>;
|
|
284
268
|
|
|
285
269
|
/**
|
|
286
270
|
* Options for {@link register}. Same shape as GetTokenOptions for SW and VAPID configuration.
|
|
@@ -288,10 +272,10 @@ export declare function register(
|
|
|
288
272
|
* @public
|
|
289
273
|
*/
|
|
290
274
|
export declare interface RegisterOptions {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
275
|
+
/** Optional VAPID key. See {@link GetTokenOptions.vapidKey}. */
|
|
276
|
+
vapidKey?: string;
|
|
277
|
+
/** Optional service worker registration. See {@link GetTokenOptions.serviceWorkerRegistration}. */
|
|
278
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
295
279
|
}
|
|
296
280
|
|
|
297
281
|
/**
|
|
@@ -303,6 +287,7 @@ export declare interface RegisterOptions {
|
|
|
303
287
|
* @public
|
|
304
288
|
*/
|
|
305
289
|
export declare function unregister(messaging: Messaging): Promise<void>;
|
|
306
|
-
export { Unsubscribe };
|
|
307
290
|
|
|
308
|
-
export {}
|
|
291
|
+
export { Unsubscribe }
|
|
292
|
+
|
|
293
|
+
export { }
|
package/dist/index.cjs.js
CHANGED
package/dist/index.sw.cjs
CHANGED
package/dist/internal.d.ts
CHANGED
|
@@ -183,6 +183,7 @@ export declare interface Messaging {
|
|
|
183
183
|
*/
|
|
184
184
|
app: FirebaseApp;
|
|
185
185
|
}
|
|
186
|
+
|
|
186
187
|
export { NextFn }
|
|
187
188
|
|
|
188
189
|
/**
|
|
@@ -210,6 +211,7 @@ export declare interface NotificationPayload {
|
|
|
210
211
|
*/
|
|
211
212
|
icon?: string;
|
|
212
213
|
}
|
|
214
|
+
|
|
213
215
|
export { Observer }
|
|
214
216
|
|
|
215
217
|
/**
|
|
@@ -288,6 +290,7 @@ export declare interface RegisterOptions {
|
|
|
288
290
|
* @public
|
|
289
291
|
*/
|
|
290
292
|
export declare function unregister(messaging: Messaging): Promise<void>;
|
|
293
|
+
|
|
291
294
|
export { Unsubscribe }
|
|
292
295
|
|
|
293
296
|
export { }
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { FirebaseApp } from '@firebase/app';
|
|
2
|
-
|
|
3
2
|
import { NextFn } from '@firebase/util';
|
|
4
|
-
|
|
5
3
|
import { Observer } from '@firebase/util';
|
|
6
|
-
|
|
7
4
|
import { Unsubscribe } from '@firebase/util';
|
|
8
5
|
|
|
9
6
|
/**
|
|
@@ -17,10 +14,7 @@ import { Unsubscribe } from '@firebase/util';
|
|
|
17
14
|
*
|
|
18
15
|
* @public
|
|
19
16
|
*/
|
|
20
|
-
export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(
|
|
21
|
-
messaging: Messaging,
|
|
22
|
-
enable: boolean
|
|
23
|
-
): void;
|
|
17
|
+
export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;
|
|
24
18
|
|
|
25
19
|
/**
|
|
26
20
|
* Options for features provided by the FCM SDK for Web. See {@link
|
|
@@ -30,14 +24,14 @@ export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(
|
|
|
30
24
|
* @public
|
|
31
25
|
*/
|
|
32
26
|
export declare interface FcmOptions {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The link to open when the user clicks on the notification.
|
|
29
|
+
*/
|
|
30
|
+
link?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The label associated with the message's analytics data.
|
|
33
|
+
*/
|
|
34
|
+
analyticsLabel?: string;
|
|
41
35
|
}
|
|
42
36
|
|
|
43
37
|
/* Excluded from this release type: _FirebaseMessagingName */
|
|
@@ -57,26 +51,26 @@ export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
|
57
51
|
* @public
|
|
58
52
|
*/
|
|
59
53
|
export declare interface GetTokenOptions {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
54
|
+
/**
|
|
55
|
+
* The public server key provided to push services. The key is used to
|
|
56
|
+
* authenticate push subscribers to receive push messages only from sending servers that hold
|
|
57
|
+
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
|
|
58
|
+
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
|
|
59
|
+
* to generate and import a VAPID key for your project with
|
|
60
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
|
|
61
|
+
* See
|
|
62
|
+
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
|
|
63
|
+
* for details on web push services.
|
|
64
|
+
*/
|
|
65
|
+
vapidKey?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The service worker registration for receiving push
|
|
68
|
+
* messaging. If the registration is not provided explicitly, you need to have a
|
|
69
|
+
* `firebase-messaging-sw.js` at your root location. See
|
|
70
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
|
|
71
|
+
* for more details.
|
|
72
|
+
*/
|
|
73
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
/**
|
|
@@ -96,33 +90,33 @@ export declare function isSupported(): Promise<boolean>;
|
|
|
96
90
|
* @public
|
|
97
91
|
*/
|
|
98
92
|
export declare interface MessagePayload {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
93
|
+
/**
|
|
94
|
+
* {@inheritdoc NotificationPayload}
|
|
95
|
+
*/
|
|
96
|
+
notification?: NotificationPayload;
|
|
97
|
+
/**
|
|
98
|
+
* Arbitrary key/value payload.
|
|
99
|
+
*/
|
|
100
|
+
data?: {
|
|
101
|
+
[key: string]: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* {@inheritdoc FcmOptions}
|
|
105
|
+
*/
|
|
106
|
+
fcmOptions?: FcmOptions;
|
|
107
|
+
/**
|
|
108
|
+
* The sender of this message.
|
|
109
|
+
*/
|
|
110
|
+
from: string;
|
|
111
|
+
/**
|
|
112
|
+
* The collapse key of the message. See
|
|
113
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
|
|
114
|
+
*/
|
|
115
|
+
collapseKey: string;
|
|
116
|
+
/**
|
|
117
|
+
* The message ID of a message.
|
|
118
|
+
*/
|
|
119
|
+
messageId: string;
|
|
126
120
|
}
|
|
127
121
|
|
|
128
122
|
/**
|
|
@@ -131,12 +125,13 @@ export declare interface MessagePayload {
|
|
|
131
125
|
* @public
|
|
132
126
|
*/
|
|
133
127
|
export declare interface Messaging {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
/**
|
|
129
|
+
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
|
|
130
|
+
*/
|
|
131
|
+
app: FirebaseApp;
|
|
138
132
|
}
|
|
139
|
-
|
|
133
|
+
|
|
134
|
+
export { NextFn }
|
|
140
135
|
|
|
141
136
|
/**
|
|
142
137
|
* Display notification details. Details are sent through the
|
|
@@ -145,25 +140,26 @@ export { NextFn };
|
|
|
145
140
|
* @public
|
|
146
141
|
*/
|
|
147
142
|
export declare interface NotificationPayload {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
143
|
+
/**
|
|
144
|
+
* The notification's title.
|
|
145
|
+
*/
|
|
146
|
+
title?: string;
|
|
147
|
+
/**
|
|
148
|
+
* The notification's body text.
|
|
149
|
+
*/
|
|
150
|
+
body?: string;
|
|
151
|
+
/**
|
|
152
|
+
* The URL of an image that is downloaded on the device and displayed in the notification.
|
|
153
|
+
*/
|
|
154
|
+
image?: string;
|
|
155
|
+
/**
|
|
156
|
+
* The URL to use for the notification's icon. If you don't send this key in the request,
|
|
157
|
+
* FCM displays the launcher icon specified in your app manifest.
|
|
158
|
+
*/
|
|
159
|
+
icon?: string;
|
|
165
160
|
}
|
|
166
|
-
|
|
161
|
+
|
|
162
|
+
export { Observer }
|
|
167
163
|
|
|
168
164
|
/**
|
|
169
165
|
* Called when a message is received while the app is in the background. An app is considered to be
|
|
@@ -177,10 +173,7 @@ export { Observer };
|
|
|
177
173
|
*
|
|
178
174
|
* @public
|
|
179
175
|
*/
|
|
180
|
-
export declare function onBackgroundMessage(
|
|
181
|
-
messaging: Messaging,
|
|
182
|
-
nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>
|
|
183
|
-
): Unsubscribe;
|
|
176
|
+
export declare function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
184
177
|
|
|
185
178
|
/**
|
|
186
179
|
* Subscribes to an event that the app instance is registered with FCM via Firebase Installation ID (FID).
|
|
@@ -193,10 +186,7 @@ export declare function onBackgroundMessage(
|
|
|
193
186
|
*
|
|
194
187
|
* @public
|
|
195
188
|
*/
|
|
196
|
-
export declare function onRegistered(
|
|
197
|
-
messaging: Messaging,
|
|
198
|
-
nextOrObserver: NextFn<string> | Observer<string>
|
|
199
|
-
): Unsubscribe;
|
|
189
|
+
export declare function onRegistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
200
190
|
|
|
201
191
|
/**
|
|
202
192
|
* Subscribes to an event that the app instance is unregistered from FCM (FID no longer active).
|
|
@@ -208,10 +198,7 @@ export declare function onRegistered(
|
|
|
208
198
|
*
|
|
209
199
|
* @public
|
|
210
200
|
*/
|
|
211
|
-
export declare function onUnregistered(
|
|
212
|
-
messaging: Messaging,
|
|
213
|
-
nextOrObserver: NextFn<string> | Observer<string>
|
|
214
|
-
): Unsubscribe;
|
|
201
|
+
export declare function onUnregistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
215
202
|
|
|
216
203
|
/**
|
|
217
204
|
* Options for {@link register}. Same shape as GetTokenOptions for SW and VAPID configuration.
|
|
@@ -219,11 +206,12 @@ export declare function onUnregistered(
|
|
|
219
206
|
* @public
|
|
220
207
|
*/
|
|
221
208
|
export declare interface RegisterOptions {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
209
|
+
/** Optional VAPID key. See {@link GetTokenOptions.vapidKey}. */
|
|
210
|
+
vapidKey?: string;
|
|
211
|
+
/** Optional service worker registration. See {@link GetTokenOptions.serviceWorkerRegistration}. */
|
|
212
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
226
213
|
}
|
|
227
|
-
export { Unsubscribe };
|
|
228
214
|
|
|
229
|
-
export {}
|
|
215
|
+
export { Unsubscribe }
|
|
216
|
+
|
|
217
|
+
export { }
|
package/dist/sw/internal.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ export declare interface Messaging {
|
|
|
133
133
|
*/
|
|
134
134
|
app: FirebaseApp;
|
|
135
135
|
}
|
|
136
|
+
|
|
136
137
|
export { NextFn }
|
|
137
138
|
|
|
138
139
|
/**
|
|
@@ -160,6 +161,7 @@ export declare interface NotificationPayload {
|
|
|
160
161
|
*/
|
|
161
162
|
icon?: string;
|
|
162
163
|
}
|
|
164
|
+
|
|
163
165
|
export { Observer }
|
|
164
166
|
|
|
165
167
|
/**
|
|
@@ -212,6 +214,7 @@ export declare interface RegisterOptions {
|
|
|
212
214
|
/** Optional service worker registration. See {@link GetTokenOptions.serviceWorkerRegistration}. */
|
|
213
215
|
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
214
216
|
}
|
|
217
|
+
|
|
215
218
|
export { Unsubscribe }
|
|
216
219
|
|
|
217
220
|
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.58.13"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/messaging",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3-crashlytics2.142b40983",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -39,28 +39,27 @@
|
|
|
39
39
|
"test:ci": "node ../../scripts/run_tests_in_ci.js",
|
|
40
40
|
"test:karma": "karma start",
|
|
41
41
|
"test:debug": "karma start --browsers=Chrome --auto-watch",
|
|
42
|
-
"api-report": "yarn api-report:main && yarn api-report:sw
|
|
43
|
-
"api-report:main": "
|
|
44
|
-
"api-report:sw": "
|
|
45
|
-
"api-report:api-json": "api-extractor run --local --verbose",
|
|
42
|
+
"api-report": "yarn api-report:main && yarn api-report:sw",
|
|
43
|
+
"api-report:main": "api-extractor run -c api-extractor.json --local --verbose",
|
|
44
|
+
"api-report:sw": "api-extractor run -c sw/api-extractor.sw.json --local --verbose",
|
|
46
45
|
"type-check": "tsc --noEmit",
|
|
47
46
|
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
|
|
48
47
|
"typings:public": "node ../../scripts/build/use_typings.js ./dist/index-public.d.ts"
|
|
49
48
|
},
|
|
50
49
|
"license": "Apache-2.0",
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"@firebase/app": "0.
|
|
51
|
+
"@firebase/app": "0.16.2-crashlytics2.142b40983"
|
|
53
52
|
},
|
|
54
53
|
"dependencies": {
|
|
55
|
-
"@firebase/installations": "0.6.24",
|
|
56
|
-
"@firebase/messaging-interop-types": "0.2.6",
|
|
57
|
-
"@firebase/util": "1.15.3",
|
|
58
|
-
"@firebase/component": "0.7.5",
|
|
54
|
+
"@firebase/installations": "0.6.24-crashlytics2.142b40983",
|
|
55
|
+
"@firebase/messaging-interop-types": "0.2.6-crashlytics2.142b40983",
|
|
56
|
+
"@firebase/util": "1.15.3-crashlytics2.142b40983",
|
|
57
|
+
"@firebase/component": "0.7.5-crashlytics2.142b40983",
|
|
59
58
|
"idb": "7.1.1",
|
|
60
59
|
"tslib": "^2.1.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
|
-
"@firebase/app": "0.16.
|
|
62
|
+
"@firebase/app": "0.16.2-crashlytics2.142b40983",
|
|
64
63
|
"rollup": "4.62.2",
|
|
65
64
|
"rollup-plugin-typescript2": "0.37.0",
|
|
66
65
|
"@rollup/plugin-json": "6.1.0",
|
package/dist/private.d.ts
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Firebase Cloud Messaging Web SDK.
|
|
3
|
-
* This SDK does not work in a Node.js environment.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { FirebaseApp } from '@firebase/app';
|
|
9
|
-
import { NextFn } from '@firebase/util';
|
|
10
|
-
import { Observer } from '@firebase/util';
|
|
11
|
-
import { Unsubscribe } from '@firebase/util';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Deletes the registration token associated with this {@link Messaging} instance and unsubscribes
|
|
15
|
-
* the {@link Messaging} instance from the push subscription.
|
|
16
|
-
*
|
|
17
|
-
* If there is no legacy registration token but the client has FID-based registration metadata
|
|
18
|
-
* (from {@link register}), this deletes that registration on the server, clears local metadata, and
|
|
19
|
-
* invokes {@link onUnregistered} with the removed FID when successful.
|
|
20
|
-
*
|
|
21
|
-
* @param messaging - The {@link Messaging} instance.
|
|
22
|
-
*
|
|
23
|
-
* @returns The promise resolves when the token has been successfully deleted.
|
|
24
|
-
*
|
|
25
|
-
* @deprecated Use {@link onUnregistered} to observe when the client is no longer
|
|
26
|
-
* registered and update your backend accordingly, instead of explicitly deleting the
|
|
27
|
-
* registration token with this API.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export declare function deleteToken(messaging: Messaging): Promise<boolean>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Options for features provided by the FCM SDK for Web. See {@link
|
|
35
|
-
* https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
|
|
36
|
-
* WebpushFcmOptions}.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export declare interface FcmOptions {
|
|
41
|
-
/**
|
|
42
|
-
* The link to open when the user clicks on the notification.
|
|
43
|
-
*/
|
|
44
|
-
link?: string;
|
|
45
|
-
/**
|
|
46
|
-
* The label associated with the message's analytics data.
|
|
47
|
-
*/
|
|
48
|
-
analyticsLabel?: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Excluded from this release type: _FirebaseMessagingName */
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Retrieves a Firebase Cloud Messaging instance.
|
|
55
|
-
*
|
|
56
|
-
* @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
|
|
57
|
-
*
|
|
58
|
-
* @public
|
|
59
|
-
*/
|
|
60
|
-
export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Subscribes the {@link Messaging} instance to push notifications. Returns a Firebase Cloud
|
|
64
|
-
* Messaging registration token that can be used to send push messages to that {@link Messaging}
|
|
65
|
-
* instance.
|
|
66
|
-
*
|
|
67
|
-
* If notification permission isn't already granted, this method asks the user for permission. The
|
|
68
|
-
* returned promise rejects if the user does not allow the app to show notifications.
|
|
69
|
-
*
|
|
70
|
-
* @param messaging - The {@link Messaging} instance.
|
|
71
|
-
* @param options - Provides an optional vapid key and an optional service worker registration.
|
|
72
|
-
*
|
|
73
|
-
* @returns The promise resolves with an FCM registration token.
|
|
74
|
-
*
|
|
75
|
-
* @deprecated Use {@link register} together with {@link onRegistered} for Firebase
|
|
76
|
-
* Installation ID-based messaging instead of retrieving an FCM registration token with this API.
|
|
77
|
-
*
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Options for {@link getToken}.
|
|
84
|
-
*
|
|
85
|
-
* @public
|
|
86
|
-
*/
|
|
87
|
-
export declare interface GetTokenOptions {
|
|
88
|
-
/**
|
|
89
|
-
* The public server key provided to push services. The key is used to
|
|
90
|
-
* authenticate push subscribers to receive push messages only from sending servers that hold
|
|
91
|
-
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
|
|
92
|
-
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
|
|
93
|
-
* to generate and import a VAPID key for your project with
|
|
94
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
|
|
95
|
-
* See
|
|
96
|
-
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
|
|
97
|
-
* for details on web push services.
|
|
98
|
-
*/
|
|
99
|
-
vapidKey?: string;
|
|
100
|
-
/**
|
|
101
|
-
* The service worker registration for receiving push
|
|
102
|
-
* messaging. If the registration is not provided explicitly, you need to have a
|
|
103
|
-
* `firebase-messaging-sw.js` at your root location. See
|
|
104
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
|
|
105
|
-
* for more details.
|
|
106
|
-
*/
|
|
107
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @license
|
|
112
|
-
* Copyright 2020 Google LLC
|
|
113
|
-
*
|
|
114
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
115
|
-
* you may not use this file except in compliance with the License.
|
|
116
|
-
* You may obtain a copy of the License at
|
|
117
|
-
*
|
|
118
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
119
|
-
*
|
|
120
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
121
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
122
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
123
|
-
* See the License for the specific language governing permissions and
|
|
124
|
-
* limitations under the License.
|
|
125
|
-
*/
|
|
126
|
-
/**
|
|
127
|
-
* Checks if all required APIs exist in the browser.
|
|
128
|
-
* @returns a Promise that resolves to a boolean.
|
|
129
|
-
*
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
132
|
-
export declare function isSupported(): Promise<boolean>;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Message payload that contains the notification payload that is represented with
|
|
136
|
-
* {@link NotificationPayload} and the data payload that contains an arbitrary
|
|
137
|
-
* number of key-value pairs sent by developers through the
|
|
138
|
-
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
139
|
-
*
|
|
140
|
-
* @public
|
|
141
|
-
*/
|
|
142
|
-
export declare interface MessagePayload {
|
|
143
|
-
/**
|
|
144
|
-
* {@inheritdoc NotificationPayload}
|
|
145
|
-
*/
|
|
146
|
-
notification?: NotificationPayload;
|
|
147
|
-
/**
|
|
148
|
-
* Arbitrary key/value payload.
|
|
149
|
-
*/
|
|
150
|
-
data?: {
|
|
151
|
-
[key: string]: string;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* {@inheritdoc FcmOptions}
|
|
155
|
-
*/
|
|
156
|
-
fcmOptions?: FcmOptions;
|
|
157
|
-
/**
|
|
158
|
-
* The sender of this message.
|
|
159
|
-
*/
|
|
160
|
-
from: string;
|
|
161
|
-
/**
|
|
162
|
-
* The collapse key of the message. See
|
|
163
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
|
|
164
|
-
*/
|
|
165
|
-
collapseKey: string;
|
|
166
|
-
/**
|
|
167
|
-
* The message ID of a message.
|
|
168
|
-
*/
|
|
169
|
-
messageId: string;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Public interface of the Firebase Cloud Messaging SDK.
|
|
174
|
-
*
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
export declare interface Messaging {
|
|
178
|
-
/**
|
|
179
|
-
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
|
|
180
|
-
*/
|
|
181
|
-
app: FirebaseApp;
|
|
182
|
-
}
|
|
183
|
-
export { NextFn }
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Display notification details. Details are sent through the
|
|
187
|
-
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
188
|
-
*
|
|
189
|
-
* @public
|
|
190
|
-
*/
|
|
191
|
-
export declare interface NotificationPayload {
|
|
192
|
-
/**
|
|
193
|
-
* The notification's title.
|
|
194
|
-
*/
|
|
195
|
-
title?: string;
|
|
196
|
-
/**
|
|
197
|
-
* The notification's body text.
|
|
198
|
-
*/
|
|
199
|
-
body?: string;
|
|
200
|
-
/**
|
|
201
|
-
* The URL of an image that is downloaded on the device and displayed in the notification.
|
|
202
|
-
*/
|
|
203
|
-
image?: string;
|
|
204
|
-
/**
|
|
205
|
-
* The URL to use for the notification's icon. If you don't send this key in the request,
|
|
206
|
-
* FCM displays the launcher icon specified in your app manifest.
|
|
207
|
-
*/
|
|
208
|
-
icon?: string;
|
|
209
|
-
}
|
|
210
|
-
export { Observer }
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* When a push message is received and the user is currently on a page for your origin, the
|
|
214
|
-
* message is passed to the page and an `onMessage()` event is dispatched with the payload of
|
|
215
|
-
* the push message.
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* @param messaging - The {@link Messaging} instance.
|
|
219
|
-
* @param nextOrObserver - This function, or observer object with `next` defined,
|
|
220
|
-
* is called when a message is received and the user is currently viewing your page.
|
|
221
|
-
* @returns To stop listening for messages execute this returned function.
|
|
222
|
-
*
|
|
223
|
-
* @public
|
|
224
|
-
*/
|
|
225
|
-
export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Subscribes to an event that the app instance is registered with FCM via Firebase Installation ID (FID).
|
|
229
|
-
* Use the FID passed to the callback to upload it to your application server. When you receive an FID
|
|
230
|
-
* after calling {@link register}, instruct your backend to remove any legacy token for this instance.
|
|
231
|
-
*
|
|
232
|
-
* @param messaging - The {@link Messaging} instance.
|
|
233
|
-
* @param nextOrObserver - A function or observer object called when an FID is registered.
|
|
234
|
-
* @returns Unsubscribe function to stop listening.
|
|
235
|
-
*
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
export declare function onRegistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Subscribes to an event that the app instance is unregistered from FCM (FID no longer active).
|
|
242
|
-
* Use this to notify your backend to remove this FID to prevent 404 errors on send.
|
|
243
|
-
*
|
|
244
|
-
* @param messaging - The {@link Messaging} instance.
|
|
245
|
-
* @param nextOrObserver - A function or observer object called with the unregistered FID.
|
|
246
|
-
* @returns Unsubscribe function to stop listening.
|
|
247
|
-
*
|
|
248
|
-
* @public
|
|
249
|
-
*/
|
|
250
|
-
export declare function onUnregistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Registers the app instance with FCM using its Firebase Installation ID (FID). The FID is
|
|
254
|
-
* delivered via the {@link onRegistered} callback, not as a return value. Call this to establish
|
|
255
|
-
* an FID-based identity; once {@link onRegistered} provides an FID, instruct your backend to
|
|
256
|
-
* remove any legacy token previously associated with this instance. The backend send API
|
|
257
|
-
* supports FID as a target.
|
|
258
|
-
*
|
|
259
|
-
* @param messaging - The {@link Messaging} instance.
|
|
260
|
-
* @param options - Optional. VAPID key and/or service worker registration (same as getToken).
|
|
261
|
-
* @returns Promise that resolves when registration has been initiated; FID is delivered via onRegistered.
|
|
262
|
-
*
|
|
263
|
-
* @public
|
|
264
|
-
*/
|
|
265
|
-
export declare function register(messaging: Messaging, options?: RegisterOptions): Promise<void>;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Options for {@link register}. Same shape as GetTokenOptions for SW and VAPID configuration.
|
|
269
|
-
*
|
|
270
|
-
* @public
|
|
271
|
-
*/
|
|
272
|
-
export declare interface RegisterOptions {
|
|
273
|
-
/** Optional VAPID key. See {@link GetTokenOptions.vapidKey}. */
|
|
274
|
-
vapidKey?: string;
|
|
275
|
-
/** Optional service worker registration. See {@link GetTokenOptions.serviceWorkerRegistration}. */
|
|
276
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Unregisters the app instance from FCM by deleting its FID-based registration.
|
|
281
|
-
* On success, triggers {@link onUnregistered} (if registered) with the unregistered FID.
|
|
282
|
-
*
|
|
283
|
-
* @param messaging - The {@link Messaging} instance.
|
|
284
|
-
*
|
|
285
|
-
* @public
|
|
286
|
-
*/
|
|
287
|
-
export declare function unregister(messaging: Messaging): Promise<void>;
|
|
288
|
-
export { Unsubscribe }
|
|
289
|
-
|
|
290
|
-
export { }
|
package/dist/sw/private.d.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { FirebaseApp } from '@firebase/app';
|
|
2
|
-
import { NextFn } from '@firebase/util';
|
|
3
|
-
import { Observer } from '@firebase/util';
|
|
4
|
-
import { Unsubscribe } from '@firebase/util';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery. By
|
|
8
|
-
* default, message delivery metrics are not exported to BigQuery. Use this method to enable or
|
|
9
|
-
* disable the export at runtime.
|
|
10
|
-
*
|
|
11
|
-
* @param messaging - The `FirebaseMessaging` instance.
|
|
12
|
-
* @param enable - Whether Firebase Cloud Messaging should export message delivery metrics to
|
|
13
|
-
* BigQuery.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Options for features provided by the FCM SDK for Web. See {@link
|
|
21
|
-
* https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
|
|
22
|
-
* WebpushFcmOptions}.
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare interface FcmOptions {
|
|
27
|
-
/**
|
|
28
|
-
* The link to open when the user clicks on the notification.
|
|
29
|
-
*/
|
|
30
|
-
link?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The label associated with the message's analytics data.
|
|
33
|
-
*/
|
|
34
|
-
analyticsLabel?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* Excluded from this release type: _FirebaseMessagingName */
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Retrieves a Firebase Cloud Messaging instance.
|
|
41
|
-
*
|
|
42
|
-
* @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
|
-
export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Options for {@link getToken}.
|
|
50
|
-
*
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
export declare interface GetTokenOptions {
|
|
54
|
-
/**
|
|
55
|
-
* The public server key provided to push services. The key is used to
|
|
56
|
-
* authenticate push subscribers to receive push messages only from sending servers that hold
|
|
57
|
-
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
|
|
58
|
-
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
|
|
59
|
-
* to generate and import a VAPID key for your project with
|
|
60
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
|
|
61
|
-
* See
|
|
62
|
-
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
|
|
63
|
-
* for details on web push services.
|
|
64
|
-
*/
|
|
65
|
-
vapidKey?: string;
|
|
66
|
-
/**
|
|
67
|
-
* The service worker registration for receiving push
|
|
68
|
-
* messaging. If the registration is not provided explicitly, you need to have a
|
|
69
|
-
* `firebase-messaging-sw.js` at your root location. See
|
|
70
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
|
|
71
|
-
* for more details.
|
|
72
|
-
*/
|
|
73
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Checks whether all required APIs exist within SW Context
|
|
78
|
-
* @returns a Promise that resolves to a boolean.
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
export declare function isSupported(): Promise<boolean>;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Message payload that contains the notification payload that is represented with
|
|
86
|
-
* {@link NotificationPayload} and the data payload that contains an arbitrary
|
|
87
|
-
* number of key-value pairs sent by developers through the
|
|
88
|
-
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
89
|
-
*
|
|
90
|
-
* @public
|
|
91
|
-
*/
|
|
92
|
-
export declare interface MessagePayload {
|
|
93
|
-
/**
|
|
94
|
-
* {@inheritdoc NotificationPayload}
|
|
95
|
-
*/
|
|
96
|
-
notification?: NotificationPayload;
|
|
97
|
-
/**
|
|
98
|
-
* Arbitrary key/value payload.
|
|
99
|
-
*/
|
|
100
|
-
data?: {
|
|
101
|
-
[key: string]: string;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* {@inheritdoc FcmOptions}
|
|
105
|
-
*/
|
|
106
|
-
fcmOptions?: FcmOptions;
|
|
107
|
-
/**
|
|
108
|
-
* The sender of this message.
|
|
109
|
-
*/
|
|
110
|
-
from: string;
|
|
111
|
-
/**
|
|
112
|
-
* The collapse key of the message. See
|
|
113
|
-
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
|
|
114
|
-
*/
|
|
115
|
-
collapseKey: string;
|
|
116
|
-
/**
|
|
117
|
-
* The message ID of a message.
|
|
118
|
-
*/
|
|
119
|
-
messageId: string;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Public interface of the Firebase Cloud Messaging SDK.
|
|
124
|
-
*
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
export declare interface Messaging {
|
|
128
|
-
/**
|
|
129
|
-
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
|
|
130
|
-
*/
|
|
131
|
-
app: FirebaseApp;
|
|
132
|
-
}
|
|
133
|
-
export { NextFn }
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Display notification details. Details are sent through the
|
|
137
|
-
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
138
|
-
*
|
|
139
|
-
* @public
|
|
140
|
-
*/
|
|
141
|
-
export declare interface NotificationPayload {
|
|
142
|
-
/**
|
|
143
|
-
* The notification's title.
|
|
144
|
-
*/
|
|
145
|
-
title?: string;
|
|
146
|
-
/**
|
|
147
|
-
* The notification's body text.
|
|
148
|
-
*/
|
|
149
|
-
body?: string;
|
|
150
|
-
/**
|
|
151
|
-
* The URL of an image that is downloaded on the device and displayed in the notification.
|
|
152
|
-
*/
|
|
153
|
-
image?: string;
|
|
154
|
-
/**
|
|
155
|
-
* The URL to use for the notification's icon. If you don't send this key in the request,
|
|
156
|
-
* FCM displays the launcher icon specified in your app manifest.
|
|
157
|
-
*/
|
|
158
|
-
icon?: string;
|
|
159
|
-
}
|
|
160
|
-
export { Observer }
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Called when a message is received while the app is in the background. An app is considered to be
|
|
164
|
-
* in the background if no active window is displayed.
|
|
165
|
-
*
|
|
166
|
-
* @param messaging - The {@link Messaging} instance.
|
|
167
|
-
* @param nextOrObserver - This function, or observer object with `next` defined, is called when a
|
|
168
|
-
* message is received and the app is currently in the background.
|
|
169
|
-
*
|
|
170
|
-
* @returns To stop listening for messages execute this returned function.
|
|
171
|
-
*
|
|
172
|
-
* @public
|
|
173
|
-
*/
|
|
174
|
-
export declare function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Subscribes to an event that the app instance is registered with FCM via Firebase Installation ID (FID).
|
|
178
|
-
* Use the FID passed to the callback to upload it to your application server. When you receive an FID
|
|
179
|
-
* after calling {@link register}, instruct your backend to remove any legacy token for this instance.
|
|
180
|
-
*
|
|
181
|
-
* @param messaging - The {@link Messaging} instance.
|
|
182
|
-
* @param nextOrObserver - A function or observer object called when an FID is registered.
|
|
183
|
-
* @returns Unsubscribe function to stop listening.
|
|
184
|
-
*
|
|
185
|
-
* @public
|
|
186
|
-
*/
|
|
187
|
-
export declare function onRegistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Subscribes to an event that the app instance is unregistered from FCM (FID no longer active).
|
|
191
|
-
* Use this to notify your backend to remove this FID to prevent 404 errors on send.
|
|
192
|
-
*
|
|
193
|
-
* @param messaging - The {@link Messaging} instance.
|
|
194
|
-
* @param nextOrObserver - A function or observer object called with the unregistered FID.
|
|
195
|
-
* @returns Unsubscribe function to stop listening.
|
|
196
|
-
*
|
|
197
|
-
* @public
|
|
198
|
-
*/
|
|
199
|
-
export declare function onUnregistered(messaging: Messaging, nextOrObserver: NextFn<string> | Observer<string>): Unsubscribe;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Options for {@link register}. Same shape as GetTokenOptions for SW and VAPID configuration.
|
|
203
|
-
*
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
export declare interface RegisterOptions {
|
|
207
|
-
/** Optional VAPID key. See {@link GetTokenOptions.vapidKey}. */
|
|
208
|
-
vapidKey?: string;
|
|
209
|
-
/** Optional service worker registration. See {@link GetTokenOptions.serviceWorkerRegistration}. */
|
|
210
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
211
|
-
}
|
|
212
|
-
export { Unsubscribe }
|
|
213
|
-
|
|
214
|
-
export { }
|