apps-sdk 1.0.171 → 1.0.174

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/config.js CHANGED
@@ -64,4 +64,6 @@ export var TRACKING_ANSWERED = false;
64
64
 
65
65
  export var FORCED_UPDATE = false;
66
66
 
67
+ export var PROMO_CODES_ACTIVE = false;
68
+
67
69
  export const DEBUG_MODE = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.171",
3
+ "version": "1.0.174",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -70,7 +70,7 @@ class PayWall extends React.Component {
70
70
 
71
71
  getPayWallData = (type, keyword) => {
72
72
  if (!config.PAYWALL_DATA[type] || !config.PAYWALL_DATA[type][keyword]) {
73
- if (keyword !== 'on_boarding') {
73
+ if (keyword !== 'on_boarding' && this.state.retryCount >= this.maxRetries) {
74
74
  Networking.sendEvent('ohter', 'no_paywall_data', {type: type, keyword: keyword, config: config.PAYWALL_DATA});
75
75
  console.log('No se encontraron datos para el paywall.');
76
76
  }
@@ -242,13 +242,16 @@ class PayWall extends React.Component {
242
242
 
243
243
  render() {
244
244
  const { visible, onClose, type, keyword } = this.props;
245
+
245
246
  if (PayWallLogic.paywallJS === '' || Object.keys(this.paywallData).length === 0) {
246
247
  this.getPayWallDataWithRetry(type, keyword);
247
248
  }
248
249
 
249
- if (Object.keys(this.paywallData).length === 0 || !this.paywallData.url) {
250
+ if ((keyword !== 'on_boarding' && Object.keys(this.paywallData).length === 0) || !this.paywallData.url) {
250
251
  config.DEBUG_MODE && console.log('PayWallLogic: paywallData no tiene url para este type / keyword -> ' + type + ' / ' + keyword);
251
- return null;
252
+ if (this.state.retryCount >= this.maxRetries) {
253
+ return null;
254
+ }
252
255
  }
253
256
 
254
257
  return (
@@ -29,7 +29,7 @@ class MixPanel {
29
29
 
30
30
  async identifyUser(userId) {
31
31
  if (!this.mixpanel) {
32
- console.error('Mixpanel is not initialized');
32
+ console.log('Mixpanel is not initialized');
33
33
  return;
34
34
  }
35
35
 
@@ -51,7 +51,7 @@ class MixPanel {
51
51
 
52
52
  async trackEvent(eventName, properties = {}) {
53
53
  if (!this.mixpanel) {
54
- console.error('Mixpanel is not initialized');
54
+ console.log('Mixpanel is not initialized');
55
55
  return;
56
56
  }
57
57
 
@@ -3,7 +3,7 @@ import NetInfo from "@react-native-community/netinfo";
3
3
  import { default as storage } from './Storage';
4
4
  import Session from './Session';
5
5
  import AdJust from './AdJust';
6
- import CryptoES from "crypto-es";
6
+ import MixPanel from "./MixPanel";
7
7
  import semver from 'semver';
8
8
  import Constants from 'expo-constants';
9
9
  import { Platform } from 'react-native';
@@ -11,19 +11,9 @@ import utils from "./Utils";
11
11
 
12
12
  class Networking {
13
13
  constructor() {
14
- this.ENCRYPT_KEY = null;
15
- this.DEFAULT_ENCRYPT_VALUE = false;
16
14
  this.PENDING_EVENTS = [];
17
15
  }
18
16
 
19
- setEncryptKey(value) {
20
- this.ENCRYPT_KEY = value;
21
- }
22
-
23
- setDefaultEncryptValue(value) {
24
- this.DEFAULT_ENCRYPT_VALUE = value;
25
- }
26
-
27
17
  async executeInit() {
28
18
  config.DEBUG_MODE && console.debug("executeInit");
29
19
  try {
@@ -34,9 +24,11 @@ class Networking {
34
24
  config.TRACKING_ANSWERED = await storage.getData('TRACKING_PERMISSION_ANSWERED');
35
25
  this.setEndpoints(initData.data.domains);
36
26
  this.setEvents(initData.data.attribution);
27
+ this.setEventsMixPanel(initData.data.tracking);
37
28
  this.setPayWallData(initData);
38
29
  this.checkSubscription();
39
30
  this.setForcedUpdate(initData.data);
31
+ this.setPromoCodesActive(initData.data.promo_codes || false);
40
32
  if (initData.data.image) {
41
33
  this.setImageCompression(initData.data.image);
42
34
  }
@@ -177,10 +169,22 @@ class Networking {
177
169
  return updateNeeded;
178
170
  }
179
171
 
172
+ setPromoCodesActive = (active) => {
173
+ config.PROMO_CODES_ACTIVE = active;
174
+ }
175
+
176
+ getPromoCodesActive = () => {
177
+ return config.PROMO_CODES_ACTIVE;
178
+ }
179
+
180
180
  setEvents(events) {
181
181
  events && (config.EVENTS = events);
182
182
  }
183
183
 
184
+ setEventsMixPanel(events) {
185
+ events && (config.EVENTS_MIXPANEL = events);
186
+ }
187
+
184
188
  setPayWallData(data) {
185
189
  let result = {
186
190
  actions: {},
@@ -248,6 +252,7 @@ class Networking {
248
252
  config.DEBUG_MODE && console.debug("sendEvent", eventType, finalKeyword, eventData);
249
253
  try {
250
254
  AdJust.trackEventIfExist(finalKeyword);
255
+ MixPanel.trackEventIfExist(finalKeyword, eventData);
251
256
  let eventResponse = await this.request(config.ENDPOINTS.EVENTS_PUSH, {
252
257
  event_name: finalKeyword,
253
258
  event_type: eventType,
package/types/index.d.ts CHANGED
@@ -68,8 +68,6 @@ declare module 'apps-sdk' {
68
68
  }
69
69
 
70
70
  export class Networking {
71
- setEncryptKey(key: string): void;
72
- setDefaultEncryptValue(value: boolean): void;
73
71
  executeInit(): Promise<void>;
74
72
  setToken(token: string): Promise<boolean | null>;
75
73
  request(url: string, data?: any): Promise<any>;
@@ -85,6 +83,7 @@ declare module 'apps-sdk' {
85
83
  clearPendingEvents(): void;
86
84
  setPayWallData(payWallData: any): void;
87
85
  getPayWallData(): any;
86
+ getPromoCodesActive(): boolean;
88
87
  }
89
88
 
90
89
  export class Storage {