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 CHANGED
@@ -9,6 +9,12 @@ export var ENDPOINTS = {
9
9
 
10
10
  export var EVENTS = {}
11
11
 
12
+ export var PAYWALL_DATA = {
13
+ actions: {},
14
+ scenes: {},
15
+ others: {}
16
+ }
17
+
12
18
  export const EVENT_TYPES = {
13
19
  ACTION: 'action',
14
20
  SCENE: 'scene',
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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 {
@@ -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
- this.webviewRef.injectJavaScript(
71
- `Appquiles.emitAppEvent(${JSON.stringify(event)});`,
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, { ComponentType } from '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 React.Component<PayWallProps, {}> {
96
- }
95
+ export class PayWall extends Component<PayWallProps, {}> {}
97
96
 
98
97
  export class AppsSDK {
99
98
  initializePushNotifications(): Promise<string>;