apps-sdk 1.0.28 → 1.0.30

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 CHANGED
@@ -1,4 +1,4 @@
1
- import {NotificationsPush, Networking, Storage, Session, Utils, PayWall} from "./src/libraries";
1
+ import {NotificationsPush, Networking, Storage, Session, Utils, PayWall, PayWall2} from "./src/libraries";
2
2
 
3
3
  class AppsSDK {
4
4
  initializePushNotifications = async() => {
@@ -18,5 +18,6 @@ export default {
18
18
  storage: Storage,
19
19
  session: Session,
20
20
  utils: Utils,
21
- paywall: PayWall
21
+ paywall: PayWall,
22
+ paywall2: PayWall2
22
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,6 +19,7 @@
19
19
  "expo-notifications": "^0.23.0",
20
20
  "expo-sharing": "^11.10.0",
21
21
  "react-native": "^0.73.2",
22
+ "react-native-btr": "^2.2.1",
22
23
  "react-native-webview": "^13.8.1"
23
24
  },
24
25
  "types": "./types/index.d.ts"
@@ -1,9 +1,12 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  import { WebView } from 'react-native-webview';
3
- import Utils from "./utils";
3
+ import { BottomSheet } from 'react-native-btr';
4
+ import Utils from "./Utils";
5
+ import { StyleSheet, View, Dimensions } from 'react-native';
4
6
 
5
- class PayWall {
7
+ export default class PayWall extends React.Component {
6
8
  webviewRef = React.createRef();
9
+ bottomSheetRef = React.createRef();
7
10
 
8
11
  handleMessage = (message) => {
9
12
  const data = JSON.parse(message.nativeEvent.data);
@@ -19,18 +22,42 @@ class PayWall {
19
22
  return "window.subInfoInterval = setInterval(() => window.Appquiles && Appquiles.setSubscriptionPlans(" + JSON.stringify(information.subsPlansInfo) + "), 300);";
20
23
  }
21
24
 
22
- async showPayWall(url) {
25
+ render() {
23
26
  return (
24
- <WebView style={styles.webview} source={{ uri: url }} javaScriptEnabled ref={webviewRef} onMessage={handleMessage} onError={(err) => {console.log('Error al cargar webview:',err)}} injectedJavaScript={getPayWallJS()} >
25
- </WebView>
27
+ this.props.isVisible &&
28
+ <View style={styles.container}>
29
+ <BottomSheet
30
+ ref={this.bottomSheetRef}
31
+ height={0.9 * Dimensions.get('window').height} // 90% de la altura de la pantalla
32
+ open={true}
33
+ customStyles={{
34
+ container: {
35
+ flex: 1,
36
+ borderTopLeftRadius: 10,
37
+ borderTopRightRadius: 10,
38
+ }
39
+ }}
40
+ >
41
+ <WebView
42
+ style={styles.webview}
43
+ source={{ uri: this.props.url }}
44
+ javaScriptEnabled
45
+ ref={this.webviewRef}
46
+ onMessage={this.handleMessage}
47
+ onError={(err) => {console.log('Error al cargar webview:',err)}}
48
+ injectedJavaScript={this.getPayWallJS()}
49
+ />
50
+ </BottomSheet>
51
+ </View>
26
52
  );
27
53
  }
28
54
  }
29
55
 
30
56
  const styles = StyleSheet.create({
57
+ container: {
58
+ flex: 1,
59
+ },
31
60
  webview: {
32
61
  flex: 1,
33
62
  }
34
63
  });
35
-
36
- export default new PayWall();
@@ -0,0 +1,15 @@
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
+ }
@@ -4,4 +4,5 @@ export { default as Storage } from './Storage';
4
4
  export { default as Session } from './Session';
5
5
  export { default as Utils } from './Utils';
6
6
  export { default as PayWall } from './PayWall';
7
+ export { default as PayWall2 } from './PayWall2';
7
8
 
package/types/index.d.ts CHANGED
@@ -83,10 +83,6 @@ declare module 'apps-sdk' {
83
83
  registerForPushNotificationsAsync(): Promise<string>;
84
84
  }
85
85
 
86
- export class PayWall {
87
- showPayWall(url: string): Promise<void>;
88
- }
89
-
90
86
  export class AppsSDK {
91
87
  initializePushNotifications(): Promise<string>;
92
88
  }
@@ -97,7 +93,6 @@ declare module 'apps-sdk' {
97
93
  storage: Storage;
98
94
  session: Session;
99
95
  utils: Utils;
100
- payWall: PayWall;
101
96
  }
102
97
 
103
98
  const Core: AppsSDK;