apps-sdk 1.1.3 → 1.1.5

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.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  "expo-store-review": "~8.0.1",
31
31
  "expo-tracking-transparency": "~5.1.1",
32
32
  "franc-min": "^6.2.0",
33
- "mixpanel-react-native": "^3.0.8",
33
+ "mixpanel-react-native": "^3.0.9",
34
34
  "react-native": "0.76.7",
35
35
  "react-native-adapty": "^3.3.1",
36
36
  "react-native-adjust": "^5.0.2",
@@ -24,6 +24,22 @@ class MixPanel {
24
24
  }
25
25
  }
26
26
 
27
+ async getDistinctID() {
28
+ if (!this.mixpanel) {
29
+ console.log('Mixpanel is not initialized');
30
+ return null;
31
+ }
32
+
33
+ try {
34
+ const distinctId = await this.mixpanel.getDistinctId();
35
+ console.log('Current distinct ID:', distinctId);
36
+ return distinctId;
37
+ } catch (error) {
38
+ console.error('Error getting distinct ID:', error);
39
+ return null;
40
+ }
41
+ }
42
+
27
43
  async trackEvent(eventName, properties = {}) {
28
44
  if (!this.mixpanel) {
29
45
  console.log('Mixpanel is not initialized');
@@ -63,7 +79,8 @@ class MixPanel {
63
79
 
64
80
  try {
65
81
  if (!this.devMode) {
66
- if (config.TRACKING_ACTIVE) {
82
+ const trackingPermissionAnswered = await Storage.getData('TRACKING_PERMISSION_ANSWERED');
83
+ if (config.TRACKING_ACTIVE || !trackingPermissionAnswered) {
67
84
  await this.mixpanel.registerSuperProperties(properties);
68
85
  config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
69
86
  } else {
@@ -102,7 +119,7 @@ class MixPanel {
102
119
  }
103
120
 
104
121
  try {
105
- if (!this.devMode) {
122
+ if (!this.devMode && userID) {
106
123
  await this.mixpanel.identify(userID);
107
124
  config.DEBUG_MODE && console.log('MixPanel User identified:', userID);
108
125
  } else {
package/types/index.d.ts CHANGED
@@ -181,6 +181,7 @@ declare module 'apps-sdk' {
181
181
 
182
182
  export class MixPanel {
183
183
  initialize(token?: string, trackAutomaticEvents?: boolean, useNative?: boolean, devMode?: boolean): Promise<void>;
184
+ getDistinctID(): Promise<string>;
184
185
  trackEvent(event: string, properties?: object): Promise<void>;
185
186
  trackEventIfExist(eventKeyword: string, eventData?: object): Promise<void>;
186
187
  isMixpanelInitialized(): boolean;