apps-sdk 1.0.152 → 1.0.153

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.153",
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', {
@@ -232,13 +201,15 @@ class PayWall extends React.Component {
232
201
  render() {
233
202
  const { visible, onClose, type, keyword } = this.props;
234
203
  if (PayWallLogic.paywallJS === '' || Object.keys(this.paywallData).length === 0) {
235
- this.getPayWallDataWithRetry(type, keyword);
204
+ this.getPayWallData(type, keyword);
205
+ // config.DEBUG_MODE && console.log('PayWallLogic.paywallJS:', PayWallLogic.paywallJS);
206
+ // config.DEBUG_MODE && console.log('PayWallLogic.paywallJS type:', typeof PayWallLogic.paywallJS);
236
207
  }
237
208
 
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
- }
209
+ if (Object.keys(this.paywallData).length === 0 || !this.paywallData.url) {
210
+ config.DEBUG_MODE && console.log('PayWallLogic: paywallData no tiene url para este type / keyword -> ' + type + ' / ' + keyword);
211
+ return null;
212
+ }
242
213
 
243
214
  return (
244
215
  <BottomSheet visible={visible}>