apps-sdk 1.0.31 → 1.0.33
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/index.js +1 -2
- package/package.json +2 -1
- package/src/libraries/PayWall.js +45 -42
- package/src/libraries/index.js +0 -2
- package/types/index.d.ts +2 -4
- package/src/libraries/PayWall2.js +0 -15
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {NotificationsPush, Networking, Storage, Session, Utils, PayWall
|
|
1
|
+
import {NotificationsPush, Networking, Storage, Session, Utils, PayWall} from "./src/libraries";
|
|
2
2
|
|
|
3
3
|
class AppsSDK {
|
|
4
4
|
initializePushNotifications = async() => {
|
|
@@ -19,5 +19,4 @@ export default {
|
|
|
19
19
|
session: Session,
|
|
20
20
|
utils: Utils,
|
|
21
21
|
paywall: PayWall,
|
|
22
|
-
paywall2: PayWall2
|
|
23
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "Apps SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"expo-sharing": "^11.10.0",
|
|
21
21
|
"react-native": "^0.73.2",
|
|
22
22
|
"react-native-btr": "^2.2.1",
|
|
23
|
+
"react-native-safe-area-context": "^4.9.0",
|
|
23
24
|
"react-native-webview": "^13.8.1"
|
|
24
25
|
},
|
|
25
26
|
"types": "./types/index.d.ts"
|
package/src/libraries/PayWall.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WebView } from 'react-native-webview';
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
2
|
import { BottomSheet } from 'react-native-btr';
|
|
3
|
+
import { WebView } from 'react-native-webview';
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
6
|
import Utils from "./Utils";
|
|
5
|
-
import { StyleSheet, View, Dimensions } from 'react-native';
|
|
6
7
|
|
|
7
|
-
export default
|
|
8
|
-
webviewRef =
|
|
9
|
-
|
|
8
|
+
export default function PayWall({ visible, onClose }) {
|
|
9
|
+
const webviewRef = useRef(null);
|
|
10
|
+
|
|
11
|
+
const getURL = () => {
|
|
12
|
+
return "https://www.google.com";
|
|
13
|
+
}
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
const getPayWallJS = () => {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const handleMessage = (message) => {
|
|
12
20
|
const data = JSON.parse(message.nativeEvent.data);
|
|
13
21
|
const event = "event" + Utils.capitalize(data.query);
|
|
14
22
|
if (typeof this[event] === 'function') {
|
|
@@ -18,46 +26,41 @@ export default class PayWall extends React.Component {
|
|
|
18
26
|
}
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (visible) {
|
|
31
|
+
webviewRef.current.injectJavaScript(getPayWallJS());
|
|
32
|
+
}
|
|
33
|
+
}, [visible]);
|
|
24
34
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
customStyles={{
|
|
34
|
-
container: {
|
|
35
|
-
flex: 1,
|
|
36
|
-
borderTopLeftRadius: 10,
|
|
37
|
-
borderTopRightRadius: 10,
|
|
38
|
-
}
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
35
|
+
return (
|
|
36
|
+
<SafeAreaView>
|
|
37
|
+
<BottomSheet
|
|
38
|
+
visible={visible}
|
|
39
|
+
onBackButtonPress={onClose}
|
|
40
|
+
onBackdropPress={onClose}
|
|
41
|
+
>
|
|
42
|
+
<View style={styles.bottomNavigationView}>
|
|
41
43
|
<WebView
|
|
42
|
-
style={
|
|
43
|
-
source={{ uri:
|
|
44
|
+
style={{flex:1}}
|
|
45
|
+
source={{ uri: getURL() }}
|
|
44
46
|
javaScriptEnabled
|
|
45
|
-
ref={
|
|
46
|
-
onMessage={
|
|
47
|
+
ref={webviewRef}
|
|
48
|
+
onMessage={handleMessage}
|
|
47
49
|
onError={(err) => {console.log('Error al cargar webview:',err)}}
|
|
48
|
-
injectedJavaScript={
|
|
50
|
+
injectedJavaScript={getPayWallJS()}
|
|
49
51
|
/>
|
|
50
|
-
</
|
|
51
|
-
</
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
</View>
|
|
53
|
+
</BottomSheet>
|
|
54
|
+
</SafeAreaView>
|
|
55
|
+
);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
const styles =
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const styles = {
|
|
59
|
+
bottomNavigationView: {
|
|
60
|
+
backgroundColor: '#fff',
|
|
61
|
+
width: '100%',
|
|
62
|
+
height: '100%',
|
|
59
63
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
package/src/libraries/index.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
declare module 'apps-sdk' {
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
|
-
import { WebViewProps } from 'react-native-webview';
|
|
4
3
|
import { BottomSheetProps } from 'react-native-btr';
|
|
5
4
|
|
|
6
5
|
export interface SessionData {
|
|
@@ -87,13 +86,11 @@ declare module 'apps-sdk' {
|
|
|
87
86
|
registerForPushNotificationsAsync(): Promise<string>;
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
export
|
|
89
|
+
export class PayWall {
|
|
91
90
|
visible: boolean;
|
|
92
91
|
onClose: () => void;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
export const PayWall2: ComponentType<PayWallProps>;
|
|
96
|
-
|
|
97
94
|
export class AppsSDK {
|
|
98
95
|
initializePushNotifications(): Promise<string>;
|
|
99
96
|
}
|
|
@@ -104,6 +101,7 @@ declare module 'apps-sdk' {
|
|
|
104
101
|
storage: Storage;
|
|
105
102
|
session: Session;
|
|
106
103
|
utils: Utils;
|
|
104
|
+
paywall: PayWall;
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
const Core: AppsSDK;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BottomSheet } from 'react-native-btr';
|
|
3
|
-
import { WebView } from 'react-native-webview';
|
|
4
|
-
|
|
5
|
-
export default function PayWall2({ visible, onClose }) {
|
|
6
|
-
return (
|
|
7
|
-
<BottomSheet
|
|
8
|
-
visible={visible}
|
|
9
|
-
onBackButtonPress={onClose}
|
|
10
|
-
onBackdropPress={onClose}
|
|
11
|
-
>
|
|
12
|
-
<WebView source={{ uri: 'https://www.google.es' }} />
|
|
13
|
-
</BottomSheet>
|
|
14
|
-
);
|
|
15
|
-
}
|