@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.
@@ -90,7 +90,6 @@ const ERRORS = {
90
90
  'contain a valid API key.',
91
91
  ["no-app-id" /* AnalyticsError.NO_APP_ID */]: 'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field to' +
92
92
  'contain a valid app ID.',
93
- ["no-client-id" /* AnalyticsError.NO_CLIENT_ID */]: 'The "client_id" field is empty.',
94
93
  ["invalid-gtag-resource" /* AnalyticsError.INVALID_GTAG_RESOURCE */]: 'Trusted Types detected an invalid gtag resource: {$gtagURL}.'
95
94
  };
96
95
  const ERROR_FACTORY = new ErrorFactory('analytics', 'Analytics', ERRORS);
@@ -304,34 +303,24 @@ measurementIdToAppId) {
304
303
  * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET.
305
304
  * @param gtagParams Params if event is EVENT/CONFIG.
306
305
  */
307
- async function gtagWrapper(command, ...args) {
306
+ async function gtagWrapper(command, idOrNameOrParams, gtagParams) {
308
307
  try {
309
308
  // If event, check that relevant initialization promises have completed.
310
309
  if (command === "event" /* GtagCommand.EVENT */) {
311
- const [measurementId, gtagParams] = args;
312
310
  // If EVENT, second arg must be measurementId.
313
- await gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams);
311
+ await gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, idOrNameOrParams, gtagParams);
314
312
  }
315
313
  else if (command === "config" /* GtagCommand.CONFIG */) {
316
- const [measurementId, gtagParams] = args;
317
314
  // If CONFIG, second arg must be measurementId.
318
- await gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams);
315
+ await gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, idOrNameOrParams, gtagParams);
319
316
  }
320
317
  else if (command === "consent" /* GtagCommand.CONSENT */) {
321
- const [gtagParams] = args;
318
+ // If CONFIG, second arg must be measurementId.
322
319
  gtagCore("consent" /* GtagCommand.CONSENT */, 'update', gtagParams);
323
320
  }
324
- else if (command === "get" /* GtagCommand.GET */) {
325
- const [measurementId, fieldName, callback] = args;
326
- gtagCore("get" /* GtagCommand.GET */, measurementId, fieldName, callback);
327
- }
328
- else if (command === "set" /* GtagCommand.SET */) {
329
- const [customParams] = args;
330
- // If SET, second arg must be params.
331
- gtagCore("set" /* GtagCommand.SET */, customParams);
332
- }
333
321
  else {
334
- gtagCore(command, ...args);
322
+ // If SET, second arg must be params.
323
+ gtagCore("set" /* GtagCommand.SET */, idOrNameOrParams);
335
324
  }
336
325
  }
337
326
  catch (e) {
@@ -725,23 +714,6 @@ async function setUserProperties$1(gtagFunction, initializationPromise, properti
725
714
  });
726
715
  }
727
716
  }
728
- /**
729
- * Retrieves a unique Google Analytics identifier for the web client.
730
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
731
- *
732
- * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
733
- */
734
- async function internalGetGoogleAnalyticsClientId(gtagFunction, initializationPromise) {
735
- const measurementId = await initializationPromise;
736
- return new Promise((resolve, reject) => {
737
- gtagFunction("get" /* GtagCommand.GET */, measurementId, 'client_id', (clientId) => {
738
- if (!clientId) {
739
- reject(ERROR_FACTORY.create("no-client-id" /* AnalyticsError.NO_CLIENT_ID */));
740
- }
741
- resolve(clientId);
742
- });
743
- });
744
- }
745
717
  /**
746
718
  * Set whether collection is enabled for this ID.
747
719
  *
@@ -1131,18 +1103,6 @@ function setCurrentScreen(analyticsInstance, screenName, options) {
1131
1103
  analyticsInstance = getModularInstance(analyticsInstance);
1132
1104
  setCurrentScreen$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], screenName, options).catch(e => logger.error(e));
1133
1105
  }
1134
- /**
1135
- * Retrieves a unique Google Analytics identifier for the web client.
1136
- * See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
1137
- *
1138
- * @public
1139
- *
1140
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
1141
- */
1142
- async function getGoogleAnalyticsClientId(analyticsInstance) {
1143
- analyticsInstance = getModularInstance(analyticsInstance);
1144
- return internalGetGoogleAnalyticsClientId(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId]);
1145
- }
1146
1106
  /**
1147
1107
  * Use gtag `config` command to set `user_id`.
1148
1108
  *
@@ -1228,7 +1188,7 @@ function setConsent(consentSettings) {
1228
1188
  }
1229
1189
 
1230
1190
  const name = "@firebase/analytics";
1231
- const version = "0.9.5-canary.0a27d2fbf";
1191
+ const version = "0.9.5-canary.195e82ebb";
1232
1192
 
1233
1193
  /**
1234
1194
  * Firebase Analytics
@@ -1264,5 +1224,5 @@ function registerAnalytics() {
1264
1224
  }
1265
1225
  registerAnalytics();
1266
1226
 
1267
- export { getAnalytics, getGoogleAnalyticsClientId, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
1227
+ export { getAnalytics, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
1268
1228
  //# sourceMappingURL=index.esm2017.js.map