apps-sdk 1.0.193 → 1.0.195

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.193",
3
+ "version": "1.0.195",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import * as config from '../../config';
2
2
  import NetInfo from "@react-native-community/netinfo";
3
- import { default as storage } from './Storage';
3
+ import Storage, { default as storage } from './Storage';
4
4
  import Session from './Session';
5
5
  import AdJust from './AdJust';
6
6
  import MixPanel from "./MixPanel";
@@ -154,7 +154,14 @@ class Networking {
154
154
  let subStatus = await this.request(config.ENDPOINTS.SUB_STATUS, {...Session.sessionData, subs_id: subsID});
155
155
  console.log('checkSubscription', subStatus);
156
156
  if (subStatus && subStatus.success === 1) {
157
+ const currentSubscriptionStatus = await storage.getData('isSubscribed');
157
158
  await Session.setIsSubscribed(subStatus.data.subscription_active);
159
+ if (currentSubscriptionStatus === false && !subStatus.data.subscription_active === true) {
160
+ await MixPanel.superProperties({
161
+ "subscription_status": "free",
162
+ "plan_type": "free",
163
+ });
164
+ }
158
165
  await Session.setSubscriptionData(subStatus.data);
159
166
  return true;
160
167
  }
@@ -2,6 +2,7 @@ import {Platform} from "react-native";
2
2
  import Networking from "./Networking";
3
3
  import Storage from "./Storage";
4
4
  import Session from "./Session";
5
+ import Mixpanel from "./MixPanel";
5
6
  import * as config from "../../config";
6
7
 
7
8
  import {
@@ -52,6 +53,11 @@ class PayWallLogic {
52
53
  if (data.source) {
53
54
  Networking.sendEvent('other', 'subscription_from_source', {source: data.source});
54
55
  }
56
+ Mixpanel.superProperties({
57
+ "subscription_status": "premium",
58
+ "plan_type": purchase.productId,
59
+ });
60
+ Mixpanel.identifyUser(data.subs_id);
55
61
  }
56
62
  }
57
63
  } catch (error) {
@@ -76,6 +82,11 @@ class PayWallLogic {
76
82
  if (data.source) {
77
83
  Networking.sendEvent('action', 'subscription_from_source', {source: data.source});
78
84
  }
85
+ Mixpanel.superProperties({
86
+ "subscription_status": "premium",
87
+ "plan_type": purchase.productId,
88
+ });
89
+ Mixpanel.identifyUser(data.subs_id);
79
90
  } else {
80
91
  console.log('SDK checkSubscription fail')
81
92
  }