apps-sdk 1.0.191 → 1.0.193

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.191",
3
+ "version": "1.0.193",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,6 +5,7 @@ import { View, Platform } from "react-native";
5
5
  import Utils from "../libraries/Utils";
6
6
  import Networking from "../libraries/Networking";
7
7
  import Storage from "../libraries/Storage";
8
+ import MixPanel from "../libraries/MixPanel";
8
9
  import PayWallLogic from "../libraries/PayWallLogic";
9
10
  import Session from "../libraries/Session";
10
11
  import * as Linking from 'expo-linking';
@@ -154,6 +155,7 @@ class PayWall extends React.Component {
154
155
  // --------------------------------------- Eventos ---------------------------------------
155
156
  eventClickClose = (data) => {
156
157
  Networking.sendEvent('action', 'continue_free');
158
+ MixPanel.trackEvent('Paywall Closed');
157
159
  this.props.onClose();
158
160
  }
159
161
 
@@ -167,6 +169,9 @@ class PayWall extends React.Component {
167
169
  data.id = data.aid;
168
170
  }
169
171
  }
172
+ MixPanel.trackEvent('Paywall Plan Selected' ,{
173
+ 'plan_type': data.id,
174
+ });
170
175
 
171
176
  if (this.paywallData && data.id && data.id.length > 0) {
172
177
  Networking.sendEvent('action', 'cta', {product_id: data.id});
@@ -215,7 +220,14 @@ class PayWall extends React.Component {
215
220
  config.DEBUG_MODE && console.debug('eventTrackScene', data);
216
221
  switch(true) {
217
222
  case data.eventName === 'on_boarding' && data.eventValue.toString().substring(0, 4) === 'step':
218
- Networking.sendEvent('action', 'onb_tap_continue_' + data.eventValue, {step: data.eventValue});
223
+ const stepNumber = data.eventValue.toString().substring(4);
224
+ MixPanel.trackEvent('Onboarding Screen Viewed', {
225
+ 'onboarding_id': config.PAYWALL_DATA.others.on_boarding.dsn_id,
226
+ 'onboarding_total_steps': 4,
227
+ 'onboarding_step': stepNumber,
228
+ 'onboarding_step_keyword': data.eventName + '_' + data.eventValue,
229
+ });
230
+ Networking.sendEvent('action', 'onb_tap_continue_' + data.eventValue, {step: data.eventValue, onboarding_id: config.PAYWALL_DATA.others.on_boarding.dsn_id});
219
231
  break;
220
232
  default:
221
233
  Networking.sendEvent('scene', data.eventName, data || {});
@@ -9,9 +9,11 @@ import {Adjust, AdjustEvent} from "react-native-adjust";
9
9
  class MixPanel {
10
10
  constructor() {
11
11
  this.mixpanel = null;
12
+ this.devMode = false;
12
13
  }
13
14
 
14
- async initialize(token = null, trackAutomaticEvents = false, useNative = false) {
15
+ async initialize(token = null, trackAutomaticEvents = false, useNative = false, devMode = false) {
16
+ this.devMode = devMode;
15
17
  const finalToken = token || config.MIXPANEL.TOKEN;
16
18
  console.log('Initializing MixPanel with token: ' + finalToken);
17
19
  try {
@@ -32,8 +34,12 @@ class MixPanel {
32
34
  }
33
35
 
34
36
  try {
35
- await this.mixpanel.track(eventName, properties);
36
- config.DEBUG_MODE && console.log(`MixPanel Event tracked: ${eventName} with properties:`, properties);
37
+ if (!this.devMode) {
38
+ await this.mixpanel.track(eventName, properties);
39
+ config.DEBUG_MODE && console.log(`MixPanel Event tracked: ${eventName} with properties:`, properties);
40
+ } else {
41
+ config.DEBUG_MODE && console.log(`MixPanel Event tracked but not send (DEV_MODE ON): ${eventName} with properties:`, properties);
42
+ }
37
43
  } catch (error) {
38
44
  console.error('Error tracking event:', error);
39
45
  }
@@ -54,8 +60,12 @@ class MixPanel {
54
60
  }
55
61
 
56
62
  try {
57
- await this.mixpanel.registerSuperProperties(properties);
58
- config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
63
+ if (!this.devMode) {
64
+ await this.mixpanel.registerSuperProperties(properties);
65
+ config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
66
+ } else {
67
+ config.DEBUG_MODE && console.log('MixPanel Super Properties registered but not send (DEV_MODE ON):', properties);
68
+ }
59
69
  } catch (error) {
60
70
  console.error('Error registering super properties:', error);
61
71
  }
@@ -68,8 +78,12 @@ class MixPanel {
68
78
  }
69
79
 
70
80
  try {
71
- await this.mixpanel.registerSuperPropertiesOnce(properties);
72
- config.DEBUG_MODE && console.log('MixPanel Super Properties appended:', properties);
81
+ if (!this.devMode) {
82
+ await this.mixpanel.registerSuperPropertiesOnce(properties);
83
+ config.DEBUG_MODE && console.log('MixPanel Super Properties appended:', properties);
84
+ } else {
85
+ config.DEBUG_MODE && console.log('MixPanel Super Properties appended but not send (DEV_MODE ON):', properties);
86
+ }
73
87
  } catch (error) {
74
88
  console.error('Error appending super properties:', error);
75
89
  }
@@ -82,8 +96,12 @@ class MixPanel {
82
96
  }
83
97
 
84
98
  try {
85
- await this.mixpanel.identify(userID);
86
- config.DEBUG_MODE && console.log('MixPanel User identified:', userID);
99
+ if (!this.devMode) {
100
+ await this.mixpanel.identify(userID);
101
+ config.DEBUG_MODE && console.log('MixPanel User identified:', userID);
102
+ } else {
103
+ config.DEBUG_MODE && console.log('MixPanel User identified but not send (DEV_MODE ON):', userID);
104
+ }
87
105
  } catch (error) {
88
106
  console.error('Error identifying user:', error);
89
107
  }
@@ -96,8 +114,12 @@ class MixPanel {
96
114
  }
97
115
 
98
116
  try {
99
- await this.mixpanel.getPeople().set(propertyName, propertyValue);
100
- config.DEBUG_MODE && console.log(`MixPanel User property set: ${propertyName} = ${propertyValue}`);
117
+ if (!this.devMode) {
118
+ await this.mixpanel.getPeople().set(propertyName, propertyValue);
119
+ config.DEBUG_MODE && console.log(`MixPanel User property set: ${propertyName} = ${propertyValue}`);
120
+ } else {
121
+ config.DEBUG_MODE && console.log(`MixPanel User property set but not send (DEV_MODE ON): ${propertyName} = ${propertyValue}`);
122
+ }
101
123
  } catch (error) {
102
124
  console.error('Error setting user property:', error);
103
125
  }
package/types/index.d.ts CHANGED
@@ -180,7 +180,7 @@ declare module 'apps-sdk' {
180
180
  }
181
181
 
182
182
  export class MixPanel {
183
- initialize(token?: string, trackAutomaticEvents?: boolean, useNative?: boolean): Promise<void>;
183
+ initialize(token?: string, trackAutomaticEvents?: boolean, useNative?: boolean, devMode?: boolean): Promise<void>;
184
184
  trackEvent(event: string, properties?: object): Promise<void>;
185
185
  trackEventIfExist(eventKeyword: string, eventData?: object): Promise<void>;
186
186
  isMixpanelInitialized(): boolean;