apps-sdk 1.0.108 → 1.0.110

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.108",
3
+ "version": "1.0.110",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ import {WebView} from 'react-native-webview';
4
4
  import {View} from "react-native";
5
5
  import Utils from "../libraries/Utils";
6
6
  import Networking from "../libraries/Networking";
7
+ import Storage from "../libraries/Storage";
7
8
  import PayWallLogic from "../libraries/PayWallLogic";
8
9
  import Session from "../libraries/Session";
9
10
  import * as Linking from 'expo-linking';
@@ -52,11 +53,12 @@ class PayWall extends React.Component {
52
53
  if (this.props.visible && !prevProps.visible && this.paywallData.url) {
53
54
  this.webviewRef.current.injectJavaScript(PayWallLogic.paywallJS);
54
55
  Networking.sendEvent('scene', 'payment_card', { user_id: Session.getUserID(), card_id: this.getCardID(), scene: 'payment_card' });
56
+ Storage.storeData('PAYWALL_DSNID', this.getCardID());
55
57
  }
56
58
  }
57
59
 
58
60
  getCardID = () => {
59
- return this.getDesignIDFromURL(this.paywallData.url);
61
+ return this.getDesignIDFromURL(this.paywallData.url) || '';
60
62
  }
61
63
 
62
64
  // --------------------------------------- Eventos ---------------------------------------
@@ -66,17 +68,21 @@ class PayWall extends React.Component {
66
68
  }
67
69
 
68
70
  eventClickSubscribe = (data) => {
69
- Networking.sendEvent('action', 'cta');
71
+ Networking.sendEvent('other', 'cta_click_init');
70
72
  if (this.paywallData && data.id && data.id.length > 0 && this.paywallData.products_id && this.paywallData.products_id.length > 0) {
71
- let subscribed = PayWallLogic.executePurchase(data.id, this.hideSpinner, this.hidePayWall).then((subscribed) => {
72
- console.log('subscription result: ',subscribed);
73
- if (subscribed) {
74
- this.props.onSubscribe(false);
75
- } else {
76
- this.props.onPaymentError();
77
- }
73
+ Storage.getData('PAYWALL_DSNID').then((dsn_id) => {
74
+ Networking.sendEvent('action', 'cta', {product_id: data.id, dsn_id: dsn_id || ''});
75
+ let subscribed = PayWallLogic.executePurchase(data.id, this.hideSpinner, this.hidePayWall).then((subscribed) => {
76
+ console.log('subscription result: ', subscribed);
77
+ if (subscribed) {
78
+ this.props.onSubscribe(false);
79
+ } else {
80
+ this.props.onPaymentError();
81
+ }
82
+ });
78
83
  });
79
84
  } else {
85
+ Networking.sendEvent('other', 'cta_click_error_paywall_data');
80
86
  this.props.onPaymentError();
81
87
  }
82
88
  }
@@ -140,6 +146,8 @@ class PayWall extends React.Component {
140
146
  if (!this.paywallData.url) {
141
147
  config.DEBUG_MODE && console.log('PayWallLogic: paywallData no tiene url para este type / keyword -> ' + type + ' / ' + keyword);
142
148
  return null;
149
+ } else {
150
+ Storage.storeData('PAYWALL_DSNID', this.getCardID());
143
151
  }
144
152
 
145
153
  return (
@@ -49,6 +49,9 @@ class PayWallLogic {
49
49
  Session.setIsSubscribed(true);
50
50
  Session.setSubscriptionID(data.subs_id);
51
51
  Session.setSubscriptionData(purchaseResponse.data);
52
+ if (data.source) {
53
+ Networking.sendEvent('other', 'subscription_from_source', {source: data.source});
54
+ }
52
55
  }
53
56
  }
54
57
  } catch (error) {
@@ -70,6 +73,9 @@ class PayWallLogic {
70
73
  Session.setIsSubscribed(true);
71
74
  Session.setSubscriptionID(data.subs_id);
72
75
  Session.setSubscriptionData(purchaseResponse.data);
76
+ if (data.source) {
77
+ Networking.sendEvent('action', 'subscription_from_source', {source: data.source});
78
+ }
73
79
  } else {
74
80
  console.log('SDK checkSubscription fail')
75
81
  }
@@ -99,10 +105,12 @@ class PayWallLogic {
99
105
  if (source) {
100
106
  final_source = source;
101
107
  }
108
+ const dns_id = await Storage.getData('PAYWALL_DSNID');
102
109
  config.DEBUG_MODE && console.log('purchaseResp final_source', final_source);
103
110
  return {
104
111
  subs_id: purchaseToken,
105
112
  product_id: subscription.productId,
113
+ dns_id: dns_id || '',
106
114
  source: final_source,
107
115
  };
108
116
  }
@@ -4,7 +4,6 @@ import { Platform } from 'react-native';
4
4
  import * as Localization from 'expo-localization'
5
5
  import Storage from './Storage';
6
6
  import Networking from './Networking';
7
- import AdJust from './AdJust';
8
7
  import * as config from "../../config";
9
8
 
10
9
  class Session {