@datalyr/react-native 1.7.4 → 1.7.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/lib/datalyr-sdk.js +5 -5
- package/lib/http-client.js +2 -2
- package/lib/types.d.ts +2 -2
- package/lib/utils.d.ts +3 -3
- package/lib/utils.js +2 -2
- package/package.json +1 -1
- package/src/datalyr-sdk-expo.ts +5 -5
- package/src/datalyr-sdk.ts +5 -5
- package/src/expo.ts +1 -1
- package/src/http-client.ts +2 -2
- package/src/types.ts +2 -2
- package/src/utils-expo.ts +3 -3
- package/src/utils-interface.ts +2 -2
- package/src/utils.ts +3 -3
package/lib/datalyr-sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform, AppState } from 'react-native';
|
|
2
|
-
import { getOrCreateVisitorId, getOrCreateAnonymousId, getOrCreateSessionId,
|
|
2
|
+
import { getOrCreateVisitorId, getOrCreateAnonymousId, getOrCreateSessionId, createDeviceContext, generateUUID, getDeviceInfo, getNetworkType, validateEventName, validateEventData, debugLog, errorLog, Storage, STORAGE_KEYS, } from './utils';
|
|
3
3
|
import { createHttpClient, HttpClient } from './http-client';
|
|
4
4
|
import { createEventQueue, EventQueue } from './event-queue';
|
|
5
5
|
import { attributionManager } from './attribution';
|
|
@@ -188,7 +188,7 @@ export class DatalyrSDK {
|
|
|
188
188
|
const installData = await attributionManager.trackInstall();
|
|
189
189
|
await this.track('app_install', {
|
|
190
190
|
platform: Platform.OS === 'ios' || Platform.OS === 'android' ? Platform.OS : 'android',
|
|
191
|
-
sdk_version: '1.7.
|
|
191
|
+
sdk_version: '1.7.5',
|
|
192
192
|
...installData,
|
|
193
193
|
});
|
|
194
194
|
}
|
|
@@ -874,7 +874,7 @@ export class DatalyrSDK {
|
|
|
874
874
|
*/
|
|
875
875
|
async createEventPayload(eventName, eventData) {
|
|
876
876
|
const deviceInfo = await getDeviceInfo();
|
|
877
|
-
const
|
|
877
|
+
const deviceContext = await createDeviceContext();
|
|
878
878
|
const attributionData = attributionManager.getAttributionData();
|
|
879
879
|
// Get Apple Search Ads attribution if available
|
|
880
880
|
const asaAttribution = appleSearchAdsIntegration.getAttributionData();
|
|
@@ -919,7 +919,7 @@ export class DatalyrSDK {
|
|
|
919
919
|
carrier: deviceInfo.carrier,
|
|
920
920
|
network_type: getNetworkType(),
|
|
921
921
|
timestamp: Date.now(),
|
|
922
|
-
sdk_version: '1.7.
|
|
922
|
+
sdk_version: '1.7.5',
|
|
923
923
|
// Advertiser data (IDFA/GAID, ATT status) for server-side postback
|
|
924
924
|
...(advertiserInfo ? {
|
|
925
925
|
idfa: advertiserInfo.idfa,
|
|
@@ -933,7 +933,7 @@ export class DatalyrSDK {
|
|
|
933
933
|
// Apple Search Ads attribution
|
|
934
934
|
...asaData,
|
|
935
935
|
},
|
|
936
|
-
|
|
936
|
+
deviceContext,
|
|
937
937
|
source: 'mobile_app',
|
|
938
938
|
timestamp: new Date().toISOString(),
|
|
939
939
|
};
|
package/lib/http-client.js
CHANGED
|
@@ -149,11 +149,11 @@ export class HttpClient {
|
|
|
149
149
|
...payload.eventData,
|
|
150
150
|
sessionId: payload.sessionId,
|
|
151
151
|
source: payload.source || 'mobile_app',
|
|
152
|
-
fingerprint: payload.
|
|
152
|
+
fingerprint: payload.deviceContext,
|
|
153
153
|
},
|
|
154
154
|
context: {
|
|
155
155
|
library: '@datalyr/react-native',
|
|
156
|
-
version: '1.
|
|
156
|
+
version: '1.7.5',
|
|
157
157
|
source: 'mobile_app',
|
|
158
158
|
userProperties: payload.userProperties,
|
|
159
159
|
},
|
package/lib/types.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export interface EventData {
|
|
|
106
106
|
app_build?: string;
|
|
107
107
|
network_type?: string;
|
|
108
108
|
}
|
|
109
|
-
export interface
|
|
109
|
+
export interface DeviceContext {
|
|
110
110
|
deviceId?: string;
|
|
111
111
|
deviceInfo?: {
|
|
112
112
|
model: string;
|
|
@@ -127,7 +127,7 @@ export interface EventPayload {
|
|
|
127
127
|
eventId: string;
|
|
128
128
|
eventName: string;
|
|
129
129
|
eventData?: EventData;
|
|
130
|
-
|
|
130
|
+
deviceContext?: DeviceContext;
|
|
131
131
|
source: 'mobile_app';
|
|
132
132
|
timestamp: string;
|
|
133
133
|
userId?: string;
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'react-native-get-random-values';
|
|
2
|
-
import { DeviceInfo as DeviceInfoType,
|
|
2
|
+
import { DeviceInfo as DeviceInfoType, DeviceContext } from './types';
|
|
3
3
|
export declare const STORAGE_KEYS: {
|
|
4
4
|
VISITOR_ID: string;
|
|
5
5
|
ANONYMOUS_ID: string;
|
|
@@ -45,9 +45,9 @@ export declare const getDeviceInfo: () => Promise<DeviceInfoType>;
|
|
|
45
45
|
*/
|
|
46
46
|
export declare const clearDeviceInfoCache: () => void;
|
|
47
47
|
/**
|
|
48
|
-
* Create
|
|
48
|
+
* Create device context for attribution
|
|
49
49
|
*/
|
|
50
|
-
export declare const
|
|
50
|
+
export declare const createDeviceContext: () => Promise<DeviceContext>;
|
|
51
51
|
/**
|
|
52
52
|
* Get network connection type
|
|
53
53
|
*/
|
package/lib/utils.js
CHANGED
|
@@ -219,9 +219,9 @@ const fetchDeviceInfoInternal = async () => {
|
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
221
|
/**
|
|
222
|
-
* Create
|
|
222
|
+
* Create device context for attribution
|
|
223
223
|
*/
|
|
224
|
-
export const
|
|
224
|
+
export const createDeviceContext = async () => {
|
|
225
225
|
const deviceInfo = await getDeviceInfo();
|
|
226
226
|
return {
|
|
227
227
|
deviceId: deviceInfo.deviceId,
|
package/package.json
CHANGED
package/src/datalyr-sdk-expo.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
getOrCreateVisitorId,
|
|
17
17
|
getOrCreateAnonymousId,
|
|
18
18
|
getOrCreateSessionId,
|
|
19
|
-
|
|
19
|
+
createDeviceContext,
|
|
20
20
|
generateUUID,
|
|
21
21
|
getDeviceInfo,
|
|
22
22
|
getNetworkType,
|
|
@@ -209,7 +209,7 @@ export class DatalyrSDKExpo {
|
|
|
209
209
|
const installData = await attributionManager.trackInstall();
|
|
210
210
|
await this.track('app_install', {
|
|
211
211
|
platform: Platform.OS,
|
|
212
|
-
sdk_version: '1.7.
|
|
212
|
+
sdk_version: '1.7.5',
|
|
213
213
|
sdk_variant: 'expo',
|
|
214
214
|
...installData,
|
|
215
215
|
});
|
|
@@ -758,7 +758,7 @@ export class DatalyrSDKExpo {
|
|
|
758
758
|
|
|
759
759
|
private async createEventPayload(eventName: string, eventData?: EventData): Promise<EventPayload> {
|
|
760
760
|
const deviceInfo = await getDeviceInfo();
|
|
761
|
-
const
|
|
761
|
+
const deviceContext = await createDeviceContext();
|
|
762
762
|
const attributionData = attributionManager.getAttributionData();
|
|
763
763
|
const networkType = getNetworkType();
|
|
764
764
|
|
|
@@ -805,7 +805,7 @@ export class DatalyrSDKExpo {
|
|
|
805
805
|
carrier: deviceInfo.carrier,
|
|
806
806
|
network_type: networkType,
|
|
807
807
|
timestamp: Date.now(),
|
|
808
|
-
sdk_version: '1.7.
|
|
808
|
+
sdk_version: '1.7.5',
|
|
809
809
|
sdk_variant: 'expo',
|
|
810
810
|
// Advertiser data (IDFA/GAID, ATT status) for server-side postback
|
|
811
811
|
...(advertiserInfo ? {
|
|
@@ -819,7 +819,7 @@ export class DatalyrSDKExpo {
|
|
|
819
819
|
// Apple Search Ads attribution
|
|
820
820
|
...asaData,
|
|
821
821
|
},
|
|
822
|
-
|
|
822
|
+
deviceContext,
|
|
823
823
|
source: 'mobile_app',
|
|
824
824
|
timestamp: new Date().toISOString(),
|
|
825
825
|
};
|
package/src/datalyr-sdk.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getOrCreateVisitorId,
|
|
14
14
|
getOrCreateAnonymousId,
|
|
15
15
|
getOrCreateSessionId,
|
|
16
|
-
|
|
16
|
+
createDeviceContext,
|
|
17
17
|
generateUUID,
|
|
18
18
|
getDeviceInfo,
|
|
19
19
|
getNetworkType,
|
|
@@ -241,7 +241,7 @@ export class DatalyrSDK {
|
|
|
241
241
|
const installData = await attributionManager.trackInstall();
|
|
242
242
|
await this.track('app_install', {
|
|
243
243
|
platform: Platform.OS === 'ios' || Platform.OS === 'android' ? Platform.OS : 'android',
|
|
244
|
-
sdk_version: '1.7.
|
|
244
|
+
sdk_version: '1.7.5',
|
|
245
245
|
...installData,
|
|
246
246
|
});
|
|
247
247
|
}
|
|
@@ -1049,7 +1049,7 @@ export class DatalyrSDK {
|
|
|
1049
1049
|
*/
|
|
1050
1050
|
private async createEventPayload(eventName: string, eventData?: EventData): Promise<EventPayload> {
|
|
1051
1051
|
const deviceInfo = await getDeviceInfo();
|
|
1052
|
-
const
|
|
1052
|
+
const deviceContext = await createDeviceContext();
|
|
1053
1053
|
const attributionData = attributionManager.getAttributionData();
|
|
1054
1054
|
|
|
1055
1055
|
// Get Apple Search Ads attribution if available
|
|
@@ -1097,7 +1097,7 @@ export class DatalyrSDK {
|
|
|
1097
1097
|
carrier: deviceInfo.carrier,
|
|
1098
1098
|
network_type: getNetworkType(),
|
|
1099
1099
|
timestamp: Date.now(),
|
|
1100
|
-
sdk_version: '1.7.
|
|
1100
|
+
sdk_version: '1.7.5',
|
|
1101
1101
|
// Advertiser data (IDFA/GAID, ATT status) for server-side postback
|
|
1102
1102
|
...(advertiserInfo ? {
|
|
1103
1103
|
idfa: advertiserInfo.idfa,
|
|
@@ -1111,7 +1111,7 @@ export class DatalyrSDK {
|
|
|
1111
1111
|
// Apple Search Ads attribution
|
|
1112
1112
|
...asaData,
|
|
1113
1113
|
},
|
|
1114
|
-
|
|
1114
|
+
deviceContext,
|
|
1115
1115
|
source: 'mobile_app',
|
|
1116
1116
|
timestamp: new Date().toISOString(),
|
|
1117
1117
|
};
|
package/src/expo.ts
CHANGED
package/src/http-client.ts
CHANGED
|
@@ -194,11 +194,11 @@ export class HttpClient {
|
|
|
194
194
|
...payload.eventData,
|
|
195
195
|
sessionId: payload.sessionId,
|
|
196
196
|
source: payload.source || 'mobile_app',
|
|
197
|
-
fingerprint: payload.
|
|
197
|
+
fingerprint: payload.deviceContext,
|
|
198
198
|
},
|
|
199
199
|
context: {
|
|
200
200
|
library: '@datalyr/react-native',
|
|
201
|
-
version: '1.
|
|
201
|
+
version: '1.7.5',
|
|
202
202
|
source: 'mobile_app',
|
|
203
203
|
userProperties: payload.userProperties,
|
|
204
204
|
},
|
package/src/types.ts
CHANGED
|
@@ -133,7 +133,7 @@ export interface EventData {
|
|
|
133
133
|
network_type?: string;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
export interface
|
|
136
|
+
export interface DeviceContext {
|
|
137
137
|
deviceId?: string;
|
|
138
138
|
deviceInfo?: {
|
|
139
139
|
model: string;
|
|
@@ -155,7 +155,7 @@ export interface EventPayload {
|
|
|
155
155
|
eventId: string;
|
|
156
156
|
eventName: string;
|
|
157
157
|
eventData?: EventData;
|
|
158
|
-
|
|
158
|
+
deviceContext?: DeviceContext;
|
|
159
159
|
source: 'mobile_app';
|
|
160
160
|
timestamp: string;
|
|
161
161
|
userId?: string;
|
package/src/utils-expo.ts
CHANGED
|
@@ -224,8 +224,8 @@ export const getOrCreateSessionId = async (): Promise<string> => {
|
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
//
|
|
228
|
-
export const
|
|
227
|
+
// Device context creation using Expo APIs
|
|
228
|
+
export const createDeviceContext = async () => {
|
|
229
229
|
try {
|
|
230
230
|
const deviceInfo = await getDeviceInfo();
|
|
231
231
|
|
|
@@ -243,7 +243,7 @@ export const createFingerprintData = async () => {
|
|
|
243
243
|
},
|
|
244
244
|
};
|
|
245
245
|
} catch (error) {
|
|
246
|
-
errorLog('Error creating
|
|
246
|
+
errorLog('Error creating device context:', error as Error);
|
|
247
247
|
const deviceInfo = await getDeviceInfo();
|
|
248
248
|
return {
|
|
249
249
|
deviceId: deviceInfo.deviceId,
|
package/src/utils-interface.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Both utils.ts and utils-expo.ts implement this interface
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { DeviceInfo,
|
|
6
|
+
import { DeviceInfo, DeviceContext } from './types';
|
|
7
7
|
|
|
8
8
|
export interface SDKUtils {
|
|
9
9
|
STORAGE_KEYS: {
|
|
@@ -22,7 +22,7 @@ export interface SDKUtils {
|
|
|
22
22
|
getOrCreateAnonymousId: () => Promise<string>;
|
|
23
23
|
getOrCreateSessionId: () => Promise<string>;
|
|
24
24
|
getDeviceInfo: () => Promise<DeviceInfo>;
|
|
25
|
-
|
|
25
|
+
createDeviceContext: () => Promise<DeviceContext>;
|
|
26
26
|
getNetworkType: () => string | Promise<string>;
|
|
27
27
|
validateEventName: (eventName: string) => boolean;
|
|
28
28
|
validateEventData: (eventData: any) => boolean;
|
package/src/utils.ts
CHANGED
|
@@ -11,7 +11,7 @@ try {
|
|
|
11
11
|
import { v4 as uuidv4 } from 'uuid';
|
|
12
12
|
import 'react-native-get-random-values'; // Required for uuid
|
|
13
13
|
|
|
14
|
-
import { DeviceInfo as DeviceInfoType,
|
|
14
|
+
import { DeviceInfo as DeviceInfoType, DeviceContext } from './types';
|
|
15
15
|
|
|
16
16
|
// Storage Keys
|
|
17
17
|
export const STORAGE_KEYS = {
|
|
@@ -250,9 +250,9 @@ const fetchDeviceInfoInternal = async (): Promise<DeviceInfoType> => {
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
|
-
* Create
|
|
253
|
+
* Create device context for attribution
|
|
254
254
|
*/
|
|
255
|
-
export const
|
|
255
|
+
export const createDeviceContext = async (): Promise<DeviceContext> => {
|
|
256
256
|
const deviceInfo = await getDeviceInfo();
|
|
257
257
|
|
|
258
258
|
return {
|