mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-06-16 20:01:03 +08:00
refactor!: remove flow types (#3954)
* chore(*): removed flow types * chore(app): rm app-types package
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {}
|
||||
|
||||
declare module '@react-native-firebase/admob' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/admob';
|
||||
* firebase.admob().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import admob from '@react-native-firebase/admob';
|
||||
* admob().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Admob
|
||||
*/
|
||||
admob: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Admob
|
||||
*/
|
||||
admob(): Module;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +0,0 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.7.2](https://github.com/invertase/react-native-firebase/compare/@react-native-firebase/app-types@6.7.1...@react-native-firebase/app-types@6.7.2) (2020-05-13)
|
||||
|
||||
**Note:** Version bump only for package @react-native-firebase/app-types
|
||||
|
||||
## [6.7.1](https://github.com/invertase/react-native-firebase/compare/@react-native-firebase/app-types@6.7.1...@react-native-firebase/app-types@6.7.1) (2020-05-13)
|
||||
|
||||
### Features
|
||||
|
||||
- **messaging:** ios & android messaging updates & fixes ([#3339](https://github.com/invertase/react-native-firebase/issues/3339)) ([d66a611](https://github.com/invertase/react-native-firebase/commit/d66a6118f82005087f53b86571990fc071402153))
|
||||
- independently version packages ([#3513](https://github.com/invertase/react-native-firebase/issues/3513)) ([e2c2d64](https://github.com/invertase/react-native-firebase/commit/e2c2d64d2266cbdd14d4dcfefa64a08263f0af85))
|
||||
|
||||
# 6.3.0 (2020-02-04)
|
||||
|
||||
# 6.2.0 (2019-12-08)
|
||||
|
||||
# 6.1.0 (2019-11-26)
|
||||
|
||||
## 6.0.4 (2019-11-17)
|
||||
|
||||
## 6.0.3 (2019-10-25)
|
||||
|
||||
## 6.0.2 (2019-10-18)
|
||||
|
||||
## 6.0.1 (2019-10-07)
|
||||
|
||||
# 0.1.0 (2019-07-30)
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type ReactNativeFirebaseModuleAndStatics<M, S = {}> = {
|
||||
(): M,
|
||||
+SDK_VERSION: string,
|
||||
} & S;
|
||||
|
||||
export type ReactNativeFirebaseModuleAndStaticsWithApp<M, S = {}> = {
|
||||
(): M,
|
||||
+SDK_VERSION: string,
|
||||
} & S;
|
||||
|
||||
export type FirebaseOptions = {
|
||||
appId: string,
|
||||
apiKey?: string,
|
||||
authDomain?: string,
|
||||
databaseURL: string,
|
||||
projectId: string,
|
||||
gaTrackingId?: string,
|
||||
storageBucket: string,
|
||||
messagingSenderId: string,
|
||||
|
||||
/**
|
||||
* iOS only
|
||||
*/
|
||||
clientId?: string,
|
||||
|
||||
/**
|
||||
* iOS only
|
||||
*/
|
||||
androidClientId?: string,
|
||||
|
||||
/**
|
||||
* iOS only
|
||||
*/
|
||||
deepLinkURLScheme?: string,
|
||||
[name: string]: any,
|
||||
};
|
||||
|
||||
export interface FirebaseAppConfig {
|
||||
name?: string;
|
||||
automaticDataCollectionEnabled?: boolean;
|
||||
}
|
||||
|
||||
export interface FirebaseApp {
|
||||
+name: string;
|
||||
+options: FirebaseOptions;
|
||||
delete(): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ReactNativeFirebaseNamespace {
|
||||
initializeApp(options: FirebaseOptions, config?: FirebaseAppConfig): FirebaseApp;
|
||||
initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
|
||||
|
||||
app: {
|
||||
(name?: string): FirebaseApp,
|
||||
};
|
||||
|
||||
apps: FirebaseApp[];
|
||||
|
||||
+SDK_VERSION: string;
|
||||
}
|
||||
|
||||
export interface ReactNativeFirebaseModule {
|
||||
app: FirebaseApp;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "@react-native-firebase/app-types",
|
||||
"version": "6.7.2",
|
||||
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
||||
"description": "@react-native-firebase/app-types",
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js.flow",
|
||||
"private.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/invertase/react-native-firebase/tree/master/packages/app-types"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": ["dist/**/*"]
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @firebase firebase
|
||||
*/
|
||||
declare module 'react-native-firebase' {
|
||||
import type { ReactNativeFirebaseNamespace } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare export default {} & ReactNativeFirebaseNamespace;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
declare interface ReactNativeFirebaseNamespace {}
|
||||
|
||||
declare interface FirebaseApp {}
|
||||
}
|
||||
@@ -54,7 +54,6 @@
|
||||
"react-native": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-firebase/app-types": "6.7.2",
|
||||
"opencollective-postinstall": "^2.0.1",
|
||||
"superstruct": "^0.6.2"
|
||||
},
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// TODO ehesp
|
||||
import type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {}
|
||||
|
||||
declare module '@react-native-firebase/auth' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/auth';
|
||||
* firebase.auth().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import auth from '@react-native-firebase/auth';
|
||||
* auth().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Auth
|
||||
*/
|
||||
auth: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Auth
|
||||
*/
|
||||
auth(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Whether Crashlytics reporting is enabled.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const isEnabled = firebase.crashlytics().isCrashlyticsCollectionEnabled;
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
isCrashlyticsCollectionEnabled: true;
|
||||
|
||||
/**
|
||||
* Cause your app to crash for testing purposes.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.crashlytics().crash();
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
crash(): void;
|
||||
|
||||
/**
|
||||
* Log a message that will appear in any subsequent Crash or Non-fatal error reports.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.crashlytics().logEvent('Testing a crash');
|
||||
* firebase.crashlytics().crash();
|
||||
* ```
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
log(message: string): void;
|
||||
|
||||
/**
|
||||
* Record a JavaScript Error.
|
||||
*
|
||||
* The JavaScript stack trace is converted into a mock native iOS or Android exception before submission.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.crashlytics().recordError(
|
||||
* new Error('An error was caught')
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param error Expects an instance of Error; e.g. classes that extend Error will also be supported.
|
||||
*/
|
||||
recordError(error: Error): void;
|
||||
|
||||
/**
|
||||
* Specify a user identifier which will be visible in the Firebase Crashlytics console.
|
||||
*
|
||||
* It is recommended for privacy purposes that this value be a value that's meaningless to a third-party
|
||||
* observer; such as an arbitrary string that ties an end-user to a record in your system e.g. a database record id.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Custom user id
|
||||
* await firebase.crashlytics().setUserId('123456789');
|
||||
* // Firebase auth uid
|
||||
* await firebase.crashlytics().setUserId(
|
||||
* firebase.auth().currentUser.uid
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param userId An arbitrary string that ties an end-user to a record in your system e.g. a database record id.
|
||||
*/
|
||||
setUserId(userId: string): Promise<null>;
|
||||
|
||||
/**
|
||||
* Sets a string value to be associated with the given attribute name which will be visible in the Firebase Crashlytics console.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.crashlytics().setAttribute('role', 'admin');
|
||||
* ```
|
||||
*
|
||||
* @param name The name of the attribute to set.
|
||||
* @param value A string value for the given attribute.
|
||||
*/
|
||||
setAttribute(name: string, value: string): Promise<null>;
|
||||
|
||||
/**
|
||||
* Like `setAttribute` but for multiple attributes.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.crashlytics().setAttributes({
|
||||
* role: 'admin',
|
||||
* followers: '13',
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param attributes An object of key/value attribute name and values.
|
||||
*/
|
||||
setAttributes(attributes: { [key: string]: string }): Promise<null>;
|
||||
|
||||
/**
|
||||
* Enable/disable Crashlytics reporting.
|
||||
*
|
||||
* Use this for opt-in first user data collection flows combined with `firebase.json` settings to disable auto collection.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Disable crash reporting
|
||||
* await firebase.crashlytics().setCrashlyticsCollectionEnabled(false);
|
||||
* ```
|
||||
*
|
||||
* @param enabled A boolean value representing whether to enable Crashlytics error collection.
|
||||
*/
|
||||
setCrashlyticsCollectionEnabled(enabled: boolean): Promise<null>;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/crashlytics' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/crashlytics';
|
||||
* firebase.crashlytics().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import crashlytics from '@react-native-firebase/crashlytics';
|
||||
* crashlytics().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Crashlytics
|
||||
*/
|
||||
crashlytics: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Crashlytics
|
||||
*/
|
||||
crashlytics(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {}
|
||||
|
||||
declare module '@react-native-firebase/database' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/database';
|
||||
* firebase.database().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import database from '@react-native-firebase/database';
|
||||
* database().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Database
|
||||
*/
|
||||
database: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Database
|
||||
*/
|
||||
database(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,633 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
/**
|
||||
* The DynamicLinkAnalyticsParameters interface provides functionality to add Google Analytic
|
||||
* based parameters to a dynamic link.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
* linkParams
|
||||
* .analytics.setCampaign('banner')
|
||||
* .analytics.setContent('Click Me');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkAnalyticsParameters {
|
||||
/**
|
||||
* Sets the campaign name.
|
||||
*
|
||||
* @param campaign The campaign name; The individual campaign name, slogan, promo code, etc. for a product.
|
||||
*/
|
||||
setCampaign(campaign: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the campaign content.
|
||||
*
|
||||
* @param content The campaign content; used for A/B testing and content-targeted ads to differentiate ads or links that point to the same URL.
|
||||
*/
|
||||
setContent(content: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the campaign medium.
|
||||
*
|
||||
* @param medium The campaign medium; used to identify a medium such as email or cost-per-click (cpc).
|
||||
*/
|
||||
setMedium(medium: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the campaign source.
|
||||
*
|
||||
* @param source The campaign source; used to identify a search engine, newsletter, or other source.
|
||||
*/
|
||||
setSource(source: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the campaign term.
|
||||
*
|
||||
* @param term The campaign term; used with paid search to supply the keywords for ads.
|
||||
|
||||
*/
|
||||
setTerm(term: string): DynamicLinkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DynamicLinkAndroidParameters interface provides functionality to configure the behaviour
|
||||
* of dynamic links for Android devices.
|
||||
*
|
||||
* If any parameter is declared then the Android package name must also be set via `setPackageName`
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
* linkParams
|
||||
* .android.setPackageName('io.invertase.testing')
|
||||
* .android.setMinimumVersion('18');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkAndroidParameters {
|
||||
/**
|
||||
* Sets the link to open when the app isn't installed. Specify this to do something other than install your app from
|
||||
* the Play Store when the app isn't installed, such as open the mobile web version of the content, or display a
|
||||
* promotional page for your app.
|
||||
*
|
||||
* @param fallbackUrl The link to open on Android if the app is not installed.
|
||||
*/
|
||||
setFallbackUrl(fallbackUrl: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the version code of the minimum version of your app that can open the link.
|
||||
*
|
||||
* @param minimumVersion The minimum version.
|
||||
*/
|
||||
setMinimumVersion(minimumVersion: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the Android package name.
|
||||
*
|
||||
* @param packageName The package name of the Android app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console.
|
||||
*/
|
||||
setPackageName(packageName: string): DynamicLinkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DynamicLinkIOSParameters interface provides functionality to configure the behaviour
|
||||
* of dynamic links for iOS devices.
|
||||
*
|
||||
* If any parameter is declared then the iOS BundleId must also be set via `setBundleId`
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
* linkParams
|
||||
* .ios.setBundleId('io.invertase.testing')
|
||||
* .ios.setAppStoreId('123456789')
|
||||
* .ios.setMinimumVersion('18');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkIOSParameters {
|
||||
/**
|
||||
* Sets the App Store ID, used to send users to the App Store when the app isn't installed.
|
||||
*
|
||||
* @param appStoreId The App Store ID.
|
||||
*/
|
||||
setAppStoreId(appStoreId: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the iOS bundle ID.
|
||||
*
|
||||
* @param bundleId The bundle ID of the iOS app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console.
|
||||
*/
|
||||
setBundleId(bundleId: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the app's custom URL scheme, if defined to be something other than your app's parameters ID.
|
||||
*
|
||||
* @param customScheme The app's custom URL scheme.
|
||||
*/
|
||||
setCustomScheme(customScheme: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the link to open when the app isn't installed. Specify this to do something other than install your app from
|
||||
* the App Store when the app isn't installed, such as open the mobile web version of the content, or display a
|
||||
* promotional page for your app.
|
||||
*
|
||||
* @param fallbackUrl The link to open on iOS if the app is not installed.
|
||||
*/
|
||||
setFallbackUrl(fallbackUrl: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the bundle ID of the iOS app to use on iPads to open the link. The app must be connected to your project
|
||||
* from the Overview page of the Firebase console.
|
||||
*
|
||||
* @param iPadBundleId The iPad parameters ID of the app.
|
||||
*/
|
||||
setIPadBundleId(iPadBundleId: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the link to open on iPads when the app isn't installed. Specify this to do something other than install your
|
||||
* app from the App Store when the app isn't installed, such as open the web version of the content, or display a
|
||||
* promotional page for your app. Overrides the fallback link set by `setFallbackUrl` on iPad.
|
||||
*
|
||||
* @param iPadFallbackUrl The link to open on iPad if the app is not installed.
|
||||
*/
|
||||
setIPadFallbackUrl(iPadFallbackUrl: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the minimum version of your app that can open the link.
|
||||
*
|
||||
* @param minimumVersion The minimum version.
|
||||
*/
|
||||
setMinimumVersion(minimumVersion: string): DynamicLinkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DynamicLinkITunesParameters interface provides functionality to add iTunes Connect Analytics
|
||||
* based parameters to the created dynamic link.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
* linkParams
|
||||
* .itunes.setAffiliateToken('ABCDEFG');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkITunesParameters {
|
||||
/**
|
||||
* Sets the affiliate token.
|
||||
*
|
||||
* @param affiliateToken The affiliate token used to create affiliate-coded links.
|
||||
*/
|
||||
setAffiliateToken(affiliateToken: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the campaign token.
|
||||
*
|
||||
* @param campaignToken The campaign token that developers can add to any link in order to track sales from a specific marketing campaign.
|
||||
*/
|
||||
setCampaignToken(campaignToken: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the provider token.
|
||||
*
|
||||
* @param providerToken The provider token that enables analytics for Dynamic DynamicLinks from within iTunes Connect.
|
||||
*/
|
||||
setProviderToken(providerToken: string): DynamicLinkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DynamicLinkNavigationParameters interface provides functionality to specify how the navigation
|
||||
* of the created link is handled.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
* linkParams
|
||||
* .navigation.setForcedRedirectEnabled(true);
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkNavigationParameters {
|
||||
/**
|
||||
* Sets whether to enable force redirecting or going to the app preview page. Defaults to false.
|
||||
*
|
||||
* @param forcedRedirectEnabled If true, app preview page will be disabled and there will be a redirect to the FDL. If false, go to the app preview page.
|
||||
*/
|
||||
setForcedRedirectEnabled(forcedRedirectEnabled: boolean): DynamicLinkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DynamicLinkSocialParameters interface provides functionality to add additional social
|
||||
* meta-data to the URL.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
* linkParams
|
||||
* .social.setTitle('Social Application')
|
||||
* .social.setDescriptionText('A Social Application');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkSocialParameters {
|
||||
/**
|
||||
* Sets the meta-tag description.
|
||||
*
|
||||
* @param descriptionText The description to use when the Dynamic Link is shared in a social post.
|
||||
*/
|
||||
setDescriptionText(descriptionText: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the meta-tag image link.
|
||||
*
|
||||
* @param imageUrl The URL to an image related to this link.
|
||||
*/
|
||||
setImageUrl(imageUrl: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Sets the meta-tag title.
|
||||
*
|
||||
* @param title The title to use when the Dynamic Link is shared in a social post.
|
||||
*/
|
||||
setTitle(title: string): DynamicLinkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DynamicLinkParameters interface provides access to the Dynamic Link builder classes
|
||||
* used to configure a created link.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks()
|
||||
* .newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
*
|
||||
* linkParams.analytics.setCampaign('banner');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*/
|
||||
export interface DynamicLinkParameters {
|
||||
/**
|
||||
* Access Google Analytics specific link parameters.
|
||||
*/
|
||||
analytics: DynamicLinkAnalyticsParameters;
|
||||
|
||||
/**
|
||||
* Access Android specific link parameters.
|
||||
*/
|
||||
android: DynamicLinkAndroidParameters;
|
||||
|
||||
/**
|
||||
* Access iOS specific link parameters.
|
||||
*/
|
||||
ios: DynamicLinkIOSParameters;
|
||||
|
||||
/**
|
||||
* Access iTunes Connect specific link parameters.
|
||||
*/
|
||||
itunes: DynamicLinkITunesParameters;
|
||||
|
||||
/**
|
||||
* Access navigation specific link parameters.
|
||||
*/
|
||||
navigation: DynamicLinkNavigationParameters;
|
||||
|
||||
/**
|
||||
* Access social specific link parameters.
|
||||
*/
|
||||
social: DynamicLinkSocialParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* ShortLinkType determines the type of dynamic short link which Firebase creates. Used when building
|
||||
* a new short link via `buildShortLink()`.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks()
|
||||
* .newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
*
|
||||
* linkParams.analytics.setCampaign('banner');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildShortLink(
|
||||
* linkParams,
|
||||
* firebase.dynamicLinks.ShortLinkType.UNGUESSABLE,
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
export interface ShortLinkType {
|
||||
/**
|
||||
* Shorten the path to a string that is only as long as needed to be unique, with a minimum length
|
||||
* of 4 characters. Use this if sensitive information would not be exposed if a short
|
||||
* Dynamic Link URL were guessed.
|
||||
*/
|
||||
SHORT: 'SHORT';
|
||||
|
||||
/**
|
||||
* Shorten the path to an unguessable string. Such strings are created by base62-encoding randomly
|
||||
* generated 96-bit numbers, and consist of 17 alphanumeric characters. Use unguessable strings
|
||||
* to prevent your Dynamic DynamicLinks from being crawled, which can potentially expose sensitive information.
|
||||
*/
|
||||
UNGUESSABLE: 'UNGUESSABLE';
|
||||
|
||||
/**
|
||||
* By default, Firebase returns a standard formatted link.
|
||||
*/
|
||||
DEFAULT: 'DEFAULT';
|
||||
}
|
||||
|
||||
/**
|
||||
* A received Dynamic Link from either `onLink` or `getInitialLink`.
|
||||
*/
|
||||
export interface DynamicLink {
|
||||
/**
|
||||
* The url of the dynamic link.
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* The minimum app version (not system version) requested to process the dynamic link.
|
||||
* This is retrieved from the imv= parameter of the Dynamic Link URL.
|
||||
*
|
||||
* If the app version of the opening app is less than the value of this property,
|
||||
* then the app is expected to open AppStore to allow user to download most recent version.
|
||||
* App can notify or ask the user before opening AppStore.
|
||||
*
|
||||
* Returns `null` if not specified
|
||||
*
|
||||
* #### Android
|
||||
*
|
||||
* On Android this returns a number value representing the apps [versionCode](https://developer.android.com/reference/android/content/pm/PackageInfo.html#versionCode).
|
||||
*
|
||||
* #### iOS
|
||||
*
|
||||
* On iOS this returns a string value representing the minimum app version (not the iOS system version).
|
||||
*/
|
||||
minimumAppVersion: number | string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Firebase Dynamic DynamicLinks Statics
|
||||
*
|
||||
* ```js
|
||||
* firebase.dynamicLinks.X
|
||||
* ```
|
||||
*/
|
||||
export interface Statics {
|
||||
/**
|
||||
* Returns the {@link links.ShortLinkType} interface.
|
||||
*/
|
||||
ShortLinkType: ShortLinkType;
|
||||
// TODO deprecate DynamicLink
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* The Firebase Dynamic DynamicLinks service is available for the default app only.
|
||||
*
|
||||
* #### Example 1
|
||||
*
|
||||
* Get the links instance for the **default app**:
|
||||
*
|
||||
* ```js
|
||||
* const links = firebase.dynamicLinks();
|
||||
* ```
|
||||
*/
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Creates new parameters which enhance the functionality of a created link.
|
||||
*
|
||||
* To create a DynamicLinkParameters, first populate it by using the setX methods available on the `DynamicLinkParameters` builder classes,
|
||||
* then pass it to `firebase.dynamicLinks().buildLink(linkParams)` or `firebase.dynamicLinks().buildShortLink(linkParams, type)`.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks()
|
||||
* .newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
*
|
||||
* linkParams.analytics.setCampaign('banner');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildShortLink(
|
||||
* linkParams,
|
||||
* firebase.dynamicLinks.ShortLinkType.UNGUESSABLE,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param link The link the target app will open. You can specify any URL the app can handle, such as a link to the app’s content, or a URL that initiates some app-specific logic such as crediting the user with a coupon, or displaying a specific welcome screen. This link must be a well-formatted URL, be properly URL-encoded, and use the HTTP or HTTPS scheme.
|
||||
* @param domainURIPrefix Domain URI Prefix of your App. This value must be your assigned domain from the Firebase console. (e.g. https://xyz.page.link) The domain URI prefix must start with a valid HTTPS scheme (https://).
|
||||
*/
|
||||
newDynamicLinkParameters(link: string, domainURIPrefix: string): DynamicLinkParameters;
|
||||
|
||||
/**
|
||||
* Builds a Dynamic Link from the provided DynamicLinkParameters instances.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks()
|
||||
* .newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
*
|
||||
* linkParams.analytics.setCampaign('banner');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildLink(linkParams);
|
||||
* ```
|
||||
*
|
||||
* @param dynamicLinkParams An instance of DynamicLinkParameters created via `newDynamicLinkParameters`
|
||||
*/
|
||||
buildLink(dynamicLinkParams: DynamicLinkParameters): Promise<string>;
|
||||
|
||||
/**
|
||||
* **Deprecated**: Creates a link from the provided DynamicLinkParameters instances.
|
||||
*
|
||||
* @deprecated Use `buildLink` with the same args instead.
|
||||
* @param dynamicLinkParams An instance of DynamicLinkParameters created via `newDynamicLinkParameters`
|
||||
*/
|
||||
createDynamicLink(dynamicLinkParams: DynamicLinkParameters): Promise<string>;
|
||||
|
||||
/**
|
||||
* Builds a short Dynamic Link from the provided DynamicLinkParameters instances.
|
||||
*
|
||||
* ```js
|
||||
* const linkParams = firebase.dynamicLinks()
|
||||
* .newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
||||
*
|
||||
* linkParams.analytics.setCampaign('banner');
|
||||
*
|
||||
* const link = await firebase.dynamicLinks().buildShortLink(
|
||||
* linkParams,
|
||||
* firebase.dynamicLinks.ShortLinkType.UNGUESSABLE,
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param dynamicLinkParams An instance of DynamicLinkParameters created via `newDynamicLinkParameters`
|
||||
* @param shortLinkType The short link type, one of `ShortLinkType` from `firebase.dynamicLinks.ShortLinkType`
|
||||
*/
|
||||
buildShortLink(
|
||||
dynamicLinkParams: DynamicLinkParameters,
|
||||
shortLinkType?: ShortLinkType,
|
||||
): Promise<string>;
|
||||
|
||||
/**
|
||||
* **Deprecated**: Creates a short Dynamic Link from the provided DynamicLinkParameters instances.
|
||||
*
|
||||
* @deprecated Use `buildShortLink` with the same args instead.
|
||||
* @param dynamicLinkParams An instance of DynamicLinkParameters created via `newDynamicLinkParameters`
|
||||
* @param shortLinkType The short link type, one of `ShortLinkType` from `firebase.dynamicLinks.ShortLinkType`
|
||||
*/
|
||||
createShortDynamicLink(
|
||||
dynamicLinkParams: DynamicLinkParameters,
|
||||
shortLinkType?: ShortLinkType,
|
||||
): Promise<string>;
|
||||
|
||||
/**
|
||||
* Returns the URL that the app has been launched from. If the app was not launched from a URL the return value will be null.
|
||||
*
|
||||
* > Use {@link auth#isSignInWithEmailLink} to check if an inbound dynamic link is an email sign-in link.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* async function bootstrapApp() {
|
||||
* await initialLink = await firebase.dynamicLinks().getInitialLink();
|
||||
*
|
||||
* if (initialLink) {
|
||||
* // Handle dynamic link inside your own application
|
||||
* if (initialLink === 'https://invertase.io/offer') return navigateTo('/offers')
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getInitialLink(): Promise<string | null>;
|
||||
|
||||
/**
|
||||
* Subscribe to URL open events while the app is still running.
|
||||
*
|
||||
* The listener is called from URL open events whilst the app is still running, use
|
||||
* {@link links#getInitialLink} for URLs which cause the app to open from a previously closed / not running state.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```jsx
|
||||
* function App() {
|
||||
* const handleDynamicLink = (link) => {
|
||||
* // Handle dynamic link inside your own application
|
||||
* if (link === 'https://invertase.io/offer') return navigateTo('/offers')
|
||||
* };
|
||||
*
|
||||
* useEffect(() => {
|
||||
* const unsubscribe = firebase.dynamicLinks().onLink(handleDynamicLink);
|
||||
* // When the component unmounts, remove the listener
|
||||
* return unsubscribe;
|
||||
* }, []);
|
||||
*
|
||||
* return <YourApp />;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @returns Unsubscribe function, call the returned function to unsubscribe from all future events.
|
||||
* @param listener The listener callback, called URL open events.
|
||||
*/
|
||||
onLink(listener: Function<string>): Function;
|
||||
|
||||
/**
|
||||
* Resolve a given dynamic link (short or long) directly.
|
||||
*
|
||||
* This mimics the result of external link resolution, app open, and the DynamicLink you
|
||||
* would get from {@link dynamic-links#getInitialLink}
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const link = await firebase.dynamicLinks().resolveLink('https://invertase.io');
|
||||
* ```
|
||||
*
|
||||
* Can throw error with message 'Invalid link parameter' if link parameter is null
|
||||
* Can throw error with code 'not-found' if the link does not resolve
|
||||
* Can throw error with code 'resolve-link-error' if there is a processing error
|
||||
*
|
||||
* @returns the resolved Dynamic Link URL
|
||||
* @param link The Dynamic Link URL to resolve, either short or long
|
||||
*/
|
||||
resolveLink(link: string): Promise<string>;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/dynamic-links' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/dynamic-links';
|
||||
* firebase.dynamicLinks().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import links from '@react-native-firebase/dynamic-links';
|
||||
* links().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* DynamicLinks
|
||||
*/
|
||||
links: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* DynamicLinks
|
||||
*/
|
||||
links(): Module;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,316 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
/**
|
||||
* The set of Firebase Functions status codes.
|
||||
*
|
||||
* The codes are the same at the ones exposed by [gRPC](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md).
|
||||
*
|
||||
* Possible values:
|
||||
* - `cancelled`: The operation was cancelled (typically by the caller).
|
||||
* - `unknown`: Unknown error or an error from a different error domain.
|
||||
* - `invalid-argument`: Client specified an invalid argument. Note that this
|
||||
* differs from `failed-precondition`. `invalid-argument` indicates
|
||||
* arguments that are problematic regardless of the state of the system
|
||||
* (e.g. an invalid field name).
|
||||
* - `deadline-exceeded`: Deadline expired before operation could complete.
|
||||
* For operations that change the state of the system, this error may be
|
||||
* returned even if the operation has completed successfully. For example,
|
||||
* a successful response from a server could have been delayed long enough
|
||||
* for the deadline to expire.
|
||||
* - `not-found`: Some requested document was not found.
|
||||
* - `already-exists`: Some document that we attempted to create already
|
||||
* exists.
|
||||
* - `permission-denied`: The caller does not have permission to execute the
|
||||
* specified operation.
|
||||
* - `resource-exhausted`: Some resource has been exhausted, perhaps a
|
||||
* per-user quota, or perhaps the entire file system is out of space.
|
||||
* - `failed-precondition`: Operation was rejected because the system is not
|
||||
* in a state required for the operation's execution.
|
||||
* - `aborted`: The operation was aborted, typically due to a concurrency
|
||||
* issue like transaction aborts, etc.
|
||||
* - `out-of-range`: Operation was attempted past the valid range.
|
||||
* - `unimplemented`: Operation is not implemented or not supported/enabled.
|
||||
* - `internal`: Internal errors. Means some invariants expected by
|
||||
* underlying system has been broken. If you see one of these errors,
|
||||
* something is very broken.
|
||||
* - `unavailable`: The service is currently unavailable. This is most likely
|
||||
* a transient condition and may be corrected by retrying with a backoff.
|
||||
* - `data-loss`: Unrecoverable data loss or corruption.
|
||||
* - `unauthenticated`: The request does not have valid authentication
|
||||
* credentials for the operation.
|
||||
*/
|
||||
export type FunctionsErrorCode =
|
||||
| 'ok'
|
||||
| 'cancelled'
|
||||
| 'unknown'
|
||||
| 'invalid-argument'
|
||||
| 'deadline-exceeded'
|
||||
| 'not-found'
|
||||
| 'already-exists'
|
||||
| 'permission-denied'
|
||||
| 'resource-exhausted'
|
||||
| 'failed-precondition'
|
||||
| 'aborted'
|
||||
| 'out-of-range'
|
||||
| 'unimplemented'
|
||||
| 'internal'
|
||||
| 'unavailable'
|
||||
| 'data-loss'
|
||||
| 'unauthenticated';
|
||||
|
||||
/**
|
||||
* An HttpsCallableResult wraps a single result from a function call.
|
||||
*/
|
||||
export interface HttpsCallableResult {
|
||||
data: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* An HttpsCallable is a reference to a "callable" http trigger in
|
||||
* Google Cloud Functions.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Create a HttpsCallable instance
|
||||
* const instance = functions().httpsCallable('order');
|
||||
*
|
||||
* try {
|
||||
* const response = await instance({
|
||||
* id: '12345',
|
||||
* });
|
||||
* } catch (e) {
|
||||
* console.error(e);
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export interface HttpsCallable {
|
||||
(data?: any): Promise<HttpsCallableResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An HttpsError wraps a single error from a function call.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* try {
|
||||
* await functions().httpsCallable('order')();
|
||||
* } catch (httpsError) {
|
||||
* console.log('Message', httpsError.message);
|
||||
*
|
||||
* // Check code
|
||||
* if (httpsError.code === firebase.functions.HttpsErrorCode.NOT_FOUND) {
|
||||
* console.error('Functions endpoint "order" not found');
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export interface HttpsError extends Error {
|
||||
/**
|
||||
* A standard error code that will be returned to the client. This also
|
||||
* determines the HTTP status code of the response, as defined in code.proto.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* try {
|
||||
* await functions().httpsCallable('order')();
|
||||
* } catch (httpsError) {
|
||||
* console.error(httpsError.code);
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
code: FunctionsErrorCode;
|
||||
/**
|
||||
* Extra data to be converted to JSON and included in the error response.
|
||||
*
|
||||
* ```js
|
||||
* try {
|
||||
* await functions().httpsCallable('order')();
|
||||
* } catch (httpsError) {
|
||||
* if (httpsError.details) {
|
||||
* console.error(httpsError.details);
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
details?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The HttpsErrorCode interface provides access to all FunctionsErrorCode
|
||||
* type aliases.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* try {
|
||||
* await functions().httpsCallable('order')();
|
||||
* } catch (httpsError) {
|
||||
* switch(httpsError.code) {
|
||||
* case firebase.functions.HttpsErrorCode.NOT_FOUND:
|
||||
* console.error('Functions endpoint not found');
|
||||
* break;
|
||||
* case firebase.functions.HttpsErrorCode.CANCELLED:
|
||||
* console.error('The operation was cancelled');
|
||||
* break;
|
||||
* default:
|
||||
* console.error('An error occurred');
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface HttpsErrorCode {
|
||||
OK: 'ok';
|
||||
CANCELLED: 'cancelled';
|
||||
UNKNOWN: 'unknown';
|
||||
INVALID_ARGUMENT: 'invalid-argument';
|
||||
DEADLINE_EXCEEDED: 'deadline-exceeded';
|
||||
NOT_FOUND: 'not-found';
|
||||
ALREADY_EXISTS: 'already-exists';
|
||||
PERMISSION_DENIED: 'permission-denied';
|
||||
UNAUTHENTICATED: 'unauthenticated';
|
||||
RESOURCE_EXHAUSTED: 'resource-exhausted';
|
||||
FAILED_PRECONDITION: 'failed-precondition';
|
||||
ABORTED: 'aborted';
|
||||
OUT_OF_RANGE: 'out-of-range';
|
||||
UNIMPLEMENTED: 'unimplemented';
|
||||
INTERNAL: 'internal';
|
||||
UNAVAILABLE: 'unavailable';
|
||||
DATA_LOSS: 'data-loss';
|
||||
}
|
||||
|
||||
/**
|
||||
* firebase.functions.X
|
||||
*/
|
||||
export interface Statics {
|
||||
/**
|
||||
* Uppercase + underscored variables of @Functions.FunctionsErrorCode
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.functions.HttpsErrorCode.OK;
|
||||
* ```
|
||||
*/
|
||||
HttpsErrorCode: {} & HttpsErrorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* firebase.functions().X
|
||||
*/
|
||||
interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Gets an `HttpsCallable` instance that refers to the function with the given
|
||||
* name.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const instance = functions().httpsCallable('order');
|
||||
*
|
||||
* try {
|
||||
* const response = await instance({
|
||||
* id: '12345',
|
||||
* });
|
||||
* } catch (e) {
|
||||
* console.error(e);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param name The name of the https callable function.
|
||||
* @return The `HttpsCallable` instance.
|
||||
*/
|
||||
httpsCallable(name: string): HttpsCallable;
|
||||
|
||||
/**
|
||||
* Changes this instance to point to a Cloud Functions emulator running
|
||||
* locally.
|
||||
*
|
||||
* See https://firebase.google.com/docs/functions/local-emulator
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* if (__DEV__) {
|
||||
* functions().useFunctionsEmulator('http://10.0.0.8:1337');
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param origin The origin string of the local emulator started via firebase tools
|
||||
* "http://10.0.0.8:1337".
|
||||
*/
|
||||
useFunctionsEmulator(origin: string): void;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/functions' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStaticsWithApp,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare export var HttpsErrorCode: {} & HttpsErrorCode;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/functions';
|
||||
* firebase.functions().httpsCallable(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
declare var FunctionsDefaultExport: ReactNativeFirebaseModuleAndStaticsWithApp<Module, Statics>;
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import functions from '@react-native-firebase/functions';
|
||||
* functions().httpsCallable(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default FunctionsDefaultExport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* The Cloud Functions for Firebase client SDKs let you call functions
|
||||
* directly from a Firebase app. To call a function from your app in this way,
|
||||
* write and deploy an HTTPS Callable function in Cloud Functions,
|
||||
* and then add client logic to call the function from your app.
|
||||
*/
|
||||
functions: ReactNativeFirebaseModuleAndStaticsWithApp<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* The Cloud Functions for Firebase client SDKs let you call functions
|
||||
* directly from a Firebase app. To call a function from your app in this way,
|
||||
* write and deploy an HTTPS Callable function in Cloud Functions,
|
||||
* and then add client logic to call the function from your app.
|
||||
*/
|
||||
functions(region?: string): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Returns a identifier that uniquely identifies the app instance.
|
||||
*
|
||||
* Once an Instance ID is generated, Firebase periodically sends information about the application
|
||||
* and the device it's running on to the Firebase backend. To stop this, see `delete()`.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const id = firebase.iid().get();
|
||||
* ```
|
||||
*/
|
||||
get(): Promise<string>;
|
||||
|
||||
/**
|
||||
* Delete the Instance ID and all data associated with it. This stops the periodic sending of data to the Firebase
|
||||
* backend that was started when the Instance ID was generated.
|
||||
*
|
||||
* A new Instance ID is asynchronously generated unless auto initialisation is turned off.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.iid().delete();
|
||||
* ```
|
||||
*/
|
||||
delete(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a token that authorizes an Entity to perform an action on behalf of the application.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const token = await firebase.iid().getToken(firebase.app().options.storageBucket, '*');
|
||||
* ```
|
||||
*
|
||||
* @param authorizedEntity Entity authorized by the token. Defaults to the apps `messagingSenderId` option.
|
||||
* @param scope Action authorized for authorizedEntity. Defaults to '*'.
|
||||
*/
|
||||
getToken(authorizedEntity?: string, scope?: string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Revokes access to a scope for an entity previously authorized by `getToken()`.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.iid().deleteToken(firebase.app().options.storageBucket, '*');
|
||||
* ```
|
||||
*
|
||||
* @param authorizedEntity Entity authorized by the token. Defaults to the apps' `messagingSenderId` option.
|
||||
* @param scope Action authorized for authorizedEntity. Defaults to '*'.
|
||||
*/
|
||||
deleteToken(authorizedEntity?: string, scope?: string): Promise<void>;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/iid' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStaticsWithApp,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/iid';
|
||||
* firebase.iid().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import iid from '@react-native-firebase/iid';
|
||||
* iid().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStaticsWithApp<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStaticsWithApp } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Firebase Instance ID provides a unique identifier for each instance of your app and a mechanism to authenticate
|
||||
* and authorize actions for it (for example: sending FCM messages).
|
||||
*
|
||||
* An Instance ID is long lived except when you call delete, the app is restored on a new device, the user
|
||||
* uninstalls/reinstall the app or the user clears the app data (clearing data applies to Android only).
|
||||
*
|
||||
* @firebase iid
|
||||
*/
|
||||
iid: ReactNativeFirebaseModuleAndStaticsWithApp<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Firebase Instance ID provides a unique identifier for each instance of your app and a mechanism to authenticate
|
||||
* and authorize actions for it (for example: sending FCM messages).
|
||||
*
|
||||
* An Instance ID is long lived except when you call delete, the app is restored on a new device, the user
|
||||
* uninstalls/reinstall the app or the user clears the app data (clearing data applies to Android only).
|
||||
*
|
||||
* @firebase iid
|
||||
*/
|
||||
iid(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Determines whether messages are suppressed or not.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const isSuppressed = firebase.inAppMessaging().isMessagesDisplaySuppressed;
|
||||
* ```
|
||||
*/
|
||||
isMessagesDisplaySuppressed: boolean;
|
||||
|
||||
/**
|
||||
* Enable or disable suppression of Firebase In App Messaging messages.
|
||||
*
|
||||
* When enabled, no in app messages will be rendered until either you disable suppression, or the app restarts.
|
||||
* This state is not persisted between app restarts.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Suppress messages
|
||||
* await firebase.inAppMessaging().setMessagesDisplaySuppressed(true);
|
||||
* ```
|
||||
*
|
||||
* @param enabled Whether messages should be suppressed.
|
||||
*/
|
||||
setMessagesDisplaySuppressed(enabled: boolean): Promise<null>;
|
||||
|
||||
/**
|
||||
* Determines whether automatic data collection is enabled or not.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const isDataCollectionEnabled = firebase.inAppMessaging().isAutomaticDataCollectionEnabled;
|
||||
* ```
|
||||
*/
|
||||
isAutomaticDataCollectionEnabled: boolean;
|
||||
|
||||
/**
|
||||
* Enable or disable automatic data collection for Firebase In-App Messaging.
|
||||
*
|
||||
* When enabled, generates a registration token on app startup if there is no valid one and generates a new token
|
||||
* when it is deleted (which prevents deleteInstanceId() from stopping the periodic sending of data).
|
||||
*
|
||||
* This setting is persisted across app restarts and overrides the setting specified in your manifest/plist file.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Disable data collection
|
||||
* firebase.inAppMessaging().setAutomaticDataCollectionEnabled(false);
|
||||
* ```
|
||||
*
|
||||
* @param enabled Whether automatic data collection is enabled.
|
||||
*/
|
||||
setAutomaticDataCollectionEnabled(enabled: boolean): Promise<null>;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/in-app-messaging' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/in-app-messaging';
|
||||
* firebase.inAppMessaging().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import inAppMessaging from '@react-native-firebase/in-app-messaging';
|
||||
* inAppMessaging().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Firebase In-App Messaging helps you engage users who are actively using your app by sending
|
||||
* them targeted and contextual messages that nudge them to complete key in-app actions - like
|
||||
* beating a game level, buying an item, or subscribing to content.
|
||||
*/
|
||||
inAppMessaging: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Firebase In-App Messaging helps you engage users who are actively using your app by sending
|
||||
* them targeted and contextual messages that nudge them to complete key in-app actions - like
|
||||
* beating a game level, buying an item, or subscribing to content.
|
||||
*/
|
||||
inAppMessaging(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {}
|
||||
|
||||
declare module '@react-native-firebase/messaging' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/messaging';
|
||||
* firebase.messaging().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import messaging from '@react-native-firebase/messaging';
|
||||
* messaging().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Messaging
|
||||
*/
|
||||
messaging: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Messaging
|
||||
*/
|
||||
messaging(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
/**
|
||||
* An interface representing the language identification options to be used with the
|
||||
* `identifyLanguage` and `identifyPossibleLanguages` methods.
|
||||
*/
|
||||
export interface LanguageIdentificationOptions {
|
||||
/**
|
||||
* The confidence threshold for language identification. The identified languages will have a
|
||||
* confidence higher or equal to the confidence threshold. The value should be between 0 and 1, e.g. 0.5.
|
||||
*
|
||||
* If no value is set, a default value is used instead.
|
||||
*
|
||||
*/
|
||||
confidenceThreshold?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An identified language for the given input text. Returned as an Array of IdentifiedLanguage from
|
||||
* `identifyPossibleLanguages`.
|
||||
*/
|
||||
export interface IdentifiedLanguage {
|
||||
/**
|
||||
* The [BCP-47 language code](https://en.wikipedia.org/wiki/IETF_language_tag) for the language, e.g. 'en'.
|
||||
*/
|
||||
language: string;
|
||||
|
||||
/**
|
||||
* The confidence score of the language. A float value between 0 and 1.
|
||||
*/
|
||||
confidence: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface representing a suggest reply, an array of these are returned from `suggestReplies`
|
||||
*/
|
||||
export interface SuggestedReply {
|
||||
/**
|
||||
* The smart reply text.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A `TextMessage` interface provided to `suggestReplies()`.
|
||||
*/
|
||||
export interface TextMessage {
|
||||
/**
|
||||
* The message text.
|
||||
*
|
||||
* This is required and must not be an empty string.
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* Whether the message is a local user. If false, a `userId` must be provided for the message.
|
||||
*
|
||||
* Defaults to true.
|
||||
*/
|
||||
isLocalUser?: boolean;
|
||||
|
||||
/**
|
||||
* A user ID of a remote user.
|
||||
*
|
||||
* Used to help better identify users to provide more accurate replies.
|
||||
*/
|
||||
userId?: string;
|
||||
|
||||
/**
|
||||
* The timestamp of the message in milliseconds.
|
||||
*
|
||||
* Defaults to now (`Date.now()`).
|
||||
*/
|
||||
timestamp?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Firebase ML Kit service interface.
|
||||
*
|
||||
* > This module is available for the default app only.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* Get the ML Kit service for the default app:
|
||||
*
|
||||
* ```js
|
||||
* const defaultAppMLKit = firebase.naturalLanguage();
|
||||
* ```
|
||||
*/
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Identifies the main language for the given text.
|
||||
*
|
||||
* Returns a promise that resolves with a [BCP-47 language code](https://en.wikipedia.org/wiki/IETF_language_tag) of the detected language.
|
||||
*
|
||||
* If the language was undetected or unknown the code returned is `und`.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const language = await firebase.naturalLanguage().identifyLanguage('Hello there. General Kenobi.');
|
||||
* console.warn(language); // en
|
||||
*
|
||||
* const unknownLanguage = await firebase.naturalLanguage().identifyLanguage('foo bar baz', { confidenceThreshold: 0.9 });
|
||||
* console.warn(language); // und
|
||||
* ```
|
||||
*
|
||||
* @param text The input text to use for identifying the language. Inputs longer than 200 characters are truncated to 200 characters, as longer input does not improve the detection accuracy.
|
||||
* @param options See `LanguageIdentificationOptions`.
|
||||
*/
|
||||
identifyLanguage(text: string, options?: LanguageIdentificationOptions): Promise<string>;
|
||||
|
||||
/**
|
||||
* Identifies possible languages for the given text.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const identifiedLanguages = firebase.naturalLanguage().identifyPossibleLanguages('hello world');
|
||||
* console.warn(identifiedLanguages[0].language); // en
|
||||
* ```
|
||||
*
|
||||
* @param text The input text to use for identifying the language. Inputs longer than 200 characters are truncated to 200 characters, as longer input does not improve the detection accuracy.
|
||||
* @param options See `LanguageIdentificationOptions`.
|
||||
*/
|
||||
identifyPossibleLanguages(
|
||||
text: string,
|
||||
options?: LanguageIdentificationOptions,
|
||||
): Promise<IdentifiedLanguage[]>;
|
||||
|
||||
/**
|
||||
* Returns suggested replies for a conversation.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const replies = await firebase.naturalLanguage().suggestReplies([
|
||||
* { text: "Hey, long time no speak!", },
|
||||
* { text: 'I know right, it has been a while..', userId: 'xxxx', isLocalUser: false },
|
||||
* { text: 'We should catch up sometime' },
|
||||
* { text: 'Definitely, how about we go for lunch this week?', userId: 'xxxx', isLocalUser: false },
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
* @param messages An array of `TextMessage` interfaces.
|
||||
*/
|
||||
suggestReplies(messages: TextMessage[]): Promise<SuggestedReply[]>;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/ml-natural-language' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/ml-natural-language';
|
||||
* firebase.naturalLanguage().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import naturalLanguage from '@react-native-firebase/ml-natural-language';
|
||||
* naturalLanguage().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* ML Kit Natural Language
|
||||
*/
|
||||
naturalLanguage: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* ML Kit Natural Language
|
||||
*/
|
||||
naturalLanguage(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {}
|
||||
|
||||
declare module '@react-native-firebase/mlkit' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/mlkit';
|
||||
* firebase.mlkit().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import mlkit from '@react-native-firebase/mlkit';
|
||||
* mlkit().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Mlkit
|
||||
*/
|
||||
mlkit: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Mlkit
|
||||
*/
|
||||
mlkit(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,432 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
/**
|
||||
* Type alias describing the valid HTTP methods accepted when creating a new {@link perf.HttpMetric} instance.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const metric = firebase.perf().newHttpMetric('https://api.com/user', 'PATCH');
|
||||
* ```
|
||||
*/
|
||||
export type HttpMethod =
|
||||
| 'GET'
|
||||
| 'HEAD'
|
||||
| 'PUT'
|
||||
| 'POST'
|
||||
| 'PATCH'
|
||||
| 'TRACE'
|
||||
| 'DELETE'
|
||||
| 'CONNECT'
|
||||
| 'OPTIONS';
|
||||
|
||||
/**
|
||||
* Trace allows you to time the beginning to end of a certain action in your app with additional metric values and attributes.
|
||||
*/
|
||||
export interface Trace {
|
||||
/**
|
||||
* Returns the value of an attribute. Returns null if it does not exist.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const attribute = trace.getAttribute('userId');
|
||||
* ```
|
||||
*
|
||||
* @param attribute Name of the attribute to fetch the value of.
|
||||
*/
|
||||
getAttribute(attribute: string): string | null;
|
||||
|
||||
/**
|
||||
* Sets a String value for the specified attribute. Updates the value of the attribute if it already exists.
|
||||
* The maximum number of attributes that can be added is 5.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* trace.putAttribute('userId', '123456789');
|
||||
* ```
|
||||
*
|
||||
* @param attribute Name of the attribute. Max length is 40 chars.
|
||||
* @param value Value of the attribute. Max length is 100 chars.
|
||||
*/
|
||||
putAttribute(attribute: string, value: string): void;
|
||||
|
||||
/**
|
||||
* Gets the value of the metric with the given name in the current trace. If the metric
|
||||
* doesn't exist, it will not be created and a 0 is returned.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const metric = trace.getMetric('hits');
|
||||
* ```
|
||||
*
|
||||
* @param metricName Name of the metric to get.
|
||||
*/
|
||||
getMetric(metricName: string): number;
|
||||
|
||||
/**
|
||||
* Returns an object of all the currently added metrics and their number values.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const metrics = trace.getMetrics();
|
||||
*
|
||||
* metrics.forEach(($) => {
|
||||
* console.log($);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
getMetrics(): { [key: string]: number };
|
||||
|
||||
/**
|
||||
* Sets the value of the named metric with the provided number.
|
||||
*
|
||||
* If a metric with the given name exists it will be overwritten.
|
||||
* If a metric with the given name doesn't exist, a new one will be created.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* trace.putMetric('hits', 1);
|
||||
* ```
|
||||
*
|
||||
* @param metricName Name of the metric to set. Must not have a leading or trailing whitespace, no leading underscore '_' character and have a max length of 32 characters.
|
||||
* @param value The value the metric should be set to.
|
||||
*/
|
||||
putMetric(metricName: string, value: number): void;
|
||||
|
||||
/**
|
||||
* Increments the named metric by the `incrementBy` value.
|
||||
*
|
||||
* If a metric with the given name doesn't exist, a new one will be created starting with the value of `incrementBy`.
|
||||
*
|
||||
* ```js
|
||||
* trace.incrementMetric('hits', 1);
|
||||
* ```
|
||||
*
|
||||
* @param metricName Name of the metric to increment. Must not have a leading or trailing whitespace, no leading underscore '_' character and have a max length of 32 characters.
|
||||
* @param incrementBy The value the metric should be incremented by.
|
||||
*/
|
||||
incrementMetric(metricName: string, incrementBy: number): void;
|
||||
|
||||
/**
|
||||
* Removes a metric by name if it exists.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* trace.removeMetric('hits');
|
||||
* ```
|
||||
*
|
||||
* @param metricName Name of the metric to remove.
|
||||
*/
|
||||
removeMetric(metricName: string): void;
|
||||
|
||||
/**
|
||||
* Marks the start time of the trace. Does nothing if already started.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const trace = firebase.perf().newTrace('example');
|
||||
* await trace.start();
|
||||
* ```
|
||||
*/
|
||||
start(): Promise<null>;
|
||||
|
||||
/**
|
||||
* Marks the end time of the trace and queues the metric on the device for transmission. Does nothing if already stopped.
|
||||
*
|
||||
* * #### Example
|
||||
*
|
||||
* ```js
|
||||
* const trace = firebase.perf().newTrace('example');
|
||||
* await trace.start();
|
||||
* trace.putMetric('hits', 1);
|
||||
* await trace.stop();
|
||||
* ```
|
||||
*/
|
||||
stop(): Promise<null>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metric used to collect data for network requests/responses. A new instance must be used for every request/response.
|
||||
*/
|
||||
export interface HttpMetric {
|
||||
/**
|
||||
* Returns the value of an attribute. Returns null if it does not exist.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const attribute = metric.getAttribute('user_role');
|
||||
* ```
|
||||
*
|
||||
* @param attribute Name of the attribute to fetch the value of
|
||||
*/
|
||||
getAttribute(attribute: string): string | null;
|
||||
|
||||
/**
|
||||
* Returns an object of all the currently added attributes.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const attributes = metric.getAttributes();
|
||||
*
|
||||
* attributes.forEach(($) => {
|
||||
* console.log($);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
getAttributes(): { [key: string]: string };
|
||||
|
||||
/**
|
||||
* Sets a String value for the specified attribute. Updates the value of the attribute if it already exists.
|
||||
* The maximum number of attributes that can be added is 5.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* metric.putAttribute('user_role', 'admin');
|
||||
* ```
|
||||
*
|
||||
* @param attribute Name of the attribute. Max length is 40 chars.
|
||||
* @param value Value of the attribute. Max length is 100 chars.
|
||||
*/
|
||||
putAttribute(attribute: string, value: string): void;
|
||||
|
||||
/**
|
||||
* Removes an already added attribute. Does nothing if attribute does not exist.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* metric.removeAttribute('user_role');
|
||||
* ```
|
||||
*
|
||||
* @param attribute Name of the attribute to be removed.
|
||||
*/
|
||||
removeAttribute(attribute: string): void;
|
||||
|
||||
/**
|
||||
* Sets the httpResponse code of the request.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const response = await fetch(url);
|
||||
* metric.setHttpResponseCode(response.status);
|
||||
* ```
|
||||
* > This is required for every request, if you do not provide this your metric will not be captured.
|
||||
*
|
||||
* @param code Value must be greater than 0. Set to null to remove. Invalid usage will be logged natively.
|
||||
*/
|
||||
setHttpResponseCode(code: number | null): void;
|
||||
|
||||
/**
|
||||
* Sets the size of the request payload.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const response = await fetch(url);
|
||||
* metric.setRequestPayloadSize(response.headers.get('Content-Type'));
|
||||
* ```
|
||||
*
|
||||
* @param bytes Value must be greater than 0. Set to null to remove. Invalid usage will be logged natively.
|
||||
*/
|
||||
setRequestPayloadSize(bytes: number | null): void;
|
||||
|
||||
/**
|
||||
* Sets the size of the response payload.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const response = await fetch(url);
|
||||
* metric.setResponsePayloadSize(response.headers.get('Content-Length'));
|
||||
* ```
|
||||
*
|
||||
* @param bytes Value must be greater than 0. Set to null to remove. Invalid usage will be logged natively.
|
||||
*/
|
||||
setResponsePayloadSize(bytes: number | null): void;
|
||||
|
||||
/**
|
||||
* Content type of the response e.g. `text/html` or `application/json`.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const response = await fetch(url);
|
||||
* metric.setResponsePayloadSize(response.headers.get('Content-Type'));
|
||||
* ```
|
||||
*
|
||||
* @param contentType Valid string of MIME type. Set to null to remove. Invalid usage will be logged natively.
|
||||
*/
|
||||
setResponseContentType(contentType: string | null): void;
|
||||
|
||||
/**
|
||||
* Marks the start time of the request. Does nothing if already started.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const metric = firebase.perf().newHttpMetric('https://api.com/login', 'POST');
|
||||
* await metric.start();
|
||||
* ```
|
||||
*/
|
||||
start(): Promise<null>;
|
||||
|
||||
/**
|
||||
* Marks the end time of the response and queues the network request metric on the device for transmission. Does nothing if already stopped.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const metric = firebase.perf().newHttpMetric('https://api.com/login', 'POST');
|
||||
* await metric.start();
|
||||
* metric.putAttribute('user_role', 'admin');
|
||||
* await metric.stop();
|
||||
* ```
|
||||
*/
|
||||
stop(): Promise<null>;
|
||||
}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* Determines whether performance monitoring is enabled or disabled.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const isEnabled = firebase.perf().isPerformanceCollectionEnabled;
|
||||
* console.log('Performance collection enabled: ', isEnabled);
|
||||
* ```
|
||||
*/
|
||||
isPerformanceCollectionEnabled: boolean;
|
||||
|
||||
/**
|
||||
* Enables or disables performance monitoring.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Disable performance monitoring collection
|
||||
* await firebase.perf().setPerformanceCollectionEnabled(false);
|
||||
* ```
|
||||
*
|
||||
* @param enabled Should performance monitoring be enabled
|
||||
*/
|
||||
setPerformanceCollectionEnabled(enabled: boolean): Promise<null>;
|
||||
|
||||
/**
|
||||
* Creates a Trace instance with the given identifier.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const trace = firebase.perf().newTrace('user_profile');
|
||||
* await trace.start();
|
||||
* ```
|
||||
*
|
||||
* @param identifier Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
|
||||
*/
|
||||
newTrace(identifier: string): Trace;
|
||||
|
||||
/**
|
||||
* Creates a Trace instance with the given identifier and immediately starts it.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const trace = await firebase.perf().startTrace('user_profile');
|
||||
* ```
|
||||
*
|
||||
* @param identifier Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
|
||||
*/
|
||||
startTrace(identifier: string): Promise<Trace>;
|
||||
|
||||
/**
|
||||
* Creates a HttpMetric instance for collecting network performance data for a single request/response
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const metric = firebase.perf().newHttpMetric('https://api.com/user/1', 'GET');
|
||||
* await metric.start();
|
||||
* ```
|
||||
*
|
||||
* @param url A valid url String, cannot be empty
|
||||
* @param httpMethod One of the values GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, TRACE, or CONNECT
|
||||
*/
|
||||
newHttpMetric(url: string, httpMethod: HttpMethod): HttpMetric;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/perf' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/perf';
|
||||
* firebase.perf().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import perf from '@react-native-firebase/perf';
|
||||
* perf().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* Perf
|
||||
*/
|
||||
perf: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* Perf
|
||||
*/
|
||||
perf(): Module;
|
||||
}
|
||||
}
|
||||
@@ -1,434 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
/**
|
||||
* A pseudo-enum for usage with ConfigSettingsRead.lastFetchStatus to determine the last fetch status.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.LastFetchStatus;
|
||||
* ```
|
||||
*/
|
||||
export interface LastFetchStatus {
|
||||
/**
|
||||
* A value indicating that the last fetch was successful.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.LastFetchStatus.SUCCESS;
|
||||
* ```
|
||||
*/
|
||||
SUCCESS: 'success';
|
||||
|
||||
/**
|
||||
* A value indicating that the last fetch failed.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.LastFetchStatus.FAILURE;
|
||||
* ```
|
||||
*/
|
||||
FAILURE: 'failure';
|
||||
|
||||
/**
|
||||
* A value indicating that the last fetch was throttled.
|
||||
*
|
||||
* This usually occurs when calling fetch often with a low expiration duration.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.LastFetchStatus.THROTTLED;
|
||||
* ```
|
||||
*/
|
||||
THROTTLED: 'throttled';
|
||||
|
||||
/**
|
||||
* A value indicating that no fetches have occurred yet.
|
||||
*
|
||||
* This usually means you've not called fetch yet.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.LastFetchStatus.NO_FETCH_YET;
|
||||
* ```
|
||||
*/
|
||||
NO_FETCH_YET: 'no_fetch_yet';
|
||||
}
|
||||
|
||||
/**
|
||||
* A pseudo-enum for usage with ConfigValue.source to determine the value source.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.ValueSource;
|
||||
* ```
|
||||
*/
|
||||
export interface ValueSource {
|
||||
/**
|
||||
* If the value was retrieved from the server.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.ValueSource.REMOTE;
|
||||
* ```
|
||||
*/
|
||||
REMOTE: 'remote';
|
||||
/**
|
||||
* If the value was set as a default value.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.ValueSource.DEFAULT;
|
||||
* ```
|
||||
*/
|
||||
DEFAULT: 'default';
|
||||
/**
|
||||
* If no value was found and a static default value was returned instead.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.ValueSource.STATIC;
|
||||
* ```
|
||||
*/
|
||||
STATIC: 'static';
|
||||
}
|
||||
|
||||
/**
|
||||
* Firebase Remote RemoteConfig statics.
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig;
|
||||
* ```
|
||||
*/
|
||||
export interface Statics {
|
||||
/**
|
||||
* A pseudo-enum for usage with ConfigValue.source to determine the value source.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.ValueSource;
|
||||
* ```
|
||||
*/
|
||||
ValueSource: ValueSource;
|
||||
|
||||
/**
|
||||
* A pseudo-enum for usage with `firebase.remoteConfig().lastFetchStatus` to determine the last fetch status.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* firebase.remoteConfig.LastFetchStatus;
|
||||
* ```
|
||||
*/
|
||||
LastFetchStatus: LastFetchStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Interface representing a Remote RemoteConfig value.
|
||||
*/
|
||||
export interface ConfigValue {
|
||||
/**
|
||||
* Where the value was retrieved from.
|
||||
*
|
||||
* - `remote`: If the value was retrieved from the server.
|
||||
* - `default`: If the value was set as a default value.
|
||||
* - `static`: If no value was found and a static default value was returned instead.
|
||||
*
|
||||
* See the `ValueSource` statics definition.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const configValue = firebase.remoteConfig().getValue('beta_enabled');
|
||||
* console.log('Value source: ', configValue.source);
|
||||
* ```
|
||||
*/
|
||||
source: 'remote' | 'default' | 'static';
|
||||
|
||||
/**
|
||||
* The returned value.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const configValue = firebase.remoteConfig().getValue('beta_enabled');
|
||||
* console.log('Value: ', configValue.value);
|
||||
* ```
|
||||
*/
|
||||
value: undefined | number | boolean | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Interface representing multiple RemoteConfig Values.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const values = firebase.remoteConfig().getAll();
|
||||
* ```
|
||||
*/
|
||||
export interface ConfigValues {
|
||||
[key: string]: ConfigValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Interface representing settable config settings.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* The example below makes use of the React Native `__DEV__` global JavaScript variable which
|
||||
* is exposed.
|
||||
*
|
||||
* ```js
|
||||
* await firebase.remoteConfig().setConfigSettings({
|
||||
* isDeveloperModeEnabled: __DEV__,
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export interface ConfigSettings {
|
||||
/**
|
||||
* If enabled, default behaviour such as caching is disabled for a better debugging
|
||||
* experience.
|
||||
*/
|
||||
isDeveloperModeEnabled: boolean;
|
||||
/**
|
||||
* The time that remote config should cache flags for.
|
||||
*/
|
||||
minimumFetchInterval?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Interface representing a RemoteConfig Defaults object.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.remoteConfig().setDefaults({
|
||||
* experiment_enabled: false,
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export interface ConfigDefaults {
|
||||
[key: string]: number | string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Firebase Remote RemoteConfig service interface.
|
||||
*
|
||||
* > This module is available for the default app only.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* Get the Remote RemoteConfig service for the default app:
|
||||
*
|
||||
* ```js
|
||||
* const defaultAppRemoteConfig = firebase.remoteConfig();
|
||||
* ```
|
||||
*/
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
/**
|
||||
* The number of milliseconds since the last Remote RemoteConfig fetch was performed.
|
||||
*/
|
||||
lastFetchTime: number;
|
||||
/**
|
||||
* Whether developer mode is enabled. This is set manually via {@link config#setConfigSettings}
|
||||
*/
|
||||
isDeveloperModeEnabled: boolean;
|
||||
/**
|
||||
* The status of the latest Remote RemoteConfig fetch action.
|
||||
*
|
||||
* See the `LastFetchStatus` statics definition.
|
||||
*/
|
||||
lastFetchStatus: 'success' | 'failure' | 'no_fetch_yet' | 'throttled';
|
||||
|
||||
/**
|
||||
* Moves fetched data to the apps active config.
|
||||
* Resolves with a boolean value of whether the fetched config was moved successfully.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Fetch values
|
||||
* await firebase.remoteConfig().fetch();
|
||||
* const activated = await firebase.remoteConfig().activate();
|
||||
*
|
||||
* if (activated) {
|
||||
* console.log('Fetched values successfully activated.');
|
||||
* } else {
|
||||
* console.log('Fetched values failed to activate.');
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
activate(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Fetches the remote config data from Firebase, as defined in the dashboard. If duration is defined (seconds), data will be locally cached for this duration.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Fetch and cache for 5 minutes
|
||||
* await firebase.remoteConfig().fetch(300);
|
||||
* ```
|
||||
*
|
||||
* @param expirationDurationSeconds Duration in seconds to cache the data for. To skip cache, use a duration of 0.
|
||||
*/
|
||||
fetch(expirationDurationSeconds?: number): Promise<null>;
|
||||
|
||||
/**
|
||||
* Fetches the remote config data from Firebase, as defined in the dashboard. If duration is defined (seconds), data will be locally cached for this duration.
|
||||
*
|
||||
* Once fetching is complete this method immediately calls activate and returns a boolean value of the activation status.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* // Fetch, cache for 5 minutes and activate
|
||||
* const activated = await firebase.remoteConfig().fetchAndActivate(300);
|
||||
*
|
||||
* if (activated) {
|
||||
* console.log('Fetched values successfully activated.');
|
||||
* } else {
|
||||
* console.log('Fetched values failed to activate.');
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param expirationDurationSeconds Duration in seconds to cache the data for. To skip cache use a duration of 0.
|
||||
*/
|
||||
fetchAndActivate(expirationDurationSeconds?: number): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns all available config values.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const values = firebase.remoteConfig().getAll();
|
||||
*
|
||||
* Object.entries(values).forEach(($) => {
|
||||
* const [key, entry] = $;
|
||||
* console.log('Key: ', key);
|
||||
* console.log('Source: ', entry.source);
|
||||
* console.log('Value: ', entry.value);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
getAll(): ConfigValues;
|
||||
|
||||
/**
|
||||
* Gets a ConfigValue by key.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* const configValue = firebase.remoteConfig().getValue('experiment');
|
||||
* console.log('Source: ', configValue.source);
|
||||
* console.log('Value: ', configValue.value);
|
||||
* ```
|
||||
*
|
||||
* @param key A key used to retrieve a specific value.
|
||||
*/
|
||||
getValue(key: string): ConfigValue;
|
||||
|
||||
/**
|
||||
* Set the Remote RemoteConfig settings, specifically the `isDeveloperModeEnabled` flag.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.remoteConfig().setConfigSettings({
|
||||
* isDeveloperModeEnabled: __DEV__,
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param configSettings A ConfigSettingsWrite instance used to set Remote RemoteConfig settings.
|
||||
*/
|
||||
setConfigSettings(configSettings: ConfigSettings): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sets default values for the app to use when accessing values.
|
||||
* Any data fetched and activated will override any default values. Any values in the defaults but not on Firebase will be untouched.
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* ```js
|
||||
* await firebase.remoteConfig().setDefaults({
|
||||
* experiment_enabled: false,
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param defaults A ConfigDefaults instance used to set default values.
|
||||
*/
|
||||
setDefaults(defaults: ConfigDefaults): Promise<null>;
|
||||
|
||||
/**
|
||||
* Sets the default values from a resource file.
|
||||
* On iOS this is a plist file and on Android this is an XML defaultsMap file.
|
||||
*
|
||||
* ```js
|
||||
* // TODO @ehesp
|
||||
* ```
|
||||
*
|
||||
* @param resourceName The plist/xml file name with no extension.
|
||||
*/
|
||||
setDefaultsFromResource(resourceName: string): Promise<null>;
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/remote-config' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/remote-config';
|
||||
* firebase.remoteConfig().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import remoteConfig from '@react-native-firebase/remote-config';
|
||||
* remoteConfig().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* RemoteConfig
|
||||
*/
|
||||
remoteConfig: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* RemoteConfig
|
||||
*/
|
||||
remoteConfig(): Module;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/*
|
||||
* Copyright (c) 2016-present Invertase Limited & Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this library 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 type { ReactNativeFirebaseModule } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
export interface Statics {}
|
||||
|
||||
export interface Module extends ReactNativeFirebaseModule {
|
||||
|
||||
}
|
||||
|
||||
declare module '@react-native-firebase/_template_' {
|
||||
import type {
|
||||
ReactNativeFirebaseNamespace,
|
||||
ReactNativeFirebaseModuleAndStatics,
|
||||
} from '@react-native-firebase/app-types/index.js.flow';
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import { firebase } from '@react-native-firebase/_template_';
|
||||
* firebase._template_().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export var firebase: {} & ReactNativeFirebaseNamespace;
|
||||
|
||||
/**
|
||||
* @example
|
||||
* ```js
|
||||
* import _template_ from '@react-native-firebase/_template_';
|
||||
* _template_().X(...);
|
||||
* ```
|
||||
*/
|
||||
declare export default ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
||||
*/
|
||||
declare module '@react-native-firebase/app-types' {
|
||||
import type { ReactNativeFirebaseModuleAndStatics } from '@react-native-firebase/app-types/index.js.flow';
|
||||
|
||||
declare interface ReactNativeFirebaseNamespace {
|
||||
/**
|
||||
* _Template_
|
||||
*/
|
||||
_template_: ReactNativeFirebaseModuleAndStatics<Module, Statics>;
|
||||
}
|
||||
|
||||
declare interface FirebaseApp {
|
||||
/**
|
||||
* _Template_
|
||||
*/
|
||||
_template_(): Module;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user