@react-native-firebase/analytics 21.7.4 → 21.8.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [21.8.0](https://github.com/invertase/react-native-firebase/compare/v21.7.4...v21.8.0) (2025-02-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ - do not ship unit tests in released packages ([e71dadf](https://github.com/invertase/react-native-firebase/commit/e71dadfc1c0cad2e89c94100913af31ddf7d9c91))
11
+
6
12
  ## [21.7.4](https://github.com/invertase/react-native-firebase/compare/v21.7.3...v21.7.4) (2025-02-08)
7
13
 
8
14
  ### Bug Fixes
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '21.7.4';
2
+ module.exports = '21.8.0';
@@ -16,7 +16,7 @@ function getAnalyticsApi() {
16
16
  }
17
17
  if (!analyticsInstances[measurementId]) {
18
18
  analyticsInstances[measurementId] = new AnalyticsApi('[DEFAULT]', measurementId);
19
- if (global.RNFBDebug) {
19
+ if (globalThis.RNFBDebug) {
20
20
  analyticsInstances[measurementId].setDebug(true);
21
21
  }
22
22
  }
package/lib/web/api.js CHANGED
@@ -54,7 +54,7 @@ class AnalyticsApi {
54
54
  this.currentScreen = null;
55
55
 
56
56
  this._getInstallationId().catch(error => {
57
- if (global.RNFBDebug) {
57
+ if (globalThis.RNFBDebug) {
58
58
  console.debug('[RNFB->Analytics][🔴] Error getting Firebase Installation Id:', error);
59
59
  } else {
60
60
  // No-op. This is a non-critical error.
@@ -128,7 +128,7 @@ class AnalyticsApi {
128
128
  const app = getApp(this.appName);
129
129
  const installations = getInstallations(app);
130
130
  const id = await getId(installations);
131
- if (global.RNFBDebug) {
131
+ if (globalThis.RNFBDebug) {
132
132
  console.debug('[RNFB->Analytics][📊] Firebase Installation Id:', id);
133
133
  }
134
134
  this.installationId = id;
@@ -299,7 +299,7 @@ For example, to use React Native Async Storage:
299
299
 
300
300
  try {
301
301
  const url = `https://www.google-analytics.com/g/collect?${queryParams.toString()}`;
302
- if (global.RNFBDebug) {
302
+ if (globalThis.RNFBDebug) {
303
303
  console.debug(`[RNFB-->Fetch][📊] Sending analytics call: ${url}`);
304
304
  }
305
305
  const response = await fetch(url, {
@@ -319,11 +319,11 @@ For example, to use React Native Async Storage:
319
319
  'user-agent': 'react-native-firebase',
320
320
  },
321
321
  });
322
- if (global.RNFBDebug) {
322
+ if (globalThis.RNFBDebug) {
323
323
  console.debug(`[RNFB<--Fetch][📊] Response: ${response.status}`);
324
324
  }
325
325
  } catch (error) {
326
- if (global.RNFBDebug) {
326
+ if (globalThis.RNFBDebug) {
327
327
  console.debug('[RNFB<--Fetch][🔴] Error sending Analytics event:', error);
328
328
  }
329
329
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/analytics",
3
- "version": "21.7.4",
3
+ "version": "21.8.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - The analytics module provides out of the box support with Google Analytics for Firebase. Integration with the Android & iOS allows for in-depth analytical insight reporting, such as device information, location, user actions and more.",
6
6
  "main": "lib/index.js",
@@ -22,7 +22,7 @@
22
22
  "analytics"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@react-native-firebase/app": "21.7.4"
25
+ "@react-native-firebase/app": "21.8.0"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
@@ -30,5 +30,5 @@
30
30
  "dependencies": {
31
31
  "superstruct": "^2.0.2"
32
32
  },
33
- "gitHead": "82c4c7391fee6597726e5363d78400f11a644e47"
33
+ "gitHead": "14ebd5c2d2e0f284397c331f909e533c47f2ec62"
34
34
  }
@@ -1,927 +0,0 @@
1
- import { describe, expect, it, xit } from '@jest/globals';
2
-
3
- import {
4
- firebase,
5
- getAnalytics,
6
- initializeAnalytics,
7
- logEvent,
8
- setAnalyticsCollectionEnabled,
9
- setSessionTimeoutDuration,
10
- getAppInstanceId,
11
- getSessionId,
12
- setUserId,
13
- setUserProperty,
14
- setUserProperties,
15
- resetAnalyticsData,
16
- logAddPaymentInfo,
17
- logScreenView,
18
- logAddShippingInfo,
19
- logAddToCart,
20
- logAddToWishlist,
21
- logAppOpen,
22
- logBeginCheckout,
23
- logCampaignDetails,
24
- logEarnVirtualCurrency,
25
- logGenerateLead,
26
- logJoinGroup,
27
- logLevelEnd,
28
- logLevelStart,
29
- logLevelUp,
30
- logLogin,
31
- logPostScore,
32
- logSelectContent,
33
- logPurchase,
34
- logRefund,
35
- logRemoveFromCart,
36
- logSearch,
37
- logSelectItem,
38
- logSetCheckoutOption,
39
- logSelectPromotion,
40
- logShare,
41
- logSignUp,
42
- logSpendVirtualCurrency,
43
- logTutorialBegin,
44
- logTutorialComplete,
45
- logUnlockAchievement,
46
- logViewCart,
47
- logViewItem,
48
- logViewItemList,
49
- logViewPromotion,
50
- logViewSearchResults,
51
- setDefaultEventParameters,
52
- initiateOnDeviceConversionMeasurementWithEmailAddress,
53
- initiateOnDeviceConversionMeasurementWithHashedEmailAddress,
54
- initiateOnDeviceConversionMeasurementWithPhoneNumber,
55
- initiateOnDeviceConversionMeasurementWithHashedPhoneNumber,
56
- isSupported,
57
- setConsent,
58
- settings,
59
- } from '../lib';
60
-
61
- describe('Analytics', function () {
62
- describe('namespace', function () {
63
- it('accessible from firebase.app()', function () {
64
- const app = firebase.app();
65
- expect(app.analytics).toBeDefined();
66
- expect(app.analytics().app).toEqual(app);
67
- });
68
-
69
- it('throws if non default app arg provided to firebase.analytics(APP)', function () {
70
- const app = firebase.app('secondaryFromNative');
71
-
72
- const expectedError = [
73
- 'You attempted to call "firebase.analytics(app)" but; analytics does not support multiple Firebase Apps.',
74
- '',
75
- 'Ensure the app provided is the default Firebase app only and not the "secondaryFromNative" app.',
76
- ].join('\r\n');
77
-
78
- // @ts-ignore test
79
- expect(() => firebase.analytics(app)).toThrowError(expectedError);
80
- });
81
-
82
- it('throws if analytics access from a non default app', function () {
83
- const app = firebase.app('secondaryFromNative');
84
-
85
- const expectedError = [
86
- 'You attempted to call "firebase.app(\'secondaryFromNative\').analytics" but; analytics does not support multiple Firebase Apps.',
87
- '',
88
- 'Ensure you access analytics from the default application only.',
89
- ].join('\r\n');
90
-
91
- expect(() => app.analytics()).toThrowError(expectedError);
92
- });
93
-
94
- // TODO in app/registry/namespace.js - if (!hasCustomUrlOrRegionSupport)
95
- xit('throws if args provided to firebase.app().analytics(ARGS)', function () {
96
- try {
97
- // @ts-ignore test
98
- firebase.app().analytics('foo', 'arg2');
99
- return Promise.reject(new Error('Did not throw'));
100
- } catch (e: any) {
101
- e.message.should.containEql('does not support multiple Firebase Apps');
102
- return Promise.resolve();
103
- }
104
- });
105
- });
106
-
107
- it('errors if milliseconds not a number', function () {
108
- // @ts-ignore test
109
- expect(() => firebase.analytics().setSessionTimeoutDuration('123')).toThrowError(
110
- "'milliseconds' expected a number value",
111
- );
112
- });
113
-
114
- it('throws if none string none null values', function () {
115
- // @ts-ignore test
116
- expect(() => firebase.analytics().setUserId(123)).toThrowError("'id' expected a string value");
117
- });
118
-
119
- it('throws if name is not a string', function () {
120
- // @ts-ignore test
121
- expect(() => firebase.analytics().setUserProperty(1337, 'invertase')).toThrowError(
122
- "'name' expected a string value",
123
- );
124
- });
125
-
126
- it('throws if value is invalid', function () {
127
- // @ts-ignore test
128
- expect(() => firebase.analytics().setUserProperty('invertase3', 33.3333)).toThrowError(
129
- "'value' expected a string value",
130
- );
131
- });
132
-
133
- it('throws if properties is not an object', function () {
134
- // @ts-ignore test
135
- expect(() => firebase.analytics().setUserProperties(1337)).toThrowError(
136
- "'properties' expected an object of key/value pairs",
137
- );
138
- });
139
-
140
- it('throws if property value is invalid', function () {
141
- const props = {
142
- test: '123',
143
- foo: {
144
- bar: 'baz',
145
- },
146
- };
147
- // @ts-ignore test
148
- expect(() => firebase.analytics().setUserProperties(props)).toThrowError(
149
- "'properties' value for parameter 'foo' is invalid",
150
- );
151
- });
152
-
153
- it('throws if value is a number', function () {
154
- // @ts-ignore test
155
- expect(() => firebase.analytics().setUserProperties({ invertase1: 123 })).toThrowError(
156
- "'properties' value for parameter 'invertase1' is invalid, expected a string.",
157
- );
158
- });
159
-
160
- it('throws if consentSettings is not an object', function () {
161
- // @ts-ignore test
162
- expect(() => firebase.analytics().setConsent(1337)).toThrowError(
163
- 'The supplied arg must be an object of key/values.',
164
- );
165
- });
166
-
167
- it('throws if consentSettings is invalid', function () {
168
- const consentSettings = {
169
- ad_storage: true,
170
- foo: {
171
- bar: 'baz',
172
- },
173
- };
174
- // @ts-ignore test
175
- expect(() => firebase.analytics().setConsent(consentSettings)).toThrowError(
176
- "'consentSettings' value for parameter 'foo' is invalid, expected a boolean.",
177
- );
178
- });
179
-
180
- it('throws if one value of consentSettings is a number', function () {
181
- // @ts-ignore test
182
- expect(() => firebase.analytics().setConsent({ ad_storage: 123 })).toThrowError(
183
- "'consentSettings' value for parameter 'ad_storage' is invalid, expected a boolean.",
184
- );
185
- });
186
-
187
- it('errors when no parameters are set', function () {
188
- // @ts-ignore test
189
- expect(() => firebase.analytics().logSearch()).toThrowError(
190
- 'The supplied arg must be an object of key/values',
191
- );
192
- });
193
-
194
- describe('logEvent()', function () {
195
- it('errors if name is not a string', function () {
196
- // @ts-ignore test
197
- expect(() => firebase.analytics().logEvent(123)).toThrowError(
198
- "firebase.analytics().logEvent(*) 'name' expected a string value.",
199
- );
200
- });
201
-
202
- it('errors if params is not an object', function () {
203
- // @ts-ignore test
204
- expect(() => firebase.analytics().logEvent('invertase_event', 'foobar')).toThrowError(
205
- "firebase.analytics().logEvent(_, *) 'params' expected an object value.",
206
- );
207
- });
208
-
209
- it('errors on using a reserved name', function () {
210
- expect(() => firebase.analytics().logEvent('session_start')).toThrowError(
211
- "firebase.analytics().logEvent(*) 'name' the event name 'session_start' is reserved and can not be used.",
212
- );
213
- });
214
-
215
- it('errors if name not alphanumeric', function () {
216
- expect(() => firebase.analytics().logEvent('!@£$%^&*')).toThrowError(
217
- "firebase.analytics().logEvent(*) 'name' invalid event name '!@£$%^&*'. Names should contain 1 to 40 alphanumeric characters or underscores.",
218
- );
219
- });
220
-
221
- describe('logScreenView()', function () {
222
- it('errors if param is not an object', function () {
223
- // @ts-ignore test
224
- expect(() => firebase.analytics().logScreenView(123)).toThrowError(
225
- 'firebase.analytics().logScreenView(*):',
226
- );
227
- });
228
-
229
- it('accepts arbitrary custom event parameters while rejecting defined parameters with wrong types', function () {
230
- expect(() => firebase.analytics().logScreenView({ foo: 'bar' })).not.toThrow();
231
- expect(() =>
232
- // @ts-ignore test
233
- firebase.analytics().logScreenView({ screen_name: 123, foo: 'bar' }),
234
- ).toThrowError('firebase.analytics().logScreenView(*):');
235
- });
236
- });
237
-
238
- describe('logAddPaymentInfo()', function () {
239
- it('errors if param is not an object', function () {
240
- // @ts-ignore test
241
- expect(() => firebase.analytics().logAddPaymentInfo(123)).toThrowError(
242
- 'firebase.analytics().logAddPaymentInfo(*):',
243
- );
244
- });
245
-
246
- it('errors when compound values are not set', function () {
247
- expect(() =>
248
- firebase.analytics().logAddPaymentInfo({
249
- value: 123,
250
- }),
251
- ).toThrowError('firebase.analytics().logAddPaymentInfo(*):');
252
- });
253
- });
254
- });
255
-
256
- describe('setDefaultEventParameters()', function () {
257
- it('errors if params is not a object', function () {
258
- // @ts-ignore test
259
- expect(() => firebase.analytics().setDefaultEventParameters('123')).toThrowError(
260
- "firebase.analytics().setDefaultEventParameters(*) 'params' expected an object value when it is defined.",
261
- );
262
- });
263
- });
264
-
265
- describe('logAddToCart()', function () {
266
- it('errors if param is not an object', function () {
267
- // @ts-ignore test
268
- expect(() => firebase.analytics().logAddToCart(123)).toThrowError(
269
- 'firebase.analytics().logAddToCart(*):',
270
- );
271
- });
272
-
273
- it('errors when compound values are not set', function () {
274
- expect(() =>
275
- firebase.analytics().logAddToCart({
276
- value: 123,
277
- }),
278
- ).toThrowError('firebase.analytics().logAddToCart(*):');
279
- });
280
- });
281
-
282
- describe('logAddShippingInfo()', function () {
283
- it('errors if param is not an object', function () {
284
- // @ts-ignore test
285
- expect(() => firebase.analytics().logAddShippingInfo(123)).toThrowError(
286
- 'firebase.analytics().logAddShippingInfo(*):',
287
- );
288
- });
289
-
290
- it('errors when compound values are not set', function () {
291
- expect(() =>
292
- firebase.analytics().logAddShippingInfo({
293
- value: 123,
294
- }),
295
- ).toThrowError('firebase.analytics().logAddShippingInfo(*):');
296
- });
297
- });
298
-
299
- describe('logAddToWishlist()', function () {
300
- it('errors if param is not an object', function () {
301
- // @ts-ignore test
302
- expect(() => firebase.analytics().logAddToWishlist(123)).toThrowError(
303
- 'firebase.analytics().logAddToWishlist(*):',
304
- );
305
- });
306
-
307
- it('errors when compound values are not set', function () {
308
- expect(() =>
309
- firebase.analytics().logAddToWishlist({
310
- value: 123,
311
- }),
312
- ).toThrowError('firebase.analytics().logAddToWishlist(*):');
313
- });
314
-
315
- it('items accept arbitrary custom event parameters', function () {
316
- expect(() =>
317
- firebase.analytics().logAddToWishlist({ items: [{ foo: 'bar' }] }),
318
- ).not.toThrow();
319
- });
320
- });
321
-
322
- describe('logBeginCheckout()', function () {
323
- it('errors if param is not an object', function () {
324
- // @ts-ignore test
325
- expect(() => firebase.analytics().logBeginCheckout(123)).toThrowError(
326
- 'firebase.analytics().logBeginCheckout(*):',
327
- );
328
- });
329
-
330
- it('errors when compound values are not set', function () {
331
- expect(() =>
332
- firebase.analytics().logBeginCheckout({
333
- value: 123,
334
- }),
335
- ).toThrowError('firebase.analytics().logBeginCheckout(*):');
336
- });
337
-
338
- it('accepts arbitrary custom event parameters', function () {
339
- expect(() =>
340
- firebase.analytics().logBeginCheckout({
341
- value: 123,
342
- currency: 'EUR',
343
- foo: 'bar',
344
- }),
345
- ).not.toThrow();
346
- });
347
- });
348
-
349
- describe('logGenerateLead()', function () {
350
- it('errors if param is not an object', function () {
351
- // @ts-ignore test
352
- expect(() => firebase.analytics().logGenerateLead(123)).toThrowError(
353
- 'firebase.analytics().logGenerateLead(*):',
354
- );
355
- });
356
-
357
- it('errors when compound values are not set', function () {
358
- expect(() =>
359
- firebase.analytics().logGenerateLead({
360
- value: 123,
361
- }),
362
- ).toThrowError('firebase.analytics().logGenerateLead(*):');
363
- });
364
- });
365
-
366
- describe('logCampaignDetails()', function () {
367
- it('errors if param is not an object', function () {
368
- // @ts-ignore test
369
- expect(() => firebase.analytics().logCampaignDetails(123)).toThrowError(
370
- 'firebase.analytics().logCampaignDetails(*):',
371
- );
372
- });
373
- });
374
-
375
- describe('logEarnVirtualCurrency()', function () {
376
- it('errors if param is not an object', function () {
377
- // @ts-ignore test
378
- expect(() => firebase.analytics().logEarnVirtualCurrency(123)).toThrowError(
379
- 'firebase.analytics().logEarnVirtualCurrency(*):',
380
- );
381
- });
382
- });
383
-
384
- describe('logJoinGroup()', function () {
385
- it('errors if param is not an object', function () {
386
- // @ts-ignore test
387
- expect(() => firebase.analytics().logJoinGroup(123)).toThrowError(
388
- 'firebase.analytics().logJoinGroup(*):',
389
- );
390
- });
391
- });
392
-
393
- describe('logLevelEnd()', function () {
394
- it('errors if param is not an object', function () {
395
- // @ts-ignore test
396
- expect(() => firebase.analytics().logLevelEnd(123)).toThrowError(
397
- 'firebase.analytics().logLevelEnd(*):',
398
- );
399
- });
400
- });
401
-
402
- describe('logLevelStart()', function () {
403
- it('errors if param is not an object', function () {
404
- // @ts-ignore test
405
- expect(() => firebase.analytics().logLevelStart(123)).toThrowError(
406
- 'firebase.analytics().logLevelStart(*):',
407
- );
408
- });
409
- });
410
-
411
- describe('logLevelUp()', function () {
412
- it('errors if param is not an object', function () {
413
- // @ts-ignore test
414
- expect(() => firebase.analytics().logLevelUp(123)).toThrowError(
415
- 'firebase.analytics().logLevelUp(*):',
416
- );
417
- });
418
- });
419
-
420
- describe('logLogin()', function () {
421
- it('errors if param is not an object', function () {
422
- // @ts-ignore test
423
- expect(() => firebase.analytics().logLogin(123)).toThrowError(
424
- 'firebase.analytics().logLogin(*):',
425
- );
426
- });
427
- });
428
-
429
- describe('logPostScore()', function () {
430
- it('errors if param is not an object', function () {
431
- // @ts-ignore test
432
- expect(() => firebase.analytics().logPostScore(123)).toThrowError(
433
- 'firebase.analytics().logPostScore(*):',
434
- );
435
- });
436
- });
437
-
438
- describe('logSelectContent()', function () {
439
- it('errors if param is not an object', function () {
440
- // @ts-ignore test
441
- expect(() => firebase.analytics().logSelectContent(123)).toThrowError(
442
- 'firebase.analytics().logSelectContent(*):',
443
- );
444
- });
445
- });
446
-
447
- describe('logSearch()', function () {
448
- it('errors if param is not an object', function () {
449
- // @ts-ignore test
450
- expect(() => firebase.analytics().logSearch(123)).toThrowError(
451
- 'firebase.analytics().logSearch(*):',
452
- );
453
- });
454
- });
455
-
456
- describe('logSelectItem()', function () {
457
- it('errors if param is not an object', function () {
458
- // @ts-ignore test
459
- expect(() => firebase.analytics().logSelectItem(123)).toThrowError(
460
- 'firebase.analytics().logSelectItem(*):',
461
- );
462
- });
463
- });
464
-
465
- describe('logSetCheckoutOption()', function () {
466
- it('errors if param is not an object', function () {
467
- // @ts-ignore test
468
- expect(() => firebase.analytics().logSetCheckoutOption(123)).toThrowError(
469
- 'firebase.analytics().logSetCheckoutOption(*):',
470
- );
471
- });
472
- });
473
-
474
- describe('logShare()', function () {
475
- it('errors if param is not an object', function () {
476
- // @ts-ignore test
477
- expect(() => firebase.analytics().logShare(123)).toThrowError(
478
- 'firebase.analytics().logShare(*):',
479
- );
480
- });
481
- });
482
-
483
- describe('logSignUp()', function () {
484
- it('errors if param is not an object', function () {
485
- // @ts-ignore test
486
- expect(() => firebase.analytics().logSignUp(123)).toThrowError(
487
- 'firebase.analytics().logSignUp(*):',
488
- );
489
- });
490
- });
491
-
492
- describe('logSelectPromotion()', function () {
493
- it('errors if param is not an object', function () {
494
- // @ts-ignore test
495
- expect(() => firebase.analytics().logSelectPromotion(123)).toThrowError(
496
- 'firebase.analytics().logSelectPromotion(*):',
497
- );
498
- });
499
- });
500
-
501
- describe('logSpendVirtualCurrency()', function () {
502
- it('errors if param is not an object', function () {
503
- // @ts-ignore test
504
- expect(() => firebase.analytics().logSpendVirtualCurrency(123)).toThrowError(
505
- 'firebase.analytics().logSpendVirtualCurrency(*):',
506
- );
507
- });
508
- });
509
-
510
- describe('logUnlockAchievement()', function () {
511
- it('errors if param is not an object', function () {
512
- // @ts-ignore test
513
- expect(() => firebase.analytics().logUnlockAchievement(123)).toThrowError(
514
- 'firebase.analytics().logUnlockAchievement(*):',
515
- );
516
- });
517
- });
518
-
519
- describe('logPurchase()', function () {
520
- it('errors if param is not an object', function () {
521
- // @ts-ignore test
522
- expect(() => firebase.analytics().logPurchase(123)).toThrowError(
523
- 'firebase.analytics().logPurchase(*):',
524
- );
525
- });
526
-
527
- it('errors when compound values are not set', function () {
528
- expect(() =>
529
- firebase.analytics().logPurchase({
530
- value: 123,
531
- }),
532
- ).toThrowError('firebase.analytics().logPurchase(*):');
533
- });
534
-
535
- it('accepts arbitrary custom event parameters', function () {
536
- expect(() =>
537
- firebase.analytics().logPurchase({
538
- value: 123,
539
- currency: 'EUR',
540
- foo: 'bar',
541
- }),
542
- ).not.toThrow();
543
- });
544
- });
545
-
546
- describe('logRefund()', function () {
547
- it('errors if param is not an object', function () {
548
- // @ts-ignore test
549
- expect(() => firebase.analytics().logRefund(123)).toThrowError(
550
- 'firebase.analytics().logRefund(*):',
551
- );
552
- });
553
-
554
- it('errors when compound values are not set', function () {
555
- expect(() =>
556
- firebase.analytics().logRefund({
557
- value: 123,
558
- }),
559
- ).toThrowError('firebase.analytics().logRefund(*):');
560
- });
561
- });
562
-
563
- describe('logViewCart()', function () {
564
- it('errors if param is not an object', function () {
565
- // @ts-ignore test
566
- expect(() => firebase.analytics().logViewCart(123)).toThrowError(
567
- 'firebase.analytics().logViewCart(*):',
568
- );
569
- });
570
-
571
- it('errors when compound values are not set', function () {
572
- expect(() =>
573
- firebase.analytics().logViewCart({
574
- value: 123,
575
- }),
576
- ).toThrowError('firebase.analytics().logViewCart(*):');
577
- });
578
- });
579
-
580
- describe('logViewItem()', function () {
581
- it('errors if param is not an object', function () {
582
- // @ts-ignore test
583
- expect(() => firebase.analytics().logViewItem(123)).toThrowError(
584
- 'firebase.analytics().logViewItem(*):',
585
- );
586
- });
587
-
588
- it('errors when compound values are not set', function () {
589
- expect(() =>
590
- firebase.analytics().logViewItem({
591
- value: 123,
592
- }),
593
- ).toThrowError('firebase.analytics().logViewItem(*):');
594
- });
595
- });
596
-
597
- describe('logViewItemList()', function () {
598
- it('errors if param is not an object', function () {
599
- // @ts-ignore test
600
- expect(() => firebase.analytics().logViewItemList(123)).toThrowError(
601
- 'firebase.analytics().logViewItemList(*):',
602
- );
603
- });
604
- });
605
-
606
- describe('logRemoveFromCart()', function () {
607
- it('errors if param is not an object', function () {
608
- // @ts-ignore test
609
- expect(() => firebase.analytics().logRemoveFromCart(123)).toThrowError(
610
- 'firebase.analytics().logRemoveFromCart(*):',
611
- );
612
- });
613
-
614
- it('errors when compound values are not set', function () {
615
- expect(() =>
616
- firebase.analytics().logRemoveFromCart({
617
- value: 123,
618
- }),
619
- ).toThrowError('firebase.analytics().logRemoveFromCart(*):');
620
- });
621
- });
622
-
623
- describe('logViewPromotion()', function () {
624
- it('errors if param is not an object', function () {
625
- // @ts-ignore test
626
- expect(() => firebase.analytics().logViewPromotion(123)).toThrowError(
627
- 'firebase.analytics().logViewPromotion(*):',
628
- );
629
- });
630
- });
631
-
632
- describe('logViewSearchResults()', function () {
633
- it('errors if param is not an object', function () {
634
- // @ts-ignore test
635
- expect(() => firebase.analytics().logViewSearchResults(123)).toThrowError(
636
- 'firebase.analytics().logViewSearchResults(*):',
637
- );
638
- });
639
- });
640
-
641
- describe('setAnalyticsCollectionEnabled()', function () {
642
- it('throws if not a boolean', function () {
643
- // @ts-ignore
644
- expect(() => firebase.analytics().setAnalyticsCollectionEnabled('foo')).toThrowError(
645
- "firebase.analytics().setAnalyticsCollectionEnabled(*) 'enabled' expected a boolean value.",
646
- );
647
- });
648
- });
649
-
650
- describe('initiateOnDeviceConversionMeasurementWithEmailAddress()', function () {
651
- it('throws if not a string', function () {
652
- expect(() =>
653
- // @ts-ignore
654
- firebase.analytics().initiateOnDeviceConversionMeasurementWithEmailAddress(true),
655
- ).toThrowError(
656
- "firebase.analytics().initiateOnDeviceConversionMeasurementWithEmailAddress(*) 'emailAddress' expected a string value.",
657
- );
658
- });
659
- });
660
-
661
- describe('initiateOnDeviceConversionMeasurementWithHashedEmailAddress()', function () {
662
- it('throws if not a string', function () {
663
- expect(() =>
664
- // @ts-ignore
665
- firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(true),
666
- ).toThrowError(
667
- "firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(*) 'hashedEmailAddress' expected a string value.",
668
- );
669
- });
670
- });
671
-
672
- describe('initiateOnDeviceConversionMeasurementWithHashedPhoneNumber()', function () {
673
- it('throws if not a string', function () {
674
- expect(() =>
675
- // @ts-ignore
676
- firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(1234),
677
- ).toThrowError(
678
- "firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a string value.",
679
- );
680
- });
681
-
682
- it('throws if hashed value is a phone number in E.164 format', function () {
683
- expect(() =>
684
- firebase
685
- .analytics()
686
- .initiateOnDeviceConversionMeasurementWithHashedPhoneNumber('+1234567890'),
687
- ).toThrowError(
688
- "firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a sha256-hashed value of a phone number in E.164 format.",
689
- );
690
- });
691
- });
692
-
693
- describe('modular', function () {
694
- it('`getAnalytics` function is properly exposed to end user', function () {
695
- expect(getAnalytics).toBeDefined();
696
- });
697
-
698
- it('`initializeAnalytics` function is properly exposed to end user', function () {
699
- expect(initializeAnalytics).toBeDefined();
700
- });
701
-
702
- it('`logEvent` function is properly exposed to end user', function () {
703
- expect(logEvent).toBeDefined();
704
- });
705
-
706
- it('`setAnalyticsCollectionEnabled` function is properly exposed to end user', function () {
707
- expect(setAnalyticsCollectionEnabled).toBeDefined();
708
- });
709
-
710
- it('`setSessionTimeoutDuration` function is properly exposed to end user', function () {
711
- expect(setSessionTimeoutDuration).toBeDefined();
712
- });
713
-
714
- it('`getAppInstanceId` function is properly exposed to end user', function () {
715
- expect(getAppInstanceId).toBeDefined();
716
- });
717
-
718
- it('`getSessionId` function is properly exposed to end user', function () {
719
- expect(getSessionId).toBeDefined();
720
- });
721
-
722
- it('`setUserId` function is properly exposed to end user', function () {
723
- expect(setUserId).toBeDefined();
724
- });
725
-
726
- it('`setUserProperty` function is properly exposed to end user', function () {
727
- expect(setUserProperty).toBeDefined();
728
- });
729
-
730
- it('`setUserProperties` function is properly exposed to end user', function () {
731
- expect(setUserProperties).toBeDefined();
732
- });
733
-
734
- it('`resetAnalyticsData` function is properly exposed to end user', function () {
735
- expect(resetAnalyticsData).toBeDefined();
736
- });
737
-
738
- it('`logAddPaymentInfo` function is properly exposed to end user', function () {
739
- expect(logAddPaymentInfo).toBeDefined();
740
- });
741
-
742
- it('`logScreenView` function is properly exposed to end user', function () {
743
- expect(logScreenView).toBeDefined();
744
- });
745
-
746
- it('`logAddShippingInfo` function is properly exposed to end user', function () {
747
- expect(logAddShippingInfo).toBeDefined();
748
- });
749
-
750
- it('`logAddToCart` function is properly exposed to end user', function () {
751
- expect(logAddToCart).toBeDefined();
752
- });
753
-
754
- it('`logAddToWishlist` function is properly exposed to end user', function () {
755
- expect(logAddToWishlist).toBeDefined();
756
- });
757
-
758
- it('`logAppOpen` function is properly exposed to end user', function () {
759
- expect(logAppOpen).toBeDefined();
760
- });
761
-
762
- it('`logBeginCheckout` function is properly exposed to end user', function () {
763
- expect(logBeginCheckout).toBeDefined();
764
- });
765
-
766
- it('`logCampaignDetails` function is properly exposed to end user', function () {
767
- expect(logCampaignDetails).toBeDefined();
768
- });
769
-
770
- it('`logEarnVirtualCurrency` function is properly exposed to end user', function () {
771
- expect(logEarnVirtualCurrency).toBeDefined();
772
- });
773
-
774
- it('`logGenerateLead` function is properly exposed to end user', function () {
775
- expect(logGenerateLead).toBeDefined();
776
- });
777
-
778
- it('`logJoinGroup` function is properly exposed to end user', function () {
779
- expect(logJoinGroup).toBeDefined();
780
- });
781
-
782
- it('`logLevelEnd` function is properly exposed to end user', function () {
783
- expect(logLevelEnd).toBeDefined();
784
- });
785
-
786
- it('`logLevelStart` function is properly exposed to end user', function () {
787
- expect(logLevelStart).toBeDefined();
788
- });
789
-
790
- it('`logLevelUp` function is properly exposed to end user', function () {
791
- expect(logLevelUp).toBeDefined();
792
- });
793
-
794
- it('`logLogin` function is properly exposed to end user', function () {
795
- expect(logLogin).toBeDefined();
796
- });
797
-
798
- it('`logPostScore` function is properly exposed to end user', function () {
799
- expect(logPostScore).toBeDefined();
800
- });
801
-
802
- it('`logSelectContent` function is properly exposed to end user', function () {
803
- expect(logSelectContent).toBeDefined();
804
- });
805
-
806
- it('`logPurchase` function is properly exposed to end user', function () {
807
- expect(logPurchase).toBeDefined();
808
- });
809
-
810
- it('`logRefund` function is properly exposed to end user', function () {
811
- expect(logRefund).toBeDefined();
812
- });
813
-
814
- it('`logRemoveFromCart` function is properly exposed to end user', function () {
815
- expect(logRemoveFromCart).toBeDefined();
816
- });
817
-
818
- it('`logSearch` function is properly exposed to end user', function () {
819
- expect(logSearch).toBeDefined();
820
- });
821
-
822
- it('`logSelectItem` function is properly exposed to end user', function () {
823
- expect(logSelectItem).toBeDefined();
824
- });
825
-
826
- it('`logSetCheckoutOption` function is properly exposed to end user', function () {
827
- expect(logSetCheckoutOption).toBeDefined();
828
- });
829
-
830
- it('`logSelectPromotion` function is properly exposed to end user', function () {
831
- expect(logSelectPromotion).toBeDefined();
832
- });
833
-
834
- it('`logShare` function is properly exposed to end user', function () {
835
- expect(logShare).toBeDefined();
836
- });
837
-
838
- it('`logSignUp` function is properly exposed to end user', function () {
839
- expect(logSignUp).toBeDefined();
840
- });
841
-
842
- it('`logSpendVirtualCurrency` function is properly exposed to end user', function () {
843
- expect(logSpendVirtualCurrency).toBeDefined();
844
- });
845
-
846
- it('`logTutorialBegin` function is properly exposed to end user', function () {
847
- expect(logTutorialBegin).toBeDefined();
848
- });
849
-
850
- it('`logTutorialComplete` function is properly exposed to end user', function () {
851
- expect(logTutorialComplete).toBeDefined();
852
- });
853
-
854
- it('`logUnlockAchievement` function is properly exposed to end user', function () {
855
- expect(logUnlockAchievement).toBeDefined();
856
- });
857
-
858
- it('`logViewCart` function is properly exposed to end user', function () {
859
- expect(logViewCart).toBeDefined();
860
- });
861
-
862
- it('`logViewItem` function is properly exposed to end user', function () {
863
- expect(logViewItem).toBeDefined();
864
- });
865
-
866
- it('`logViewItemList` function is properly exposed to end user', function () {
867
- expect(logViewItemList).toBeDefined();
868
- });
869
-
870
- it('`logViewPromotion` function is properly exposed to end user', function () {
871
- expect(logViewPromotion).toBeDefined();
872
- });
873
-
874
- it('`logViewSearchResults` function is properly exposed to end user', function () {
875
- expect(logViewSearchResults).toBeDefined();
876
- });
877
-
878
- it('`setDefaultEventParameters` function is properly exposed to end user', function () {
879
- expect(setDefaultEventParameters).toBeDefined();
880
- });
881
-
882
- it('`initiateOnDeviceConversionMeasurementWithEmailAddress` function is properly exposed to end user', function () {
883
- expect(initiateOnDeviceConversionMeasurementWithEmailAddress).toBeDefined();
884
- });
885
-
886
- it('`initiateOnDeviceConversionMeasurementWithHashedEmailAddress` function is properly exposed to end user', function () {
887
- expect(initiateOnDeviceConversionMeasurementWithHashedEmailAddress).toBeDefined();
888
- });
889
-
890
- it('`initiateOnDeviceConversionMeasurementWithHashedEmailAddress` throws if not a string', function () {
891
- expect(() =>
892
- // @ts-ignore
893
- initiateOnDeviceConversionMeasurementWithHashedEmailAddress(getAnalytics(), true),
894
- ).toThrowError(
895
- "firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(*) 'hashedEmailAddress' expected a string value.",
896
- );
897
- });
898
-
899
- it('`initiateOnDeviceConversionMeasurementWithHashedPhoneNumber` should throw if the value is in E.164 format', function () {
900
- expect(() =>
901
- initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(getAnalytics(), '+1234567890'),
902
- ).toThrowError(
903
- "firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a sha256-hashed value of a phone number in E.164 format.",
904
- );
905
- });
906
-
907
- it('`initiateOnDeviceConversionMeasurementWithPhoneNumber` function is properly exposed to end user', function () {
908
- expect(initiateOnDeviceConversionMeasurementWithPhoneNumber).toBeDefined();
909
- });
910
-
911
- it('`initiateOnDeviceConversionMeasurementWithHashedPhoneNumber` function is properly exposed to end user', function () {
912
- expect(initiateOnDeviceConversionMeasurementWithHashedPhoneNumber).toBeDefined();
913
- });
914
-
915
- it('`isSupported` function is properly exposed to end user', function () {
916
- expect(isSupported).toBeDefined();
917
- });
918
-
919
- it('`setConsent` function is properly exposed to end user', function () {
920
- expect(setConsent).toBeDefined();
921
- });
922
-
923
- it('`settings` function is properly exposed to end user', function () {
924
- expect(settings).toBeDefined();
925
- });
926
- });
927
- });