apps-sdk 1.0.170 → 1.0.173

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
@@ -16,6 +16,7 @@ export var ENDPOINTS = {
16
16
  }
17
17
 
18
18
  export var EVENTS = {}
19
+ export var EVENTS_MIXPANEL = {}
19
20
 
20
21
  export var SPECIAL_EVENTS = ['picture_upload', 'write_prompt', 'picture_generated', 'paywall_view']
21
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.170",
3
+ "version": "1.0.173",
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 (
@@ -4,6 +4,7 @@ import {Session} from "./index";
4
4
  import Constants from "expo-constants";
5
5
  import * as Localization from "expo-localization";
6
6
  import Networking from "./Networking";
7
+ import {Adjust, AdjustEvent} from "react-native-adjust";
7
8
 
8
9
  class MixPanel {
9
10
  constructor() {
@@ -28,7 +29,7 @@ class MixPanel {
28
29
 
29
30
  async identifyUser(userId) {
30
31
  if (!this.mixpanel) {
31
- console.error('Mixpanel is not initialized');
32
+ console.log('Mixpanel is not initialized');
32
33
  return;
33
34
  }
34
35
 
@@ -50,7 +51,7 @@ class MixPanel {
50
51
 
51
52
  async trackEvent(eventName, properties = {}) {
52
53
  if (!this.mixpanel) {
53
- console.error('Mixpanel is not initialized');
54
+ console.log('Mixpanel is not initialized');
54
55
  return;
55
56
  }
56
57
 
@@ -62,6 +63,15 @@ class MixPanel {
62
63
  }
63
64
  }
64
65
 
66
+ async trackEventIfExist(eventKeyword, eventData = {}) {
67
+ if (config.EVENTS_MIXPANEL[eventKeyword]) {
68
+ this.trackEvent(eventKeyword, eventData);
69
+ } else {
70
+ console.log("Event not found in MixPanel, not sent: " + eventKeyword);
71
+ }
72
+ }
73
+
74
+
65
75
  isMixpanelInitialized() {
66
76
  return this.mixpanel !== null;
67
77
  }
@@ -34,6 +34,7 @@ class Networking {
34
34
  config.TRACKING_ANSWERED = await storage.getData('TRACKING_PERMISSION_ANSWERED');
35
35
  this.setEndpoints(initData.data.domains);
36
36
  this.setEvents(initData.data.attribution);
37
+ this.setEventsMixPanel(initData.data.mixpanel);
37
38
  this.setPayWallData(initData);
38
39
  this.checkSubscription();
39
40
  this.setForcedUpdate(initData.data);
@@ -181,6 +182,10 @@ class Networking {
181
182
  events && (config.EVENTS = events);
182
183
  }
183
184
 
185
+ setEventsMixPanel(events) {
186
+ events && (config.EVENTS_MIXPANEL = events);
187
+ }
188
+
184
189
  setPayWallData(data) {
185
190
  let result = {
186
191
  actions: {},
package/types/index.d.ts CHANGED
@@ -185,6 +185,7 @@ declare module 'apps-sdk' {
185
185
  identifyUser(userID: string): Promise<void>;
186
186
  trackEvent(event: string, properties?: object): Promise<void>;
187
187
  isMixpanelInitialized(): boolean;
188
+ trackEventIfExist(eventKeyword: string, eventData?: object): Promise<void>;
188
189
  }
189
190
 
190
191
  export class TrackingTransparency {