@react-native-firebase/analytics 20.3.0 → 20.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/__tests__/analytics.test.ts +265 -1
- package/lib/index.d.ts +33 -1
- package/lib/index.js +2 -52
- package/lib/modular/index.d.ts +10 -0
- package/lib/modular/index.js +271 -376
- package/lib/version.js +1 -1
- package/package.json +3 -3
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
|
+
## [20.4.0](https://github.com/invertase/react-native-firebase/compare/v20.3.0...v20.4.0) (2024-08-13)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **analytics:** update the typing for Item ([#7919](https://github.com/invertase/react-native-firebase/issues/7919)) ([c2c4576](https://github.com/invertase/react-native-firebase/commit/c2c457608c865f6d25e4b9b6689cbc00721de194))
|
11
|
+
|
6
12
|
## [20.3.0](https://github.com/invertase/react-native-firebase/compare/v20.2.1...v20.3.0) (2024-07-19)
|
7
13
|
|
8
14
|
### Bug Fixes
|
@@ -1,6 +1,60 @@
|
|
1
1
|
import { describe, expect, it, xit } from '@jest/globals';
|
2
2
|
|
3
|
-
import {
|
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
|
+
initiateOnDeviceConversionMeasurementWithPhoneNumber,
|
54
|
+
isSupported,
|
55
|
+
setConsent,
|
56
|
+
settings,
|
57
|
+
} from '../lib';
|
4
58
|
|
5
59
|
describe('Analytics', function () {
|
6
60
|
describe('namespace', function () {
|
@@ -595,4 +649,214 @@ describe('Analytics', function () {
|
|
595
649
|
);
|
596
650
|
});
|
597
651
|
});
|
652
|
+
|
653
|
+
describe('modular', function () {
|
654
|
+
it('`getAnalytics` function is properly exposed to end user', function () {
|
655
|
+
expect(getAnalytics).toBeDefined();
|
656
|
+
});
|
657
|
+
|
658
|
+
it('`initializeAnalytics` function is properly exposed to end user', function () {
|
659
|
+
expect(initializeAnalytics).toBeDefined();
|
660
|
+
});
|
661
|
+
|
662
|
+
it('`logEvent` function is properly exposed to end user', function () {
|
663
|
+
expect(logEvent).toBeDefined();
|
664
|
+
});
|
665
|
+
|
666
|
+
it('`setAnalyticsCollectionEnabled` function is properly exposed to end user', function () {
|
667
|
+
expect(setAnalyticsCollectionEnabled).toBeDefined();
|
668
|
+
});
|
669
|
+
|
670
|
+
it('`setSessionTimeoutDuration` function is properly exposed to end user', function () {
|
671
|
+
expect(setSessionTimeoutDuration).toBeDefined();
|
672
|
+
});
|
673
|
+
|
674
|
+
it('`getAppInstanceId` function is properly exposed to end user', function () {
|
675
|
+
expect(getAppInstanceId).toBeDefined();
|
676
|
+
});
|
677
|
+
|
678
|
+
it('`getSessionId` function is properly exposed to end user', function () {
|
679
|
+
expect(getSessionId).toBeDefined();
|
680
|
+
});
|
681
|
+
|
682
|
+
it('`setUserId` function is properly exposed to end user', function () {
|
683
|
+
expect(setUserId).toBeDefined();
|
684
|
+
});
|
685
|
+
|
686
|
+
it('`setUserProperty` function is properly exposed to end user', function () {
|
687
|
+
expect(setUserProperty).toBeDefined();
|
688
|
+
});
|
689
|
+
|
690
|
+
it('`setUserProperties` function is properly exposed to end user', function () {
|
691
|
+
expect(setUserProperties).toBeDefined();
|
692
|
+
});
|
693
|
+
|
694
|
+
it('`resetAnalyticsData` function is properly exposed to end user', function () {
|
695
|
+
expect(resetAnalyticsData).toBeDefined();
|
696
|
+
});
|
697
|
+
|
698
|
+
it('`logAddPaymentInfo` function is properly exposed to end user', function () {
|
699
|
+
expect(logAddPaymentInfo).toBeDefined();
|
700
|
+
});
|
701
|
+
|
702
|
+
it('`logScreenView` function is properly exposed to end user', function () {
|
703
|
+
expect(logScreenView).toBeDefined();
|
704
|
+
});
|
705
|
+
|
706
|
+
it('`logAddShippingInfo` function is properly exposed to end user', function () {
|
707
|
+
expect(logAddShippingInfo).toBeDefined();
|
708
|
+
});
|
709
|
+
|
710
|
+
it('`logAddToCart` function is properly exposed to end user', function () {
|
711
|
+
expect(logAddToCart).toBeDefined();
|
712
|
+
});
|
713
|
+
|
714
|
+
it('`logAddToWishlist` function is properly exposed to end user', function () {
|
715
|
+
expect(logAddToWishlist).toBeDefined();
|
716
|
+
});
|
717
|
+
|
718
|
+
it('`logAppOpen` function is properly exposed to end user', function () {
|
719
|
+
expect(logAppOpen).toBeDefined();
|
720
|
+
});
|
721
|
+
|
722
|
+
it('`logBeginCheckout` function is properly exposed to end user', function () {
|
723
|
+
expect(logBeginCheckout).toBeDefined();
|
724
|
+
});
|
725
|
+
|
726
|
+
it('`logCampaignDetails` function is properly exposed to end user', function () {
|
727
|
+
expect(logCampaignDetails).toBeDefined();
|
728
|
+
});
|
729
|
+
|
730
|
+
it('`logEarnVirtualCurrency` function is properly exposed to end user', function () {
|
731
|
+
expect(logEarnVirtualCurrency).toBeDefined();
|
732
|
+
});
|
733
|
+
|
734
|
+
it('`logGenerateLead` function is properly exposed to end user', function () {
|
735
|
+
expect(logGenerateLead).toBeDefined();
|
736
|
+
});
|
737
|
+
|
738
|
+
it('`logJoinGroup` function is properly exposed to end user', function () {
|
739
|
+
expect(logJoinGroup).toBeDefined();
|
740
|
+
});
|
741
|
+
|
742
|
+
it('`logLevelEnd` function is properly exposed to end user', function () {
|
743
|
+
expect(logLevelEnd).toBeDefined();
|
744
|
+
});
|
745
|
+
|
746
|
+
it('`logLevelStart` function is properly exposed to end user', function () {
|
747
|
+
expect(logLevelStart).toBeDefined();
|
748
|
+
});
|
749
|
+
|
750
|
+
it('`logLevelUp` function is properly exposed to end user', function () {
|
751
|
+
expect(logLevelUp).toBeDefined();
|
752
|
+
});
|
753
|
+
|
754
|
+
it('`logLogin` function is properly exposed to end user', function () {
|
755
|
+
expect(logLogin).toBeDefined();
|
756
|
+
});
|
757
|
+
|
758
|
+
it('`logPostScore` function is properly exposed to end user', function () {
|
759
|
+
expect(logPostScore).toBeDefined();
|
760
|
+
});
|
761
|
+
|
762
|
+
it('`logSelectContent` function is properly exposed to end user', function () {
|
763
|
+
expect(logSelectContent).toBeDefined();
|
764
|
+
});
|
765
|
+
|
766
|
+
it('`logPurchase` function is properly exposed to end user', function () {
|
767
|
+
expect(logPurchase).toBeDefined();
|
768
|
+
});
|
769
|
+
|
770
|
+
it('`logRefund` function is properly exposed to end user', function () {
|
771
|
+
expect(logRefund).toBeDefined();
|
772
|
+
});
|
773
|
+
|
774
|
+
it('`logRemoveFromCart` function is properly exposed to end user', function () {
|
775
|
+
expect(logRemoveFromCart).toBeDefined();
|
776
|
+
});
|
777
|
+
|
778
|
+
it('`logSearch` function is properly exposed to end user', function () {
|
779
|
+
expect(logSearch).toBeDefined();
|
780
|
+
});
|
781
|
+
|
782
|
+
it('`logSelectItem` function is properly exposed to end user', function () {
|
783
|
+
expect(logSelectItem).toBeDefined();
|
784
|
+
});
|
785
|
+
|
786
|
+
it('`logSetCheckoutOption` function is properly exposed to end user', function () {
|
787
|
+
expect(logSetCheckoutOption).toBeDefined();
|
788
|
+
});
|
789
|
+
|
790
|
+
it('`logSelectPromotion` function is properly exposed to end user', function () {
|
791
|
+
expect(logSelectPromotion).toBeDefined();
|
792
|
+
});
|
793
|
+
|
794
|
+
it('`logShare` function is properly exposed to end user', function () {
|
795
|
+
expect(logShare).toBeDefined();
|
796
|
+
});
|
797
|
+
|
798
|
+
it('`logSignUp` function is properly exposed to end user', function () {
|
799
|
+
expect(logSignUp).toBeDefined();
|
800
|
+
});
|
801
|
+
|
802
|
+
it('`logSpendVirtualCurrency` function is properly exposed to end user', function () {
|
803
|
+
expect(logSpendVirtualCurrency).toBeDefined();
|
804
|
+
});
|
805
|
+
|
806
|
+
it('`logTutorialBegin` function is properly exposed to end user', function () {
|
807
|
+
expect(logTutorialBegin).toBeDefined();
|
808
|
+
});
|
809
|
+
|
810
|
+
it('`logTutorialComplete` function is properly exposed to end user', function () {
|
811
|
+
expect(logTutorialComplete).toBeDefined();
|
812
|
+
});
|
813
|
+
|
814
|
+
it('`logUnlockAchievement` function is properly exposed to end user', function () {
|
815
|
+
expect(logUnlockAchievement).toBeDefined();
|
816
|
+
});
|
817
|
+
|
818
|
+
it('`logViewCart` function is properly exposed to end user', function () {
|
819
|
+
expect(logViewCart).toBeDefined();
|
820
|
+
});
|
821
|
+
|
822
|
+
it('`logViewItem` function is properly exposed to end user', function () {
|
823
|
+
expect(logViewItem).toBeDefined();
|
824
|
+
});
|
825
|
+
|
826
|
+
it('`logViewItemList` function is properly exposed to end user', function () {
|
827
|
+
expect(logViewItemList).toBeDefined();
|
828
|
+
});
|
829
|
+
|
830
|
+
it('`logViewPromotion` function is properly exposed to end user', function () {
|
831
|
+
expect(logViewPromotion).toBeDefined();
|
832
|
+
});
|
833
|
+
|
834
|
+
it('`logViewSearchResults` function is properly exposed to end user', function () {
|
835
|
+
expect(logViewSearchResults).toBeDefined();
|
836
|
+
});
|
837
|
+
|
838
|
+
it('`setDefaultEventParameters` function is properly exposed to end user', function () {
|
839
|
+
expect(setDefaultEventParameters).toBeDefined();
|
840
|
+
});
|
841
|
+
|
842
|
+
it('`initiateOnDeviceConversionMeasurementWithEmailAddress` function is properly exposed to end user', function () {
|
843
|
+
expect(initiateOnDeviceConversionMeasurementWithEmailAddress).toBeDefined();
|
844
|
+
});
|
845
|
+
|
846
|
+
it('`initiateOnDeviceConversionMeasurementWithPhoneNumber` function is properly exposed to end user', function () {
|
847
|
+
expect(initiateOnDeviceConversionMeasurementWithPhoneNumber).toBeDefined();
|
848
|
+
});
|
849
|
+
|
850
|
+
it('`isSupported` function is properly exposed to end user', function () {
|
851
|
+
expect(isSupported).toBeDefined();
|
852
|
+
});
|
853
|
+
|
854
|
+
it('`setConsent` function is properly exposed to end user', function () {
|
855
|
+
expect(setConsent).toBeDefined();
|
856
|
+
});
|
857
|
+
|
858
|
+
it('`settings` function is properly exposed to end user', function () {
|
859
|
+
expect(settings).toBeDefined();
|
860
|
+
});
|
861
|
+
});
|
598
862
|
});
|
package/lib/index.d.ts
CHANGED
@@ -94,7 +94,7 @@ export namespace FirebaseAnalyticsTypes {
|
|
94
94
|
/**
|
95
95
|
* The Google [Place ID](https://developers.google.com/places/place-id) that corresponds to the associated item (String). Alternatively, you can supply your own custom Location ID.
|
96
96
|
*/
|
97
|
-
|
97
|
+
location_id?: string;
|
98
98
|
/**
|
99
99
|
* The Item variant.
|
100
100
|
*/
|
@@ -109,6 +109,38 @@ export namespace FirebaseAnalyticsTypes {
|
|
109
109
|
* See https://github.com/invertase/react-native-firebase/issues/4578#issuecomment-771703420 for more information
|
110
110
|
*/
|
111
111
|
price?: number;
|
112
|
+
/**
|
113
|
+
* The affiliation of the item.
|
114
|
+
*/
|
115
|
+
affiliation?: string;
|
116
|
+
/**
|
117
|
+
* The coupon associated with the item.
|
118
|
+
*/
|
119
|
+
coupon?: string;
|
120
|
+
/**
|
121
|
+
* The creative name associated with the item.
|
122
|
+
*/
|
123
|
+
creative_name?: string;
|
124
|
+
/**
|
125
|
+
* The creative slot associated with the item.
|
126
|
+
*/
|
127
|
+
creative_slot?: string;
|
128
|
+
/**
|
129
|
+
* The discount applied to the item.
|
130
|
+
*/
|
131
|
+
discount?: Currency;
|
132
|
+
/**
|
133
|
+
* The index of the item.
|
134
|
+
*/
|
135
|
+
index?: number;
|
136
|
+
/**
|
137
|
+
* The promotion ID associated with the item.
|
138
|
+
*/
|
139
|
+
promotion_id?: string;
|
140
|
+
/**
|
141
|
+
* The promotion name associated with the item.
|
142
|
+
*/
|
143
|
+
promotion_name?: string;
|
112
144
|
}
|
113
145
|
|
114
146
|
export interface AddPaymentInfoEventParameters {
|
package/lib/index.js
CHANGED
@@ -40,58 +40,6 @@ import fallBackModule from './web/RNFBAnalyticsModule';
|
|
40
40
|
import version from './version';
|
41
41
|
import * as structs from './structs';
|
42
42
|
|
43
|
-
export {
|
44
|
-
getAnalytics,
|
45
|
-
logEvent,
|
46
|
-
setAnalyticsCollectionEnabled,
|
47
|
-
setSessionTimeoutDuration,
|
48
|
-
getAppInstanceId,
|
49
|
-
getSessionId,
|
50
|
-
setUserId,
|
51
|
-
setUserProperty,
|
52
|
-
setUserProperties,
|
53
|
-
resetAnalyticsData,
|
54
|
-
logAddPaymentInfo,
|
55
|
-
logScreenView,
|
56
|
-
logAddShippingInfo,
|
57
|
-
logAddToCart,
|
58
|
-
logAddToWishlist,
|
59
|
-
logAppOpen,
|
60
|
-
logBeginCheckout,
|
61
|
-
logCampaignDetails,
|
62
|
-
logEarnVirtualCurrency,
|
63
|
-
logGenerateLead,
|
64
|
-
logJoinGroup,
|
65
|
-
logLevelEnd,
|
66
|
-
logLevelStart,
|
67
|
-
logLevelUp,
|
68
|
-
logLogin,
|
69
|
-
logPostScore,
|
70
|
-
logSelectContent,
|
71
|
-
logPurchase,
|
72
|
-
logRefund,
|
73
|
-
logRemoveFromCart,
|
74
|
-
logSearch,
|
75
|
-
logSelectItem,
|
76
|
-
logSetCheckoutOption,
|
77
|
-
logSelectPromotion,
|
78
|
-
logShare,
|
79
|
-
logSignUp,
|
80
|
-
logSpendVirtualCurrency,
|
81
|
-
logTutorialBegin,
|
82
|
-
logTutorialComplete,
|
83
|
-
logUnlockAchievement,
|
84
|
-
logViewCart,
|
85
|
-
logViewItem,
|
86
|
-
logViewItemList,
|
87
|
-
logViewPromotion,
|
88
|
-
logViewSearchResults,
|
89
|
-
setDefaultEventParameters,
|
90
|
-
initiateOnDeviceConversionMeasurementWithEmailAddress,
|
91
|
-
initiateOnDeviceConversionMeasurementWithPhoneNumber,
|
92
|
-
setConsent,
|
93
|
-
} from './modular/index';
|
94
|
-
|
95
43
|
const ReservedEventNames = [
|
96
44
|
'ad_activeview',
|
97
45
|
'ad_click',
|
@@ -826,6 +774,8 @@ export default createModuleNamespace({
|
|
826
774
|
ModuleClass: FirebaseAnalyticsModule,
|
827
775
|
});
|
828
776
|
|
777
|
+
export * from './modular/index';
|
778
|
+
|
829
779
|
// import analytics, { firebase } from '@react-native-firebase/analytics';
|
830
780
|
// analytics().logEvent(...);
|
831
781
|
// firebase.analytics().logEvent(...);
|
package/lib/modular/index.d.ts
CHANGED
@@ -1210,3 +1210,13 @@ export function setConsent(
|
|
1210
1210
|
* @returns {void}
|
1211
1211
|
*/
|
1212
1212
|
export function settings(options: FirebaseAnalyticsTypes.SettingsOptions): void;
|
1213
|
+
|
1214
|
+
/**
|
1215
|
+
* Retrieves the session id from the client.
|
1216
|
+
* On iOS, Firebase SDK may return an error that is handled internally and may take many minutes to return a valid value. Check native debug logs for more details.
|
1217
|
+
*
|
1218
|
+
* Returns the session id or null if session is expired, null on android if FirebaseAnalytics.ConsentType.ANALYTICS_STORAGE has been set to FirebaseAnalytics.ConsentStatus.DENIED and null on iOS if ConsentType.analyticsStorage has been set to ConsentStatus.denied.
|
1219
|
+
* @param {Analytics} instance.
|
1220
|
+
* @returns {Promise<number | null>}
|
1221
|
+
*/
|
1222
|
+
export function getSessionId(analytics: Analytics): Promise<number | null>;
|