apps-sdk 1.1.11 → 1.1.14

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.11",
3
+ "version": "1.1.14",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,7 +40,7 @@ class MixPanel {
40
40
  }
41
41
  }
42
42
 
43
- async trackEvent(eventName, properties = {}) {
43
+ async trackEvent(eventName, properties = {}, forceSend = false) {
44
44
  if (!this.mixpanel) {
45
45
  console.log('Mixpanel is not initialized');
46
46
  return;
@@ -49,7 +49,7 @@ class MixPanel {
49
49
  try {
50
50
  if (!this.devMode) {
51
51
  const trackingPermissionAnswered = await Storage.getData('TRACKING_PERMISSION_ANSWERED');
52
- if (config.TRACKING_ACTIVE || !trackingPermissionAnswered) {
52
+ if (config.TRACKING_ACTIVE || !trackingPermissionAnswered || forceSend) {
53
53
  await this.mixpanel.track(eventName, properties);
54
54
  config.DEBUG_MODE && console.log(`MixPanel Event tracked: ${eventName} with properties:`, properties);
55
55
  } else {
@@ -81,10 +81,10 @@ class MixPanel {
81
81
  if (!this.devMode) {
82
82
  const trackingPermissionAnswered = await Storage.getData('TRACKING_PERMISSION_ANSWERED');
83
83
  if (config.TRACKING_ACTIVE || !trackingPermissionAnswered) {
84
- const distinctId = await this.getDistinctID();
85
- const superProperties = { ...properties, distinct_id: distinctId };
86
- await this.mixpanel.registerSuperProperties(superProperties);
87
- config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', superProperties);
84
+ // const distinctId = await this.getDistinctID();
85
+ // const superProperties = { ...properties, distinct_id: distinctId };
86
+ await this.mixpanel.registerSuperProperties(properties);
87
+ config.DEBUG_MODE && console.log('MixPanel Super Properties registered:', properties);
88
88
  } else {
89
89
  config.DEBUG_MODE && console.log('MixPanel Super Properties not registered due to tracking permission:', properties);
90
90
  }
@@ -104,10 +104,10 @@ class MixPanel {
104
104
 
105
105
  try {
106
106
  if (!this.devMode) {
107
- const distinctId = await this.getDistinctID();
108
- const superProperties = { ...properties, distinct_id: distinctId };
109
- await this.mixpanel.registerSuperPropertiesOnce(superProperties);
110
- config.DEBUG_MODE && console.log('MixPanel Super Properties appended:', superProperties);
107
+ // const distinctId = await this.getDistinctID();
108
+ // const superProperties = { ...properties, distinct_id: distinctId };
109
+ await this.mixpanel.registerSuperPropertiesOnce(properties);
110
+ config.DEBUG_MODE && console.log('MixPanel Super Properties appended:', properties);
111
111
  } else {
112
112
  config.DEBUG_MODE && console.log('MixPanel Super Properties appended but not send (DEV_MODE ON):', properties);
113
113
  }
@@ -134,7 +134,8 @@ class MixPanel {
134
134
  }
135
135
  }
136
136
 
137
- async setUserProperty(propertyName, propertyValue) {
137
+
138
+ async setUserProperties(properties) {
138
139
  if (!this.mixpanel) {
139
140
  console.log('Mixpanel is not initialized');
140
141
  return;
@@ -142,15 +143,13 @@ class MixPanel {
142
143
 
143
144
  try {
144
145
  if (!this.devMode) {
145
- const distinctId = await this.getDistinctID();
146
- const userProperties = { [propertyName]: propertyValue, distinct_id: distinctId };
147
- await this.mixpanel.getPeople().set(userProperties);
148
- config.DEBUG_MODE && console.log(`MixPanel User property set: ${propertyName} = ${propertyValue}, distinct_id = ${distinctId}`);
146
+ await this.mixpanel.getPeople().set(properties);
147
+ config.DEBUG_MODE && console.log('MixPanel User properties set:', properties);
149
148
  } else {
150
- config.DEBUG_MODE && console.log(`MixPanel User property set but not send (DEV_MODE ON): ${propertyName} = ${propertyValue}`);
149
+ config.DEBUG_MODE && console.log('MixPanel User properties set but not send (DEV_MODE ON):', properties);
151
150
  }
152
151
  } catch (error) {
153
- console.error('Error setting user property:', error);
152
+ console.error('Error setting user properties:', error);
154
153
  }
155
154
  }
156
155
 
@@ -13,7 +13,7 @@ class HomeActions {
13
13
  }
14
14
 
15
15
  async itemCallback(itemCallbackFunction) {
16
- console.log("itemCallback", itemCallback);
16
+ console.log("itemCallback", itemCallbackFunction);
17
17
  useQuickActionCallback(action => {
18
18
  if (action) {
19
19
  console.log("action", action);
package/types/index.d.ts CHANGED
@@ -188,7 +188,7 @@ declare module 'apps-sdk' {
188
188
  superProperties(properties: object): Promise<void>;
189
189
  superPropertiesAppend(properties: object): Promise<void>;
190
190
  identifyUser(userID: string): Promise<void>;
191
- setUserProperty(property: string, value: any): Promise<void>;
191
+ setUserProperties(properties: any): Promise<void>;
192
192
  disableTracking(): Promise<void>;
193
193
  enableTracking(): Promise<void>;
194
194
  }