apps-sdk 1.0.152 → 1.0.154

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.152",
3
+ "version": "1.0.154",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,45 +18,17 @@ class PayWall extends React.Component {
18
18
  this.paywallJS = '';
19
19
  this.state = {
20
20
  htmlContent: null,
21
- retryCount: 0
22
21
  };
23
- this.maxRetries = 50;
24
- this.retryInterval = 1000;
25
22
  }
26
23
 
27
24
  componentDidMount() {
28
- const { type, keyword } = this.props;
29
25
  this.initPayWall();
30
- this.getPayWallDataWithRetry(type, keyword);
31
26
  }
32
27
 
33
28
  initPayWall = async () => {
34
29
  await PayWallLogic.initializePayWall();
35
30
  }
36
31
 
37
- getPayWallDataWithRetry = async (type, keyword) => {
38
- if (this.state.retryCount >= this.maxRetries) {
39
- console.log('Máximo número de reintentos alcanzado.');
40
- return;
41
- } else {
42
- console.log('Reintentando obtener datos del paywall. Reintento número:', this.state.retryCount);
43
- }
44
-
45
- this.getPayWallData(type, keyword);
46
-
47
- if (!this.paywallData.url) {
48
- console.log('Esperando antes de reintentar...');
49
- await new Promise(resolve => setTimeout(resolve, this.retryInterval));
50
-
51
- this.setState(
52
- prevState => ({ retryCount: prevState.retryCount + 1 }),
53
- () => {
54
- this.getPayWallDataWithRetry(type, keyword);
55
- }
56
- );
57
- }
58
- }
59
-
60
32
  getURL = (type, keyword) => {
61
33
  return config.PAYWALL_DATA[type][keyword].url || '';
62
34
  }
@@ -128,9 +100,6 @@ class PayWall extends React.Component {
128
100
 
129
101
  async componentDidUpdate(prevProps) {
130
102
  if (this.props.visible && !prevProps.visible && this.paywallData.url) {
131
- const { type, keyword } = this.props;
132
- await this.initPayWall();
133
- await this.getPayWallDataWithRetry(type, keyword);
134
103
  await this.fetchAndModifyHTML();
135
104
  setTimeout(() => {
136
105
  Networking.sendEvent('scene', 'payment_card', {
@@ -207,7 +176,14 @@ class PayWall extends React.Component {
207
176
 
208
177
  eventTrackScene = (data) => {
209
178
  config.DEBUG_MODE && console.debug('eventTrackScene', data);
210
- Networking.sendEvent('scene', data.eventName, data || {});
179
+ switch(true) {
180
+ case data.eventName === 'on_boarding' && data.eventValue.toString().substring(0, 4) === 'step':
181
+ Networking.sendEvent('action', 'onb_tap_continue_' + data.eventValue, {step: data.eventValue});
182
+ break;
183
+ default:
184
+ Networking.sendEvent('scene', data.eventName, data || {});
185
+ break;
186
+ }
211
187
  }
212
188
 
213
189
  hideSpinner = () => {
@@ -232,13 +208,15 @@ class PayWall extends React.Component {
232
208
  render() {
233
209
  const { visible, onClose, type, keyword } = this.props;
234
210
  if (PayWallLogic.paywallJS === '' || Object.keys(this.paywallData).length === 0) {
235
- this.getPayWallDataWithRetry(type, keyword);
211
+ this.getPayWallData(type, keyword);
212
+ // config.DEBUG_MODE && console.log('PayWallLogic.paywallJS:', PayWallLogic.paywallJS);
213
+ // config.DEBUG_MODE && console.log('PayWallLogic.paywallJS type:', typeof PayWallLogic.paywallJS);
236
214
  }
237
215
 
238
- if (!this.paywallData.url) {
239
- config.DEBUG_MODE && console.log('PayWallLogic: paywallData no tiene url para este type / keyword -> ' + type + ' / ' + keyword);
240
- return null;
241
- }
216
+ if (Object.keys(this.paywallData).length === 0 || !this.paywallData.url) {
217
+ config.DEBUG_MODE && console.log('PayWallLogic: paywallData no tiene url para este type / keyword -> ' + type + ' / ' + keyword);
218
+ return null;
219
+ }
242
220
 
243
221
  return (
244
222
  <BottomSheet visible={visible}>
@@ -84,7 +84,7 @@ class Storage {
84
84
  const { status } = await MediaLibrary.requestPermissionsAsync();
85
85
  if (status === 'granted') {
86
86
  await this.storeData('GALLERY_PERMISSION', 'granted');
87
- Networking.sendEvent('action', 'galery_consent');
87
+ Networking.sendEvent('action', 'gallery_consent');
88
88
  }
89
89
  return status;
90
90
  } catch (error) {
@@ -101,7 +101,7 @@ class Storage {
101
101
  galleryPermission = status;
102
102
  if (status === 'granted') {
103
103
  await this.storeData('GALLERY_PERMISSION', 'granted');
104
- Networking.sendEvent('action', 'galery_consent');
104
+ Networking.sendEvent('action', 'gallery_consent');
105
105
  }
106
106
  }
107
107
  if (galleryPermission === 'granted') {