apps-sdk 1.0.47 → 1.0.48

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.47",
3
+ "version": "1.0.48",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,11 +1,15 @@
1
- import { Adjust, AdjustEvent, AdjustConfig } from 'react-native-adjust';
1
+ import { Adjust, AdjustEvent, AdjustConfig, AdjustPlayStoreSubscription, AdjustAppStoreSubscription, AdjustAttribution } from 'react-native-adjust';
2
2
  import * as config from '../../config';
3
3
  import { default as storage } from './Storage';
4
+ import {Platform} from "react-native";
4
5
 
5
6
  class AdJust {
6
7
  initialize() {
7
8
  const adjustConfig = new AdjustConfig(config.ADJUST.ADJUST_TOKEN, config.ADJUST.ENVIRONMENT === 'SANDBOX' ? AdjustConfig.EnvironmentSandbox : AdjustConfig.EnvironmentProduction);
8
9
  adjustConfig.setLogLevel(config.ADJUST.LOG_LEVEL === 'VERBOSE' ? AdjustConfig.LogLevelVerbose : AdjustConfig.LogLevelSuppress);
10
+ adjustConfig.setAttributionCallbackListener(function(attribution) {
11
+ console.log("Attribution callback received: ", JSON.stringify(attribution));
12
+ });
9
13
  Adjust.create(adjustConfig);
10
14
  }
11
15
 
@@ -13,7 +17,7 @@ class AdJust {
13
17
  let finalKeyword = eventKeyword;
14
18
  if (config.EVENTS[finalKeyword]) {
15
19
  if (this.isSpecialEvent(eventKeyword)) {
16
- const finalKeyword = 'first_' + eventKeyword;
20
+ finalKeyword = 'first_' + eventKeyword;
17
21
  if (config.EVENTS[finalKeyword]) {
18
22
  const alreadySent = storage.getData(finalKeyword);
19
23
  if (!alreadySent) {
@@ -32,8 +36,29 @@ class AdJust {
32
36
  }
33
37
  }
34
38
 
39
+ storeSubscription(subscriptionData) {
40
+ if (Platform.OS === 'android') {
41
+ const subscription = new AdjustPlayStoreSubscription(
42
+ subscriptionData.price,
43
+ subscriptionData.currency,
44
+ subscriptionData.sku,
45
+ subscriptionData.orderId,
46
+ subscriptionData.signature,
47
+ subscriptionData.purchaseToken);
48
+ subscription.setPurchaseTime(subscriptionData.purchaseTime);
49
+ } else {
50
+ const subscription = new AdjustAppStoreSubscription(
51
+ subscriptionData.price,
52
+ subscriptionData.currency,
53
+ subscriptionData.transactionId,
54
+ subscriptionData.receipt);
55
+ subscription.setTransactionDate(subscriptionData.transactionDate);
56
+ subscription.setSalesRegion(subscriptionData.salesRegion);
57
+ }
58
+ }
59
+
35
60
  isSpecialEvent(eventKeyword) {
36
- return config.SPECIAL_EVENTS[eventKeyword] ? config.SPECIAL_EVENTS[eventKeyword] : false;
61
+ return config.SPECIAL_EVENTS.includes(eventKeyword);
37
62
  }
38
63
  }
39
64