@firebase/messaging 0.9.13 → 0.9.14-canary.ebc17e27f

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.
@@ -1,214 +1,214 @@
1
- /**
2
- * Firebase Cloud Messaging
3
- *
4
- * @packageDocumentation
5
- */
6
-
7
- import { FirebaseApp } from '@firebase/app';
8
- import { NextFn } from '@firebase/util';
9
- import { Observer } from '@firebase/util';
10
- import { Unsubscribe } from '@firebase/util';
11
-
12
- /**
13
- * Deletes the registration token associated with this {@link Messaging} instance and unsubscribes
14
- * the {@link Messaging} instance from the push subscription.
15
- *
16
- * @param messaging - The {@link Messaging} instance.
17
- *
18
- * @returns The promise resolves when the token has been successfully deleted.
19
- *
20
- * @public
21
- */
22
- export declare function deleteToken(messaging: Messaging): Promise<boolean>;
23
-
24
- /**
25
- * Options for features provided by the FCM SDK for Web. See {@link
26
- * https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
27
- * WebpushFcmOptions}
28
- *
29
- * @public
30
- */
31
- export declare interface FcmOptions {
32
- /**
33
- * The link to open when the user clicks on the notification.
34
- */
35
- link?: string;
36
- /**
37
- * The label associated with the message's analytics data.
38
- */
39
- analyticsLabel?: string;
40
- }
41
-
42
- /**
43
- * @internal
44
- */
45
- export declare type _FirebaseMessagingName = 'messaging';
46
-
47
- /**
48
- * Retrieves a Firebase Cloud Messaging instance.
49
- *
50
- * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
51
- *
52
- * @public
53
- */
54
- export declare function getMessaging(app?: FirebaseApp): Messaging;
55
-
56
- /**
57
- * Subscribes the {@link Messaging} instance to push notifications. Returns an Firebase Cloud
58
- * Messaging registration token that can be used to send push messages to that {@link Messaging}
59
- * instance.
60
- *
61
- * If a notification permission isn't already granted, this method asks the user for permission. The
62
- * returned promise rejects if the user does not allow the app to show notifications.
63
- *
64
- * @param messaging - The {@link Messaging} instance.
65
- * @param options - Provides an optional vapid key and an optinoal service worker registration
66
- *
67
- * @returns The promise resolves with an FCM registration token.
68
- *
69
- * @public
70
- */
71
- export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
72
-
73
- /**
74
- * Options for {@link getToken}
75
- *
76
- * @public
77
- */
78
- export declare interface GetTokenOptions {
79
- /**
80
- * The public server key provided to push services. It is used to
81
- * authenticate the push subscribers to receive push messages only from sending servers that hold
82
- * the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
83
- * push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
84
- * to generate and import a VAPID key for your project with
85
- * {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_with_fcm | Configure Web Credentials with FCM}.
86
- * See
87
- * {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
88
- * for details on web push services.
89
- */
90
- vapidKey?: string;
91
- /**
92
- * The service worker registration for receiving push
93
- * messaging. If the registration is not provided explicitly, you need to have a
94
- * `firebase-messaging-sw.js` at your root location. See
95
- * {@link https://firebase.google.com/docs/cloud-messaging/js/client#retrieve-the-current-registration-token | Retrieve the current registration token}
96
- * for more details.
97
- */
98
- serviceWorkerRegistration?: ServiceWorkerRegistration;
99
- }
100
-
101
- /**
102
- * @license
103
- * Copyright 2020 Google LLC
104
- *
105
- * Licensed under the Apache License, Version 2.0 (the "License");
106
- * you may not use this file except in compliance with the License.
107
- * You may obtain a copy of the License at
108
- *
109
- * http://www.apache.org/licenses/LICENSE-2.0
110
- *
111
- * Unless required by applicable law or agreed to in writing, software
112
- * distributed under the License is distributed on an "AS IS" BASIS,
113
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
- * See the License for the specific language governing permissions and
115
- * limitations under the License.
116
- */
117
- /**
118
- * Checks if all required APIs exist in the browser.
119
- * @returns a Promise that resolves to a boolean.
120
- *
121
- * @public
122
- */
123
- export declare function isSupported(): Promise<boolean>;
124
-
125
- /**
126
- * Message payload that contains the notification payload that is represented with
127
- * {@link NotificationPayload} and the data payload that contains an arbitrary
128
- * number of key-value pairs sent by developers through the
129
- * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}
130
- *
131
- * @public
132
- */
133
- export declare interface MessagePayload {
134
- /**
135
- * {@inheritdoc NotificationPayload}
136
- */
137
- notification?: NotificationPayload;
138
- /**
139
- * Arbitrary key/value payload.
140
- */
141
- data?: {
142
- [key: string]: string;
143
- };
144
- /**
145
- * {@inheritdoc FcmOptions}
146
- */
147
- fcmOptions?: FcmOptions;
148
- /**
149
- * The sender of this message.
150
- */
151
- from: string;
152
- /**
153
- * The collapse key of the message. See
154
- * {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
155
- */
156
- collapseKey: string;
157
- /**
158
- * The message id of a message.
159
- */
160
- messageId: string;
161
- }
162
-
163
- /**
164
- * Public interface of the Firebase Cloud Messaging SDK.
165
- *
166
- * @public
167
- */
168
- export declare interface Messaging {
169
- /**
170
- * The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
171
- */
172
- app: FirebaseApp;
173
- }
174
- export { NextFn }
175
-
176
- /**
177
- * Display notification details. They are sent through the
178
- * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}
179
- *
180
- * @public
181
- */
182
- export declare interface NotificationPayload {
183
- /**
184
- * The notification's title.
185
- */
186
- title?: string;
187
- /**
188
- * The notification's body text.
189
- */
190
- body?: string;
191
- /**
192
- * The URL of an image that is downloaded on the device and displayed in the notification.
193
- */
194
- image?: string;
195
- }
196
- export { Observer }
197
-
198
- /**
199
- * When a push message is received and the user is currently on a page for your origin, the
200
- * message is passed to the page and an `onMessage()` event is dispatched with the payload of
201
- * the push message.
202
- *
203
- *
204
- * @param messaging - The {@link Messaging} instance.
205
- * @param nextOrObserver - This function, or observer object with `next` defined,
206
- * is called when a message is received and the user is currently viewing your page.
207
- * @returns To stop listening for messages execute this returned function.
208
- *
209
- * @public
210
- */
211
- export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
212
- export { Unsubscribe }
213
-
214
- export { }
1
+ /**
2
+ * Firebase Cloud Messaging
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { FirebaseApp } from '@firebase/app';
8
+ import { NextFn } from '@firebase/util';
9
+ import { Observer } from '@firebase/util';
10
+ import { Unsubscribe } from '@firebase/util';
11
+
12
+ /**
13
+ * Deletes the registration token associated with this {@link Messaging} instance and unsubscribes
14
+ * the {@link Messaging} instance from the push subscription.
15
+ *
16
+ * @param messaging - The {@link Messaging} instance.
17
+ *
18
+ * @returns The promise resolves when the token has been successfully deleted.
19
+ *
20
+ * @public
21
+ */
22
+ export declare function deleteToken(messaging: Messaging): Promise<boolean>;
23
+
24
+ /**
25
+ * Options for features provided by the FCM SDK for Web. See {@link
26
+ * https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
27
+ * WebpushFcmOptions}
28
+ *
29
+ * @public
30
+ */
31
+ export declare interface FcmOptions {
32
+ /**
33
+ * The link to open when the user clicks on the notification.
34
+ */
35
+ link?: string;
36
+ /**
37
+ * The label associated with the message's analytics data.
38
+ */
39
+ analyticsLabel?: string;
40
+ }
41
+
42
+ /**
43
+ * @internal
44
+ */
45
+ export declare type _FirebaseMessagingName = 'messaging';
46
+
47
+ /**
48
+ * Retrieves a Firebase Cloud Messaging instance.
49
+ *
50
+ * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
51
+ *
52
+ * @public
53
+ */
54
+ export declare function getMessaging(app?: FirebaseApp): Messaging;
55
+
56
+ /**
57
+ * Subscribes the {@link Messaging} instance to push notifications. Returns an Firebase Cloud
58
+ * Messaging registration token that can be used to send push messages to that {@link Messaging}
59
+ * instance.
60
+ *
61
+ * If a notification permission isn't already granted, this method asks the user for permission. The
62
+ * returned promise rejects if the user does not allow the app to show notifications.
63
+ *
64
+ * @param messaging - The {@link Messaging} instance.
65
+ * @param options - Provides an optional vapid key and an optinoal service worker registration
66
+ *
67
+ * @returns The promise resolves with an FCM registration token.
68
+ *
69
+ * @public
70
+ */
71
+ export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
72
+
73
+ /**
74
+ * Options for {@link getToken}
75
+ *
76
+ * @public
77
+ */
78
+ export declare interface GetTokenOptions {
79
+ /**
80
+ * The public server key provided to push services. It is used to
81
+ * authenticate the push subscribers to receive push messages only from sending servers that hold
82
+ * the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
83
+ * push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
84
+ * to generate and import a VAPID key for your project with
85
+ * {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_with_fcm | Configure Web Credentials with FCM}.
86
+ * See
87
+ * {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
88
+ * for details on web push services.
89
+ */
90
+ vapidKey?: string;
91
+ /**
92
+ * The service worker registration for receiving push
93
+ * messaging. If the registration is not provided explicitly, you need to have a
94
+ * `firebase-messaging-sw.js` at your root location. See
95
+ * {@link https://firebase.google.com/docs/cloud-messaging/js/client#retrieve-the-current-registration-token | Retrieve the current registration token}
96
+ * for more details.
97
+ */
98
+ serviceWorkerRegistration?: ServiceWorkerRegistration;
99
+ }
100
+
101
+ /**
102
+ * @license
103
+ * Copyright 2020 Google LLC
104
+ *
105
+ * Licensed under the Apache License, Version 2.0 (the "License");
106
+ * you may not use this file except in compliance with the License.
107
+ * You may obtain a copy of the License at
108
+ *
109
+ * http://www.apache.org/licenses/LICENSE-2.0
110
+ *
111
+ * Unless required by applicable law or agreed to in writing, software
112
+ * distributed under the License is distributed on an "AS IS" BASIS,
113
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ * See the License for the specific language governing permissions and
115
+ * limitations under the License.
116
+ */
117
+ /**
118
+ * Checks if all required APIs exist in the browser.
119
+ * @returns a Promise that resolves to a boolean.
120
+ *
121
+ * @public
122
+ */
123
+ export declare function isSupported(): Promise<boolean>;
124
+
125
+ /**
126
+ * Message payload that contains the notification payload that is represented with
127
+ * {@link NotificationPayload} and the data payload that contains an arbitrary
128
+ * number of key-value pairs sent by developers through the
129
+ * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}
130
+ *
131
+ * @public
132
+ */
133
+ export declare interface MessagePayload {
134
+ /**
135
+ * {@inheritdoc NotificationPayload}
136
+ */
137
+ notification?: NotificationPayload;
138
+ /**
139
+ * Arbitrary key/value payload.
140
+ */
141
+ data?: {
142
+ [key: string]: string;
143
+ };
144
+ /**
145
+ * {@inheritdoc FcmOptions}
146
+ */
147
+ fcmOptions?: FcmOptions;
148
+ /**
149
+ * The sender of this message.
150
+ */
151
+ from: string;
152
+ /**
153
+ * The collapse key of the message. See
154
+ * {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
155
+ */
156
+ collapseKey: string;
157
+ /**
158
+ * The message id of a message.
159
+ */
160
+ messageId: string;
161
+ }
162
+
163
+ /**
164
+ * Public interface of the Firebase Cloud Messaging SDK.
165
+ *
166
+ * @public
167
+ */
168
+ export declare interface Messaging {
169
+ /**
170
+ * The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
171
+ */
172
+ app: FirebaseApp;
173
+ }
174
+ export { NextFn }
175
+
176
+ /**
177
+ * Display notification details. They are sent through the
178
+ * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}
179
+ *
180
+ * @public
181
+ */
182
+ export declare interface NotificationPayload {
183
+ /**
184
+ * The notification's title.
185
+ */
186
+ title?: string;
187
+ /**
188
+ * The notification's body text.
189
+ */
190
+ body?: string;
191
+ /**
192
+ * The URL of an image that is downloaded on the device and displayed in the notification.
193
+ */
194
+ image?: string;
195
+ }
196
+ export { Observer }
197
+
198
+ /**
199
+ * When a push message is received and the user is currently on a page for your origin, the
200
+ * message is passed to the page and an `onMessage()` event is dispatched with the payload of
201
+ * the push message.
202
+ *
203
+ *
204
+ * @param messaging - The {@link Messaging} instance.
205
+ * @param nextOrObserver - This function, or observer object with `next` defined,
206
+ * is called when a message is received and the user is currently viewing your page.
207
+ * @returns To stop listening for messages execute this returned function.
208
+ *
209
+ * @public
210
+ */
211
+ export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
212
+ export { Unsubscribe }
213
+
214
+ export { }