@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.
package/dist/index.cjs.js CHANGED
@@ -96,7 +96,6 @@ var ERRORS = (_a = {},
96
96
  'contain a valid API key.',
97
97
  _a["no-app-id" /* AnalyticsError.NO_APP_ID */] = 'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field to' +
98
98
  'contain a valid app ID.',
99
- _a["no-client-id" /* AnalyticsError.NO_CLIENT_ID */] = 'The "client_id" field is empty.',
100
99
  _a["invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */] = 'Trusted Types detected an invalid gtag resource: {$gtagURL}.',
101
100
  _a);
102
101
  var ERROR_FACTORY = new util.ErrorFactory('analytics', 'Analytics', ERRORS);
@@ -340,50 +339,36 @@ measurementIdToAppId) {
340
339
  * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET.
341
340
  * @param gtagParams Params if event is EVENT/CONFIG.
342
341
  */
343
- function gtagWrapper(command) {
344
- var args = [];
345
- for (var _i = 1; _i < arguments.length; _i++) {
346
- args[_i - 1] = arguments[_i];
347
- }
342
+ function gtagWrapper(command, idOrNameOrParams, gtagParams) {
348
343
  return tslib.__awaiter(this, void 0, void 0, function () {
349
- var measurementId, gtagParams, measurementId, gtagParams, gtagParams, measurementId, fieldName, callback, customParams, e_3;
344
+ var e_3;
350
345
  return tslib.__generator(this, function (_a) {
351
346
  switch (_a.label) {
352
347
  case 0:
353
348
  _a.trys.push([0, 6, , 7]);
354
349
  if (!(command === "event" /* GtagCommand.EVENT */)) return [3 /*break*/, 2];
355
- measurementId = args[0], gtagParams = args[1];
356
350
  // If EVENT, second arg must be measurementId.
357
- return [4 /*yield*/, gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams)];
351
+ return [4 /*yield*/, gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, idOrNameOrParams, gtagParams)];
358
352
  case 1:
359
353
  // If EVENT, second arg must be measurementId.
360
354
  _a.sent();
361
355
  return [3 /*break*/, 5];
362
356
  case 2:
363
357
  if (!(command === "config" /* GtagCommand.CONFIG */)) return [3 /*break*/, 4];
364
- measurementId = args[0], gtagParams = args[1];
365
358
  // If CONFIG, second arg must be measurementId.
366
- return [4 /*yield*/, gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams)];
359
+ return [4 /*yield*/, gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, idOrNameOrParams, gtagParams)];
367
360
  case 3:
368
361
  // If CONFIG, second arg must be measurementId.
369
362
  _a.sent();
370
363
  return [3 /*break*/, 5];
371
364
  case 4:
372
365
  if (command === "consent" /* GtagCommand.CONSENT */) {
373
- gtagParams = args[0];
366
+ // If CONFIG, second arg must be measurementId.
374
367
  gtagCore("consent" /* GtagCommand.CONSENT */, 'update', gtagParams);
375
368
  }
376
- else if (command === "get" /* GtagCommand.GET */) {
377
- measurementId = args[0], fieldName = args[1], callback = args[2];
378
- gtagCore("get" /* GtagCommand.GET */, measurementId, fieldName, callback);
379
- }
380
- else if (command === "set" /* GtagCommand.SET */) {
381
- customParams = args[0];
382
- // If SET, second arg must be params.
383
- gtagCore("set" /* GtagCommand.SET */, customParams);
384
- }
385
369
  else {
386
- gtagCore.apply(void 0, tslib.__spreadArray([command], args, false));
370
+ // If SET, second arg must be params.
371
+ gtagCore("set" /* GtagCommand.SET */, idOrNameOrParams);
387
372
  }
388
373
  _a.label = 5;
389
374
  case 5: return [3 /*break*/, 7];
@@ -862,32 +847,6 @@ function setUserProperties$1(gtagFunction, initializationPromise, properties, op
862
847
  });
863
848
  });
864
849
  }
865
- /**
866
- * Retrieves a unique Google Analytics identifier for the web client.
867
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
868
- *
869
- * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
870
- */
871
- function internalGetGoogleAnalyticsClientId(gtagFunction, initializationPromise) {
872
- return tslib.__awaiter(this, void 0, void 0, function () {
873
- var measurementId;
874
- return tslib.__generator(this, function (_a) {
875
- switch (_a.label) {
876
- case 0: return [4 /*yield*/, initializationPromise];
877
- case 1:
878
- measurementId = _a.sent();
879
- return [2 /*return*/, new Promise(function (resolve, reject) {
880
- gtagFunction("get" /* GtagCommand.GET */, measurementId, 'client_id', function (clientId) {
881
- if (!clientId) {
882
- reject(ERROR_FACTORY.create("no-client-id" /* AnalyticsError.NO_CLIENT_ID */));
883
- }
884
- resolve(clientId);
885
- });
886
- })];
887
- }
888
- });
889
- });
890
- }
891
850
  /**
892
851
  * Set whether collection is enabled for this ID.
893
852
  *
@@ -1318,22 +1277,6 @@ function setCurrentScreen(analyticsInstance, screenName, options) {
1318
1277
  analyticsInstance = util.getModularInstance(analyticsInstance);
1319
1278
  setCurrentScreen$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], screenName, options).catch(function (e) { return logger.error(e); });
1320
1279
  }
1321
- /**
1322
- * Retrieves a unique Google Analytics identifier for the web client.
1323
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
1324
- *
1325
- * @public
1326
- *
1327
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
1328
- */
1329
- function getGoogleAnalyticsClientId(analyticsInstance) {
1330
- return tslib.__awaiter(this, void 0, void 0, function () {
1331
- return tslib.__generator(this, function (_a) {
1332
- analyticsInstance = util.getModularInstance(analyticsInstance);
1333
- return [2 /*return*/, internalGetGoogleAnalyticsClientId(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId])];
1334
- });
1335
- });
1336
- }
1337
1280
  /**
1338
1281
  * Use gtag `config` command to set `user_id`.
1339
1282
  *
@@ -1419,7 +1362,7 @@ function setConsent(consentSettings) {
1419
1362
  }
1420
1363
 
1421
1364
  var name = "@firebase/analytics";
1422
- var version = "0.9.5-canary.0a27d2fbf";
1365
+ var version = "0.9.5-canary.195e82ebb";
1423
1366
 
1424
1367
  /**
1425
1368
  * Firebase Analytics
@@ -1457,7 +1400,6 @@ function registerAnalytics() {
1457
1400
  registerAnalytics();
1458
1401
 
1459
1402
  exports.getAnalytics = getAnalytics;
1460
- exports.getGoogleAnalyticsClientId = getGoogleAnalyticsClientId;
1461
1403
  exports.initializeAnalytics = initializeAnalytics;
1462
1404
  exports.isSupported = isSupported;
1463
1405
  exports.logEvent = logEvent;