apps-sdk 1.0.188 → 1.0.190
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/package.json +1 -1
- package/src/libraries/AdJust.js +8 -8
- package/src/libraries/MixPanel.js +54 -21
- package/types/index.d.ts +5 -2
- package/src/components/Navigator.js +0 -39
package/package.json
CHANGED
package/src/libraries/AdJust.js
CHANGED
|
@@ -111,14 +111,14 @@ class AdJust {
|
|
|
111
111
|
Adjust.getAttribution((attribution) => {
|
|
112
112
|
if (attribution) {
|
|
113
113
|
Session.setAdjustAttribution(attribution);
|
|
114
|
-
if (MixPanel.isMixpanelInitialized()) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
114
|
+
// if (MixPanel.isMixpanelInitialized()) {
|
|
115
|
+
// for (let key in attribution) {
|
|
116
|
+
// if (attribution.hasOwnProperty(key) && attribution[key] !== "") {
|
|
117
|
+
// config.DEBUG_MODE && console.log('MixPanel Setting key: ' + key + ' with value: ' + attribution[key]);
|
|
118
|
+
// MixPanel.mixpanel.getPeople().set(key, attribution[key]);
|
|
119
|
+
// }
|
|
120
|
+
// }
|
|
121
|
+
// }
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
}
|
|
@@ -25,50 +25,83 @@ class MixPanel {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async
|
|
28
|
+
async trackEvent(eventName, properties = {}) {
|
|
29
29
|
if (!this.mixpanel) {
|
|
30
30
|
console.log('Mixpanel is not initialized');
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
try {
|
|
35
|
-
await this.mixpanel.
|
|
36
|
-
|
|
37
|
-
this.mixpanel.getPeople().set('subscribed_user', Session.getIsSubscribed());
|
|
38
|
-
this.mixpanel.getPeople().set('app_version', Constants.expoConfig.version);
|
|
39
|
-
this.mixpanel.getPeople().set('language', Localization.getLocales()[0].languageCode || 'en');
|
|
40
|
-
config.DEBUG_MODE && console.log(`MixPanel User identified: ${userId} with data:`, {
|
|
41
|
-
subscribed_user: Session.getIsSubscribed(),
|
|
42
|
-
app_version: Constants.expoConfig.version,
|
|
43
|
-
language: Localization.getLocales()[0].languageCode || 'en'
|
|
44
|
-
});
|
|
35
|
+
await this.mixpanel.track(eventName, properties);
|
|
36
|
+
config.DEBUG_MODE && console.log(`MixPanel Event tracked: ${eventName} with properties:`, properties);
|
|
45
37
|
} catch (error) {
|
|
46
|
-
console.error('Error
|
|
38
|
+
console.error('Error tracking event:', error);
|
|
47
39
|
}
|
|
48
40
|
}
|
|
49
41
|
|
|
50
|
-
async
|
|
42
|
+
async trackEventIfExist(eventKeyword, eventData = {}) {
|
|
43
|
+
if (config.EVENTS_MIXPANEL[eventKeyword]) {
|
|
44
|
+
this.trackEvent(eventKeyword, eventData);
|
|
45
|
+
} else {
|
|
46
|
+
console.log("Event not found in MixPanel, not sent: " + eventKeyword);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async superProperties(properties) {
|
|
51
51
|
if (!this.mixpanel) {
|
|
52
52
|
console.log('Mixpanel is not initialized');
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
try {
|
|
57
|
-
await this.mixpanel.
|
|
58
|
-
config.DEBUG_MODE && console.log(
|
|
57
|
+
await this.mixpanel.registerSuperProperties(properties);
|
|
58
|
+
config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
|
|
59
59
|
} catch (error) {
|
|
60
|
-
console.error('Error
|
|
60
|
+
console.error('Error registering super properties:', error);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
async
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
async superPropertiesAppend(properties) {
|
|
65
|
+
if (!this.mixpanel) {
|
|
66
|
+
console.log('Mixpanel is not initialized');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
await this.mixpanel.registerSuperPropertiesOnce(properties);
|
|
72
|
+
config.DEBUG_MODE && console.log('MixPanel Super Properties appended:', properties);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error('Error appending super properties:', error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async identifyUser(userID) {
|
|
79
|
+
if (!this.mixpanel) {
|
|
80
|
+
console.log('Mixpanel is not initialized');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
await this.mixpanel.identify(userID);
|
|
86
|
+
config.DEBUG_MODE && console.log('MixPanel User identified:', userID);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('Error identifying user:', error);
|
|
69
89
|
}
|
|
70
90
|
}
|
|
71
91
|
|
|
92
|
+
async setUserProperty(propertyName, propertyValue) {
|
|
93
|
+
if (!this.mixpanel) {
|
|
94
|
+
console.log('Mixpanel is not initialized');
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
await this.mixpanel.getPeople().set(propertyName, propertyValue);
|
|
100
|
+
config.DEBUG_MODE && console.log(`MixPanel User property set: ${propertyName} = ${propertyValue}`);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('Error setting user property:', error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
72
105
|
|
|
73
106
|
isMixpanelInitialized() {
|
|
74
107
|
return this.mixpanel !== null;
|
package/types/index.d.ts
CHANGED
|
@@ -181,10 +181,13 @@ declare module 'apps-sdk' {
|
|
|
181
181
|
|
|
182
182
|
export class MixPanel {
|
|
183
183
|
initialize(token?: string, trackAutomaticEvents?: boolean, useNative?: boolean): Promise<void>;
|
|
184
|
-
identifyUser(userID: string): Promise<void>;
|
|
185
184
|
trackEvent(event: string, properties?: object): Promise<void>;
|
|
186
|
-
isMixpanelInitialized(): boolean;
|
|
187
185
|
trackEventIfExist(eventKeyword: string, eventData?: object): Promise<void>;
|
|
186
|
+
isMixpanelInitialized(): boolean;
|
|
187
|
+
superProperties(properties: object): Promise<void>;
|
|
188
|
+
superPropertiesAppend(properties: object): Promise<void>;
|
|
189
|
+
identifyUser(userID: string): Promise<void>;
|
|
190
|
+
setUserProperty(property: string, value: any): Promise<void>;
|
|
188
191
|
}
|
|
189
192
|
|
|
190
193
|
type PaywallEventHandlers = {
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal, View, Button } from 'react-native';
|
|
3
|
-
import { WebView } from 'react-native-webview';
|
|
4
|
-
|
|
5
|
-
class Navigator extends React.Component {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
this.state = {
|
|
9
|
-
isVisible: props.isVisible,
|
|
10
|
-
url: props.url,
|
|
11
|
-
title: props.title,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
componentDidUpdate(prevProps) {
|
|
16
|
-
if (prevProps.isVisible !== this.props.isVisible) {
|
|
17
|
-
this.setState({ isVisible: this.props.isVisible });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
return (
|
|
23
|
-
<Modal
|
|
24
|
-
animationType="slide"
|
|
25
|
-
transparent={true}
|
|
26
|
-
visible={this.state.isVisible}
|
|
27
|
-
onRequestClose={this.props.onRequestClose}
|
|
28
|
-
>
|
|
29
|
-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
30
|
-
<WebView
|
|
31
|
-
source={{ uri: this.state.url }}
|
|
32
|
-
style={{ width: '100%', height: '100%' }}
|
|
33
|
-
/>
|
|
34
|
-
<Button title="Close" onPress={this.props.onRequestClose} />
|
|
35
|
-
</View>
|
|
36
|
-
</Modal>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
}
|