@depup/firebase__messaging 0.12.24-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +32 -0
  2. package/changes.json +14 -0
  3. package/dist/esm/index.esm.js +1270 -0
  4. package/dist/esm/index.esm.js.map +1 -0
  5. package/dist/esm/index.sw.esm.js +1278 -0
  6. package/dist/esm/index.sw.esm.js.map +1 -0
  7. package/dist/esm/package.json +1 -0
  8. package/dist/esm/src/api/deleteToken.d.ts +18 -0
  9. package/dist/esm/src/api/getToken.d.ts +19 -0
  10. package/dist/esm/src/api/isSupported.d.ts +30 -0
  11. package/dist/esm/src/api/onBackgroundMessage.d.ts +19 -0
  12. package/dist/esm/src/api/onMessage.d.ts +19 -0
  13. package/dist/esm/src/api/setDeliveryMetricsExportedToBigQueryEnabled.d.ts +18 -0
  14. package/dist/esm/src/api.d.ts +101 -0
  15. package/dist/esm/src/helpers/array-base64-translator.d.ts +18 -0
  16. package/dist/esm/src/helpers/externalizePayload.d.ts +19 -0
  17. package/dist/esm/src/helpers/extract-app-config.d.ts +19 -0
  18. package/dist/esm/src/helpers/is-console-message.d.ts +18 -0
  19. package/dist/esm/src/helpers/logToFirelog.d.ts +30 -0
  20. package/dist/esm/src/helpers/logToScion.d.ts +19 -0
  21. package/dist/esm/src/helpers/migrate-old-database.d.ts +51 -0
  22. package/dist/esm/src/helpers/register.d.ts +23 -0
  23. package/dist/esm/src/helpers/registerDefaultSw.d.ts +18 -0
  24. package/dist/esm/src/helpers/sleep.d.ts +18 -0
  25. package/dist/esm/src/helpers/updateSwReg.d.ts +18 -0
  26. package/dist/esm/src/helpers/updateVapidKey.d.ts +18 -0
  27. package/dist/esm/src/index.d.ts +32 -0
  28. package/dist/esm/src/index.sw.d.ts +26 -0
  29. package/dist/esm/src/interfaces/app-config.d.ts +24 -0
  30. package/dist/esm/src/interfaces/internal-dependencies.d.ts +27 -0
  31. package/dist/esm/src/interfaces/internal-message-payload.d.ts +65 -0
  32. package/dist/esm/src/interfaces/logging-types.d.ts +60 -0
  33. package/dist/esm/src/interfaces/public-types.d.ts +144 -0
  34. package/dist/esm/src/interfaces/token-details.d.ts +32 -0
  35. package/dist/esm/src/internals/idb-manager.d.ts +27 -0
  36. package/dist/esm/src/internals/requests.d.ts +35 -0
  37. package/dist/esm/src/internals/token-manager.d.ts +23 -0
  38. package/dist/esm/src/listeners/sw-listeners.d.ts +21 -0
  39. package/dist/esm/src/listeners/window-listener.d.ts +18 -0
  40. package/dist/esm/src/messaging-service.d.ts +36 -0
  41. package/dist/esm/src/testing/compare-headers.d.ts +22 -0
  42. package/dist/esm/src/testing/fakes/firebase-dependencies.d.ts +25 -0
  43. package/dist/esm/src/testing/fakes/logging-object.d.ts +18 -0
  44. package/dist/esm/src/testing/fakes/messaging-service.d.ts +18 -0
  45. package/dist/esm/src/testing/fakes/service-worker.d.ts +83 -0
  46. package/dist/esm/src/testing/fakes/token-details.d.ts +18 -0
  47. package/dist/esm/src/testing/setup.d.ts +17 -0
  48. package/dist/esm/src/testing/sinon-types.d.ts +19 -0
  49. package/dist/esm/src/util/constants.d.ts +40 -0
  50. package/dist/esm/src/util/errors.d.ts +57 -0
  51. package/dist/esm/src/util/sw-types.d.ts +90 -0
  52. package/dist/index-public.d.ts +204 -0
  53. package/dist/index.cjs.js +1278 -0
  54. package/dist/index.cjs.js.map +1 -0
  55. package/dist/index.sw.cjs +1285 -0
  56. package/dist/index.sw.cjs.map +1 -0
  57. package/dist/internal.d.ts +220 -0
  58. package/dist/private.d.ts +217 -0
  59. package/dist/src/api/deleteToken.d.ts +18 -0
  60. package/dist/src/api/getToken.d.ts +19 -0
  61. package/dist/src/api/isSupported.d.ts +30 -0
  62. package/dist/src/api/onBackgroundMessage.d.ts +19 -0
  63. package/dist/src/api/onMessage.d.ts +19 -0
  64. package/dist/src/api/setDeliveryMetricsExportedToBigQueryEnabled.d.ts +18 -0
  65. package/dist/src/api.d.ts +101 -0
  66. package/dist/src/helpers/array-base64-translator.d.ts +18 -0
  67. package/dist/src/helpers/externalizePayload.d.ts +19 -0
  68. package/dist/src/helpers/extract-app-config.d.ts +19 -0
  69. package/dist/src/helpers/is-console-message.d.ts +18 -0
  70. package/dist/src/helpers/logToFirelog.d.ts +30 -0
  71. package/dist/src/helpers/logToScion.d.ts +19 -0
  72. package/dist/src/helpers/migrate-old-database.d.ts +51 -0
  73. package/dist/src/helpers/register.d.ts +23 -0
  74. package/dist/src/helpers/registerDefaultSw.d.ts +18 -0
  75. package/dist/src/helpers/sleep.d.ts +18 -0
  76. package/dist/src/helpers/updateSwReg.d.ts +18 -0
  77. package/dist/src/helpers/updateVapidKey.d.ts +18 -0
  78. package/dist/src/index.d.ts +32 -0
  79. package/dist/src/index.sw.d.ts +26 -0
  80. package/dist/src/interfaces/app-config.d.ts +24 -0
  81. package/dist/src/interfaces/internal-dependencies.d.ts +27 -0
  82. package/dist/src/interfaces/internal-message-payload.d.ts +65 -0
  83. package/dist/src/interfaces/logging-types.d.ts +60 -0
  84. package/dist/src/interfaces/public-types.d.ts +144 -0
  85. package/dist/src/interfaces/token-details.d.ts +32 -0
  86. package/dist/src/internals/idb-manager.d.ts +27 -0
  87. package/dist/src/internals/requests.d.ts +35 -0
  88. package/dist/src/internals/token-manager.d.ts +23 -0
  89. package/dist/src/listeners/sw-listeners.d.ts +21 -0
  90. package/dist/src/listeners/window-listener.d.ts +18 -0
  91. package/dist/src/messaging-service.d.ts +36 -0
  92. package/dist/src/testing/compare-headers.d.ts +22 -0
  93. package/dist/src/testing/fakes/firebase-dependencies.d.ts +25 -0
  94. package/dist/src/testing/fakes/logging-object.d.ts +18 -0
  95. package/dist/src/testing/fakes/messaging-service.d.ts +18 -0
  96. package/dist/src/testing/fakes/service-worker.d.ts +83 -0
  97. package/dist/src/testing/fakes/token-details.d.ts +18 -0
  98. package/dist/src/testing/setup.d.ts +17 -0
  99. package/dist/src/testing/sinon-types.d.ts +19 -0
  100. package/dist/src/tsdoc-metadata.json +11 -0
  101. package/dist/src/util/constants.d.ts +40 -0
  102. package/dist/src/util/errors.d.ts +57 -0
  103. package/dist/src/util/sw-types.d.ts +90 -0
  104. package/dist/sw/index-public.d.ts +166 -0
  105. package/dist/sw/internal.d.ts +180 -0
  106. package/dist/sw/private.d.ts +177 -0
  107. package/package.json +103 -0
  108. package/sw/package.json +8 -0
@@ -0,0 +1,217 @@
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
+ * @param messaging - The {@link Messaging} instance.
18
+ *
19
+ * @returns The promise resolves when the token has been successfully deleted.
20
+ *
21
+ * @public
22
+ */
23
+ export declare function deleteToken(messaging: Messaging): Promise<boolean>;
24
+
25
+ /**
26
+ * Options for features provided by the FCM SDK for Web. See {@link
27
+ * https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
28
+ * WebpushFcmOptions}.
29
+ *
30
+ * @public
31
+ */
32
+ export declare interface FcmOptions {
33
+ /**
34
+ * The link to open when the user clicks on the notification.
35
+ */
36
+ link?: string;
37
+ /**
38
+ * The label associated with the message's analytics data.
39
+ */
40
+ analyticsLabel?: string;
41
+ }
42
+
43
+ /* Excluded from this release type: _FirebaseMessagingName */
44
+
45
+ /**
46
+ * Retrieves a Firebase Cloud Messaging instance.
47
+ *
48
+ * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
49
+ *
50
+ * @public
51
+ */
52
+ export declare function getMessaging(app?: FirebaseApp): Messaging;
53
+
54
+ /**
55
+ * Subscribes the {@link Messaging} instance to push notifications. Returns a Firebase Cloud
56
+ * Messaging registration token that can be used to send push messages to that {@link Messaging}
57
+ * instance.
58
+ *
59
+ * If notification permission isn't already granted, this method asks the user for permission. The
60
+ * returned promise rejects if the user does not allow the app to show notifications.
61
+ *
62
+ * @param messaging - The {@link Messaging} instance.
63
+ * @param options - Provides an optional vapid key and an optional service worker registration.
64
+ *
65
+ * @returns The promise resolves with an FCM registration token.
66
+ *
67
+ * @public
68
+ */
69
+ export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
70
+
71
+ /**
72
+ * Options for {@link getToken}.
73
+ *
74
+ * @public
75
+ */
76
+ export declare interface GetTokenOptions {
77
+ /**
78
+ * The public server key provided to push services. The key is used to
79
+ * authenticate push subscribers to receive push messages only from sending servers that hold
80
+ * the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
81
+ * push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
82
+ * to generate and import a VAPID key for your project with
83
+ * {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
84
+ * See
85
+ * {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
86
+ * for details on web push services.
87
+ */
88
+ vapidKey?: string;
89
+ /**
90
+ * The service worker registration for receiving push
91
+ * messaging. If the registration is not provided explicitly, you need to have a
92
+ * `firebase-messaging-sw.js` at your root location. See
93
+ * {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
94
+ * for more details.
95
+ */
96
+ serviceWorkerRegistration?: ServiceWorkerRegistration;
97
+ }
98
+
99
+ /**
100
+ * @license
101
+ * Copyright 2020 Google LLC
102
+ *
103
+ * Licensed under the Apache License, Version 2.0 (the "License");
104
+ * you may not use this file except in compliance with the License.
105
+ * You may obtain a copy of the License at
106
+ *
107
+ * http://www.apache.org/licenses/LICENSE-2.0
108
+ *
109
+ * Unless required by applicable law or agreed to in writing, software
110
+ * distributed under the License is distributed on an "AS IS" BASIS,
111
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
+ * See the License for the specific language governing permissions and
113
+ * limitations under the License.
114
+ */
115
+ /**
116
+ * Checks if all required APIs exist in the browser.
117
+ * @returns a Promise that resolves to a boolean.
118
+ *
119
+ * @public
120
+ */
121
+ export declare function isSupported(): Promise<boolean>;
122
+
123
+ /**
124
+ * Message payload that contains the notification payload that is represented with
125
+ * {@link NotificationPayload} and the data payload that contains an arbitrary
126
+ * number of key-value pairs sent by developers through the
127
+ * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
128
+ *
129
+ * @public
130
+ */
131
+ export declare interface MessagePayload {
132
+ /**
133
+ * {@inheritdoc NotificationPayload}
134
+ */
135
+ notification?: NotificationPayload;
136
+ /**
137
+ * Arbitrary key/value payload.
138
+ */
139
+ data?: {
140
+ [key: string]: string;
141
+ };
142
+ /**
143
+ * {@inheritdoc FcmOptions}
144
+ */
145
+ fcmOptions?: FcmOptions;
146
+ /**
147
+ * The sender of this message.
148
+ */
149
+ from: string;
150
+ /**
151
+ * The collapse key of the message. See
152
+ * {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
153
+ */
154
+ collapseKey: string;
155
+ /**
156
+ * The message ID of a message.
157
+ */
158
+ messageId: string;
159
+ }
160
+
161
+ /**
162
+ * Public interface of the Firebase Cloud Messaging SDK.
163
+ *
164
+ * @public
165
+ */
166
+ export declare interface Messaging {
167
+ /**
168
+ * The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
169
+ */
170
+ app: FirebaseApp;
171
+ }
172
+ export { NextFn }
173
+
174
+ /**
175
+ * Display notification details. Details are sent through the
176
+ * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
177
+ *
178
+ * @public
179
+ */
180
+ export declare interface NotificationPayload {
181
+ /**
182
+ * The notification's title.
183
+ */
184
+ title?: string;
185
+ /**
186
+ * The notification's body text.
187
+ */
188
+ body?: string;
189
+ /**
190
+ * The URL of an image that is downloaded on the device and displayed in the notification.
191
+ */
192
+ image?: string;
193
+ /**
194
+ * The URL to use for the notification's icon. If you don't send this key in the request,
195
+ * FCM displays the launcher icon specified in your app manifest.
196
+ */
197
+ icon?: string;
198
+ }
199
+ export { Observer }
200
+
201
+ /**
202
+ * When a push message is received and the user is currently on a page for your origin, the
203
+ * message is passed to the page and an `onMessage()` event is dispatched with the payload of
204
+ * the push message.
205
+ *
206
+ *
207
+ * @param messaging - The {@link Messaging} instance.
208
+ * @param nextOrObserver - This function, or observer object with `next` defined,
209
+ * is called when a message is received and the user is currently viewing your page.
210
+ * @returns To stop listening for messages execute this returned function.
211
+ *
212
+ * @public
213
+ */
214
+ export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
215
+ export { Unsubscribe }
216
+
217
+ export { }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessagingService } from '../messaging-service';
18
+ export declare function deleteToken(messaging: MessagingService): Promise<boolean>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessagingService } from '../messaging-service';
18
+ import { GetTokenOptions } from '../interfaces/public-types';
19
+ export declare function getToken(messaging: MessagingService, options?: GetTokenOptions): Promise<string>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Checks if all required APIs exist in the browser.
19
+ * @returns a Promise that resolves to a boolean.
20
+ *
21
+ * @public
22
+ */
23
+ export declare function isWindowSupported(): Promise<boolean>;
24
+ /**
25
+ * Checks whether all required APIs exist within SW Context
26
+ * @returns a Promise that resolves to a boolean.
27
+ *
28
+ * @public
29
+ */
30
+ export declare function isSwSupported(): Promise<boolean>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessagePayload, NextFn, Observer, Unsubscribe } from '../interfaces/public-types';
18
+ import { MessagingService } from '../messaging-service';
19
+ export declare function onBackgroundMessage(messaging: MessagingService, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessagePayload, NextFn, Observer, Unsubscribe } from '../interfaces/public-types';
18
+ import { MessagingService } from '../messaging-service';
19
+ export declare function onMessage(messaging: MessagingService, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Messaging } from '../interfaces/public-types';
18
+ export declare function _setDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp } from '@firebase/app';
18
+ import { GetTokenOptions, MessagePayload, Messaging } from './interfaces/public-types';
19
+ import { NextFn, Observer, Unsubscribe } from '@firebase/util';
20
+ /**
21
+ * Retrieves a Firebase Cloud Messaging instance.
22
+ *
23
+ * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
24
+ *
25
+ * @public
26
+ */
27
+ export declare function getMessagingInWindow(app?: FirebaseApp): Messaging;
28
+ /**
29
+ * Retrieves a Firebase Cloud Messaging instance.
30
+ *
31
+ * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
32
+ *
33
+ * @public
34
+ */
35
+ export declare function getMessagingInSw(app?: FirebaseApp): Messaging;
36
+ /**
37
+ * Subscribes the {@link Messaging} instance to push notifications. Returns a Firebase Cloud
38
+ * Messaging registration token that can be used to send push messages to that {@link Messaging}
39
+ * instance.
40
+ *
41
+ * If notification permission isn't already granted, this method asks the user for permission. The
42
+ * returned promise rejects if the user does not allow the app to show notifications.
43
+ *
44
+ * @param messaging - The {@link Messaging} instance.
45
+ * @param options - Provides an optional vapid key and an optional service worker registration.
46
+ *
47
+ * @returns The promise resolves with an FCM registration token.
48
+ *
49
+ * @public
50
+ */
51
+ export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
52
+ /**
53
+ * Deletes the registration token associated with this {@link Messaging} instance and unsubscribes
54
+ * the {@link Messaging} instance from the push subscription.
55
+ *
56
+ * @param messaging - The {@link Messaging} instance.
57
+ *
58
+ * @returns The promise resolves when the token has been successfully deleted.
59
+ *
60
+ * @public
61
+ */
62
+ export declare function deleteToken(messaging: Messaging): Promise<boolean>;
63
+ /**
64
+ * When a push message is received and the user is currently on a page for your origin, the
65
+ * message is passed to the page and an `onMessage()` event is dispatched with the payload of
66
+ * the push message.
67
+ *
68
+ *
69
+ * @param messaging - The {@link Messaging} instance.
70
+ * @param nextOrObserver - This function, or observer object with `next` defined,
71
+ * is called when a message is received and the user is currently viewing your page.
72
+ * @returns To stop listening for messages execute this returned function.
73
+ *
74
+ * @public
75
+ */
76
+ export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
77
+ /**
78
+ * Called when a message is received while the app is in the background. An app is considered to be
79
+ * in the background if no active window is displayed.
80
+ *
81
+ * @param messaging - The {@link Messaging} instance.
82
+ * @param nextOrObserver - This function, or observer object with `next` defined, is called when a
83
+ * message is received and the app is currently in the background.
84
+ *
85
+ * @returns To stop listening for messages execute this returned function
86
+ *
87
+ * @public
88
+ */
89
+ export declare function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
90
+ /**
91
+ * Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery. By
92
+ * default, message delivery metrics are not exported to BigQuery. Use this method to enable or
93
+ * disable the export at runtime.
94
+ *
95
+ * @param messaging - The `FirebaseMessaging` instance.
96
+ * @param enable - Whether Firebase Cloud Messaging should export message delivery metrics to
97
+ * BigQuery.
98
+ *
99
+ * @public
100
+ */
101
+ export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare function arrayToBase64(array: Uint8Array | ArrayBuffer): string;
18
+ export declare function base64ToArray(base64String: string): Uint8Array;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessagePayload } from '../interfaces/public-types';
18
+ import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
19
+ export declare function externalizePayload(internalPayload: MessagePayloadInternal): MessagePayload;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp } from '@firebase/app';
18
+ import { AppConfig } from '../interfaces/app-config';
19
+ export declare function extractAppConfig(app: FirebaseApp): AppConfig;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ConsoleMessageData } from '../interfaces/internal-message-payload';
18
+ export declare function isConsoleMessage(data: unknown): data is ConsoleMessageData;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { LogEvent, LogRequest } from '../interfaces/logging-types';
18
+ import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
19
+ import { MessagingService } from '../messaging-service';
20
+ export declare function startLoggingService(messaging: MessagingService): void;
21
+ /**
22
+ *
23
+ * @param messaging the messaging instance.
24
+ * @param offsetInMs this method execute after `offsetInMs` elapsed .
25
+ */
26
+ export declare function _processQueue(messaging: MessagingService, offsetInMs: number): void;
27
+ export declare function _dispatchLogEvents(messaging: MessagingService): Promise<void>;
28
+ export declare function stageLog(messaging: MessagingService, internalPayload: MessagePayloadInternal): Promise<void>;
29
+ export declare function _createLogRequest(logEventQueue: LogEvent[]): LogRequest;
30
+ export declare function _mergeStrings(s1: string, s2: string): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ConsoleMessageData, MessageType } from '../interfaces/internal-message-payload';
18
+ import { MessagingService } from '../messaging-service';
19
+ export declare function logToScion(messaging: MessagingService, messageType: MessageType, data: ConsoleMessageData): Promise<void>;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { TokenDetails } from '../interfaces/token-details';
18
+ export interface V2TokenDetails {
19
+ fcmToken: string;
20
+ swScope: string;
21
+ vapidKey: string | Uint8Array;
22
+ subscription: PushSubscription;
23
+ fcmSenderId: string;
24
+ fcmPushSet: string;
25
+ createTime?: number;
26
+ endpoint?: string;
27
+ auth?: string;
28
+ p256dh?: string;
29
+ }
30
+ export interface V3TokenDetails {
31
+ fcmToken: string;
32
+ swScope: string;
33
+ vapidKey: Uint8Array;
34
+ fcmSenderId: string;
35
+ fcmPushSet: string;
36
+ endpoint: string;
37
+ auth: ArrayBuffer;
38
+ p256dh: ArrayBuffer;
39
+ createTime: number;
40
+ }
41
+ export interface V4TokenDetails {
42
+ fcmToken: string;
43
+ swScope: string;
44
+ vapidKey: Uint8Array;
45
+ fcmSenderId: string;
46
+ endpoint: string;
47
+ auth: ArrayBufferLike;
48
+ p256dh: ArrayBufferLike;
49
+ createTime: number;
50
+ }
51
+ export declare function migrateOldDatabase(senderId: string): Promise<TokenDetails | null>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare function registerMessagingInWindow(): void;
18
+ /**
19
+ * The messaging instance registered in sw is named differently than that of in client. This is
20
+ * because both `registerMessagingInWindow` and `registerMessagingInSw` would be called in
21
+ * `messaging-compat` and component with the same name can only be registered once.
22
+ */
23
+ export declare function registerMessagingInSw(): void;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MessagingService } from '../messaging-service';
18
+ export declare function registerDefaultSw(messaging: MessagingService): Promise<void>;