apps-sdk 1.0.32 → 1.0.34
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 -1
- package/package.json +1 -1
- package/src/libraries/PayWall.js +38 -37
- package/types/index.d.ts +5 -5
package/index.js
CHANGED
package/package.json
CHANGED
package/src/libraries/PayWall.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BottomSheet } from 'react-native-btr';
|
|
3
3
|
import { WebView } from 'react-native-webview';
|
|
4
|
-
import {
|
|
4
|
+
import { View } from "react-native";
|
|
5
5
|
import Utils from "./Utils";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
class PayWall extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.webviewRef = React.createRef();
|
|
11
|
+
}
|
|
9
12
|
|
|
13
|
+
getURL = () => {
|
|
14
|
+
return "https://www.google.com";
|
|
15
|
+
}
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
return "
|
|
17
|
+
getPayWallJS = () => {
|
|
18
|
+
return "";
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
handleMessage = (message) => {
|
|
16
22
|
const data = JSON.parse(message.nativeEvent.data);
|
|
17
23
|
const event = "event" + Utils.capitalize(data.query);
|
|
18
24
|
if (typeof this[event] === 'function') {
|
|
@@ -22,35 +28,30 @@ export default function PayWall({ visible, onClose }) {
|
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
if (visible) {
|
|
27
|
-
webviewRef.current.injectJavaScript(getPayWallJS());
|
|
31
|
+
componentDidUpdate(prevProps) {
|
|
32
|
+
if (this.props.visible && !prevProps.visible) {
|
|
33
|
+
this.webviewRef.current.injectJavaScript(this.getPayWallJS());
|
|
28
34
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onBackButtonPress={onClose}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
ref={this.webviewRef}
|
|
50
|
-
onMessage={handleMessage}
|
|
51
|
-
onError={(err) => {console.log('Error al cargar webview:',err)}}
|
|
52
|
-
injectedJavaScript={getPayWallJS()}
|
|
53
|
-
/>
|
|
54
|
-
</BottomSheet>
|
|
55
|
-
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
const { visible, onClose } = this.props;
|
|
39
|
+
return (
|
|
40
|
+
<BottomSheet visible={visible} onBackButtonPress={onClose} onBackdropPress={onClose}>
|
|
41
|
+
<View style={styles.bottomNavigationView}>
|
|
42
|
+
<WebView style={{flex:1}} source={{ uri: this.getURL() }} javaScriptEnabled ref={this.webviewRef} onMessage={this.handleMessage} onError={(err) => {console.log('Error al cargar webview:',err)}} injectedJavaScript={this.getPayWallJS()}/>
|
|
43
|
+
</View>
|
|
44
|
+
</BottomSheet>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const styles = {
|
|
50
|
+
bottomNavigationView: {
|
|
51
|
+
backgroundColor: '#fff',
|
|
52
|
+
width: '100%',
|
|
53
|
+
height: '95%',
|
|
54
|
+
},
|
|
56
55
|
}
|
|
56
|
+
|
|
57
|
+
export default PayWall;
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
declare module 'apps-sdk' {
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
import { WebViewProps } from 'react-native-webview';
|
|
4
|
-
import { BottomSheetProps } from 'react-native-btr';
|
|
2
|
+
import React, { ComponentType } from 'react';
|
|
5
3
|
|
|
6
4
|
export interface SessionData {
|
|
7
5
|
app: {
|
|
@@ -87,12 +85,13 @@ declare module 'apps-sdk' {
|
|
|
87
85
|
registerForPushNotificationsAsync(): Promise<string>;
|
|
88
86
|
}
|
|
89
87
|
|
|
90
|
-
export interface PayWallProps
|
|
88
|
+
export interface PayWallProps {
|
|
91
89
|
visible: boolean;
|
|
92
90
|
onClose: () => void;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
export
|
|
93
|
+
export class PayWall extends React.Component<PayWallProps, {}> {
|
|
94
|
+
}
|
|
96
95
|
|
|
97
96
|
export class AppsSDK {
|
|
98
97
|
initializePushNotifications(): Promise<string>;
|
|
@@ -104,6 +103,7 @@ declare module 'apps-sdk' {
|
|
|
104
103
|
storage: Storage;
|
|
105
104
|
session: Session;
|
|
106
105
|
utils: Utils;
|
|
106
|
+
paywall: PayWall;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const Core: AppsSDK;
|