Browse Source

Restruct

master
Václav Španinger 1 year ago
parent
commit
8d7722be91
3362 changed files with 13803 additions and 500762 deletions
  1. +14
    -5
      .gitignore
  2. +0
    -0
      README.md
  3. +0
    -0
      babel.config.js
  4. +0
    -22
      gabenparadise/.gitignore
  5. +0
    -12704
      gabenparadise/package-lock.json
  6. +0
    -15
      node_modules/.bin/pbjs
  7. +0
    -17
      node_modules/.bin/pbjs.cmd
  8. +0
    -18
      node_modules/.bin/pbjs.ps1
  9. +0
    -15
      node_modules/.bin/pbts
  10. +0
    -17
      node_modules/.bin/pbts.cmd
  11. +0
    -18
      node_modules/.bin/pbts.ps1
  12. +0
    -15
      node_modules/.bin/semver
  13. +0
    -17
      node_modules/.bin/semver.cmd
  14. +0
    -18
      node_modules/.bin/semver.ps1
  15. +0
    -3
      node_modules/@firebase/analytics-types/README.md
  16. +0
    -242
      node_modules/@firebase/analytics-types/index.d.ts
  17. +0
    -56
      node_modules/@firebase/analytics-types/package.json
  18. +0
    -5
      node_modules/@firebase/analytics/README.md
  19. +0
    -596
      node_modules/@firebase/analytics/dist/index.cjs.js
  20. +0
    -1
      node_modules/@firebase/analytics/dist/index.cjs.js.map
  21. +0
    -22
      node_modules/@firebase/analytics/dist/index.d.ts
  22. +0
    -586
      node_modules/@firebase/analytics/dist/index.esm.js
  23. +0
    -1
      node_modules/@firebase/analytics/dist/index.esm.js.map
  24. +0
    -551
      node_modules/@firebase/analytics/dist/index.esm2017.js
  25. +0
    -1
      node_modules/@firebase/analytics/dist/index.esm2017.js.map
  26. +0
    -17
      node_modules/@firebase/analytics/dist/index.test.d.ts
  27. +0
    -56
      node_modules/@firebase/analytics/dist/src/constants.d.ts
  28. +0
    -33
      node_modules/@firebase/analytics/dist/src/errors.d.ts
  29. +0
    -38
      node_modules/@firebase/analytics/dist/src/factory.d.ts
  30. +0
    -52
      node_modules/@firebase/analytics/dist/src/functions.d.ts
  31. +0
    -17
      node_modules/@firebase/analytics/dist/src/functions.test.d.ts
  32. +0
    -52
      node_modules/@firebase/analytics/dist/src/helpers.d.ts
  33. +0
    -17
      node_modules/@firebase/analytics/dist/src/helpers.test.d.ts
  34. +0
    -18
      node_modules/@firebase/analytics/dist/src/logger.d.ts
  35. +0
    -20
      node_modules/@firebase/analytics/dist/testing/get-fake-firebase-services.d.ts
  36. +0
    -1
      node_modules/@firebase/analytics/dist/testing/gtag-script-util.d.ts
  37. +0
    -17
      node_modules/@firebase/analytics/dist/testing/setup.d.ts
  38. +0
    -92
      node_modules/@firebase/analytics/package.json
  39. +0
    -3
      node_modules/@firebase/app-types/README.md
  40. +0
    -130
      node_modules/@firebase/app-types/index.d.ts
  41. +0
    -59
      node_modules/@firebase/app-types/package.json
  42. +0
    -165
      node_modules/@firebase/app-types/private.d.ts
  43. +0
    -6
      node_modules/@firebase/app/README.md
  44. +0
    -674
      node_modules/@firebase/app/dist/index.cjs.js
  45. +0
    -1
      node_modules/@firebase/app/dist/index.cjs.js.map
  46. +0
    -670
      node_modules/@firebase/app/dist/index.esm.js
  47. +0
    -1
      node_modules/@firebase/app/dist/index.esm.js.map
  48. +0
    -635
      node_modules/@firebase/app/dist/index.esm2017.js
  49. +0
    -1
      node_modules/@firebase/app/dist/index.esm2017.js.map
  50. +0
    -561
      node_modules/@firebase/app/dist/index.lite.esm2017.js
  51. +0
    -1
      node_modules/@firebase/app/dist/index.lite.esm2017.js.map
  52. +0
    -609
      node_modules/@firebase/app/dist/index.lite.js
  53. +0
    -1
      node_modules/@firebase/app/dist/index.lite.js.map
  54. +0
    -660
      node_modules/@firebase/app/dist/index.node.cjs.js
  55. +0
    -1
      node_modules/@firebase/app/dist/index.node.cjs.js.map
  56. +0
    -661
      node_modules/@firebase/app/dist/index.rn.cjs.js
  57. +0
    -1
      node_modules/@firebase/app/dist/index.rn.cjs.js.map
  58. +0
    -19
      node_modules/@firebase/app/dist/packages/app/index.d.ts
  59. +0
    -18
      node_modules/@firebase/app/dist/packages/app/index.lite.d.ts
  60. +0
    -19
      node_modules/@firebase/app/dist/packages/app/index.node.d.ts
  61. +0
    -19
      node_modules/@firebase/app/dist/packages/app/index.rn.d.ts
  62. +0
    -21
      node_modules/@firebase/app/dist/packages/app/src/constants.d.ts
  63. +0
    -32
      node_modules/@firebase/app/dist/packages/app/src/errors.d.ts
  64. +0
    -73
      node_modules/@firebase/app/dist/packages/app/src/firebaseApp.d.ts
  65. +0
    -26
      node_modules/@firebase/app/dist/packages/app/src/firebaseNamespace.d.ts
  66. +0
    -27
      node_modules/@firebase/app/dist/packages/app/src/firebaseNamespaceCore.d.ts
  67. +0
    -57
      node_modules/@firebase/app/dist/packages/app/src/lite/firebaseAppLite.d.ts
  68. +0
    -18
      node_modules/@firebase/app/dist/packages/app/src/lite/firebaseNamespaceLite.d.ts
  69. +0
    -18
      node_modules/@firebase/app/dist/packages/app/src/logger.d.ts
  70. +0
    -22
      node_modules/@firebase/app/dist/packages/app/src/platformLoggerService.d.ts
  71. +0
    -18
      node_modules/@firebase/app/dist/packages/app/src/registerCoreComponents.d.ts
  72. +0
    -25
      node_modules/@firebase/app/dist/packages/app/test/clientLogger.test.d.ts
  73. +0
    -17
      node_modules/@firebase/app/dist/packages/app/test/firebaseApp.test.d.ts
  74. +0
    -25
      node_modules/@firebase/app/dist/packages/app/test/platformLogger.test.d.ts
  75. +0
    -17
      node_modules/@firebase/app/dist/packages/app/test/setup.d.ts
  76. +0
    -93
      node_modules/@firebase/app/package.json
  77. +0
    -3
      node_modules/@firebase/auth-interop-types/README.md
  78. +0
    -35
      node_modules/@firebase/auth-interop-types/index.d.ts
  79. +0
    -60
      node_modules/@firebase/auth-interop-types/package.json
  80. +0
    -3
      node_modules/@firebase/auth-types/README.md
  81. +0
    -492
      node_modules/@firebase/auth-types/index.d.ts
  82. +0
    -60
      node_modules/@firebase/auth-types/package.json
  83. +0
    -202
      node_modules/@firebase/auth/LICENSE
  84. +0
    -5
      node_modules/@firebase/auth/README.md
  85. +0
    -432
      node_modules/@firebase/auth/dist/auth.esm.js
  86. +0
    -1
      node_modules/@firebase/auth/dist/auth.esm.js.map
  87. +0
    -432
      node_modules/@firebase/auth/dist/auth.js
  88. +0
    -1
      node_modules/@firebase/auth/dist/auth.js.map
  89. +0
    -18
      node_modules/@firebase/auth/index.d.ts
  90. +0
    -74
      node_modules/@firebase/auth/package.json
  91. +0
    -20
      node_modules/@firebase/component/README.md
  92. +0
    -315
      node_modules/@firebase/component/dist/index.cjs.js
  93. +0
    -1
      node_modules/@firebase/component/dist/index.cjs.js.map
  94. +0
    -20
      node_modules/@firebase/component/dist/index.d.ts
  95. +0
    -309
      node_modules/@firebase/component/dist/index.esm.js
  96. +0
    -1
      node_modules/@firebase/component/dist/index.esm.js.map
  97. +0
    -281
      node_modules/@firebase/component/dist/index.esm2017.js
  98. +0
    -1
      node_modules/@firebase/component/dist/index.esm2017.js.map
  99. +0
    -41
      node_modules/@firebase/component/dist/src/component.d.ts
  100. +0
    -47
      node_modules/@firebase/component/dist/src/component_container.d.ts

+ 14
- 5
.gitignore View File

@ -1,13 +1,22 @@
gabenparadise/dis/
.DS_Store
node_modules/
node_modules
/dist
/public
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor settings
.vscode
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

gabenparadise/README.md → README.md View File


gabenparadise/babel.config.js → babel.config.js View File


+ 0
- 22
gabenparadise/.gitignore View File

@ -1,22 +0,0 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

+ 0
- 12704
gabenparadise/package-lock.json
File diff suppressed because it is too large
View File


+ 0
- 15
node_modules/.bin/pbjs View File

@ -1,15 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../protobufjs/bin/pbjs" "$@"
ret=$?
else
node "$basedir/../protobufjs/bin/pbjs" "$@"
ret=$?
fi
exit $ret

+ 0
- 17
node_modules/.bin/pbjs.cmd View File

@ -1,17 +0,0 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\protobufjs\bin\pbjs" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

+ 0
- 18
node_modules/.bin/pbjs.ps1 View File

@ -1,18 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../protobufjs/bin/pbjs" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../protobufjs/bin/pbjs" $args
$ret=$LASTEXITCODE
}
exit $ret

+ 0
- 15
node_modules/.bin/pbts View File

@ -1,15 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../protobufjs/bin/pbts" "$@"
ret=$?
else
node "$basedir/../protobufjs/bin/pbts" "$@"
ret=$?
fi
exit $ret

+ 0
- 17
node_modules/.bin/pbts.cmd View File

@ -1,17 +0,0 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\protobufjs\bin\pbts" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

+ 0
- 18
node_modules/.bin/pbts.ps1 View File

@ -1,18 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../protobufjs/bin/pbts" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../protobufjs/bin/pbts" $args
$ret=$LASTEXITCODE
}
exit $ret

+ 0
- 15
node_modules/.bin/semver View File

@ -1,15 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
ret=$?
else
node "$basedir/../semver/bin/semver.js" "$@"
ret=$?
fi
exit $ret

+ 0
- 17
node_modules/.bin/semver.cmd View File

@ -1,17 +0,0 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\semver\bin\semver.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

+ 0
- 18
node_modules/.bin/semver.ps1 View File

@ -1,18 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../semver/bin/semver.js" $args
$ret=$LASTEXITCODE
}
exit $ret

+ 0
- 3
node_modules/@firebase/analytics-types/README.md View File

@ -1,3 +0,0 @@
# @firebase/analytics-types
**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.**

+ 0
- 242
node_modules/@firebase/analytics-types/index.d.ts View File

@ -1,242 +0,0 @@
/**
* @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-types';
export type GtagCommand = 'event' | 'set' | 'config';
export type DataLayer = Array<IArguments>;
/**
* Additional options that can be passed to Firebase Analytics method
* calls such as `logEvent`, `setCurrentScreen`, etc.
*/
export interface AnalyticsCallOptions {
/**
* If true, this config or event call applies globally to all
* analytics properties on the page.
*/
global: boolean;
}
export interface FirebaseAnalytics {
app: FirebaseApp;
/**
* Sends 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
* {@link https://developers.google.com/gtagjs/reference/event
* the gtag.js reference documentation}.
*/
logEvent(
eventName: EventNameString,
eventParams?: EventParams,
options?: AnalyticsCallOptions
): void;
/**
* Use gtag 'config' command to set 'screen_name'.
*/
setCurrentScreen(screenName: string, options?: AnalyticsCallOptions): void;
/**
* Use gtag 'config' command to set 'user_id'.
*/
setUserId(id: string, options?: AnalyticsCallOptions): void;
/**
* Use gtag 'config' command to set all params specified.
*/
setUserProperties(
properties: { [key: string]: any },
options?: AnalyticsCallOptions
): void;
/**
* Sets whether analytics collection is enabled for this app on this device.
* window['ga-disable-analyticsId'] = true;
*/
setAnalyticsCollectionEnabled(enabled: boolean): void;
}
/**
* Specifies custom options for your Firebase Analytics instance.
* You must set these before initializing `firebase.analytics()`.
*/
export interface SettingsOptions {
/** Sets custom name for `gtag` function. */
gtagName?: string;
/** Sets custom name for `dataLayer` array used by gtag. */
dataLayerName?: 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;
}
/**
* Standard gtag.js control parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/parameter
* the gtag.js documentation on parameters}.
*/
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/parameter
* the gtag.js documentation on parameters}.
*/
export interface EventParams {
checkout_option?: string;
checkout_step?: number;
content_id?: string;
content_type?: string;
coupon?: string;
currency?: string;
description?: string;
fatal?: boolean;
items?: Item[];
method?: string;
number?: string;
promotions?: Promotion[];
screen_name?: 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;
}
/**
* Any custom params the user may pass to gtag.js.
*/
export interface CustomParams {
[key: string]: any;
}
/**
* Type for standard gtag.js event names. `logEvent` also accepts any
* custom string and interprets it as a custom event name.
*/
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';
export type Currency = string | number;
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;
}
/** @deprecated Use Item instead. */
export interface Promotion {
creative_name?: string;
creative_slot?: string;
id?: string;
name?: string;
}
declare module '@firebase/component' {
interface NameServiceMapping {
'analytics': FirebaseAnalytics;
}
}

+ 0
- 56
node_modules/@firebase/analytics-types/package.json View File

@ -1,56 +0,0 @@
{
"_from": "@firebase/analytics-types@0.3.1",
"_id": "@firebase/analytics-types@0.3.1",
"_inBundle": false,
"_integrity": "sha512-63vVJ5NIBh/JF8l9LuPrQYSzFimk7zYHySQB4Dk9rVdJ8kV/vGQoVTvRu1UW05sEc2Ug5PqtEChtTHU+9hvPcA==",
"_location": "/@firebase/analytics-types",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@firebase/analytics-types@0.3.1",
"name": "@firebase/analytics-types",
"escapedName": "@firebase%2fanalytics-types",
"scope": "@firebase",
"rawSpec": "0.3.1",
"saveSpec": null,
"fetchSpec": "0.3.1"
},
"_requiredBy": [
"/@firebase/analytics"
],
"_resolved": "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.3.1.tgz",
"_shasum": "3c5f5d71129c88295e17e914e34b391ffda1723c",
"_spec": "@firebase/analytics-types@0.3.1",
"_where": "C:\\Users\\ASUS-ROG-NTB\\Disk Google\\git\\freeGames\\node_modules\\@firebase\\analytics",
"author": {
"name": "Firebase",
"email": "firebase-support@google.com",
"url": "https://firebase.google.com/"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "@firebase/analytics Types",
"devDependencies": {
"typescript": "3.8.3"
},
"files": [
"index.d.ts"
],
"homepage": "https://github.com/firebase/firebase-js-sdk#readme",
"license": "Apache-2.0",
"name": "@firebase/analytics-types",
"repository": {
"directory": "packages/analytics-types",
"type": "git",
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
},
"scripts": {
"test": "tsc",
"test:ci": "node ../../scripts/run_tests_in_ci.js"
},
"version": "0.3.1"
}

+ 0
- 5
node_modules/@firebase/analytics/README.md View File

@ -1,5 +0,0 @@
# @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.**

+ 0
- 596
node_modules/@firebase/analytics/dist/index.cjs.js View File

@ -1,596 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var firebase = _interopDefault(require('@firebase/app'));
require('@firebase/installations');
var tslib = require('tslib');
var logger$1 = require('@firebase/logger');
var util = require('@firebase/util');
var component = require('@firebase/component');
/**
* @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.
*/
var ANALYTICS_ID_FIELD = 'measurementId';
// Key to attach FID to in gtag params.
var GA_FID_KEY = 'firebase_id';
var ORIGIN_KEY = 'origin';
var GTAG_URL = 'https://www.googletagmanager.com/gtag/js';
var GtagCommand;
(function (GtagCommand) {
GtagCommand["EVENT"] = "event";
GtagCommand["SET"] = "set";
GtagCommand["CONFIG"] = "config";
})(GtagCommand || (GtagCommand = {}));
/*
* Officially recommended event names for gtag.js
* Any other string is also allowed.
*/
var EventName;
(function (EventName) {
EventName["ADD_SHIPPING_INFO"] = "add_shipping_info";
EventName["ADD_PAYMENT_INFO"] = "add_payment_info";
EventName["ADD_TO_CART"] = "add_to_cart";
EventName["ADD_TO_WISHLIST"] = "add_to_wishlist";
EventName["BEGIN_CHECKOUT"] = "begin_checkout";
/** @deprecated */
EventName["CHECKOUT_PROGRESS"] = "checkout_progress";
EventName["EXCEPTION"] = "exception";
EventName["GENERATE_LEAD"] = "generate_lead";
EventName["LOGIN"] = "login";
EventName["PAGE_VIEW"] = "page_view";
EventName["PURCHASE"] = "purchase";
EventName["REFUND"] = "refund";
EventName["REMOVE_FROM_CART"] = "remove_from_cart";
EventName["SCREEN_VIEW"] = "screen_view";
EventName["SEARCH"] = "search";
EventName["SELECT_CONTENT"] = "select_content";
EventName["SELECT_ITEM"] = "select_item";
EventName["SELECT_PROMOTION"] = "select_promotion";
/** @deprecated */
EventName["SET_CHECKOUT_OPTION"] = "set_checkout_option";
EventName["SHARE"] = "share";
EventName["SIGN_UP"] = "sign_up";
EventName["TIMING_COMPLETE"] = "timing_complete";
EventName["VIEW_CART"] = "view_cart";
EventName["VIEW_ITEM"] = "view_item";
EventName["VIEW_ITEM_LIST"] = "view_item_list";
EventName["VIEW_PROMOTION"] = "view_promotion";
EventName["VIEW_SEARCH_RESULTS"] = "view_search_results";
})(EventName || (EventName = {}));
/**
* @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.
*/
/**
* 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.
*/
function logEvent(gtagFunction, analyticsId, eventName, eventParams, options) {
var params = eventParams || {};
if (!options || !options.global) {
params = tslib.__assign(tslib.__assign({}, eventParams), { 'send_to': analyticsId });
}
// Workaround for http://b/141370449 - third argument cannot be undefined.
gtagFunction(GtagCommand.EVENT, eventName, params || {});
}
// TODO: Brad is going to add `screen_name` to GA Gold config parameter schema
/**
* Set screen_name parameter for this Google Analytics ID.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param screenName Screen name string to set.
*/
function setCurrentScreen(gtagFunction, analyticsId, screenName, options) {
if (options && options.global) {
gtagFunction(GtagCommand.SET, { 'screen_name': screenName });
}
else {
gtagFunction(GtagCommand.CONFIG, analyticsId, {
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
*/
function setUserId(gtagFunction, analyticsId, id, options) {
if (options && options.global) {
gtagFunction(GtagCommand.SET, { 'user_id': id });
}
else {
gtagFunction(GtagCommand.CONFIG, analyticsId, {
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
*/
function setUserProperties(gtagFunction, analyticsId, properties, options) {
if (options && options.global) {
var flatProperties = {};
for (var _i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {
var key = _a[_i];
// use dot notation for merge behavior in gtag.js
flatProperties["user_properties." + key] = properties[key];
}
gtagFunction(GtagCommand.SET, flatProperties);
}
else {
gtagFunction(GtagCommand.CONFIG, analyticsId, {
update: true,
'user_properties': properties
});
}
}
/**
* Set whether collection is enabled for this ID.
*
* @param enabled If true, collection is enabled for this ID.
*/
function setAnalyticsCollectionEnabled(analyticsId, enabled) {
window["ga-disable-" + analyticsId] = !enabled;
}
/**
* @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.
*/
var 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.
*/
/**
* 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.
*/
function initializeGAId(app, installations, gtagCore) {
return tslib.__awaiter(this, void 0, void 0, function () {
var fid;
var _a;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, installations.getId()];
case 1:
fid = _b.sent();
// 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());
// 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.
gtagCore(GtagCommand.CONFIG, app.options[ANALYTICS_ID_FIELD], (_a = {},
_a[GA_FID_KEY] = fid,
// guard against developers accidentally setting properties with prefix `firebase_`
_a[ORIGIN_KEY] = 'firebase',
_a.update = true,
_a));
return [2 /*return*/];
}
});
});
}
function insertScriptTag(dataLayerName) {
var 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.
script.src = GTAG_URL + "?l=" + dataLayerName;
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.
var dataLayer = [];
if (Array.isArray(window[dataLayerName])) {
dataLayer = window[dataLayerName];
}
else {
window[dataLayerName] = dataLayer;
}
return dataLayer;
}
/**
* 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 initializedIdPromisesMap Map of gaIds to their initialization promises
*/
function wrapGtag(gtagCore, initializedIdPromisesMap) {
return function (command, idOrNameOrParams, gtagParams) {
// If event, check that relevant initialization promises have completed.
if (command === GtagCommand.EVENT) {
var initializationPromisesToWaitFor = [];
// If there's a 'send_to' param, check if any ID specified matches
// a FID we have begun a fetch on.
if (gtagParams && gtagParams['send_to']) {
var 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];
}
for (var _i = 0, gaSendToList_1 = gaSendToList; _i < gaSendToList_1.length; _i++) {
var sendToId = gaSendToList_1[_i];
var initializationPromise = initializedIdPromisesMap[sendToId];
// Groups will not be in the map.
if (initializationPromise) {
initializationPromisesToWaitFor.push(initializationPromise);
}
else {
// There is an item in 'send_to' that is not associated
// directly with an FID, possibly a group. Empty this array
// 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) {
for (var _a = 0, _b = Object.values(initializedIdPromisesMap); _a < _b.length; _a++) {
var idPromise = _b[_a];
initializationPromisesToWaitFor.push(idPromise);
}
}
// Run core gtag function with args after all relevant initialization
// promises have been resolved.
Promise.all(initializationPromisesToWaitFor)
// Workaround for http://b/141370449 - third argument cannot be undefined.
.then(function () {
return gtagCore(GtagCommand.EVENT, idOrNameOrParams, gtagParams || {});
})
.catch(function (e) { return logger.error(e); });
}
else if (command === GtagCommand.CONFIG) {
var initializationPromiseToWait = initializedIdPromisesMap[idOrNameOrParams] ||
Promise.resolve();
initializationPromiseToWait
.then(function () {
gtagCore(GtagCommand.CONFIG, idOrNameOrParams, gtagParams);
})
.catch(function (e) { return logger.error(e); });
}
else {
// SET command.
// Splitting calls for CONFIG and SET to make it clear which signature
// Typescript is checking.
gtagCore(GtagCommand.SET, idOrNameOrParams);
}
};
}
/**
* 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 initializedIdPromisesMap Map of gaId to initialization promises.
* @param dataLayerName Name of global GA datalayer array.
* @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified)
*/
function wrapOrCreateGtag(initializedIdPromisesMap, dataLayerName, gtagFunctionName) {
// Create a basic core gtag function
var gtagCore = function () {
var _args = [];
for (var _i = 0; _i < arguments.length; _i++) {
_args[_i] = arguments[_i];
}
// 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, initializedIdPromisesMap);
return {
gtagCore: gtagCore,
wrappedGtag: window[gtagFunctionName]
};
}
/**
* Returns first script tag in DOM matching our gtag url pattern.
*/
function findGtagScriptOnPage() {
var scriptTags = window.document.getElementsByTagName('script');
for (var _i = 0, _a = Object.values(scriptTags); _i < _a.length; _i++) {
var tag = _a[_i];
if (tag.src && tag.src.includes(GTAG_URL)) {
return tag;
}
}
return null;
}
/**
* @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.
*/
var _a;
var ERRORS = (_a = {},
_a["no-ga-id" /* NO_GA_ID */] = "\"" + ANALYTICS_ID_FIELD + "\" field is empty in " +
'Firebase config. Firebase Analytics ' +
'requires this field to contain a valid measurement ID.',
_a["already-exists" /* ALREADY_EXISTS */] = 'A Firebase Analytics instance with the measurement ID ${id} ' +
' already exists. ' +
'Only one Firebase Analytics instance can be created for each measurement ID.',
_a["already-initialized" /* ALREADY_INITIALIZED */] = 'Firebase Analytics has already been initialized.' +
'settings() must be called before initializing any Analytics instance' +
'or it will have no effect.',
_a["interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */] = 'Firebase Analytics Interop Component failed to instantiate',
_a);
var 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.
*/
/**
* Maps gaId to FID fetch promises.
*/
var initializedIdPromisesMap = {};
/**
* Name for window global data layer array used by GA: defaults to 'dataLayer'.
*/
var dataLayerName = 'dataLayer';
/**
* Name for window global gtag function used by GA: defaults to 'gtag'.
*/
var gtagName = 'gtag';
/**
* Reproduction of standard gtag function or reference to existing
* gtag function on window object.
*/
var gtagCoreFunction;
/**
* Wrapper around gtag function that ensures FID is sent with all
* relevant event and config calls.
*/
var wrappedGtagFunction;
/**
* Flag to ensure page initialization steps (creation or wrapping of
* dataLayer and gtag script) are only run once per page load.
*/
var globalInitDone = false;
/**
* For testing
*/
function resetGlobalVars(newGlobalInitDone, newGaInitializedPromise) {
if (newGlobalInitDone === void 0) { newGlobalInitDone = false; }
if (newGaInitializedPromise === void 0) { newGaInitializedPromise = {}; }
globalInitDone = newGlobalInitDone;
initializedIdPromisesMap = newGaInitializedPromise;
dataLayerName = 'dataLayer';
gtagName = 'gtag';
}
/**
* For testing
*/
function getGlobalVars() {
return {
initializedIdPromisesMap: initializedIdPromisesMap
};
}
/**
* This must be run before calling firebase.analytics() or it won't
* have any effect.
* @param options Custom gtag and dataLayer names.
*/
function settings(options) {
if (globalInitDone) {
throw ERROR_FACTORY.create("already-initialized" /* ALREADY_INITIALIZED */);
}
if (options.dataLayerName) {
dataLayerName = options.dataLayerName;
}
if (options.gtagName) {
gtagName = options.gtagName;
}
}
function factory(app, installations) {
var analyticsId = app.options[ANALYTICS_ID_FIELD];
if (!analyticsId) {
throw ERROR_FACTORY.create("no-ga-id" /* NO_GA_ID */);
}
if (initializedIdPromisesMap[analyticsId] != null) {
throw ERROR_FACTORY.create("already-exists" /* ALREADY_EXISTS */, {
id: analyticsId
});
}
if (!globalInitDone) {
// Steps here should only be done once per page: creation or wrapping
// of dataLayer and global gtag function.
// Detect if user has already put the gtag <script> tag on this page.
if (!findGtagScriptOnPage()) {
insertScriptTag(dataLayerName);
}
getOrCreateDataLayer(dataLayerName);
var _a = wrapOrCreateGtag(initializedIdPromisesMap, dataLayerName, gtagName), wrappedGtag = _a.wrappedGtag, gtagCore = _a.gtagCore;
wrappedGtagFunction = wrappedGtag;
gtagCoreFunction = gtagCore;
globalInitDone = true;
}
// Async but non-blocking.
initializedIdPromisesMap[analyticsId] = initializeGAId(app, installations, gtagCoreFunction);
var analyticsInstance = {
app: app,
logEvent: function (eventName, eventParams, options) {
return logEvent(wrappedGtagFunction, analyticsId, eventName, eventParams, options);
},
setCurrentScreen: function (screenName, options) {
return setCurrentScreen(wrappedGtagFunction, analyticsId, screenName, options);
},
setUserId: function (id, options) {
return setUserId(wrappedGtagFunction, analyticsId, id, options);
},
setUserProperties: function (properties, options) {
return setUserProperties(wrappedGtagFunction, analyticsId, properties, options);
},
setAnalyticsCollectionEnabled: function (enabled) {
return setAnalyticsCollectionEnabled(analyticsId, enabled);
}
};
return analyticsInstance;
}
var name = "@firebase/analytics";
var version = "0.3.5";
/**
* @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.
*/
var ANALYTICS_TYPE = 'analytics';
function registerAnalytics(instance) {
instance.INTERNAL.registerComponent(new component.Component(ANALYTICS_TYPE, function (container) {
// getImmediate for FirebaseApp will always succeed
var app = container.getProvider('app').getImmediate();
var installations = container
.getProvider('installations')
.getImmediate();
return factory(app, installations);
}, "PUBLIC" /* PUBLIC */).setServiceProps({
settings: settings,
EventName: EventName
}));
instance.INTERNAL.registerComponent(new component.Component('analytics-internal', internalFactory, "PRIVATE" /* PRIVATE */));
instance.registerVersion(name, version);
function internalFactory(container) {
try {
var analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();
return {
logEvent: analytics.logEvent
};
}
catch (e) {
throw ERROR_FACTORY.create("interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */, {
reason: e
});
}
}
}
registerAnalytics(firebase);
exports.factory = factory;
exports.getGlobalVars = getGlobalVars;
exports.registerAnalytics = registerAnalytics;
exports.resetGlobalVars = resetGlobalVars;
exports.settings = settings;
//# sourceMappingURL=index.cjs.js.map

+ 0
- 1
node_modules/@firebase/analytics/dist/index.cjs.js.map
File diff suppressed because it is too large
View File


+ 0
- 22
node_modules/@firebase/analytics/dist/index.d.ts View File

@ -1,22 +0,0 @@
import '@firebase/installations';
import { FirebaseAnalytics } from '@firebase/analytics-types';
import { _FirebaseNamespace } from '@firebase/app-types/private';
import { factory, settings, resetGlobalVars, getGlobalVars } from './src/factory';
declare global {
interface Window {
[key: string]: unknown;
}
}
export declare function registerAnalytics(instance: _FirebaseNamespace): void;
export { factory, settings, resetGlobalVars, getGlobalVars };
/**
* Define extension behavior of `registerAnalytics`
*/
declare module '@firebase/app-types' {
interface FirebaseNamespace {
analytics(app?: FirebaseApp): FirebaseAnalytics;
}
interface FirebaseApp {
analytics(): FirebaseAnalytics;
}
}

+ 0
- 586
node_modules/@firebase/analytics/dist/index.esm.js View File

@ -1,586 +0,0 @@
import firebase from '@firebase/app';
import '@firebase/installations';
import { __assign, __awaiter, __generator } from 'tslib';
import { Logger } from '@firebase/logger';
import { ErrorFactory } from '@firebase/util';
import { Component } from '@firebase/component';
/**
* @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.
*/
var ANALYTICS_ID_FIELD = 'measurementId';
// Key to attach FID to in gtag params.
var GA_FID_KEY = 'firebase_id';
var ORIGIN_KEY = 'origin';
var GTAG_URL = 'https://www.googletagmanager.com/gtag/js';
var GtagCommand;
(function (GtagCommand) {
GtagCommand["EVENT"] = "event";
GtagCommand["SET"] = "set";
GtagCommand["CONFIG"] = "config";
})(GtagCommand || (GtagCommand = {}));
/*
* Officially recommended event names for gtag.js
* Any other string is also allowed.
*/
var EventName;
(function (EventName) {
EventName["ADD_SHIPPING_INFO"] = "add_shipping_info";
EventName["ADD_PAYMENT_INFO"] = "add_payment_info";
EventName["ADD_TO_CART"] = "add_to_cart";
EventName["ADD_TO_WISHLIST"] = "add_to_wishlist";
EventName["BEGIN_CHECKOUT"] = "begin_checkout";
/** @deprecated */
EventName["CHECKOUT_PROGRESS"] = "checkout_progress";
EventName["EXCEPTION"] = "exception";
EventName["GENERATE_LEAD"] = "generate_lead";
EventName["LOGIN"] = "login";
EventName["PAGE_VIEW"] = "page_view";
EventName["PURCHASE"] = "purchase";
EventName["REFUND"] = "refund";
EventName["REMOVE_FROM_CART"] = "remove_from_cart";
EventName["SCREEN_VIEW"] = "screen_view";
EventName["SEARCH"] = "search";
EventName["SELECT_CONTENT"] = "select_content";
EventName["SELECT_ITEM"] = "select_item";
EventName["SELECT_PROMOTION"] = "select_promotion";
/** @deprecated */
EventName["SET_CHECKOUT_OPTION"] = "set_checkout_option";
EventName["SHARE"] = "share";
EventName["SIGN_UP"] = "sign_up";
EventName["TIMING_COMPLETE"] = "timing_complete";
EventName["VIEW_CART"] = "view_cart";
EventName["VIEW_ITEM"] = "view_item";
EventName["VIEW_ITEM_LIST"] = "view_item_list";
EventName["VIEW_PROMOTION"] = "view_promotion";
EventName["VIEW_SEARCH_RESULTS"] = "view_search_results";
})(EventName || (EventName = {}));
/**
* @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.
*/
/**
* 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.
*/
function logEvent(gtagFunction, analyticsId, eventName, eventParams, options) {
var params = eventParams || {};
if (!options || !options.global) {
params = __assign(__assign({}, eventParams), { 'send_to': analyticsId });
}
// Workaround for http://b/141370449 - third argument cannot be undefined.
gtagFunction(GtagCommand.EVENT, eventName, params || {});
}
// TODO: Brad is going to add `screen_name` to GA Gold config parameter schema
/**
* Set screen_name parameter for this Google Analytics ID.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param screenName Screen name string to set.
*/
function setCurrentScreen(gtagFunction, analyticsId, screenName, options) {
if (options && options.global) {
gtagFunction(GtagCommand.SET, { 'screen_name': screenName });
}
else {
gtagFunction(GtagCommand.CONFIG, analyticsId, {
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
*/
function setUserId(gtagFunction, analyticsId, id, options) {
if (options && options.global) {
gtagFunction(GtagCommand.SET, { 'user_id': id });
}
else {
gtagFunction(GtagCommand.CONFIG, analyticsId, {
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
*/
function setUserProperties(gtagFunction, analyticsId, properties, options) {
if (options && options.global) {
var flatProperties = {};
for (var _i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {
var key = _a[_i];
// use dot notation for merge behavior in gtag.js
flatProperties["user_properties." + key] = properties[key];
}
gtagFunction(GtagCommand.SET, flatProperties);
}
else {
gtagFunction(GtagCommand.CONFIG, analyticsId, {
update: true,
'user_properties': properties
});
}
}
/**
* Set whether collection is enabled for this ID.
*
* @param enabled If true, collection is enabled for this ID.
*/
function setAnalyticsCollectionEnabled(analyticsId, enabled) {
window["ga-disable-" + analyticsId] = !enabled;
}
/**
* @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.
*/
var 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.
*/
/**
* 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.
*/
function initializeGAId(app, installations, gtagCore) {
return __awaiter(this, void 0, void 0, function () {
var fid;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, installations.getId()];
case 1:
fid = _b.sent();
// 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());
// 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.
gtagCore(GtagCommand.CONFIG, app.options[ANALYTICS_ID_FIELD], (_a = {},
_a[GA_FID_KEY] = fid,
// guard against developers accidentally setting properties with prefix `firebase_`
_a[ORIGIN_KEY] = 'firebase',
_a.update = true,
_a));
return [2 /*return*/];
}
});
});
}
function insertScriptTag(dataLayerName) {
var 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.
script.src = GTAG_URL + "?l=" + dataLayerName;
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.
var dataLayer = [];
if (Array.isArray(window[dataLayerName])) {
dataLayer = window[dataLayerName];
}
else {
window[dataLayerName] = dataLayer;
}
return dataLayer;
}
/**
* 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 initializedIdPromisesMap Map of gaIds to their initialization promises
*/
function wrapGtag(gtagCore, initializedIdPromisesMap) {
return function (command, idOrNameOrParams, gtagParams) {
// If event, check that relevant initialization promises have completed.
if (command === GtagCommand.EVENT) {
var initializationPromisesToWaitFor = [];
// If there's a 'send_to' param, check if any ID specified matches
// a FID we have begun a fetch on.
if (gtagParams && gtagParams['send_to']) {
var 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];
}
for (var _i = 0, gaSendToList_1 = gaSendToList; _i < gaSendToList_1.length; _i++) {
var sendToId = gaSendToList_1[_i];
var initializationPromise = initializedIdPromisesMap[sendToId];
// Groups will not be in the map.
if (initializationPromise) {
initializationPromisesToWaitFor.push(initializationPromise);
}
else {
// There is an item in 'send_to' that is not associated
// directly with an FID, possibly a group. Empty this array
// 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) {
for (var _a = 0, _b = Object.values(initializedIdPromisesMap); _a < _b.length; _a++) {
var idPromise = _b[_a];
initializationPromisesToWaitFor.push(idPromise);
}
}
// Run core gtag function with args after all relevant initialization
// promises have been resolved.
Promise.all(initializationPromisesToWaitFor)
// Workaround for http://b/141370449 - third argument cannot be undefined.
.then(function () {
return gtagCore(GtagCommand.EVENT, idOrNameOrParams, gtagParams || {});
})
.catch(function (e) { return logger.error(e); });
}
else if (command === GtagCommand.CONFIG) {
var initializationPromiseToWait = initializedIdPromisesMap[idOrNameOrParams] ||
Promise.resolve();
initializationPromiseToWait
.then(function () {
gtagCore(GtagCommand.CONFIG, idOrNameOrParams, gtagParams);
})
.catch(function (e) { return logger.error(e); });
}
else {
// SET command.
// Splitting calls for CONFIG and SET to make it clear which signature
// Typescript is checking.
gtagCore(GtagCommand.SET, idOrNameOrParams);
}
};
}
/**
* 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 initializedIdPromisesMap Map of gaId to initialization promises.
* @param dataLayerName Name of global GA datalayer array.
* @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified)
*/
function wrapOrCreateGtag(initializedIdPromisesMap, dataLayerName, gtagFunctionName) {
// Create a basic core gtag function
var gtagCore = function () {
var _args = [];
for (var _i = 0; _i < arguments.length; _i++) {
_args[_i] = arguments[_i];
}
// 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, initializedIdPromisesMap);
return {
gtagCore: gtagCore,
wrappedGtag: window[gtagFunctionName]
};
}
/**
* Returns first script tag in DOM matching our gtag url pattern.
*/
function findGtagScriptOnPage() {
var scriptTags = window.document.getElementsByTagName('script');
for (var _i = 0, _a = Object.values(scriptTags); _i < _a.length; _i++) {
var tag =