apps-sdk 1.0.104 → 1.0.105

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.104",
3
+ "version": "1.0.105",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -152,6 +152,7 @@ class Networking {
152
152
  }
153
153
 
154
154
  createSubscription = async (data) => {
155
+ config.DEBUG_MODE && console.debug("createSubscription", data);
155
156
  return this.request(config.ENDPOINTS.SUB_NEW, data);
156
157
  }
157
158
 
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
1
  import {Platform} from "react-native";
3
2
  import Networking from "./Networking";
3
+ import Storage from "./Storage";
4
4
  import Session from "./Session";
5
5
  import * as config from "../../config";
6
6
 
@@ -43,7 +43,7 @@ class PayWallLogic {
43
43
  const subscription = await getSubscriptions({skus: [purchase.productId]})
44
44
  const s = subscription[0];
45
45
  await finishTransaction({purchase: purchase});
46
- let data = this.purchaseResp(s,purchase.purchaseToken)
46
+ let data = await this.purchaseResp(s,purchase.purchaseToken)
47
47
  const purchaseResponse = await Networking.createSubscription(data);
48
48
  if(purchaseResponse.success){
49
49
  Session.setIsSubscribed(true);
@@ -64,7 +64,7 @@ class PayWallLogic {
64
64
  const subscription = await getSubscriptions({skus: [purchase.productId]})
65
65
  const s = subscription[0];
66
66
  await finishTransaction({purchase: purchase,isConsumable:true});
67
- let data = this.purchaseResp(s,(purchase.originalTransactionIdentifierIOS ? purchase.originalTransactionIdentifierIOS : purchase.transactionId))
67
+ let data = await this.purchaseResp(s,(purchase.originalTransactionIdentifierIOS ? purchase.originalTransactionIdentifierIOS : purchase.transactionId))
68
68
  const purchaseResponse = await Networking.createSubscription(data);
69
69
  if(purchaseResponse.success){
70
70
  Session.setIsSubscribed(true);
@@ -92,10 +92,18 @@ class PayWallLogic {
92
92
  }
93
93
  }
94
94
 
95
- purchaseResp = (subscription, purchaseToken) => {
95
+ purchaseResp = async (subscription, purchaseToken) => {
96
+ let final_source = 'unknown';
97
+ const source = await Storage.getData('PAYWALL_ORIGIN');
98
+ config.DEBUG_MODE && console.log('purchaseResp source', source);
99
+ if (source) {
100
+ final_source = source;
101
+ }
102
+ config.DEBUG_MODE && console.log('purchaseResp final_source', final_source);
96
103
  return {
97
104
  subs_id: purchaseToken,
98
105
  product_id: subscription.productId,
106
+ source: final_source,
99
107
  };
100
108
  }
101
109