apps-sdk 1.1.22 → 1.1.24

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.22",
3
+ "version": "1.1.24",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -134,6 +134,22 @@ class Adapty {
134
134
  return null;
135
135
  }
136
136
  }
137
+
138
+ async updateAdjustAttributionData(adjustData) {
139
+ try {
140
+ await adapty.updateAttribution(adjustData, 'adjust');
141
+ } catch (error) {
142
+ console.error('Error updating attribution data:', error);
143
+ }
144
+ }
145
+
146
+ async setAdjustIntegrationIdentifier(integrationIdentifier) {
147
+ try {
148
+ await adapty.setIntegrationIdentifier('adjust_device_id', integrationIdentifier);
149
+ } catch (error) {
150
+ console.error('Error setting integration identifier:', error);
151
+ }
152
+ }
137
153
  }
138
154
 
139
155
  export default new Adapty();
@@ -57,12 +57,17 @@ class PayWallLogic {
57
57
  "subscription_status": "premium",
58
58
  "plan_type": purchase.productId,
59
59
  });
60
- if (purchaseResponse.subs_previous_id || data.subs_id) {
61
- await Mixpanel.resetUserID();
62
- await Mixpanel.identifyUser(purchaseResponse.subs_previous_id || data.subs_id);
63
- console.log('SDK purchaseUpdatedListener Mixpanel identifyUser', data.subs_id);
60
+ if (purchaseResponse.data.origin_user_id) {
61
+ const currentMixpanelUser = await Mixpanel.getDistinctID();
62
+ if (currentMixpanelUser !== purchaseResponse.data.origin_user_id) {
63
+ await Mixpanel.resetUserID();
64
+ await Mixpanel.identifyUser(purchaseResponse.data.origin_user_id);
65
+ console.log('SDK purchaseUpdatedListener Mixpanel identifyUser by previous user', data.subs_id);
66
+ } else {
67
+ console.log('SDK purchaseUpdatedListener Mixpanel identifyUser not needed (same user_id)');
68
+ }
64
69
  } else {
65
- console.log('No subs_id in purchaseResp');
70
+ console.log('SDK purchaseUpdatedListener Mixpanel identifyUser (origin_user_id missing)');
66
71
  }
67
72
  await Mixpanel.superProperties({
68
73
  "subscription_status": "premium",
@@ -92,12 +97,17 @@ class PayWallLogic {
92
97
  if (data.source) {
93
98
  Networking.sendEvent('action', 'subscription_from_source', {source: data.source});
94
99
  }
95
- if (data.subs_id) {
96
- await Mixpanel.resetUserID();
97
- await Mixpanel.identifyUser(data.subs_id);
98
- console.log('SDK purchaseUpdatedListener Mixpanel identifyUser', data.subs_id);
100
+ if (purchaseResponse.data.origin_user_id) {
101
+ const currentMixpanelUser = await Mixpanel.getDistinctID();
102
+ if (currentMixpanelUser !== purchaseResponse.data.origin_user_id) {
103
+ await Mixpanel.resetUserID();
104
+ await Mixpanel.identifyUser(purchaseResponse.data.origin_user_id);
105
+ console.log('SDK purchaseUpdatedListener Mixpanel identifyUser by previous user', data.subs_id);
106
+ } else {
107
+ console.log('SDK purchaseUpdatedListener Mixpanel identifyUser not needed (same user_id)');
108
+ }
99
109
  } else {
100
- console.log('No subs_id in purchaseResp');
110
+ console.log('SDK purchaseUpdatedListener Mixpanel identifyUser (origin_user_id missing)');
101
111
  }
102
112
  await Mixpanel.superProperties({
103
113
  "subscription_status": "premium",
package/types/index.d.ts CHANGED
@@ -219,6 +219,8 @@ declare module 'apps-sdk' {
219
219
  preloadPaywall(placementID: any, lang: any): Promise<any>
220
220
  showPaywallPreloaded(paywallView: any, eventHandlers?: PaywallEventHandlers): Promise<void>;
221
221
  getProfile(): Promise<any>;
222
+ updateAdjustAttributionData(attribution: any): Promise<void>;
223
+ setAdjustIntegrationIdentifier(adjustIntegrationIdentifier: string): Promise<void>;
222
224
  }
223
225
 
224
226
  export class TrackingTransparency {