apps-sdk 1.0.153 → 1.0.155
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
|
@@ -18,17 +18,45 @@ class PayWall extends React.Component {
|
|
|
18
18
|
this.paywallJS = '';
|
|
19
19
|
this.state = {
|
|
20
20
|
htmlContent: null,
|
|
21
|
+
retryCount: 0
|
|
21
22
|
};
|
|
23
|
+
this.maxRetries = 10;
|
|
24
|
+
this.retryInterval = 1000;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
componentDidMount() {
|
|
28
|
+
const { type, keyword } = this.props;
|
|
25
29
|
this.initPayWall();
|
|
30
|
+
this.getPayWallDataWithRetry(type, keyword);
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
initPayWall = async () => {
|
|
29
34
|
await PayWallLogic.initializePayWall();
|
|
30
35
|
}
|
|
31
36
|
|
|
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
|
+
|
|
32
60
|
getURL = (type, keyword) => {
|
|
33
61
|
return config.PAYWALL_DATA[type][keyword].url || '';
|
|
34
62
|
}
|
|
@@ -40,8 +68,10 @@ class PayWall extends React.Component {
|
|
|
40
68
|
|
|
41
69
|
getPayWallData = (type, keyword) => {
|
|
42
70
|
if (!config.PAYWALL_DATA[type] || !config.PAYWALL_DATA[type][keyword]) {
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
if (keyword !== 'on_boarding') {
|
|
72
|
+
Networking.sendEvent('ohter', 'no_paywall_data', {type: type, keyword: keyword, config: config.PAYWALL_DATA});
|
|
73
|
+
console.log('No se encontraron datos para el paywall.');
|
|
74
|
+
}
|
|
45
75
|
return;
|
|
46
76
|
}
|
|
47
77
|
this.paywallData = config.PAYWALL_DATA[type][keyword];
|
|
@@ -100,6 +130,9 @@ class PayWall extends React.Component {
|
|
|
100
130
|
|
|
101
131
|
async componentDidUpdate(prevProps) {
|
|
102
132
|
if (this.props.visible && !prevProps.visible && this.paywallData.url) {
|
|
133
|
+
const { type, keyword } = this.props;
|
|
134
|
+
await this.initPayWall();
|
|
135
|
+
await this.getPayWallDataWithRetry(type, keyword);
|
|
103
136
|
await this.fetchAndModifyHTML();
|
|
104
137
|
setTimeout(() => {
|
|
105
138
|
Networking.sendEvent('scene', 'payment_card', {
|
|
@@ -176,7 +209,14 @@ class PayWall extends React.Component {
|
|
|
176
209
|
|
|
177
210
|
eventTrackScene = (data) => {
|
|
178
211
|
config.DEBUG_MODE && console.debug('eventTrackScene', data);
|
|
179
|
-
|
|
212
|
+
switch(true) {
|
|
213
|
+
case data.eventName === 'on_boarding' && data.eventValue.toString().substring(0, 4) === 'step':
|
|
214
|
+
Networking.sendEvent('action', 'onb_tap_continue_' + data.eventValue, {step: data.eventValue});
|
|
215
|
+
break;
|
|
216
|
+
default:
|
|
217
|
+
Networking.sendEvent('scene', data.eventName, data || {});
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
180
220
|
}
|
|
181
221
|
|
|
182
222
|
hideSpinner = () => {
|
|
@@ -201,9 +241,7 @@ class PayWall extends React.Component {
|
|
|
201
241
|
render() {
|
|
202
242
|
const { visible, onClose, type, keyword } = this.props;
|
|
203
243
|
if (PayWallLogic.paywallJS === '' || Object.keys(this.paywallData).length === 0) {
|
|
204
|
-
this.
|
|
205
|
-
// config.DEBUG_MODE && console.log('PayWallLogic.paywallJS:', PayWallLogic.paywallJS);
|
|
206
|
-
// config.DEBUG_MODE && console.log('PayWallLogic.paywallJS type:', typeof PayWallLogic.paywallJS);
|
|
244
|
+
this.getPayWallDataWithRetry(type, keyword);
|
|
207
245
|
}
|
|
208
246
|
|
|
209
247
|
if (Object.keys(this.paywallData).length === 0 || !this.paywallData.url) {
|
package/src/libraries/Storage.js
CHANGED
|
@@ -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', '
|
|
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', '
|
|
104
|
+
Networking.sendEvent('action', 'gallery_consent');
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
if (galleryPermission === 'granted') {
|