apps-sdk 1.0.34 → 1.0.35
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 +6 -6
- package/package.json +1 -1
- package/src/libraries/Networking.js +1 -1
- package/src/libraries/PayWall.js +43 -3
- package/src/libraries/Storage.js +2 -2
- package/types/index.d.ts +2 -0
package/config.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export var ENDPOINTS = {
|
|
2
|
-
INIT : 'https://
|
|
3
|
-
NOTIFICATION_TOKEN: 'https://
|
|
4
|
-
TRACKING: 'https://
|
|
5
|
-
GET_USER_ID: 'https://
|
|
6
|
-
CHECK_SUBSCRIPTION: 'https://
|
|
7
|
-
SET_ATTRIBUTION: 'https://
|
|
2
|
+
INIT : 'https://backend.ailandsapp.com/v6/init',
|
|
3
|
+
NOTIFICATION_TOKEN: 'https://backend.ailandsapp.com/user/set_expo_id',
|
|
4
|
+
TRACKING: 'https://backend.ailandsapp.com/v3/log-event',
|
|
5
|
+
GET_USER_ID: 'https://backend.ailandsapp.com/user/generate_public_id',
|
|
6
|
+
CHECK_SUBSCRIPTION: 'https://backend.ailandsapp.com/create-sub',
|
|
7
|
+
SET_ATTRIBUTION: 'https://backend.ailandsapp.com/user/set_attribution_data',
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export var EVENTS = {}
|
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@ class Networking {
|
|
|
44
44
|
try {
|
|
45
45
|
let initData = await this.request(config.ENDPOINTS.INIT);
|
|
46
46
|
if (initData) {
|
|
47
|
-
config.DEBUG_MODE && console.debug("initData", initData);
|
|
47
|
+
config.DEBUG_MODE && console.debug("initData", JSON.stringify(initData));
|
|
48
48
|
this.setEndpoints(initData.data.domains);
|
|
49
49
|
this.setEvents(initData.data.attribution);
|
|
50
50
|
}
|
package/src/libraries/PayWall.js
CHANGED
|
@@ -3,21 +3,34 @@ import { BottomSheet } from 'react-native-btr';
|
|
|
3
3
|
import { WebView } from 'react-native-webview';
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
import Utils from "./Utils";
|
|
6
|
+
import Networking from "./Networking";
|
|
7
|
+
import Session from "./Session";
|
|
8
|
+
import * as config from "../../config";
|
|
6
9
|
|
|
7
10
|
class PayWall extends React.Component {
|
|
8
11
|
constructor(props) {
|
|
9
12
|
super(props);
|
|
10
13
|
this.webviewRef = React.createRef();
|
|
14
|
+
this.paywallData = {};
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
getURL = () => {
|
|
14
|
-
return "https://
|
|
18
|
+
return "https://apaq09.gways.org/card/ZLp_slash_QSy94h9aKdNJWvvvkE8dkHSyeiTGRxsZVQAaiiYveh2jTjeZVJnnIZ0WVKTgiRoAkEoVrB2leXjt_slash_l2g2MtLKRa_slash_30mL6tMu0L9IJxY=?dsn_id=6274";
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
getPayWallJS = () => {
|
|
18
22
|
return "";
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
getPayWallData = (type, keyword) => {
|
|
26
|
+
if (!config.PAYWALL_DATA[type] || !config.PAYWALL_DATA[type][keyword]) {
|
|
27
|
+
console.log('No se encontraron datos para el paywall.');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
console.log('PayWallData: ', JSON.stringify(config.PAYWALL_DATA[type][keyword]));
|
|
31
|
+
this.paywallData = config.PAYWALL_DATA[type][keyword];
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
handleMessage = (message) => {
|
|
22
35
|
const data = JSON.parse(message.nativeEvent.data);
|
|
23
36
|
const event = "event" + Utils.capitalize(data.query);
|
|
@@ -34,12 +47,39 @@ class PayWall extends React.Component {
|
|
|
34
47
|
}
|
|
35
48
|
}
|
|
36
49
|
|
|
50
|
+
// --------------------------------------- Eventos ---------------------------------------
|
|
51
|
+
eventClickClose = (data) => {
|
|
52
|
+
Networking.sendEvent('action', 'continue_free');
|
|
53
|
+
this.props.onClose();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
eventClickSubscribe = (data) => {
|
|
57
|
+
Networking.sendEvent('action', 'cta');
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
hideSpinner();
|
|
60
|
+
}, 3000);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
hideSpinner = () => {
|
|
64
|
+
const event = {
|
|
65
|
+
event: 'hideLoader',
|
|
66
|
+
value: {
|
|
67
|
+
status: true,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
this.webviewRef.injectJavaScript(
|
|
71
|
+
`Appquiles.emitAppEvent(${JSON.stringify(event)});`,
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
// --------------------------------------- Eventos ---------------------------------------
|
|
75
|
+
|
|
37
76
|
render() {
|
|
38
|
-
const { visible, onClose } = this.props;
|
|
77
|
+
const { visible, onClose, type, keyword } = this.props;
|
|
78
|
+
this.getPayWallData(type, keyword);
|
|
39
79
|
return (
|
|
40
80
|
<BottomSheet visible={visible} onBackButtonPress={onClose} onBackdropPress={onClose}>
|
|
41
81
|
<View style={styles.bottomNavigationView}>
|
|
42
|
-
<WebView style={{flex:1}} source={{ uri: this.
|
|
82
|
+
<WebView style={{flex:1}} source={{ uri: this.paywallData.url }} javaScriptEnabled ref={this.webviewRef} onMessage={this.handleMessage} onError={(err) => {console.log('Error al cargar webview:',err)}} injectedJavaScript={this.getPayWallJS()}/>
|
|
43
83
|
</View>
|
|
44
84
|
</BottomSheet>
|
|
45
85
|
);
|
package/src/libraries/Storage.js
CHANGED
|
@@ -117,8 +117,8 @@ class Storage {
|
|
|
117
117
|
try {
|
|
118
118
|
const info = await FileSystem.getInfoAsync(CREATIONS_DIR);
|
|
119
119
|
if (!info.exists) {
|
|
120
|
-
|
|
121
|
-
return;
|
|
120
|
+
await this.createCreationsDir(CREATIONS_DIR);
|
|
121
|
+
return {};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
const directories = await FileSystem.readDirectoryAsync(CREATIONS_DIR);
|