apps-sdk 1.0.29 → 1.0.31

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.29",
3
+ "version": "1.0.31",
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,15 +1,10 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  import { WebView } from 'react-native-webview';
3
3
  import { BottomSheet } from 'react-native-btr';
4
4
  import Utils from "./Utils";
5
5
  import { StyleSheet, View, Dimensions } from 'react-native';
6
6
 
7
- class PayWall extends React.Component {
8
- constructor(props) {
9
- super(props);
10
- this.state = { isVisible: false, url: null };
11
- }
12
-
7
+ export default class PayWall extends React.Component {
13
8
  webviewRef = React.createRef();
14
9
  bottomSheetRef = React.createRef();
15
10
 
@@ -27,17 +22,9 @@ class PayWall extends React.Component {
27
22
  return "window.subInfoInterval = setInterval(() => window.Appquiles && Appquiles.setSubscriptionPlans(" + JSON.stringify(information.subsPlansInfo) + "), 300);";
28
23
  }
29
24
 
30
- show = (url) => {
31
- this.setState({ isVisible: true, url: url });
32
- }
33
-
34
- hide = () => {
35
- this.setState({ isVisible: false, url: null });
36
- }
37
-
38
25
  render() {
39
26
  return (
40
- this.state.isVisible &&
27
+ this.props.isVisible &&
41
28
  <View style={styles.container}>
42
29
  <BottomSheet
43
30
  ref={this.bottomSheetRef}
@@ -53,7 +40,7 @@ class PayWall extends React.Component {
53
40
  >
54
41
  <WebView
55
42
  style={styles.webview}
56
- source={{ uri: this.state.url }}
43
+ source={{ uri: this.props.url }}
57
44
  javaScriptEnabled
58
45
  ref={this.webviewRef}
59
46
  onMessage={this.handleMessage}
@@ -74,5 +61,3 @@ const styles = StyleSheet.create({
74
61
  flex: 1,
75
62
  }
76
63
  });
77
-
78
- 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
@@ -1,4 +1,8 @@
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';
5
+
2
6
  export interface SessionData {
3
7
  app: {
4
8
  shortVersion: string;
@@ -83,11 +87,13 @@ declare module 'apps-sdk' {
83
87
  registerForPushNotificationsAsync(): Promise<string>;
84
88
  }
85
89
 
86
- export class PayWall {
87
- show(url: string): void;
88
- hide(): void;
90
+ export interface PayWallProps extends BottomSheetProps {
91
+ visible: boolean;
92
+ onClose: () => void;
89
93
  }
90
94
 
95
+ export const PayWall2: ComponentType<PayWallProps>;
96
+
91
97
  export class AppsSDK {
92
98
  initializePushNotifications(): Promise<string>;
93
99
  }
@@ -98,7 +104,6 @@ declare module 'apps-sdk' {
98
104
  storage: Storage;
99
105
  session: Session;
100
106
  utils: Utils;
101
- paywall: PayWall;
102
107
  }
103
108
 
104
109
  const Core: AppsSDK;