apps-sdk 1.1.83 → 1.1.84

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.83",
3
+ "version": "1.1.84",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "author": "ASD",
@@ -105,18 +105,42 @@ class MixPanel {
105
105
  async identifyUser(userID) {
106
106
  if (!this.mixpanel) {
107
107
  console.log('Mixpanel is not initialized');
108
+ Networking.sendEvent('other', 'mixpanel_sdk_identify_failed', {
109
+ user_id: userID,
110
+ error: 'mixpanel_not_initialized'
111
+ });
108
112
  return;
109
113
  }
110
-
111
114
  try {
112
- if (!this.devMode && userID) {
115
+ // format: YYYYMMDDHHMMSS_[hash_hexadecimal]
116
+ const userIDRegex = /^\d{14}_[a-f0-9]+$/;
117
+ const isValidFormat = userIDRegex.test(userID);
118
+
119
+ if (!this.devMode && userID && isValidFormat) {
113
120
  await this.mixpanel.identify(userID);
121
+
122
+ Networking.sendEvent('other', 'mixpanel_sdk_identify_success', {
123
+ user_id: userID
124
+ });
125
+
114
126
  config.DEBUG_MODE && console.log('MixPanel User identified:', userID);
127
+ } else if (!this.devMode && userID && !isValidFormat) {
128
+ console.error('MixPanel: Invalid userID format. Expected format: YYYYMMDDHHMMSS_[hex], received:', userID);
129
+
130
+ Networking.sendEvent('other', 'mixpanel_sdk_identify_failed', {
131
+ user_id: userID,
132
+ error: 'invalid_format'
133
+ });
115
134
  } else {
116
135
  config.DEBUG_MODE && console.log('MixPanel User identified but not send (DEV_MODE ON):', userID);
117
136
  }
118
137
  } catch (error) {
119
138
  console.error('Error identifying user:', error);
139
+
140
+ Networking.sendEvent('other', 'mixpanel_sdk_identify_failed', {
141
+ user_id: userID,
142
+ error: error.message
143
+ });
120
144
  }
121
145
  }
122
146
 
@@ -51,13 +51,23 @@ class NotificationsPush {
51
51
  try {
52
52
  const {status: existingStatus} = await Notifications.getPermissionsAsync();
53
53
  let finalStatus = existingStatus;
54
+
54
55
  if (existingStatus !== 'granted') {
56
+ Networking.sendEvent('other', 'push_banner_shown', { platform: Platform.OS });
57
+ MixPanel.trackEvent('push_banner_shown', { platform: Platform.OS });
58
+
55
59
  const {status} = await Notifications.requestPermissionsAsync();
56
60
  finalStatus = status;
61
+
57
62
  if (finalStatus === 'granted') {
58
- Networking.sendEvent('action', 'allow_notifications');
63
+ Networking.sendEvent('other', 'push_permission_granted', { platform: Platform.OS });
64
+ MixPanel.trackEvent('push_permission_granted', { platform: Platform.OS });
65
+ } else {
66
+ Networking.sendEvent('other', 'push_permission_denied', { platform: Platform.OS });
67
+ MixPanel.trackEvent('push_permission_denied', { platform: Platform.OS });
59
68
  }
60
69
  }
70
+
61
71
  if (finalStatus === 'granted') {
62
72
  token = (await Notifications.getExpoPushTokenAsync({"projectId": Constants.expoConfig.extra.eas.projectId})).data;
63
73
  console.log('Notification token', token);