@firebase/analytics 0.9.5-canary.0a27d2fbf → 0.9.5-canary.195e82ebb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -174,16 +174,6 @@ export declare interface EventParams {
174
174
  */
175
175
  export declare function getAnalytics(app?: FirebaseApp): Analytics;
176
176
 
177
- /**
178
- * Retrieves a unique Google Analytics identifier for the web client.
179
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
180
- *
181
- * @public
182
- *
183
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
184
- */
185
- export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
186
-
187
177
  /**
188
178
  * A set of common Google Analytics config settings recognized by
189
179
  * `gtag.js`.
@@ -174,16 +174,6 @@ export declare interface EventParams {
174
174
  */
175
175
  export declare function getAnalytics(app?: FirebaseApp): Analytics;
176
176
 
177
- /**
178
- * Retrieves a unique Google Analytics identifier for the web client.
179
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
180
- *
181
- * @public
182
- *
183
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
184
- */
185
- export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
186
-
187
177
  /**
188
178
  * A set of common Google Analytics config settings recognized by
189
179
  * `gtag.js`.
@@ -1,5 +1,5 @@
1
1
  import { getApp, _getProvider, _registerComponent, registerVersion } from '@firebase/app';
2
- import { __awaiter, __generator, __spreadArray, __assign } from 'tslib';
2
+ import { __awaiter, __generator, __assign } from 'tslib';
3
3
  import { Logger } from '@firebase/logger';
4
4
  import { ErrorFactory, calculateBackoffMillis, FirebaseError, validateIndexedDBOpenable, isIndexedDBAvailable, isBrowserExtension, areCookiesEnabled, getModularInstance, deepEqual } from '@firebase/util';
5
5
  import { Component } from '@firebase/component';
@@ -92,7 +92,6 @@ var ERRORS = (_a = {},
92
92
  'contain a valid API key.',
93
93
  _a["no-app-id" /* AnalyticsError.NO_APP_ID */] = 'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field to' +
94
94
  'contain a valid app ID.',
95
- _a["no-client-id" /* AnalyticsError.NO_CLIENT_ID */] = 'The "client_id" field is empty.',
96
95
  _a["invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */] = 'Trusted Types detected an invalid gtag resource: {$gtagURL}.',
97
96
  _a);
98
97
  var ERROR_FACTORY = new ErrorFactory('analytics', 'Analytics', ERRORS);
@@ -336,50 +335,36 @@ measurementIdToAppId) {
336
335
  * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET.
337
336
  * @param gtagParams Params if event is EVENT/CONFIG.
338
337
  */
339
- function gtagWrapper(command) {
340
- var args = [];
341
- for (var _i = 1; _i < arguments.length; _i++) {
342
- args[_i - 1] = arguments[_i];
343
- }
338
+ function gtagWrapper(command, idOrNameOrParams, gtagParams) {
344
339
  return __awaiter(this, void 0, void 0, function () {
345
- var measurementId, gtagParams, measurementId, gtagParams, gtagParams, measurementId, fieldName, callback, customParams, e_3;
340
+ var e_3;
346
341
  return __generator(this, function (_a) {
347
342
  switch (_a.label) {
348
343
  case 0:
349
344
  _a.trys.push([0, 6, , 7]);
350
345
  if (!(command === "event" /* GtagCommand.EVENT */)) return [3 /*break*/, 2];
351
- measurementId = args[0], gtagParams = args[1];
352
346
  // If EVENT, second arg must be measurementId.
353
- return [4 /*yield*/, gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams)];
347
+ return [4 /*yield*/, gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, idOrNameOrParams, gtagParams)];
354
348
  case 1:
355
349
  // If EVENT, second arg must be measurementId.
356
350
  _a.sent();
357
351
  return [3 /*break*/, 5];
358
352
  case 2:
359
353
  if (!(command === "config" /* GtagCommand.CONFIG */)) return [3 /*break*/, 4];
360
- measurementId = args[0], gtagParams = args[1];
361
354
  // If CONFIG, second arg must be measurementId.
362
- return [4 /*yield*/, gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams)];
355
+ return [4 /*yield*/, gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, idOrNameOrParams, gtagParams)];
363
356
  case 3:
364
357
  // If CONFIG, second arg must be measurementId.
365
358
  _a.sent();
366
359
  return [3 /*break*/, 5];
367
360
  case 4:
368
361
  if (command === "consent" /* GtagCommand.CONSENT */) {
369
- gtagParams = args[0];
362
+ // If CONFIG, second arg must be measurementId.
370
363
  gtagCore("consent" /* GtagCommand.CONSENT */, 'update', gtagParams);
371
364
  }
372
- else if (command === "get" /* GtagCommand.GET */) {
373
- measurementId = args[0], fieldName = args[1], callback = args[2];
374
- gtagCore("get" /* GtagCommand.GET */, measurementId, fieldName, callback);
375
- }
376
- else if (command === "set" /* GtagCommand.SET */) {
377
- customParams = args[0];
378
- // If SET, second arg must be params.
379
- gtagCore("set" /* GtagCommand.SET */, customParams);
380
- }
381
365
  else {
382
- gtagCore.apply(void 0, __spreadArray([command], args, false));
366
+ // If SET, second arg must be params.
367
+ gtagCore("set" /* GtagCommand.SET */, idOrNameOrParams);
383
368
  }
384
369
  _a.label = 5;
385
370
  case 5: return [3 /*break*/, 7];
@@ -858,32 +843,6 @@ function setUserProperties$1(gtagFunction, initializationPromise, properties, op
858
843
  });
859
844
  });
860
845
  }
861
- /**
862
- * Retrieves a unique Google Analytics identifier for the web client.
863
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
864
- *
865
- * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
866
- */
867
- function internalGetGoogleAnalyticsClientId(gtagFunction, initializationPromise) {
868
- return __awaiter(this, void 0, void 0, function () {
869
- var measurementId;
870
- return __generator(this, function (_a) {
871
- switch (_a.label) {
872
- case 0: return [4 /*yield*/, initializationPromise];
873
- case 1:
874
- measurementId = _a.sent();
875
- return [2 /*return*/, new Promise(function (resolve, reject) {
876
- gtagFunction("get" /* GtagCommand.GET */, measurementId, 'client_id', function (clientId) {
877
- if (!clientId) {
878
- reject(ERROR_FACTORY.create("no-client-id" /* AnalyticsError.NO_CLIENT_ID */));
879
- }
880
- resolve(clientId);
881
- });
882
- })];
883
- }
884
- });
885
- });
886
- }
887
846
  /**
888
847
  * Set whether collection is enabled for this ID.
889
848
  *
@@ -1314,22 +1273,6 @@ function setCurrentScreen(analyticsInstance, screenName, options) {
1314
1273
  analyticsInstance = getModularInstance(analyticsInstance);
1315
1274
  setCurrentScreen$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], screenName, options).catch(function (e) { return logger.error(e); });
1316
1275
  }
1317
- /**
1318
- * Retrieves a unique Google Analytics identifier for the web client.
1319
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
1320
- *
1321
- * @public
1322
- *
1323
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
1324
- */
1325
- function getGoogleAnalyticsClientId(analyticsInstance) {
1326
- return __awaiter(this, void 0, void 0, function () {
1327
- return __generator(this, function (_a) {
1328
- analyticsInstance = getModularInstance(analyticsInstance);
1329
- return [2 /*return*/, internalGetGoogleAnalyticsClientId(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId])];
1330
- });
1331
- });
1332
- }
1333
1276
  /**
1334
1277
  * Use gtag `config` command to set `user_id`.
1335
1278
  *
@@ -1415,7 +1358,7 @@ function setConsent(consentSettings) {
1415
1358
  }
1416
1359
 
1417
1360
  var name = "@firebase/analytics";
1418
- var version = "0.9.5-canary.0a27d2fbf";
1361
+ var version = "0.9.5-canary.195e82ebb";
1419
1362
 
1420
1363
  /**
1421
1364
  * Firebase Analytics
@@ -1452,5 +1395,5 @@ function registerAnalytics() {
1452
1395
  }
1453
1396
  registerAnalytics();
1454
1397
 
1455
- export { getAnalytics, getGoogleAnalyticsClientId, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
1398
+ export { getAnalytics, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
1456
1399
  //# sourceMappingURL=index.esm.js.map