apps-sdk 1.0.35 → 1.0.37
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/config.js +6 -0
- package/index.js +0 -1
- package/package.json +1 -1
- package/src/libraries/Networking.js +31 -0
- package/src/libraries/PayWall.js +7 -4
- package/types/index.d.ts +2 -3
package/config.js
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,6 @@ class AppsSDK {
|
|
|
6
6
|
|
|
7
7
|
return NotificationsPush.registerForPushNotificationsAsync().then(async (expoToken) => {
|
|
8
8
|
return expoToken
|
|
9
|
-
// const setExpoToken = await Networking.setExpoToken({expo_id : expoToken, user_id : Session._info.user_id, ...Session._info} )
|
|
10
9
|
})
|
|
11
10
|
}
|
|
12
11
|
}
|
package/package.json
CHANGED
|
@@ -47,6 +47,7 @@ class Networking {
|
|
|
47
47
|
config.DEBUG_MODE && console.debug("initData", JSON.stringify(initData));
|
|
48
48
|
this.setEndpoints(initData.data.domains);
|
|
49
49
|
this.setEvents(initData.data.attribution);
|
|
50
|
+
this.setPayWallData(initData);
|
|
50
51
|
}
|
|
51
52
|
} catch (error) {
|
|
52
53
|
console.error(error);
|
|
@@ -151,6 +152,36 @@ class Networking {
|
|
|
151
152
|
events && (config.EVENTS = events);
|
|
152
153
|
}
|
|
153
154
|
|
|
155
|
+
setPayWallData(data) {
|
|
156
|
+
let result = {
|
|
157
|
+
actions: {},
|
|
158
|
+
scenes: {},
|
|
159
|
+
others: {}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
if (data && data.data && data.data.purchase) {
|
|
163
|
+
if (data.data.purchase.actions) {
|
|
164
|
+
data.data.purchase.actions.forEach(action => {
|
|
165
|
+
result.actions[action.identifier] = action;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (data.data.purchase.scenes) {
|
|
169
|
+
data.data.purchase.scenes.forEach(scene => {
|
|
170
|
+
result.scenes[scene.identifier] = scene;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (data.data.purchase.others) {
|
|
174
|
+
data.data.purchase.others.forEach(other => {
|
|
175
|
+
result.others[other.identifier] = other;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (result) {
|
|
181
|
+
config.PAYWALL_DATA = result;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
154
185
|
sendEvent = async (eventType, eventKeyword, eventData={}) => {
|
|
155
186
|
config.DEBUG_MODE && console.debug("sendEvent", eventType, eventKeyword, eventData);
|
|
156
187
|
try {
|
package/src/libraries/PayWall.js
CHANGED
|
@@ -19,7 +19,9 @@ class PayWall extends React.Component {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
getPayWallJS = () => {
|
|
22
|
-
return "";
|
|
22
|
+
// return "window.subInfoInterval = setInterval(() => window.Appquiles && Appquiles.setSubscriptionPlans(" + JSON.stringify(information.subsPlansInfo) + "), 300);" : '';
|
|
23
|
+
return "window.subInfoInterval = setInterval(() => window.Appquiles, 300);";
|
|
24
|
+
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
getPayWallData = (type, keyword) => {
|
|
@@ -56,7 +58,7 @@ class PayWall extends React.Component {
|
|
|
56
58
|
eventClickSubscribe = (data) => {
|
|
57
59
|
Networking.sendEvent('action', 'cta');
|
|
58
60
|
setTimeout(() => {
|
|
59
|
-
hideSpinner();
|
|
61
|
+
this.hideSpinner();
|
|
60
62
|
}, 3000);
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -67,8 +69,9 @@ class PayWall extends React.Component {
|
|
|
67
69
|
status: true,
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
console.log('SDK setHideLoaderAppquiles',event);
|
|
73
|
+
this.webviewRef.current.injectJavaScript(
|
|
74
|
+
`Appquiles.emitAppEvent(${JSON.stringify(event)});$('.spinner').hide();`
|
|
72
75
|
)
|
|
73
76
|
}
|
|
74
77
|
// --------------------------------------- Eventos ---------------------------------------
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'apps-sdk' {
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
3
|
|
|
4
4
|
export interface SessionData {
|
|
5
5
|
app: {
|
|
@@ -92,8 +92,7 @@ declare module 'apps-sdk' {
|
|
|
92
92
|
keyword: string;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
export class PayWall extends
|
|
96
|
-
}
|
|
95
|
+
export class PayWall extends Component<PayWallProps, {}> {}
|
|
97
96
|
|
|
98
97
|
export class AppsSDK {
|
|
99
98
|
initializePushNotifications(): Promise<string>;
|