Skip to content

Commit d84e137

Browse files
authored
Remove messaging-types-exp (#4498)
* save * save * fix tsdoc * export public types * remove the package from changeset config
1 parent 07d6b2c commit d84e137

File tree

15 files changed

+76
-89
lines changed

15 files changed

+76
-89
lines changed

.changeset/config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"@firebase/installations-types-exp",
2525
"@firebase/installations-compat",
2626
"@firebase/messaging-exp",
27-
"@firebase/messaging-types-exp",
2827
"@firebase/performance-exp",
2928
"@firebase/performance-types-exp",
3029
"@firebase/remote-config-exp",

common/api-review/messaging-exp.api.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,27 @@
55
```ts
66

77
import { FirebaseApp } from '@firebase/app-exp';
8-
import { FirebaseMessaging } from '@firebase/messaging-types-exp';
9-
import { MessagePayload } from '@firebase/messaging-types-exp';
108
import { NextFn } from '@firebase/util';
119
import { Observer } from '@firebase/util';
1210
import { Unsubscribe } from '@firebase/util';
1311

1412
// @public
1513
export function deleteToken(messaging: FirebaseMessaging): Promise<boolean>;
1614

17-
export { FirebaseMessaging }
15+
// @public (undocumented)
16+
export interface FcmOptions {
17+
// (undocumented)
18+
analyticsLabel?: string;
19+
// (undocumented)
20+
link?: string;
21+
}
22+
23+
// @public (undocumented)
24+
export interface FirebaseMessaging {
25+
}
26+
27+
// @internal (undocumented)
28+
export type _FirebaseMessagingName = 'messaging';
1829

1930
// @public
2031
export function getMessaging(app: FirebaseApp): FirebaseMessaging;
@@ -25,7 +36,31 @@ export function getToken(messaging: FirebaseMessaging, options?: {
2536
swReg?: ServiceWorkerRegistration;
2637
}): Promise<string>;
2738

28-
export { MessagePayload }
39+
// @public (undocumented)
40+
export interface MessagePayload {
41+
// (undocumented)
42+
collapseKey: string;
43+
// (undocumented)
44+
data?: {
45+
[key: string]: string;
46+
};
47+
// (undocumented)
48+
fcmOptions?: FcmOptions;
49+
// (undocumented)
50+
from: string;
51+
// (undocumented)
52+
notification?: NotificationPayload;
53+
}
54+
55+
// @public
56+
export interface NotificationPayload {
57+
// (undocumented)
58+
body?: string;
59+
// (undocumented)
60+
image?: string;
61+
// (undocumented)
62+
title?: string;
63+
}
2964

3065
// @public
3166
export function onMessage(messaging: FirebaseMessaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;

packages-exp/messaging-exp/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"dependencies": {
3535
"@firebase/component": "0.2.0",
3636
"@firebase/installations-exp": "0.0.900",
37-
"@firebase/messaging-types-exp": "0.0.900",
3837
"@firebase/util": "0.3.4",
3938
"idb": "3.0.2",
4039
"tslib": "^1.11.1"

packages-exp/messaging-exp/src/api.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import {
19-
FirebaseMessaging,
20-
MessagePayload
21-
} from '@firebase/messaging-types-exp';
18+
import { FirebaseMessaging, MessagePayload } from './interfaces/public-types';
2219
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
2320

2421
import { MessagingService } from './messaging-service';
@@ -32,7 +29,9 @@ import { onMessage as _onMessage } from './api/onMessage';
3229
/**
3330
* Retrieves a firebase messaging instance.
3431
*
35-
* @return the firebase messaging instance associated with the provided firebase app.
32+
* @returns the firebase messaging instance associated with the provided firebase app.
33+
*
34+
* @public
3635
*/
3736
export function getMessaging(app: FirebaseApp): FirebaseMessaging {
3837
const messagingProvider: Provider<'messaging-exp'> = _getProvider(
@@ -50,25 +49,26 @@ export function getMessaging(app: FirebaseApp): FirebaseMessaging {
5049
* If a notification permission isn't already granted, this method asks the user for permission.
5150
* The returned promise rejects if the user does not allow the app to show notifications.
5251
*
53-
* @param messaging: the messaging instance.
54-
* @param options.vapidKey The public server key provided to push services. It is used to
52+
* @param messaging - the messaging instance.
53+
* @param options.vapidKey - The public server key provided to push services. It is used to
5554
* authenticate the push subscribers to receive push messages only from sending servers that
5655
* hold the corresponding private key. If it is not provided, a default VAPID key is used. Note
5756
* that some push services (Chrome Push Service) require a non-default VAPID key. Therefore, it
5857
* is recommended to generate and import a VAPID key for your project with
59-
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_with_fcm Configure Web Credentials with FCM}.
58+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_with_fcm | Configure Web Credentials with FCM}.
6059
* See
61-
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol The Web Push Protocol}
62-
* for details on web push services.}
60+
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
61+
* for details on web push services.
6362
*
64-
* @param options.serviceWorkerRegistration The service worker registration for receiving push
63+
* @param options.serviceWorkerRegistration - The service worker registration for receiving push
6564
* messaging. If the registration is not provided explicitly, you need to have a
6665
* `firebase-messaging-sw.js` at your root location. See
67-
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#retrieve-the-current-registration-token Retrieve the current registration token}
66+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#retrieve-the-current-registration-token | Retrieve the current registration token}
6867
* for more details.
6968
*
70-
* @return The promise resolves with an FCM registration token.
69+
* @returns The promise resolves with an FCM registration token.
7170
*
71+
* @public
7272
*/
7373
export async function getToken(
7474
messaging: FirebaseMessaging,
@@ -81,9 +81,11 @@ export async function getToken(
8181
* Deletes the registration token associated with this messaging instance and unsubscribes the
8282
* messaging instance from the push subscription.
8383
*
84-
* @param messaging: the messaging instance.
84+
* @param messaging - the messaging instance.
85+
*
86+
* @returns The promise resolves when the token has been successfully deleted.
8587
*
86-
* @return The promise resolves when the token has been successfully deleted.
88+
* @public
8789
*/
8890
export function deleteToken(messaging: FirebaseMessaging): Promise<boolean> {
8991
return _deleteToken(messaging as MessagingService);
@@ -95,11 +97,12 @@ export function deleteToken(messaging: FirebaseMessaging): Promise<boolean> {
9597
* the push message.
9698
*
9799
*
98-
* @param messaging: the messaging instance.
99-
* @param
100-
* nextOrObserver This function, or observer object with `next` defined,
100+
* @param messaging - the messaging instance.
101+
* @param nextOrObserver - This function, or observer object with `next` defined,
101102
* is called when a message is received and the user is currently viewing your page.
102-
* @return To stop listening for messages execute this returned function.
103+
* @returns To stop listening for messages execute this returned function.
104+
*
105+
* @public
103106
*/
104107
export function onMessage(
105108
messaging: FirebaseMessaging,
@@ -112,18 +115,17 @@ export function onMessage(
112115
* Called when a message is received while the app is in the background. An app is considered to
113116
* be in the background if no active window is displayed.
114117
*
115-
* @param messaging: the messaging instance.
116-
* @param
117-
* nextOrObserver This function, or observer object with `next` defined,
118+
* @param messaging - the messaging instance.
119+
* @param nextOrObserver - This function, or observer object with `next` defined,
118120
* is called when a message is received and the app is currently in the background.
119121
*
120-
* @return To stop listening for messages execute this returned function
122+
* @returns To stop listening for messages execute this returned function
123+
*
124+
* @public
121125
*/
122126
export function onBackgroundMessage(
123127
messaging: FirebaseMessaging,
124128
nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>
125129
): Unsubscribe {
126130
return _onBackgroundMessage(messaging as MessagingService, nextOrObserver);
127131
}
128-
129-
export { FirebaseMessaging, MessagePayload };

packages-exp/messaging-exp/src/api/onBackgroundMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
1919
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
2020

21-
import { MessagePayload } from '@firebase/messaging-types-exp';
21+
import { MessagePayload } from '../interfaces/public-types';
2222
import { MessagingService } from '../messaging-service';
2323
import { SwController } from '../listeners/sw-controller';
2424

packages-exp/messaging-exp/src/api/onMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
1919
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
2020

21-
import { MessagePayload } from '@firebase/messaging-types-exp';
21+
import { MessagePayload } from '../interfaces/public-types';
2222
import { MessagingService } from '../messaging-service';
2323
import { messageEventListener } from '../listeners/messageEventListener';
2424

packages-exp/messaging-exp/src/helpers/externalizePayload.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { MessagePayload } from '@firebase/messaging-types-exp';
18+
import { MessagePayload } from '../interfaces/public-types';
1919
import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
2020
import { expect } from 'chai';
2121
import { externalizePayload } from './externalizePayload';

packages-exp/messaging-exp/src/helpers/externalizePayload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { MessagePayload } from '@firebase/messaging-types-exp';
18+
import { MessagePayload } from '../interfaces/public-types';
1919
import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
2020

2121
export function externalizePayload(

packages-exp/messaging-exp/src/index.sw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { FirebaseMessaging } from '@firebase/messaging-types-exp';
18+
import { FirebaseMessaging } from './interfaces/public-types';
1919
import { registerMessaging } from './helpers/register';
2020
import '@firebase/installations-exp';
2121

packages-exp/messaging-exp/src/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,12 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { FirebaseMessaging } from '@firebase/messaging-types-exp';
18+
import { FirebaseMessaging } from './interfaces/public-types';
1919
import { registerMessaging } from './helpers/register';
2020
import '@firebase/installations-exp';
2121

22-
export {
23-
getToken,
24-
deleteToken,
25-
onMessage,
26-
getMessaging,
27-
FirebaseMessaging,
28-
MessagePayload
29-
} from './api';
22+
export { getToken, deleteToken, onMessage, getMessaging } from './api';
23+
export * from './interfaces/public-types';
3024

3125
declare module '@firebase/component' {
3226
interface NameServiceMapping {

packages-exp/messaging-types-exp/index.d.ts renamed to packages-exp/messaging-exp/src/interfaces/public-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google LLC
3+
* Copyright 2020 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages-exp/messaging-exp/src/messaging-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { NextFn, Observer } from '@firebase/util';
2020

2121
import { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
2222
import { FirebaseInternalDependencies } from './interfaces/internal-dependencies';
23-
import { MessagePayload } from '@firebase/messaging-types-exp';
23+
import { MessagePayload } from './interfaces/public-types';
2424
import { Provider } from '@firebase/component';
2525
import { _FirebaseInstallationsInternal } from '@firebase/installations-types-exp';
2626
import { extractAppConfig } from './helpers/extract-app-config';

packages-exp/messaging-types-exp/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages-exp/messaging-types-exp/package.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages-exp/messaging-types-exp/tsconfig.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)