GSI - Employe Self Service Mobile
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.

219 lines
6.9 KiB

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