Skip to content

Commit 22cebe9

Browse files
committed
installations and messaging
1 parent e175f45 commit 22cebe9

File tree

13 files changed

+28
-15
lines changed

13 files changed

+28
-15
lines changed

packages/installations-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@rollup/plugin-node-resolve": "13.3.0",
5353
"rollup-plugin-typescript2": "0.31.2",
5454
"rollup-plugin-uglify": "6.0.4",
55-
"typescript": "4.2.2"
55+
"typescript": "4.7.4"
5656
},
5757
"peerDependencies": {
5858
"@firebase/app-compat": "0.x"

packages/installations-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"url": "https://github.com/firebase/firebase-js-sdk/issues"
2424
},
2525
"devDependencies": {
26-
"typescript": "4.2.2"
26+
"typescript": "4.7.4"
2727
}
2828
}

packages/installations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@rollup/plugin-node-resolve": "13.3.0",
5858
"rollup-plugin-typescript2": "0.31.2",
5959
"rollup-plugin-uglify": "6.0.4",
60-
"typescript": "4.2.2"
60+
"typescript": "4.7.4"
6161
},
6262
"peerDependencies": {
6363
"@firebase/app": "0.x"

packages/installations/src/functions/create-installation-request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const FID = 'defenders-of-the-faith';
3939

4040
describe('createInstallationRequest', () => {
4141
let fakeInstallations: FirebaseInstallationsImpl;
42-
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
42+
let fetchSpy: SinonStub<[RequestInfo | URL, RequestInit?], Promise<Response>>;
4343
let inProgressInstallationEntry: InProgressInstallationEntry;
4444
let response: CreateInstallationResponse;
4545

packages/installations/src/functions/delete-installation-request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const FID = 'foreclosure-of-a-dream';
3737

3838
describe('deleteInstallationRequest', () => {
3939
let appConfig: AppConfig;
40-
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
40+
let fetchSpy: SinonStub<[RequestInfo | URL, RequestInit?], Promise<Response>>;
4141
let registeredInstallationEntry: RegisteredInstallationEntry;
4242

4343
beforeEach(() => {

packages/installations/src/functions/generate-auth-token-request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const FID = 'evil-has-no-boundaries';
4040

4141
describe('generateAuthTokenRequest', () => {
4242
let installations: FirebaseInstallationsImpl;
43-
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
43+
let fetchSpy: SinonStub<[RequestInfo | URL, RequestInit?], Promise<Response>>;
4444
let registeredInstallationEntry: RegisteredInstallationEntry;
4545
let response: GenerateAuthTokenResponse;
4646

packages/messaging-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@rollup/plugin-json": "4.1.0",
5050
"rollup-plugin-typescript2": "0.31.2",
5151
"ts-essentials": "9.3.0",
52-
"typescript": "4.2.2"
52+
"typescript": "4.7.4"
5353
},
5454
"repository": {
5555
"directory": "packages/messaging",

packages/messaging-interop-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
"url": "https://github.com/firebase/firebase-js-sdk/issues"
2121
},
2222
"devDependencies": {
23-
"typescript": "4.2.2"
23+
"typescript": "4.7.4"
2424
}
2525
}

packages/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"rollup-plugin-typescript2": "0.31.2",
6868
"@rollup/plugin-json": "4.1.0",
6969
"ts-essentials": "9.3.0",
70-
"typescript": "4.2.2"
70+
"typescript": "4.7.4"
7171
},
7272
"repository": {
7373
"directory": "packages/messaging",

packages/messaging/src/listeners/sw-listeners.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ const DISPLAY_MESSAGE: MessagePayloadInternal = {
8080
fcmMessageId: 'mid'
8181
};
8282

83+
// maxActions is an experimental property and not part of the official
84+
// TypeScript interface
85+
// https://developer.mozilla.org/en-US/docs/Web/API/Notification/maxActions
86+
interface NotificationExperimental extends Notification {
87+
maxActions?: number;
88+
}
89+
8390
describe('SwController', () => {
8491
let addEventListenerStub: Stub<typeof self.addEventListener>;
8592
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -227,10 +234,10 @@ describe('SwController', () => {
227234
it('warns if there are more action buttons than the browser limit', async () => {
228235
// This doesn't exist on Firefox:
229236
// https://developer.mozilla.org/en-US/docs/Web/API/notification/maxActions
230-
if (!Notification.maxActions) {
237+
if (!(Notification as unknown as NotificationExperimental).maxActions) {
231238
return;
232239
}
233-
stub(Notification, 'maxActions').value(1);
240+
stub((Notification as unknown as NotificationExperimental), 'maxActions').value(1);
234241

235242
const warnStub = stub(console, 'warn');
236243

packages/messaging/src/listeners/sw-listeners.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ import { isConsoleMessage } from '../helpers/is-console-message';
4040
import { sleep } from '../helpers/sleep';
4141
import { stageLog } from '../helpers/logToFirelog';
4242

43+
// maxActions is an experimental property and not part of the official
44+
// TypeScript interface
45+
// https://developer.mozilla.org/en-US/docs/Web/API/Notification/maxActions
46+
interface NotificationExperimental extends Notification {
47+
maxActions?: number;
48+
}
49+
4350
// Let TS know that this is a service worker
4451
declare const self: ServiceWorkerGlobalScope;
4552

@@ -247,7 +254,7 @@ function showNotification(
247254
// Note: Firefox does not support the maxActions property.
248255
// https://developer.mozilla.org/en-US/docs/Web/API/notification/maxActions
249256
const { actions } = notificationPayloadInternal;
250-
const { maxActions } = Notification;
257+
const { maxActions } = Notification as unknown as NotificationExperimental;
251258
if (actions && maxActions && actions.length > maxActions) {
252259
console.warn(
253260
`This browser only supports ${maxActions} actions. The remaining actions will not be displayed.`

packages/messaging/src/testing/fakes/service-worker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class FakeWindowClient implements WindowClient {
8080
readonly id: string;
8181
readonly type = 'window';
8282
focused = false;
83-
visibilityState: VisibilityState = 'hidden';
83+
visibilityState: DocumentVisibilityState = 'hidden';
8484
url = 'https://example.org';
8585

8686
constructor() {
@@ -112,7 +112,6 @@ export class FakeServiceWorkerRegistration
112112

113113
// Unused in FCM Web SDK, no need to mock these.
114114
navigationPreload = null as unknown as NavigationPreloadManager;
115-
sync = null as unknown as SyncManager;
116115
updateViaCache = null as unknown as ServiceWorkerUpdateViaCache;
117116

118117
async getNotifications() {

packages/messaging/src/util/sw-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export interface ClientQueryOptions {
6363

6464
export interface WindowClient extends Client {
6565
readonly focused: boolean;
66-
readonly visibilityState: VisibilityState;
66+
readonly visibilityState: DocumentVisibilityState;
6767
focus(): Promise<WindowClient>;
6868
navigate(url: string): Promise<WindowClient>;
6969
}

0 commit comments

Comments
 (0)