@amplitude/analytics-react-native 0.2.2 → 0.2.3
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/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.kt +2 -1
- package/android/src/main/java/com/amplitude/reactnative/AndroidContextProvider.kt +5 -0
- package/lib/commonjs/plugins/context.js +4 -0
- package/lib/commonjs/plugins/context.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/plugins/context.js +4 -0
- package/lib/module/plugins/context.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/plugins/context.d.ts +1 -0
- package/lib/typescript/plugins/context.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/plugins/context.ts +3 -0
- package/src/version.ts +1 -1
|
@@ -23,7 +23,7 @@ class AmplitudeReactNativeModule(private val reactContext: ReactApplicationConte
|
|
|
23
23
|
private fun getApplicationContext(promise: Promise) {
|
|
24
24
|
promise.resolve(WritableNativeMap().apply {
|
|
25
25
|
putString("version", androidContextProvider.versionName)
|
|
26
|
-
putString("platform", androidContextProvider.
|
|
26
|
+
putString("platform", androidContextProvider.platform)
|
|
27
27
|
putString("language", androidContextProvider.language)
|
|
28
28
|
putString("osName", androidContextProvider.osName)
|
|
29
29
|
putString("osVersion", androidContextProvider.osVersion)
|
|
@@ -31,6 +31,7 @@ class AmplitudeReactNativeModule(private val reactContext: ReactApplicationConte
|
|
|
31
31
|
putString("deviceManufacturer", androidContextProvider.manufacturer)
|
|
32
32
|
putString("deviceModel", androidContextProvider.model)
|
|
33
33
|
putString("carrier", androidContextProvider.carrier)
|
|
34
|
+
putString("adid", androidContextProvider.advertisingId)
|
|
34
35
|
})
|
|
35
36
|
}
|
|
36
37
|
}
|
|
@@ -38,6 +38,7 @@ class AndroidContextProvider(private val context: Context, locationListening: Bo
|
|
|
38
38
|
val country: String?
|
|
39
39
|
val versionName: String?
|
|
40
40
|
val osName: String
|
|
41
|
+
val platform: String
|
|
41
42
|
val osVersion: String
|
|
42
43
|
val brand: String
|
|
43
44
|
val manufacturer: String
|
|
@@ -52,6 +53,7 @@ class AndroidContextProvider(private val context: Context, locationListening: Bo
|
|
|
52
53
|
advertisingId = fetchAdvertisingId()
|
|
53
54
|
versionName = fetchVersionName()
|
|
54
55
|
osName = OS_NAME
|
|
56
|
+
platform = PLATFORM
|
|
55
57
|
osVersion = fetchOsVersion()
|
|
56
58
|
brand = fetchBrand()
|
|
57
59
|
manufacturer = fetchManufacturer()
|
|
@@ -322,6 +324,8 @@ class AndroidContextProvider(private val context: Context, locationListening: Bo
|
|
|
322
324
|
get() = cachedInfo!!.versionName
|
|
323
325
|
val osName: String
|
|
324
326
|
get() = cachedInfo!!.osName
|
|
327
|
+
val platform: String
|
|
328
|
+
get() = cachedInfo!!.platform
|
|
325
329
|
val osVersion: String
|
|
326
330
|
get() = cachedInfo!!.osVersion
|
|
327
331
|
val brand: String
|
|
@@ -402,6 +406,7 @@ class AndroidContextProvider(private val context: Context, locationListening: Bo
|
|
|
402
406
|
|
|
403
407
|
companion object {
|
|
404
408
|
const val OS_NAME = "android"
|
|
409
|
+
const val PLATFORM = "Android"
|
|
405
410
|
const val SETTING_LIMIT_AD_TRACKING = "limit_ad_tracking"
|
|
406
411
|
const val SETTING_ADVERTISING_ID = "advertising_id"
|
|
407
412
|
fun generateUUID(): String {
|
|
@@ -82,6 +82,7 @@ class Context {
|
|
|
82
82
|
const deviceModel = (nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.deviceModel) || this.uaResult.device.model || this.uaResult.os.name;
|
|
83
83
|
const language = (nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.language) || (0, _language.getLanguage)();
|
|
84
84
|
const carrier = nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.carrier;
|
|
85
|
+
const adid = nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.adid;
|
|
85
86
|
const event = {
|
|
86
87
|
user_id: this.config.userId,
|
|
87
88
|
device_id: this.config.deviceId,
|
|
@@ -114,6 +115,9 @@ class Context {
|
|
|
114
115
|
...(this.config.trackingOptions.ipAddress && {
|
|
115
116
|
ip: IP_ADDRESS
|
|
116
117
|
}),
|
|
118
|
+
...(this.config.trackingOptions.adid && {
|
|
119
|
+
adid: adid
|
|
120
|
+
}),
|
|
117
121
|
insert_id: (0, _analyticsCore.UUID)(),
|
|
118
122
|
partner_id: this.config.partnerId,
|
|
119
123
|
plan: this.config.plan,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BROWSER_PLATFORM","IP_ADDRESS","Context","constructor","PluginType","BEFORE","NativeModules","AmplitudeReactNative","VERSION","agent","navigator","userAgent","uaResult","UAParser","getResult","setup","config","Promise","resolve","undefined","execute","context","isSessionValid","sessionId","Date","now","lastEventTime","time","getTime","nativeContext","nativeModule","getApplicationContext","appVersion","version","platform","osName","browser","name","osVersion","deviceVendor","deviceManufacturer","device","vendor","deviceModel","model","os","language","getLanguage","carrier","event","user_id","userId","device_id","deviceId","session_id","app_version","trackingOptions","os_name","os_version","device_manufacturer","device_model","ipAddress","ip","insert_id","UUID","partner_id","partnerId","plan","event_id","eventId","library","timeSinceLastEvent","sessionTimeout"],"sources":["context.ts"],"sourcesContent":["import { BeforePlugin, ReactNativeConfig, Event, PluginType } from '@amplitude/analytics-types';\nimport UAParser from '@amplitude/ua-parser-js';\nimport { UUID } from '@amplitude/analytics-core';\nimport { getLanguage } from '../utils/language';\nimport { VERSION } from '../version';\nimport { NativeModules } from 'react-native';\n\nconst BROWSER_PLATFORM = 'Web';\nconst IP_ADDRESS = '$remote';\n\ntype NativeContext = {\n version: string;\n platform: string;\n language: string;\n osName: string;\n osVersion: string;\n deviceBrand: string;\n deviceManufacturer: string;\n deviceModel: string;\n carrier: string;\n};\n\nexport interface AmplitudeReactNative {\n getApplicationContext(): Promise<NativeContext>;\n}\n\nexport class Context implements BeforePlugin {\n name = 'context';\n type = PluginType.BEFORE as const;\n\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: ReactNativeConfig;\n eventId = 0;\n uaResult: UAParser.IResult;\n nativeModule: AmplitudeReactNative | undefined = NativeModules.AmplitudeReactNative as\n | AmplitudeReactNative\n | undefined;\n library = `amplitude-react-native-ts/${VERSION}`;\n\n constructor() {\n let agent: string | undefined;\n /* istanbul ignore else */\n if (typeof navigator !== 'undefined') {\n agent = navigator.userAgent;\n }\n this.uaResult = new UAParser(agent).getResult();\n }\n\n setup(config: ReactNativeConfig): Promise<undefined> {\n this.config = config;\n return Promise.resolve(undefined);\n }\n\n async execute(context: Event): Promise<Event> {\n /**\n * Manages user session triggered by new events\n */\n if (!this.isSessionValid()) {\n // Creates new session\n this.config.sessionId = Date.now();\n } // else use previously creates session\n // Updates last event time to extend time-based session\n this.config.lastEventTime = Date.now();\n const time = new Date().getTime();\n const nativeContext = await this.nativeModule?.getApplicationContext();\n const appVersion = nativeContext?.version || this.config.appVersion;\n const platform = nativeContext?.platform || BROWSER_PLATFORM;\n const osName = nativeContext?.osName || this.uaResult.browser.name;\n const osVersion = nativeContext?.osVersion || this.uaResult.browser.version;\n const deviceVendor = nativeContext?.deviceManufacturer || this.uaResult.device.vendor;\n const deviceModel = nativeContext?.deviceModel || this.uaResult.device.model || this.uaResult.os.name;\n const language = nativeContext?.language || getLanguage();\n const carrier = nativeContext?.carrier;\n\n const event: Event = {\n user_id: this.config.userId,\n device_id: this.config.deviceId,\n session_id: this.config.sessionId,\n time,\n ...(this.config.appVersion && { app_version: appVersion }),\n ...(this.config.trackingOptions.platform && { platform: platform }),\n ...(this.config.trackingOptions.osName && { os_name: osName }),\n ...(this.config.trackingOptions.osVersion && { os_version: osVersion }),\n ...(this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }),\n ...(this.config.trackingOptions.deviceModel && { device_model: deviceModel }),\n ...(this.config.trackingOptions.language && { language: language }),\n ...(this.config.trackingOptions.carrier && { carrier: carrier }),\n ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),\n insert_id: UUID(),\n partner_id: this.config.partnerId,\n plan: this.config.plan,\n ...context,\n event_id: this.eventId++,\n library: this.library,\n };\n return event;\n }\n\n isSessionValid() {\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = Date.now() - lastEventTime;\n return timeSinceLastEvent < this.config.sessionTimeout;\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,gBAAgB,GAAG,KAAzB;AACA,MAAMC,UAAU,GAAG,SAAnB;;
|
|
1
|
+
{"version":3,"names":["BROWSER_PLATFORM","IP_ADDRESS","Context","constructor","PluginType","BEFORE","NativeModules","AmplitudeReactNative","VERSION","agent","navigator","userAgent","uaResult","UAParser","getResult","setup","config","Promise","resolve","undefined","execute","context","isSessionValid","sessionId","Date","now","lastEventTime","time","getTime","nativeContext","nativeModule","getApplicationContext","appVersion","version","platform","osName","browser","name","osVersion","deviceVendor","deviceManufacturer","device","vendor","deviceModel","model","os","language","getLanguage","carrier","adid","event","user_id","userId","device_id","deviceId","session_id","app_version","trackingOptions","os_name","os_version","device_manufacturer","device_model","ipAddress","ip","insert_id","UUID","partner_id","partnerId","plan","event_id","eventId","library","timeSinceLastEvent","sessionTimeout"],"sources":["context.ts"],"sourcesContent":["import { BeforePlugin, ReactNativeConfig, Event, PluginType } from '@amplitude/analytics-types';\nimport UAParser from '@amplitude/ua-parser-js';\nimport { UUID } from '@amplitude/analytics-core';\nimport { getLanguage } from '../utils/language';\nimport { VERSION } from '../version';\nimport { NativeModules } from 'react-native';\n\nconst BROWSER_PLATFORM = 'Web';\nconst IP_ADDRESS = '$remote';\n\ntype NativeContext = {\n version: string;\n platform: string;\n language: string;\n osName: string;\n osVersion: string;\n deviceBrand: string;\n deviceManufacturer: string;\n deviceModel: string;\n carrier: string;\n adid: string;\n};\n\nexport interface AmplitudeReactNative {\n getApplicationContext(): Promise<NativeContext>;\n}\n\nexport class Context implements BeforePlugin {\n name = 'context';\n type = PluginType.BEFORE as const;\n\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: ReactNativeConfig;\n eventId = 0;\n uaResult: UAParser.IResult;\n nativeModule: AmplitudeReactNative | undefined = NativeModules.AmplitudeReactNative as\n | AmplitudeReactNative\n | undefined;\n library = `amplitude-react-native-ts/${VERSION}`;\n\n constructor() {\n let agent: string | undefined;\n /* istanbul ignore else */\n if (typeof navigator !== 'undefined') {\n agent = navigator.userAgent;\n }\n this.uaResult = new UAParser(agent).getResult();\n }\n\n setup(config: ReactNativeConfig): Promise<undefined> {\n this.config = config;\n return Promise.resolve(undefined);\n }\n\n async execute(context: Event): Promise<Event> {\n /**\n * Manages user session triggered by new events\n */\n if (!this.isSessionValid()) {\n // Creates new session\n this.config.sessionId = Date.now();\n } // else use previously creates session\n // Updates last event time to extend time-based session\n this.config.lastEventTime = Date.now();\n const time = new Date().getTime();\n const nativeContext = await this.nativeModule?.getApplicationContext();\n const appVersion = nativeContext?.version || this.config.appVersion;\n const platform = nativeContext?.platform || BROWSER_PLATFORM;\n const osName = nativeContext?.osName || this.uaResult.browser.name;\n const osVersion = nativeContext?.osVersion || this.uaResult.browser.version;\n const deviceVendor = nativeContext?.deviceManufacturer || this.uaResult.device.vendor;\n const deviceModel = nativeContext?.deviceModel || this.uaResult.device.model || this.uaResult.os.name;\n const language = nativeContext?.language || getLanguage();\n const carrier = nativeContext?.carrier;\n const adid = nativeContext?.adid;\n\n const event: Event = {\n user_id: this.config.userId,\n device_id: this.config.deviceId,\n session_id: this.config.sessionId,\n time,\n ...(this.config.appVersion && { app_version: appVersion }),\n ...(this.config.trackingOptions.platform && { platform: platform }),\n ...(this.config.trackingOptions.osName && { os_name: osName }),\n ...(this.config.trackingOptions.osVersion && { os_version: osVersion }),\n ...(this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }),\n ...(this.config.trackingOptions.deviceModel && { device_model: deviceModel }),\n ...(this.config.trackingOptions.language && { language: language }),\n ...(this.config.trackingOptions.carrier && { carrier: carrier }),\n ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),\n ...(this.config.trackingOptions.adid && { adid: adid }),\n insert_id: UUID(),\n partner_id: this.config.partnerId,\n plan: this.config.plan,\n ...context,\n event_id: this.eventId++,\n library: this.library,\n };\n return event;\n }\n\n isSessionValid() {\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = Date.now() - lastEventTime;\n return timeSinceLastEvent < this.config.sessionTimeout;\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,gBAAgB,GAAG,KAAzB;AACA,MAAMC,UAAU,GAAG,SAAnB;;AAmBO,MAAMC,OAAN,CAAsC;EAI3C;EACA;EACA;EASAC,WAAW,GAAG;IAAA,8BAdP,SAcO;;IAAA,8BAbPC,0BAAA,CAAWC,MAaJ;;IAAA;;IAAA,iCAPJ,CAOI;;IAAA;;IAAA,sCALmCC,0BAAA,CAAcC,oBAKjD;;IAAA,iCAFH,6BAA4BC,gBAAQ,EAEjC;;IACZ,IAAIC,KAAJ;IACA;;IACA,IAAI,OAAOC,SAAP,KAAqB,WAAzB,EAAsC;MACpCD,KAAK,GAAGC,SAAS,CAACC,SAAlB;IACD;;IACD,KAAKC,QAAL,GAAgB,IAAIC,mBAAJ,CAAaJ,KAAb,EAAoBK,SAApB,EAAhB;EACD;;EAEDC,KAAK,CAACC,MAAD,EAAgD;IACnD,KAAKA,MAAL,GAAcA,MAAd;IACA,OAAOC,OAAO,CAACC,OAAR,CAAgBC,SAAhB,CAAP;EACD;;EAEY,MAAPC,OAAO,CAACC,OAAD,EAAiC;IAAA;;IAC5C;AACJ;AACA;IACI,IAAI,CAAC,KAAKC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AEA;MAAX,CAA3C,CAZmB;MAanB,IAAI,KAAKhC,MAAL,CAAYyC,eAAZ,CAA4BK,SAA5B,IAAyC;QAAEC,EAAE,EAAE9D;MAAN,CAA7C,CAbmB;MAcnB,IAAI,KAAKe,MAAL,CAAYyC,eAAZ,CAA4BR,IAA5B,IAAoC;QAAEA,IAAI,EAAEA;MAAR,CAAxC,CAdmB;MAenBe,SAAS,EAAE,IAAAC,mBAAA,GAfQ;MAgBnBC,UAAU,EAAE,KAAKlD,MAAL,CAAYmD,SAhBL;MAiBnBC,IAAI,EAAE,KAAKpD,MAAL,CAAYoD,IAjBC;MAkBnB,GAAG/C,OAlBgB;MAmBnBgD,QAAQ,EAAE,KAAKC,OAAL,EAnBS;MAoBnBC,OAAO,EAAE,KAAKA;IApBK,CAArB;IAsBA,OAAOrB,KAAP;EACD;;EAED5B,cAAc,GAAG;IACf,MAAMI,aAAa,GAAG,KAAKV,MAAL,CAAYU,aAAZ,IAA6BF,IAAI,CAACC,GAAL,EAAnD;IACA,MAAM+C,kBAAkB,GAAGhD,IAAI,CAACC,GAAL,KAAaC,aAAxC;IACA,OAAO8C,kBAAkB,GAAG,KAAKxD,MAAL,CAAYyD,cAAxC;EACD;;AAhF0C"}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["export const VERSION = '0.2.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["export const VERSION = '0.2.3';\n"],"mappings":";;;;;;AAAO,MAAMA,OAAO,GAAG,OAAhB"}
|
|
@@ -66,6 +66,7 @@ export class Context {
|
|
|
66
66
|
const deviceModel = (nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.deviceModel) || this.uaResult.device.model || this.uaResult.os.name;
|
|
67
67
|
const language = (nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.language) || getLanguage();
|
|
68
68
|
const carrier = nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.carrier;
|
|
69
|
+
const adid = nativeContext === null || nativeContext === void 0 ? void 0 : nativeContext.adid;
|
|
69
70
|
const event = {
|
|
70
71
|
user_id: this.config.userId,
|
|
71
72
|
device_id: this.config.deviceId,
|
|
@@ -98,6 +99,9 @@ export class Context {
|
|
|
98
99
|
...(this.config.trackingOptions.ipAddress && {
|
|
99
100
|
ip: IP_ADDRESS
|
|
100
101
|
}),
|
|
102
|
+
...(this.config.trackingOptions.adid && {
|
|
103
|
+
adid: adid
|
|
104
|
+
}),
|
|
101
105
|
insert_id: UUID(),
|
|
102
106
|
partner_id: this.config.partnerId,
|
|
103
107
|
plan: this.config.plan,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PluginType","UAParser","UUID","getLanguage","VERSION","NativeModules","BROWSER_PLATFORM","IP_ADDRESS","Context","constructor","BEFORE","AmplitudeReactNative","agent","navigator","userAgent","uaResult","getResult","setup","config","Promise","resolve","undefined","execute","context","isSessionValid","sessionId","Date","now","lastEventTime","time","getTime","nativeContext","nativeModule","getApplicationContext","appVersion","version","platform","osName","browser","name","osVersion","deviceVendor","deviceManufacturer","device","vendor","deviceModel","model","os","language","carrier","event","user_id","userId","device_id","deviceId","session_id","app_version","trackingOptions","os_name","os_version","device_manufacturer","device_model","ipAddress","ip","insert_id","partner_id","partnerId","plan","event_id","eventId","library","timeSinceLastEvent","sessionTimeout"],"sources":["context.ts"],"sourcesContent":["import { BeforePlugin, ReactNativeConfig, Event, PluginType } from '@amplitude/analytics-types';\nimport UAParser from '@amplitude/ua-parser-js';\nimport { UUID } from '@amplitude/analytics-core';\nimport { getLanguage } from '../utils/language';\nimport { VERSION } from '../version';\nimport { NativeModules } from 'react-native';\n\nconst BROWSER_PLATFORM = 'Web';\nconst IP_ADDRESS = '$remote';\n\ntype NativeContext = {\n version: string;\n platform: string;\n language: string;\n osName: string;\n osVersion: string;\n deviceBrand: string;\n deviceManufacturer: string;\n deviceModel: string;\n carrier: string;\n};\n\nexport interface AmplitudeReactNative {\n getApplicationContext(): Promise<NativeContext>;\n}\n\nexport class Context implements BeforePlugin {\n name = 'context';\n type = PluginType.BEFORE as const;\n\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: ReactNativeConfig;\n eventId = 0;\n uaResult: UAParser.IResult;\n nativeModule: AmplitudeReactNative | undefined = NativeModules.AmplitudeReactNative as\n | AmplitudeReactNative\n | undefined;\n library = `amplitude-react-native-ts/${VERSION}`;\n\n constructor() {\n let agent: string | undefined;\n /* istanbul ignore else */\n if (typeof navigator !== 'undefined') {\n agent = navigator.userAgent;\n }\n this.uaResult = new UAParser(agent).getResult();\n }\n\n setup(config: ReactNativeConfig): Promise<undefined> {\n this.config = config;\n return Promise.resolve(undefined);\n }\n\n async execute(context: Event): Promise<Event> {\n /**\n * Manages user session triggered by new events\n */\n if (!this.isSessionValid()) {\n // Creates new session\n this.config.sessionId = Date.now();\n } // else use previously creates session\n // Updates last event time to extend time-based session\n this.config.lastEventTime = Date.now();\n const time = new Date().getTime();\n const nativeContext = await this.nativeModule?.getApplicationContext();\n const appVersion = nativeContext?.version || this.config.appVersion;\n const platform = nativeContext?.platform || BROWSER_PLATFORM;\n const osName = nativeContext?.osName || this.uaResult.browser.name;\n const osVersion = nativeContext?.osVersion || this.uaResult.browser.version;\n const deviceVendor = nativeContext?.deviceManufacturer || this.uaResult.device.vendor;\n const deviceModel = nativeContext?.deviceModel || this.uaResult.device.model || this.uaResult.os.name;\n const language = nativeContext?.language || getLanguage();\n const carrier = nativeContext?.carrier;\n\n const event: Event = {\n user_id: this.config.userId,\n device_id: this.config.deviceId,\n session_id: this.config.sessionId,\n time,\n ...(this.config.appVersion && { app_version: appVersion }),\n ...(this.config.trackingOptions.platform && { platform: platform }),\n ...(this.config.trackingOptions.osName && { os_name: osName }),\n ...(this.config.trackingOptions.osVersion && { os_version: osVersion }),\n ...(this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }),\n ...(this.config.trackingOptions.deviceModel && { device_model: deviceModel }),\n ...(this.config.trackingOptions.language && { language: language }),\n ...(this.config.trackingOptions.carrier && { carrier: carrier }),\n ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),\n insert_id: UUID(),\n partner_id: this.config.partnerId,\n plan: this.config.plan,\n ...context,\n event_id: this.eventId++,\n library: this.library,\n };\n return event;\n }\n\n isSessionValid() {\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = Date.now() - lastEventTime;\n return timeSinceLastEvent < this.config.sessionTimeout;\n }\n}\n"],"mappings":";;AAAA,SAAiDA,UAAjD,QAAmE,4BAAnE;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,IAAT,QAAqB,2BAArB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,YAAxB;AACA,SAASC,aAAT,QAA8B,cAA9B;AAEA,MAAMC,gBAAgB,GAAG,KAAzB;AACA,MAAMC,UAAU,GAAG,SAAnB;
|
|
1
|
+
{"version":3,"names":["PluginType","UAParser","UUID","getLanguage","VERSION","NativeModules","BROWSER_PLATFORM","IP_ADDRESS","Context","constructor","BEFORE","AmplitudeReactNative","agent","navigator","userAgent","uaResult","getResult","setup","config","Promise","resolve","undefined","execute","context","isSessionValid","sessionId","Date","now","lastEventTime","time","getTime","nativeContext","nativeModule","getApplicationContext","appVersion","version","platform","osName","browser","name","osVersion","deviceVendor","deviceManufacturer","device","vendor","deviceModel","model","os","language","carrier","adid","event","user_id","userId","device_id","deviceId","session_id","app_version","trackingOptions","os_name","os_version","device_manufacturer","device_model","ipAddress","ip","insert_id","partner_id","partnerId","plan","event_id","eventId","library","timeSinceLastEvent","sessionTimeout"],"sources":["context.ts"],"sourcesContent":["import { BeforePlugin, ReactNativeConfig, Event, PluginType } from '@amplitude/analytics-types';\nimport UAParser from '@amplitude/ua-parser-js';\nimport { UUID } from '@amplitude/analytics-core';\nimport { getLanguage } from '../utils/language';\nimport { VERSION } from '../version';\nimport { NativeModules } from 'react-native';\n\nconst BROWSER_PLATFORM = 'Web';\nconst IP_ADDRESS = '$remote';\n\ntype NativeContext = {\n version: string;\n platform: string;\n language: string;\n osName: string;\n osVersion: string;\n deviceBrand: string;\n deviceManufacturer: string;\n deviceModel: string;\n carrier: string;\n adid: string;\n};\n\nexport interface AmplitudeReactNative {\n getApplicationContext(): Promise<NativeContext>;\n}\n\nexport class Context implements BeforePlugin {\n name = 'context';\n type = PluginType.BEFORE as const;\n\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: ReactNativeConfig;\n eventId = 0;\n uaResult: UAParser.IResult;\n nativeModule: AmplitudeReactNative | undefined = NativeModules.AmplitudeReactNative as\n | AmplitudeReactNative\n | undefined;\n library = `amplitude-react-native-ts/${VERSION}`;\n\n constructor() {\n let agent: string | undefined;\n /* istanbul ignore else */\n if (typeof navigator !== 'undefined') {\n agent = navigator.userAgent;\n }\n this.uaResult = new UAParser(agent).getResult();\n }\n\n setup(config: ReactNativeConfig): Promise<undefined> {\n this.config = config;\n return Promise.resolve(undefined);\n }\n\n async execute(context: Event): Promise<Event> {\n /**\n * Manages user session triggered by new events\n */\n if (!this.isSessionValid()) {\n // Creates new session\n this.config.sessionId = Date.now();\n } // else use previously creates session\n // Updates last event time to extend time-based session\n this.config.lastEventTime = Date.now();\n const time = new Date().getTime();\n const nativeContext = await this.nativeModule?.getApplicationContext();\n const appVersion = nativeContext?.version || this.config.appVersion;\n const platform = nativeContext?.platform || BROWSER_PLATFORM;\n const osName = nativeContext?.osName || this.uaResult.browser.name;\n const osVersion = nativeContext?.osVersion || this.uaResult.browser.version;\n const deviceVendor = nativeContext?.deviceManufacturer || this.uaResult.device.vendor;\n const deviceModel = nativeContext?.deviceModel || this.uaResult.device.model || this.uaResult.os.name;\n const language = nativeContext?.language || getLanguage();\n const carrier = nativeContext?.carrier;\n const adid = nativeContext?.adid;\n\n const event: Event = {\n user_id: this.config.userId,\n device_id: this.config.deviceId,\n session_id: this.config.sessionId,\n time,\n ...(this.config.appVersion && { app_version: appVersion }),\n ...(this.config.trackingOptions.platform && { platform: platform }),\n ...(this.config.trackingOptions.osName && { os_name: osName }),\n ...(this.config.trackingOptions.osVersion && { os_version: osVersion }),\n ...(this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }),\n ...(this.config.trackingOptions.deviceModel && { device_model: deviceModel }),\n ...(this.config.trackingOptions.language && { language: language }),\n ...(this.config.trackingOptions.carrier && { carrier: carrier }),\n ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),\n ...(this.config.trackingOptions.adid && { adid: adid }),\n insert_id: UUID(),\n partner_id: this.config.partnerId,\n plan: this.config.plan,\n ...context,\n event_id: this.eventId++,\n library: this.library,\n };\n return event;\n }\n\n isSessionValid() {\n const lastEventTime = this.config.lastEventTime || Date.now();\n const timeSinceLastEvent = Date.now() - lastEventTime;\n return timeSinceLastEvent < this.config.sessionTimeout;\n }\n}\n"],"mappings":";;AAAA,SAAiDA,UAAjD,QAAmE,4BAAnE;AACA,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,IAAT,QAAqB,2BAArB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,YAAxB;AACA,SAASC,aAAT,QAA8B,cAA9B;AAEA,MAAMC,gBAAgB,GAAG,KAAzB;AACA,MAAMC,UAAU,GAAG,SAAnB;AAmBA,OAAO,MAAMC,OAAN,CAAsC;EAI3C;EACA;EACA;EASAC,WAAW,GAAG;IAAA,8BAdP,SAcO;;IAAA,8BAbPT,UAAU,CAACU,MAaJ;;IAAA;;IAAA,iCAPJ,CAOI;;IAAA;;IAAA,sCALmCL,aAAa,CAACM,oBAKjD;;IAAA,iCAFH,6BAA4BP,OAAQ,EAEjC;;IACZ,IAAIQ,KAAJ;IACA;;IACA,IAAI,OAAOC,SAAP,KAAqB,W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URL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["export const VERSION = '0.2.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["export const VERSION = '0.2.3';\n"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,OAAhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAS/C,aAAK,aAAa,GAAG;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAS/C,aAAK,aAAa,GAAG;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACjD;AAED,qBAAa,OAAQ,YAAW,YAAY;IAC1C,IAAI,SAAa;IACjB,IAAI,oBAA8B;IAKlC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,SAAK;IACZ,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B,YAAY,EAAE,oBAAoB,GAAG,SAAS,CAEhC;IACd,OAAO,SAA0C;;IAWjD,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;IAK9C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IA+C7C,cAAc;CAKf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.
|
|
1
|
+
export declare const VERSION = "0.2.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Official React Native SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@amplitude/analytics-connector": "1.4.5",
|
|
61
|
-
"@amplitude/analytics-core": "^0.6.
|
|
62
|
-
"@amplitude/analytics-types": "^0.6.
|
|
61
|
+
"@amplitude/analytics-core": "^0.6.6",
|
|
62
|
+
"@amplitude/analytics-types": "^0.6.2",
|
|
63
63
|
"@amplitude/ua-parser-js": "^0.7.31",
|
|
64
64
|
"@react-native-async-storage/async-storage": "^1.17.7",
|
|
65
65
|
"tslib": "^2.3.1"
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
]
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "39c6658dd10b735e38651aedb04f8eeea7e6372e"
|
|
93
93
|
}
|
package/src/plugins/context.ts
CHANGED
|
@@ -18,6 +18,7 @@ type NativeContext = {
|
|
|
18
18
|
deviceManufacturer: string;
|
|
19
19
|
deviceModel: string;
|
|
20
20
|
carrier: string;
|
|
21
|
+
adid: string;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export interface AmplitudeReactNative {
|
|
@@ -73,6 +74,7 @@ export class Context implements BeforePlugin {
|
|
|
73
74
|
const deviceModel = nativeContext?.deviceModel || this.uaResult.device.model || this.uaResult.os.name;
|
|
74
75
|
const language = nativeContext?.language || getLanguage();
|
|
75
76
|
const carrier = nativeContext?.carrier;
|
|
77
|
+
const adid = nativeContext?.adid;
|
|
76
78
|
|
|
77
79
|
const event: Event = {
|
|
78
80
|
user_id: this.config.userId,
|
|
@@ -88,6 +90,7 @@ export class Context implements BeforePlugin {
|
|
|
88
90
|
...(this.config.trackingOptions.language && { language: language }),
|
|
89
91
|
...(this.config.trackingOptions.carrier && { carrier: carrier }),
|
|
90
92
|
...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }),
|
|
93
|
+
...(this.config.trackingOptions.adid && { adid: adid }),
|
|
91
94
|
insert_id: UUID(),
|
|
92
95
|
partner_id: this.config.partnerId,
|
|
93
96
|
plan: this.config.plan,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.3';
|