Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

101
node_modules/@firebase/messaging/dist/esm/src/api.d.ts generated vendored Normal file
View file

@ -0,0 +1,101 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { GetTokenOptions, MessagePayload, Messaging } from './interfaces/public-types';
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
/**
* Retrieves a Firebase Cloud Messaging instance.
*
* @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
*
* @public
*/
export declare function getMessagingInWindow(app?: FirebaseApp): Messaging;
/**
* Retrieves a Firebase Cloud Messaging instance.
*
* @returns The Firebase Cloud Messaging instance associated with the provided firebase app.
*
* @public
*/
export declare function getMessagingInSw(app?: FirebaseApp): Messaging;
/**
* Subscribes the {@link Messaging} instance to push notifications. Returns a Firebase Cloud
* Messaging registration token that can be used to send push messages to that {@link Messaging}
* instance.
*
* If notification permission isn't already granted, this method asks the user for permission. The
* returned promise rejects if the user does not allow the app to show notifications.
*
* @param messaging - The {@link Messaging} instance.
* @param options - Provides an optional vapid key and an optional service worker registration.
*
* @returns The promise resolves with an FCM registration token.
*
* @public
*/
export declare function getToken(messaging: Messaging, options?: GetTokenOptions): Promise<string>;
/**
* Deletes the registration token associated with this {@link Messaging} instance and unsubscribes
* the {@link Messaging} instance from the push subscription.
*
* @param messaging - The {@link Messaging} instance.
*
* @returns The promise resolves when the token has been successfully deleted.
*
* @public
*/
export declare function deleteToken(messaging: Messaging): Promise<boolean>;
/**
* When a push message is received and the user is currently on a page for your origin, the
* message is passed to the page and an `onMessage()` event is dispatched with the payload of
* the push message.
*
*
* @param messaging - The {@link Messaging} instance.
* @param nextOrObserver - This function, or observer object with `next` defined,
* is called when a message is received and the user is currently viewing your page.
* @returns To stop listening for messages execute this returned function.
*
* @public
*/
export declare function onMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
/**
* Called when a message is received while the app is in the background. An app is considered to be
* in the background if no active window is displayed.
*
* @param messaging - The {@link Messaging} instance.
* @param nextOrObserver - This function, or observer object with `next` defined, is called when a
* message is received and the app is currently in the background.
*
* @returns To stop listening for messages execute this returned function
*
* @public
*/
export declare function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
/**
* Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery. By
* default, message delivery metrics are not exported to BigQuery. Use this method to enable or
* disable the export at runtime.
*
* @param messaging - The `FirebaseMessaging` instance.
* @param enable - Whether Firebase Cloud Messaging should export message delivery metrics to
* BigQuery.
*
* @public
*/
export declare function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
export declare function deleteToken(messaging: MessagingService): Promise<boolean>;

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
import { GetTokenOptions } from '../interfaces/public-types';
export declare function getToken(messaging: MessagingService, options?: GetTokenOptions): Promise<string>;

View file

@ -0,0 +1,30 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Checks if all required APIs exist in the browser.
* @returns a Promise that resolves to a boolean.
*
* @public
*/
export declare function isWindowSupported(): Promise<boolean>;
/**
* Checks whether all required APIs exist within SW Context
* @returns a Promise that resolves to a boolean.
*
* @public
*/
export declare function isSwSupported(): Promise<boolean>;

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagePayload, NextFn, Observer, Unsubscribe } from '../interfaces/public-types';
import { MessagingService } from '../messaging-service';
export declare function onBackgroundMessage(messaging: MessagingService, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagePayload, NextFn, Observer, Unsubscribe } from '../interfaces/public-types';
import { MessagingService } from '../messaging-service';
export declare function onMessage(messaging: MessagingService, nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Messaging } from '../interfaces/public-types';
export declare function _setDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function arrayToBase64(array: Uint8Array | ArrayBuffer): string;
export declare function base64ToArray(base64String: string): Uint8Array;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagePayload } from '../interfaces/public-types';
import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
export declare function externalizePayload(internalPayload: MessagePayloadInternal): MessagePayload;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { AppConfig } from '../interfaces/app-config';
export declare function extractAppConfig(app: FirebaseApp): AppConfig;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ConsoleMessageData } from '../interfaces/internal-message-payload';
export declare function isConsoleMessage(data: unknown): data is ConsoleMessageData;

View file

@ -0,0 +1,30 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LogEvent, LogRequest } from '../interfaces/logging-types';
import { MessagePayloadInternal } from '../interfaces/internal-message-payload';
import { MessagingService } from '../messaging-service';
export declare function startLoggingService(messaging: MessagingService): void;
/**
*
* @param messaging the messaging instance.
* @param offsetInMs this method execute after `offsetInMs` elapsed .
*/
export declare function _processQueue(messaging: MessagingService, offsetInMs: number): void;
export declare function _dispatchLogEvents(messaging: MessagingService): Promise<void>;
export declare function stageLog(messaging: MessagingService, internalPayload: MessagePayloadInternal): Promise<void>;
export declare function _createLogRequest(logEventQueue: LogEvent[]): LogRequest;
export declare function _mergeStrings(s1: string, s2: string): string;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ConsoleMessageData, MessageType } from '../interfaces/internal-message-payload';
import { MessagingService } from '../messaging-service';
export declare function logToScion(messaging: MessagingService, messageType: MessageType, data: ConsoleMessageData): Promise<void>;

View file

@ -0,0 +1,51 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TokenDetails } from '../interfaces/token-details';
export interface V2TokenDetails {
fcmToken: string;
swScope: string;
vapidKey: string | Uint8Array;
subscription: PushSubscription;
fcmSenderId: string;
fcmPushSet: string;
createTime?: number;
endpoint?: string;
auth?: string;
p256dh?: string;
}
export interface V3TokenDetails {
fcmToken: string;
swScope: string;
vapidKey: Uint8Array;
fcmSenderId: string;
fcmPushSet: string;
endpoint: string;
auth: ArrayBuffer;
p256dh: ArrayBuffer;
createTime: number;
}
export interface V4TokenDetails {
fcmToken: string;
swScope: string;
vapidKey: Uint8Array;
fcmSenderId: string;
endpoint: string;
auth: ArrayBufferLike;
p256dh: ArrayBufferLike;
createTime: number;
}
export declare function migrateOldDatabase(senderId: string): Promise<TokenDetails | null>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,23 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function registerMessagingInWindow(): void;
/**
* The messaging instance registered in sw is named differently than that of in client. This is
* because both `registerMessagingInWindow` and `registerMessagingInSw` would be called in
* `messaging-compat` and component with the same name can only be registered once.
*/
export declare function registerMessagingInSw(): void;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
export declare function registerDefaultSw(messaging: MessagingService): Promise<void>;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** Returns a promise that resolves after given time passes. */
export declare function sleep(ms: number): Promise<void>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
export declare function updateSwReg(messaging: MessagingService, swRegistration?: ServiceWorkerRegistration | undefined): Promise<void>;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
export declare function updateVapidKey(messaging: MessagingService, vapidKey?: string | undefined): Promise<void>;

View file

@ -0,0 +1,32 @@
/**
* The Firebase Cloud Messaging Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '@firebase/installations';
import { Messaging } from './interfaces/public-types';
export { getToken, deleteToken, onMessage, getMessagingInWindow as getMessaging } from './api';
export { isWindowSupported as isSupported } from './api/isSupported';
export * from './interfaces/public-types';
declare module '@firebase/component' {
interface NameServiceMapping {
'messaging': Messaging;
}
}

View file

@ -0,0 +1,26 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '@firebase/installations';
import { Messaging } from './interfaces/public-types';
export * from './interfaces/public-types';
export { onBackgroundMessage, getMessagingInSw as getMessaging, experimentalSetDeliveryMetricsExportedToBigQueryEnabled } from './api';
export { isSwSupported as isSupported } from './api/isSupported';
declare module '@firebase/component' {
interface NameServiceMapping {
'messaging-sw': Messaging;
}
}

View file

@ -0,0 +1,24 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface AppConfig {
readonly appName: string;
readonly projectId: string;
readonly apiKey: string;
readonly appId: string;
/** Only used for old DB migration. */
readonly senderId: string;
}

View file

@ -0,0 +1,27 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppConfig } from './app-config';
import { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
import { FirebaseApp } from '@firebase/app';
import { Provider } from '@firebase/component';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export interface FirebaseInternalDependencies {
app: FirebaseApp;
appConfig: AppConfig;
installations: _FirebaseInstallationsInternal;
analyticsProvider: Provider<FirebaseAnalyticsInternalName>;
}

View file

@ -0,0 +1,46 @@
/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
import { CONSOLE_CAMPAIGN_ANALYTICS_ENABLED, CONSOLE_CAMPAIGN_ID, CONSOLE_CAMPAIGN_NAME, CONSOLE_CAMPAIGN_TIME } from '../util/constants';
export interface MessagePayloadInternal {
notification?: NotificationPayloadInternal;
data?: unknown;
fcmOptions?: FcmOptionsInternal;
messageType?: MessageType;
isFirebaseMessaging?: boolean;
from: string;
fcmMessageId: string;
productId: number;
collapse_key: string;
}
export interface NotificationPayloadInternal extends NotificationOptions {
title: string;
click_action?: string;
icon?: string;
}
export interface FcmOptionsInternal {
link?: string;
analytics_label?: string;
}
export declare enum MessageType {
PUSH_RECEIVED = "push-received",
NOTIFICATION_CLICKED = "notification-clicked"
}
/** Additional data of a message sent from the FN Console. */
export interface ConsoleMessageData {
[CONSOLE_CAMPAIGN_ID]: string;
[CONSOLE_CAMPAIGN_TIME]: string;
[CONSOLE_CAMPAIGN_NAME]?: string;
[CONSOLE_CAMPAIGN_ANALYTICS_ENABLED]?: '1';
}

View file

@ -0,0 +1,60 @@
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
export interface FcmEvent {
project_number: string;
message_id: string;
instance_id: string;
message_type: string;
sdk_platform: string;
package_name: string;
collapse_key: string;
event: string;
analytics_label?: string;
}
/**
* A LogRequest represents a batched collection of loggable events sent to firelog, each event to be
* processed and sent to Sawmill. Defined as in proto/clientanalytics.proto#LogRequest
*/
export interface LogRequest {
log_source: string;
log_event: LogEvent[];
}
export interface LogEvent {
event_time_ms: string;
source_extension_json_proto3: string;
compliance_data: ComplianceData;
}
export interface ComplianceData {
privacy_context: ExternalPrivacyContext;
}
export interface ExternalPrivacyContext {
prequest: ExternalPRequestContext;
}
export interface ExternalPRequestContext {
origin_associated_product_id: number;
}
export interface LogResponse {
nextRequestWaitMillis: number;
logResponseDetails: LogResponseDetails[];
}
interface LogResponseDetails {
responseAction: UserResponse;
}
export declare const enum UserResponse {
RESPONSE_ACTION_UNKNOWN = "RESPONSE_ACTION_UNKNOWN",
RETRY_REQUEST_LATER = "RETRY_REQUEST_LATER",
DELETE_REQUEST = "DELETE_REQUEST"
}
export {};

View file

@ -0,0 +1,144 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
/**
* Display notification details. Details are sent through the
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
*
* @public
*/
export interface NotificationPayload {
/**
* The notification's title.
*/
title?: string;
/**
* The notification's body text.
*/
body?: string;
/**
* The URL of an image that is downloaded on the device and displayed in the notification.
*/
image?: string;
/**
* The URL to use for the notification's icon. If you don't send this key in the request,
* FCM displays the launcher icon specified in your app manifest.
*/
icon?: string;
}
/**
* Options for features provided by the FCM SDK for Web. See {@link
* https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushfcmoptions |
* WebpushFcmOptions}.
*
* @public
*/
export interface FcmOptions {
/**
* The link to open when the user clicks on the notification.
*/
link?: string;
/**
* The label associated with the message's analytics data.
*/
analyticsLabel?: string;
}
/**
* Message payload that contains the notification payload that is represented with
* {@link NotificationPayload} and the data payload that contains an arbitrary
* number of key-value pairs sent by developers through the
* {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API}.
*
* @public
*/
export interface MessagePayload {
/**
* {@inheritdoc NotificationPayload}
*/
notification?: NotificationPayload;
/**
* Arbitrary key/value payload.
*/
data?: {
[key: string]: string;
};
/**
* {@inheritdoc FcmOptions}
*/
fcmOptions?: FcmOptions;
/**
* The sender of this message.
*/
from: string;
/**
* The collapse key of the message. See
* {@link https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages | Non-collapsible and collapsible messages}
*/
collapseKey: string;
/**
* The message ID of a message.
*/
messageId: string;
}
/**
* Options for {@link getToken}.
*
* @public
*/
export interface GetTokenOptions {
/**
* The public server key provided to push services. The key is used to
* authenticate push subscribers to receive push messages only from sending servers that hold
* the corresponding private key. If it is not provided, a default VAPID key is used. Note that some
* push services (Chrome Push Service) require a non-default VAPID key. Therefore, it is recommended
* to generate and import a VAPID key for your project with
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_in_your_app | Configure Web Credentials with FCM}.
* See
* {@link https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol | The Web Push Protocol}
* for details on web push services.
*/
vapidKey?: string;
/**
* The service worker registration for receiving push
* messaging. If the registration is not provided explicitly, you need to have a
* `firebase-messaging-sw.js` at your root location. See
* {@link https://firebase.google.com/docs/cloud-messaging/js/client#access_the_registration_token | Access the registration token}
* for more details.
*/
serviceWorkerRegistration?: ServiceWorkerRegistration;
}
/**
* Public interface of the Firebase Cloud Messaging SDK.
*
* @public
*/
export interface Messaging {
/**
* The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with.
*/
app: FirebaseApp;
}
/**
* @internal
*/
export declare type _FirebaseMessagingName = 'messaging';
export { NextFn, Observer, Unsubscribe } from '@firebase/util';
declare module '@firebase/component' {
interface NameServiceMapping {
'messaging': Messaging;
}
}

View file

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface TokenDetails {
token: string;
createTime: number;
/** Does not exist in Safari since it's not using Push API. */
subscriptionOptions?: SubscriptionOptions;
}
/**
* Additional options and values required by a Push API subscription.
*/
export interface SubscriptionOptions {
vapidKey: string;
swScope: string;
endpoint: string;
auth: string;
p256dh: string;
}

View file

@ -0,0 +1,27 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseInternalDependencies } from '../interfaces/internal-dependencies';
import { TokenDetails } from '../interfaces/token-details';
export declare const DATABASE_NAME = "firebase-messaging-database";
/** Gets record(s) from the objectStore that match the given key. */
export declare function dbGet(firebaseDependencies: FirebaseInternalDependencies): Promise<TokenDetails | undefined>;
/** Assigns or overwrites the record for the given key with the given value. */
export declare function dbSet(firebaseDependencies: FirebaseInternalDependencies, tokenDetails: TokenDetails): Promise<TokenDetails>;
/** Removes record(s) from the objectStore that match the given key. */
export declare function dbRemove(firebaseDependencies: FirebaseInternalDependencies): Promise<void>;
/** Deletes the DB. Useful for tests. */
export declare function dbDelete(): Promise<void>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,35 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SubscriptionOptions, TokenDetails } from '../interfaces/token-details';
import { FirebaseInternalDependencies } from '../interfaces/internal-dependencies';
export interface ApiResponse {
token?: string;
error?: {
message: string;
};
}
export interface ApiRequestBody {
web: {
endpoint: string;
p256dh: string;
auth: string;
applicationPubKey?: string;
};
}
export declare function requestGetToken(firebaseDependencies: FirebaseInternalDependencies, subscriptionOptions: SubscriptionOptions): Promise<string>;
export declare function requestUpdateToken(firebaseDependencies: FirebaseInternalDependencies, tokenDetails: TokenDetails): Promise<string>;
export declare function requestDeleteToken(firebaseDependencies: FirebaseInternalDependencies, token: string): Promise<void>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,23 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
export declare function getTokenInternal(messaging: MessagingService): Promise<string>;
/**
* This method deletes the token from the database, unsubscribes the token from FCM, and unregisters
* the push subscription if it exists.
*/
export declare function deleteTokenInternal(messaging: MessagingService): Promise<boolean>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,21 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NotificationEvent, PushEvent, PushSubscriptionChangeEvent } from '../util/sw-types';
import { MessagingService } from '../messaging-service';
export declare function onSubChange(event: PushSubscriptionChangeEvent, messaging: MessagingService): Promise<void>;
export declare function onPush(event: PushEvent, messaging: MessagingService): Promise<void>;
export declare function onNotificationClick(event: NotificationEvent): Promise<void>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../messaging-service';
export declare function messageEventListener(messaging: MessagingService, event: MessageEvent): Promise<void>;

View file

@ -0,0 +1,36 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp, _FirebaseService } from '@firebase/app';
import { MessagePayload, NextFn, Observer } from './interfaces/public-types';
import { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
import { FirebaseInternalDependencies } from './interfaces/internal-dependencies';
import { LogEvent } from './interfaces/logging-types';
import { Provider } from '@firebase/component';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export declare class MessagingService implements _FirebaseService {
readonly app: FirebaseApp;
readonly firebaseDependencies: FirebaseInternalDependencies;
swRegistration?: ServiceWorkerRegistration;
vapidKey?: string;
deliveryMetricsExportedToBigQueryEnabled: boolean;
onBackgroundMessageHandler: NextFn<MessagePayload> | Observer<MessagePayload> | null;
onMessageHandler: NextFn<MessagePayload> | Observer<MessagePayload> | null;
logEvents: LogEvent[];
isLogServiceStarted: boolean;
constructor(app: FirebaseApp, installations: _FirebaseInstallationsInternal, analyticsProvider: Provider<FirebaseAnalyticsInternalName>);
_delete(): Promise<void>;
}

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import './setup';
declare class HeadersWithEntries extends Headers {
entries?(): Iterable<[string, string]>;
}
export declare function compareHeaders(expectedHeaders: HeadersWithEntries, actualHeaders: HeadersWithEntries): void;
export {};

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import './setup';

View file

@ -0,0 +1,25 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseAnalyticsInternalName } from '@firebase/analytics-interop-types';
import { FirebaseInternalDependencies } from '../../interfaces/internal-dependencies';
import { FirebaseOptions } from '@firebase/app';
import { Provider } from '@firebase/component';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export declare function getFakeFirebaseDependencies(options?: FirebaseOptions): FirebaseInternalDependencies;
export declare function getFakeApp(options?: FirebaseOptions): any;
export declare function getFakeInstallations(): _FirebaseInstallationsInternal;
export declare function getFakeAnalyticsProvider(): Provider<FirebaseAnalyticsInternalName>;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
import { LogEvent, LogResponse } from '../../interfaces/logging-types';
export declare function getFakeLogEvent(): LogEvent;
export declare function getSuccessResponse(): LogResponse;
export declare function getFailedResponse(): LogResponse;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessagingService } from '../../messaging-service';
export declare function getFakeMessagingService(): MessagingService;

View file

@ -0,0 +1,83 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ExtendableEvent } from '../../util/sw-types';
export declare function mockServiceWorker(): void;
export declare function restoreServiceWorker(): void;
export declare class FakeServiceWorkerRegistration implements ServiceWorkerRegistration {
active: null;
installing: null;
waiting: null;
onupdatefound: null;
pushManager: FakePushManager;
scope: string;
navigationPreload: NavigationPreloadManager;
updateViaCache: ServiceWorkerUpdateViaCache;
getNotifications(): Promise<never[]>;
showNotification(): Promise<void>;
update(): Promise<void>;
unregister(): Promise<boolean>;
addEventListener(): void;
removeEventListener(): void;
dispatchEvent(): boolean;
}
declare class FakePushManager implements PushManager {
private subscription;
permissionState(): Promise<"granted">;
getSubscription(): Promise<FakePushSubscription | null>;
subscribe(): Promise<FakePushSubscription>;
}
export declare class FakePushSubscription implements PushSubscription {
endpoint: string;
expirationTime: number;
auth: string;
p256: string;
getKey(name: PushEncryptionKeyName): Uint8Array;
unsubscribe(): Promise<boolean>;
toJSON: () => PushSubscriptionJSON;
options: PushSubscriptionOptions;
}
/**
* Most of the fields in here are unused / deprecated. They are only added here to match the TS
* Event interface.
*/
export declare class FakeEvent implements ExtendableEvent {
type: string;
NONE: number;
AT_TARGET: number;
BUBBLING_PHASE: number;
CAPTURING_PHASE: number;
bubbles: boolean;
cancelable: boolean;
composed: boolean;
timeStamp: number;
isTrusted: boolean;
eventPhase: number;
target: null;
currentTarget: null;
srcElement: null;
cancelBubble: boolean;
defaultPrevented: boolean;
returnValue: boolean;
preventDefault(): void;
stopPropagation(): void;
stopImmediatePropagation(): void;
initEvent(): void;
waitUntil(): void;
composedPath(): never[];
constructor(type: string, options?: EventInit);
}
export {};

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TokenDetails } from '../../interfaces/token-details';
export declare function getFakeTokenDetails(): TokenDetails;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};

View file

@ -0,0 +1,19 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SinonSpy, SinonStub } from 'sinon';
export declare type Stub<T extends (...args: any) => any> = SinonStub<Parameters<T>, ReturnType<T>>;
export declare type Spy<T extends (...args: any) => any> = SinonSpy<Parameters<T>, ReturnType<T>>;

View file

@ -0,0 +1,39 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const DEFAULT_SW_PATH = "/firebase-messaging-sw.js";
export declare const DEFAULT_SW_SCOPE = "/firebase-cloud-messaging-push-scope";
export declare const DEFAULT_VAPID_KEY = "BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";
export declare const ENDPOINT = "https://fcmregistrations.googleapis.com/v1";
/** Key of FCM Payload in Notification's data field. */
export declare const FCM_MSG = "FCM_MSG";
export declare const CONSOLE_CAMPAIGN_ID = "google.c.a.c_id";
export declare const CONSOLE_CAMPAIGN_NAME = "google.c.a.c_l";
export declare const CONSOLE_CAMPAIGN_TIME = "google.c.a.ts";
/** Set to '1' if Analytics is enabled for the campaign */
export declare const CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = "google.c.a.e";
export declare const TAG = "FirebaseMessaging: ";
export declare const MAX_NUMBER_OF_EVENTS_PER_LOG_REQUEST = 1000;
export declare const MAX_RETRIES = 3;
export declare const LOG_INTERVAL_IN_MS = 86400000;
export declare const DEFAULT_BACKOFF_TIME_MS = 5000;
export declare const FCM_LOG_SOURCE = 1249;
export declare const SDK_PLATFORM_WEB = 3;
export declare const EVENT_MESSAGE_DELIVERED = 1;
export declare enum MessageType {
DATA_MESSAGE = 1,
DISPLAY_NOTIFICATION = 3
}

View file

@ -0,0 +1,57 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorFactory, ErrorMap } from '@firebase/util';
export declare const enum ErrorCode {
MISSING_APP_CONFIG_VALUES = "missing-app-config-values",
AVAILABLE_IN_WINDOW = "only-available-in-window",
AVAILABLE_IN_SW = "only-available-in-sw",
PERMISSION_DEFAULT = "permission-default",
PERMISSION_BLOCKED = "permission-blocked",
UNSUPPORTED_BROWSER = "unsupported-browser",
INDEXED_DB_UNSUPPORTED = "indexed-db-unsupported",
FAILED_DEFAULT_REGISTRATION = "failed-service-worker-registration",
TOKEN_SUBSCRIBE_FAILED = "token-subscribe-failed",
TOKEN_SUBSCRIBE_NO_TOKEN = "token-subscribe-no-token",
TOKEN_UNSUBSCRIBE_FAILED = "token-unsubscribe-failed",
TOKEN_UPDATE_FAILED = "token-update-failed",
TOKEN_UPDATE_NO_TOKEN = "token-update-no-token",
INVALID_BG_HANDLER = "invalid-bg-handler",
USE_SW_AFTER_GET_TOKEN = "use-sw-after-get-token",
INVALID_SW_REGISTRATION = "invalid-sw-registration",
USE_VAPID_KEY_AFTER_GET_TOKEN = "use-vapid-key-after-get-token",
INVALID_VAPID_KEY = "invalid-vapid-key"
}
export declare const ERROR_MAP: ErrorMap<ErrorCode>;
interface ErrorParams {
[ErrorCode.MISSING_APP_CONFIG_VALUES]: {
valueName: string;
};
[ErrorCode.FAILED_DEFAULT_REGISTRATION]: {
browserErrorMessage: string;
};
[ErrorCode.TOKEN_SUBSCRIBE_FAILED]: {
errorInfo: string;
};
[ErrorCode.TOKEN_UNSUBSCRIBE_FAILED]: {
errorInfo: string;
};
[ErrorCode.TOKEN_UPDATE_FAILED]: {
errorInfo: string;
};
}
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
export {};

View file

@ -0,0 +1,90 @@
/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Subset of Web Worker types from lib.webworker.d.ts
* https://github.com/Microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts
*
* Since it's not possible to have both "dom" and "webworker" libs in a single project, we have to
* manually declare the web worker types we need.
*/
export interface ServiceWorkerGlobalScope {
readonly location: WorkerLocation;
readonly clients: Clients;
readonly registration: ServiceWorkerRegistration;
addEventListener<K extends keyof ServiceWorkerGlobalScopeEventMap>(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}
export interface ServiceWorkerGlobalScopeEventMap {
notificationclick: NotificationEvent;
push: PushEvent;
pushsubscriptionchange: PushSubscriptionChangeEvent;
}
export interface Client {
readonly id: string;
readonly type: ClientTypes;
readonly url: string;
postMessage(message: any, transfer?: Transferable[]): void;
}
export interface ClientQueryOptions {
includeReserved?: boolean;
includeUncontrolled?: boolean;
type?: ClientTypes;
}
export interface WindowClient extends Client {
readonly focused: boolean;
readonly visibilityState: DocumentVisibilityState;
focus(): Promise<WindowClient>;
navigate(url: string): Promise<WindowClient>;
}
export interface Clients {
claim(): Promise<void>;
get(id: string): Promise<any>;
matchAll(options?: ClientQueryOptions): Promise<Client[]>;
openWindow(url: string): Promise<WindowClient | null>;
}
export interface ExtendableEvent extends Event {
waitUntil(f: Promise<any>): void;
}
export interface NotificationEvent extends ExtendableEvent {
readonly action: string;
readonly notification: Notification;
}
interface PushMessageData {
arrayBuffer(): ArrayBuffer;
blob(): Blob;
json(): any;
text(): string;
}
export interface PushEvent extends ExtendableEvent {
readonly data: PushMessageData | null;
}
export interface PushSubscriptionChangeEvent extends ExtendableEvent {
readonly newSubscription: PushSubscription | null;
readonly oldSubscription: PushSubscription | null;
}
interface WorkerLocation {
readonly hash: string;
readonly host: string;
readonly hostname: string;
readonly href: string;
readonly origin: string;
readonly pathname: string;
readonly port: string;
readonly protocol: string;
readonly search: string;
toString(): string;
}
export {};