@depup/firebase__messaging 0.12.24-depup.0
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.
- package/README.md +32 -0
- package/changes.json +14 -0
- package/dist/esm/index.esm.js +1270 -0
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/esm/index.sw.esm.js +1278 -0
- package/dist/esm/index.sw.esm.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/src/api/deleteToken.d.ts +18 -0
- package/dist/esm/src/api/getToken.d.ts +19 -0
- package/dist/esm/src/api/isSupported.d.ts +30 -0
- package/dist/esm/src/api/onBackgroundMessage.d.ts +19 -0
- package/dist/esm/src/api/onMessage.d.ts +19 -0
- package/dist/esm/src/api/setDeliveryMetricsExportedToBigQueryEnabled.d.ts +18 -0
- package/dist/esm/src/api.d.ts +101 -0
- package/dist/esm/src/helpers/array-base64-translator.d.ts +18 -0
- package/dist/esm/src/helpers/externalizePayload.d.ts +19 -0
- package/dist/esm/src/helpers/extract-app-config.d.ts +19 -0
- package/dist/esm/src/helpers/is-console-message.d.ts +18 -0
- package/dist/esm/src/helpers/logToFirelog.d.ts +30 -0
- package/dist/esm/src/helpers/logToScion.d.ts +19 -0
- package/dist/esm/src/helpers/migrate-old-database.d.ts +51 -0
- package/dist/esm/src/helpers/register.d.ts +23 -0
- package/dist/esm/src/helpers/registerDefaultSw.d.ts +18 -0
- package/dist/esm/src/helpers/sleep.d.ts +18 -0
- package/dist/esm/src/helpers/updateSwReg.d.ts +18 -0
- package/dist/esm/src/helpers/updateVapidKey.d.ts +18 -0
- package/dist/esm/src/index.d.ts +32 -0
- package/dist/esm/src/index.sw.d.ts +26 -0
- package/dist/esm/src/interfaces/app-config.d.ts +24 -0
- package/dist/esm/src/interfaces/internal-dependencies.d.ts +27 -0
- package/dist/esm/src/interfaces/internal-message-payload.d.ts +65 -0
- package/dist/esm/src/interfaces/logging-types.d.ts +60 -0
- package/dist/esm/src/interfaces/public-types.d.ts +144 -0
- package/dist/esm/src/interfaces/token-details.d.ts +32 -0
- package/dist/esm/src/internals/idb-manager.d.ts +27 -0
- package/dist/esm/src/internals/requests.d.ts +35 -0
- package/dist/esm/src/internals/token-manager.d.ts +23 -0
- package/dist/esm/src/listeners/sw-listeners.d.ts +21 -0
- package/dist/esm/src/listeners/window-listener.d.ts +18 -0
- package/dist/esm/src/messaging-service.d.ts +36 -0
- package/dist/esm/src/testing/compare-headers.d.ts +22 -0
- package/dist/esm/src/testing/fakes/firebase-dependencies.d.ts +25 -0
- package/dist/esm/src/testing/fakes/logging-object.d.ts +18 -0
- package/dist/esm/src/testing/fakes/messaging-service.d.ts +18 -0
- package/dist/esm/src/testing/fakes/service-worker.d.ts +83 -0
- package/dist/esm/src/testing/fakes/token-details.d.ts +18 -0
- package/dist/esm/src/testing/setup.d.ts +17 -0
- package/dist/esm/src/testing/sinon-types.d.ts +19 -0
- package/dist/esm/src/util/constants.d.ts +40 -0
- package/dist/esm/src/util/errors.d.ts +57 -0
- package/dist/esm/src/util/sw-types.d.ts +90 -0
- package/dist/index-public.d.ts +204 -0
- package/dist/index.cjs.js +1278 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.sw.cjs +1285 -0
- package/dist/index.sw.cjs.map +1 -0
- package/dist/internal.d.ts +220 -0
- package/dist/private.d.ts +217 -0
- package/dist/src/api/deleteToken.d.ts +18 -0
- package/dist/src/api/getToken.d.ts +19 -0
- package/dist/src/api/isSupported.d.ts +30 -0
- package/dist/src/api/onBackgroundMessage.d.ts +19 -0
- package/dist/src/api/onMessage.d.ts +19 -0
- package/dist/src/api/setDeliveryMetricsExportedToBigQueryEnabled.d.ts +18 -0
- package/dist/src/api.d.ts +101 -0
- package/dist/src/helpers/array-base64-translator.d.ts +18 -0
- package/dist/src/helpers/externalizePayload.d.ts +19 -0
- package/dist/src/helpers/extract-app-config.d.ts +19 -0
- package/dist/src/helpers/is-console-message.d.ts +18 -0
- package/dist/src/helpers/logToFirelog.d.ts +30 -0
- package/dist/src/helpers/logToScion.d.ts +19 -0
- package/dist/src/helpers/migrate-old-database.d.ts +51 -0
- package/dist/src/helpers/register.d.ts +23 -0
- package/dist/src/helpers/registerDefaultSw.d.ts +18 -0
- package/dist/src/helpers/sleep.d.ts +18 -0
- package/dist/src/helpers/updateSwReg.d.ts +18 -0
- package/dist/src/helpers/updateVapidKey.d.ts +18 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.sw.d.ts +26 -0
- package/dist/src/interfaces/app-config.d.ts +24 -0
- package/dist/src/interfaces/internal-dependencies.d.ts +27 -0
- package/dist/src/interfaces/internal-message-payload.d.ts +65 -0
- package/dist/src/interfaces/logging-types.d.ts +60 -0
- package/dist/src/interfaces/public-types.d.ts +144 -0
- package/dist/src/interfaces/token-details.d.ts +32 -0
- package/dist/src/internals/idb-manager.d.ts +27 -0
- package/dist/src/internals/requests.d.ts +35 -0
- package/dist/src/internals/token-manager.d.ts +23 -0
- package/dist/src/listeners/sw-listeners.d.ts +21 -0
- package/dist/src/listeners/window-listener.d.ts +18 -0
- package/dist/src/messaging-service.d.ts +36 -0
- package/dist/src/testing/compare-headers.d.ts +22 -0
- package/dist/src/testing/fakes/firebase-dependencies.d.ts +25 -0
- package/dist/src/testing/fakes/logging-object.d.ts +18 -0
- package/dist/src/testing/fakes/messaging-service.d.ts +18 -0
- package/dist/src/testing/fakes/service-worker.d.ts +83 -0
- package/dist/src/testing/fakes/token-details.d.ts +18 -0
- package/dist/src/testing/setup.d.ts +17 -0
- package/dist/src/testing/sinon-types.d.ts +19 -0
- package/dist/src/tsdoc-metadata.json +11 -0
- package/dist/src/util/constants.d.ts +40 -0
- package/dist/src/util/errors.d.ts +57 -0
- package/dist/src/util/sw-types.d.ts +90 -0
- package/dist/sw/index-public.d.ts +166 -0
- package/dist/sw/internal.d.ts +180 -0
- package/dist/sw/private.d.ts +177 -0
- package/package.json +103 -0
- package/sw/package.json +8 -0
|
@@ -0,0 +1,25 @@
|
|
|
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 { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
|
|
18
|
+
import { FirebaseInternalDependencies } from '../../interfaces/internal-dependencies';
|
|
19
|
+
import { FirebaseOptions } from '@firebase/app';
|
|
20
|
+
import { Provider } from '@firebase/component';
|
|
21
|
+
import { _FirebaseInstallationsInternal } from '@firebase/installations';
|
|
22
|
+
export declare function getFakeFirebaseDependencies(options?: FirebaseOptions): FirebaseInternalDependencies;
|
|
23
|
+
export declare function getFakeApp(options?: FirebaseOptions): any;
|
|
24
|
+
export declare function getFakeInstallations(): _FirebaseInstallationsInternal;
|
|
25
|
+
export declare function getFakeAnalyticsProvider(): Provider<FirebaseAnalyticsInternalName>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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 { LogEvent, LogResponse } from '../../interfaces/logging-types';
|
|
16
|
+
export declare function getFakeLogEvent(): LogEvent;
|
|
17
|
+
export declare function getSuccessResponse(): LogResponse;
|
|
18
|
+
export declare function getFailedResponse(): LogResponse;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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 getFakeMessagingService(): MessagingService;
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { ExtendableEvent } from '../../util/sw-types';
|
|
18
|
+
export declare function mockServiceWorker(): void;
|
|
19
|
+
export declare function restoreServiceWorker(): void;
|
|
20
|
+
export declare class FakeServiceWorkerRegistration implements ServiceWorkerRegistration {
|
|
21
|
+
active: null;
|
|
22
|
+
installing: null;
|
|
23
|
+
waiting: null;
|
|
24
|
+
onupdatefound: null;
|
|
25
|
+
pushManager: FakePushManager;
|
|
26
|
+
scope: string;
|
|
27
|
+
navigationPreload: NavigationPreloadManager;
|
|
28
|
+
updateViaCache: ServiceWorkerUpdateViaCache;
|
|
29
|
+
getNotifications(): Promise<never[]>;
|
|
30
|
+
showNotification(): Promise<void>;
|
|
31
|
+
update(): Promise<void>;
|
|
32
|
+
unregister(): Promise<boolean>;
|
|
33
|
+
addEventListener(): void;
|
|
34
|
+
removeEventListener(): void;
|
|
35
|
+
dispatchEvent(): boolean;
|
|
36
|
+
}
|
|
37
|
+
declare class FakePushManager implements PushManager {
|
|
38
|
+
private subscription;
|
|
39
|
+
permissionState(): Promise<"granted">;
|
|
40
|
+
getSubscription(): Promise<FakePushSubscription | null>;
|
|
41
|
+
subscribe(): Promise<FakePushSubscription>;
|
|
42
|
+
}
|
|
43
|
+
export declare class FakePushSubscription implements PushSubscription {
|
|
44
|
+
endpoint: string;
|
|
45
|
+
expirationTime: number;
|
|
46
|
+
auth: string;
|
|
47
|
+
p256: string;
|
|
48
|
+
getKey(name: PushEncryptionKeyName): Uint8Array;
|
|
49
|
+
unsubscribe(): Promise<boolean>;
|
|
50
|
+
toJSON: () => PushSubscriptionJSON;
|
|
51
|
+
options: PushSubscriptionOptions;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Most of the fields in here are unused / deprecated. They are only added here to match the TS
|
|
55
|
+
* Event interface.
|
|
56
|
+
*/
|
|
57
|
+
export declare class FakeEvent implements ExtendableEvent {
|
|
58
|
+
type: string;
|
|
59
|
+
NONE: 0;
|
|
60
|
+
AT_TARGET: 2;
|
|
61
|
+
BUBBLING_PHASE: 3;
|
|
62
|
+
CAPTURING_PHASE: 1;
|
|
63
|
+
bubbles: boolean;
|
|
64
|
+
cancelable: boolean;
|
|
65
|
+
composed: boolean;
|
|
66
|
+
timeStamp: number;
|
|
67
|
+
isTrusted: boolean;
|
|
68
|
+
eventPhase: 0;
|
|
69
|
+
target: null;
|
|
70
|
+
currentTarget: null;
|
|
71
|
+
srcElement: null;
|
|
72
|
+
cancelBubble: boolean;
|
|
73
|
+
defaultPrevented: boolean;
|
|
74
|
+
returnValue: boolean;
|
|
75
|
+
preventDefault(): void;
|
|
76
|
+
stopPropagation(): void;
|
|
77
|
+
stopImmediatePropagation(): void;
|
|
78
|
+
initEvent(): void;
|
|
79
|
+
waitUntil(): void;
|
|
80
|
+
composedPath(): never[];
|
|
81
|
+
constructor(type: string, options?: EventInit);
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -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 { TokenDetails } from '../../interfaces/token-details';
|
|
18
|
+
export declare function getFakeTokenDetails(): TokenDetails;
|
|
@@ -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 { SinonSpy, SinonStub } from 'sinon';
|
|
18
|
+
export type Stub<T extends (...args: any) => any> = SinonStub<Parameters<T>, ReturnType<T>>;
|
|
19
|
+
export type Spy<T extends (...args: any) => any> = SinonSpy<Parameters<T>, ReturnType<T>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "0.1.2"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 declare const DEFAULT_SW_PATH = "/firebase-messaging-sw.js";
|
|
18
|
+
export declare const DEFAULT_SW_SCOPE = "/firebase-cloud-messaging-push-scope";
|
|
19
|
+
export declare const DEFAULT_VAPID_KEY = "BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";
|
|
20
|
+
export declare const ENDPOINT = "https://fcmregistrations.googleapis.com/v1";
|
|
21
|
+
/** Key of FCM Payload in Notification's data field. */
|
|
22
|
+
export declare const FCM_MSG = "FCM_MSG";
|
|
23
|
+
export declare const CONSOLE_CAMPAIGN_ID = "google.c.a.c_id";
|
|
24
|
+
export declare const CONSOLE_CAMPAIGN_NAME = "google.c.a.c_l";
|
|
25
|
+
export declare const CONSOLE_CAMPAIGN_TIME = "google.c.a.ts";
|
|
26
|
+
/** Set to '1' if Analytics is enabled for the campaign */
|
|
27
|
+
export declare const CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = "google.c.a.e";
|
|
28
|
+
export declare const TAG = "FirebaseMessaging: ";
|
|
29
|
+
export declare const MAX_NUMBER_OF_EVENTS_PER_LOG_REQUEST = 1000;
|
|
30
|
+
export declare const MAX_RETRIES = 3;
|
|
31
|
+
export declare const LOG_INTERVAL_IN_MS = 86400000;
|
|
32
|
+
export declare const DEFAULT_BACKOFF_TIME_MS = 5000;
|
|
33
|
+
export declare const DEFAULT_REGISTRATION_TIMEOUT = 10000;
|
|
34
|
+
export declare const FCM_LOG_SOURCE = 1249;
|
|
35
|
+
export declare const SDK_PLATFORM_WEB = 3;
|
|
36
|
+
export declare const EVENT_MESSAGE_DELIVERED = 1;
|
|
37
|
+
export declare enum MessageType {
|
|
38
|
+
DATA_MESSAGE = 1,
|
|
39
|
+
DISPLAY_NOTIFICATION = 3
|
|
40
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { ErrorFactory, ErrorMap } from '@firebase/util';
|
|
18
|
+
export declare const enum ErrorCode {
|
|
19
|
+
MISSING_APP_CONFIG_VALUES = "missing-app-config-values",
|
|
20
|
+
AVAILABLE_IN_WINDOW = "only-available-in-window",
|
|
21
|
+
AVAILABLE_IN_SW = "only-available-in-sw",
|
|
22
|
+
PERMISSION_DEFAULT = "permission-default",
|
|
23
|
+
PERMISSION_BLOCKED = "permission-blocked",
|
|
24
|
+
UNSUPPORTED_BROWSER = "unsupported-browser",
|
|
25
|
+
INDEXED_DB_UNSUPPORTED = "indexed-db-unsupported",
|
|
26
|
+
FAILED_DEFAULT_REGISTRATION = "failed-service-worker-registration",
|
|
27
|
+
TOKEN_SUBSCRIBE_FAILED = "token-subscribe-failed",
|
|
28
|
+
TOKEN_SUBSCRIBE_NO_TOKEN = "token-subscribe-no-token",
|
|
29
|
+
TOKEN_UNSUBSCRIBE_FAILED = "token-unsubscribe-failed",
|
|
30
|
+
TOKEN_UPDATE_FAILED = "token-update-failed",
|
|
31
|
+
TOKEN_UPDATE_NO_TOKEN = "token-update-no-token",
|
|
32
|
+
INVALID_BG_HANDLER = "invalid-bg-handler",
|
|
33
|
+
USE_SW_AFTER_GET_TOKEN = "use-sw-after-get-token",
|
|
34
|
+
INVALID_SW_REGISTRATION = "invalid-sw-registration",
|
|
35
|
+
USE_VAPID_KEY_AFTER_GET_TOKEN = "use-vapid-key-after-get-token",
|
|
36
|
+
INVALID_VAPID_KEY = "invalid-vapid-key"
|
|
37
|
+
}
|
|
38
|
+
export declare const ERROR_MAP: ErrorMap<ErrorCode>;
|
|
39
|
+
interface ErrorParams {
|
|
40
|
+
[ErrorCode.MISSING_APP_CONFIG_VALUES]: {
|
|
41
|
+
valueName: string;
|
|
42
|
+
};
|
|
43
|
+
[ErrorCode.FAILED_DEFAULT_REGISTRATION]: {
|
|
44
|
+
browserErrorMessage: string;
|
|
45
|
+
};
|
|
46
|
+
[ErrorCode.TOKEN_SUBSCRIBE_FAILED]: {
|
|
47
|
+
errorInfo: string;
|
|
48
|
+
};
|
|
49
|
+
[ErrorCode.TOKEN_UNSUBSCRIBE_FAILED]: {
|
|
50
|
+
errorInfo: string;
|
|
51
|
+
};
|
|
52
|
+
[ErrorCode.TOKEN_UPDATE_FAILED]: {
|
|
53
|
+
errorInfo: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2018 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
|
+
/**
|
|
18
|
+
* Subset of Web Worker types from lib.webworker.d.ts
|
|
19
|
+
* https://github.com/Microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts
|
|
20
|
+
*
|
|
21
|
+
* Since it's not possible to have both "dom" and "webworker" libs in a single project, we have to
|
|
22
|
+
* manually declare the web worker types we need.
|
|
23
|
+
*/
|
|
24
|
+
export interface ServiceWorkerGlobalScope {
|
|
25
|
+
readonly location: WorkerLocation;
|
|
26
|
+
readonly clients: Clients;
|
|
27
|
+
readonly registration: ServiceWorkerRegistration;
|
|
28
|
+
addEventListener<K extends keyof ServiceWorkerGlobalScopeEventMap>(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
29
|
+
}
|
|
30
|
+
export interface ServiceWorkerGlobalScopeEventMap {
|
|
31
|
+
notificationclick: NotificationEvent;
|
|
32
|
+
push: PushEvent;
|
|
33
|
+
pushsubscriptionchange: PushSubscriptionChangeEvent;
|
|
34
|
+
}
|
|
35
|
+
export interface Client {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly type: ClientTypes;
|
|
38
|
+
readonly url: string;
|
|
39
|
+
postMessage(message: any, transfer?: Transferable[]): void;
|
|
40
|
+
}
|
|
41
|
+
export interface ClientQueryOptions {
|
|
42
|
+
includeReserved?: boolean;
|
|
43
|
+
includeUncontrolled?: boolean;
|
|
44
|
+
type?: ClientTypes;
|
|
45
|
+
}
|
|
46
|
+
export interface WindowClient extends Client {
|
|
47
|
+
readonly focused: boolean;
|
|
48
|
+
readonly visibilityState: DocumentVisibilityState;
|
|
49
|
+
focus(): Promise<WindowClient>;
|
|
50
|
+
navigate(url: string): Promise<WindowClient>;
|
|
51
|
+
}
|
|
52
|
+
export interface Clients {
|
|
53
|
+
claim(): Promise<void>;
|
|
54
|
+
get(id: string): Promise<any>;
|
|
55
|
+
matchAll(options?: ClientQueryOptions): Promise<Client[]>;
|
|
56
|
+
openWindow(url: string): Promise<WindowClient | null>;
|
|
57
|
+
}
|
|
58
|
+
export interface ExtendableEvent extends Event {
|
|
59
|
+
waitUntil(f: Promise<any>): void;
|
|
60
|
+
}
|
|
61
|
+
export interface NotificationEvent extends ExtendableEvent {
|
|
62
|
+
readonly action: string;
|
|
63
|
+
readonly notification: Notification;
|
|
64
|
+
}
|
|
65
|
+
interface PushMessageData {
|
|
66
|
+
arrayBuffer(): ArrayBuffer;
|
|
67
|
+
blob(): Blob;
|
|
68
|
+
json(): any;
|
|
69
|
+
text(): string;
|
|
70
|
+
}
|
|
71
|
+
export interface PushEvent extends ExtendableEvent {
|
|
72
|
+
readonly data: PushMessageData | null;
|
|
73
|
+
}
|
|
74
|
+
export interface PushSubscriptionChangeEvent extends ExtendableEvent {
|
|
75
|
+
readonly newSubscription: PushSubscription | null;
|
|
76
|
+
readonly oldSubscription: PushSubscription | null;
|
|
77
|
+
}
|
|
78
|
+
interface WorkerLocation {
|
|
79
|
+
readonly hash: string;
|
|
80
|
+
readonly host: string;
|
|
81
|
+
readonly hostname: string;
|
|
82
|
+
readonly href: string;
|
|
83
|
+
readonly origin: string;
|
|
84
|
+
readonly pathname: string;
|
|
85
|
+
readonly port: string;
|
|
86
|
+
readonly protocol: string;
|
|
87
|
+
readonly search: string;
|
|
88
|
+
toString(): string;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { FirebaseApp } from '@firebase/app';
|
|
2
|
+
|
|
3
|
+
import { NextFn , Observer , Unsubscribe } from '@firebase/util';
|
|
4
|
+
|
|
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
|
+
/* Excluded from this release type: _FirebaseMessagingName */
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves a Firebase Cloud Messaging instance.
|
|
37
|
+
*
|
|
38
|
+
* @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare function getMessaging(app?: FirebaseApp): Messaging;
|
|
43
|
+
/**
|
|
44
|
+
* Options for {@link getToken}.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare interface GetTokenOptions {
|
|
49
|
+
/**
|
|
50
|
+
* The public server key provided to push services. The key is used to
|
|
51
|
+
* authenticate push subscribers to receive push messages only from sending servers that hold
|
|
52
|
+
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
|
|
53
|
+
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
|
|
54
|
+
* to generate and import a VAPID key for your project with
|
|
55
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
|
|
56
|
+
* See
|
|
57
|
+
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
|
|
58
|
+
* for details on web push services.
|
|
59
|
+
*/
|
|
60
|
+
vapidKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The service worker registration for receiving push
|
|
63
|
+
* messaging. If the registration is not provided explicitly, you need to have a
|
|
64
|
+
* `firebase-messaging-sw.js` at your root location. See
|
|
65
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
|
|
66
|
+
* for more details.
|
|
67
|
+
*/
|
|
68
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Checks whether all required APIs exist within SW Context
|
|
72
|
+
* @returns a Promise that resolves to a boolean.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export declare function isSupported(): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Message payload that contains the notification payload that is represented with
|
|
79
|
+
* {@link NotificationPayload} and the data payload that contains an arbitrary
|
|
80
|
+
* number of key-value pairs sent by developers through the
|
|
81
|
+
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export declare interface MessagePayload {
|
|
86
|
+
/**
|
|
87
|
+
* {@inheritdoc NotificationPayload}
|
|
88
|
+
*/
|
|
89
|
+
notification?: NotificationPayload;
|
|
90
|
+
/**
|
|
91
|
+
* Arbitrary key/value payload.
|
|
92
|
+
*/
|
|
93
|
+
data?: {
|
|
94
|
+
[key: string]: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* {@inheritdoc FcmOptions}
|
|
98
|
+
*/
|
|
99
|
+
fcmOptions?: FcmOptions;
|
|
100
|
+
/**
|
|
101
|
+
* The sender of this message.
|
|
102
|
+
*/
|
|
103
|
+
from: string;
|
|
104
|
+
/**
|
|
105
|
+
* The collapse key of the message. See
|
|
106
|
+
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
|
|
107
|
+
*/
|
|
108
|
+
collapseKey: string;
|
|
109
|
+
/**
|
|
110
|
+
* The message ID of a message.
|
|
111
|
+
*/
|
|
112
|
+
messageId: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Public interface of the Firebase Cloud Messaging SDK.
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export declare interface Messaging {
|
|
120
|
+
/**
|
|
121
|
+
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
|
|
122
|
+
*/
|
|
123
|
+
app: FirebaseApp;
|
|
124
|
+
}
|
|
125
|
+
export { NextFn };
|
|
126
|
+
/**
|
|
127
|
+
* Display notification details. Details are sent through the
|
|
128
|
+
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
export declare interface NotificationPayload {
|
|
133
|
+
/**
|
|
134
|
+
* The notification's title.
|
|
135
|
+
*/
|
|
136
|
+
title?: string;
|
|
137
|
+
/**
|
|
138
|
+
* The notification's body text.
|
|
139
|
+
*/
|
|
140
|
+
body?: string;
|
|
141
|
+
/**
|
|
142
|
+
* The URL of an image that is downloaded on the device and displayed in the notification.
|
|
143
|
+
*/
|
|
144
|
+
image?: string;
|
|
145
|
+
/**
|
|
146
|
+
* The URL to use for the notification's icon. If you don't send this key in the request,
|
|
147
|
+
* FCM displays the launcher icon specified in your app manifest.
|
|
148
|
+
*/
|
|
149
|
+
icon?: string;
|
|
150
|
+
}
|
|
151
|
+
export { Observer };
|
|
152
|
+
/**
|
|
153
|
+
* Called when a message is received while the app is in the background. An app is considered to be
|
|
154
|
+
* in the background if no active window is displayed.
|
|
155
|
+
*
|
|
156
|
+
* @param messaging - The {@link Messaging} instance.
|
|
157
|
+
* @param nextOrObserver - This function, or observer object with `next` defined, is called when a
|
|
158
|
+
* message is received and the app is currently in the background.
|
|
159
|
+
*
|
|
160
|
+
* @returns To stop listening for messages execute this returned function
|
|
161
|
+
*
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
export declare function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
165
|
+
export { Unsubscribe };
|
|
166
|
+
export {};
|