apps-sdk 1.0.195 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.195",
3
+ "version": "1.0.196",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
- await this.mixpanel.track(eventName, properties);
39
- config.DEBUG_MODE && console.log(`MixPanel Event tracked: ${eventName} with properties:`, properties);
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
- await this.mixpanel.registerSuperProperties(properties);
65
- config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
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();
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 = {