No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

internal.d.ts 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. * Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery. By
  7. * default, message delivery metrics are not exported to BigQuery. Use this method to enable or
  8. * disable the export at runtime.
  9. *
  10. * @param messaging - The `FirebaseMessaging` instance.
  11. * @param enable - Whether Firebase Cloud Messaging should export message delivery metrics to
  12. * BigQuery.
  13. *
  14. * @public
  15. */
  16. export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;
  17. /**
  18. * Options for features provided by the FCM SDK for Web. See {@link
  19. * https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
  20. * WebpushFcmOptions}
  21. *
  22. * @public
  23. */
  24. export declare interface FcmOptions {
  25. /**
  26. * The link to open when the user clicks on the notification.
  27. */
  28. link?: string;
  29. /**
  30. * The label associated with the message's analytics data.
  31. */
  32. analyticsLabel?: string;
  33. }
  34. /**
  35. * @internal
  36. */
  37. export declare type _FirebaseMessagingName = 'messaging';
  38. /**
  39. * Retrieves a Firebase Cloud Messaging instance.
  40. *
  41. * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
  42. *
  43. * @public
  44. */
  45. export declare function getMessaging(app?: FirebaseApp): Messaging;
  46. /**
  47. * Options for {@link getToken}
  48. *
  49. * @public
  50. */
  51. export declare interface GetTokenOptions {
  52. /**
  53. * The public server key provided to push services. It is used to
  54. * authenticate the push subscribers to receive push messages only from sending servers that hold
  55. * the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
  56. * push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
  57. * to generate and import a VAPID key for your project with
  58. * {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_with_fcm | Configure Web Credentials with FCM}.
  59. * See
  60. * {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
  61. * for details on web push services.
  62. */
  63. vapidKey?: string;
  64. /**
  65. * The service worker registration for receiving push
  66. * messaging. If the registration is not provided explicitly, you need to have a
  67. * `firebase-messaging-sw.js` at your root location. See
  68. * {@link https://firebase.google.com/docs/cloud-messaging/js/client#retrieve-the-current-registration-token | Retrieve the current registration token}
  69. * for more details.
  70. */
  71. serviceWorkerRegistration?: ServiceWorkerRegistration;
  72. }
  73. /**
  74. * Checks whether all required APIs exist within SW Context
  75. * @returns a Promise that resolves to a boolean.
  76. *
  77. * @public
  78. */
  79. export declare function isSupported(): Promise<boolean>;
  80. /**
  81. * Message payload that contains the notification payload that is represented with
  82. * {@link NotificationPayload} and the data payload that contains an arbitrary
  83. * number of key-value pairs sent by developers through the
  84. * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}
  85. *
  86. * @public
  87. */
  88. export declare interface MessagePayload {
  89. /**
  90. * {@inheritdoc NotificationPayload}
  91. */
  92. notification?: NotificationPayload;
  93. /**
  94. * Arbitrary key/value payload.
  95. */
  96. data?: {
  97. [key: string]: string;
  98. };
  99. /**
  100. * {@inheritdoc FcmOptions}
  101. */
  102. fcmOptions?: FcmOptions;
  103. /**
  104. * The sender of this message.
  105. */
  106. from: string;
  107. /**
  108. * The collapse key of the message. See
  109. * {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
  110. */
  111. collapseKey: string;
  112. /**
  113. * The message id of a message.
  114. */
  115. messageId: string;
  116. }
  117. /**
  118. * Public interface of the Firebase Cloud Messaging SDK.
  119. *
  120. * @public
  121. */
  122. export declare interface Messaging {
  123. /**
  124. * The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
  125. */
  126. app: FirebaseApp;
  127. }
  128. export { NextFn }
  129. /**
  130. * Display notification details. They are sent through the
  131. * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}
  132. *
  133. * @public
  134. */
  135. export declare interface NotificationPayload {
  136. /**
  137. * The notification's title.
  138. */
  139. title?: string;
  140. /**
  141. * The notification's body text.
  142. */
  143. body?: string;
  144. /**
  145. * The URL of an image that is downloaded on the device and displayed in the notification.
  146. */
  147. image?: string;
  148. /**
  149. * The URL to use for the notification's icon. If you don't send this key in the request,
  150. * FCM displays the launcher icon specified in your app manifest.
  151. */
  152. icon?: string;
  153. }
  154. export { Observer }
  155. /**
  156. * Called when a message is received while the app is in the background. An app is considered to be
  157. * in the background if no active window is displayed.
  158. *
  159. * @param messaging - The {@link Messaging} instance.
  160. * @param nextOrObserver - This function, or observer object with `next` defined, is called when a
  161. * message is received and the app is currently in the background.
  162. *
  163. * @returns To stop listening for messages execute this returned function
  164. *
  165. * @public
  166. */
  167. export declare function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
  168. export { Unsubscribe }
  169. export { }