apps-sdk 1.0.107 → 1.0.109
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"description": "Apps SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"@react-native-async-storage/async-storage": "^1.21.0",
|
|
14
14
|
"@react-native-community/netinfo": "11.1.0",
|
|
15
15
|
"crypto-es": "^2.1.0",
|
|
16
|
-
"expo-camera": "~14.1.3",
|
|
17
16
|
"expo-constants": "^15.4.5",
|
|
18
17
|
"expo-device": "^5.9.3",
|
|
19
18
|
"expo-file-system": "~16.0.8",
|
|
@@ -4,6 +4,7 @@ import {WebView} from 'react-native-webview';
|
|
|
4
4
|
import {View} from "react-native";
|
|
5
5
|
import Utils from "../libraries/Utils";
|
|
6
6
|
import Networking from "../libraries/Networking";
|
|
7
|
+
import Storage from "../libraries/Storage";
|
|
7
8
|
import PayWallLogic from "../libraries/PayWallLogic";
|
|
8
9
|
import Session from "../libraries/Session";
|
|
9
10
|
import * as Linking from 'expo-linking';
|
|
@@ -52,11 +53,12 @@ class PayWall extends React.Component {
|
|
|
52
53
|
if (this.props.visible && !prevProps.visible && this.paywallData.url) {
|
|
53
54
|
this.webviewRef.current.injectJavaScript(PayWallLogic.paywallJS);
|
|
54
55
|
Networking.sendEvent('scene', 'payment_card', { user_id: Session.getUserID(), card_id: this.getCardID(), scene: 'payment_card' });
|
|
56
|
+
Storage.storeData('PAYWALL_DSNID', this.getCardID());
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
getCardID = () => {
|
|
59
|
-
return this.getDesignIDFromURL(this.paywallData.url);
|
|
61
|
+
return this.getDesignIDFromURL(this.paywallData.url) || '';
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
// --------------------------------------- Eventos ---------------------------------------
|
|
@@ -66,17 +68,21 @@ class PayWall extends React.Component {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
eventClickSubscribe = (data) => {
|
|
69
|
-
Networking.sendEvent('
|
|
71
|
+
Networking.sendEvent('other', 'cta_click_init');
|
|
70
72
|
if (this.paywallData && data.id && data.id.length > 0 && this.paywallData.products_id && this.paywallData.products_id.length > 0) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
Storage.getData('PAYWALL_DSNID').then((dsn_id) => {
|
|
74
|
+
Networking.sendEvent('action', 'cta', {product_id: data.id, dsn_id: dsn_id || ''});
|
|
75
|
+
let subscribed = PayWallLogic.executePurchase(data.id, this.hideSpinner, this.hidePayWall).then((subscribed) => {
|
|
76
|
+
console.log('subscription result: ', subscribed);
|
|
77
|
+
if (subscribed) {
|
|
78
|
+
this.props.onSubscribe(false);
|
|
79
|
+
} else {
|
|
80
|
+
this.props.onPaymentError();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
78
83
|
});
|
|
79
84
|
} else {
|
|
85
|
+
Networking.sendEvent('other', 'cta_click_error_paywall_data');
|
|
80
86
|
this.props.onPaymentError();
|
|
81
87
|
}
|
|
82
88
|
}
|
|
@@ -140,6 +146,8 @@ class PayWall extends React.Component {
|
|
|
140
146
|
if (!this.paywallData.url) {
|
|
141
147
|
config.DEBUG_MODE && console.log('PayWallLogic: paywallData no tiene url para este type / keyword -> ' + type + ' / ' + keyword);
|
|
142
148
|
return null;
|
|
149
|
+
} else {
|
|
150
|
+
Storage.storeData('PAYWALL_DSNID', this.getCardID());
|
|
143
151
|
}
|
|
144
152
|
|
|
145
153
|
return (
|
|
@@ -99,10 +99,12 @@ class PayWallLogic {
|
|
|
99
99
|
if (source) {
|
|
100
100
|
final_source = source;
|
|
101
101
|
}
|
|
102
|
+
const dns_id = await Storage.getData('PAYWALL_DSNID');
|
|
102
103
|
config.DEBUG_MODE && console.log('purchaseResp final_source', final_source);
|
|
103
104
|
return {
|
|
104
105
|
subs_id: purchaseToken,
|
|
105
106
|
product_id: subscription.productId,
|
|
107
|
+
dns_id: dns_id || '',
|
|
106
108
|
source: final_source,
|
|
107
109
|
};
|
|
108
110
|
}
|
package/src/libraries/Session.js
CHANGED
package/src/libraries/Storage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2
2
|
import * as MediaLibrary from 'expo-media-library';
|
|
3
|
-
import
|
|
3
|
+
// import {Camera} from 'expo-camera';
|
|
4
4
|
import * as FileSystem from 'expo-file-system';
|
|
5
5
|
import * as Sharing from 'expo-sharing';
|
|
6
6
|
import Networking from "./Networking";
|
|
@@ -61,19 +61,19 @@ class Storage {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
async handleRequestCameraPermission() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
64
|
+
// async handleRequestCameraPermission() {
|
|
65
|
+
// try {
|
|
66
|
+
// const { status } = await Camera.requestCameraPermissionsAsync();
|
|
67
|
+
// if (status === 'granted') {
|
|
68
|
+
// await this.storeData('CAMERA_PERMISSION', 'granted');
|
|
69
|
+
// Networking.sendEvent('action', 'camera_consent');
|
|
70
|
+
// }
|
|
71
|
+
// return status;
|
|
72
|
+
// } catch (error) {
|
|
73
|
+
// console.log('Error al solicitar permiso de cámara:', error);
|
|
74
|
+
// return 'denied';
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
77
77
|
|
|
78
78
|
async handleRequestGalleryPermission() {
|
|
79
79
|
try {
|
package/types/index.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ declare module 'apps-sdk' {
|
|
|
95
95
|
deleteCreation(dirName: string): Promise<void>;
|
|
96
96
|
deleteAllCreations(): Promise<void>;
|
|
97
97
|
handleDownloadImageToGallery(imageURI: string): Promise<string>;
|
|
98
|
-
handleRequestCameraPermission(): Promise<string>;
|
|
98
|
+
// handleRequestCameraPermission(): Promise<string>;
|
|
99
99
|
handleRequestGalleryPermission(): Promise<string>;
|
|
100
100
|
setTrackingPermissionGranted(value: boolean): Promise<void>;
|
|
101
101
|
setTrackingPermissionFromStorage(): Promise<void>;
|