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