Skip to content

Commit 9ad43e4

Browse files
committed
Merge branch 'master' into fei-remove-ref-exp
2 parents d33f3b0 + f037995 commit 9ad43e4

File tree

141 files changed

+5134
-344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+5134
-344
lines changed

.changeset/blue-hairs-scream.md

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

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"firebase-compat-interop-test",
1717
"firebase-compat-typings-test",
1818
"@firebase/app-exp",
19+
"@firebase/app-check-exp",
1920
"@firebase/analytics-compat",
2021
"@firebase/analytics-exp",
2122
"@firebase/auth-exp",

.changeset/fuzzy-teachers-guess.md

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

.changeset/rotten-wombats-shop.md

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

.changeset/twenty-scissors-exist.md

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

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
- name: Install Dependencies
2525
run: yarn
2626

27+
- name: Add a changeset for @firebase/app
28+
run: yarn ts-node-script scripts/add_changeset.ts
29+
2730
- name: Create Release Pull Request
2831
uses: changesets/action@master
2932
env:

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ export interface AnalyticsCallOptions {
1616
global: boolean;
1717
}
1818

19+
// @public
20+
export interface AnalyticsOptions {
21+
config?: GtagConfigParams | EventParams;
22+
}
23+
1924
// @public
2025
export interface ControlParams {
2126
// (undocumented)
@@ -45,6 +50,8 @@ export type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to
4550

4651
// @public
4752
export interface EventParams {
53+
// (undocumented)
54+
[key: string]: unknown;
4855
// (undocumented)
4956
affiliation?: string;
5057
// (undocumented)
@@ -110,6 +117,31 @@ export interface EventParams {
110117
// @public
111118
export function getAnalytics(app?: FirebaseApp): Analytics;
112119

120+
// @public
121+
export interface GtagConfigParams {
122+
'allow_google_signals?': boolean;
123+
// (undocumented)
124+
[key: string]: unknown;
125+
'allow_ad_personalization_signals'?: boolean;
126+
'anonymize_ip'?: boolean;
127+
'cookie_domain'?: string;
128+
'cookie_expires'?: number;
129+
'cookie_flags'?: string;
130+
'cookie_prefix'?: string;
131+
'cookie_update'?: boolean;
132+
'custom_map'?: {
133+
[key: string]: unknown;
134+
};
135+
'link_attribution'?: boolean;
136+
'page_location'?: string;
137+
'page_path'?: string;
138+
'page_title'?: string;
139+
'send_page_view'?: boolean;
140+
}
141+
142+
// @public
143+
export function initializeAnalytics(app: FirebaseApp, options?: AnalyticsOptions): Analytics;
144+
113145
// @public
114146
export function isSupported(): Promise<boolean>;
115147

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## API Report File for "@firebase/app-check-exp"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { FirebaseApp } from '@firebase/app-exp';
8+
9+
// @public
10+
export interface AppCheck {
11+
app: FirebaseApp;
12+
}
13+
14+
// @internal (undocumented)
15+
export type _AppCheckComponentName = 'app-check-exp';
16+
17+
// @internal (undocumented)
18+
export type _AppCheckInternalComponentName = 'app-check-internal';
19+
20+
// @public
21+
export interface AppCheckOptions {
22+
isTokenAutoRefreshEnabled?: boolean;
23+
provider: CustomProvider | ReCaptchaV3Provider;
24+
}
25+
26+
// @public
27+
export interface AppCheckToken {
28+
readonly expireTimeMillis: number;
29+
// (undocumented)
30+
readonly token: string;
31+
}
32+
33+
// Warning: (ae-forgotten-export) The symbol "AppCheckProvider" needs to be exported by the entry point index.d.ts
34+
//
35+
// @public
36+
export class CustomProvider implements AppCheckProvider {
37+
constructor(_customProviderOptions: CustomProviderOptions);
38+
// Warning: (ae-forgotten-export) The symbol "AppCheckTokenInternal" needs to be exported by the entry point index.d.ts
39+
//
40+
// @internal (undocumented)
41+
getToken(): Promise<AppCheckTokenInternal>;
42+
// @internal (undocumented)
43+
initialize(app: FirebaseApp): void;
44+
}
45+
46+
// @public
47+
export interface CustomProviderOptions {
48+
getToken: () => Promise<AppCheckToken>;
49+
}
50+
51+
// @public
52+
export function initializeAppCheck(app: FirebaseApp | undefined, options: AppCheckOptions): AppCheck;
53+
54+
// @public
55+
export class ReCaptchaV3Provider implements AppCheckProvider {
56+
constructor(_siteKey: string);
57+
// @internal
58+
getToken(): Promise<AppCheckTokenInternal>;
59+
// @internal (undocumented)
60+
initialize(app: FirebaseApp): void;
61+
}
62+
63+
// @public
64+
export function setTokenAutoRefreshEnabled(app: FirebaseApp, isTokenAutoRefreshEnabled: boolean): void;
65+
66+
67+
// (No @packageDocumentation comment for this package)
68+
69+
```
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"name": "firebase-compat-interop-test",
3-
"private": true,
4-
"version": "0.1.0",
5-
"scripts": {
6-
"test": "karma start --single-run",
7-
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
8-
"test:debug": "karma start --browsers Chrome --auto-watch"
9-
},
10-
"dependencies": {
11-
"@firebase/app-exp": "0.0.900",
12-
"@firebase/app-compat": "0.0.900",
13-
"@firebase/analytics-exp": "0.0.900",
14-
"@firebase/analytics-compat": "0.0.900",
15-
"@firebase/auth-exp": "0.0.900",
16-
"@firebase/auth-compat": "0.0.900",
17-
"@firebase/functions-exp": "0.0.900",
18-
"@firebase/functions-compat": "0.0.900",
19-
"@firebase/messaging-exp": "0.0.900",
20-
"@firebase/messaging-compat": "0.0.900",
21-
"@firebase/performance-exp": "0.0.900",
22-
"@firebase/performance-compat": "0.0.900",
23-
"@firebase/remote-config-exp": "0.0.900",
24-
"@firebase/remote-config-compat": "0.0.900"
25-
},
26-
"devDependencies": {
27-
"typescript": "4.2.2"
28-
}
29-
}
2+
"name": "firebase-compat-interop-test",
3+
"private": true,
4+
"version": "0.1.0",
5+
"scripts": {
6+
"test": "karma start --single-run",
7+
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
8+
"test:debug": "karma start --browsers Chrome --auto-watch"
9+
},
10+
"dependencies": {
11+
"@firebase/app-exp": "0.0.900",
12+
"@firebase/app-compat": "0.0.900",
13+
"@firebase/analytics-exp": "0.0.900",
14+
"@firebase/analytics-compat": "0.0.900",
15+
"@firebase/auth-exp": "0.0.900",
16+
"@firebase/auth-compat": "0.0.900",
17+
"@firebase/functions-exp": "0.0.900",
18+
"@firebase/functions-compat": "0.0.900",
19+
"@firebase/messaging-exp": "0.0.900",
20+
"@firebase/messaging-compat": "0.0.900",
21+
"@firebase/performance-exp": "0.0.900",
22+
"@firebase/performance-compat": "0.0.900",
23+
"@firebase/remote-config-exp": "0.0.900",
24+
"@firebase/remote-config-compat": "0.0.900"
25+
},
26+
"devDependencies": {
27+
"typescript": "4.2.2"
28+
}
29+
}

integration/firebase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
88
},
99
"devDependencies": {
10-
"firebase": "8.6.2",
10+
"firebase": "8.6.8",
1111
"@types/chai": "4.2.14",
1212
"@types/mocha": "7.0.2",
1313
"chai": "4.2.0",

integration/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"test:memory:debug": "yarn build:memory; karma start --auto-watch --browsers Chrome"
1515
},
1616
"devDependencies": {
17-
"@firebase/app": "0.6.22",
18-
"@firebase/firestore": "2.3.1",
17+
"@firebase/app": "0.6.27",
18+
"@firebase/firestore": "2.3.7",
1919
"@types/mocha": "7.0.2",
2020
"gulp": "4.0.2",
2121
"gulp-filter": "6.0.0",

integration/messaging/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"test:manual": "mocha --exit"
1010
},
1111
"devDependencies": {
12-
"firebase": "8.6.2",
12+
"firebase": "8.6.8",
1313
"chai": "4.2.0",
14-
"chromedriver": "89.0.0",
14+
"chromedriver": "91.0.0",
1515
"express": "4.17.1",
1616
"geckodriver": "1.21.1",
1717
"mocha": "7.2.0",

packages-exp/analytics-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"typings": "dist/src/index.d.ts",
4646
"dependencies": {
47-
"@firebase/component": "0.5.0",
47+
"@firebase/component": "0.5.3",
4848
"@firebase/analytics-exp": "0.0.900",
4949
"@firebase/analytics-types": "0.4.0",
5050
"@firebase/util": "1.1.0",

packages-exp/analytics-exp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@firebase/installations-exp": "0.0.900",
3636
"@firebase/logger": "0.2.6",
3737
"@firebase/util": "1.1.0",
38-
"@firebase/component": "0.5.0",
38+
"@firebase/component": "0.5.3",
3939
"tslib": "^2.1.0"
4040
},
4141
"license": "Apache-2.0",

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { _getProvider, FirebaseApp, getApp } from '@firebase/app-exp';
2121
import {
2222
Analytics,
2323
AnalyticsCallOptions,
24+
AnalyticsOptions,
2425
CustomParams,
2526
EventNameString,
2627
EventParams
@@ -47,6 +48,7 @@ import {
4748
setUserProperties as internalSetUserProperties,
4849
setAnalyticsCollectionEnabled as internalSetAnalyticsCollectionEnabled
4950
} from './functions';
51+
import { ERROR_FACTORY, AnalyticsError } from './errors';
5052

5153
export { settings } from './factory';
5254

@@ -70,7 +72,34 @@ export function getAnalytics(app: FirebaseApp = getApp()): Analytics {
7072
app,
7173
ANALYTICS_TYPE
7274
);
73-
const analyticsInstance = analyticsProvider.getImmediate();
75+
76+
if (analyticsProvider.isInitialized()) {
77+
return analyticsProvider.getImmediate();
78+
}
79+
80+
return initializeAnalytics(app);
81+
}
82+
83+
/**
84+
* Returns a Firebase Analytics instance for the given app.
85+
*
86+
* @public
87+
*
88+
* @param app - The FirebaseApp to use.
89+
*/
90+
export function initializeAnalytics(
91+
app: FirebaseApp,
92+
options: AnalyticsOptions = {}
93+
): Analytics {
94+
// Dependencies
95+
const analyticsProvider: Provider<'analytics-exp'> = _getProvider(
96+
app,
97+
ANALYTICS_TYPE
98+
);
99+
if (analyticsProvider.isInitialized()) {
100+
throw ERROR_FACTORY.create(AnalyticsError.ALREADY_INITIALIZED);
101+
}
102+
const analyticsInstance = analyticsProvider.initialize({ options });
74103
return analyticsInstance;
75104
}
76105

packages-exp/analytics-exp/src/errors.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { ErrorFactory, ErrorMap } from '@firebase/util';
2020
export const enum AnalyticsError {
2121
ALREADY_EXISTS = 'already-exists',
2222
ALREADY_INITIALIZED = 'already-initialized',
23+
ALREADY_INITIALIZED_SETTINGS = 'already-initialized-settings',
2324
INTEROP_COMPONENT_REG_FAILED = 'interop-component-reg-failed',
2425
INVALID_ANALYTICS_CONTEXT = 'invalid-analytics-context',
2526
INDEXEDDB_UNAVAILABLE = 'indexeddb-unavailable',
@@ -35,6 +36,10 @@ const ERRORS: ErrorMap<AnalyticsError> = {
3536
' already exists. ' +
3637
'Only one Firebase Analytics instance can be created for each appId.',
3738
[AnalyticsError.ALREADY_INITIALIZED]:
39+
'Firebase Analytics has already been initialized. ' +
40+
'initializeAnalytics() must only be called once. getAnalytics() can be used ' +
41+
'to get a reference to the already-intialized instance.',
42+
[AnalyticsError.ALREADY_INITIALIZED_SETTINGS]:
3843
'Firebase Analytics has already been initialized.' +
3944
'settings() must be called before initializing any Analytics instance' +
4045
'or it will have no effect.',

packages-exp/analytics-exp/src/factory.ts

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

18-
import { SettingsOptions, Analytics } from './public-types';
18+
import { SettingsOptions, Analytics, AnalyticsOptions } from './public-types';
1919
import { Gtag, DynamicConfig, MinimalDynamicConfig } from './types';
2020
import { getOrCreateDataLayer, wrapOrCreateGtag } from './helpers';
2121
import { AnalyticsError, ERROR_FACTORY } from './errors';
@@ -176,7 +176,8 @@ function warnOnBrowserContextMismatch(): void {
176176
*/
177177
export function factory(
178178
app: FirebaseApp,
179-
installations: _FirebaseInstallationsInternal
179+
installations: _FirebaseInstallationsInternal,
180+
options?: AnalyticsOptions
180181
): AnalyticsService {
181182
warnOnBrowserContextMismatch();
182183
const appId = app.options.appId;
@@ -226,7 +227,8 @@ export function factory(
226227
measurementIdToAppId,
227228
installations,
228229
gtagCoreFunction,
229-
dataLayerName
230+
dataLayerName,
231+
options
230232
);
231233

232234
const analyticsInstance: AnalyticsService = new AnalyticsService(app);

0 commit comments

Comments
 (0)