@firebase/messaging 0.9.1 → 0.9.2-canary.2322b6023

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 (125) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{index.esm.js → esm/index.esm.js} +8 -2
  3. package/dist/esm/index.esm.js.map +1 -0
  4. package/dist/{index.esm2017.js → esm/index.esm2017.js} +8 -2
  5. package/dist/esm/index.esm2017.js.map +1 -0
  6. package/dist/esm/package.json +1 -0
  7. package/dist/{api → esm/src/api}/deleteToken.d.ts +0 -0
  8. package/dist/{api → esm/src/api}/getToken.d.ts +0 -0
  9. package/dist/{api → esm/src/api}/isSupported.d.ts +0 -0
  10. package/dist/{api → esm/src/api}/onBackgroundMessage.d.ts +0 -0
  11. package/dist/{api → esm/src/api}/onMessage.d.ts +0 -0
  12. package/dist/{api → esm/src/api}/setDeliveryMetricsExportedToBigQueryEnabled.d.ts +0 -0
  13. package/dist/{api.d.ts → esm/src/api.d.ts} +0 -0
  14. package/dist/{helpers → esm/src/helpers}/array-base64-translator.d.ts +0 -0
  15. package/dist/{helpers → esm/src/helpers}/array-base64-translator.test.d.ts +0 -0
  16. package/dist/{helpers → esm/src/helpers}/externalizePayload.d.ts +0 -0
  17. package/dist/{helpers → esm/src/helpers}/externalizePayload.test.d.ts +0 -0
  18. package/dist/{helpers → esm/src/helpers}/extract-app-config.d.ts +0 -0
  19. package/dist/{helpers → esm/src/helpers}/extract-app-config.test.d.ts +0 -0
  20. package/dist/{helpers → esm/src/helpers}/is-console-message.d.ts +0 -0
  21. package/dist/{helpers → esm/src/helpers}/logToFirelog.d.ts +0 -0
  22. package/dist/{helpers → esm/src/helpers}/logToFirelog.test.d.ts +0 -0
  23. package/dist/{helpers → esm/src/helpers}/logToScion.d.ts +0 -0
  24. package/dist/{helpers → esm/src/helpers}/migrate-old-database.d.ts +0 -0
  25. package/dist/{helpers → esm/src/helpers}/migrate-old-database.test.d.ts +0 -0
  26. package/dist/{helpers → esm/src/helpers}/register.d.ts +0 -0
  27. package/dist/{helpers → esm/src/helpers}/registerDefaultSw.d.ts +0 -0
  28. package/dist/{helpers → esm/src/helpers}/sleep.d.ts +0 -0
  29. package/dist/{helpers → esm/src/helpers}/sleep.test.d.ts +0 -0
  30. package/dist/{helpers → esm/src/helpers}/updateSwReg.d.ts +0 -0
  31. package/dist/{helpers → esm/src/helpers}/updateVapidKey.d.ts +0 -0
  32. package/dist/{index.d.ts → esm/src/index.d.ts} +0 -0
  33. package/dist/{index.sw.d.ts → esm/src/index.sw.d.ts} +0 -0
  34. package/dist/{interfaces → esm/src/interfaces}/app-config.d.ts +0 -0
  35. package/dist/{interfaces → esm/src/interfaces}/internal-dependencies.d.ts +0 -0
  36. package/dist/{interfaces → esm/src/interfaces}/internal-message-payload.d.ts +0 -0
  37. package/dist/{interfaces → esm/src/interfaces}/logging-types.d.ts +0 -0
  38. package/dist/{interfaces → esm/src/interfaces}/public-types.d.ts +0 -0
  39. package/dist/{interfaces → esm/src/interfaces}/token-details.d.ts +0 -0
  40. package/dist/{internals → esm/src/internals}/idb-manager.d.ts +0 -0
  41. package/dist/{internals → esm/src/internals}/idb-manager.test.d.ts +0 -0
  42. package/dist/{internals → esm/src/internals}/requests.d.ts +0 -0
  43. package/dist/{internals → esm/src/internals}/requests.test.d.ts +0 -0
  44. package/dist/{internals → esm/src/internals}/token-manager.d.ts +0 -0
  45. package/dist/{internals → esm/src/internals}/token-manager.test.d.ts +0 -0
  46. package/dist/{listeners → esm/src/listeners}/sw-listeners.d.ts +0 -0
  47. package/dist/{listeners → esm/src/listeners}/sw-listeners.test.d.ts +0 -0
  48. package/dist/{listeners → esm/src/listeners}/window-listener.d.ts +0 -0
  49. package/dist/{messaging-service.d.ts → esm/src/messaging-service.d.ts} +0 -0
  50. package/dist/{testing → esm/src/testing}/compare-headers.d.ts +0 -0
  51. package/dist/{testing → esm/src/testing}/compare-headers.test.d.ts +0 -0
  52. package/dist/{testing → esm/src/testing}/fakes/firebase-dependencies.d.ts +0 -0
  53. package/dist/{testing → esm/src/testing}/fakes/logging-object.d.ts +0 -0
  54. package/dist/{testing → esm/src/testing}/fakes/messaging-service.d.ts +0 -0
  55. package/dist/{testing → esm/src/testing}/fakes/service-worker.d.ts +0 -0
  56. package/dist/{testing → esm/src/testing}/fakes/token-details.d.ts +0 -0
  57. package/dist/{testing → esm/src/testing}/setup.d.ts +0 -0
  58. package/dist/{testing → esm/src/testing}/sinon-types.d.ts +0 -0
  59. package/dist/{util → esm/src/util}/constants.d.ts +0 -0
  60. package/dist/{util → esm/src/util}/errors.d.ts +0 -0
  61. package/dist/{util → esm/src/util}/sw-types.d.ts +0 -0
  62. package/dist/index.cjs.js +7 -1
  63. package/dist/index.cjs.js.map +1 -1
  64. package/dist/index.sw.esm2017.js +1 -1
  65. package/dist/index.sw.esm2017.js.map +1 -1
  66. package/dist/src/api/deleteToken.d.ts +18 -0
  67. package/dist/src/api/getToken.d.ts +19 -0
  68. package/dist/src/api/isSupported.d.ts +30 -0
  69. package/dist/src/api/onBackgroundMessage.d.ts +19 -0
  70. package/dist/src/api/onMessage.d.ts +19 -0
  71. package/dist/src/api/setDeliveryMetricsExportedToBigQueryEnabled.d.ts +18 -0
  72. package/dist/src/api.d.ts +101 -0
  73. package/dist/src/helpers/array-base64-translator.d.ts +18 -0
  74. package/dist/src/helpers/array-base64-translator.test.d.ts +17 -0
  75. package/dist/src/helpers/externalizePayload.d.ts +19 -0
  76. package/dist/src/helpers/externalizePayload.test.d.ts +17 -0
  77. package/dist/src/helpers/extract-app-config.d.ts +19 -0
  78. package/dist/src/helpers/extract-app-config.test.d.ts +17 -0
  79. package/dist/src/helpers/is-console-message.d.ts +18 -0
  80. package/dist/src/helpers/logToFirelog.d.ts +30 -0
  81. package/dist/src/helpers/logToFirelog.test.d.ts +17 -0
  82. package/dist/src/helpers/logToScion.d.ts +19 -0
  83. package/dist/src/helpers/migrate-old-database.d.ts +51 -0
  84. package/dist/src/helpers/migrate-old-database.test.d.ts +17 -0
  85. package/dist/src/helpers/register.d.ts +23 -0
  86. package/dist/src/helpers/registerDefaultSw.d.ts +18 -0
  87. package/dist/src/helpers/sleep.d.ts +18 -0
  88. package/dist/src/helpers/sleep.test.d.ts +17 -0
  89. package/dist/src/helpers/updateSwReg.d.ts +18 -0
  90. package/dist/src/helpers/updateVapidKey.d.ts +18 -0
  91. package/dist/src/index.d.ts +31 -0
  92. package/dist/src/index.sw.d.ts +26 -0
  93. package/dist/src/interfaces/app-config.d.ts +24 -0
  94. package/dist/src/interfaces/internal-dependencies.d.ts +27 -0
  95. package/dist/src/interfaces/internal-message-payload.d.ts +44 -0
  96. package/dist/src/interfaces/logging-types.d.ts +50 -0
  97. package/dist/src/interfaces/public-types.d.ts +139 -0
  98. package/dist/src/interfaces/token-details.d.ts +32 -0
  99. package/dist/src/internals/idb-manager.d.ts +27 -0
  100. package/dist/src/internals/idb-manager.test.d.ts +17 -0
  101. package/dist/src/internals/requests.d.ts +35 -0
  102. package/dist/src/internals/requests.test.d.ts +17 -0
  103. package/dist/src/internals/token-manager.d.ts +23 -0
  104. package/dist/src/internals/token-manager.test.d.ts +17 -0
  105. package/dist/src/listeners/sw-listeners.d.ts +21 -0
  106. package/dist/src/listeners/sw-listeners.test.d.ts +17 -0
  107. package/dist/src/listeners/window-listener.d.ts +18 -0
  108. package/dist/src/messaging-service.d.ts +36 -0
  109. package/dist/src/testing/compare-headers.d.ts +22 -0
  110. package/dist/src/testing/compare-headers.test.d.ts +17 -0
  111. package/dist/src/testing/fakes/firebase-dependencies.d.ts +25 -0
  112. package/dist/src/testing/fakes/logging-object.d.ts +18 -0
  113. package/dist/src/testing/fakes/messaging-service.d.ts +18 -0
  114. package/dist/src/testing/fakes/service-worker.d.ts +84 -0
  115. package/dist/src/testing/fakes/token-details.d.ts +18 -0
  116. package/dist/src/testing/setup.d.ts +17 -0
  117. package/dist/src/testing/sinon-types.d.ts +19 -0
  118. package/dist/{tsdoc-metadata.json → src/tsdoc-metadata.json} +0 -0
  119. package/dist/src/util/constants.d.ts +39 -0
  120. package/dist/src/util/errors.d.ts +57 -0
  121. package/dist/src/util/sw-types.d.ts +90 -0
  122. package/package.json +24 -15
  123. package/sw/package.json +1 -1
  124. package/dist/index.esm.js.map +0 -1
  125. package/dist/index.esm2017.js.map +0 -1
@@ -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 an Firebase Cloud
38
+ * Messaging registration token that can be used to send push messages to that {@link Messaging}
39
+ * instance.
40
+ *
41
+ * If a 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 optinoal 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,17 @@
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 '../testing/setup';
@@ -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,17 @@
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 {};
@@ -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,17 @@
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 '../testing/setup';
@@ -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,17 @@
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
+ export {};
@@ -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,17 @@
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 '../testing/setup';
@@ -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>;
@@ -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
+ /** Returns a promise that resolves after given time passes. */
18
+ export declare function sleep(ms: number): Promise<void>;
@@ -0,0 +1,17 @@
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 '../testing/setup';
@@ -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 updateSwReg(messaging: MessagingService, swRegistration?: ServiceWorkerRegistration | undefined): Promise<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 updateVapidKey(messaging: MessagingService, vapidKey?: string | undefined): Promise<void>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Firebase Cloud Messaging
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /**
7
+ * @license
8
+ * Copyright 2017 Google LLC
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ import '@firebase/installations';
23
+ import { Messaging } from './interfaces/public-types';
24
+ export { getToken, deleteToken, onMessage, getMessagingInWindow as getMessaging } from './api';
25
+ export { isWindowSupported as isSupported } from './api/isSupported';
26
+ export * from './interfaces/public-types';
27
+ declare module '@firebase/component' {
28
+ interface NameServiceMapping {
29
+ 'messaging': Messaging;
30
+ }
31
+ }
@@ -0,0 +1,26 @@
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 '@firebase/installations';
18
+ import { Messaging } from './interfaces/public-types';
19
+ export * from './interfaces/public-types';
20
+ export { onBackgroundMessage, getMessagingInSw as getMessaging, experimentalSetDeliveryMetricsExportedToBigQueryEnabled } from './api';
21
+ export { isSwSupported as isSupported } from './api/isSupported';
22
+ declare module '@firebase/component' {
23
+ interface NameServiceMapping {
24
+ 'messaging-sw': Messaging;
25
+ }
26
+ }
@@ -0,0 +1,24 @@
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
+ export interface AppConfig {
18
+ readonly appName: string;
19
+ readonly projectId: string;
20
+ readonly apiKey: string;
21
+ readonly appId: string;
22
+ /** Only used for old DB migration. */
23
+ readonly senderId: string;
24
+ }
@@ -0,0 +1,27 @@
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 { AppConfig } from './app-config';
18
+ import { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
19
+ import { FirebaseApp } from '@firebase/app';
20
+ import { Provider } from '@firebase/component';
21
+ import { _FirebaseInstallationsInternal } from '@firebase/installations';
22
+ export interface FirebaseInternalDependencies {
23
+ app: FirebaseApp;
24
+ appConfig: AppConfig;
25
+ installations: _FirebaseInstallationsInternal;
26
+ analyticsProvider: Provider<FirebaseAnalyticsInternalName>;
27
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
11
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
+ * or implied. See the License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+ import { CONSOLE_CAMPAIGN_ANALYTICS_ENABLED, CONSOLE_CAMPAIGN_ID, CONSOLE_CAMPAIGN_NAME, CONSOLE_CAMPAIGN_TIME } from '../util/constants';
16
+ export interface MessagePayloadInternal {
17
+ notification?: NotificationPayloadInternal;
18
+ data?: unknown;
19
+ fcmOptions?: FcmOptionsInternal;
20
+ messageType?: MessageType;
21
+ isFirebaseMessaging?: boolean;
22
+ from: string;
23
+ collapse_key: string;
24
+ fcm_message_id: string;
25
+ }
26
+ export interface NotificationPayloadInternal extends NotificationOptions {
27
+ title: string;
28
+ click_action?: string;
29
+ }
30
+ export interface FcmOptionsInternal {
31
+ link?: string;
32
+ analytics_label?: string;
33
+ }
34
+ export declare enum MessageType {
35
+ PUSH_RECEIVED = "push-received",
36
+ NOTIFICATION_CLICKED = "notification-clicked"
37
+ }
38
+ /** Additional data of a message sent from the FN Console. */
39
+ export interface ConsoleMessageData {
40
+ [CONSOLE_CAMPAIGN_ID]: string;
41
+ [CONSOLE_CAMPAIGN_TIME]: string;
42
+ [CONSOLE_CAMPAIGN_NAME]?: string;
43
+ [CONSOLE_CAMPAIGN_ANALYTICS_ENABLED]?: '1';
44
+ }