apps-sdk 1.0.195 → 1.0.197

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.197",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,6 +23,7 @@ class PayWall extends React.Component {
23
23
  };
24
24
  this.maxRetries = 50;
25
25
  this.retryInterval = 1000;
26
+ this.bottomsheet = typeof(props.bottomsheet) === 'undefined' ? false : props.bottomsheet;
26
27
  }
27
28
 
28
29
  componentDidMount() {
@@ -268,35 +269,41 @@ class PayWall extends React.Component {
268
269
  }
269
270
  }
270
271
 
271
- return (
272
+ const content = (
273
+ <View style={styles.bottomNavigationView}>
274
+ {this.state.htmlContent ? (
275
+ <WebView
276
+ style={{ flex: 1 }}
277
+ originWhitelist={['*']}
278
+ source={{ html: this.state.htmlContent }}
279
+ javaScriptEnabled
280
+ ref={this.webviewRef}
281
+ onMessage={this.handleMessage}
282
+ onError={(err) => { console.log('Error al cargar webview:', err) }}
283
+ // injectedJavaScript={PayWallLogic.paywallJS}
284
+ allowsInlineMediaPlayback={true}
285
+ mediaPlaybackRequiresUserAction={false}
286
+ onShouldStartLoadWithRequest={request => {
287
+ if (request.url !== 'about:blank' && request.url !== this.paywallData.url) {
288
+ Networking.sendEvent('action', 'click_link', { url: request.url });
289
+ Linking.openURL(request.url);
290
+ return false;
291
+ } else {
292
+ return true;
293
+ }
294
+ }}
295
+ />
296
+ ) : null}
297
+ </View>
298
+ );
299
+
300
+ return this.bottomsheet ? (
272
301
  <BottomSheet visible={visible}>
273
- <View style={styles.bottomNavigationView}>
274
- {this.state.htmlContent ? (
275
- <WebView
276
- style={{ flex: 1 }}
277
- originWhitelist={['*']}
278
- source={{ html: this.state.htmlContent }}
279
- javaScriptEnabled
280
- ref={this.webviewRef}
281
- onMessage={this.handleMessage}
282
- onError={(err) => { console.log('Error al cargar webview:', err) }}
283
- // injectedJavaScript={PayWallLogic.paywallJS}
284
- allowsInlineMediaPlayback={true}
285
- mediaPlaybackRequiresUserAction={false}
286
- onShouldStartLoadWithRequest={request => {
287
- if (request.url !== 'about:blank' && request.url !== this.paywallData.url) {
288
- Networking.sendEvent('action', 'click_link', { url: request.url });
289
- Linking.openURL(request.url);
290
- return false;
291
- } else {
292
- return true;
293
- }
294
- }}
295
- />
296
- ) : null}
297
- </View>
302
+ {content}
298
303
  </BottomSheet>
299
- );
304
+ ) : (
305
+ content
306
+ );
300
307
  }
301
308
  }
302
309
 
@@ -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 = {