diff options
Diffstat (limited to 'frontend-old/node_modules/@firebase/analytics')
43 files changed, 7860 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/analytics/README.md b/frontend-old/node_modules/@firebase/analytics/README.md new file mode 100644 index 0000000..45dee7e --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/README.md @@ -0,0 +1,5 @@ +# @firebase/analytics + +This is the Firebase Analytics component of the Firebase JS SDK. + +**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.** diff --git a/frontend-old/node_modules/@firebase/analytics/dist/analytics-public.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/analytics-public.d.ts new file mode 100644 index 0000000..77bfff3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/analytics-public.d.ts @@ -0,0 +1,763 @@ +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ + +import { FirebaseApp } from '@firebase/app'; + +/** + * An instance of Firebase Analytics. + * @public + */ +export declare interface Analytics { + /** + * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with. + */ + app: FirebaseApp; +} + +/** + * Additional options that can be passed to Analytics method + * calls such as `logEvent`, etc. + * @public + */ +export declare interface AnalyticsCallOptions { + /** + * If true, this config or event call applies globally to all + * Google Analytics properties on the page. + */ + global: boolean; +} + +/** + * {@link Analytics} instance initialization options. + * @public + */ +export declare interface AnalyticsSettings { + /** + * Params to be passed in the initial `gtag` config call during Firebase + * Analytics initialization. + */ + config?: GtagConfigParams | EventParams; +} + +/** + * Consent status settings for each consent type. + * For more information, see + * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis + * | the GA4 reference documentation for consent state and consent types}. + * @public + */ +export declare interface ConsentSettings { + /** Enables storage, such as cookies, related to advertising */ + ad_storage?: ConsentStatusString; + /** Sets consent for sending user data to Google for advertising purposes. */ + ad_user_data?: ConsentStatusString; + /** Sets consent for personalized advertising. */ + ad_personalization?: ConsentStatusString; + /** Enables storage, such as cookies, related to analytics (for example, visit duration) */ + analytics_storage?: ConsentStatusString; + /** + * Enables storage that supports the functionality of the website or app such as language settings + */ + functionality_storage?: ConsentStatusString; + /** Enables storage related to personalization such as video recommendations */ + personalization_storage?: ConsentStatusString; + /** + * Enables storage related to security such as authentication functionality, fraud prevention, + * and other user protection. + */ + security_storage?: ConsentStatusString; + [key: string]: unknown; +} + +/** + * Whether a particular consent type has been granted or denied. + * @public + */ +export declare type ConsentStatusString = 'granted' | 'denied'; + +/** + * Standard `gtag.js` control parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export declare interface ControlParams { + groups?: string | string[]; + send_to?: string | string[]; + event_callback?: () => void; + event_timeout?: number; +} + +/** + * Standard Google Analytics currency type. + * @public + */ +export declare type Currency = string | number; + +/** + * Any custom event name string not in the standard list of recommended + * event names. + * @public + */ +export declare type CustomEventName<T> = T extends EventNameString ? never : T; + +/** + * Any custom params the user may pass to `gtag`. + * @public + */ +export declare interface CustomParams { + [key: string]: unknown; +} + +/** + * Type for standard Google Analytics event names. `logEvent` also accepts any + * custom string and interprets it as a custom event name. + * @public + */ +export declare type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'checkout_progress' | 'exception' | 'generate_lead' | 'login' | 'page_view' | 'purchase' | 'refund' | 'remove_from_cart' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'set_checkout_option' | 'share' | 'sign_up' | 'timing_complete' | 'view_cart' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_search_results'; + +/** + * Standard `gtag.js` event parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export declare interface EventParams { + checkout_option?: string; + checkout_step?: number; + item_id?: string; + content_type?: string; + coupon?: string; + currency?: string; + description?: string; + fatal?: boolean; + items?: Item[]; + method?: string; + number?: string; + promotions?: Promotion[]; + screen_name?: string; + /** + * Firebase-specific. Use to log a `screen_name` to Firebase Analytics. + */ + firebase_screen?: string; + /** + * Firebase-specific. Use to log a `screen_class` to Firebase Analytics. + */ + firebase_screen_class?: string; + search_term?: string; + shipping?: Currency; + tax?: Currency; + transaction_id?: string; + value?: number; + event_label?: string; + event_category?: string; + shipping_tier?: string; + item_list_id?: string; + item_list_name?: string; + promotion_id?: string; + promotion_name?: string; + payment_type?: string; + affiliation?: string; + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: unknown; +} + +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getAnalytics(app?: FirebaseApp): Analytics; + +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>; + +/** + * A set of common Google Analytics config settings recognized by + * `gtag.js`. + * @public + */ +export declare interface GtagConfigParams { + /** + * Whether or not a page view should be sent. + * If set to true (default), a page view is automatically sent upon initialization + * of analytics. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'send_page_view'?: boolean; + /** + * The title of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_title'?: string; + /** + * The URL of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_location'?: string; + /** + * Defaults to `auto`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_domain'?: string; + /** + * Defaults to 63072000 (two years, in seconds). + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_expires'?: number; + /** + * Defaults to `_ga`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_prefix'?: string; + /** + * If set to true, will update cookies on each page load. + * Defaults to true. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_update'?: boolean; + /** + * Appends additional flags to the cookie when set. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_flags'?: string; + /** + * If set to false, disables all advertising features with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_google_signals'?: boolean; + /** + * If set to false, disables all advertising personalization with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_ad_personalization_signals'?: boolean; + [key: string]: unknown; +} + +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics; + +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +export declare function isSupported(): Promise<boolean>; + +/** + * Standard Google Analytics `Item` type. + * @public + */ +export declare interface Item { + item_id?: string; + item_name?: string; + item_brand?: string; + item_category?: string; + item_category2?: string; + item_category3?: string; + item_category4?: string; + item_category5?: string; + item_variant?: string; + price?: Currency; + quantity?: number; + index?: number; + coupon?: string; + item_list_name?: string; + item_list_id?: string; + discount?: Currency; + affiliation?: string; + creative_name?: string; + creative_slot?: string; + promotion_id?: string; + promotion_name?: string; + location_id?: string; + /** @deprecated Use item_brand instead. */ + brand?: string; + /** @deprecated Use item_category instead. */ + category?: string; + /** @deprecated Use item_id instead. */ + id?: string; + /** @deprecated Use item_name instead. */ + name?: string; +} + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + payment_type?: EventParams['payment_type']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + shipping_tier?: EventParams['shipping_tier']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: { + currency?: EventParams['currency']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions + * | Measure exceptions}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: { + description?: EventParams['description']; + fatal?: EventParams['fatal']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/views + * | Page views}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: { + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + transaction_id: EventParams['transaction_id']; + tax?: EventParams['tax']; + shipping?: EventParams['shipping']; + items?: EventParams['items']; + coupon?: EventParams['coupon']; + affiliation?: EventParams['affiliation']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See {@link https://firebase.google.com/docs/analytics/screenviews + * | Track Screenviews}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: { + firebase_screen: EventParams['firebase_screen']; + firebase_screen_class: EventParams['firebase_screen_class']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: { + search_term?: EventParams['search_term']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: { + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: { + items?: EventParams['items']; + promotion_id?: EventParams['promotion_id']; + promotion_name?: EventParams['promotion_name']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: { + method?: EventParams['method']; + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: { + name: string; + value: number; + event_category?: string; + event_label?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: { + currency?: EventParams['currency']; + items?: EventParams['items']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: { + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Field previously used by some Google Analytics events. + * @deprecated Use `Item` instead. + * @public + */ +export declare interface Promotion { + creative_name?: string; + creative_slot?: string; + id?: string; + name?: string; +} + +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void; + +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +export declare function setConsent(consentSettings: ConsentSettings): void; + +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void; + +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +export declare function setDefaultEventParameters(customParams: CustomParams): void; + +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +export declare function settings(options: SettingsOptions): void; + +/** + * Specifies custom options for your Firebase Analytics instance. + * You must set these before initializing `firebase.analytics()`. + * @public + */ +export declare interface SettingsOptions { + /** Sets custom name for `gtag` function. */ + gtagName?: string; + /** Sets custom name for `dataLayer` array used by `gtag.js`. */ + dataLayerName?: string; +} + +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void; + +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void; + +export { } diff --git a/frontend-old/node_modules/@firebase/analytics/dist/analytics.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/analytics.d.ts new file mode 100644 index 0000000..77bfff3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/analytics.d.ts @@ -0,0 +1,763 @@ +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ + +import { FirebaseApp } from '@firebase/app'; + +/** + * An instance of Firebase Analytics. + * @public + */ +export declare interface Analytics { + /** + * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with. + */ + app: FirebaseApp; +} + +/** + * Additional options that can be passed to Analytics method + * calls such as `logEvent`, etc. + * @public + */ +export declare interface AnalyticsCallOptions { + /** + * If true, this config or event call applies globally to all + * Google Analytics properties on the page. + */ + global: boolean; +} + +/** + * {@link Analytics} instance initialization options. + * @public + */ +export declare interface AnalyticsSettings { + /** + * Params to be passed in the initial `gtag` config call during Firebase + * Analytics initialization. + */ + config?: GtagConfigParams | EventParams; +} + +/** + * Consent status settings for each consent type. + * For more information, see + * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis + * | the GA4 reference documentation for consent state and consent types}. + * @public + */ +export declare interface ConsentSettings { + /** Enables storage, such as cookies, related to advertising */ + ad_storage?: ConsentStatusString; + /** Sets consent for sending user data to Google for advertising purposes. */ + ad_user_data?: ConsentStatusString; + /** Sets consent for personalized advertising. */ + ad_personalization?: ConsentStatusString; + /** Enables storage, such as cookies, related to analytics (for example, visit duration) */ + analytics_storage?: ConsentStatusString; + /** + * Enables storage that supports the functionality of the website or app such as language settings + */ + functionality_storage?: ConsentStatusString; + /** Enables storage related to personalization such as video recommendations */ + personalization_storage?: ConsentStatusString; + /** + * Enables storage related to security such as authentication functionality, fraud prevention, + * and other user protection. + */ + security_storage?: ConsentStatusString; + [key: string]: unknown; +} + +/** + * Whether a particular consent type has been granted or denied. + * @public + */ +export declare type ConsentStatusString = 'granted' | 'denied'; + +/** + * Standard `gtag.js` control parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export declare interface ControlParams { + groups?: string | string[]; + send_to?: string | string[]; + event_callback?: () => void; + event_timeout?: number; +} + +/** + * Standard Google Analytics currency type. + * @public + */ +export declare type Currency = string | number; + +/** + * Any custom event name string not in the standard list of recommended + * event names. + * @public + */ +export declare type CustomEventName<T> = T extends EventNameString ? never : T; + +/** + * Any custom params the user may pass to `gtag`. + * @public + */ +export declare interface CustomParams { + [key: string]: unknown; +} + +/** + * Type for standard Google Analytics event names. `logEvent` also accepts any + * custom string and interprets it as a custom event name. + * @public + */ +export declare type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'checkout_progress' | 'exception' | 'generate_lead' | 'login' | 'page_view' | 'purchase' | 'refund' | 'remove_from_cart' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'set_checkout_option' | 'share' | 'sign_up' | 'timing_complete' | 'view_cart' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_search_results'; + +/** + * Standard `gtag.js` event parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export declare interface EventParams { + checkout_option?: string; + checkout_step?: number; + item_id?: string; + content_type?: string; + coupon?: string; + currency?: string; + description?: string; + fatal?: boolean; + items?: Item[]; + method?: string; + number?: string; + promotions?: Promotion[]; + screen_name?: string; + /** + * Firebase-specific. Use to log a `screen_name` to Firebase Analytics. + */ + firebase_screen?: string; + /** + * Firebase-specific. Use to log a `screen_class` to Firebase Analytics. + */ + firebase_screen_class?: string; + search_term?: string; + shipping?: Currency; + tax?: Currency; + transaction_id?: string; + value?: number; + event_label?: string; + event_category?: string; + shipping_tier?: string; + item_list_id?: string; + item_list_name?: string; + promotion_id?: string; + promotion_name?: string; + payment_type?: string; + affiliation?: string; + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: unknown; +} + +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getAnalytics(app?: FirebaseApp): Analytics; + +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>; + +/** + * A set of common Google Analytics config settings recognized by + * `gtag.js`. + * @public + */ +export declare interface GtagConfigParams { + /** + * Whether or not a page view should be sent. + * If set to true (default), a page view is automatically sent upon initialization + * of analytics. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'send_page_view'?: boolean; + /** + * The title of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_title'?: string; + /** + * The URL of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_location'?: string; + /** + * Defaults to `auto`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_domain'?: string; + /** + * Defaults to 63072000 (two years, in seconds). + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_expires'?: number; + /** + * Defaults to `_ga`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_prefix'?: string; + /** + * If set to true, will update cookies on each page load. + * Defaults to true. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_update'?: boolean; + /** + * Appends additional flags to the cookie when set. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_flags'?: string; + /** + * If set to false, disables all advertising features with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_google_signals'?: boolean; + /** + * If set to false, disables all advertising personalization with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_ad_personalization_signals'?: boolean; + [key: string]: unknown; +} + +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics; + +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +export declare function isSupported(): Promise<boolean>; + +/** + * Standard Google Analytics `Item` type. + * @public + */ +export declare interface Item { + item_id?: string; + item_name?: string; + item_brand?: string; + item_category?: string; + item_category2?: string; + item_category3?: string; + item_category4?: string; + item_category5?: string; + item_variant?: string; + price?: Currency; + quantity?: number; + index?: number; + coupon?: string; + item_list_name?: string; + item_list_id?: string; + discount?: Currency; + affiliation?: string; + creative_name?: string; + creative_slot?: string; + promotion_id?: string; + promotion_name?: string; + location_id?: string; + /** @deprecated Use item_brand instead. */ + brand?: string; + /** @deprecated Use item_category instead. */ + category?: string; + /** @deprecated Use item_id instead. */ + id?: string; + /** @deprecated Use item_name instead. */ + name?: string; +} + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + payment_type?: EventParams['payment_type']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + shipping_tier?: EventParams['shipping_tier']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: { + currency?: EventParams['currency']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions + * | Measure exceptions}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: { + description?: EventParams['description']; + fatal?: EventParams['fatal']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/views + * | Page views}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: { + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + transaction_id: EventParams['transaction_id']; + tax?: EventParams['tax']; + shipping?: EventParams['shipping']; + items?: EventParams['items']; + coupon?: EventParams['coupon']; + affiliation?: EventParams['affiliation']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See {@link https://firebase.google.com/docs/analytics/screenviews + * | Track Screenviews}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: { + firebase_screen: EventParams['firebase_screen']; + firebase_screen_class: EventParams['firebase_screen_class']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: { + search_term?: EventParams['search_term']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: { + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: { + items?: EventParams['items']; + promotion_id?: EventParams['promotion_id']; + promotion_name?: EventParams['promotion_name']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: { + method?: EventParams['method']; + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: { + name: string; + value: number; + event_category?: string; + event_label?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: { + currency?: EventParams['currency']; + items?: EventParams['items']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: { + [key: string]: any; +}, options?: AnalyticsCallOptions): void; + +/** + * Field previously used by some Google Analytics events. + * @deprecated Use `Item` instead. + * @public + */ +export declare interface Promotion { + creative_name?: string; + creative_slot?: string; + id?: string; + name?: string; +} + +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void; + +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +export declare function setConsent(consentSettings: ConsentSettings): void; + +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void; + +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +export declare function setDefaultEventParameters(customParams: CustomParams): void; + +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +export declare function settings(options: SettingsOptions): void; + +/** + * Specifies custom options for your Firebase Analytics instance. + * You must set these before initializing `firebase.analytics()`. + * @public + */ +export declare interface SettingsOptions { + /** Sets custom name for `gtag` function. */ + gtagName?: string; + /** Sets custom name for `dataLayer` array used by `gtag.js`. */ + dataLayerName?: string; +} + +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void; + +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void; + +export { } diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/index.esm.js b/frontend-old/node_modules/@firebase/analytics/dist/esm/index.esm.js new file mode 100644 index 0000000..93900d5 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/index.esm.js @@ -0,0 +1,1272 @@ +import { _getProvider, getApp, _registerComponent, registerVersion } from '@firebase/app'; +import { Logger } from '@firebase/logger'; +import { ErrorFactory, calculateBackoffMillis, FirebaseError, isIndexedDBAvailable, validateIndexedDBOpenable, isBrowserExtension, areCookiesEnabled, getModularInstance, deepEqual } from '@firebase/util'; +import { Component } from '@firebase/component'; +import '@firebase/installations'; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Analytics. + */ +const ANALYTICS_TYPE = 'analytics'; +// Key to attach FID to in gtag params. +const GA_FID_KEY = 'firebase_id'; +const ORIGIN_KEY = 'origin'; +const FETCH_TIMEOUT_MILLIS = 60 * 1000; +const DYNAMIC_CONFIG_URL = 'https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig'; +const GTAG_URL = 'https://www.googletagmanager.com/gtag/js'; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const logger = new Logger('@firebase/analytics'); + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const ERRORS = { + ["already-exists" /* AnalyticsError.ALREADY_EXISTS */]: 'A Firebase Analytics instance with the appId {$id} ' + + ' already exists. ' + + 'Only one Firebase Analytics instance can be created for each appId.', + ["already-initialized" /* AnalyticsError.ALREADY_INITIALIZED */]: 'initializeAnalytics() cannot be called again with different options than those ' + + 'it was initially called with. It can be called again with the same options to ' + + 'return the existing instance, or getAnalytics() can be used ' + + 'to get a reference to the already-initialized instance.', + ["already-initialized-settings" /* AnalyticsError.ALREADY_INITIALIZED_SETTINGS */]: 'Firebase Analytics has already been initialized.' + + 'settings() must be called before initializing any Analytics instance' + + 'or it will have no effect.', + ["interop-component-reg-failed" /* AnalyticsError.INTEROP_COMPONENT_REG_FAILED */]: 'Firebase Analytics Interop Component failed to instantiate: {$reason}', + ["invalid-analytics-context" /* AnalyticsError.INVALID_ANALYTICS_CONTEXT */]: 'Firebase Analytics is not supported in this environment. ' + + 'Wrap initialization of analytics in analytics.isSupported() ' + + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', + ["indexeddb-unavailable" /* AnalyticsError.INDEXEDDB_UNAVAILABLE */]: 'IndexedDB unavailable or restricted in this environment. ' + + 'Wrap initialization of analytics in analytics.isSupported() ' + + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', + ["fetch-throttle" /* AnalyticsError.FETCH_THROTTLE */]: 'The config fetch request timed out while in an exponential backoff state.' + + ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.', + ["config-fetch-failed" /* AnalyticsError.CONFIG_FETCH_FAILED */]: 'Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}', + ["no-api-key" /* AnalyticsError.NO_API_KEY */]: 'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field to' + + 'contain a valid API key.', + ["no-app-id" /* AnalyticsError.NO_APP_ID */]: 'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field to' + + 'contain a valid app ID.', + ["no-client-id" /* AnalyticsError.NO_CLIENT_ID */]: 'The "client_id" field is empty.', + ["invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */]: 'Trusted Types detected an invalid gtag resource: {$gtagURL}.' +}; +const ERROR_FACTORY = new ErrorFactory('analytics', 'Analytics', ERRORS); + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Verifies and creates a TrustedScriptURL. + */ +function createGtagTrustedTypesScriptURL(url) { + if (!url.startsWith(GTAG_URL)) { + const err = ERROR_FACTORY.create("invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */, { + gtagURL: url + }); + logger.warn(err.message); + return ''; + } + return url; +} +/** + * Makeshift polyfill for Promise.allSettled(). Resolves when all promises + * have either resolved or rejected. + * + * @param promises Array of promises to wait for. + */ +function promiseAllSettled(promises) { + return Promise.all(promises.map(promise => promise.catch(e => e))); +} +/** + * Creates a TrustedTypePolicy object that implements the rules passed as policyOptions. + * + * @param policyName A string containing the name of the policy + * @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods + * | the TrustedTypePolicy reference documentation}. + */ +function createTrustedTypesPolicy(policyName, policyOptions) { + // Create a TrustedTypes policy that we can use for updating src + // properties + let trustedTypesPolicy; + if (window.trustedTypes) { + trustedTypesPolicy = window.trustedTypes.createPolicy(policyName, policyOptions); + } + return trustedTypesPolicy; +} +/** + * Inserts gtag script tag into the page to asynchronously download gtag. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +function insertScriptTag(dataLayerName, measurementId) { + const trustedTypesPolicy = createTrustedTypesPolicy('firebase-js-sdk-policy', { + createScriptURL: createGtagTrustedTypesScriptURL + }); + const script = document.createElement('script'); + // We are not providing an analyticsId in the URL because it would trigger a `page_view` + // without fid. We will initialize ga-id using gtag (config) command together with fid. + const gtagScriptURL = `${GTAG_URL}?l=${dataLayerName}&id=${measurementId}`; + script.src = trustedTypesPolicy + ? trustedTypesPolicy?.createScriptURL(gtagScriptURL) + : gtagScriptURL; + script.async = true; + document.head.appendChild(script); +} +/** + * Get reference to, or create, global datalayer. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +function getOrCreateDataLayer(dataLayerName) { + // Check for existing dataLayer and create if needed. + let dataLayer = []; + if (Array.isArray(window[dataLayerName])) { + dataLayer = window[dataLayerName]; + } + else { + window[dataLayerName] = dataLayer; + } + return dataLayer; +} +/** + * Wrapped gtag logic when gtag is called with 'config' command. + * + * @param gtagCore Basic gtag function that just appends to dataLayer. + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + * @param measurementId GA Measurement ID to set config for. + * @param gtagParams Gtag config params to set. + */ +async function gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams) { + // If config is already fetched, we know the appId and can use it to look up what FID promise we + /// are waiting for, and wait only on that one. + const correspondingAppId = measurementIdToAppId[measurementId]; + try { + if (correspondingAppId) { + await initializationPromisesMap[correspondingAppId]; + } + else { + // If config is not fetched yet, wait for all configs (we don't know which one we need) and + // find the appId (if any) corresponding to this measurementId. If there is one, wait on + // that appId's initialization promise. If there is none, promise resolves and gtag + // call goes through. + const dynamicConfigResults = await promiseAllSettled(dynamicConfigPromisesList); + const foundConfig = dynamicConfigResults.find(config => config.measurementId === measurementId); + if (foundConfig) { + await initializationPromisesMap[foundConfig.appId]; + } + } + } + catch (e) { + logger.error(e); + } + gtagCore("config" /* GtagCommand.CONFIG */, measurementId, gtagParams); +} +/** + * Wrapped gtag logic when gtag is called with 'event' command. + * + * @param gtagCore Basic gtag function that just appends to dataLayer. + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementId GA Measurement ID to log event to. + * @param gtagParams Params to log with this event. + */ +async function gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams) { + try { + let initializationPromisesToWaitFor = []; + // If there's a 'send_to' param, check if any ID specified matches + // an initializeIds() promise we are waiting for. + if (gtagParams && gtagParams['send_to']) { + let gaSendToList = gtagParams['send_to']; + // Make it an array if is isn't, so it can be dealt with the same way. + if (!Array.isArray(gaSendToList)) { + gaSendToList = [gaSendToList]; + } + // Checking 'send_to' fields requires having all measurement ID results back from + // the dynamic config fetch. + const dynamicConfigResults = await promiseAllSettled(dynamicConfigPromisesList); + for (const sendToId of gaSendToList) { + // Any fetched dynamic measurement ID that matches this 'send_to' ID + const foundConfig = dynamicConfigResults.find(config => config.measurementId === sendToId); + const initializationPromise = foundConfig && initializationPromisesMap[foundConfig.appId]; + if (initializationPromise) { + initializationPromisesToWaitFor.push(initializationPromise); + } + else { + // Found an item in 'send_to' that is not associated + // directly with an FID, possibly a group. Empty this array, + // exit the loop early, and let it get populated below. + initializationPromisesToWaitFor = []; + break; + } + } + } + // This will be unpopulated if there was no 'send_to' field , or + // if not all entries in the 'send_to' field could be mapped to + // a FID. In these cases, wait on all pending initialization promises. + if (initializationPromisesToWaitFor.length === 0) { + /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ + initializationPromisesToWaitFor = Object.values(initializationPromisesMap); + } + // Run core gtag function with args after all relevant initialization + // promises have been resolved. + await Promise.all(initializationPromisesToWaitFor); + // Workaround for http://b/141370449 - third argument cannot be undefined. + gtagCore("event" /* GtagCommand.EVENT */, measurementId, gtagParams || {}); + } + catch (e) { + logger.error(e); + } +} +/** + * Wraps a standard gtag function with extra code to wait for completion of + * relevant initialization promises before sending requests. + * + * @param gtagCore Basic gtag function that just appends to dataLayer. + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + */ +function wrapGtag(gtagCore, +/** + * Allows wrapped gtag calls to wait on whichever initialization promises are required, + * depending on the contents of the gtag params' `send_to` field, if any. + */ +initializationPromisesMap, +/** + * Wrapped gtag calls sometimes require all dynamic config fetches to have returned + * before determining what initialization promises (which include FIDs) to wait for. + */ +dynamicConfigPromisesList, +/** + * Wrapped gtag config calls can narrow down which initialization promise (with FID) + * to wait for if the measurementId is already fetched, by getting the corresponding appId, + * which is the key for the initialization promises map. + */ +measurementIdToAppId) { + /** + * Wrapper around gtag that ensures FID is sent with gtag calls. + * @param command Gtag command type. + * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET. + * @param gtagParams Params if event is EVENT/CONFIG. + */ + async function gtagWrapper(command, ...args) { + try { + // If event, check that relevant initialization promises have completed. + if (command === "event" /* GtagCommand.EVENT */) { + const [measurementId, gtagParams] = args; + // If EVENT, second arg must be measurementId. + await gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams); + } + else if (command === "config" /* GtagCommand.CONFIG */) { + const [measurementId, gtagParams] = args; + // If CONFIG, second arg must be measurementId. + await gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams); + } + else if (command === "consent" /* GtagCommand.CONSENT */) { + const [consentAction, gtagParams] = args; + // consentAction can be one of 'default' or 'update'. + gtagCore("consent" /* GtagCommand.CONSENT */, consentAction, gtagParams); + } + else if (command === "get" /* GtagCommand.GET */) { + const [measurementId, fieldName, callback] = args; + gtagCore("get" /* GtagCommand.GET */, measurementId, fieldName, callback); + } + else if (command === "set" /* GtagCommand.SET */) { + const [customParams] = args; + // If SET, second arg must be params. + gtagCore("set" /* GtagCommand.SET */, customParams); + } + else { + gtagCore(command, ...args); + } + } + catch (e) { + logger.error(e); + } + } + return gtagWrapper; +} +/** + * Creates global gtag function or wraps existing one if found. + * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and + * 'event' calls that belong to the GAID associated with this Firebase instance. + * + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + * @param dataLayerName Name of global GA datalayer array. + * @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified). + */ +function wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagFunctionName) { + // Create a basic core gtag function + let gtagCore = function (..._args) { + // Must push IArguments object, not an array. + window[dataLayerName].push(arguments); + }; + // Replace it with existing one if found + if (window[gtagFunctionName] && + typeof window[gtagFunctionName] === 'function') { + // @ts-ignore + gtagCore = window[gtagFunctionName]; + } + window[gtagFunctionName] = wrapGtag(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId); + return { + gtagCore, + wrappedGtag: window[gtagFunctionName] + }; +} +/** + * Returns the script tag in the DOM matching both the gtag url pattern + * and the provided data layer name. + */ +function findGtagScriptOnPage(dataLayerName) { + const scriptTags = window.document.getElementsByTagName('script'); + for (const tag of Object.values(scriptTags)) { + if (tag.src && + tag.src.includes(GTAG_URL) && + tag.src.includes(dataLayerName)) { + return tag; + } + } + return null; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Backoff factor for 503 errors, which we want to be conservative about + * to avoid overloading servers. Each retry interval will be + * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one + * will be ~30 seconds (with fuzzing). + */ +const LONG_RETRY_FACTOR = 30; +/** + * Base wait interval to multiplied by backoffFactor^backoffCount. + */ +const BASE_INTERVAL_MILLIS = 1000; +/** + * Stubbable retry data storage class. + */ +class RetryData { + constructor(throttleMetadata = {}, intervalMillis = BASE_INTERVAL_MILLIS) { + this.throttleMetadata = throttleMetadata; + this.intervalMillis = intervalMillis; + } + getThrottleMetadata(appId) { + return this.throttleMetadata[appId]; + } + setThrottleMetadata(appId, metadata) { + this.throttleMetadata[appId] = metadata; + } + deleteThrottleMetadata(appId) { + delete this.throttleMetadata[appId]; + } +} +const defaultRetryData = new RetryData(); +/** + * Set GET request headers. + * @param apiKey App API key. + */ +function getHeaders(apiKey) { + return new Headers({ + Accept: 'application/json', + 'x-goog-api-key': apiKey + }); +} +/** + * Fetches dynamic config from backend. + * @param app Firebase app to fetch config for. + */ +async function fetchDynamicConfig(appFields) { + const { appId, apiKey } = appFields; + const request = { + method: 'GET', + headers: getHeaders(apiKey) + }; + const appUrl = DYNAMIC_CONFIG_URL.replace('{app-id}', appId); + const response = await fetch(appUrl, request); + if (response.status !== 200 && response.status !== 304) { + let errorMessage = ''; + try { + // Try to get any error message text from server response. + const jsonResponse = (await response.json()); + if (jsonResponse.error?.message) { + errorMessage = jsonResponse.error.message; + } + } + catch (_ignored) { } + throw ERROR_FACTORY.create("config-fetch-failed" /* AnalyticsError.CONFIG_FETCH_FAILED */, { + httpStatus: response.status, + responseMessage: errorMessage + }); + } + return response.json(); +} +/** + * Fetches dynamic config from backend, retrying if failed. + * @param app Firebase app to fetch config for. + */ +async function fetchDynamicConfigWithRetry(app, +// retryData and timeoutMillis are parameterized to allow passing a different value for testing. +retryData = defaultRetryData, timeoutMillis) { + const { appId, apiKey, measurementId } = app.options; + if (!appId) { + throw ERROR_FACTORY.create("no-app-id" /* AnalyticsError.NO_APP_ID */); + } + if (!apiKey) { + if (measurementId) { + return { + measurementId, + appId + }; + } + throw ERROR_FACTORY.create("no-api-key" /* AnalyticsError.NO_API_KEY */); + } + const throttleMetadata = retryData.getThrottleMetadata(appId) || { + backoffCount: 0, + throttleEndTimeMillis: Date.now() + }; + const signal = new AnalyticsAbortSignal(); + setTimeout(async () => { + // Note a very low delay, eg < 10ms, can elapse before listeners are initialized. + signal.abort(); + }, timeoutMillis !== undefined ? timeoutMillis : FETCH_TIMEOUT_MILLIS); + return attemptFetchDynamicConfigWithRetry({ appId, apiKey, measurementId }, throttleMetadata, signal, retryData); +} +/** + * Runs one retry attempt. + * @param appFields Necessary app config fields. + * @param throttleMetadata Ongoing metadata to determine throttling times. + * @param signal Abort signal. + */ +async function attemptFetchDynamicConfigWithRetry(appFields, { throttleEndTimeMillis, backoffCount }, signal, retryData = defaultRetryData // for testing +) { + const { appId, measurementId } = appFields; + // Starts with a (potentially zero) timeout to support resumption from stored state. + // Ensures the throttle end time is honored if the last attempt timed out. + // Note the SDK will never make a request if the fetch timeout expires at this point. + try { + await setAbortableTimeout(signal, throttleEndTimeMillis); + } + catch (e) { + if (measurementId) { + logger.warn(`Timed out fetching this Firebase app's measurement ID from the server.` + + ` Falling back to the measurement ID ${measurementId}` + + ` provided in the "measurementId" field in the local Firebase config. [${e?.message}]`); + return { appId, measurementId }; + } + throw e; + } + try { + const response = await fetchDynamicConfig(appFields); + // Note the SDK only clears throttle state if response is success or non-retriable. + retryData.deleteThrottleMetadata(appId); + return response; + } + catch (e) { + const error = e; + if (!isRetriableError(error)) { + retryData.deleteThrottleMetadata(appId); + if (measurementId) { + logger.warn(`Failed to fetch this Firebase app's measurement ID from the server.` + + ` Falling back to the measurement ID ${measurementId}` + + ` provided in the "measurementId" field in the local Firebase config. [${error?.message}]`); + return { appId, measurementId }; + } + else { + throw e; + } + } + const backoffMillis = Number(error?.customData?.httpStatus) === 503 + ? calculateBackoffMillis(backoffCount, retryData.intervalMillis, LONG_RETRY_FACTOR) + : calculateBackoffMillis(backoffCount, retryData.intervalMillis); + // Increments backoff state. + const throttleMetadata = { + throttleEndTimeMillis: Date.now() + backoffMillis, + backoffCount: backoffCount + 1 + }; + // Persists state. + retryData.setThrottleMetadata(appId, throttleMetadata); + logger.debug(`Calling attemptFetch again in ${backoffMillis} millis`); + return attemptFetchDynamicConfigWithRetry(appFields, throttleMetadata, signal, retryData); + } +} +/** + * Supports waiting on a backoff by: + * + * <ul> + * <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li> + * <li>Listening on a signal bus for abort events, just like the Fetch API</li> + * <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled + * request appear the same.</li> + * </ul> + * + * <p>Visible for testing. + */ +function setAbortableTimeout(signal, throttleEndTimeMillis) { + return new Promise((resolve, reject) => { + // Derives backoff from given end time, normalizing negative numbers to zero. + const backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0); + const timeout = setTimeout(resolve, backoffMillis); + // Adds listener, rather than sets onabort, because signal is a shared object. + signal.addEventListener(() => { + clearTimeout(timeout); + // If the request completes before this timeout, the rejection has no effect. + reject(ERROR_FACTORY.create("fetch-throttle" /* AnalyticsError.FETCH_THROTTLE */, { + throttleEndTimeMillis + })); + }); + }); +} +/** + * Returns true if the {@link Error} indicates a fetch request may succeed later. + */ +function isRetriableError(e) { + if (!(e instanceof FirebaseError) || !e.customData) { + return false; + } + // Uses string index defined by ErrorData, which FirebaseError implements. + const httpStatus = Number(e.customData['httpStatus']); + return (httpStatus === 429 || + httpStatus === 500 || + httpStatus === 503 || + httpStatus === 504); +} +/** + * Shims a minimal AbortSignal (copied from Remote Config). + * + * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects + * of networking, such as retries. Firebase doesn't use AbortController enough to justify a + * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be + * swapped out if/when we do. + */ +class AnalyticsAbortSignal { + constructor() { + this.listeners = []; + } + addEventListener(listener) { + this.listeners.push(listener); + } + abort() { + this.listeners.forEach(listener => listener()); + } +} + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Event parameters to set on 'gtag' during initialization. + */ +let defaultEventParametersForInit; +/** + * Logs an analytics event through the Firebase SDK. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param eventName Google Analytics event name, choose from standard list or use a custom string. + * @param eventParams Analytics event parameters. + */ +async function logEvent$1(gtagFunction, initializationPromise, eventName, eventParams, options) { + if (options && options.global) { + gtagFunction("event" /* GtagCommand.EVENT */, eventName, eventParams); + return; + } + else { + const measurementId = await initializationPromise; + const params = { + ...eventParams, + 'send_to': measurementId + }; + gtagFunction("event" /* GtagCommand.EVENT */, eventName, params); + } +} +/** + * Set screen_name parameter for this Google Analytics ID. + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param screenName Screen name string to set. + */ +async function setCurrentScreen$1(gtagFunction, initializationPromise, screenName, options) { + if (options && options.global) { + gtagFunction("set" /* GtagCommand.SET */, { 'screen_name': screenName }); + return Promise.resolve(); + } + else { + const measurementId = await initializationPromise; + gtagFunction("config" /* GtagCommand.CONFIG */, measurementId, { + update: true, + 'screen_name': screenName + }); + } +} +/** + * Set user_id parameter for this Google Analytics ID. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param id User ID string to set + */ +async function setUserId$1(gtagFunction, initializationPromise, id, options) { + if (options && options.global) { + gtagFunction("set" /* GtagCommand.SET */, { 'user_id': id }); + return Promise.resolve(); + } + else { + const measurementId = await initializationPromise; + gtagFunction("config" /* GtagCommand.CONFIG */, measurementId, { + update: true, + 'user_id': id + }); + } +} +/** + * Set all other user properties other than user_id and screen_name. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param properties Map of user properties to set + */ +async function setUserProperties$1(gtagFunction, initializationPromise, properties, options) { + if (options && options.global) { + const flatProperties = {}; + for (const key of Object.keys(properties)) { + // use dot notation for merge behavior in gtag.js + flatProperties[`user_properties.${key}`] = properties[key]; + } + gtagFunction("set" /* GtagCommand.SET */, flatProperties); + return Promise.resolve(); + } + else { + const measurementId = await initializationPromise; + gtagFunction("config" /* GtagCommand.CONFIG */, measurementId, { + update: true, + 'user_properties': properties + }); + } +} +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + */ +async function internalGetGoogleAnalyticsClientId(gtagFunction, initializationPromise) { + const measurementId = await initializationPromise; + return new Promise((resolve, reject) => { + gtagFunction("get" /* GtagCommand.GET */, measurementId, 'client_id', (clientId) => { + if (!clientId) { + reject(ERROR_FACTORY.create("no-client-id" /* AnalyticsError.NO_CLIENT_ID */)); + } + resolve(clientId); + }); + }); +} +/** + * Set whether collection is enabled for this ID. + * + * @param enabled If true, collection is enabled for this ID. + */ +async function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) { + const measurementId = await initializationPromise; + window[`ga-disable-${measurementId}`] = !enabled; +} +/** + * Consent parameters to default to during 'gtag' initialization. + */ +let defaultConsentSettingsForInit; +/** + * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of + * analytics. + * + * @param consentSettings Maps the applicable end user consent state for gtag.js. + */ +function _setConsentDefaultForInit(consentSettings) { + defaultConsentSettingsForInit = consentSettings; +} +/** + * Sets the variable `defaultEventParametersForInit` for use in the initialization of + * analytics. + * + * @param customParams Any custom params the user may pass to gtag.js. + */ +function _setDefaultEventParametersForInit(customParams) { + defaultEventParametersForInit = customParams; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +async function validateIndexedDB() { + if (!isIndexedDBAvailable()) { + logger.warn(ERROR_FACTORY.create("indexeddb-unavailable" /* AnalyticsError.INDEXEDDB_UNAVAILABLE */, { + errorInfo: 'IndexedDB is not available in this environment.' + }).message); + return false; + } + else { + try { + await validateIndexedDBOpenable(); + } + catch (e) { + logger.warn(ERROR_FACTORY.create("indexeddb-unavailable" /* AnalyticsError.INDEXEDDB_UNAVAILABLE */, { + errorInfo: e?.toString() + }).message); + return false; + } + } + return true; +} +/** + * Initialize the analytics instance in gtag.js by calling config command with fid. + * + * NOTE: We combine analytics initialization and setting fid together because we want fid to be + * part of the `page_view` event that's sent during the initialization + * @param app Firebase app + * @param gtagCore The gtag function that's not wrapped. + * @param dynamicConfigPromisesList Array of all dynamic config promises. + * @param measurementIdToAppId Maps measurementID to appID. + * @param installations _FirebaseInstallationsInternal instance. + * + * @returns Measurement ID. + */ +async function _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCore, dataLayerName, options) { + const dynamicConfigPromise = fetchDynamicConfigWithRetry(app); + // Once fetched, map measurementIds to appId, for ease of lookup in wrapped gtag function. + dynamicConfigPromise + .then(config => { + measurementIdToAppId[config.measurementId] = config.appId; + if (app.options.measurementId && + config.measurementId !== app.options.measurementId) { + logger.warn(`The measurement ID in the local Firebase config (${app.options.measurementId})` + + ` does not match the measurement ID fetched from the server (${config.measurementId}).` + + ` To ensure analytics events are always sent to the correct Analytics property,` + + ` update the` + + ` measurement ID field in the local config or remove it from the local config.`); + } + }) + .catch(e => logger.error(e)); + // Add to list to track state of all dynamic config promises. + dynamicConfigPromisesList.push(dynamicConfigPromise); + const fidPromise = validateIndexedDB().then(envIsValid => { + if (envIsValid) { + return installations.getId(); + } + else { + return undefined; + } + }); + const [dynamicConfig, fid] = await Promise.all([ + dynamicConfigPromise, + fidPromise + ]); + // Detect if user has already put the gtag <script> tag on this page with the passed in + // data layer name. + if (!findGtagScriptOnPage(dataLayerName)) { + insertScriptTag(dataLayerName, dynamicConfig.measurementId); + } + // Detects if there are consent settings that need to be configured. + if (defaultConsentSettingsForInit) { + gtagCore("consent" /* GtagCommand.CONSENT */, 'default', defaultConsentSettingsForInit); + _setConsentDefaultForInit(undefined); + } + // This command initializes gtag.js and only needs to be called once for the entire web app, + // but since it is idempotent, we can call it multiple times. + // We keep it together with other initialization logic for better code structure. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + gtagCore('js', new Date()); + // User config added first. We don't want users to accidentally overwrite + // base Firebase config properties. + const configProperties = options?.config ?? {}; + // guard against developers accidentally setting properties with prefix `firebase_` + configProperties[ORIGIN_KEY] = 'firebase'; + configProperties.update = true; + if (fid != null) { + configProperties[GA_FID_KEY] = fid; + } + // It should be the first config command called on this GA-ID + // Initialize this GA-ID and set FID on it using the gtag config API. + // Note: This will trigger a page_view event unless 'send_page_view' is set to false in + // `configProperties`. + gtagCore("config" /* GtagCommand.CONFIG */, dynamicConfig.measurementId, configProperties); + // Detects if there is data that will be set on every event logged from the SDK. + if (defaultEventParametersForInit) { + gtagCore("set" /* GtagCommand.SET */, defaultEventParametersForInit); + _setDefaultEventParametersForInit(undefined); + } + return dynamicConfig.measurementId; +} + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Analytics Service class. + */ +class AnalyticsService { + constructor(app) { + this.app = app; + } + _delete() { + delete initializationPromisesMap[this.app.options.appId]; + return Promise.resolve(); + } +} +/** + * Maps appId to full initialization promise. Wrapped gtag calls must wait on + * all or some of these, depending on the call's `send_to` param and the status + * of the dynamic config fetches (see below). + */ +let initializationPromisesMap = {}; +/** + * List of dynamic config fetch promises. In certain cases, wrapped gtag calls + * wait on all these to be complete in order to determine if it can selectively + * wait for only certain initialization (FID) promises or if it must wait for all. + */ +let dynamicConfigPromisesList = []; +/** + * Maps fetched measurementIds to appId. Populated when the app's dynamic config + * fetch completes. If already populated, gtag config calls can use this to + * selectively wait for only this app's initialization promise (FID) instead of all + * initialization promises. + */ +const measurementIdToAppId = {}; +/** + * Name for window global data layer array used by GA: defaults to 'dataLayer'. + */ +let dataLayerName = 'dataLayer'; +/** + * Name for window global gtag function used by GA: defaults to 'gtag'. + */ +let gtagName = 'gtag'; +/** + * Reproduction of standard gtag function or reference to existing + * gtag function on window object. + */ +let gtagCoreFunction; +/** + * Wrapper around gtag function that ensures FID is sent with all + * relevant event and config calls. + */ +let wrappedGtagFunction; +/** + * Flag to ensure page initialization steps (creation or wrapping of + * dataLayer and gtag script) are only run once per page load. + */ +let globalInitDone = false; +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +function settings(options) { + if (globalInitDone) { + throw ERROR_FACTORY.create("already-initialized" /* AnalyticsError.ALREADY_INITIALIZED */); + } + if (options.dataLayerName) { + dataLayerName = options.dataLayerName; + } + if (options.gtagName) { + gtagName = options.gtagName; + } +} +/** + * Returns true if no environment mismatch is found. + * If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT + * error that also lists details for each mismatch found. + */ +function warnOnBrowserContextMismatch() { + const mismatchedEnvMessages = []; + if (isBrowserExtension()) { + mismatchedEnvMessages.push('This is a browser extension environment.'); + } + if (!areCookiesEnabled()) { + mismatchedEnvMessages.push('Cookies are not available.'); + } + if (mismatchedEnvMessages.length > 0) { + const details = mismatchedEnvMessages + .map((message, index) => `(${index + 1}) ${message}`) + .join(' '); + const err = ERROR_FACTORY.create("invalid-analytics-context" /* AnalyticsError.INVALID_ANALYTICS_CONTEXT */, { + errorInfo: details + }); + logger.warn(err.message); + } +} +/** + * Analytics instance factory. + * @internal + */ +function factory(app, installations, options) { + warnOnBrowserContextMismatch(); + const appId = app.options.appId; + if (!appId) { + throw ERROR_FACTORY.create("no-app-id" /* AnalyticsError.NO_APP_ID */); + } + if (!app.options.apiKey) { + if (app.options.measurementId) { + logger.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest` + + ` measurement ID for this Firebase app. Falling back to the measurement ID ${app.options.measurementId}` + + ` provided in the "measurementId" field in the local Firebase config.`); + } + else { + throw ERROR_FACTORY.create("no-api-key" /* AnalyticsError.NO_API_KEY */); + } + } + if (initializationPromisesMap[appId] != null) { + throw ERROR_FACTORY.create("already-exists" /* AnalyticsError.ALREADY_EXISTS */, { + id: appId + }); + } + if (!globalInitDone) { + // Steps here should only be done once per page: creation or wrapping + // of dataLayer and global gtag function. + getOrCreateDataLayer(dataLayerName); + const { wrappedGtag, gtagCore } = wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagName); + wrappedGtagFunction = wrappedGtag; + gtagCoreFunction = gtagCore; + globalInitDone = true; + } + // Async but non-blocking. + // This map reflects the completion state of all promises for each appId. + initializationPromisesMap[appId] = _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCoreFunction, dataLayerName, options); + const analyticsInstance = new AnalyticsService(app); + return analyticsInstance; +} + +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +function getAnalytics(app = getApp()) { + app = getModularInstance(app); + // Dependencies + const analyticsProvider = _getProvider(app, ANALYTICS_TYPE); + if (analyticsProvider.isInitialized()) { + return analyticsProvider.getImmediate(); + } + return initializeAnalytics(app); +} +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +function initializeAnalytics(app, options = {}) { + // Dependencies + const analyticsProvider = _getProvider(app, ANALYTICS_TYPE); + if (analyticsProvider.isInitialized()) { + const existingInstance = analyticsProvider.getImmediate(); + if (deepEqual(options, analyticsProvider.getOptions())) { + return existingInstance; + } + else { + throw ERROR_FACTORY.create("already-initialized" /* AnalyticsError.ALREADY_INITIALIZED */); + } + } + const analyticsInstance = analyticsProvider.initialize({ options }); + return analyticsInstance; +} +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +async function isSupported() { + if (isBrowserExtension()) { + return false; + } + if (!areCookiesEnabled()) { + return false; + } + if (!isIndexedDBAvailable()) { + return false; + } + try { + const isDBOpenable = await validateIndexedDBOpenable(); + return isDBOpenable; + } + catch (error) { + return false; + } +} +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +function setCurrentScreen(analyticsInstance, screenName, options) { + analyticsInstance = getModularInstance(analyticsInstance); + setCurrentScreen$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], screenName, options).catch(e => logger.error(e)); +} +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +async function getGoogleAnalyticsClientId(analyticsInstance) { + analyticsInstance = getModularInstance(analyticsInstance); + return internalGetGoogleAnalyticsClientId(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId]); +} +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +function setUserId(analyticsInstance, id, options) { + analyticsInstance = getModularInstance(analyticsInstance); + setUserId$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], id, options).catch(e => logger.error(e)); +} +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +function setUserProperties(analyticsInstance, properties, options) { + analyticsInstance = getModularInstance(analyticsInstance); + setUserProperties$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], properties, options).catch(e => logger.error(e)); +} +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +function setAnalyticsCollectionEnabled(analyticsInstance, enabled) { + analyticsInstance = getModularInstance(analyticsInstance); + setAnalyticsCollectionEnabled$1(initializationPromisesMap[analyticsInstance.app.options.appId], enabled).catch(e => logger.error(e)); +} +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +function setDefaultEventParameters(customParams) { + // Check if reference to existing gtag function on window object exists + if (wrappedGtagFunction) { + wrappedGtagFunction("set" /* GtagCommand.SET */, customParams); + } + else { + _setDefaultEventParametersForInit(customParams); + } +} +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * List of official event parameters can be found in the gtag.js + * reference documentation: + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * + * @public + */ +function logEvent(analyticsInstance, eventName, eventParams, options) { + analyticsInstance = getModularInstance(analyticsInstance); + logEvent$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], eventName, eventParams, options).catch(e => logger.error(e)); +} +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +function setConsent(consentSettings) { + // Check if reference to existing gtag function on window object exists + if (wrappedGtagFunction) { + wrappedGtagFunction("consent" /* GtagCommand.CONSENT */, 'update', consentSettings); + } + else { + _setConsentDefaultForInit(consentSettings); + } +} + +const name = "@firebase/analytics"; +const version = "0.10.19"; + +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ +function registerAnalytics() { + _registerComponent(new Component(ANALYTICS_TYPE, (container, { options: analyticsOptions }) => { + // getImmediate for FirebaseApp will always succeed + const app = container.getProvider('app').getImmediate(); + const installations = container + .getProvider('installations-internal') + .getImmediate(); + return factory(app, installations, analyticsOptions); + }, "PUBLIC" /* ComponentType.PUBLIC */)); + _registerComponent(new Component('analytics-internal', internalFactory, "PRIVATE" /* ComponentType.PRIVATE */)); + registerVersion(name, version); + // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation + registerVersion(name, version, 'esm2020'); + function internalFactory(container) { + try { + const analytics = container.getProvider(ANALYTICS_TYPE).getImmediate(); + return { + logEvent: (eventName, eventParams, options) => logEvent(analytics, eventName, eventParams, options), + setUserProperties: (properties, options) => setUserProperties(analytics, properties, options) + }; + } + catch (e) { + throw ERROR_FACTORY.create("interop-component-reg-failed" /* AnalyticsError.INTEROP_COMPONENT_REG_FAILED */, { + reason: e + }); + } + } +} +registerAnalytics(); + +export { getAnalytics, getGoogleAnalyticsClientId, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings }; +//# sourceMappingURL=index.esm.js.map diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/index.esm.js.map b/frontend-old/node_modules/@firebase/analytics/dist/esm/index.esm.js.map new file mode 100644 index 0000000..b16b356 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/index.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.esm.js","sources":["../../src/constants.ts","../../src/logger.ts","../../src/errors.ts","../../src/helpers.ts","../../src/get-config.ts","../../src/functions.ts","../../src/initialize-analytics.ts","../../src/factory.ts","../../src/api.ts","../../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Type constant for Firebase Analytics.\n */\nexport const ANALYTICS_TYPE = 'analytics';\n\n// Key to attach FID to in gtag params.\nexport const GA_FID_KEY = 'firebase_id';\nexport const ORIGIN_KEY = 'origin';\n\nexport const FETCH_TIMEOUT_MILLIS = 60 * 1000;\n\nexport const DYNAMIC_CONFIG_URL =\n 'https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig';\n\nexport const GTAG_URL = 'https://www.googletagmanager.com/gtag/js';\n\nexport const enum GtagCommand {\n EVENT = 'event',\n SET = 'set',\n CONFIG = 'config',\n CONSENT = 'consent',\n GET = 'get'\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from '@firebase/logger';\n\nexport const logger = new Logger('@firebase/analytics');\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorFactory, ErrorMap } from '@firebase/util';\n\nexport const enum AnalyticsError {\n ALREADY_EXISTS = 'already-exists',\n ALREADY_INITIALIZED = 'already-initialized',\n ALREADY_INITIALIZED_SETTINGS = 'already-initialized-settings',\n INTEROP_COMPONENT_REG_FAILED = 'interop-component-reg-failed',\n INVALID_ANALYTICS_CONTEXT = 'invalid-analytics-context',\n INDEXEDDB_UNAVAILABLE = 'indexeddb-unavailable',\n FETCH_THROTTLE = 'fetch-throttle',\n CONFIG_FETCH_FAILED = 'config-fetch-failed',\n NO_API_KEY = 'no-api-key',\n NO_APP_ID = 'no-app-id',\n NO_CLIENT_ID = 'no-client-id',\n INVALID_GTAG_RESOURCE = 'invalid-gtag-resource'\n}\n\nconst ERRORS: ErrorMap<AnalyticsError> = {\n [AnalyticsError.ALREADY_EXISTS]:\n 'A Firebase Analytics instance with the appId {$id} ' +\n ' already exists. ' +\n 'Only one Firebase Analytics instance can be created for each appId.',\n [AnalyticsError.ALREADY_INITIALIZED]:\n 'initializeAnalytics() cannot be called again with different options than those ' +\n 'it was initially called with. It can be called again with the same options to ' +\n 'return the existing instance, or getAnalytics() can be used ' +\n 'to get a reference to the already-initialized instance.',\n [AnalyticsError.ALREADY_INITIALIZED_SETTINGS]:\n 'Firebase Analytics has already been initialized.' +\n 'settings() must be called before initializing any Analytics instance' +\n 'or it will have no effect.',\n [AnalyticsError.INTEROP_COMPONENT_REG_FAILED]:\n 'Firebase Analytics Interop Component failed to instantiate: {$reason}',\n [AnalyticsError.INVALID_ANALYTICS_CONTEXT]:\n 'Firebase Analytics is not supported in this environment. ' +\n 'Wrap initialization of analytics in analytics.isSupported() ' +\n 'to prevent initialization in unsupported environments. Details: {$errorInfo}',\n [AnalyticsError.INDEXEDDB_UNAVAILABLE]:\n 'IndexedDB unavailable or restricted in this environment. ' +\n 'Wrap initialization of analytics in analytics.isSupported() ' +\n 'to prevent initialization in unsupported environments. Details: {$errorInfo}',\n [AnalyticsError.FETCH_THROTTLE]:\n 'The config fetch request timed out while in an exponential backoff state.' +\n ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',\n [AnalyticsError.CONFIG_FETCH_FAILED]:\n 'Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}',\n [AnalyticsError.NO_API_KEY]:\n 'The \"apiKey\" field is empty in the local Firebase config. Firebase Analytics requires this field to' +\n 'contain a valid API key.',\n [AnalyticsError.NO_APP_ID]:\n 'The \"appId\" field is empty in the local Firebase config. Firebase Analytics requires this field to' +\n 'contain a valid app ID.',\n [AnalyticsError.NO_CLIENT_ID]: 'The \"client_id\" field is empty.',\n [AnalyticsError.INVALID_GTAG_RESOURCE]:\n 'Trusted Types detected an invalid gtag resource: {$gtagURL}.'\n};\n\ninterface ErrorParams {\n [AnalyticsError.ALREADY_EXISTS]: { id: string };\n [AnalyticsError.INTEROP_COMPONENT_REG_FAILED]: { reason: Error };\n [AnalyticsError.FETCH_THROTTLE]: { throttleEndTimeMillis: number };\n [AnalyticsError.CONFIG_FETCH_FAILED]: {\n httpStatus: number;\n responseMessage: string;\n };\n [AnalyticsError.INVALID_ANALYTICS_CONTEXT]: { errorInfo: string };\n [AnalyticsError.INDEXEDDB_UNAVAILABLE]: { errorInfo: string };\n [AnalyticsError.INVALID_GTAG_RESOURCE]: { gtagURL: string };\n}\n\nexport const ERROR_FACTORY = new ErrorFactory<AnalyticsError, ErrorParams>(\n 'analytics',\n 'Analytics',\n ERRORS\n);\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CustomParams,\n ControlParams,\n EventParams,\n ConsentSettings\n} from './public-types';\nimport { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types';\nimport { GtagCommand, GTAG_URL } from './constants';\nimport { logger } from './logger';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\n\n// Possible parameter types for gtag 'event' and 'config' commands\ntype GtagConfigOrEventParams = ControlParams & EventParams & CustomParams;\n\n/**\n * Verifies and creates a TrustedScriptURL.\n */\nexport function createGtagTrustedTypesScriptURL(url: string): string {\n if (!url.startsWith(GTAG_URL)) {\n const err = ERROR_FACTORY.create(AnalyticsError.INVALID_GTAG_RESOURCE, {\n gtagURL: url\n });\n logger.warn(err.message);\n return '';\n }\n return url;\n}\n\n/**\n * Makeshift polyfill for Promise.allSettled(). Resolves when all promises\n * have either resolved or rejected.\n *\n * @param promises Array of promises to wait for.\n */\nexport function promiseAllSettled<T>(\n promises: Array<Promise<T>>\n): Promise<T[]> {\n return Promise.all(promises.map(promise => promise.catch(e => e)));\n}\n\n/**\n * Creates a TrustedTypePolicy object that implements the rules passed as policyOptions.\n *\n * @param policyName A string containing the name of the policy\n * @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods\n * | the TrustedTypePolicy reference documentation}.\n */\nexport function createTrustedTypesPolicy(\n policyName: string,\n policyOptions: Partial<TrustedTypePolicyOptions>\n): Partial<TrustedTypePolicy> | undefined {\n // Create a TrustedTypes policy that we can use for updating src\n // properties\n let trustedTypesPolicy: Partial<TrustedTypePolicy> | undefined;\n if (window.trustedTypes) {\n trustedTypesPolicy = window.trustedTypes.createPolicy(\n policyName,\n policyOptions\n );\n }\n return trustedTypesPolicy;\n}\n\n/**\n * Inserts gtag script tag into the page to asynchronously download gtag.\n * @param dataLayerName Name of datalayer (most often the default, \"_dataLayer\").\n */\nexport function insertScriptTag(\n dataLayerName: string,\n measurementId: string\n): void {\n const trustedTypesPolicy = createTrustedTypesPolicy(\n 'firebase-js-sdk-policy',\n {\n createScriptURL: createGtagTrustedTypesScriptURL\n }\n );\n\n const script = document.createElement('script');\n // We are not providing an analyticsId in the URL because it would trigger a `page_view`\n // without fid. We will initialize ga-id using gtag (config) command together with fid.\n\n const gtagScriptURL = `${GTAG_URL}?l=${dataLayerName}&id=${measurementId}`;\n (script.src as string | TrustedScriptURL) = trustedTypesPolicy\n ? (trustedTypesPolicy as TrustedTypePolicy)?.createScriptURL(gtagScriptURL)\n : gtagScriptURL;\n\n script.async = true;\n document.head.appendChild(script);\n}\n\n/**\n * Get reference to, or create, global datalayer.\n * @param dataLayerName Name of datalayer (most often the default, \"_dataLayer\").\n */\nexport function getOrCreateDataLayer(dataLayerName: string): DataLayer {\n // Check for existing dataLayer and create if needed.\n let dataLayer: DataLayer = [];\n if (Array.isArray(window[dataLayerName])) {\n dataLayer = window[dataLayerName] as DataLayer;\n } else {\n window[dataLayerName] = dataLayer;\n }\n return dataLayer;\n}\n\n/**\n * Wrapped gtag logic when gtag is called with 'config' command.\n *\n * @param gtagCore Basic gtag function that just appends to dataLayer.\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\n * @param measurementId GA Measurement ID to set config for.\n * @param gtagParams Gtag config params to set.\n */\nasync function gtagOnConfig(\n gtagCore: Gtag,\n initializationPromisesMap: { [appId: string]: Promise<string> },\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementIdToAppId: { [measurementId: string]: string },\n measurementId: string,\n gtagParams?: ControlParams & EventParams & CustomParams\n): Promise<void> {\n // If config is already fetched, we know the appId and can use it to look up what FID promise we\n /// are waiting for, and wait only on that one.\n const correspondingAppId = measurementIdToAppId[measurementId as string];\n try {\n if (correspondingAppId) {\n await initializationPromisesMap[correspondingAppId];\n } else {\n // If config is not fetched yet, wait for all configs (we don't know which one we need) and\n // find the appId (if any) corresponding to this measurementId. If there is one, wait on\n // that appId's initialization promise. If there is none, promise resolves and gtag\n // call goes through.\n const dynamicConfigResults = await promiseAllSettled(\n dynamicConfigPromisesList\n );\n const foundConfig = dynamicConfigResults.find(\n config => config.measurementId === measurementId\n );\n if (foundConfig) {\n await initializationPromisesMap[foundConfig.appId];\n }\n }\n } catch (e) {\n logger.error(e);\n }\n gtagCore(GtagCommand.CONFIG, measurementId, gtagParams);\n}\n\n/**\n * Wrapped gtag logic when gtag is called with 'event' command.\n *\n * @param gtagCore Basic gtag function that just appends to dataLayer.\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementId GA Measurement ID to log event to.\n * @param gtagParams Params to log with this event.\n */\nasync function gtagOnEvent(\n gtagCore: Gtag,\n initializationPromisesMap: { [appId: string]: Promise<string> },\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementId: string,\n gtagParams?: ControlParams & EventParams & CustomParams\n): Promise<void> {\n try {\n let initializationPromisesToWaitFor: Array<Promise<string>> = [];\n\n // If there's a 'send_to' param, check if any ID specified matches\n // an initializeIds() promise we are waiting for.\n if (gtagParams && gtagParams['send_to']) {\n let gaSendToList: string | string[] = gtagParams['send_to'];\n // Make it an array if is isn't, so it can be dealt with the same way.\n if (!Array.isArray(gaSendToList)) {\n gaSendToList = [gaSendToList];\n }\n // Checking 'send_to' fields requires having all measurement ID results back from\n // the dynamic config fetch.\n const dynamicConfigResults = await promiseAllSettled(\n dynamicConfigPromisesList\n );\n for (const sendToId of gaSendToList) {\n // Any fetched dynamic measurement ID that matches this 'send_to' ID\n const foundConfig = dynamicConfigResults.find(\n config => config.measurementId === sendToId\n );\n const initializationPromise =\n foundConfig && initializationPromisesMap[foundConfig.appId];\n if (initializationPromise) {\n initializationPromisesToWaitFor.push(initializationPromise);\n } else {\n // Found an item in 'send_to' that is not associated\n // directly with an FID, possibly a group. Empty this array,\n // exit the loop early, and let it get populated below.\n initializationPromisesToWaitFor = [];\n break;\n }\n }\n }\n\n // This will be unpopulated if there was no 'send_to' field , or\n // if not all entries in the 'send_to' field could be mapped to\n // a FID. In these cases, wait on all pending initialization promises.\n if (initializationPromisesToWaitFor.length === 0) {\n /* eslint-disable-next-line @typescript-eslint/no-floating-promises */\n initializationPromisesToWaitFor = Object.values(\n initializationPromisesMap\n );\n }\n\n // Run core gtag function with args after all relevant initialization\n // promises have been resolved.\n await Promise.all(initializationPromisesToWaitFor);\n // Workaround for http://b/141370449 - third argument cannot be undefined.\n gtagCore(GtagCommand.EVENT, measurementId, gtagParams || {});\n } catch (e) {\n logger.error(e);\n }\n}\n\n/**\n * Wraps a standard gtag function with extra code to wait for completion of\n * relevant initialization promises before sending requests.\n *\n * @param gtagCore Basic gtag function that just appends to dataLayer.\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\n */\nfunction wrapGtag(\n gtagCore: Gtag,\n /**\n * Allows wrapped gtag calls to wait on whichever initialization promises are required,\n * depending on the contents of the gtag params' `send_to` field, if any.\n */\n initializationPromisesMap: { [appId: string]: Promise<string> },\n /**\n * Wrapped gtag calls sometimes require all dynamic config fetches to have returned\n * before determining what initialization promises (which include FIDs) to wait for.\n */\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n /**\n * Wrapped gtag config calls can narrow down which initialization promise (with FID)\n * to wait for if the measurementId is already fetched, by getting the corresponding appId,\n * which is the key for the initialization promises map.\n */\n measurementIdToAppId: { [measurementId: string]: string }\n): Gtag {\n /**\n * Wrapper around gtag that ensures FID is sent with gtag calls.\n * @param command Gtag command type.\n * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET.\n * @param gtagParams Params if event is EVENT/CONFIG.\n */\n async function gtagWrapper(\n command: 'config' | 'set' | 'event' | 'consent' | 'get' | string,\n ...args: unknown[]\n ): Promise<void> {\n try {\n // If event, check that relevant initialization promises have completed.\n if (command === GtagCommand.EVENT) {\n const [measurementId, gtagParams] = args;\n // If EVENT, second arg must be measurementId.\n await gtagOnEvent(\n gtagCore,\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementId as string,\n gtagParams as GtagConfigOrEventParams\n );\n } else if (command === GtagCommand.CONFIG) {\n const [measurementId, gtagParams] = args;\n // If CONFIG, second arg must be measurementId.\n await gtagOnConfig(\n gtagCore,\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementIdToAppId,\n measurementId as string,\n gtagParams as GtagConfigOrEventParams\n );\n } else if (command === GtagCommand.CONSENT) {\n const [consentAction, gtagParams] = args;\n // consentAction can be one of 'default' or 'update'.\n gtagCore(\n GtagCommand.CONSENT,\n consentAction,\n gtagParams as ConsentSettings\n );\n } else if (command === GtagCommand.GET) {\n const [measurementId, fieldName, callback] = args;\n gtagCore(\n GtagCommand.GET,\n measurementId as string,\n fieldName as string,\n callback as (...args: unknown[]) => void\n );\n } else if (command === GtagCommand.SET) {\n const [customParams] = args;\n // If SET, second arg must be params.\n gtagCore(GtagCommand.SET, customParams as CustomParams);\n } else {\n gtagCore(command, ...args);\n }\n } catch (e) {\n logger.error(e);\n }\n }\n return gtagWrapper as Gtag;\n}\n\n/**\n * Creates global gtag function or wraps existing one if found.\n * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and\n * 'event' calls that belong to the GAID associated with this Firebase instance.\n *\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\n * @param dataLayerName Name of global GA datalayer array.\n * @param gtagFunctionName Name of global gtag function (\"gtag\" if not user-specified).\n */\nexport function wrapOrCreateGtag(\n initializationPromisesMap: { [appId: string]: Promise<string> },\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementIdToAppId: { [measurementId: string]: string },\n dataLayerName: string,\n gtagFunctionName: string\n): {\n gtagCore: Gtag;\n wrappedGtag: Gtag;\n} {\n // Create a basic core gtag function\n let gtagCore: Gtag = function (..._args: unknown[]) {\n // Must push IArguments object, not an array.\n (window[dataLayerName] as DataLayer).push(arguments);\n };\n\n // Replace it with existing one if found\n if (\n window[gtagFunctionName] &&\n typeof window[gtagFunctionName] === 'function'\n ) {\n // @ts-ignore\n gtagCore = window[gtagFunctionName];\n }\n\n window[gtagFunctionName] = wrapGtag(\n gtagCore,\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementIdToAppId\n );\n\n return {\n gtagCore,\n wrappedGtag: window[gtagFunctionName] as Gtag\n };\n}\n\n/**\n * Returns the script tag in the DOM matching both the gtag url pattern\n * and the provided data layer name.\n */\nexport function findGtagScriptOnPage(\n dataLayerName: string\n): HTMLScriptElement | null {\n const scriptTags = window.document.getElementsByTagName('script');\n for (const tag of Object.values(scriptTags)) {\n if (\n tag.src &&\n tag.src.includes(GTAG_URL) &&\n tag.src.includes(dataLayerName)\n ) {\n return tag;\n }\n }\n return null;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types';\nimport { FirebaseError, calculateBackoffMillis } from '@firebase/util';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\nimport { DYNAMIC_CONFIG_URL, FETCH_TIMEOUT_MILLIS } from './constants';\nimport { logger } from './logger';\n\n// App config fields needed by analytics.\nexport interface AppFields {\n appId: string;\n apiKey: string;\n measurementId?: string;\n}\n\n/**\n * Backoff factor for 503 errors, which we want to be conservative about\n * to avoid overloading servers. Each retry interval will be\n * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one\n * will be ~30 seconds (with fuzzing).\n */\nexport const LONG_RETRY_FACTOR = 30;\n\n/**\n * Base wait interval to multiplied by backoffFactor^backoffCount.\n */\nconst BASE_INTERVAL_MILLIS = 1000;\n\n/**\n * Stubbable retry data storage class.\n */\nclass RetryData {\n constructor(\n public throttleMetadata: { [appId: string]: ThrottleMetadata } = {},\n public intervalMillis: number = BASE_INTERVAL_MILLIS\n ) {}\n\n getThrottleMetadata(appId: string): ThrottleMetadata {\n return this.throttleMetadata[appId];\n }\n\n setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void {\n this.throttleMetadata[appId] = metadata;\n }\n\n deleteThrottleMetadata(appId: string): void {\n delete this.throttleMetadata[appId];\n }\n}\n\nconst defaultRetryData = new RetryData();\n\n/**\n * Set GET request headers.\n * @param apiKey App API key.\n */\nfunction getHeaders(apiKey: string): Headers {\n return new Headers({\n Accept: 'application/json',\n 'x-goog-api-key': apiKey\n });\n}\n\n/**\n * Fetches dynamic config from backend.\n * @param app Firebase app to fetch config for.\n */\nexport async function fetchDynamicConfig(\n appFields: AppFields\n): Promise<DynamicConfig> {\n const { appId, apiKey } = appFields;\n const request: RequestInit = {\n method: 'GET',\n headers: getHeaders(apiKey)\n };\n const appUrl = DYNAMIC_CONFIG_URL.replace('{app-id}', appId);\n const response = await fetch(appUrl, request);\n if (response.status !== 200 && response.status !== 304) {\n let errorMessage = '';\n try {\n // Try to get any error message text from server response.\n const jsonResponse = (await response.json()) as {\n error?: { message?: string };\n };\n if (jsonResponse.error?.message) {\n errorMessage = jsonResponse.error.message;\n }\n } catch (_ignored) {}\n throw ERROR_FACTORY.create(AnalyticsError.CONFIG_FETCH_FAILED, {\n httpStatus: response.status,\n responseMessage: errorMessage\n });\n }\n return response.json();\n}\n\n/**\n * Fetches dynamic config from backend, retrying if failed.\n * @param app Firebase app to fetch config for.\n */\nexport async function fetchDynamicConfigWithRetry(\n app: FirebaseApp,\n // retryData and timeoutMillis are parameterized to allow passing a different value for testing.\n retryData: RetryData = defaultRetryData,\n timeoutMillis?: number\n): Promise<DynamicConfig | MinimalDynamicConfig> {\n const { appId, apiKey, measurementId } = app.options;\n\n if (!appId) {\n throw ERROR_FACTORY.create(AnalyticsError.NO_APP_ID);\n }\n\n if (!apiKey) {\n if (measurementId) {\n return {\n measurementId,\n appId\n };\n }\n throw ERROR_FACTORY.create(AnalyticsError.NO_API_KEY);\n }\n\n const throttleMetadata: ThrottleMetadata = retryData.getThrottleMetadata(\n appId\n ) || {\n backoffCount: 0,\n throttleEndTimeMillis: Date.now()\n };\n\n const signal = new AnalyticsAbortSignal();\n\n setTimeout(\n async () => {\n // Note a very low delay, eg < 10ms, can elapse before listeners are initialized.\n signal.abort();\n },\n timeoutMillis !== undefined ? timeoutMillis : FETCH_TIMEOUT_MILLIS\n );\n\n return attemptFetchDynamicConfigWithRetry(\n { appId, apiKey, measurementId },\n throttleMetadata,\n signal,\n retryData\n );\n}\n\n/**\n * Runs one retry attempt.\n * @param appFields Necessary app config fields.\n * @param throttleMetadata Ongoing metadata to determine throttling times.\n * @param signal Abort signal.\n */\nasync function attemptFetchDynamicConfigWithRetry(\n appFields: AppFields,\n { throttleEndTimeMillis, backoffCount }: ThrottleMetadata,\n signal: AnalyticsAbortSignal,\n retryData: RetryData = defaultRetryData // for testing\n): Promise<DynamicConfig | MinimalDynamicConfig> {\n const { appId, measurementId } = appFields;\n // Starts with a (potentially zero) timeout to support resumption from stored state.\n // Ensures the throttle end time is honored if the last attempt timed out.\n // Note the SDK will never make a request if the fetch timeout expires at this point.\n try {\n await setAbortableTimeout(signal, throttleEndTimeMillis);\n } catch (e) {\n if (measurementId) {\n logger.warn(\n `Timed out fetching this Firebase app's measurement ID from the server.` +\n ` Falling back to the measurement ID ${measurementId}` +\n ` provided in the \"measurementId\" field in the local Firebase config. [${\n (e as Error)?.message\n }]`\n );\n return { appId, measurementId };\n }\n throw e;\n }\n\n try {\n const response = await fetchDynamicConfig(appFields);\n\n // Note the SDK only clears throttle state if response is success or non-retriable.\n retryData.deleteThrottleMetadata(appId);\n\n return response;\n } catch (e) {\n const error = e as Error;\n if (!isRetriableError(error)) {\n retryData.deleteThrottleMetadata(appId);\n if (measurementId) {\n logger.warn(\n `Failed to fetch this Firebase app's measurement ID from the server.` +\n ` Falling back to the measurement ID ${measurementId}` +\n ` provided in the \"measurementId\" field in the local Firebase config. [${error?.message}]`\n );\n return { appId, measurementId };\n } else {\n throw e;\n }\n }\n\n const backoffMillis =\n Number(error?.customData?.httpStatus) === 503\n ? calculateBackoffMillis(\n backoffCount,\n retryData.intervalMillis,\n LONG_RETRY_FACTOR\n )\n : calculateBackoffMillis(backoffCount, retryData.intervalMillis);\n\n // Increments backoff state.\n const throttleMetadata = {\n throttleEndTimeMillis: Date.now() + backoffMillis,\n backoffCount: backoffCount + 1\n };\n\n // Persists state.\n retryData.setThrottleMetadata(appId, throttleMetadata);\n logger.debug(`Calling attemptFetch again in ${backoffMillis} millis`);\n\n return attemptFetchDynamicConfigWithRetry(\n appFields,\n throttleMetadata,\n signal,\n retryData\n );\n }\n}\n\n/**\n * Supports waiting on a backoff by:\n *\n * <ul>\n * <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li>\n * <li>Listening on a signal bus for abort events, just like the Fetch API</li>\n * <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled\n * request appear the same.</li>\n * </ul>\n *\n * <p>Visible for testing.\n */\nfunction setAbortableTimeout(\n signal: AnalyticsAbortSignal,\n throttleEndTimeMillis: number\n): Promise<void> {\n return new Promise((resolve, reject) => {\n // Derives backoff from given end time, normalizing negative numbers to zero.\n const backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0);\n\n const timeout = setTimeout(resolve, backoffMillis);\n\n // Adds listener, rather than sets onabort, because signal is a shared object.\n signal.addEventListener(() => {\n clearTimeout(timeout);\n // If the request completes before this timeout, the rejection has no effect.\n reject(\n ERROR_FACTORY.create(AnalyticsError.FETCH_THROTTLE, {\n throttleEndTimeMillis\n })\n );\n });\n });\n}\n\ntype RetriableError = FirebaseError & { customData: { httpStatus: string } };\n\n/**\n * Returns true if the {@link Error} indicates a fetch request may succeed later.\n */\nfunction isRetriableError(e: Error): e is RetriableError {\n if (!(e instanceof FirebaseError) || !e.customData) {\n return false;\n }\n\n // Uses string index defined by ErrorData, which FirebaseError implements.\n const httpStatus = Number(e.customData['httpStatus']);\n\n return (\n httpStatus === 429 ||\n httpStatus === 500 ||\n httpStatus === 503 ||\n httpStatus === 504\n );\n}\n\n/**\n * Shims a minimal AbortSignal (copied from Remote Config).\n *\n * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects\n * of networking, such as retries. Firebase doesn't use AbortController enough to justify a\n * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be\n * swapped out if/when we do.\n */\nexport class AnalyticsAbortSignal {\n listeners: Array<() => void> = [];\n addEventListener(listener: () => void): void {\n this.listeners.push(listener);\n }\n abort(): void {\n this.listeners.forEach(listener => listener());\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AnalyticsCallOptions,\n CustomParams,\n ControlParams,\n EventParams,\n ConsentSettings\n} from './public-types';\nimport { Gtag } from './types';\nimport { GtagCommand } from './constants';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\n\n/**\n * Event parameters to set on 'gtag' during initialization.\n */\nexport let defaultEventParametersForInit: CustomParams | undefined;\n\n/**\n * Logs an analytics event through the Firebase SDK.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param eventName Google Analytics event name, choose from standard list or use a custom string.\n * @param eventParams Analytics event parameters.\n */\nexport async function logEvent(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n eventName: string,\n eventParams?: EventParams,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n gtagFunction(GtagCommand.EVENT, eventName, eventParams);\n return;\n } else {\n const measurementId = await initializationPromise;\n const params: EventParams | ControlParams = {\n ...eventParams,\n 'send_to': measurementId\n };\n gtagFunction(GtagCommand.EVENT, eventName, params);\n }\n}\n\n/**\n * Set screen_name parameter for this Google Analytics ID.\n *\n * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.\n * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param screenName Screen name string to set.\n */\nexport async function setCurrentScreen(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n screenName: string | null,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n gtagFunction(GtagCommand.SET, { 'screen_name': screenName });\n return Promise.resolve();\n } else {\n const measurementId = await initializationPromise;\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'screen_name': screenName\n });\n }\n}\n\n/**\n * Set user_id parameter for this Google Analytics ID.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param id User ID string to set\n */\nexport async function setUserId(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n id: string | null,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n gtagFunction(GtagCommand.SET, { 'user_id': id });\n return Promise.resolve();\n } else {\n const measurementId = await initializationPromise;\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'user_id': id\n });\n }\n}\n\n/**\n * Set all other user properties other than user_id and screen_name.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param properties Map of user properties to set\n */\nexport async function setUserProperties(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n properties: CustomParams,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n const flatProperties: { [key: string]: unknown } = {};\n for (const key of Object.keys(properties)) {\n // use dot notation for merge behavior in gtag.js\n flatProperties[`user_properties.${key}`] = properties[key];\n }\n gtagFunction(GtagCommand.SET, flatProperties);\n return Promise.resolve();\n } else {\n const measurementId = await initializationPromise;\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'user_properties': properties\n });\n }\n}\n\n/**\n * Retrieves a unique Google Analytics identifier for the web client.\n * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n */\nexport async function internalGetGoogleAnalyticsClientId(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>\n): Promise<string> {\n const measurementId = await initializationPromise;\n return new Promise((resolve, reject) => {\n gtagFunction(\n GtagCommand.GET,\n measurementId,\n 'client_id',\n (clientId: string) => {\n if (!clientId) {\n reject(ERROR_FACTORY.create(AnalyticsError.NO_CLIENT_ID));\n }\n resolve(clientId);\n }\n );\n });\n}\n\n/**\n * Set whether collection is enabled for this ID.\n *\n * @param enabled If true, collection is enabled for this ID.\n */\nexport async function setAnalyticsCollectionEnabled(\n initializationPromise: Promise<string>,\n enabled: boolean\n): Promise<void> {\n const measurementId = await initializationPromise;\n window[`ga-disable-${measurementId}`] = !enabled;\n}\n\n/**\n * Consent parameters to default to during 'gtag' initialization.\n */\nexport let defaultConsentSettingsForInit: ConsentSettings | undefined;\n\n/**\n * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of\n * analytics.\n *\n * @param consentSettings Maps the applicable end user consent state for gtag.js.\n */\nexport function _setConsentDefaultForInit(\n consentSettings?: ConsentSettings\n): void {\n defaultConsentSettingsForInit = consentSettings;\n}\n\n/**\n * Sets the variable `defaultEventParametersForInit` for use in the initialization of\n * analytics.\n *\n * @param customParams Any custom params the user may pass to gtag.js.\n */\nexport function _setDefaultEventParametersForInit(\n customParams?: CustomParams\n): void {\n defaultEventParametersForInit = customParams;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DynamicConfig, Gtag, MinimalDynamicConfig } from './types';\nimport { GtagCommand, GA_FID_KEY, ORIGIN_KEY } from './constants';\nimport { _FirebaseInstallationsInternal } from '@firebase/installations';\nimport { fetchDynamicConfigWithRetry } from './get-config';\nimport { logger } from './logger';\nimport { FirebaseApp } from '@firebase/app';\nimport {\n isIndexedDBAvailable,\n validateIndexedDBOpenable\n} from '@firebase/util';\nimport { ERROR_FACTORY, AnalyticsError } from './errors';\nimport { findGtagScriptOnPage, insertScriptTag } from './helpers';\nimport { AnalyticsSettings } from './public-types';\nimport {\n defaultConsentSettingsForInit,\n _setConsentDefaultForInit,\n defaultEventParametersForInit,\n _setDefaultEventParametersForInit\n} from './functions';\n\nasync function validateIndexedDB(): Promise<boolean> {\n if (!isIndexedDBAvailable()) {\n logger.warn(\n ERROR_FACTORY.create(AnalyticsError.INDEXEDDB_UNAVAILABLE, {\n errorInfo: 'IndexedDB is not available in this environment.'\n }).message\n );\n return false;\n } else {\n try {\n await validateIndexedDBOpenable();\n } catch (e) {\n logger.warn(\n ERROR_FACTORY.create(AnalyticsError.INDEXEDDB_UNAVAILABLE, {\n errorInfo: (e as Error)?.toString()\n }).message\n );\n return false;\n }\n }\n return true;\n}\n\n/**\n * Initialize the analytics instance in gtag.js by calling config command with fid.\n *\n * NOTE: We combine analytics initialization and setting fid together because we want fid to be\n * part of the `page_view` event that's sent during the initialization\n * @param app Firebase app\n * @param gtagCore The gtag function that's not wrapped.\n * @param dynamicConfigPromisesList Array of all dynamic config promises.\n * @param measurementIdToAppId Maps measurementID to appID.\n * @param installations _FirebaseInstallationsInternal instance.\n *\n * @returns Measurement ID.\n */\nexport async function _initializeAnalytics(\n app: FirebaseApp,\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementIdToAppId: { [key: string]: string },\n installations: _FirebaseInstallationsInternal,\n gtagCore: Gtag,\n dataLayerName: string,\n options?: AnalyticsSettings\n): Promise<string> {\n const dynamicConfigPromise = fetchDynamicConfigWithRetry(app);\n // Once fetched, map measurementIds to appId, for ease of lookup in wrapped gtag function.\n dynamicConfigPromise\n .then(config => {\n measurementIdToAppId[config.measurementId] = config.appId;\n if (\n app.options.measurementId &&\n config.measurementId !== app.options.measurementId\n ) {\n logger.warn(\n `The measurement ID in the local Firebase config (${app.options.measurementId})` +\n ` does not match the measurement ID fetched from the server (${config.measurementId}).` +\n ` To ensure analytics events are always sent to the correct Analytics property,` +\n ` update the` +\n ` measurement ID field in the local config or remove it from the local config.`\n );\n }\n })\n .catch(e => logger.error(e));\n // Add to list to track state of all dynamic config promises.\n dynamicConfigPromisesList.push(dynamicConfigPromise);\n\n const fidPromise: Promise<string | undefined> = validateIndexedDB().then(\n envIsValid => {\n if (envIsValid) {\n return installations.getId();\n } else {\n return undefined;\n }\n }\n );\n\n const [dynamicConfig, fid] = await Promise.all([\n dynamicConfigPromise,\n fidPromise\n ]);\n\n // Detect if user has already put the gtag <script> tag on this page with the passed in\n // data layer name.\n if (!findGtagScriptOnPage(dataLayerName)) {\n insertScriptTag(dataLayerName, dynamicConfig.measurementId);\n }\n\n // Detects if there are consent settings that need to be configured.\n if (defaultConsentSettingsForInit) {\n gtagCore(GtagCommand.CONSENT, 'default', defaultConsentSettingsForInit);\n _setConsentDefaultForInit(undefined);\n }\n\n // This command initializes gtag.js and only needs to be called once for the entire web app,\n // but since it is idempotent, we can call it multiple times.\n // We keep it together with other initialization logic for better code structure.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (gtagCore as any)('js', new Date());\n // User config added first. We don't want users to accidentally overwrite\n // base Firebase config properties.\n const configProperties: Record<string, unknown> = options?.config ?? {};\n\n // guard against developers accidentally setting properties with prefix `firebase_`\n configProperties[ORIGIN_KEY] = 'firebase';\n configProperties.update = true;\n\n if (fid != null) {\n configProperties[GA_FID_KEY] = fid;\n }\n\n // It should be the first config command called on this GA-ID\n // Initialize this GA-ID and set FID on it using the gtag config API.\n // Note: This will trigger a page_view event unless 'send_page_view' is set to false in\n // `configProperties`.\n gtagCore(GtagCommand.CONFIG, dynamicConfig.measurementId, configProperties);\n\n // Detects if there is data that will be set on every event logged from the SDK.\n if (defaultEventParametersForInit) {\n gtagCore(GtagCommand.SET, defaultEventParametersForInit);\n _setDefaultEventParametersForInit(undefined);\n }\n\n return dynamicConfig.measurementId;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SettingsOptions, Analytics, AnalyticsSettings } from './public-types';\nimport { Gtag, DynamicConfig, MinimalDynamicConfig } from './types';\nimport { getOrCreateDataLayer, wrapOrCreateGtag } from './helpers';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\nimport { _FirebaseInstallationsInternal } from '@firebase/installations';\nimport { areCookiesEnabled, isBrowserExtension } from '@firebase/util';\nimport { _initializeAnalytics } from './initialize-analytics';\nimport { logger } from './logger';\nimport { FirebaseApp, _FirebaseService } from '@firebase/app';\n\n/**\n * Analytics Service class.\n */\nexport class AnalyticsService implements Analytics, _FirebaseService {\n constructor(public app: FirebaseApp) {}\n _delete(): Promise<void> {\n delete initializationPromisesMap[this.app.options.appId!];\n return Promise.resolve();\n }\n}\n\n/**\n * Maps appId to full initialization promise. Wrapped gtag calls must wait on\n * all or some of these, depending on the call's `send_to` param and the status\n * of the dynamic config fetches (see below).\n */\nexport let initializationPromisesMap: {\n [appId: string]: Promise<string>; // Promise contains measurement ID string.\n} = {};\n\n/**\n * List of dynamic config fetch promises. In certain cases, wrapped gtag calls\n * wait on all these to be complete in order to determine if it can selectively\n * wait for only certain initialization (FID) promises or if it must wait for all.\n */\nlet dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n> = [];\n\n/**\n * Maps fetched measurementIds to appId. Populated when the app's dynamic config\n * fetch completes. If already populated, gtag config calls can use this to\n * selectively wait for only this app's initialization promise (FID) instead of all\n * initialization promises.\n */\nconst measurementIdToAppId: { [measurementId: string]: string } = {};\n\n/**\n * Name for window global data layer array used by GA: defaults to 'dataLayer'.\n */\nlet dataLayerName: string = 'dataLayer';\n\n/**\n * Name for window global gtag function used by GA: defaults to 'gtag'.\n */\nlet gtagName: string = 'gtag';\n\n/**\n * Reproduction of standard gtag function or reference to existing\n * gtag function on window object.\n */\nlet gtagCoreFunction: Gtag;\n\n/**\n * Wrapper around gtag function that ensures FID is sent with all\n * relevant event and config calls.\n */\nexport let wrappedGtagFunction: Gtag;\n\n/**\n * Flag to ensure page initialization steps (creation or wrapping of\n * dataLayer and gtag script) are only run once per page load.\n */\nlet globalInitDone: boolean = false;\n\n/**\n * For testing\n * @internal\n */\nexport function resetGlobalVars(\n newGlobalInitDone = false,\n newInitializationPromisesMap = {},\n newDynamicPromises = []\n): void {\n globalInitDone = newGlobalInitDone;\n initializationPromisesMap = newInitializationPromisesMap;\n dynamicConfigPromisesList = newDynamicPromises;\n dataLayerName = 'dataLayer';\n gtagName = 'gtag';\n}\n\n/**\n * For testing\n * @internal\n */\nexport function getGlobalVars(): {\n initializationPromisesMap: { [appId: string]: Promise<string> };\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >;\n} {\n return {\n initializationPromisesMap,\n dynamicConfigPromisesList\n };\n}\n\n/**\n * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.\n * Intended to be used if `gtag.js` script has been installed on\n * this page independently of Firebase Analytics, and is using non-default\n * names for either the `gtag` function or for `dataLayer`.\n * Must be called before calling `getAnalytics()` or it won't\n * have any effect.\n *\n * @public\n *\n * @param options - Custom gtag and dataLayer names.\n */\nexport function settings(options: SettingsOptions): void {\n if (globalInitDone) {\n throw ERROR_FACTORY.create(AnalyticsError.ALREADY_INITIALIZED);\n }\n if (options.dataLayerName) {\n dataLayerName = options.dataLayerName;\n }\n if (options.gtagName) {\n gtagName = options.gtagName;\n }\n}\n\n/**\n * Returns true if no environment mismatch is found.\n * If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT\n * error that also lists details for each mismatch found.\n */\nfunction warnOnBrowserContextMismatch(): void {\n const mismatchedEnvMessages = [];\n if (isBrowserExtension()) {\n mismatchedEnvMessages.push('This is a browser extension environment.');\n }\n if (!areCookiesEnabled()) {\n mismatchedEnvMessages.push('Cookies are not available.');\n }\n if (mismatchedEnvMessages.length > 0) {\n const details = mismatchedEnvMessages\n .map((message, index) => `(${index + 1}) ${message}`)\n .join(' ');\n const err = ERROR_FACTORY.create(AnalyticsError.INVALID_ANALYTICS_CONTEXT, {\n errorInfo: details\n });\n logger.warn(err.message);\n }\n}\n\n/**\n * Analytics instance factory.\n * @internal\n */\nexport function factory(\n app: FirebaseApp,\n installations: _FirebaseInstallationsInternal,\n options?: AnalyticsSettings\n): AnalyticsService {\n warnOnBrowserContextMismatch();\n const appId = app.options.appId;\n if (!appId) {\n throw ERROR_FACTORY.create(AnalyticsError.NO_APP_ID);\n }\n if (!app.options.apiKey) {\n if (app.options.measurementId) {\n logger.warn(\n `The \"apiKey\" field is empty in the local Firebase config. This is needed to fetch the latest` +\n ` measurement ID for this Firebase app. Falling back to the measurement ID ${app.options.measurementId}` +\n ` provided in the \"measurementId\" field in the local Firebase config.`\n );\n } else {\n throw ERROR_FACTORY.create(AnalyticsError.NO_API_KEY);\n }\n }\n if (initializationPromisesMap[appId] != null) {\n throw ERROR_FACTORY.create(AnalyticsError.ALREADY_EXISTS, {\n id: appId\n });\n }\n\n if (!globalInitDone) {\n // Steps here should only be done once per page: creation or wrapping\n // of dataLayer and global gtag function.\n\n getOrCreateDataLayer(dataLayerName);\n\n const { wrappedGtag, gtagCore } = wrapOrCreateGtag(\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementIdToAppId,\n dataLayerName,\n gtagName\n );\n wrappedGtagFunction = wrappedGtag;\n gtagCoreFunction = gtagCore;\n\n globalInitDone = true;\n }\n // Async but non-blocking.\n // This map reflects the completion state of all promises for each appId.\n initializationPromisesMap[appId] = _initializeAnalytics(\n app,\n dynamicConfigPromisesList,\n measurementIdToAppId,\n installations,\n gtagCoreFunction,\n dataLayerName,\n options\n );\n\n const analyticsInstance: AnalyticsService = new AnalyticsService(app);\n\n return analyticsInstance;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable camelcase */\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _getProvider, FirebaseApp, getApp } from '@firebase/app';\nimport {\n Analytics,\n AnalyticsCallOptions,\n AnalyticsSettings,\n ConsentSettings,\n CustomParams,\n EventNameString,\n EventParams\n} from './public-types';\nimport { Provider } from '@firebase/component';\nimport {\n isIndexedDBAvailable,\n validateIndexedDBOpenable,\n areCookiesEnabled,\n isBrowserExtension,\n getModularInstance,\n deepEqual\n} from '@firebase/util';\nimport { ANALYTICS_TYPE, GtagCommand } from './constants';\nimport {\n AnalyticsService,\n initializationPromisesMap,\n wrappedGtagFunction\n} from './factory';\nimport { logger } from './logger';\nimport {\n logEvent as internalLogEvent,\n setCurrentScreen as internalSetCurrentScreen,\n setUserId as internalSetUserId,\n setUserProperties as internalSetUserProperties,\n setAnalyticsCollectionEnabled as internalSetAnalyticsCollectionEnabled,\n _setConsentDefaultForInit,\n _setDefaultEventParametersForInit,\n internalGetGoogleAnalyticsClientId\n} from './functions';\nimport { ERROR_FACTORY, AnalyticsError } from './errors';\n\nexport { settings } from './factory';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n [ANALYTICS_TYPE]: AnalyticsService;\n }\n}\n\n/**\n * Returns an {@link Analytics} instance for the given app.\n *\n * @public\n *\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n */\nexport function getAnalytics(app: FirebaseApp = getApp()): Analytics {\n app = getModularInstance(app);\n // Dependencies\n const analyticsProvider: Provider<'analytics'> = _getProvider(\n app,\n ANALYTICS_TYPE\n );\n\n if (analyticsProvider.isInitialized()) {\n return analyticsProvider.getImmediate();\n }\n\n return initializeAnalytics(app);\n}\n\n/**\n * Returns an {@link Analytics} instance for the given app.\n *\n * @public\n *\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n */\nexport function initializeAnalytics(\n app: FirebaseApp,\n options: AnalyticsSettings = {}\n): Analytics {\n // Dependencies\n const analyticsProvider: Provider<'analytics'> = _getProvider(\n app,\n ANALYTICS_TYPE\n );\n if (analyticsProvider.isInitialized()) {\n const existingInstance = analyticsProvider.getImmediate();\n if (deepEqual(options, analyticsProvider.getOptions())) {\n return existingInstance;\n } else {\n throw ERROR_FACTORY.create(AnalyticsError.ALREADY_INITIALIZED);\n }\n }\n const analyticsInstance = analyticsProvider.initialize({ options });\n return analyticsInstance;\n}\n\n/**\n * This is a public static method provided to users that wraps four different checks:\n *\n * 1. Check if it's not a browser extension environment.\n * 2. Check if cookies are enabled in current browser.\n * 3. Check if IndexedDB is supported by the browser environment.\n * 4. Check if the current browser context is valid for using `IndexedDB.open()`.\n *\n * @public\n *\n */\nexport async function isSupported(): Promise<boolean> {\n if (isBrowserExtension()) {\n return false;\n }\n if (!areCookiesEnabled()) {\n return false;\n }\n if (!isIndexedDBAvailable()) {\n return false;\n }\n\n try {\n const isDBOpenable: boolean = await validateIndexedDBOpenable();\n return isDBOpenable;\n } catch (error) {\n return false;\n }\n}\n\n/**\n * Use gtag `config` command to set `screen_name`.\n *\n * @public\n *\n * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.\n * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.\n *\n * @param analyticsInstance - The {@link Analytics} instance.\n * @param screenName - Screen name to set.\n */\nexport function setCurrentScreen(\n analyticsInstance: Analytics,\n screenName: string,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetCurrentScreen(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n screenName,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Retrieves a unique Google Analytics identifier for the web client.\n * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.\n *\n * @public\n *\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n */\nexport async function getGoogleAnalyticsClientId(\n analyticsInstance: Analytics\n): Promise<string> {\n analyticsInstance = getModularInstance(analyticsInstance);\n return internalGetGoogleAnalyticsClientId(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!]\n );\n}\n\n/**\n * Use gtag `config` command to set `user_id`.\n *\n * @public\n *\n * @param analyticsInstance - The {@link Analytics} instance.\n * @param id - User ID to set.\n */\nexport function setUserId(\n analyticsInstance: Analytics,\n id: string | null,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetUserId(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n id,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Use gtag `config` command to set all params specified.\n *\n * @public\n */\nexport function setUserProperties(\n analyticsInstance: Analytics,\n properties: CustomParams,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetUserProperties(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n properties,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Sets whether Google Analytics collection is enabled for this app on this device.\n * Sets global `window['ga-disable-analyticsId'] = true;`\n *\n * @public\n *\n * @param analyticsInstance - The {@link Analytics} instance.\n * @param enabled - If true, enables collection, if false, disables it.\n */\nexport function setAnalyticsCollectionEnabled(\n analyticsInstance: Analytics,\n enabled: boolean\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetAnalyticsCollectionEnabled(\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n enabled\n ).catch(e => logger.error(e));\n}\n\n/**\n * Adds data that will be set on every event logged from the SDK, including automatic ones.\n * With gtag's \"set\" command, the values passed persist on the current page and are passed with\n * all subsequent events.\n * @public\n * @param customParams - Any custom params the user may pass to gtag.js.\n */\nexport function setDefaultEventParameters(customParams: CustomParams): void {\n // Check if reference to existing gtag function on window object exists\n if (wrappedGtagFunction) {\n wrappedGtagFunction(GtagCommand.SET, customParams);\n } else {\n _setDefaultEventParametersForInit(customParams);\n }\n}\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'add_payment_info',\n eventParams?: {\n coupon?: EventParams['coupon'];\n currency?: EventParams['currency'];\n items?: EventParams['items'];\n payment_type?: EventParams['payment_type'];\n value?: EventParams['value'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'add_shipping_info',\n eventParams?: {\n coupon?: EventParams['coupon'];\n currency?: EventParams['currency'];\n items?: EventParams['items'];\n shipping_tier?: EventParams['shipping_tier'];\n value?: EventParams['value'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart',\n eventParams?: {\n currency?: EventParams['currency'];\n value?: EventParams['value'];\n items?: EventParams['items'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'begin_checkout',\n eventParams?: {\n currency?: EventParams['currency'];\n coupon?: EventParams['coupon'];\n value?: EventParams['value'];\n items?: EventParams['items'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'checkout_progress',\n eventParams?: {\n currency?: EventParams['currency'];\n coupon?: EventParams['coupon'];\n value?: EventParams['value'];\n items?: EventParams['items'];\n checkout_step?: EventParams['checkout_step'];\n checkout_option?: EventParams['checkout_option'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * See\n * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions\n * | Measure exceptions}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'exception',\n eventParams?: {\n description?: EventParams['description'];\n fatal?: EventParams['fatal'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'generate_lead',\n eventParams?: {\n value?: EventParams['value'];\n currency?: EventParams['currency'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'login',\n eventParams?: {\n method?: EventParams['method'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * See\n * {@link https://developers.google.com/analytics/devguides/collection/ga4/views\n * | Page views}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'page_view',\n eventParams?: {\n page_title?: string;\n page_location?: string;\n page_path?: string;\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'purchase' | 'refund',\n eventParams?: {\n value?: EventParams['value'];\n currency?: EventParams['currency'];\n transaction_id: EventParams['transaction_id'];\n tax?: EventParams['tax'];\n shipping?: EventParams['shipping'];\n items?: EventParams['items'];\n coupon?: EventParams['coupon'];\n affiliation?: EventParams['affiliation'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * See {@link https://firebase.google.com/docs/analytics/screenviews\n * | Track Screenviews}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'screen_view',\n eventParams?: {\n firebase_screen: EventParams['firebase_screen'];\n firebase_screen_class: EventParams['firebase_screen_class'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'search' | 'view_search_results',\n eventParams?: {\n search_term?: EventParams['search_term'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'select_content',\n eventParams?: {\n content_type?: EventParams['content_type'];\n item_id?: EventParams['item_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'select_item',\n eventParams?: {\n items?: EventParams['items'];\n item_list_name?: EventParams['item_list_name'];\n item_list_id?: EventParams['item_list_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'select_promotion' | 'view_promotion',\n eventParams?: {\n items?: EventParams['items'];\n promotion_id?: EventParams['promotion_id'];\n promotion_name?: EventParams['promotion_name'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'set_checkout_option',\n eventParams?: {\n checkout_step?: EventParams['checkout_step'];\n checkout_option?: EventParams['checkout_option'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'share',\n eventParams?: {\n method?: EventParams['method'];\n content_type?: EventParams['content_type'];\n item_id?: EventParams['item_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'sign_up',\n eventParams?: {\n method?: EventParams['method'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'timing_complete',\n eventParams?: {\n name: string;\n value: number;\n event_category?: string;\n event_label?: string;\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'view_cart' | 'view_item',\n eventParams?: {\n currency?: EventParams['currency'];\n items?: EventParams['items'];\n value?: EventParams['value'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'view_item_list',\n eventParams?: {\n items?: EventParams['items'];\n item_list_name?: EventParams['item_list_name'];\n item_list_id?: EventParams['item_list_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent<T extends string>(\n analyticsInstance: Analytics,\n eventName: CustomEventName<T>,\n eventParams?: { [key: string]: any },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * List of official event parameters can be found in the gtag.js\n * reference documentation:\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n *\n * @public\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: string,\n eventParams?: EventParams,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalLogEvent(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n eventName,\n eventParams,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Any custom event name string not in the standard list of recommended\n * event names.\n * @public\n */\nexport type CustomEventName<T> = T extends EventNameString ? never : T;\n\n/**\n * Sets the applicable end user consent state for this web app across all gtag references once\n * Firebase Analytics is initialized.\n *\n * Use the {@link ConsentSettings} to specify individual consent type values. By default consent\n * types are set to \"granted\".\n * @public\n * @param consentSettings - Maps the applicable end user consent state for gtag.js.\n */\nexport function setConsent(consentSettings: ConsentSettings): void {\n // Check if reference to existing gtag function on window object exists\n if (wrappedGtagFunction) {\n wrappedGtagFunction(GtagCommand.CONSENT, 'update', consentSettings);\n } else {\n _setConsentDefaultForInit(consentSettings);\n }\n}\n","/**\n * The Firebase Analytics Web SDK.\n * This SDK does not work in a Node.js environment.\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { registerVersion, _registerComponent } from '@firebase/app';\nimport { FirebaseAnalyticsInternal } from '@firebase/analytics-interop-types';\nimport { factory } from './factory';\nimport { ANALYTICS_TYPE } from './constants';\nimport {\n Component,\n ComponentType,\n ComponentContainer,\n InstanceFactoryOptions\n} from '@firebase/component';\nimport { ERROR_FACTORY, AnalyticsError } from './errors';\nimport { logEvent, setUserProperties } from './api';\nimport { name, version } from '../package.json';\nimport { AnalyticsCallOptions, CustomParams } from './public-types';\nimport '@firebase/installations';\n\ndeclare global {\n interface Window {\n [key: string]: unknown;\n }\n}\n\nfunction registerAnalytics(): void {\n _registerComponent(\n new Component(\n ANALYTICS_TYPE,\n (container, { options: analyticsOptions }: InstanceFactoryOptions) => {\n // getImmediate for FirebaseApp will always succeed\n const app = container.getProvider('app').getImmediate();\n const installations = container\n .getProvider('installations-internal')\n .getImmediate();\n\n return factory(app, installations, analyticsOptions);\n },\n ComponentType.PUBLIC\n )\n );\n\n _registerComponent(\n new Component('analytics-internal', internalFactory, ComponentType.PRIVATE)\n );\n\n registerVersion(name, version);\n // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n\n function internalFactory(\n container: ComponentContainer\n ): FirebaseAnalyticsInternal {\n try {\n const analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();\n return {\n logEvent: (\n eventName: string,\n eventParams?: { [key: string]: unknown },\n options?: AnalyticsCallOptions\n ) => logEvent(analytics, eventName, eventParams, options),\n setUserProperties: (\n properties: CustomParams,\n options?: AnalyticsCallOptions\n ) => setUserProperties(analytics, properties, options)\n };\n } catch (e) {\n throw ERROR_FACTORY.create(AnalyticsError.INTEROP_COMPONENT_REG_FAILED, {\n reason: e as Error\n });\n }\n }\n}\n\nregisterAnalytics();\n\nexport * from './api';\nexport * from './public-types';\n"],"names":["logEvent","setCurrentScreen","setUserId","setUserProperties","setAnalyticsCollectionEnabled","internalSetCurrentScreen","internalSetUserId","internalSetUserProperties","internalSetAnalyticsCollectionEnabled","internalLogEvent"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAEH;;AAEG;AACI,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C;AACO,MAAM,UAAU,GAAG,aAAa,CAAC;AACjC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvC,MAAM,kBAAkB,GAC7B,4EAA4E,CAAC;AAExE,MAAM,QAAQ,GAAG,0CAA0C;;AC/BlE;;;;;;;;;;;;;;;AAeG;AAII,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,qBAAqB,CAAC;;ACnBvD;;;;;;;;;;;;;;;AAeG;AAmBH,MAAM,MAAM,GAA6B;AACvC,IAAA,CAAA,gBAAA,uCACE,qDAAqD;QACrD,mBAAmB;QACnB,qEAAqE;AACvE,IAAA,CAAA,qBAAA,4CACE,iFAAiF;QACjF,gFAAgF;QAChF,8DAA8D;QAC9D,yDAAyD;AAC3D,IAAA,CAAA,8BAAA,qDACE,kDAAkD;QAClD,sEAAsE;QACtE,4BAA4B;AAC9B,IAAA,CAAA,8BAAA,qDACE,uEAAuE;AACzE,IAAA,CAAA,2BAAA,kDACE,2DAA2D;QAC3D,8DAA8D;QAC9D,8EAA8E;AAChF,IAAA,CAAA,uBAAA,8CACE,2DAA2D;QAC3D,8DAA8D;QAC9D,8EAA8E;AAChF,IAAA,CAAA,gBAAA,uCACE,2EAA2E;QAC3E,+FAA+F;AACjG,IAAA,CAA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CAAC,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,aAAa,GAAG,SAAS;aAC5B,WAAW,CAAC,wBAAwB,CAAC;AACrC,aAAA,YAAY,EAAE,CAAC;QAElB,OAAO,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;KACtD,EAAA,QAAA,4BAEF,CACF,CAAC;IAEF,kBAAkB,CAChB,IAAI,SAAS,CAAC,oBAAoB,EAAE,eAAe,EAAwB,SAAA,6BAAA,CAC5E,CAAC;AAEF,IAAA,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;AAE/B,IAAA,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,SAAkB,CAAC,CAAC;IAEnD,SAAS,eAAe,CACtB,SAA6B,EAAA;AAE7B,QAAA,IAAI;YACF,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,YAAY,EAAE,CAAC;YACvE,OAAO;AACL,gBAAA,QAAQ,EAAE,CACR,SAAiB,EACjB,WAAwC,EACxC,OAA8B,KAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC;AACzD,gBAAA,iBAAiB,EAAE,CACjB,UAAwB,EACxB,OAA8B,KAC3B,iBAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC;aACvD,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,aAAa,CAAC,MAAM,CAA8C,8BAAA,oDAAA;AACtE,gBAAA,MAAM,EAAE,CAAU;AACnB,aAAA,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAED,iBAAiB,EAAE;;;;"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/package.json b/frontend-old/node_modules/@firebase/analytics/dist/esm/package.json new file mode 100644 index 0000000..7c34deb --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/api.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/api.d.ts new file mode 100644 index 0000000..3527276 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/api.d.ts @@ -0,0 +1,453 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, CustomParams, EventNameString, EventParams } from './public-types'; +import { ANALYTICS_TYPE } from './constants'; +import { AnalyticsService } from './factory'; +export { settings } from './factory'; +declare module '@firebase/component' { + interface NameServiceMapping { + [ANALYTICS_TYPE]: AnalyticsService; + } +} +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getAnalytics(app?: FirebaseApp): Analytics; +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics; +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +export declare function isSupported(): Promise<boolean>; +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void; +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>; +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void; +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void; +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void; +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +export declare function setDefaultEventParameters(customParams: CustomParams): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + payment_type?: EventParams['payment_type']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + shipping_tier?: EventParams['shipping_tier']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: { + currency?: EventParams['currency']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions + * | Measure exceptions}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: { + description?: EventParams['description']; + fatal?: EventParams['fatal']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/views + * | Page views}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: { + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + transaction_id: EventParams['transaction_id']; + tax?: EventParams['tax']; + shipping?: EventParams['shipping']; + items?: EventParams['items']; + coupon?: EventParams['coupon']; + affiliation?: EventParams['affiliation']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See {@link https://firebase.google.com/docs/analytics/screenviews + * | Track Screenviews}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: { + firebase_screen: EventParams['firebase_screen']; + firebase_screen_class: EventParams['firebase_screen_class']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: { + search_term?: EventParams['search_term']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: { + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: { + items?: EventParams['items']; + promotion_id?: EventParams['promotion_id']; + promotion_name?: EventParams['promotion_name']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: { + method?: EventParams['method']; + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: { + name: string; + value: number; + event_category?: string; + event_label?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: { + currency?: EventParams['currency']; + items?: EventParams['items']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: { + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Any custom event name string not in the standard list of recommended + * event names. + * @public + */ +export type CustomEventName<T> = T extends EventNameString ? never : T; +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +export declare function setConsent(consentSettings: ConsentSettings): void; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/constants.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/constants.d.ts new file mode 100644 index 0000000..c907c32 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/constants.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Analytics. + */ +export declare const ANALYTICS_TYPE = "analytics"; +export declare const GA_FID_KEY = "firebase_id"; +export declare const ORIGIN_KEY = "origin"; +export declare const FETCH_TIMEOUT_MILLIS: number; +export declare const DYNAMIC_CONFIG_URL = "https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig"; +export declare const GTAG_URL = "https://www.googletagmanager.com/gtag/js"; +export declare const enum GtagCommand { + EVENT = "event", + SET = "set", + CONFIG = "config", + CONSENT = "consent", + GET = "get" +} diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/errors.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/errors.d.ts new file mode 100644 index 0000000..76fc8bf --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/errors.d.ts @@ -0,0 +1,57 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ErrorFactory } from '@firebase/util'; +export declare const enum AnalyticsError { + ALREADY_EXISTS = "already-exists", + ALREADY_INITIALIZED = "already-initialized", + ALREADY_INITIALIZED_SETTINGS = "already-initialized-settings", + INTEROP_COMPONENT_REG_FAILED = "interop-component-reg-failed", + INVALID_ANALYTICS_CONTEXT = "invalid-analytics-context", + INDEXEDDB_UNAVAILABLE = "indexeddb-unavailable", + FETCH_THROTTLE = "fetch-throttle", + CONFIG_FETCH_FAILED = "config-fetch-failed", + NO_API_KEY = "no-api-key", + NO_APP_ID = "no-app-id", + NO_CLIENT_ID = "no-client-id", + INVALID_GTAG_RESOURCE = "invalid-gtag-resource" +} +interface ErrorParams { + [AnalyticsError.ALREADY_EXISTS]: { + id: string; + }; + [AnalyticsError.INTEROP_COMPONENT_REG_FAILED]: { + reason: Error; + }; + [AnalyticsError.FETCH_THROTTLE]: { + throttleEndTimeMillis: number; + }; + [AnalyticsError.CONFIG_FETCH_FAILED]: { + httpStatus: number; + responseMessage: string; + }; + [AnalyticsError.INVALID_ANALYTICS_CONTEXT]: { + errorInfo: string; + }; + [AnalyticsError.INDEXEDDB_UNAVAILABLE]: { + errorInfo: string; + }; + [AnalyticsError.INVALID_GTAG_RESOURCE]: { + gtagURL: string; + }; +} +export declare const ERROR_FACTORY: ErrorFactory<AnalyticsError, ErrorParams>; +export {}; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/factory.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/factory.d.ts new file mode 100644 index 0000000..cfcc024 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/factory.d.ts @@ -0,0 +1,74 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { SettingsOptions, Analytics, AnalyticsSettings } from './public-types'; +import { Gtag, DynamicConfig, MinimalDynamicConfig } from './types'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +import { FirebaseApp, _FirebaseService } from '@firebase/app'; +/** + * Analytics Service class. + */ +export declare class AnalyticsService implements Analytics, _FirebaseService { + app: FirebaseApp; + constructor(app: FirebaseApp); + _delete(): Promise<void>; +} +/** + * Maps appId to full initialization promise. Wrapped gtag calls must wait on + * all or some of these, depending on the call's `send_to` param and the status + * of the dynamic config fetches (see below). + */ +export declare let initializationPromisesMap: { + [appId: string]: Promise<string>; +}; +/** + * Wrapper around gtag function that ensures FID is sent with all + * relevant event and config calls. + */ +export declare let wrappedGtagFunction: Gtag; +/** + * For testing + * @internal + */ +export declare function resetGlobalVars(newGlobalInitDone?: boolean, newInitializationPromisesMap?: {}, newDynamicPromises?: never[]): void; +/** + * For testing + * @internal + */ +export declare function getGlobalVars(): { + initializationPromisesMap: { + [appId: string]: Promise<string>; + }; + dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>; +}; +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +export declare function settings(options: SettingsOptions): void; +/** + * Analytics instance factory. + * @internal + */ +export declare function factory(app: FirebaseApp, installations: _FirebaseInstallationsInternal, options?: AnalyticsSettings): AnalyticsService; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/functions.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/functions.d.ts new file mode 100644 index 0000000..ced5392 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/functions.d.ts @@ -0,0 +1,85 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { AnalyticsCallOptions, CustomParams, EventParams, ConsentSettings } from './public-types'; +import { Gtag } from './types'; +/** + * Event parameters to set on 'gtag' during initialization. + */ +export declare let defaultEventParametersForInit: CustomParams | undefined; +/** + * Logs an analytics event through the Firebase SDK. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param eventName Google Analytics event name, choose from standard list or use a custom string. + * @param eventParams Analytics event parameters. + */ +export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>; +/** + * Set screen_name parameter for this Google Analytics ID. + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param screenName Screen name string to set. + */ +export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>; +/** + * Set user_id parameter for this Google Analytics ID. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param id User ID string to set + */ +export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>; +/** + * Set all other user properties other than user_id and screen_name. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param properties Map of user properties to set + */ +export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>; +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + */ +export declare function internalGetGoogleAnalyticsClientId(gtagFunction: Gtag, initializationPromise: Promise<string>): Promise<string>; +/** + * Set whether collection is enabled for this ID. + * + * @param enabled If true, collection is enabled for this ID. + */ +export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>; +/** + * Consent parameters to default to during 'gtag' initialization. + */ +export declare let defaultConsentSettingsForInit: ConsentSettings | undefined; +/** + * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of + * analytics. + * + * @param consentSettings Maps the applicable end user consent state for gtag.js. + */ +export declare function _setConsentDefaultForInit(consentSettings?: ConsentSettings): void; +/** + * Sets the variable `defaultEventParametersForInit` for use in the initialization of + * analytics. + * + * @param customParams Any custom params the user may pass to gtag.js. + */ +export declare function _setDefaultEventParametersForInit(customParams?: CustomParams): void; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/get-config.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/get-config.d.ts new file mode 100644 index 0000000..adb8236 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/get-config.d.ts @@ -0,0 +1,72 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts + */ +import { FirebaseApp } from '@firebase/app'; +import { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types'; +export interface AppFields { + appId: string; + apiKey: string; + measurementId?: string; +} +/** + * Backoff factor for 503 errors, which we want to be conservative about + * to avoid overloading servers. Each retry interval will be + * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one + * will be ~30 seconds (with fuzzing). + */ +export declare const LONG_RETRY_FACTOR = 30; +/** + * Stubbable retry data storage class. + */ +declare class RetryData { + throttleMetadata: { + [appId: string]: ThrottleMetadata; + }; + intervalMillis: number; + constructor(throttleMetadata?: { + [appId: string]: ThrottleMetadata; + }, intervalMillis?: number); + getThrottleMetadata(appId: string): ThrottleMetadata; + setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void; + deleteThrottleMetadata(appId: string): void; +} +/** + * Fetches dynamic config from backend. + * @param app Firebase app to fetch config for. + */ +export declare function fetchDynamicConfig(appFields: AppFields): Promise<DynamicConfig>; +/** + * Fetches dynamic config from backend, retrying if failed. + * @param app Firebase app to fetch config for. + */ +export declare function fetchDynamicConfigWithRetry(app: FirebaseApp, retryData?: RetryData, timeoutMillis?: number): Promise<DynamicConfig | MinimalDynamicConfig>; +/** + * Shims a minimal AbortSignal (copied from Remote Config). + * + * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects + * of networking, such as retries. Firebase doesn't use AbortController enough to justify a + * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be + * swapped out if/when we do. + */ +export declare class AnalyticsAbortSignal { + listeners: Array<() => void>; + addEventListener(listener: () => void): void; + abort(): void; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/helpers.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/helpers.d.ts new file mode 100644 index 0000000..6295706 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/helpers.d.ts @@ -0,0 +1,70 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types'; +/** + * Verifies and creates a TrustedScriptURL. + */ +export declare function createGtagTrustedTypesScriptURL(url: string): string; +/** + * Makeshift polyfill for Promise.allSettled(). Resolves when all promises + * have either resolved or rejected. + * + * @param promises Array of promises to wait for. + */ +export declare function promiseAllSettled<T>(promises: Array<Promise<T>>): Promise<T[]>; +/** + * Creates a TrustedTypePolicy object that implements the rules passed as policyOptions. + * + * @param policyName A string containing the name of the policy + * @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods + * | the TrustedTypePolicy reference documentation}. + */ +export declare function createTrustedTypesPolicy(policyName: string, policyOptions: Partial<TrustedTypePolicyOptions>): Partial<TrustedTypePolicy> | undefined; +/** + * Inserts gtag script tag into the page to asynchronously download gtag. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +export declare function insertScriptTag(dataLayerName: string, measurementId: string): void; +/** + * Get reference to, or create, global datalayer. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +export declare function getOrCreateDataLayer(dataLayerName: string): DataLayer; +/** + * Creates global gtag function or wraps existing one if found. + * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and + * 'event' calls that belong to the GAID associated with this Firebase instance. + * + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + * @param dataLayerName Name of global GA datalayer array. + * @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified). + */ +export declare function wrapOrCreateGtag(initializationPromisesMap: { + [appId: string]: Promise<string>; +}, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: { + [measurementId: string]: string; +}, dataLayerName: string, gtagFunctionName: string): { + gtagCore: Gtag; + wrappedGtag: Gtag; +}; +/** + * Returns the script tag in the DOM matching both the gtag url pattern + * and the provided data layer name. + */ +export declare function findGtagScriptOnPage(dataLayerName: string): HTMLScriptElement | null; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/index.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/index.d.ts new file mode 100644 index 0000000..ee21b19 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/index.d.ts @@ -0,0 +1,14 @@ +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ +import '@firebase/installations'; +declare global { + interface Window { + [key: string]: unknown; + } +} +export * from './api'; +export * from './public-types'; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/initialize-analytics.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/initialize-analytics.d.ts new file mode 100644 index 0000000..2736795 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/initialize-analytics.d.ts @@ -0,0 +1,36 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { DynamicConfig, Gtag, MinimalDynamicConfig } from './types'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +import { FirebaseApp } from '@firebase/app'; +import { AnalyticsSettings } from './public-types'; +/** + * Initialize the analytics instance in gtag.js by calling config command with fid. + * + * NOTE: We combine analytics initialization and setting fid together because we want fid to be + * part of the `page_view` event that's sent during the initialization + * @param app Firebase app + * @param gtagCore The gtag function that's not wrapped. + * @param dynamicConfigPromisesList Array of all dynamic config promises. + * @param measurementIdToAppId Maps measurementID to appID. + * @param installations _FirebaseInstallationsInternal instance. + * + * @returns Measurement ID. + */ +export declare function _initializeAnalytics(app: FirebaseApp, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: { + [key: string]: string; +}, installations: _FirebaseInstallationsInternal, gtagCore: Gtag, dataLayerName: string, options?: AnalyticsSettings): Promise<string>; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/logger.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/logger.d.ts new file mode 100644 index 0000000..4a4edbd --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/logger.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Logger } from '@firebase/logger'; +export declare const logger: Logger; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/public-types.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/public-types.d.ts new file mode 100644 index 0000000..16d3978 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/public-types.d.ts @@ -0,0 +1,282 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +/** + * A set of common Google Analytics config settings recognized by + * `gtag.js`. + * @public + */ +export interface GtagConfigParams { + /** + * Whether or not a page view should be sent. + * If set to true (default), a page view is automatically sent upon initialization + * of analytics. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'send_page_view'?: boolean; + /** + * The title of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_title'?: string; + /** + * The URL of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_location'?: string; + /** + * Defaults to `auto`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_domain'?: string; + /** + * Defaults to 63072000 (two years, in seconds). + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_expires'?: number; + /** + * Defaults to `_ga`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_prefix'?: string; + /** + * If set to true, will update cookies on each page load. + * Defaults to true. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_update'?: boolean; + /** + * Appends additional flags to the cookie when set. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_flags'?: string; + /** + * If set to false, disables all advertising features with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_google_signals'?: boolean; + /** + * If set to false, disables all advertising personalization with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_ad_personalization_signals'?: boolean; + [key: string]: unknown; +} +/** + * {@link Analytics} instance initialization options. + * @public + */ +export interface AnalyticsSettings { + /** + * Params to be passed in the initial `gtag` config call during Firebase + * Analytics initialization. + */ + config?: GtagConfigParams | EventParams; +} +/** + * Additional options that can be passed to Analytics method + * calls such as `logEvent`, etc. + * @public + */ +export interface AnalyticsCallOptions { + /** + * If true, this config or event call applies globally to all + * Google Analytics properties on the page. + */ + global: boolean; +} +/** + * An instance of Firebase Analytics. + * @public + */ +export interface Analytics { + /** + * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with. + */ + app: FirebaseApp; +} +/** + * Specifies custom options for your Firebase Analytics instance. + * You must set these before initializing `firebase.analytics()`. + * @public + */ +export interface SettingsOptions { + /** Sets custom name for `gtag` function. */ + gtagName?: string; + /** Sets custom name for `dataLayer` array used by `gtag.js`. */ + dataLayerName?: string; +} +/** + * Any custom params the user may pass to `gtag`. + * @public + */ +export interface CustomParams { + [key: string]: unknown; +} +/** + * Type for standard Google Analytics event names. `logEvent` also accepts any + * custom string and interprets it as a custom event name. + * @public + */ +export type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'checkout_progress' | 'exception' | 'generate_lead' | 'login' | 'page_view' | 'purchase' | 'refund' | 'remove_from_cart' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'set_checkout_option' | 'share' | 'sign_up' | 'timing_complete' | 'view_cart' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_search_results'; +/** + * Standard Google Analytics currency type. + * @public + */ +export type Currency = string | number; +/** + * Standard Google Analytics `Item` type. + * @public + */ +export interface Item { + item_id?: string; + item_name?: string; + item_brand?: string; + item_category?: string; + item_category2?: string; + item_category3?: string; + item_category4?: string; + item_category5?: string; + item_variant?: string; + price?: Currency; + quantity?: number; + index?: number; + coupon?: string; + item_list_name?: string; + item_list_id?: string; + discount?: Currency; + affiliation?: string; + creative_name?: string; + creative_slot?: string; + promotion_id?: string; + promotion_name?: string; + location_id?: string; + /** @deprecated Use item_brand instead. */ + brand?: string; + /** @deprecated Use item_category instead. */ + category?: string; + /** @deprecated Use item_id instead. */ + id?: string; + /** @deprecated Use item_name instead. */ + name?: string; +} +/** + * Field previously used by some Google Analytics events. + * @deprecated Use `Item` instead. + * @public + */ +export interface Promotion { + creative_name?: string; + creative_slot?: string; + id?: string; + name?: string; +} +/** + * Standard `gtag.js` control parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export interface ControlParams { + groups?: string | string[]; + send_to?: string | string[]; + event_callback?: () => void; + event_timeout?: number; +} +/** + * Standard `gtag.js` event parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export interface EventParams { + checkout_option?: string; + checkout_step?: number; + item_id?: string; + content_type?: string; + coupon?: string; + currency?: string; + description?: string; + fatal?: boolean; + items?: Item[]; + method?: string; + number?: string; + promotions?: Promotion[]; + screen_name?: string; + /** + * Firebase-specific. Use to log a `screen_name` to Firebase Analytics. + */ + firebase_screen?: string; + /** + * Firebase-specific. Use to log a `screen_class` to Firebase Analytics. + */ + firebase_screen_class?: string; + search_term?: string; + shipping?: Currency; + tax?: Currency; + transaction_id?: string; + value?: number; + event_label?: string; + event_category?: string; + shipping_tier?: string; + item_list_id?: string; + item_list_name?: string; + promotion_id?: string; + promotion_name?: string; + payment_type?: string; + affiliation?: string; + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: unknown; +} +/** + * Consent status settings for each consent type. + * For more information, see + * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis + * | the GA4 reference documentation for consent state and consent types}. + * @public + */ +export interface ConsentSettings { + /** Enables storage, such as cookies, related to advertising */ + ad_storage?: ConsentStatusString; + /** Sets consent for sending user data to Google for advertising purposes. */ + ad_user_data?: ConsentStatusString; + /** Sets consent for personalized advertising. */ + ad_personalization?: ConsentStatusString; + /** Enables storage, such as cookies, related to analytics (for example, visit duration) */ + analytics_storage?: ConsentStatusString; + /** + * Enables storage that supports the functionality of the website or app such as language settings + */ + functionality_storage?: ConsentStatusString; + /** Enables storage related to personalization such as video recommendations */ + personalization_storage?: ConsentStatusString; + /** + * Enables storage related to security such as authentication functionality, fraud prevention, + * and other user protection. + */ + security_storage?: ConsentStatusString; + [key: string]: unknown; +} +/** + * Whether a particular consent type has been granted or denied. + * @public + */ +export type ConsentStatusString = 'granted' | 'denied'; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/src/types.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/types.d.ts new file mode 100644 index 0000000..e7f964f --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/src/types.d.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ControlParams, EventParams, CustomParams, ConsentSettings } from './public-types'; +/** + * Encapsulates metadata concerning throttled fetch requests. + */ +export interface ThrottleMetadata { + backoffCount: number; + throttleEndTimeMillis: number; +} +/** + * Dynamic configuration fetched from server. + * See https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps/getConfig + */ +export interface DynamicConfig { + projectId: string; + appId: string; + databaseURL: string; + storageBucket: string; + locationId: string; + apiKey: string; + authDomain: string; + messagingSenderId: string; + measurementId: string; +} +export interface MinimalDynamicConfig { + appId: string; + measurementId: string; +} +/** + * Standard `gtag` function provided by gtag.js. + */ +export interface Gtag { + (command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void; + (command: 'set', config: CustomParams): void; + (command: 'event', eventName: string, eventParams?: ControlParams | EventParams | CustomParams): void; + (command: 'consent', subCommand: 'default' | 'update', consentSettings: ConsentSettings): void; + (command: 'get', measurementId: string, fieldName: string, callback: (...args: unknown[]) => void): void; + (command: string, ...args: unknown[]): void; +} +export type DataLayer = IArguments[]; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/get-fake-firebase-services.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/get-fake-firebase-services.d.ts new file mode 100644 index 0000000..d2f6357 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/get-fake-firebase-services.d.ts @@ -0,0 +1,29 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +export declare function getFakeApp(fakeAppParams?: { + appId?: string; + apiKey?: string; + measurementId?: string; +}): FirebaseApp; +export declare function getFakeInstallations(fid?: string, onFidResolve?: Function): _FirebaseInstallationsInternal; +export declare function getFullApp(fakeAppParams?: { + appId?: string; + apiKey?: string; + measurementId?: string; +}): FirebaseApp; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/gtag-script-util.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/gtag-script-util.d.ts new file mode 100644 index 0000000..d80a58c --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/gtag-script-util.d.ts @@ -0,0 +1 @@ +export declare function removeGtagScripts(): void; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/integration-tests/integration.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/integration-tests/integration.d.ts new file mode 100644 index 0000000..6ffe0d3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/integration-tests/integration.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import '@firebase/installations'; +import '../setup'; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/setup.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/setup.d.ts new file mode 100644 index 0000000..1c93d90 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/esm/testing/setup.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/index.cjs.js b/frontend-old/node_modules/@firebase/analytics/dist/index.cjs.js new file mode 100644 index 0000000..0d6cdfe --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/index.cjs.js @@ -0,0 +1,1287 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var app = require('@firebase/app'); +var logger$1 = require('@firebase/logger'); +var util = require('@firebase/util'); +var component = require('@firebase/component'); +require('@firebase/installations'); + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Analytics. + */ +const ANALYTICS_TYPE = 'analytics'; +// Key to attach FID to in gtag params. +const GA_FID_KEY = 'firebase_id'; +const ORIGIN_KEY = 'origin'; +const FETCH_TIMEOUT_MILLIS = 60 * 1000; +const DYNAMIC_CONFIG_URL = 'https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig'; +const GTAG_URL = 'https://www.googletagmanager.com/gtag/js'; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const logger = new logger$1.Logger('@firebase/analytics'); + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const ERRORS = { + ["already-exists" /* AnalyticsError.ALREADY_EXISTS */]: 'A Firebase Analytics instance with the appId {$id} ' + + ' already exists. ' + + 'Only one Firebase Analytics instance can be created for each appId.', + ["already-initialized" /* AnalyticsError.ALREADY_INITIALIZED */]: 'initializeAnalytics() cannot be called again with different options than those ' + + 'it was initially called with. It can be called again with the same options to ' + + 'return the existing instance, or getAnalytics() can be used ' + + 'to get a reference to the already-initialized instance.', + ["already-initialized-settings" /* AnalyticsError.ALREADY_INITIALIZED_SETTINGS */]: 'Firebase Analytics has already been initialized.' + + 'settings() must be called before initializing any Analytics instance' + + 'or it will have no effect.', + ["interop-component-reg-failed" /* AnalyticsError.INTEROP_COMPONENT_REG_FAILED */]: 'Firebase Analytics Interop Component failed to instantiate: {$reason}', + ["invalid-analytics-context" /* AnalyticsError.INVALID_ANALYTICS_CONTEXT */]: 'Firebase Analytics is not supported in this environment. ' + + 'Wrap initialization of analytics in analytics.isSupported() ' + + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', + ["indexeddb-unavailable" /* AnalyticsError.INDEXEDDB_UNAVAILABLE */]: 'IndexedDB unavailable or restricted in this environment. ' + + 'Wrap initialization of analytics in analytics.isSupported() ' + + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', + ["fetch-throttle" /* AnalyticsError.FETCH_THROTTLE */]: 'The config fetch request timed out while in an exponential backoff state.' + + ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.', + ["config-fetch-failed" /* AnalyticsError.CONFIG_FETCH_FAILED */]: 'Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}', + ["no-api-key" /* AnalyticsError.NO_API_KEY */]: 'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field to' + + 'contain a valid API key.', + ["no-app-id" /* AnalyticsError.NO_APP_ID */]: 'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field to' + + 'contain a valid app ID.', + ["no-client-id" /* AnalyticsError.NO_CLIENT_ID */]: 'The "client_id" field is empty.', + ["invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */]: 'Trusted Types detected an invalid gtag resource: {$gtagURL}.' +}; +const ERROR_FACTORY = new util.ErrorFactory('analytics', 'Analytics', ERRORS); + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Verifies and creates a TrustedScriptURL. + */ +function createGtagTrustedTypesScriptURL(url) { + if (!url.startsWith(GTAG_URL)) { + const err = ERROR_FACTORY.create("invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */, { + gtagURL: url + }); + logger.warn(err.message); + return ''; + } + return url; +} +/** + * Makeshift polyfill for Promise.allSettled(). Resolves when all promises + * have either resolved or rejected. + * + * @param promises Array of promises to wait for. + */ +function promiseAllSettled(promises) { + return Promise.all(promises.map(promise => promise.catch(e => e))); +} +/** + * Creates a TrustedTypePolicy object that implements the rules passed as policyOptions. + * + * @param policyName A string containing the name of the policy + * @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods + * | the TrustedTypePolicy reference documentation}. + */ +function createTrustedTypesPolicy(policyName, policyOptions) { + // Create a TrustedTypes policy that we can use for updating src + // properties + let trustedTypesPolicy; + if (window.trustedTypes) { + trustedTypesPolicy = window.trustedTypes.createPolicy(policyName, policyOptions); + } + return trustedTypesPolicy; +} +/** + * Inserts gtag script tag into the page to asynchronously download gtag. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +function insertScriptTag(dataLayerName, measurementId) { + const trustedTypesPolicy = createTrustedTypesPolicy('firebase-js-sdk-policy', { + createScriptURL: createGtagTrustedTypesScriptURL + }); + const script = document.createElement('script'); + // We are not providing an analyticsId in the URL because it would trigger a `page_view` + // without fid. We will initialize ga-id using gtag (config) command together with fid. + const gtagScriptURL = `${GTAG_URL}?l=${dataLayerName}&id=${measurementId}`; + script.src = trustedTypesPolicy + ? trustedTypesPolicy?.createScriptURL(gtagScriptURL) + : gtagScriptURL; + script.async = true; + document.head.appendChild(script); +} +/** + * Get reference to, or create, global datalayer. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +function getOrCreateDataLayer(dataLayerName) { + // Check for existing dataLayer and create if needed. + let dataLayer = []; + if (Array.isArray(window[dataLayerName])) { + dataLayer = window[dataLayerName]; + } + else { + window[dataLayerName] = dataLayer; + } + return dataLayer; +} +/** + * Wrapped gtag logic when gtag is called with 'config' command. + * + * @param gtagCore Basic gtag function that just appends to dataLayer. + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + * @param measurementId GA Measurement ID to set config for. + * @param gtagParams Gtag config params to set. + */ +async function gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams) { + // If config is already fetched, we know the appId and can use it to look up what FID promise we + /// are waiting for, and wait only on that one. + const correspondingAppId = measurementIdToAppId[measurementId]; + try { + if (correspondingAppId) { + await initializationPromisesMap[correspondingAppId]; + } + else { + // If config is not fetched yet, wait for all configs (we don't know which one we need) and + // find the appId (if any) corresponding to this measurementId. If there is one, wait on + // that appId's initialization promise. If there is none, promise resolves and gtag + // call goes through. + const dynamicConfigResults = await promiseAllSettled(dynamicConfigPromisesList); + const foundConfig = dynamicConfigResults.find(config => config.measurementId === measurementId); + if (foundConfig) { + await initializationPromisesMap[foundConfig.appId]; + } + } + } + catch (e) { + logger.error(e); + } + gtagCore("config" /* GtagCommand.CONFIG */, measurementId, gtagParams); +} +/** + * Wrapped gtag logic when gtag is called with 'event' command. + * + * @param gtagCore Basic gtag function that just appends to dataLayer. + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementId GA Measurement ID to log event to. + * @param gtagParams Params to log with this event. + */ +async function gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams) { + try { + let initializationPromisesToWaitFor = []; + // If there's a 'send_to' param, check if any ID specified matches + // an initializeIds() promise we are waiting for. + if (gtagParams && gtagParams['send_to']) { + let gaSendToList = gtagParams['send_to']; + // Make it an array if is isn't, so it can be dealt with the same way. + if (!Array.isArray(gaSendToList)) { + gaSendToList = [gaSendToList]; + } + // Checking 'send_to' fields requires having all measurement ID results back from + // the dynamic config fetch. + const dynamicConfigResults = await promiseAllSettled(dynamicConfigPromisesList); + for (const sendToId of gaSendToList) { + // Any fetched dynamic measurement ID that matches this 'send_to' ID + const foundConfig = dynamicConfigResults.find(config => config.measurementId === sendToId); + const initializationPromise = foundConfig && initializationPromisesMap[foundConfig.appId]; + if (initializationPromise) { + initializationPromisesToWaitFor.push(initializationPromise); + } + else { + // Found an item in 'send_to' that is not associated + // directly with an FID, possibly a group. Empty this array, + // exit the loop early, and let it get populated below. + initializationPromisesToWaitFor = []; + break; + } + } + } + // This will be unpopulated if there was no 'send_to' field , or + // if not all entries in the 'send_to' field could be mapped to + // a FID. In these cases, wait on all pending initialization promises. + if (initializationPromisesToWaitFor.length === 0) { + /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ + initializationPromisesToWaitFor = Object.values(initializationPromisesMap); + } + // Run core gtag function with args after all relevant initialization + // promises have been resolved. + await Promise.all(initializationPromisesToWaitFor); + // Workaround for http://b/141370449 - third argument cannot be undefined. + gtagCore("event" /* GtagCommand.EVENT */, measurementId, gtagParams || {}); + } + catch (e) { + logger.error(e); + } +} +/** + * Wraps a standard gtag function with extra code to wait for completion of + * relevant initialization promises before sending requests. + * + * @param gtagCore Basic gtag function that just appends to dataLayer. + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + */ +function wrapGtag(gtagCore, +/** + * Allows wrapped gtag calls to wait on whichever initialization promises are required, + * depending on the contents of the gtag params' `send_to` field, if any. + */ +initializationPromisesMap, +/** + * Wrapped gtag calls sometimes require all dynamic config fetches to have returned + * before determining what initialization promises (which include FIDs) to wait for. + */ +dynamicConfigPromisesList, +/** + * Wrapped gtag config calls can narrow down which initialization promise (with FID) + * to wait for if the measurementId is already fetched, by getting the corresponding appId, + * which is the key for the initialization promises map. + */ +measurementIdToAppId) { + /** + * Wrapper around gtag that ensures FID is sent with gtag calls. + * @param command Gtag command type. + * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET. + * @param gtagParams Params if event is EVENT/CONFIG. + */ + async function gtagWrapper(command, ...args) { + try { + // If event, check that relevant initialization promises have completed. + if (command === "event" /* GtagCommand.EVENT */) { + const [measurementId, gtagParams] = args; + // If EVENT, second arg must be measurementId. + await gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams); + } + else if (command === "config" /* GtagCommand.CONFIG */) { + const [measurementId, gtagParams] = args; + // If CONFIG, second arg must be measurementId. + await gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams); + } + else if (command === "consent" /* GtagCommand.CONSENT */) { + const [consentAction, gtagParams] = args; + // consentAction can be one of 'default' or 'update'. + gtagCore("consent" /* GtagCommand.CONSENT */, consentAction, gtagParams); + } + else if (command === "get" /* GtagCommand.GET */) { + const [measurementId, fieldName, callback] = args; + gtagCore("get" /* GtagCommand.GET */, measurementId, fieldName, callback); + } + else if (command === "set" /* GtagCommand.SET */) { + const [customParams] = args; + // If SET, second arg must be params. + gtagCore("set" /* GtagCommand.SET */, customParams); + } + else { + gtagCore(command, ...args); + } + } + catch (e) { + logger.error(e); + } + } + return gtagWrapper; +} +/** + * Creates global gtag function or wraps existing one if found. + * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and + * 'event' calls that belong to the GAID associated with this Firebase instance. + * + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + * @param dataLayerName Name of global GA datalayer array. + * @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified). + */ +function wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagFunctionName) { + // Create a basic core gtag function + let gtagCore = function (..._args) { + // Must push IArguments object, not an array. + window[dataLayerName].push(arguments); + }; + // Replace it with existing one if found + if (window[gtagFunctionName] && + typeof window[gtagFunctionName] === 'function') { + // @ts-ignore + gtagCore = window[gtagFunctionName]; + } + window[gtagFunctionName] = wrapGtag(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId); + return { + gtagCore, + wrappedGtag: window[gtagFunctionName] + }; +} +/** + * Returns the script tag in the DOM matching both the gtag url pattern + * and the provided data layer name. + */ +function findGtagScriptOnPage(dataLayerName) { + const scriptTags = window.document.getElementsByTagName('script'); + for (const tag of Object.values(scriptTags)) { + if (tag.src && + tag.src.includes(GTAG_URL) && + tag.src.includes(dataLayerName)) { + return tag; + } + } + return null; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Backoff factor for 503 errors, which we want to be conservative about + * to avoid overloading servers. Each retry interval will be + * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one + * will be ~30 seconds (with fuzzing). + */ +const LONG_RETRY_FACTOR = 30; +/** + * Base wait interval to multiplied by backoffFactor^backoffCount. + */ +const BASE_INTERVAL_MILLIS = 1000; +/** + * Stubbable retry data storage class. + */ +class RetryData { + constructor(throttleMetadata = {}, intervalMillis = BASE_INTERVAL_MILLIS) { + this.throttleMetadata = throttleMetadata; + this.intervalMillis = intervalMillis; + } + getThrottleMetadata(appId) { + return this.throttleMetadata[appId]; + } + setThrottleMetadata(appId, metadata) { + this.throttleMetadata[appId] = metadata; + } + deleteThrottleMetadata(appId) { + delete this.throttleMetadata[appId]; + } +} +const defaultRetryData = new RetryData(); +/** + * Set GET request headers. + * @param apiKey App API key. + */ +function getHeaders(apiKey) { + return new Headers({ + Accept: 'application/json', + 'x-goog-api-key': apiKey + }); +} +/** + * Fetches dynamic config from backend. + * @param app Firebase app to fetch config for. + */ +async function fetchDynamicConfig(appFields) { + const { appId, apiKey } = appFields; + const request = { + method: 'GET', + headers: getHeaders(apiKey) + }; + const appUrl = DYNAMIC_CONFIG_URL.replace('{app-id}', appId); + const response = await fetch(appUrl, request); + if (response.status !== 200 && response.status !== 304) { + let errorMessage = ''; + try { + // Try to get any error message text from server response. + const jsonResponse = (await response.json()); + if (jsonResponse.error?.message) { + errorMessage = jsonResponse.error.message; + } + } + catch (_ignored) { } + throw ERROR_FACTORY.create("config-fetch-failed" /* AnalyticsError.CONFIG_FETCH_FAILED */, { + httpStatus: response.status, + responseMessage: errorMessage + }); + } + return response.json(); +} +/** + * Fetches dynamic config from backend, retrying if failed. + * @param app Firebase app to fetch config for. + */ +async function fetchDynamicConfigWithRetry(app, +// retryData and timeoutMillis are parameterized to allow passing a different value for testing. +retryData = defaultRetryData, timeoutMillis) { + const { appId, apiKey, measurementId } = app.options; + if (!appId) { + throw ERROR_FACTORY.create("no-app-id" /* AnalyticsError.NO_APP_ID */); + } + if (!apiKey) { + if (measurementId) { + return { + measurementId, + appId + }; + } + throw ERROR_FACTORY.create("no-api-key" /* AnalyticsError.NO_API_KEY */); + } + const throttleMetadata = retryData.getThrottleMetadata(appId) || { + backoffCount: 0, + throttleEndTimeMillis: Date.now() + }; + const signal = new AnalyticsAbortSignal(); + setTimeout(async () => { + // Note a very low delay, eg < 10ms, can elapse before listeners are initialized. + signal.abort(); + }, timeoutMillis !== undefined ? timeoutMillis : FETCH_TIMEOUT_MILLIS); + return attemptFetchDynamicConfigWithRetry({ appId, apiKey, measurementId }, throttleMetadata, signal, retryData); +} +/** + * Runs one retry attempt. + * @param appFields Necessary app config fields. + * @param throttleMetadata Ongoing metadata to determine throttling times. + * @param signal Abort signal. + */ +async function attemptFetchDynamicConfigWithRetry(appFields, { throttleEndTimeMillis, backoffCount }, signal, retryData = defaultRetryData // for testing +) { + const { appId, measurementId } = appFields; + // Starts with a (potentially zero) timeout to support resumption from stored state. + // Ensures the throttle end time is honored if the last attempt timed out. + // Note the SDK will never make a request if the fetch timeout expires at this point. + try { + await setAbortableTimeout(signal, throttleEndTimeMillis); + } + catch (e) { + if (measurementId) { + logger.warn(`Timed out fetching this Firebase app's measurement ID from the server.` + + ` Falling back to the measurement ID ${measurementId}` + + ` provided in the "measurementId" field in the local Firebase config. [${e?.message}]`); + return { appId, measurementId }; + } + throw e; + } + try { + const response = await fetchDynamicConfig(appFields); + // Note the SDK only clears throttle state if response is success or non-retriable. + retryData.deleteThrottleMetadata(appId); + return response; + } + catch (e) { + const error = e; + if (!isRetriableError(error)) { + retryData.deleteThrottleMetadata(appId); + if (measurementId) { + logger.warn(`Failed to fetch this Firebase app's measurement ID from the server.` + + ` Falling back to the measurement ID ${measurementId}` + + ` provided in the "measurementId" field in the local Firebase config. [${error?.message}]`); + return { appId, measurementId }; + } + else { + throw e; + } + } + const backoffMillis = Number(error?.customData?.httpStatus) === 503 + ? util.calculateBackoffMillis(backoffCount, retryData.intervalMillis, LONG_RETRY_FACTOR) + : util.calculateBackoffMillis(backoffCount, retryData.intervalMillis); + // Increments backoff state. + const throttleMetadata = { + throttleEndTimeMillis: Date.now() + backoffMillis, + backoffCount: backoffCount + 1 + }; + // Persists state. + retryData.setThrottleMetadata(appId, throttleMetadata); + logger.debug(`Calling attemptFetch again in ${backoffMillis} millis`); + return attemptFetchDynamicConfigWithRetry(appFields, throttleMetadata, signal, retryData); + } +} +/** + * Supports waiting on a backoff by: + * + * <ul> + * <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li> + * <li>Listening on a signal bus for abort events, just like the Fetch API</li> + * <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled + * request appear the same.</li> + * </ul> + * + * <p>Visible for testing. + */ +function setAbortableTimeout(signal, throttleEndTimeMillis) { + return new Promise((resolve, reject) => { + // Derives backoff from given end time, normalizing negative numbers to zero. + const backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0); + const timeout = setTimeout(resolve, backoffMillis); + // Adds listener, rather than sets onabort, because signal is a shared object. + signal.addEventListener(() => { + clearTimeout(timeout); + // If the request completes before this timeout, the rejection has no effect. + reject(ERROR_FACTORY.create("fetch-throttle" /* AnalyticsError.FETCH_THROTTLE */, { + throttleEndTimeMillis + })); + }); + }); +} +/** + * Returns true if the {@link Error} indicates a fetch request may succeed later. + */ +function isRetriableError(e) { + if (!(e instanceof util.FirebaseError) || !e.customData) { + return false; + } + // Uses string index defined by ErrorData, which FirebaseError implements. + const httpStatus = Number(e.customData['httpStatus']); + return (httpStatus === 429 || + httpStatus === 500 || + httpStatus === 503 || + httpStatus === 504); +} +/** + * Shims a minimal AbortSignal (copied from Remote Config). + * + * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects + * of networking, such as retries. Firebase doesn't use AbortController enough to justify a + * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be + * swapped out if/when we do. + */ +class AnalyticsAbortSignal { + constructor() { + this.listeners = []; + } + addEventListener(listener) { + this.listeners.push(listener); + } + abort() { + this.listeners.forEach(listener => listener()); + } +} + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Event parameters to set on 'gtag' during initialization. + */ +let defaultEventParametersForInit; +/** + * Logs an analytics event through the Firebase SDK. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param eventName Google Analytics event name, choose from standard list or use a custom string. + * @param eventParams Analytics event parameters. + */ +async function logEvent$1(gtagFunction, initializationPromise, eventName, eventParams, options) { + if (options && options.global) { + gtagFunction("event" /* GtagCommand.EVENT */, eventName, eventParams); + return; + } + else { + const measurementId = await initializationPromise; + const params = { + ...eventParams, + 'send_to': measurementId + }; + gtagFunction("event" /* GtagCommand.EVENT */, eventName, params); + } +} +/** + * Set screen_name parameter for this Google Analytics ID. + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param screenName Screen name string to set. + */ +async function setCurrentScreen$1(gtagFunction, initializationPromise, screenName, options) { + if (options && options.global) { + gtagFunction("set" /* GtagCommand.SET */, { 'screen_name': screenName }); + return Promise.resolve(); + } + else { + const measurementId = await initializationPromise; + gtagFunction("config" /* GtagCommand.CONFIG */, measurementId, { + update: true, + 'screen_name': screenName + }); + } +} +/** + * Set user_id parameter for this Google Analytics ID. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param id User ID string to set + */ +async function setUserId$1(gtagFunction, initializationPromise, id, options) { + if (options && options.global) { + gtagFunction("set" /* GtagCommand.SET */, { 'user_id': id }); + return Promise.resolve(); + } + else { + const measurementId = await initializationPromise; + gtagFunction("config" /* GtagCommand.CONFIG */, measurementId, { + update: true, + 'user_id': id + }); + } +} +/** + * Set all other user properties other than user_id and screen_name. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param properties Map of user properties to set + */ +async function setUserProperties$1(gtagFunction, initializationPromise, properties, options) { + if (options && options.global) { + const flatProperties = {}; + for (const key of Object.keys(properties)) { + // use dot notation for merge behavior in gtag.js + flatProperties[`user_properties.${key}`] = properties[key]; + } + gtagFunction("set" /* GtagCommand.SET */, flatProperties); + return Promise.resolve(); + } + else { + const measurementId = await initializationPromise; + gtagFunction("config" /* GtagCommand.CONFIG */, measurementId, { + update: true, + 'user_properties': properties + }); + } +} +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + */ +async function internalGetGoogleAnalyticsClientId(gtagFunction, initializationPromise) { + const measurementId = await initializationPromise; + return new Promise((resolve, reject) => { + gtagFunction("get" /* GtagCommand.GET */, measurementId, 'client_id', (clientId) => { + if (!clientId) { + reject(ERROR_FACTORY.create("no-client-id" /* AnalyticsError.NO_CLIENT_ID */)); + } + resolve(clientId); + }); + }); +} +/** + * Set whether collection is enabled for this ID. + * + * @param enabled If true, collection is enabled for this ID. + */ +async function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) { + const measurementId = await initializationPromise; + window[`ga-disable-${measurementId}`] = !enabled; +} +/** + * Consent parameters to default to during 'gtag' initialization. + */ +let defaultConsentSettingsForInit; +/** + * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of + * analytics. + * + * @param consentSettings Maps the applicable end user consent state for gtag.js. + */ +function _setConsentDefaultForInit(consentSettings) { + defaultConsentSettingsForInit = consentSettings; +} +/** + * Sets the variable `defaultEventParametersForInit` for use in the initialization of + * analytics. + * + * @param customParams Any custom params the user may pass to gtag.js. + */ +function _setDefaultEventParametersForInit(customParams) { + defaultEventParametersForInit = customParams; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +async function validateIndexedDB() { + if (!util.isIndexedDBAvailable()) { + logger.warn(ERROR_FACTORY.create("indexeddb-unavailable" /* AnalyticsError.INDEXEDDB_UNAVAILABLE */, { + errorInfo: 'IndexedDB is not available in this environment.' + }).message); + return false; + } + else { + try { + await util.validateIndexedDBOpenable(); + } + catch (e) { + logger.warn(ERROR_FACTORY.create("indexeddb-unavailable" /* AnalyticsError.INDEXEDDB_UNAVAILABLE */, { + errorInfo: e?.toString() + }).message); + return false; + } + } + return true; +} +/** + * Initialize the analytics instance in gtag.js by calling config command with fid. + * + * NOTE: We combine analytics initialization and setting fid together because we want fid to be + * part of the `page_view` event that's sent during the initialization + * @param app Firebase app + * @param gtagCore The gtag function that's not wrapped. + * @param dynamicConfigPromisesList Array of all dynamic config promises. + * @param measurementIdToAppId Maps measurementID to appID. + * @param installations _FirebaseInstallationsInternal instance. + * + * @returns Measurement ID. + */ +async function _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCore, dataLayerName, options) { + const dynamicConfigPromise = fetchDynamicConfigWithRetry(app); + // Once fetched, map measurementIds to appId, for ease of lookup in wrapped gtag function. + dynamicConfigPromise + .then(config => { + measurementIdToAppId[config.measurementId] = config.appId; + if (app.options.measurementId && + config.measurementId !== app.options.measurementId) { + logger.warn(`The measurement ID in the local Firebase config (${app.options.measurementId})` + + ` does not match the measurement ID fetched from the server (${config.measurementId}).` + + ` To ensure analytics events are always sent to the correct Analytics property,` + + ` update the` + + ` measurement ID field in the local config or remove it from the local config.`); + } + }) + .catch(e => logger.error(e)); + // Add to list to track state of all dynamic config promises. + dynamicConfigPromisesList.push(dynamicConfigPromise); + const fidPromise = validateIndexedDB().then(envIsValid => { + if (envIsValid) { + return installations.getId(); + } + else { + return undefined; + } + }); + const [dynamicConfig, fid] = await Promise.all([ + dynamicConfigPromise, + fidPromise + ]); + // Detect if user has already put the gtag <script> tag on this page with the passed in + // data layer name. + if (!findGtagScriptOnPage(dataLayerName)) { + insertScriptTag(dataLayerName, dynamicConfig.measurementId); + } + // Detects if there are consent settings that need to be configured. + if (defaultConsentSettingsForInit) { + gtagCore("consent" /* GtagCommand.CONSENT */, 'default', defaultConsentSettingsForInit); + _setConsentDefaultForInit(undefined); + } + // This command initializes gtag.js and only needs to be called once for the entire web app, + // but since it is idempotent, we can call it multiple times. + // We keep it together with other initialization logic for better code structure. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + gtagCore('js', new Date()); + // User config added first. We don't want users to accidentally overwrite + // base Firebase config properties. + const configProperties = options?.config ?? {}; + // guard against developers accidentally setting properties with prefix `firebase_` + configProperties[ORIGIN_KEY] = 'firebase'; + configProperties.update = true; + if (fid != null) { + configProperties[GA_FID_KEY] = fid; + } + // It should be the first config command called on this GA-ID + // Initialize this GA-ID and set FID on it using the gtag config API. + // Note: This will trigger a page_view event unless 'send_page_view' is set to false in + // `configProperties`. + gtagCore("config" /* GtagCommand.CONFIG */, dynamicConfig.measurementId, configProperties); + // Detects if there is data that will be set on every event logged from the SDK. + if (defaultEventParametersForInit) { + gtagCore("set" /* GtagCommand.SET */, defaultEventParametersForInit); + _setDefaultEventParametersForInit(undefined); + } + return dynamicConfig.measurementId; +} + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Analytics Service class. + */ +class AnalyticsService { + constructor(app) { + this.app = app; + } + _delete() { + delete initializationPromisesMap[this.app.options.appId]; + return Promise.resolve(); + } +} +/** + * Maps appId to full initialization promise. Wrapped gtag calls must wait on + * all or some of these, depending on the call's `send_to` param and the status + * of the dynamic config fetches (see below). + */ +let initializationPromisesMap = {}; +/** + * List of dynamic config fetch promises. In certain cases, wrapped gtag calls + * wait on all these to be complete in order to determine if it can selectively + * wait for only certain initialization (FID) promises or if it must wait for all. + */ +let dynamicConfigPromisesList = []; +/** + * Maps fetched measurementIds to appId. Populated when the app's dynamic config + * fetch completes. If already populated, gtag config calls can use this to + * selectively wait for only this app's initialization promise (FID) instead of all + * initialization promises. + */ +const measurementIdToAppId = {}; +/** + * Name for window global data layer array used by GA: defaults to 'dataLayer'. + */ +let dataLayerName = 'dataLayer'; +/** + * Name for window global gtag function used by GA: defaults to 'gtag'. + */ +let gtagName = 'gtag'; +/** + * Reproduction of standard gtag function or reference to existing + * gtag function on window object. + */ +let gtagCoreFunction; +/** + * Wrapper around gtag function that ensures FID is sent with all + * relevant event and config calls. + */ +let wrappedGtagFunction; +/** + * Flag to ensure page initialization steps (creation or wrapping of + * dataLayer and gtag script) are only run once per page load. + */ +let globalInitDone = false; +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +function settings(options) { + if (globalInitDone) { + throw ERROR_FACTORY.create("already-initialized" /* AnalyticsError.ALREADY_INITIALIZED */); + } + if (options.dataLayerName) { + dataLayerName = options.dataLayerName; + } + if (options.gtagName) { + gtagName = options.gtagName; + } +} +/** + * Returns true if no environment mismatch is found. + * If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT + * error that also lists details for each mismatch found. + */ +function warnOnBrowserContextMismatch() { + const mismatchedEnvMessages = []; + if (util.isBrowserExtension()) { + mismatchedEnvMessages.push('This is a browser extension environment.'); + } + if (!util.areCookiesEnabled()) { + mismatchedEnvMessages.push('Cookies are not available.'); + } + if (mismatchedEnvMessages.length > 0) { + const details = mismatchedEnvMessages + .map((message, index) => `(${index + 1}) ${message}`) + .join(' '); + const err = ERROR_FACTORY.create("invalid-analytics-context" /* AnalyticsError.INVALID_ANALYTICS_CONTEXT */, { + errorInfo: details + }); + logger.warn(err.message); + } +} +/** + * Analytics instance factory. + * @internal + */ +function factory(app, installations, options) { + warnOnBrowserContextMismatch(); + const appId = app.options.appId; + if (!appId) { + throw ERROR_FACTORY.create("no-app-id" /* AnalyticsError.NO_APP_ID */); + } + if (!app.options.apiKey) { + if (app.options.measurementId) { + logger.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest` + + ` measurement ID for this Firebase app. Falling back to the measurement ID ${app.options.measurementId}` + + ` provided in the "measurementId" field in the local Firebase config.`); + } + else { + throw ERROR_FACTORY.create("no-api-key" /* AnalyticsError.NO_API_KEY */); + } + } + if (initializationPromisesMap[appId] != null) { + throw ERROR_FACTORY.create("already-exists" /* AnalyticsError.ALREADY_EXISTS */, { + id: appId + }); + } + if (!globalInitDone) { + // Steps here should only be done once per page: creation or wrapping + // of dataLayer and global gtag function. + getOrCreateDataLayer(dataLayerName); + const { wrappedGtag, gtagCore } = wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagName); + wrappedGtagFunction = wrappedGtag; + gtagCoreFunction = gtagCore; + globalInitDone = true; + } + // Async but non-blocking. + // This map reflects the completion state of all promises for each appId. + initializationPromisesMap[appId] = _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCoreFunction, dataLayerName, options); + const analyticsInstance = new AnalyticsService(app); + return analyticsInstance; +} + +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +function getAnalytics(app$1 = app.getApp()) { + app$1 = util.getModularInstance(app$1); + // Dependencies + const analyticsProvider = app._getProvider(app$1, ANALYTICS_TYPE); + if (analyticsProvider.isInitialized()) { + return analyticsProvider.getImmediate(); + } + return initializeAnalytics(app$1); +} +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +function initializeAnalytics(app$1, options = {}) { + // Dependencies + const analyticsProvider = app._getProvider(app$1, ANALYTICS_TYPE); + if (analyticsProvider.isInitialized()) { + const existingInstance = analyticsProvider.getImmediate(); + if (util.deepEqual(options, analyticsProvider.getOptions())) { + return existingInstance; + } + else { + throw ERROR_FACTORY.create("already-initialized" /* AnalyticsError.ALREADY_INITIALIZED */); + } + } + const analyticsInstance = analyticsProvider.initialize({ options }); + return analyticsInstance; +} +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +async function isSupported() { + if (util.isBrowserExtension()) { + return false; + } + if (!util.areCookiesEnabled()) { + return false; + } + if (!util.isIndexedDBAvailable()) { + return false; + } + try { + const isDBOpenable = await util.validateIndexedDBOpenable(); + return isDBOpenable; + } + catch (error) { + return false; + } +} +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +function setCurrentScreen(analyticsInstance, screenName, options) { + analyticsInstance = util.getModularInstance(analyticsInstance); + setCurrentScreen$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], screenName, options).catch(e => logger.error(e)); +} +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +async function getGoogleAnalyticsClientId(analyticsInstance) { + analyticsInstance = util.getModularInstance(analyticsInstance); + return internalGetGoogleAnalyticsClientId(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId]); +} +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +function setUserId(analyticsInstance, id, options) { + analyticsInstance = util.getModularInstance(analyticsInstance); + setUserId$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], id, options).catch(e => logger.error(e)); +} +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +function setUserProperties(analyticsInstance, properties, options) { + analyticsInstance = util.getModularInstance(analyticsInstance); + setUserProperties$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], properties, options).catch(e => logger.error(e)); +} +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +function setAnalyticsCollectionEnabled(analyticsInstance, enabled) { + analyticsInstance = util.getModularInstance(analyticsInstance); + setAnalyticsCollectionEnabled$1(initializationPromisesMap[analyticsInstance.app.options.appId], enabled).catch(e => logger.error(e)); +} +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +function setDefaultEventParameters(customParams) { + // Check if reference to existing gtag function on window object exists + if (wrappedGtagFunction) { + wrappedGtagFunction("set" /* GtagCommand.SET */, customParams); + } + else { + _setDefaultEventParametersForInit(customParams); + } +} +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * List of official event parameters can be found in the gtag.js + * reference documentation: + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * + * @public + */ +function logEvent(analyticsInstance, eventName, eventParams, options) { + analyticsInstance = util.getModularInstance(analyticsInstance); + logEvent$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], eventName, eventParams, options).catch(e => logger.error(e)); +} +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +function setConsent(consentSettings) { + // Check if reference to existing gtag function on window object exists + if (wrappedGtagFunction) { + wrappedGtagFunction("consent" /* GtagCommand.CONSENT */, 'update', consentSettings); + } + else { + _setConsentDefaultForInit(consentSettings); + } +} + +const name = "@firebase/analytics"; +const version = "0.10.19"; + +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ +function registerAnalytics() { + app._registerComponent(new component.Component(ANALYTICS_TYPE, (container, { options: analyticsOptions }) => { + // getImmediate for FirebaseApp will always succeed + const app = container.getProvider('app').getImmediate(); + const installations = container + .getProvider('installations-internal') + .getImmediate(); + return factory(app, installations, analyticsOptions); + }, "PUBLIC" /* ComponentType.PUBLIC */)); + app._registerComponent(new component.Component('analytics-internal', internalFactory, "PRIVATE" /* ComponentType.PRIVATE */)); + app.registerVersion(name, version); + // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation + app.registerVersion(name, version, 'cjs2020'); + function internalFactory(container) { + try { + const analytics = container.getProvider(ANALYTICS_TYPE).getImmediate(); + return { + logEvent: (eventName, eventParams, options) => logEvent(analytics, eventName, eventParams, options), + setUserProperties: (properties, options) => setUserProperties(analytics, properties, options) + }; + } + catch (e) { + throw ERROR_FACTORY.create("interop-component-reg-failed" /* AnalyticsError.INTEROP_COMPONENT_REG_FAILED */, { + reason: e + }); + } + } +} +registerAnalytics(); + +exports.getAnalytics = getAnalytics; +exports.getGoogleAnalyticsClientId = getGoogleAnalyticsClientId; +exports.initializeAnalytics = initializeAnalytics; +exports.isSupported = isSupported; +exports.logEvent = logEvent; +exports.setAnalyticsCollectionEnabled = setAnalyticsCollectionEnabled; +exports.setConsent = setConsent; +exports.setCurrentScreen = setCurrentScreen; +exports.setDefaultEventParameters = setDefaultEventParameters; +exports.setUserId = setUserId; +exports.setUserProperties = setUserProperties; +exports.settings = settings; +//# sourceMappingURL=index.cjs.js.map diff --git a/frontend-old/node_modules/@firebase/analytics/dist/index.cjs.js.map b/frontend-old/node_modules/@firebase/analytics/dist/index.cjs.js.map new file mode 100644 index 0000000..aeff324 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/index.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs.js","sources":["../src/constants.ts","../src/logger.ts","../src/errors.ts","../src/helpers.ts","../src/get-config.ts","../src/functions.ts","../src/initialize-analytics.ts","../src/factory.ts","../src/api.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Type constant for Firebase Analytics.\n */\nexport const ANALYTICS_TYPE = 'analytics';\n\n// Key to attach FID to in gtag params.\nexport const GA_FID_KEY = 'firebase_id';\nexport const ORIGIN_KEY = 'origin';\n\nexport const FETCH_TIMEOUT_MILLIS = 60 * 1000;\n\nexport const DYNAMIC_CONFIG_URL =\n 'https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig';\n\nexport const GTAG_URL = 'https://www.googletagmanager.com/gtag/js';\n\nexport const enum GtagCommand {\n EVENT = 'event',\n SET = 'set',\n CONFIG = 'config',\n CONSENT = 'consent',\n GET = 'get'\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from '@firebase/logger';\n\nexport const logger = new Logger('@firebase/analytics');\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorFactory, ErrorMap } from '@firebase/util';\n\nexport const enum AnalyticsError {\n ALREADY_EXISTS = 'already-exists',\n ALREADY_INITIALIZED = 'already-initialized',\n ALREADY_INITIALIZED_SETTINGS = 'already-initialized-settings',\n INTEROP_COMPONENT_REG_FAILED = 'interop-component-reg-failed',\n INVALID_ANALYTICS_CONTEXT = 'invalid-analytics-context',\n INDEXEDDB_UNAVAILABLE = 'indexeddb-unavailable',\n FETCH_THROTTLE = 'fetch-throttle',\n CONFIG_FETCH_FAILED = 'config-fetch-failed',\n NO_API_KEY = 'no-api-key',\n NO_APP_ID = 'no-app-id',\n NO_CLIENT_ID = 'no-client-id',\n INVALID_GTAG_RESOURCE = 'invalid-gtag-resource'\n}\n\nconst ERRORS: ErrorMap<AnalyticsError> = {\n [AnalyticsError.ALREADY_EXISTS]:\n 'A Firebase Analytics instance with the appId {$id} ' +\n ' already exists. ' +\n 'Only one Firebase Analytics instance can be created for each appId.',\n [AnalyticsError.ALREADY_INITIALIZED]:\n 'initializeAnalytics() cannot be called again with different options than those ' +\n 'it was initially called with. It can be called again with the same options to ' +\n 'return the existing instance, or getAnalytics() can be used ' +\n 'to get a reference to the already-initialized instance.',\n [AnalyticsError.ALREADY_INITIALIZED_SETTINGS]:\n 'Firebase Analytics has already been initialized.' +\n 'settings() must be called before initializing any Analytics instance' +\n 'or it will have no effect.',\n [AnalyticsError.INTEROP_COMPONENT_REG_FAILED]:\n 'Firebase Analytics Interop Component failed to instantiate: {$reason}',\n [AnalyticsError.INVALID_ANALYTICS_CONTEXT]:\n 'Firebase Analytics is not supported in this environment. ' +\n 'Wrap initialization of analytics in analytics.isSupported() ' +\n 'to prevent initialization in unsupported environments. Details: {$errorInfo}',\n [AnalyticsError.INDEXEDDB_UNAVAILABLE]:\n 'IndexedDB unavailable or restricted in this environment. ' +\n 'Wrap initialization of analytics in analytics.isSupported() ' +\n 'to prevent initialization in unsupported environments. Details: {$errorInfo}',\n [AnalyticsError.FETCH_THROTTLE]:\n 'The config fetch request timed out while in an exponential backoff state.' +\n ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',\n [AnalyticsError.CONFIG_FETCH_FAILED]:\n 'Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}',\n [AnalyticsError.NO_API_KEY]:\n 'The \"apiKey\" field is empty in the local Firebase config. Firebase Analytics requires this field to' +\n 'contain a valid API key.',\n [AnalyticsError.NO_APP_ID]:\n 'The \"appId\" field is empty in the local Firebase config. Firebase Analytics requires this field to' +\n 'contain a valid app ID.',\n [AnalyticsError.NO_CLIENT_ID]: 'The \"client_id\" field is empty.',\n [AnalyticsError.INVALID_GTAG_RESOURCE]:\n 'Trusted Types detected an invalid gtag resource: {$gtagURL}.'\n};\n\ninterface ErrorParams {\n [AnalyticsError.ALREADY_EXISTS]: { id: string };\n [AnalyticsError.INTEROP_COMPONENT_REG_FAILED]: { reason: Error };\n [AnalyticsError.FETCH_THROTTLE]: { throttleEndTimeMillis: number };\n [AnalyticsError.CONFIG_FETCH_FAILED]: {\n httpStatus: number;\n responseMessage: string;\n };\n [AnalyticsError.INVALID_ANALYTICS_CONTEXT]: { errorInfo: string };\n [AnalyticsError.INDEXEDDB_UNAVAILABLE]: { errorInfo: string };\n [AnalyticsError.INVALID_GTAG_RESOURCE]: { gtagURL: string };\n}\n\nexport const ERROR_FACTORY = new ErrorFactory<AnalyticsError, ErrorParams>(\n 'analytics',\n 'Analytics',\n ERRORS\n);\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CustomParams,\n ControlParams,\n EventParams,\n ConsentSettings\n} from './public-types';\nimport { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types';\nimport { GtagCommand, GTAG_URL } from './constants';\nimport { logger } from './logger';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\n\n// Possible parameter types for gtag 'event' and 'config' commands\ntype GtagConfigOrEventParams = ControlParams & EventParams & CustomParams;\n\n/**\n * Verifies and creates a TrustedScriptURL.\n */\nexport function createGtagTrustedTypesScriptURL(url: string): string {\n if (!url.startsWith(GTAG_URL)) {\n const err = ERROR_FACTORY.create(AnalyticsError.INVALID_GTAG_RESOURCE, {\n gtagURL: url\n });\n logger.warn(err.message);\n return '';\n }\n return url;\n}\n\n/**\n * Makeshift polyfill for Promise.allSettled(). Resolves when all promises\n * have either resolved or rejected.\n *\n * @param promises Array of promises to wait for.\n */\nexport function promiseAllSettled<T>(\n promises: Array<Promise<T>>\n): Promise<T[]> {\n return Promise.all(promises.map(promise => promise.catch(e => e)));\n}\n\n/**\n * Creates a TrustedTypePolicy object that implements the rules passed as policyOptions.\n *\n * @param policyName A string containing the name of the policy\n * @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods\n * | the TrustedTypePolicy reference documentation}.\n */\nexport function createTrustedTypesPolicy(\n policyName: string,\n policyOptions: Partial<TrustedTypePolicyOptions>\n): Partial<TrustedTypePolicy> | undefined {\n // Create a TrustedTypes policy that we can use for updating src\n // properties\n let trustedTypesPolicy: Partial<TrustedTypePolicy> | undefined;\n if (window.trustedTypes) {\n trustedTypesPolicy = window.trustedTypes.createPolicy(\n policyName,\n policyOptions\n );\n }\n return trustedTypesPolicy;\n}\n\n/**\n * Inserts gtag script tag into the page to asynchronously download gtag.\n * @param dataLayerName Name of datalayer (most often the default, \"_dataLayer\").\n */\nexport function insertScriptTag(\n dataLayerName: string,\n measurementId: string\n): void {\n const trustedTypesPolicy = createTrustedTypesPolicy(\n 'firebase-js-sdk-policy',\n {\n createScriptURL: createGtagTrustedTypesScriptURL\n }\n );\n\n const script = document.createElement('script');\n // We are not providing an analyticsId in the URL because it would trigger a `page_view`\n // without fid. We will initialize ga-id using gtag (config) command together with fid.\n\n const gtagScriptURL = `${GTAG_URL}?l=${dataLayerName}&id=${measurementId}`;\n (script.src as string | TrustedScriptURL) = trustedTypesPolicy\n ? (trustedTypesPolicy as TrustedTypePolicy)?.createScriptURL(gtagScriptURL)\n : gtagScriptURL;\n\n script.async = true;\n document.head.appendChild(script);\n}\n\n/**\n * Get reference to, or create, global datalayer.\n * @param dataLayerName Name of datalayer (most often the default, \"_dataLayer\").\n */\nexport function getOrCreateDataLayer(dataLayerName: string): DataLayer {\n // Check for existing dataLayer and create if needed.\n let dataLayer: DataLayer = [];\n if (Array.isArray(window[dataLayerName])) {\n dataLayer = window[dataLayerName] as DataLayer;\n } else {\n window[dataLayerName] = dataLayer;\n }\n return dataLayer;\n}\n\n/**\n * Wrapped gtag logic when gtag is called with 'config' command.\n *\n * @param gtagCore Basic gtag function that just appends to dataLayer.\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\n * @param measurementId GA Measurement ID to set config for.\n * @param gtagParams Gtag config params to set.\n */\nasync function gtagOnConfig(\n gtagCore: Gtag,\n initializationPromisesMap: { [appId: string]: Promise<string> },\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementIdToAppId: { [measurementId: string]: string },\n measurementId: string,\n gtagParams?: ControlParams & EventParams & CustomParams\n): Promise<void> {\n // If config is already fetched, we know the appId and can use it to look up what FID promise we\n /// are waiting for, and wait only on that one.\n const correspondingAppId = measurementIdToAppId[measurementId as string];\n try {\n if (correspondingAppId) {\n await initializationPromisesMap[correspondingAppId];\n } else {\n // If config is not fetched yet, wait for all configs (we don't know which one we need) and\n // find the appId (if any) corresponding to this measurementId. If there is one, wait on\n // that appId's initialization promise. If there is none, promise resolves and gtag\n // call goes through.\n const dynamicConfigResults = await promiseAllSettled(\n dynamicConfigPromisesList\n );\n const foundConfig = dynamicConfigResults.find(\n config => config.measurementId === measurementId\n );\n if (foundConfig) {\n await initializationPromisesMap[foundConfig.appId];\n }\n }\n } catch (e) {\n logger.error(e);\n }\n gtagCore(GtagCommand.CONFIG, measurementId, gtagParams);\n}\n\n/**\n * Wrapped gtag logic when gtag is called with 'event' command.\n *\n * @param gtagCore Basic gtag function that just appends to dataLayer.\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementId GA Measurement ID to log event to.\n * @param gtagParams Params to log with this event.\n */\nasync function gtagOnEvent(\n gtagCore: Gtag,\n initializationPromisesMap: { [appId: string]: Promise<string> },\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementId: string,\n gtagParams?: ControlParams & EventParams & CustomParams\n): Promise<void> {\n try {\n let initializationPromisesToWaitFor: Array<Promise<string>> = [];\n\n // If there's a 'send_to' param, check if any ID specified matches\n // an initializeIds() promise we are waiting for.\n if (gtagParams && gtagParams['send_to']) {\n let gaSendToList: string | string[] = gtagParams['send_to'];\n // Make it an array if is isn't, so it can be dealt with the same way.\n if (!Array.isArray(gaSendToList)) {\n gaSendToList = [gaSendToList];\n }\n // Checking 'send_to' fields requires having all measurement ID results back from\n // the dynamic config fetch.\n const dynamicConfigResults = await promiseAllSettled(\n dynamicConfigPromisesList\n );\n for (const sendToId of gaSendToList) {\n // Any fetched dynamic measurement ID that matches this 'send_to' ID\n const foundConfig = dynamicConfigResults.find(\n config => config.measurementId === sendToId\n );\n const initializationPromise =\n foundConfig && initializationPromisesMap[foundConfig.appId];\n if (initializationPromise) {\n initializationPromisesToWaitFor.push(initializationPromise);\n } else {\n // Found an item in 'send_to' that is not associated\n // directly with an FID, possibly a group. Empty this array,\n // exit the loop early, and let it get populated below.\n initializationPromisesToWaitFor = [];\n break;\n }\n }\n }\n\n // This will be unpopulated if there was no 'send_to' field , or\n // if not all entries in the 'send_to' field could be mapped to\n // a FID. In these cases, wait on all pending initialization promises.\n if (initializationPromisesToWaitFor.length === 0) {\n /* eslint-disable-next-line @typescript-eslint/no-floating-promises */\n initializationPromisesToWaitFor = Object.values(\n initializationPromisesMap\n );\n }\n\n // Run core gtag function with args after all relevant initialization\n // promises have been resolved.\n await Promise.all(initializationPromisesToWaitFor);\n // Workaround for http://b/141370449 - third argument cannot be undefined.\n gtagCore(GtagCommand.EVENT, measurementId, gtagParams || {});\n } catch (e) {\n logger.error(e);\n }\n}\n\n/**\n * Wraps a standard gtag function with extra code to wait for completion of\n * relevant initialization promises before sending requests.\n *\n * @param gtagCore Basic gtag function that just appends to dataLayer.\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\n */\nfunction wrapGtag(\n gtagCore: Gtag,\n /**\n * Allows wrapped gtag calls to wait on whichever initialization promises are required,\n * depending on the contents of the gtag params' `send_to` field, if any.\n */\n initializationPromisesMap: { [appId: string]: Promise<string> },\n /**\n * Wrapped gtag calls sometimes require all dynamic config fetches to have returned\n * before determining what initialization promises (which include FIDs) to wait for.\n */\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n /**\n * Wrapped gtag config calls can narrow down which initialization promise (with FID)\n * to wait for if the measurementId is already fetched, by getting the corresponding appId,\n * which is the key for the initialization promises map.\n */\n measurementIdToAppId: { [measurementId: string]: string }\n): Gtag {\n /**\n * Wrapper around gtag that ensures FID is sent with gtag calls.\n * @param command Gtag command type.\n * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET.\n * @param gtagParams Params if event is EVENT/CONFIG.\n */\n async function gtagWrapper(\n command: 'config' | 'set' | 'event' | 'consent' | 'get' | string,\n ...args: unknown[]\n ): Promise<void> {\n try {\n // If event, check that relevant initialization promises have completed.\n if (command === GtagCommand.EVENT) {\n const [measurementId, gtagParams] = args;\n // If EVENT, second arg must be measurementId.\n await gtagOnEvent(\n gtagCore,\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementId as string,\n gtagParams as GtagConfigOrEventParams\n );\n } else if (command === GtagCommand.CONFIG) {\n const [measurementId, gtagParams] = args;\n // If CONFIG, second arg must be measurementId.\n await gtagOnConfig(\n gtagCore,\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementIdToAppId,\n measurementId as string,\n gtagParams as GtagConfigOrEventParams\n );\n } else if (command === GtagCommand.CONSENT) {\n const [consentAction, gtagParams] = args;\n // consentAction can be one of 'default' or 'update'.\n gtagCore(\n GtagCommand.CONSENT,\n consentAction,\n gtagParams as ConsentSettings\n );\n } else if (command === GtagCommand.GET) {\n const [measurementId, fieldName, callback] = args;\n gtagCore(\n GtagCommand.GET,\n measurementId as string,\n fieldName as string,\n callback as (...args: unknown[]) => void\n );\n } else if (command === GtagCommand.SET) {\n const [customParams] = args;\n // If SET, second arg must be params.\n gtagCore(GtagCommand.SET, customParams as CustomParams);\n } else {\n gtagCore(command, ...args);\n }\n } catch (e) {\n logger.error(e);\n }\n }\n return gtagWrapper as Gtag;\n}\n\n/**\n * Creates global gtag function or wraps existing one if found.\n * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and\n * 'event' calls that belong to the GAID associated with this Firebase instance.\n *\n * @param initializationPromisesMap Map of appIds to their initialization promises.\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\n * @param dataLayerName Name of global GA datalayer array.\n * @param gtagFunctionName Name of global gtag function (\"gtag\" if not user-specified).\n */\nexport function wrapOrCreateGtag(\n initializationPromisesMap: { [appId: string]: Promise<string> },\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementIdToAppId: { [measurementId: string]: string },\n dataLayerName: string,\n gtagFunctionName: string\n): {\n gtagCore: Gtag;\n wrappedGtag: Gtag;\n} {\n // Create a basic core gtag function\n let gtagCore: Gtag = function (..._args: unknown[]) {\n // Must push IArguments object, not an array.\n (window[dataLayerName] as DataLayer).push(arguments);\n };\n\n // Replace it with existing one if found\n if (\n window[gtagFunctionName] &&\n typeof window[gtagFunctionName] === 'function'\n ) {\n // @ts-ignore\n gtagCore = window[gtagFunctionName];\n }\n\n window[gtagFunctionName] = wrapGtag(\n gtagCore,\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementIdToAppId\n );\n\n return {\n gtagCore,\n wrappedGtag: window[gtagFunctionName] as Gtag\n };\n}\n\n/**\n * Returns the script tag in the DOM matching both the gtag url pattern\n * and the provided data layer name.\n */\nexport function findGtagScriptOnPage(\n dataLayerName: string\n): HTMLScriptElement | null {\n const scriptTags = window.document.getElementsByTagName('script');\n for (const tag of Object.values(scriptTags)) {\n if (\n tag.src &&\n tag.src.includes(GTAG_URL) &&\n tag.src.includes(dataLayerName)\n ) {\n return tag;\n }\n }\n return null;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts\n */\n\nimport { FirebaseApp } from '@firebase/app';\nimport { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types';\nimport { FirebaseError, calculateBackoffMillis } from '@firebase/util';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\nimport { DYNAMIC_CONFIG_URL, FETCH_TIMEOUT_MILLIS } from './constants';\nimport { logger } from './logger';\n\n// App config fields needed by analytics.\nexport interface AppFields {\n appId: string;\n apiKey: string;\n measurementId?: string;\n}\n\n/**\n * Backoff factor for 503 errors, which we want to be conservative about\n * to avoid overloading servers. Each retry interval will be\n * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one\n * will be ~30 seconds (with fuzzing).\n */\nexport const LONG_RETRY_FACTOR = 30;\n\n/**\n * Base wait interval to multiplied by backoffFactor^backoffCount.\n */\nconst BASE_INTERVAL_MILLIS = 1000;\n\n/**\n * Stubbable retry data storage class.\n */\nclass RetryData {\n constructor(\n public throttleMetadata: { [appId: string]: ThrottleMetadata } = {},\n public intervalMillis: number = BASE_INTERVAL_MILLIS\n ) {}\n\n getThrottleMetadata(appId: string): ThrottleMetadata {\n return this.throttleMetadata[appId];\n }\n\n setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void {\n this.throttleMetadata[appId] = metadata;\n }\n\n deleteThrottleMetadata(appId: string): void {\n delete this.throttleMetadata[appId];\n }\n}\n\nconst defaultRetryData = new RetryData();\n\n/**\n * Set GET request headers.\n * @param apiKey App API key.\n */\nfunction getHeaders(apiKey: string): Headers {\n return new Headers({\n Accept: 'application/json',\n 'x-goog-api-key': apiKey\n });\n}\n\n/**\n * Fetches dynamic config from backend.\n * @param app Firebase app to fetch config for.\n */\nexport async function fetchDynamicConfig(\n appFields: AppFields\n): Promise<DynamicConfig> {\n const { appId, apiKey } = appFields;\n const request: RequestInit = {\n method: 'GET',\n headers: getHeaders(apiKey)\n };\n const appUrl = DYNAMIC_CONFIG_URL.replace('{app-id}', appId);\n const response = await fetch(appUrl, request);\n if (response.status !== 200 && response.status !== 304) {\n let errorMessage = '';\n try {\n // Try to get any error message text from server response.\n const jsonResponse = (await response.json()) as {\n error?: { message?: string };\n };\n if (jsonResponse.error?.message) {\n errorMessage = jsonResponse.error.message;\n }\n } catch (_ignored) {}\n throw ERROR_FACTORY.create(AnalyticsError.CONFIG_FETCH_FAILED, {\n httpStatus: response.status,\n responseMessage: errorMessage\n });\n }\n return response.json();\n}\n\n/**\n * Fetches dynamic config from backend, retrying if failed.\n * @param app Firebase app to fetch config for.\n */\nexport async function fetchDynamicConfigWithRetry(\n app: FirebaseApp,\n // retryData and timeoutMillis are parameterized to allow passing a different value for testing.\n retryData: RetryData = defaultRetryData,\n timeoutMillis?: number\n): Promise<DynamicConfig | MinimalDynamicConfig> {\n const { appId, apiKey, measurementId } = app.options;\n\n if (!appId) {\n throw ERROR_FACTORY.create(AnalyticsError.NO_APP_ID);\n }\n\n if (!apiKey) {\n if (measurementId) {\n return {\n measurementId,\n appId\n };\n }\n throw ERROR_FACTORY.create(AnalyticsError.NO_API_KEY);\n }\n\n const throttleMetadata: ThrottleMetadata = retryData.getThrottleMetadata(\n appId\n ) || {\n backoffCount: 0,\n throttleEndTimeMillis: Date.now()\n };\n\n const signal = new AnalyticsAbortSignal();\n\n setTimeout(\n async () => {\n // Note a very low delay, eg < 10ms, can elapse before listeners are initialized.\n signal.abort();\n },\n timeoutMillis !== undefined ? timeoutMillis : FETCH_TIMEOUT_MILLIS\n );\n\n return attemptFetchDynamicConfigWithRetry(\n { appId, apiKey, measurementId },\n throttleMetadata,\n signal,\n retryData\n );\n}\n\n/**\n * Runs one retry attempt.\n * @param appFields Necessary app config fields.\n * @param throttleMetadata Ongoing metadata to determine throttling times.\n * @param signal Abort signal.\n */\nasync function attemptFetchDynamicConfigWithRetry(\n appFields: AppFields,\n { throttleEndTimeMillis, backoffCount }: ThrottleMetadata,\n signal: AnalyticsAbortSignal,\n retryData: RetryData = defaultRetryData // for testing\n): Promise<DynamicConfig | MinimalDynamicConfig> {\n const { appId, measurementId } = appFields;\n // Starts with a (potentially zero) timeout to support resumption from stored state.\n // Ensures the throttle end time is honored if the last attempt timed out.\n // Note the SDK will never make a request if the fetch timeout expires at this point.\n try {\n await setAbortableTimeout(signal, throttleEndTimeMillis);\n } catch (e) {\n if (measurementId) {\n logger.warn(\n `Timed out fetching this Firebase app's measurement ID from the server.` +\n ` Falling back to the measurement ID ${measurementId}` +\n ` provided in the \"measurementId\" field in the local Firebase config. [${\n (e as Error)?.message\n }]`\n );\n return { appId, measurementId };\n }\n throw e;\n }\n\n try {\n const response = await fetchDynamicConfig(appFields);\n\n // Note the SDK only clears throttle state if response is success or non-retriable.\n retryData.deleteThrottleMetadata(appId);\n\n return response;\n } catch (e) {\n const error = e as Error;\n if (!isRetriableError(error)) {\n retryData.deleteThrottleMetadata(appId);\n if (measurementId) {\n logger.warn(\n `Failed to fetch this Firebase app's measurement ID from the server.` +\n ` Falling back to the measurement ID ${measurementId}` +\n ` provided in the \"measurementId\" field in the local Firebase config. [${error?.message}]`\n );\n return { appId, measurementId };\n } else {\n throw e;\n }\n }\n\n const backoffMillis =\n Number(error?.customData?.httpStatus) === 503\n ? calculateBackoffMillis(\n backoffCount,\n retryData.intervalMillis,\n LONG_RETRY_FACTOR\n )\n : calculateBackoffMillis(backoffCount, retryData.intervalMillis);\n\n // Increments backoff state.\n const throttleMetadata = {\n throttleEndTimeMillis: Date.now() + backoffMillis,\n backoffCount: backoffCount + 1\n };\n\n // Persists state.\n retryData.setThrottleMetadata(appId, throttleMetadata);\n logger.debug(`Calling attemptFetch again in ${backoffMillis} millis`);\n\n return attemptFetchDynamicConfigWithRetry(\n appFields,\n throttleMetadata,\n signal,\n retryData\n );\n }\n}\n\n/**\n * Supports waiting on a backoff by:\n *\n * <ul>\n * <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li>\n * <li>Listening on a signal bus for abort events, just like the Fetch API</li>\n * <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled\n * request appear the same.</li>\n * </ul>\n *\n * <p>Visible for testing.\n */\nfunction setAbortableTimeout(\n signal: AnalyticsAbortSignal,\n throttleEndTimeMillis: number\n): Promise<void> {\n return new Promise((resolve, reject) => {\n // Derives backoff from given end time, normalizing negative numbers to zero.\n const backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0);\n\n const timeout = setTimeout(resolve, backoffMillis);\n\n // Adds listener, rather than sets onabort, because signal is a shared object.\n signal.addEventListener(() => {\n clearTimeout(timeout);\n // If the request completes before this timeout, the rejection has no effect.\n reject(\n ERROR_FACTORY.create(AnalyticsError.FETCH_THROTTLE, {\n throttleEndTimeMillis\n })\n );\n });\n });\n}\n\ntype RetriableError = FirebaseError & { customData: { httpStatus: string } };\n\n/**\n * Returns true if the {@link Error} indicates a fetch request may succeed later.\n */\nfunction isRetriableError(e: Error): e is RetriableError {\n if (!(e instanceof FirebaseError) || !e.customData) {\n return false;\n }\n\n // Uses string index defined by ErrorData, which FirebaseError implements.\n const httpStatus = Number(e.customData['httpStatus']);\n\n return (\n httpStatus === 429 ||\n httpStatus === 500 ||\n httpStatus === 503 ||\n httpStatus === 504\n );\n}\n\n/**\n * Shims a minimal AbortSignal (copied from Remote Config).\n *\n * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects\n * of networking, such as retries. Firebase doesn't use AbortController enough to justify a\n * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be\n * swapped out if/when we do.\n */\nexport class AnalyticsAbortSignal {\n listeners: Array<() => void> = [];\n addEventListener(listener: () => void): void {\n this.listeners.push(listener);\n }\n abort(): void {\n this.listeners.forEach(listener => listener());\n }\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AnalyticsCallOptions,\n CustomParams,\n ControlParams,\n EventParams,\n ConsentSettings\n} from './public-types';\nimport { Gtag } from './types';\nimport { GtagCommand } from './constants';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\n\n/**\n * Event parameters to set on 'gtag' during initialization.\n */\nexport let defaultEventParametersForInit: CustomParams | undefined;\n\n/**\n * Logs an analytics event through the Firebase SDK.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param eventName Google Analytics event name, choose from standard list or use a custom string.\n * @param eventParams Analytics event parameters.\n */\nexport async function logEvent(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n eventName: string,\n eventParams?: EventParams,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n gtagFunction(GtagCommand.EVENT, eventName, eventParams);\n return;\n } else {\n const measurementId = await initializationPromise;\n const params: EventParams | ControlParams = {\n ...eventParams,\n 'send_to': measurementId\n };\n gtagFunction(GtagCommand.EVENT, eventName, params);\n }\n}\n\n/**\n * Set screen_name parameter for this Google Analytics ID.\n *\n * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.\n * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param screenName Screen name string to set.\n */\nexport async function setCurrentScreen(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n screenName: string | null,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n gtagFunction(GtagCommand.SET, { 'screen_name': screenName });\n return Promise.resolve();\n } else {\n const measurementId = await initializationPromise;\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'screen_name': screenName\n });\n }\n}\n\n/**\n * Set user_id parameter for this Google Analytics ID.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param id User ID string to set\n */\nexport async function setUserId(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n id: string | null,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n gtagFunction(GtagCommand.SET, { 'user_id': id });\n return Promise.resolve();\n } else {\n const measurementId = await initializationPromise;\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'user_id': id\n });\n }\n}\n\n/**\n * Set all other user properties other than user_id and screen_name.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n * @param properties Map of user properties to set\n */\nexport async function setUserProperties(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>,\n properties: CustomParams,\n options?: AnalyticsCallOptions\n): Promise<void> {\n if (options && options.global) {\n const flatProperties: { [key: string]: unknown } = {};\n for (const key of Object.keys(properties)) {\n // use dot notation for merge behavior in gtag.js\n flatProperties[`user_properties.${key}`] = properties[key];\n }\n gtagFunction(GtagCommand.SET, flatProperties);\n return Promise.resolve();\n } else {\n const measurementId = await initializationPromise;\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'user_properties': properties\n });\n }\n}\n\n/**\n * Retrieves a unique Google Analytics identifier for the web client.\n * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.\n *\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\n */\nexport async function internalGetGoogleAnalyticsClientId(\n gtagFunction: Gtag,\n initializationPromise: Promise<string>\n): Promise<string> {\n const measurementId = await initializationPromise;\n return new Promise((resolve, reject) => {\n gtagFunction(\n GtagCommand.GET,\n measurementId,\n 'client_id',\n (clientId: string) => {\n if (!clientId) {\n reject(ERROR_FACTORY.create(AnalyticsError.NO_CLIENT_ID));\n }\n resolve(clientId);\n }\n );\n });\n}\n\n/**\n * Set whether collection is enabled for this ID.\n *\n * @param enabled If true, collection is enabled for this ID.\n */\nexport async function setAnalyticsCollectionEnabled(\n initializationPromise: Promise<string>,\n enabled: boolean\n): Promise<void> {\n const measurementId = await initializationPromise;\n window[`ga-disable-${measurementId}`] = !enabled;\n}\n\n/**\n * Consent parameters to default to during 'gtag' initialization.\n */\nexport let defaultConsentSettingsForInit: ConsentSettings | undefined;\n\n/**\n * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of\n * analytics.\n *\n * @param consentSettings Maps the applicable end user consent state for gtag.js.\n */\nexport function _setConsentDefaultForInit(\n consentSettings?: ConsentSettings\n): void {\n defaultConsentSettingsForInit = consentSettings;\n}\n\n/**\n * Sets the variable `defaultEventParametersForInit` for use in the initialization of\n * analytics.\n *\n * @param customParams Any custom params the user may pass to gtag.js.\n */\nexport function _setDefaultEventParametersForInit(\n customParams?: CustomParams\n): void {\n defaultEventParametersForInit = customParams;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DynamicConfig, Gtag, MinimalDynamicConfig } from './types';\nimport { GtagCommand, GA_FID_KEY, ORIGIN_KEY } from './constants';\nimport { _FirebaseInstallationsInternal } from '@firebase/installations';\nimport { fetchDynamicConfigWithRetry } from './get-config';\nimport { logger } from './logger';\nimport { FirebaseApp } from '@firebase/app';\nimport {\n isIndexedDBAvailable,\n validateIndexedDBOpenable\n} from '@firebase/util';\nimport { ERROR_FACTORY, AnalyticsError } from './errors';\nimport { findGtagScriptOnPage, insertScriptTag } from './helpers';\nimport { AnalyticsSettings } from './public-types';\nimport {\n defaultConsentSettingsForInit,\n _setConsentDefaultForInit,\n defaultEventParametersForInit,\n _setDefaultEventParametersForInit\n} from './functions';\n\nasync function validateIndexedDB(): Promise<boolean> {\n if (!isIndexedDBAvailable()) {\n logger.warn(\n ERROR_FACTORY.create(AnalyticsError.INDEXEDDB_UNAVAILABLE, {\n errorInfo: 'IndexedDB is not available in this environment.'\n }).message\n );\n return false;\n } else {\n try {\n await validateIndexedDBOpenable();\n } catch (e) {\n logger.warn(\n ERROR_FACTORY.create(AnalyticsError.INDEXEDDB_UNAVAILABLE, {\n errorInfo: (e as Error)?.toString()\n }).message\n );\n return false;\n }\n }\n return true;\n}\n\n/**\n * Initialize the analytics instance in gtag.js by calling config command with fid.\n *\n * NOTE: We combine analytics initialization and setting fid together because we want fid to be\n * part of the `page_view` event that's sent during the initialization\n * @param app Firebase app\n * @param gtagCore The gtag function that's not wrapped.\n * @param dynamicConfigPromisesList Array of all dynamic config promises.\n * @param measurementIdToAppId Maps measurementID to appID.\n * @param installations _FirebaseInstallationsInternal instance.\n *\n * @returns Measurement ID.\n */\nexport async function _initializeAnalytics(\n app: FirebaseApp,\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >,\n measurementIdToAppId: { [key: string]: string },\n installations: _FirebaseInstallationsInternal,\n gtagCore: Gtag,\n dataLayerName: string,\n options?: AnalyticsSettings\n): Promise<string> {\n const dynamicConfigPromise = fetchDynamicConfigWithRetry(app);\n // Once fetched, map measurementIds to appId, for ease of lookup in wrapped gtag function.\n dynamicConfigPromise\n .then(config => {\n measurementIdToAppId[config.measurementId] = config.appId;\n if (\n app.options.measurementId &&\n config.measurementId !== app.options.measurementId\n ) {\n logger.warn(\n `The measurement ID in the local Firebase config (${app.options.measurementId})` +\n ` does not match the measurement ID fetched from the server (${config.measurementId}).` +\n ` To ensure analytics events are always sent to the correct Analytics property,` +\n ` update the` +\n ` measurement ID field in the local config or remove it from the local config.`\n );\n }\n })\n .catch(e => logger.error(e));\n // Add to list to track state of all dynamic config promises.\n dynamicConfigPromisesList.push(dynamicConfigPromise);\n\n const fidPromise: Promise<string | undefined> = validateIndexedDB().then(\n envIsValid => {\n if (envIsValid) {\n return installations.getId();\n } else {\n return undefined;\n }\n }\n );\n\n const [dynamicConfig, fid] = await Promise.all([\n dynamicConfigPromise,\n fidPromise\n ]);\n\n // Detect if user has already put the gtag <script> tag on this page with the passed in\n // data layer name.\n if (!findGtagScriptOnPage(dataLayerName)) {\n insertScriptTag(dataLayerName, dynamicConfig.measurementId);\n }\n\n // Detects if there are consent settings that need to be configured.\n if (defaultConsentSettingsForInit) {\n gtagCore(GtagCommand.CONSENT, 'default', defaultConsentSettingsForInit);\n _setConsentDefaultForInit(undefined);\n }\n\n // This command initializes gtag.js and only needs to be called once for the entire web app,\n // but since it is idempotent, we can call it multiple times.\n // We keep it together with other initialization logic for better code structure.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (gtagCore as any)('js', new Date());\n // User config added first. We don't want users to accidentally overwrite\n // base Firebase config properties.\n const configProperties: Record<string, unknown> = options?.config ?? {};\n\n // guard against developers accidentally setting properties with prefix `firebase_`\n configProperties[ORIGIN_KEY] = 'firebase';\n configProperties.update = true;\n\n if (fid != null) {\n configProperties[GA_FID_KEY] = fid;\n }\n\n // It should be the first config command called on this GA-ID\n // Initialize this GA-ID and set FID on it using the gtag config API.\n // Note: This will trigger a page_view event unless 'send_page_view' is set to false in\n // `configProperties`.\n gtagCore(GtagCommand.CONFIG, dynamicConfig.measurementId, configProperties);\n\n // Detects if there is data that will be set on every event logged from the SDK.\n if (defaultEventParametersForInit) {\n gtagCore(GtagCommand.SET, defaultEventParametersForInit);\n _setDefaultEventParametersForInit(undefined);\n }\n\n return dynamicConfig.measurementId;\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SettingsOptions, Analytics, AnalyticsSettings } from './public-types';\nimport { Gtag, DynamicConfig, MinimalDynamicConfig } from './types';\nimport { getOrCreateDataLayer, wrapOrCreateGtag } from './helpers';\nimport { AnalyticsError, ERROR_FACTORY } from './errors';\nimport { _FirebaseInstallationsInternal } from '@firebase/installations';\nimport { areCookiesEnabled, isBrowserExtension } from '@firebase/util';\nimport { _initializeAnalytics } from './initialize-analytics';\nimport { logger } from './logger';\nimport { FirebaseApp, _FirebaseService } from '@firebase/app';\n\n/**\n * Analytics Service class.\n */\nexport class AnalyticsService implements Analytics, _FirebaseService {\n constructor(public app: FirebaseApp) {}\n _delete(): Promise<void> {\n delete initializationPromisesMap[this.app.options.appId!];\n return Promise.resolve();\n }\n}\n\n/**\n * Maps appId to full initialization promise. Wrapped gtag calls must wait on\n * all or some of these, depending on the call's `send_to` param and the status\n * of the dynamic config fetches (see below).\n */\nexport let initializationPromisesMap: {\n [appId: string]: Promise<string>; // Promise contains measurement ID string.\n} = {};\n\n/**\n * List of dynamic config fetch promises. In certain cases, wrapped gtag calls\n * wait on all these to be complete in order to determine if it can selectively\n * wait for only certain initialization (FID) promises or if it must wait for all.\n */\nlet dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n> = [];\n\n/**\n * Maps fetched measurementIds to appId. Populated when the app's dynamic config\n * fetch completes. If already populated, gtag config calls can use this to\n * selectively wait for only this app's initialization promise (FID) instead of all\n * initialization promises.\n */\nconst measurementIdToAppId: { [measurementId: string]: string } = {};\n\n/**\n * Name for window global data layer array used by GA: defaults to 'dataLayer'.\n */\nlet dataLayerName: string = 'dataLayer';\n\n/**\n * Name for window global gtag function used by GA: defaults to 'gtag'.\n */\nlet gtagName: string = 'gtag';\n\n/**\n * Reproduction of standard gtag function or reference to existing\n * gtag function on window object.\n */\nlet gtagCoreFunction: Gtag;\n\n/**\n * Wrapper around gtag function that ensures FID is sent with all\n * relevant event and config calls.\n */\nexport let wrappedGtagFunction: Gtag;\n\n/**\n * Flag to ensure page initialization steps (creation or wrapping of\n * dataLayer and gtag script) are only run once per page load.\n */\nlet globalInitDone: boolean = false;\n\n/**\n * For testing\n * @internal\n */\nexport function resetGlobalVars(\n newGlobalInitDone = false,\n newInitializationPromisesMap = {},\n newDynamicPromises = []\n): void {\n globalInitDone = newGlobalInitDone;\n initializationPromisesMap = newInitializationPromisesMap;\n dynamicConfigPromisesList = newDynamicPromises;\n dataLayerName = 'dataLayer';\n gtagName = 'gtag';\n}\n\n/**\n * For testing\n * @internal\n */\nexport function getGlobalVars(): {\n initializationPromisesMap: { [appId: string]: Promise<string> };\n dynamicConfigPromisesList: Array<\n Promise<DynamicConfig | MinimalDynamicConfig>\n >;\n} {\n return {\n initializationPromisesMap,\n dynamicConfigPromisesList\n };\n}\n\n/**\n * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.\n * Intended to be used if `gtag.js` script has been installed on\n * this page independently of Firebase Analytics, and is using non-default\n * names for either the `gtag` function or for `dataLayer`.\n * Must be called before calling `getAnalytics()` or it won't\n * have any effect.\n *\n * @public\n *\n * @param options - Custom gtag and dataLayer names.\n */\nexport function settings(options: SettingsOptions): void {\n if (globalInitDone) {\n throw ERROR_FACTORY.create(AnalyticsError.ALREADY_INITIALIZED);\n }\n if (options.dataLayerName) {\n dataLayerName = options.dataLayerName;\n }\n if (options.gtagName) {\n gtagName = options.gtagName;\n }\n}\n\n/**\n * Returns true if no environment mismatch is found.\n * If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT\n * error that also lists details for each mismatch found.\n */\nfunction warnOnBrowserContextMismatch(): void {\n const mismatchedEnvMessages = [];\n if (isBrowserExtension()) {\n mismatchedEnvMessages.push('This is a browser extension environment.');\n }\n if (!areCookiesEnabled()) {\n mismatchedEnvMessages.push('Cookies are not available.');\n }\n if (mismatchedEnvMessages.length > 0) {\n const details = mismatchedEnvMessages\n .map((message, index) => `(${index + 1}) ${message}`)\n .join(' ');\n const err = ERROR_FACTORY.create(AnalyticsError.INVALID_ANALYTICS_CONTEXT, {\n errorInfo: details\n });\n logger.warn(err.message);\n }\n}\n\n/**\n * Analytics instance factory.\n * @internal\n */\nexport function factory(\n app: FirebaseApp,\n installations: _FirebaseInstallationsInternal,\n options?: AnalyticsSettings\n): AnalyticsService {\n warnOnBrowserContextMismatch();\n const appId = app.options.appId;\n if (!appId) {\n throw ERROR_FACTORY.create(AnalyticsError.NO_APP_ID);\n }\n if (!app.options.apiKey) {\n if (app.options.measurementId) {\n logger.warn(\n `The \"apiKey\" field is empty in the local Firebase config. This is needed to fetch the latest` +\n ` measurement ID for this Firebase app. Falling back to the measurement ID ${app.options.measurementId}` +\n ` provided in the \"measurementId\" field in the local Firebase config.`\n );\n } else {\n throw ERROR_FACTORY.create(AnalyticsError.NO_API_KEY);\n }\n }\n if (initializationPromisesMap[appId] != null) {\n throw ERROR_FACTORY.create(AnalyticsError.ALREADY_EXISTS, {\n id: appId\n });\n }\n\n if (!globalInitDone) {\n // Steps here should only be done once per page: creation or wrapping\n // of dataLayer and global gtag function.\n\n getOrCreateDataLayer(dataLayerName);\n\n const { wrappedGtag, gtagCore } = wrapOrCreateGtag(\n initializationPromisesMap,\n dynamicConfigPromisesList,\n measurementIdToAppId,\n dataLayerName,\n gtagName\n );\n wrappedGtagFunction = wrappedGtag;\n gtagCoreFunction = gtagCore;\n\n globalInitDone = true;\n }\n // Async but non-blocking.\n // This map reflects the completion state of all promises for each appId.\n initializationPromisesMap[appId] = _initializeAnalytics(\n app,\n dynamicConfigPromisesList,\n measurementIdToAppId,\n installations,\n gtagCoreFunction,\n dataLayerName,\n options\n );\n\n const analyticsInstance: AnalyticsService = new AnalyticsService(app);\n\n return analyticsInstance;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable camelcase */\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _getProvider, FirebaseApp, getApp } from '@firebase/app';\nimport {\n Analytics,\n AnalyticsCallOptions,\n AnalyticsSettings,\n ConsentSettings,\n CustomParams,\n EventNameString,\n EventParams\n} from './public-types';\nimport { Provider } from '@firebase/component';\nimport {\n isIndexedDBAvailable,\n validateIndexedDBOpenable,\n areCookiesEnabled,\n isBrowserExtension,\n getModularInstance,\n deepEqual\n} from '@firebase/util';\nimport { ANALYTICS_TYPE, GtagCommand } from './constants';\nimport {\n AnalyticsService,\n initializationPromisesMap,\n wrappedGtagFunction\n} from './factory';\nimport { logger } from './logger';\nimport {\n logEvent as internalLogEvent,\n setCurrentScreen as internalSetCurrentScreen,\n setUserId as internalSetUserId,\n setUserProperties as internalSetUserProperties,\n setAnalyticsCollectionEnabled as internalSetAnalyticsCollectionEnabled,\n _setConsentDefaultForInit,\n _setDefaultEventParametersForInit,\n internalGetGoogleAnalyticsClientId\n} from './functions';\nimport { ERROR_FACTORY, AnalyticsError } from './errors';\n\nexport { settings } from './factory';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n [ANALYTICS_TYPE]: AnalyticsService;\n }\n}\n\n/**\n * Returns an {@link Analytics} instance for the given app.\n *\n * @public\n *\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n */\nexport function getAnalytics(app: FirebaseApp = getApp()): Analytics {\n app = getModularInstance(app);\n // Dependencies\n const analyticsProvider: Provider<'analytics'> = _getProvider(\n app,\n ANALYTICS_TYPE\n );\n\n if (analyticsProvider.isInitialized()) {\n return analyticsProvider.getImmediate();\n }\n\n return initializeAnalytics(app);\n}\n\n/**\n * Returns an {@link Analytics} instance for the given app.\n *\n * @public\n *\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n */\nexport function initializeAnalytics(\n app: FirebaseApp,\n options: AnalyticsSettings = {}\n): Analytics {\n // Dependencies\n const analyticsProvider: Provider<'analytics'> = _getProvider(\n app,\n ANALYTICS_TYPE\n );\n if (analyticsProvider.isInitialized()) {\n const existingInstance = analyticsProvider.getImmediate();\n if (deepEqual(options, analyticsProvider.getOptions())) {\n return existingInstance;\n } else {\n throw ERROR_FACTORY.create(AnalyticsError.ALREADY_INITIALIZED);\n }\n }\n const analyticsInstance = analyticsProvider.initialize({ options });\n return analyticsInstance;\n}\n\n/**\n * This is a public static method provided to users that wraps four different checks:\n *\n * 1. Check if it's not a browser extension environment.\n * 2. Check if cookies are enabled in current browser.\n * 3. Check if IndexedDB is supported by the browser environment.\n * 4. Check if the current browser context is valid for using `IndexedDB.open()`.\n *\n * @public\n *\n */\nexport async function isSupported(): Promise<boolean> {\n if (isBrowserExtension()) {\n return false;\n }\n if (!areCookiesEnabled()) {\n return false;\n }\n if (!isIndexedDBAvailable()) {\n return false;\n }\n\n try {\n const isDBOpenable: boolean = await validateIndexedDBOpenable();\n return isDBOpenable;\n } catch (error) {\n return false;\n }\n}\n\n/**\n * Use gtag `config` command to set `screen_name`.\n *\n * @public\n *\n * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.\n * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.\n *\n * @param analyticsInstance - The {@link Analytics} instance.\n * @param screenName - Screen name to set.\n */\nexport function setCurrentScreen(\n analyticsInstance: Analytics,\n screenName: string,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetCurrentScreen(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n screenName,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Retrieves a unique Google Analytics identifier for the web client.\n * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.\n *\n * @public\n *\n * @param app - The {@link @firebase/app#FirebaseApp} to use.\n */\nexport async function getGoogleAnalyticsClientId(\n analyticsInstance: Analytics\n): Promise<string> {\n analyticsInstance = getModularInstance(analyticsInstance);\n return internalGetGoogleAnalyticsClientId(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!]\n );\n}\n\n/**\n * Use gtag `config` command to set `user_id`.\n *\n * @public\n *\n * @param analyticsInstance - The {@link Analytics} instance.\n * @param id - User ID to set.\n */\nexport function setUserId(\n analyticsInstance: Analytics,\n id: string | null,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetUserId(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n id,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Use gtag `config` command to set all params specified.\n *\n * @public\n */\nexport function setUserProperties(\n analyticsInstance: Analytics,\n properties: CustomParams,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetUserProperties(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n properties,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Sets whether Google Analytics collection is enabled for this app on this device.\n * Sets global `window['ga-disable-analyticsId'] = true;`\n *\n * @public\n *\n * @param analyticsInstance - The {@link Analytics} instance.\n * @param enabled - If true, enables collection, if false, disables it.\n */\nexport function setAnalyticsCollectionEnabled(\n analyticsInstance: Analytics,\n enabled: boolean\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalSetAnalyticsCollectionEnabled(\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n enabled\n ).catch(e => logger.error(e));\n}\n\n/**\n * Adds data that will be set on every event logged from the SDK, including automatic ones.\n * With gtag's \"set\" command, the values passed persist on the current page and are passed with\n * all subsequent events.\n * @public\n * @param customParams - Any custom params the user may pass to gtag.js.\n */\nexport function setDefaultEventParameters(customParams: CustomParams): void {\n // Check if reference to existing gtag function on window object exists\n if (wrappedGtagFunction) {\n wrappedGtagFunction(GtagCommand.SET, customParams);\n } else {\n _setDefaultEventParametersForInit(customParams);\n }\n}\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'add_payment_info',\n eventParams?: {\n coupon?: EventParams['coupon'];\n currency?: EventParams['currency'];\n items?: EventParams['items'];\n payment_type?: EventParams['payment_type'];\n value?: EventParams['value'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'add_shipping_info',\n eventParams?: {\n coupon?: EventParams['coupon'];\n currency?: EventParams['currency'];\n items?: EventParams['items'];\n shipping_tier?: EventParams['shipping_tier'];\n value?: EventParams['value'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart',\n eventParams?: {\n currency?: EventParams['currency'];\n value?: EventParams['value'];\n items?: EventParams['items'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'begin_checkout',\n eventParams?: {\n currency?: EventParams['currency'];\n coupon?: EventParams['coupon'];\n value?: EventParams['value'];\n items?: EventParams['items'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'checkout_progress',\n eventParams?: {\n currency?: EventParams['currency'];\n coupon?: EventParams['coupon'];\n value?: EventParams['value'];\n items?: EventParams['items'];\n checkout_step?: EventParams['checkout_step'];\n checkout_option?: EventParams['checkout_option'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * See\n * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions\n * | Measure exceptions}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'exception',\n eventParams?: {\n description?: EventParams['description'];\n fatal?: EventParams['fatal'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'generate_lead',\n eventParams?: {\n value?: EventParams['value'];\n currency?: EventParams['currency'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'login',\n eventParams?: {\n method?: EventParams['method'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * See\n * {@link https://developers.google.com/analytics/devguides/collection/ga4/views\n * | Page views}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'page_view',\n eventParams?: {\n page_title?: string;\n page_location?: string;\n page_path?: string;\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'purchase' | 'refund',\n eventParams?: {\n value?: EventParams['value'];\n currency?: EventParams['currency'];\n transaction_id: EventParams['transaction_id'];\n tax?: EventParams['tax'];\n shipping?: EventParams['shipping'];\n items?: EventParams['items'];\n coupon?: EventParams['coupon'];\n affiliation?: EventParams['affiliation'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * See {@link https://firebase.google.com/docs/analytics/screenviews\n * | Track Screenviews}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'screen_view',\n eventParams?: {\n firebase_screen: EventParams['firebase_screen'];\n firebase_screen_class: EventParams['firebase_screen_class'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'search' | 'view_search_results',\n eventParams?: {\n search_term?: EventParams['search_term'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'select_content',\n eventParams?: {\n content_type?: EventParams['content_type'];\n item_id?: EventParams['item_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'select_item',\n eventParams?: {\n items?: EventParams['items'];\n item_list_name?: EventParams['item_list_name'];\n item_list_id?: EventParams['item_list_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'select_promotion' | 'view_promotion',\n eventParams?: {\n items?: EventParams['items'];\n promotion_id?: EventParams['promotion_id'];\n promotion_name?: EventParams['promotion_name'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'set_checkout_option',\n eventParams?: {\n checkout_step?: EventParams['checkout_step'];\n checkout_option?: EventParams['checkout_option'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'share',\n eventParams?: {\n method?: EventParams['method'];\n content_type?: EventParams['content_type'];\n item_id?: EventParams['item_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'sign_up',\n eventParams?: {\n method?: EventParams['method'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'timing_complete',\n eventParams?: {\n name: string;\n value: number;\n event_category?: string;\n event_label?: string;\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'view_cart' | 'view_item',\n eventParams?: {\n currency?: EventParams['currency'];\n items?: EventParams['items'];\n value?: EventParams['value'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: 'view_item_list',\n eventParams?: {\n items?: EventParams['items'];\n item_list_name?: EventParams['item_list_name'];\n item_list_id?: EventParams['item_list_id'];\n [key: string]: any;\n },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * @public\n * List of recommended event parameters can be found in\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n */\nexport function logEvent<T extends string>(\n analyticsInstance: Analytics,\n eventName: CustomEventName<T>,\n eventParams?: { [key: string]: any },\n options?: AnalyticsCallOptions\n): void;\n\n/**\n * Sends a Google Analytics event with given `eventParams`. This method\n * automatically associates this logged event with this Firebase web\n * app instance on this device.\n * List of official event parameters can be found in the gtag.js\n * reference documentation:\n * {@link https://developers.google.com/gtagjs/reference/ga4-events\n * | the GA4 reference documentation}.\n *\n * @public\n */\nexport function logEvent(\n analyticsInstance: Analytics,\n eventName: string,\n eventParams?: EventParams,\n options?: AnalyticsCallOptions\n): void {\n analyticsInstance = getModularInstance(analyticsInstance);\n internalLogEvent(\n wrappedGtagFunction,\n initializationPromisesMap[analyticsInstance.app.options.appId!],\n eventName,\n eventParams,\n options\n ).catch(e => logger.error(e));\n}\n\n/**\n * Any custom event name string not in the standard list of recommended\n * event names.\n * @public\n */\nexport type CustomEventName<T> = T extends EventNameString ? never : T;\n\n/**\n * Sets the applicable end user consent state for this web app across all gtag references once\n * Firebase Analytics is initialized.\n *\n * Use the {@link ConsentSettings} to specify individual consent type values. By default consent\n * types are set to \"granted\".\n * @public\n * @param consentSettings - Maps the applicable end user consent state for gtag.js.\n */\nexport function setConsent(consentSettings: ConsentSettings): void {\n // Check if reference to existing gtag function on window object exists\n if (wrappedGtagFunction) {\n wrappedGtagFunction(GtagCommand.CONSENT, 'update', consentSettings);\n } else {\n _setConsentDefaultForInit(consentSettings);\n }\n}\n","/**\n * The Firebase Analytics Web SDK.\n * This SDK does not work in a Node.js environment.\n *\n * @packageDocumentation\n */\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { registerVersion, _registerComponent } from '@firebase/app';\nimport { FirebaseAnalyticsInternal } from '@firebase/analytics-interop-types';\nimport { factory } from './factory';\nimport { ANALYTICS_TYPE } from './constants';\nimport {\n Component,\n ComponentType,\n ComponentContainer,\n InstanceFactoryOptions\n} from '@firebase/component';\nimport { ERROR_FACTORY, AnalyticsError } from './errors';\nimport { logEvent, setUserProperties } from './api';\nimport { name, version } from '../package.json';\nimport { AnalyticsCallOptions, CustomParams } from './public-types';\nimport '@firebase/installations';\n\ndeclare global {\n interface Window {\n [key: string]: unknown;\n }\n}\n\nfunction registerAnalytics(): void {\n _registerComponent(\n new Component(\n ANALYTICS_TYPE,\n (container, { options: analyticsOptions }: InstanceFactoryOptions) => {\n // getImmediate for FirebaseApp will always succeed\n const app = container.getProvider('app').getImmediate();\n const installations = container\n .getProvider('installations-internal')\n .getImmediate();\n\n return factory(app, installations, analyticsOptions);\n },\n ComponentType.PUBLIC\n )\n );\n\n _registerComponent(\n new Component('analytics-internal', internalFactory, ComponentType.PRIVATE)\n );\n\n registerVersion(name, version);\n // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation\n registerVersion(name, version, '__BUILD_TARGET__');\n\n function internalFactory(\n container: ComponentContainer\n ): FirebaseAnalyticsInternal {\n try {\n const analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();\n return {\n logEvent: (\n eventName: string,\n eventParams?: { [key: string]: unknown },\n options?: AnalyticsCallOptions\n ) => logEvent(analytics, eventName, eventParams, options),\n setUserProperties: (\n properties: CustomParams,\n options?: AnalyticsCallOptions\n ) => setUserProperties(analytics, properties, options)\n };\n } catch (e) {\n throw ERROR_FACTORY.create(AnalyticsError.INTEROP_COMPONENT_REG_FAILED, {\n reason: e as Error\n });\n }\n }\n}\n\nregisterAnalytics();\n\nexport * from './api';\nexport * from './public-types';\n"],"names":["Logger","ErrorFactory","calculateBackoffMillis","FirebaseError","logEvent","setCurrentScreen","setUserId","setUserProperties","setAnalyticsCollectionEnabled","isIndexedDBAvailable","validateIndexedDBOpenable","isBrowserExtension","areCookiesEnabled","app","getApp","getModularInstance","_getProvider","deepEqual","internalSetCurrentScreen","internalSetUserId","internalSetUserProperties","internalSetAnalyticsCollectionEnabled","internalLogEvent","_registerComponent","Component","registerVersion"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAEH;;AAEG;AACI,MAAM,cAAc,GAAG,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IAAI,EAAE,OAAO,CAAC,CAAC;;AAE/B,IAAAA,mBAAe,CAAC,IAAI,EAAE,OAAO,EAAE,SAAkB,CAAC,CAAC;IAEnD,SAAS,eAAe,CACtB,SAA6B,EAAA;AAE7B,QAAA,IAAI;YACF,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,YAAY,EAAE,CAAC;YACvE,OAAO;AACL,gBAAA,QAAQ,EAAE,CACR,SAAiB,EACjB,WAAwC,EACxC,OAA8B,KAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC;AACzD,gBAAA,iBAAiB,EAAE,CACjB,UAAwB,EACxB,OAA8B,KAC3B,iBAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC;aACvD,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,aAAa,CAAC,MAAM,CAA8C,8BAAA,oDAAA;AACtE,gBAAA,MAAM,EAAE,CAAU;AACnB,aAAA,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAED,iBAAiB,EAAE;;;;;;;;;;;;;;;"}
\ No newline at end of file diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/api.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/api.d.ts new file mode 100644 index 0000000..3527276 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/api.d.ts @@ -0,0 +1,453 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, CustomParams, EventNameString, EventParams } from './public-types'; +import { ANALYTICS_TYPE } from './constants'; +import { AnalyticsService } from './factory'; +export { settings } from './factory'; +declare module '@firebase/component' { + interface NameServiceMapping { + [ANALYTICS_TYPE]: AnalyticsService; + } +} +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getAnalytics(app?: FirebaseApp): Analytics; +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics; +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +export declare function isSupported(): Promise<boolean>; +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void; +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>; +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void; +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void; +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void; +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +export declare function setDefaultEventParameters(customParams: CustomParams): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + payment_type?: EventParams['payment_type']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + shipping_tier?: EventParams['shipping_tier']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: { + currency?: EventParams['currency']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions + * | Measure exceptions}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: { + description?: EventParams['description']; + fatal?: EventParams['fatal']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/views + * | Page views}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: { + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + transaction_id: EventParams['transaction_id']; + tax?: EventParams['tax']; + shipping?: EventParams['shipping']; + items?: EventParams['items']; + coupon?: EventParams['coupon']; + affiliation?: EventParams['affiliation']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See {@link https://firebase.google.com/docs/analytics/screenviews + * | Track Screenviews}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: { + firebase_screen: EventParams['firebase_screen']; + firebase_screen_class: EventParams['firebase_screen_class']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: { + search_term?: EventParams['search_term']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: { + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: { + items?: EventParams['items']; + promotion_id?: EventParams['promotion_id']; + promotion_name?: EventParams['promotion_name']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: { + method?: EventParams['method']; + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: { + name: string; + value: number; + event_category?: string; + event_label?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: { + currency?: EventParams['currency']; + items?: EventParams['items']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: { + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Any custom event name string not in the standard list of recommended + * event names. + * @public + */ +export type CustomEventName<T> = T extends EventNameString ? never : T; +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +export declare function setConsent(consentSettings: ConsentSettings): void; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/constants.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/constants.d.ts new file mode 100644 index 0000000..c907c32 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/constants.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Analytics. + */ +export declare const ANALYTICS_TYPE = "analytics"; +export declare const GA_FID_KEY = "firebase_id"; +export declare const ORIGIN_KEY = "origin"; +export declare const FETCH_TIMEOUT_MILLIS: number; +export declare const DYNAMIC_CONFIG_URL = "https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig"; +export declare const GTAG_URL = "https://www.googletagmanager.com/gtag/js"; +export declare const enum GtagCommand { + EVENT = "event", + SET = "set", + CONFIG = "config", + CONSENT = "consent", + GET = "get" +} diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/errors.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/errors.d.ts new file mode 100644 index 0000000..76fc8bf --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/errors.d.ts @@ -0,0 +1,57 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ErrorFactory } from '@firebase/util'; +export declare const enum AnalyticsError { + ALREADY_EXISTS = "already-exists", + ALREADY_INITIALIZED = "already-initialized", + ALREADY_INITIALIZED_SETTINGS = "already-initialized-settings", + INTEROP_COMPONENT_REG_FAILED = "interop-component-reg-failed", + INVALID_ANALYTICS_CONTEXT = "invalid-analytics-context", + INDEXEDDB_UNAVAILABLE = "indexeddb-unavailable", + FETCH_THROTTLE = "fetch-throttle", + CONFIG_FETCH_FAILED = "config-fetch-failed", + NO_API_KEY = "no-api-key", + NO_APP_ID = "no-app-id", + NO_CLIENT_ID = "no-client-id", + INVALID_GTAG_RESOURCE = "invalid-gtag-resource" +} +interface ErrorParams { + [AnalyticsError.ALREADY_EXISTS]: { + id: string; + }; + [AnalyticsError.INTEROP_COMPONENT_REG_FAILED]: { + reason: Error; + }; + [AnalyticsError.FETCH_THROTTLE]: { + throttleEndTimeMillis: number; + }; + [AnalyticsError.CONFIG_FETCH_FAILED]: { + httpStatus: number; + responseMessage: string; + }; + [AnalyticsError.INVALID_ANALYTICS_CONTEXT]: { + errorInfo: string; + }; + [AnalyticsError.INDEXEDDB_UNAVAILABLE]: { + errorInfo: string; + }; + [AnalyticsError.INVALID_GTAG_RESOURCE]: { + gtagURL: string; + }; +} +export declare const ERROR_FACTORY: ErrorFactory<AnalyticsError, ErrorParams>; +export {}; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/factory.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/factory.d.ts new file mode 100644 index 0000000..cfcc024 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/factory.d.ts @@ -0,0 +1,74 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { SettingsOptions, Analytics, AnalyticsSettings } from './public-types'; +import { Gtag, DynamicConfig, MinimalDynamicConfig } from './types'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +import { FirebaseApp, _FirebaseService } from '@firebase/app'; +/** + * Analytics Service class. + */ +export declare class AnalyticsService implements Analytics, _FirebaseService { + app: FirebaseApp; + constructor(app: FirebaseApp); + _delete(): Promise<void>; +} +/** + * Maps appId to full initialization promise. Wrapped gtag calls must wait on + * all or some of these, depending on the call's `send_to` param and the status + * of the dynamic config fetches (see below). + */ +export declare let initializationPromisesMap: { + [appId: string]: Promise<string>; +}; +/** + * Wrapper around gtag function that ensures FID is sent with all + * relevant event and config calls. + */ +export declare let wrappedGtagFunction: Gtag; +/** + * For testing + * @internal + */ +export declare function resetGlobalVars(newGlobalInitDone?: boolean, newInitializationPromisesMap?: {}, newDynamicPromises?: never[]): void; +/** + * For testing + * @internal + */ +export declare function getGlobalVars(): { + initializationPromisesMap: { + [appId: string]: Promise<string>; + }; + dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>; +}; +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +export declare function settings(options: SettingsOptions): void; +/** + * Analytics instance factory. + * @internal + */ +export declare function factory(app: FirebaseApp, installations: _FirebaseInstallationsInternal, options?: AnalyticsSettings): AnalyticsService; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/functions.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/functions.d.ts new file mode 100644 index 0000000..ced5392 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/functions.d.ts @@ -0,0 +1,85 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { AnalyticsCallOptions, CustomParams, EventParams, ConsentSettings } from './public-types'; +import { Gtag } from './types'; +/** + * Event parameters to set on 'gtag' during initialization. + */ +export declare let defaultEventParametersForInit: CustomParams | undefined; +/** + * Logs an analytics event through the Firebase SDK. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param eventName Google Analytics event name, choose from standard list or use a custom string. + * @param eventParams Analytics event parameters. + */ +export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>; +/** + * Set screen_name parameter for this Google Analytics ID. + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param screenName Screen name string to set. + */ +export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>; +/** + * Set user_id parameter for this Google Analytics ID. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param id User ID string to set + */ +export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>; +/** + * Set all other user properties other than user_id and screen_name. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + * @param properties Map of user properties to set + */ +export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>; +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event + */ +export declare function internalGetGoogleAnalyticsClientId(gtagFunction: Gtag, initializationPromise: Promise<string>): Promise<string>; +/** + * Set whether collection is enabled for this ID. + * + * @param enabled If true, collection is enabled for this ID. + */ +export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>; +/** + * Consent parameters to default to during 'gtag' initialization. + */ +export declare let defaultConsentSettingsForInit: ConsentSettings | undefined; +/** + * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of + * analytics. + * + * @param consentSettings Maps the applicable end user consent state for gtag.js. + */ +export declare function _setConsentDefaultForInit(consentSettings?: ConsentSettings): void; +/** + * Sets the variable `defaultEventParametersForInit` for use in the initialization of + * analytics. + * + * @param customParams Any custom params the user may pass to gtag.js. + */ +export declare function _setDefaultEventParametersForInit(customParams?: CustomParams): void; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/get-config.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/get-config.d.ts new file mode 100644 index 0000000..adb8236 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/get-config.d.ts @@ -0,0 +1,72 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts + */ +import { FirebaseApp } from '@firebase/app'; +import { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types'; +export interface AppFields { + appId: string; + apiKey: string; + measurementId?: string; +} +/** + * Backoff factor for 503 errors, which we want to be conservative about + * to avoid overloading servers. Each retry interval will be + * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one + * will be ~30 seconds (with fuzzing). + */ +export declare const LONG_RETRY_FACTOR = 30; +/** + * Stubbable retry data storage class. + */ +declare class RetryData { + throttleMetadata: { + [appId: string]: ThrottleMetadata; + }; + intervalMillis: number; + constructor(throttleMetadata?: { + [appId: string]: ThrottleMetadata; + }, intervalMillis?: number); + getThrottleMetadata(appId: string): ThrottleMetadata; + setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void; + deleteThrottleMetadata(appId: string): void; +} +/** + * Fetches dynamic config from backend. + * @param app Firebase app to fetch config for. + */ +export declare function fetchDynamicConfig(appFields: AppFields): Promise<DynamicConfig>; +/** + * Fetches dynamic config from backend, retrying if failed. + * @param app Firebase app to fetch config for. + */ +export declare function fetchDynamicConfigWithRetry(app: FirebaseApp, retryData?: RetryData, timeoutMillis?: number): Promise<DynamicConfig | MinimalDynamicConfig>; +/** + * Shims a minimal AbortSignal (copied from Remote Config). + * + * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects + * of networking, such as retries. Firebase doesn't use AbortController enough to justify a + * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be + * swapped out if/when we do. + */ +export declare class AnalyticsAbortSignal { + listeners: Array<() => void>; + addEventListener(listener: () => void): void; + abort(): void; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/global_index.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/global_index.d.ts new file mode 100644 index 0000000..97e6d81 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/global_index.d.ts @@ -0,0 +1,1056 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +interface VersionService { + library: string; + version: string; +} +interface PlatformLoggerService { + getPlatformInfoString(): string; +} +interface HeartbeatService { + /** + * Called to report a heartbeat. The function will generate + * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it + * to IndexedDB. + * Note that we only store one heartbeat per day. So if a heartbeat for today is + * already logged, subsequent calls to this function in the same day will be ignored. + */ + triggerHeartbeat(): Promise<void>; + /** + * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly. + * It also clears all heartbeats from memory as well as in IndexedDB. + */ + getHeartbeatsHeader(): Promise<string>; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of + * services. + * + * Do not call this constructor directly. Instead, use + * {@link (initializeApp:1) | initializeApp()} to create an app. + * + * @public + */ +interface FirebaseApp { + /** + * The (read-only) name for this app. + * + * The default app's name is `"[DEFAULT]"`. + * + * @example + * ```javascript + * // The default app's name is "[DEFAULT]" + * const app = initializeApp(defaultAppConfig); + * console.log(app.name); // "[DEFAULT]" + * ``` + * + * @example + * ```javascript + * // A named app's name is what you provide to initializeApp() + * const otherApp = initializeApp(otherAppConfig, "other"); + * console.log(otherApp.name); // "other" + * ``` + */ + readonly name: string; + /** + * The (read-only) configuration options for this app. These are the original + * parameters given in {@link (initializeApp:1) | initializeApp()}. + * + * @example + * ```javascript + * const app = initializeApp(config); + * console.log(app.options.databaseURL === config.databaseURL); // true + * ``` + */ + readonly options: FirebaseOptions; + /** + * The settable config flag for GDPR opt-in/opt-out + */ + automaticDataCollectionEnabled: boolean; +} +/** + * @public + * + * Firebase configuration object. Contains a set of parameters required by + * services in order to successfully communicate with Firebase server APIs + * and to associate client data with your Firebase project and + * Firebase application. Typically this object is populated by the Firebase + * console at project setup. See also: + * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}. + */ +interface FirebaseOptions { + /** + * An encrypted string used when calling certain APIs that don't need to + * access private user data + * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`). + */ + apiKey?: string; + /** + * Auth domain for the project ID. + */ + authDomain?: string; + /** + * Default Realtime Database URL. + */ + databaseURL?: string; + /** + * The unique identifier for the project across all of Firebase and + * Google Cloud. + */ + projectId?: string; + /** + * The default Cloud Storage bucket name. + */ + storageBucket?: string; + /** + * Unique numerical value used to identify each sender that can send + * Firebase Cloud Messaging messages to client apps. + */ + messagingSenderId?: string; + /** + * Unique identifier for the app. + */ + appId?: string; + /** + * An ID automatically created when you enable Analytics in your + * Firebase project and register a web app. In versions 7.20.0 + * and higher, this parameter is optional. + */ + measurementId?: string; +} +/** + * @internal + */ +interface _FirebaseService { + app: FirebaseApp; + /** + * Delete the service and free it's resources - called from + * {@link @firebase/app#deleteApp | deleteApp()} + */ + _delete(): Promise<void>; +} +declare module '@firebase/component' { + interface NameServiceMapping { + 'app': FirebaseApp; + 'app-version': VersionService; + 'heartbeat': HeartbeatService; + 'platform-logger': PlatformLoggerService; + } +} + +/** + * An object that can be injected into the environment as __FIREBASE_DEFAULTS__, + * either as a property of globalThis, a shell environment variable, or a + * cookie. + * + * This object can be used to automatically configure and initialize + * a Firebase app as well as any emulators. + * + * @public + */ +interface FirebaseDefaults { + config?: Record<string, string>; + emulatorHosts?: Record<string, string>; + _authTokenSyncURL?: string; + _authIdTokenMaxAge?: number; + /** + * Override Firebase's runtime environment detection and + * force the SDK to act as if it were in the specified environment. + */ + forceEnvironment?: 'browser' | 'node'; + [key: string]: unknown; +} +declare global { + var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined; +} + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Public interface of the Firebase Installations SDK. + * + * @public + */ +interface Installations { + /** + * The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with. + */ + app: FirebaseApp; +} +/** + * An interface for Firebase internal SDKs use only. + * + * @internal + */ +interface _FirebaseInstallationsInternal { + /** + * Creates a Firebase Installation if there isn't one for the app and + * returns the Installation ID. + */ + getId(): Promise<string>; + /** + * Returns an Authentication Token for the current Firebase Installation. + */ + getToken(forceRefresh?: boolean): Promise<string>; +} +declare module '@firebase/component' { + interface NameServiceMapping { + 'installations': Installations; + 'installations-internal': _FirebaseInstallationsInternal; + } +} + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A set of common Google Analytics config settings recognized by + * `gtag.js`. + * @public + */ +interface GtagConfigParams { + /** + * Whether or not a page view should be sent. + * If set to true (default), a page view is automatically sent upon initialization + * of analytics. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'send_page_view'?: boolean; + /** + * The title of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_title'?: string; + /** + * The URL of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_location'?: string; + /** + * Defaults to `auto`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_domain'?: string; + /** + * Defaults to 63072000 (two years, in seconds). + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_expires'?: number; + /** + * Defaults to `_ga`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_prefix'?: string; + /** + * If set to true, will update cookies on each page load. + * Defaults to true. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_update'?: boolean; + /** + * Appends additional flags to the cookie when set. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_flags'?: string; + /** + * If set to false, disables all advertising features with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_google_signals'?: boolean; + /** + * If set to false, disables all advertising personalization with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_ad_personalization_signals'?: boolean; + [key: string]: unknown; +} +/** + * {@link Analytics} instance initialization options. + * @public + */ +interface AnalyticsSettings { + /** + * Params to be passed in the initial `gtag` config call during Firebase + * Analytics initialization. + */ + config?: GtagConfigParams | EventParams; +} +/** + * Additional options that can be passed to Analytics method + * calls such as `logEvent`, etc. + * @public + */ +interface AnalyticsCallOptions { + /** + * If true, this config or event call applies globally to all + * Google Analytics properties on the page. + */ + global: boolean; +} +/** + * An instance of Firebase Analytics. + * @public + */ +interface Analytics { + /** + * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with. + */ + app: FirebaseApp; +} +/** + * Specifies custom options for your Firebase Analytics instance. + * You must set these before initializing `firebase.analytics()`. + * @public + */ +interface SettingsOptions { + /** Sets custom name for `gtag` function. */ + gtagName?: string; + /** Sets custom name for `dataLayer` array used by `gtag.js`. */ + dataLayerName?: string; +} +/** + * Any custom params the user may pass to `gtag`. + * @public + */ +interface CustomParams { + [key: string]: unknown; +} +/** + * Type for standard Google Analytics event names. `logEvent` also accepts any + * custom string and interprets it as a custom event name. + * @public + */ +type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'checkout_progress' | 'exception' | 'generate_lead' | 'login' | 'page_view' | 'purchase' | 'refund' | 'remove_from_cart' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'set_checkout_option' | 'share' | 'sign_up' | 'timing_complete' | 'view_cart' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_search_results'; +/** + * Standard Google Analytics currency type. + * @public + */ +type Currency = string | number; +/** + * Standard Google Analytics `Item` type. + * @public + */ +interface Item { + item_id?: string; + item_name?: string; + item_brand?: string; + item_category?: string; + item_category2?: string; + item_category3?: string; + item_category4?: string; + item_category5?: string; + item_variant?: string; + price?: Currency; + quantity?: number; + index?: number; + coupon?: string; + item_list_name?: string; + item_list_id?: string; + discount?: Currency; + affiliation?: string; + creative_name?: string; + creative_slot?: string; + promotion_id?: string; + promotion_name?: string; + location_id?: string; + /** @deprecated Use item_brand instead. */ + brand?: string; + /** @deprecated Use item_category instead. */ + category?: string; + /** @deprecated Use item_id instead. */ + id?: string; + /** @deprecated Use item_name instead. */ + name?: string; +} +/** + * Field previously used by some Google Analytics events. + * @deprecated Use `Item` instead. + * @public + */ +interface Promotion { + creative_name?: string; + creative_slot?: string; + id?: string; + name?: string; +} +/** + * Standard `gtag.js` control parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +interface ControlParams { + groups?: string | string[]; + send_to?: string | string[]; + event_callback?: () => void; + event_timeout?: number; +} +/** + * Standard `gtag.js` event parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +interface EventParams { + checkout_option?: string; + checkout_step?: number; + item_id?: string; + content_type?: string; + coupon?: string; + currency?: string; + description?: string; + fatal?: boolean; + items?: Item[]; + method?: string; + number?: string; + promotions?: Promotion[]; + screen_name?: string; + /** + * Firebase-specific. Use to log a `screen_name` to Firebase Analytics. + */ + firebase_screen?: string; + /** + * Firebase-specific. Use to log a `screen_class` to Firebase Analytics. + */ + firebase_screen_class?: string; + search_term?: string; + shipping?: Currency; + tax?: Currency; + transaction_id?: string; + value?: number; + event_label?: string; + event_category?: string; + shipping_tier?: string; + item_list_id?: string; + item_list_name?: string; + promotion_id?: string; + promotion_name?: string; + payment_type?: string; + affiliation?: string; + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: unknown; +} +/** + * Consent status settings for each consent type. + * For more information, see + * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis + * | the GA4 reference documentation for consent state and consent types}. + * @public + */ +interface ConsentSettings { + /** Enables storage, such as cookies, related to advertising */ + ad_storage?: ConsentStatusString; + /** Sets consent for sending user data to Google for advertising purposes. */ + ad_user_data?: ConsentStatusString; + /** Sets consent for personalized advertising. */ + ad_personalization?: ConsentStatusString; + /** Enables storage, such as cookies, related to analytics (for example, visit duration) */ + analytics_storage?: ConsentStatusString; + /** + * Enables storage that supports the functionality of the website or app such as language settings + */ + functionality_storage?: ConsentStatusString; + /** Enables storage related to personalization such as video recommendations */ + personalization_storage?: ConsentStatusString; + /** + * Enables storage related to security such as authentication functionality, fraud prevention, + * and other user protection. + */ + security_storage?: ConsentStatusString; + [key: string]: unknown; +} +/** + * Whether a particular consent type has been granted or denied. + * @public + */ +type ConsentStatusString = 'granted' | 'denied'; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Type constant for Firebase Analytics. + */ +declare const ANALYTICS_TYPE = "analytics"; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Analytics Service class. + */ +declare class AnalyticsService implements Analytics, _FirebaseService { + app: FirebaseApp; + constructor(app: FirebaseApp); + _delete(): Promise<void>; +} +/** + * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names. + * Intended to be used if `gtag.js` script has been installed on + * this page independently of Firebase Analytics, and is using non-default + * names for either the `gtag` function or for `dataLayer`. + * Must be called before calling `getAnalytics()` or it won't + * have any effect. + * + * @public + * + * @param options - Custom gtag and dataLayer names. + */ +declare function settings(options: SettingsOptions): void; + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare module '@firebase/component' { + interface NameServiceMapping { + [ANALYTICS_TYPE]: AnalyticsService; + } +} +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +declare function getAnalytics(app?: FirebaseApp): Analytics; +/** + * Returns an {@link Analytics} instance for the given app. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics; +/** + * This is a public static method provided to users that wraps four different checks: + * + * 1. Check if it's not a browser extension environment. + * 2. Check if cookies are enabled in current browser. + * 3. Check if IndexedDB is supported by the browser environment. + * 4. Check if the current browser context is valid for using `IndexedDB.open()`. + * + * @public + * + */ +declare function isSupported(): Promise<boolean>; +/** + * Use gtag `config` command to set `screen_name`. + * + * @public + * + * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`. + * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}. + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param screenName - Screen name to set. + */ +declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void; +/** + * Retrieves a unique Google Analytics identifier for the web client. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}. + * + * @public + * + * @param app - The {@link @firebase/app#FirebaseApp} to use. + */ +declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>; +/** + * Use gtag `config` command to set `user_id`. + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param id - User ID to set. + */ +declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void; +/** + * Use gtag `config` command to set all params specified. + * + * @public + */ +declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void; +/** + * Sets whether Google Analytics collection is enabled for this app on this device. + * Sets global `window['ga-disable-analyticsId'] = true;` + * + * @public + * + * @param analyticsInstance - The {@link Analytics} instance. + * @param enabled - If true, enables collection, if false, disables it. + */ +declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void; +/** + * Adds data that will be set on every event logged from the SDK, including automatic ones. + * With gtag's "set" command, the values passed persist on the current page and are passed with + * all subsequent events. + * @public + * @param customParams - Any custom params the user may pass to gtag.js. + */ +declare function setDefaultEventParameters(customParams: CustomParams): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + payment_type?: EventParams['payment_type']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + shipping_tier?: EventParams['shipping_tier']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: { + currency?: EventParams['currency']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions + * | Measure exceptions}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: { + description?: EventParams['description']; + fatal?: EventParams['fatal']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See + * {@link https://developers.google.com/analytics/devguides/collection/ga4/views + * | Page views}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: { + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + transaction_id: EventParams['transaction_id']; + tax?: EventParams['tax']; + shipping?: EventParams['shipping']; + items?: EventParams['items']; + coupon?: EventParams['coupon']; + affiliation?: EventParams['affiliation']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * See {@link https://firebase.google.com/docs/analytics/screenviews + * | Track Screenviews}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: { + firebase_screen: EventParams['firebase_screen']; + firebase_screen_class: EventParams['firebase_screen_class']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: { + search_term?: EventParams['search_term']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: { + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: { + items?: EventParams['items']; + promotion_id?: EventParams['promotion_id']; + promotion_name?: EventParams['promotion_name']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: { + method?: EventParams['method']; + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: { + method?: EventParams['method']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: { + name: string; + value: number; + event_category?: string; + event_label?: string; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: { + currency?: EventParams['currency']; + items?: EventParams['items']; + value?: EventParams['value']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Sends a Google Analytics event with given `eventParams`. This method + * automatically associates this logged event with this Firebase web + * app instance on this device. + * @public + * List of recommended event parameters can be found in + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + */ +declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: { + [key: string]: any; +}, options?: AnalyticsCallOptions): void; +/** + * Any custom event name string not in the standard list of recommended + * event names. + * @public + */ +type CustomEventName<T> = T extends EventNameString ? never : T; +/** + * Sets the applicable end user consent state for this web app across all gtag references once + * Firebase Analytics is initialized. + * + * Use the {@link ConsentSettings} to specify individual consent type values. By default consent + * types are set to "granted". + * @public + * @param consentSettings - Maps the applicable end user consent state for gtag.js. + */ +declare function setConsent(consentSettings: ConsentSettings): void; + +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ + +declare global { + interface Window { + [key: string]: unknown; + } +} + +export { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, ConsentStatusString, ControlParams, Currency, CustomEventName, CustomParams, EventNameString, EventParams, GtagConfigParams, Item, Promotion, SettingsOptions, getAnalytics, getGoogleAnalyticsClientId, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings }; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/helpers.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/helpers.d.ts new file mode 100644 index 0000000..6295706 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/helpers.d.ts @@ -0,0 +1,70 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types'; +/** + * Verifies and creates a TrustedScriptURL. + */ +export declare function createGtagTrustedTypesScriptURL(url: string): string; +/** + * Makeshift polyfill for Promise.allSettled(). Resolves when all promises + * have either resolved or rejected. + * + * @param promises Array of promises to wait for. + */ +export declare function promiseAllSettled<T>(promises: Array<Promise<T>>): Promise<T[]>; +/** + * Creates a TrustedTypePolicy object that implements the rules passed as policyOptions. + * + * @param policyName A string containing the name of the policy + * @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods + * | the TrustedTypePolicy reference documentation}. + */ +export declare function createTrustedTypesPolicy(policyName: string, policyOptions: Partial<TrustedTypePolicyOptions>): Partial<TrustedTypePolicy> | undefined; +/** + * Inserts gtag script tag into the page to asynchronously download gtag. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +export declare function insertScriptTag(dataLayerName: string, measurementId: string): void; +/** + * Get reference to, or create, global datalayer. + * @param dataLayerName Name of datalayer (most often the default, "_dataLayer"). + */ +export declare function getOrCreateDataLayer(dataLayerName: string): DataLayer; +/** + * Creates global gtag function or wraps existing one if found. + * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and + * 'event' calls that belong to the GAID associated with this Firebase instance. + * + * @param initializationPromisesMap Map of appIds to their initialization promises. + * @param dynamicConfigPromisesList Array of dynamic config fetch promises. + * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId. + * @param dataLayerName Name of global GA datalayer array. + * @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified). + */ +export declare function wrapOrCreateGtag(initializationPromisesMap: { + [appId: string]: Promise<string>; +}, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: { + [measurementId: string]: string; +}, dataLayerName: string, gtagFunctionName: string): { + gtagCore: Gtag; + wrappedGtag: Gtag; +}; +/** + * Returns the script tag in the DOM matching both the gtag url pattern + * and the provided data layer name. + */ +export declare function findGtagScriptOnPage(dataLayerName: string): HTMLScriptElement | null; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/index.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/index.d.ts new file mode 100644 index 0000000..ee21b19 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/index.d.ts @@ -0,0 +1,14 @@ +/** + * The Firebase Analytics Web SDK. + * This SDK does not work in a Node.js environment. + * + * @packageDocumentation + */ +import '@firebase/installations'; +declare global { + interface Window { + [key: string]: unknown; + } +} +export * from './api'; +export * from './public-types'; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/initialize-analytics.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/initialize-analytics.d.ts new file mode 100644 index 0000000..2736795 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/initialize-analytics.d.ts @@ -0,0 +1,36 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { DynamicConfig, Gtag, MinimalDynamicConfig } from './types'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +import { FirebaseApp } from '@firebase/app'; +import { AnalyticsSettings } from './public-types'; +/** + * Initialize the analytics instance in gtag.js by calling config command with fid. + * + * NOTE: We combine analytics initialization and setting fid together because we want fid to be + * part of the `page_view` event that's sent during the initialization + * @param app Firebase app + * @param gtagCore The gtag function that's not wrapped. + * @param dynamicConfigPromisesList Array of all dynamic config promises. + * @param measurementIdToAppId Maps measurementID to appID. + * @param installations _FirebaseInstallationsInternal instance. + * + * @returns Measurement ID. + */ +export declare function _initializeAnalytics(app: FirebaseApp, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: { + [key: string]: string; +}, installations: _FirebaseInstallationsInternal, gtagCore: Gtag, dataLayerName: string, options?: AnalyticsSettings): Promise<string>; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/logger.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/logger.d.ts new file mode 100644 index 0000000..4a4edbd --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/logger.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Logger } from '@firebase/logger'; +export declare const logger: Logger; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/public-types.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/public-types.d.ts new file mode 100644 index 0000000..16d3978 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/public-types.d.ts @@ -0,0 +1,282 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +/** + * A set of common Google Analytics config settings recognized by + * `gtag.js`. + * @public + */ +export interface GtagConfigParams { + /** + * Whether or not a page view should be sent. + * If set to true (default), a page view is automatically sent upon initialization + * of analytics. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'send_page_view'?: boolean; + /** + * The title of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_title'?: string; + /** + * The URL of the page. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views } + */ + 'page_location'?: string; + /** + * Defaults to `auto`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_domain'?: string; + /** + * Defaults to 63072000 (two years, in seconds). + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_expires'?: number; + /** + * Defaults to `_ga`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_prefix'?: string; + /** + * If set to true, will update cookies on each page load. + * Defaults to true. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_update'?: boolean; + /** + * Appends additional flags to the cookie when set. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification } + */ + 'cookie_flags'?: string; + /** + * If set to false, disables all advertising features with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_google_signals'?: boolean; + /** + * If set to false, disables all advertising personalization with `gtag.js`. + * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } + */ + 'allow_ad_personalization_signals'?: boolean; + [key: string]: unknown; +} +/** + * {@link Analytics} instance initialization options. + * @public + */ +export interface AnalyticsSettings { + /** + * Params to be passed in the initial `gtag` config call during Firebase + * Analytics initialization. + */ + config?: GtagConfigParams | EventParams; +} +/** + * Additional options that can be passed to Analytics method + * calls such as `logEvent`, etc. + * @public + */ +export interface AnalyticsCallOptions { + /** + * If true, this config or event call applies globally to all + * Google Analytics properties on the page. + */ + global: boolean; +} +/** + * An instance of Firebase Analytics. + * @public + */ +export interface Analytics { + /** + * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with. + */ + app: FirebaseApp; +} +/** + * Specifies custom options for your Firebase Analytics instance. + * You must set these before initializing `firebase.analytics()`. + * @public + */ +export interface SettingsOptions { + /** Sets custom name for `gtag` function. */ + gtagName?: string; + /** Sets custom name for `dataLayer` array used by `gtag.js`. */ + dataLayerName?: string; +} +/** + * Any custom params the user may pass to `gtag`. + * @public + */ +export interface CustomParams { + [key: string]: unknown; +} +/** + * Type for standard Google Analytics event names. `logEvent` also accepts any + * custom string and interprets it as a custom event name. + * @public + */ +export type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'checkout_progress' | 'exception' | 'generate_lead' | 'login' | 'page_view' | 'purchase' | 'refund' | 'remove_from_cart' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'set_checkout_option' | 'share' | 'sign_up' | 'timing_complete' | 'view_cart' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_search_results'; +/** + * Standard Google Analytics currency type. + * @public + */ +export type Currency = string | number; +/** + * Standard Google Analytics `Item` type. + * @public + */ +export interface Item { + item_id?: string; + item_name?: string; + item_brand?: string; + item_category?: string; + item_category2?: string; + item_category3?: string; + item_category4?: string; + item_category5?: string; + item_variant?: string; + price?: Currency; + quantity?: number; + index?: number; + coupon?: string; + item_list_name?: string; + item_list_id?: string; + discount?: Currency; + affiliation?: string; + creative_name?: string; + creative_slot?: string; + promotion_id?: string; + promotion_name?: string; + location_id?: string; + /** @deprecated Use item_brand instead. */ + brand?: string; + /** @deprecated Use item_category instead. */ + category?: string; + /** @deprecated Use item_id instead. */ + id?: string; + /** @deprecated Use item_name instead. */ + name?: string; +} +/** + * Field previously used by some Google Analytics events. + * @deprecated Use `Item` instead. + * @public + */ +export interface Promotion { + creative_name?: string; + creative_slot?: string; + id?: string; + name?: string; +} +/** + * Standard `gtag.js` control parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export interface ControlParams { + groups?: string | string[]; + send_to?: string | string[]; + event_callback?: () => void; + event_timeout?: number; +} +/** + * Standard `gtag.js` event parameters. + * For more information, see + * {@link https://developers.google.com/gtagjs/reference/ga4-events + * | the GA4 reference documentation}. + * @public + */ +export interface EventParams { + checkout_option?: string; + checkout_step?: number; + item_id?: string; + content_type?: string; + coupon?: string; + currency?: string; + description?: string; + fatal?: boolean; + items?: Item[]; + method?: string; + number?: string; + promotions?: Promotion[]; + screen_name?: string; + /** + * Firebase-specific. Use to log a `screen_name` to Firebase Analytics. + */ + firebase_screen?: string; + /** + * Firebase-specific. Use to log a `screen_class` to Firebase Analytics. + */ + firebase_screen_class?: string; + search_term?: string; + shipping?: Currency; + tax?: Currency; + transaction_id?: string; + value?: number; + event_label?: string; + event_category?: string; + shipping_tier?: string; + item_list_id?: string; + item_list_name?: string; + promotion_id?: string; + promotion_name?: string; + payment_type?: string; + affiliation?: string; + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: unknown; +} +/** + * Consent status settings for each consent type. + * For more information, see + * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis + * | the GA4 reference documentation for consent state and consent types}. + * @public + */ +export interface ConsentSettings { + /** Enables storage, such as cookies, related to advertising */ + ad_storage?: ConsentStatusString; + /** Sets consent for sending user data to Google for advertising purposes. */ + ad_user_data?: ConsentStatusString; + /** Sets consent for personalized advertising. */ + ad_personalization?: ConsentStatusString; + /** Enables storage, such as cookies, related to analytics (for example, visit duration) */ + analytics_storage?: ConsentStatusString; + /** + * Enables storage that supports the functionality of the website or app such as language settings + */ + functionality_storage?: ConsentStatusString; + /** Enables storage related to personalization such as video recommendations */ + personalization_storage?: ConsentStatusString; + /** + * Enables storage related to security such as authentication functionality, fraud prevention, + * and other user protection. + */ + security_storage?: ConsentStatusString; + [key: string]: unknown; +} +/** + * Whether a particular consent type has been granted or denied. + * @public + */ +export type ConsentStatusString = 'granted' | 'denied'; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/tsdoc-metadata.json b/frontend-old/node_modules/@firebase/analytics/dist/src/tsdoc-metadata.json new file mode 100644 index 0000000..6af1f6a --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/tsdoc-metadata.json @@ -0,0 +1,11 @@ +// This file is read by tools that parse documentation comments conforming to the TSDoc standard. +// It should be published with your NPM package. It should not be tracked by Git. +{ + "tsdocVersion": "0.12", + "toolPackages": [ + { + "packageName": "@microsoft/api-extractor", + "packageVersion": "0.1.2" + } + ] +} diff --git a/frontend-old/node_modules/@firebase/analytics/dist/src/types.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/src/types.d.ts new file mode 100644 index 0000000..e7f964f --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/src/types.d.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ControlParams, EventParams, CustomParams, ConsentSettings } from './public-types'; +/** + * Encapsulates metadata concerning throttled fetch requests. + */ +export interface ThrottleMetadata { + backoffCount: number; + throttleEndTimeMillis: number; +} +/** + * Dynamic configuration fetched from server. + * See https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps/getConfig + */ +export interface DynamicConfig { + projectId: string; + appId: string; + databaseURL: string; + storageBucket: string; + locationId: string; + apiKey: string; + authDomain: string; + messagingSenderId: string; + measurementId: string; +} +export interface MinimalDynamicConfig { + appId: string; + measurementId: string; +} +/** + * Standard `gtag` function provided by gtag.js. + */ +export interface Gtag { + (command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void; + (command: 'set', config: CustomParams): void; + (command: 'event', eventName: string, eventParams?: ControlParams | EventParams | CustomParams): void; + (command: 'consent', subCommand: 'default' | 'update', consentSettings: ConsentSettings): void; + (command: 'get', measurementId: string, fieldName: string, callback: (...args: unknown[]) => void): void; + (command: string, ...args: unknown[]): void; +} +export type DataLayer = IArguments[]; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/testing/get-fake-firebase-services.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/testing/get-fake-firebase-services.d.ts new file mode 100644 index 0000000..d2f6357 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/testing/get-fake-firebase-services.d.ts @@ -0,0 +1,29 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FirebaseApp } from '@firebase/app'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +export declare function getFakeApp(fakeAppParams?: { + appId?: string; + apiKey?: string; + measurementId?: string; +}): FirebaseApp; +export declare function getFakeInstallations(fid?: string, onFidResolve?: Function): _FirebaseInstallationsInternal; +export declare function getFullApp(fakeAppParams?: { + appId?: string; + apiKey?: string; + measurementId?: string; +}): FirebaseApp; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/testing/gtag-script-util.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/testing/gtag-script-util.d.ts new file mode 100644 index 0000000..d80a58c --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/testing/gtag-script-util.d.ts @@ -0,0 +1 @@ +export declare function removeGtagScripts(): void; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/testing/integration-tests/integration.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/testing/integration-tests/integration.d.ts new file mode 100644 index 0000000..6ffe0d3 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/testing/integration-tests/integration.d.ts @@ -0,0 +1,18 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import '@firebase/installations'; +import '../setup'; diff --git a/frontend-old/node_modules/@firebase/analytics/dist/testing/setup.d.ts b/frontend-old/node_modules/@firebase/analytics/dist/testing/setup.d.ts new file mode 100644 index 0000000..1c93d90 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/dist/testing/setup.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/analytics/package.json b/frontend-old/node_modules/@firebase/analytics/package.json new file mode 100644 index 0000000..512d8f4 --- /dev/null +++ b/frontend-old/node_modules/@firebase/analytics/package.json @@ -0,0 +1,74 @@ +{ + "name": "@firebase/analytics", + "version": "0.10.19", + "description": "A analytics package for new firebase packages", + "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", + "main": "dist/index.cjs.js", + "browser": "dist/esm/index.esm.js", + "module": "dist/esm/index.esm.js", + "exports": { + ".": { + "types": "./dist/analytics-public.d.ts", + "require": "./dist/index.cjs.js", + "default": "./dist/esm/index.esm.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist" + ], + "scripts": { + "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", + "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", + "build": "rollup -c && yarn api-report", + "build:release": "yarn build && yarn typings:public", + "build:deps": "lerna run --scope @firebase/analytics --include-dependencies build", + "dev": "rollup -c -w", + "test": "run-p --npm-path npm lint test:all", + "test:all": "run-p --npm-path npm test:browser test:integration", + "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", + "test:browser": "karma start --nocache", + "test:integration": "karma start ./karma.integration.conf.js --nocache", + "trusted-type-check": "tsec -p tsconfig.json --noEmit", + "api-report": "api-extractor run --local --verbose", + "doc": "api-documenter markdown --input temp --output docs", + "build:doc": "yarn build && yarn doc", + "typings:public": "node ../../scripts/build/use_typings.js ./dist/analytics-public.d.ts" + }, + "peerDependencies": { + "@firebase/app": "0.x" + }, + "dependencies": { + "@firebase/installations": "0.6.19", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.13.0", + "@firebase/component": "0.7.0", + "tslib": "^2.1.0" + }, + "license": "Apache-2.0", + "devDependencies": { + "@firebase/app": "0.14.4", + "rollup": "2.79.2", + "rollup-plugin-dts": "5.3.1", + "@rollup/plugin-commonjs": "21.1.0", + "@rollup/plugin-json": "6.1.0", + "@rollup/plugin-node-resolve": "16.0.0", + "rollup-plugin-typescript2": "0.36.0", + "typescript": "5.5.4" + }, + "repository": { + "directory": "packages/analytics", + "type": "git", + "url": "git+https://github.com/firebase/firebase-js-sdk.git" + }, + "bugs": { + "url": "https://github.com/firebase/firebase-js-sdk/issues" + }, + "typings": "./dist/analytics-public.d.ts", + "nyc": { + "extension": [ + ".ts" + ], + "reportDir": "./coverage/node" + } +} |
