@depup/firebase__analytics 0.10.20-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/analytics-public.d.ts +763 -0
  4. package/dist/analytics.d.ts +763 -0
  5. package/dist/esm/index.esm.js +1272 -0
  6. package/dist/esm/index.esm.js.map +1 -0
  7. package/dist/esm/package.json +1 -0
  8. package/dist/esm/src/api.d.ts +453 -0
  9. package/dist/esm/src/constants.d.ts +32 -0
  10. package/dist/esm/src/errors.d.ts +57 -0
  11. package/dist/esm/src/factory.d.ts +74 -0
  12. package/dist/esm/src/functions.d.ts +85 -0
  13. package/dist/esm/src/get-config.d.ts +72 -0
  14. package/dist/esm/src/helpers.d.ts +70 -0
  15. package/dist/esm/src/index.d.ts +14 -0
  16. package/dist/esm/src/initialize-analytics.d.ts +36 -0
  17. package/dist/esm/src/logger.d.ts +18 -0
  18. package/dist/esm/src/public-types.d.ts +282 -0
  19. package/dist/esm/src/types.d.ts +55 -0
  20. package/dist/esm/testing/get-fake-firebase-services.d.ts +29 -0
  21. package/dist/esm/testing/gtag-script-util.d.ts +1 -0
  22. package/dist/esm/testing/integration-tests/integration.d.ts +18 -0
  23. package/dist/esm/testing/setup.d.ts +17 -0
  24. package/dist/index.cjs.js +1287 -0
  25. package/dist/index.cjs.js.map +1 -0
  26. package/dist/src/api.d.ts +453 -0
  27. package/dist/src/constants.d.ts +32 -0
  28. package/dist/src/errors.d.ts +57 -0
  29. package/dist/src/factory.d.ts +74 -0
  30. package/dist/src/functions.d.ts +85 -0
  31. package/dist/src/get-config.d.ts +72 -0
  32. package/dist/src/global_index.d.ts +1056 -0
  33. package/dist/src/helpers.d.ts +70 -0
  34. package/dist/src/index.d.ts +14 -0
  35. package/dist/src/initialize-analytics.d.ts +36 -0
  36. package/dist/src/logger.d.ts +18 -0
  37. package/dist/src/public-types.d.ts +282 -0
  38. package/dist/src/tsdoc-metadata.json +11 -0
  39. package/dist/src/types.d.ts +55 -0
  40. package/dist/testing/get-fake-firebase-services.d.ts +29 -0
  41. package/dist/testing/gtag-script-util.d.ts +1 -0
  42. package/dist/testing/integration-tests/integration.d.ts +18 -0
  43. package/dist/testing/setup.d.ts +17 -0
  44. package/package.json +95 -0
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { AnalyticsCallOptions, CustomParams, EventParams, ConsentSettings } from './public-types';
18
+ import { Gtag } from './types';
19
+ /**
20
+ * Event parameters to set on 'gtag' during initialization.
21
+ */
22
+ export declare let defaultEventParametersForInit: CustomParams | undefined;
23
+ /**
24
+ * Logs an analytics event through the Firebase SDK.
25
+ *
26
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
27
+ * @param eventName Google Analytics event name, choose from standard list or use a custom string.
28
+ * @param eventParams Analytics event parameters.
29
+ */
30
+ export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>;
31
+ /**
32
+ * Set screen_name parameter for this Google Analytics ID.
33
+ *
34
+ * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
35
+ * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
36
+ *
37
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
38
+ * @param screenName Screen name string to set.
39
+ */
40
+ export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>;
41
+ /**
42
+ * Set user_id parameter for this Google Analytics ID.
43
+ *
44
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
45
+ * @param id User ID string to set
46
+ */
47
+ export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>;
48
+ /**
49
+ * Set all other user properties other than user_id and screen_name.
50
+ *
51
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
52
+ * @param properties Map of user properties to set
53
+ */
54
+ export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>;
55
+ /**
56
+ * Retrieves a unique Google Analytics identifier for the web client.
57
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
58
+ *
59
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
60
+ */
61
+ export declare function internalGetGoogleAnalyticsClientId(gtagFunction: Gtag, initializationPromise: Promise<string>): Promise<string>;
62
+ /**
63
+ * Set whether collection is enabled for this ID.
64
+ *
65
+ * @param enabled If true, collection is enabled for this ID.
66
+ */
67
+ export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;
68
+ /**
69
+ * Consent parameters to default to during 'gtag' initialization.
70
+ */
71
+ export declare let defaultConsentSettingsForInit: ConsentSettings | undefined;
72
+ /**
73
+ * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of
74
+ * analytics.
75
+ *
76
+ * @param consentSettings Maps the applicable end user consent state for gtag.js.
77
+ */
78
+ export declare function _setConsentDefaultForInit(consentSettings?: ConsentSettings): void;
79
+ /**
80
+ * Sets the variable `defaultEventParametersForInit` for use in the initialization of
81
+ * analytics.
82
+ *
83
+ * @param customParams Any custom params the user may pass to gtag.js.
84
+ */
85
+ export declare function _setDefaultEventParametersForInit(customParams?: CustomParams): void;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts
19
+ */
20
+ import { FirebaseApp } from '@firebase/app';
21
+ import { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types';
22
+ export interface AppFields {
23
+ appId: string;
24
+ apiKey: string;
25
+ measurementId?: string;
26
+ }
27
+ /**
28
+ * Backoff factor for 503 errors, which we want to be conservative about
29
+ * to avoid overloading servers. Each retry interval will be
30
+ * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one
31
+ * will be ~30 seconds (with fuzzing).
32
+ */
33
+ export declare const LONG_RETRY_FACTOR = 30;
34
+ /**
35
+ * Stubbable retry data storage class.
36
+ */
37
+ declare class RetryData {
38
+ throttleMetadata: {
39
+ [appId: string]: ThrottleMetadata;
40
+ };
41
+ intervalMillis: number;
42
+ constructor(throttleMetadata?: {
43
+ [appId: string]: ThrottleMetadata;
44
+ }, intervalMillis?: number);
45
+ getThrottleMetadata(appId: string): ThrottleMetadata;
46
+ setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void;
47
+ deleteThrottleMetadata(appId: string): void;
48
+ }
49
+ /**
50
+ * Fetches dynamic config from backend.
51
+ * @param app Firebase app to fetch config for.
52
+ */
53
+ export declare function fetchDynamicConfig(appFields: AppFields): Promise<DynamicConfig>;
54
+ /**
55
+ * Fetches dynamic config from backend, retrying if failed.
56
+ * @param app Firebase app to fetch config for.
57
+ */
58
+ export declare function fetchDynamicConfigWithRetry(app: FirebaseApp, retryData?: RetryData, timeoutMillis?: number): Promise<DynamicConfig | MinimalDynamicConfig>;
59
+ /**
60
+ * Shims a minimal AbortSignal (copied from Remote Config).
61
+ *
62
+ * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects
63
+ * of networking, such as retries. Firebase doesn't use AbortController enough to justify a
64
+ * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be
65
+ * swapped out if/when we do.
66
+ */
67
+ export declare class AnalyticsAbortSignal {
68
+ listeners: Array<() => void>;
69
+ addEventListener(listener: () => void): void;
70
+ abort(): void;
71
+ }
72
+ export {};