apps-sdk 1.0.194 → 1.0.196
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/MixPanel.js +30 -8
- package/src/libraries/Networking.js +8 -1
- package/types/index.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Mixpanel } from "mixpanel-react-native";
|
|
2
2
|
import * as config from '../../config';
|
|
3
|
-
import {Session} from "./index";
|
|
4
|
-
import Constants from "expo-constants";
|
|
5
|
-
import * as Localization from "expo-localization";
|
|
6
3
|
import Networking from "./Networking";
|
|
7
|
-
import {Adjust, AdjustEvent} from "react-native-adjust";
|
|
8
4
|
|
|
9
5
|
class MixPanel {
|
|
10
6
|
constructor() {
|
|
@@ -35,8 +31,12 @@ class MixPanel {
|
|
|
35
31
|
|
|
36
32
|
try {
|
|
37
33
|
if (!this.devMode) {
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
if (config.TRACKING_ACTIVE) {
|
|
35
|
+
await this.mixpanel.track(eventName, properties);
|
|
36
|
+
config.DEBUG_MODE && console.log(`MixPanel Event tracked: ${eventName} with properties:`, properties);
|
|
37
|
+
} else {
|
|
38
|
+
config.DEBUG_MODE && console.log(`MixPanel Event not tracked due to tracking permission: ${eventName} with properties:`, properties);
|
|
39
|
+
}
|
|
40
40
|
} else {
|
|
41
41
|
config.DEBUG_MODE && console.log(`MixPanel Event tracked but not send (DEV_MODE ON): ${eventName} with properties:`, properties);
|
|
42
42
|
}
|
|
@@ -61,8 +61,12 @@ class MixPanel {
|
|
|
61
61
|
|
|
62
62
|
try {
|
|
63
63
|
if (!this.devMode) {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if (config.TRACKING_ACTIVE) {
|
|
65
|
+
await this.mixpanel.registerSuperProperties(properties);
|
|
66
|
+
config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
|
|
67
|
+
} else {
|
|
68
|
+
config.DEBUG_MODE && console.log('MixPanel Super Properties not registered due to tracking permission:', properties);
|
|
69
|
+
}
|
|
66
70
|
} else {
|
|
67
71
|
config.DEBUG_MODE && console.log('MixPanel Super Properties registered but not send (DEV_MODE ON):', properties);
|
|
68
72
|
}
|
|
@@ -128,6 +132,24 @@ class MixPanel {
|
|
|
128
132
|
isMixpanelInitialized() {
|
|
129
133
|
return this.mixpanel !== null;
|
|
130
134
|
}
|
|
135
|
+
|
|
136
|
+
disableTracking() {
|
|
137
|
+
if (this.mixpanel) {
|
|
138
|
+
this.mixpanel.optOutTracking();
|
|
139
|
+
config.DEBUG_MODE && console.log('MixPanel tracking disabled');
|
|
140
|
+
} else {
|
|
141
|
+
console.log('Mixpanel is not initialized');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
enableTracking() {
|
|
146
|
+
if (this.mixpanel) {
|
|
147
|
+
this.mixpanel.optInTracking();
|
|
148
|
+
config.DEBUG_MODE && console.log('MixPanel tracking enabled');
|
|
149
|
+
} else {
|
|
150
|
+
console.log('Mixpanel is not initialized');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
131
153
|
}
|
|
132
154
|
|
|
133
155
|
export default new MixPanel();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as config from '../../config';
|
|
2
2
|
import NetInfo from "@react-native-community/netinfo";
|
|
3
|
-
import { default as storage } from './Storage';
|
|
3
|
+
import Storage, { default as storage } from './Storage';
|
|
4
4
|
import Session from './Session';
|
|
5
5
|
import AdJust from './AdJust';
|
|
6
6
|
import MixPanel from "./MixPanel";
|
|
@@ -154,7 +154,14 @@ class Networking {
|
|
|
154
154
|
let subStatus = await this.request(config.ENDPOINTS.SUB_STATUS, {...Session.sessionData, subs_id: subsID});
|
|
155
155
|
console.log('checkSubscription', subStatus);
|
|
156
156
|
if (subStatus && subStatus.success === 1) {
|
|
157
|
+
const currentSubscriptionStatus = await storage.getData('isSubscribed');
|
|
157
158
|
await Session.setIsSubscribed(subStatus.data.subscription_active);
|
|
159
|
+
if (currentSubscriptionStatus === false && !subStatus.data.subscription_active === true) {
|
|
160
|
+
await MixPanel.superProperties({
|
|
161
|
+
"subscription_status": "free",
|
|
162
|
+
"plan_type": "free",
|
|
163
|
+
});
|
|
164
|
+
}
|
|
158
165
|
await Session.setSubscriptionData(subStatus.data);
|
|
159
166
|
return true;
|
|
160
167
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -188,6 +188,8 @@ declare module 'apps-sdk' {
|
|
|
188
188
|
superPropertiesAppend(properties: object): Promise<void>;
|
|
189
189
|
identifyUser(userID: string): Promise<void>;
|
|
190
190
|
setUserProperty(property: string, value: any): Promise<void>;
|
|
191
|
+
disableTracking(): Promise<void>;
|
|
192
|
+
enableTracking(): Promise<void>;
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
type PaywallEventHandlers = {
|