This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.js
105 lines (74 loc) · 2.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { NativeModules } from 'react-native';
import { PropTypes } from 'prop-types';
const { RNAdobeAnalytics } = NativeModules;
// ------------------------------------
// API
// ------------------------------------
export class AdobeAnalyticsAPI {
static init(debug = false) {
RNAdobeAnalytics.init({ debug });
}
static trackState(state, contextData = {}) {
RNAdobeAnalytics.trackState(state, contextData);
}
static trackAction(action, contextData = {}) {
RNAdobeAnalytics.trackAction(action, contextData);
}
static trackVideo(action, settings = {}) {
RNAdobeAnalytics.trackVideo(action, settings);
}
static trackTimedActionStart(action, contextData = {}) {
RNAdobeAnalytics.trackTimedActionStart(action, contextData);
}
static trackTimedActionUpdate(action, contextData = {}) {
RNAdobeAnalytics.trackTimedActionUpdate(action, contextData);
}
//Open question
static trackTimedActionEnd(action) {
RNAdobeAnalytics.trackTimedActionEnd(action);
}
}
new AdobeAnalyticsAPI();
// ------------------------------------
// Init component
// ------------------------------------
export const AdobeAnalytics = ({ debug }) => {
AdobeAnalyticsAPI.init(debug);
return null;
};
AdobeAnalytics.propTypes = {
debug: PropTypes.bool
};
// ------------------------------------
// TrackState component
// ------------------------------------
export const AdobeAnalyticsTrackState = ({ state, contextData }) => {
AdobeAnalyticsAPI.trackState(state, contextData);
return null;
};
AdobeAnalyticsTrackState.propTypes = {
state: PropTypes.string.isRequired,
contextData: PropTypes.object
};
// ------------------------------------
// TrackAction component
// ------------------------------------
export const AdobeAnalyticsTrackAction = ({ action, contextData }) => {
AdobeAnalyticsAPI.trackAction(action, contextData);
return null;
};
AdobeAnalyticsTrackAction.propTypes = {
action: PropTypes.string.isRequired,
contextData: PropTypes.object
};
// ------------------------------------
// AdobeAnalytics component
// ------------------------------------
export const AdobeAnalyticsTrackVideo = ({ action, settings }) => {
AdobeAnalyticsAPI.trackVideo(action, settings);
return null;
};
AdobeAnalyticsTrackVideo.propTypes = {
action: PropTypes.string.isRequired,
settings: PropTypes.object
};