@exodus/headless 2.2.2 → 2.3.0
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.2.2...@exodus/headless@2.3.0) (2024-01-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **headless:** add analytics plugin ([#5402](https://github.com/ExodusMovement/exodus-hydra/issues/5402)) ([2ffd24b](https://github.com/ExodusMovement/exodus-hydra/commit/2ffd24b937cda8f5ba233d7796de7b5b5367b704))
|
|
11
|
+
|
|
6
12
|
## [2.2.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.2.1...@exodus/headless@2.2.2) (2024-01-12)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/headless",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "The platform-agnostic Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"@exodus/ab-testing": "^7.3.0",
|
|
67
67
|
"@exodus/algorand-lib": "^2.0.1",
|
|
68
68
|
"@exodus/algorand-meta": "^1.1.4",
|
|
69
|
+
"@exodus/analytics": "^11.0.0",
|
|
69
70
|
"@exodus/apy-rates": "^3.3.1",
|
|
70
71
|
"@exodus/assets-feature": "workspace:^",
|
|
71
72
|
"@exodus/bitcoin-plugin": "^1.0.14",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"@exodus/models": "^10.1.0",
|
|
83
84
|
"@exodus/nfts": "^7.11.0",
|
|
84
85
|
"@exodus/personal-notes": "^3.6.0",
|
|
85
|
-
"@exodus/referrals": "^8.1.
|
|
86
|
+
"@exodus/referrals": "^8.1.2",
|
|
86
87
|
"@exodus/solana-lib": "^1.3.11",
|
|
87
88
|
"@exodus/solana-meta": "^1.0.2",
|
|
88
89
|
"@exodus/storage-encrypted": "^1.1.2",
|
|
@@ -100,5 +101,5 @@
|
|
|
100
101
|
"msw": "^2.0.0",
|
|
101
102
|
"p-defer": "^4.0.0"
|
|
102
103
|
},
|
|
103
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "035a21e35481a7819a24348a5eb97f4c71b37d0b"
|
|
104
105
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import headlessAnalyticsPluginDefinition from '../plugins/analytics'
|
|
2
|
+
import logLifecyclePluginDefinition from '../plugins/log-lifecycle'
|
|
3
3
|
|
|
4
|
-
const createPluginDependencies = () =>
|
|
5
|
-
|
|
4
|
+
const createPluginDependencies = () => [
|
|
5
|
+
{ definition: logLifecyclePluginDefinition },
|
|
6
|
+
{
|
|
7
|
+
if: { registered: ['analytics'] },
|
|
8
|
+
definition: headlessAnalyticsPluginDefinition,
|
|
9
|
+
},
|
|
10
|
+
]
|
|
6
11
|
|
|
7
12
|
export default createPluginDependencies
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const setBuildMetadataProperties = async ({ analytics, getBuildMetadata }) => {
|
|
2
|
+
analytics.requireDefaultProperties(['appId', 'osName'])
|
|
3
|
+
|
|
4
|
+
const { appId, osName, deviceModel } = await getBuildMetadata()
|
|
5
|
+
|
|
6
|
+
analytics.setDefaultProperties({ appId, osName, deviceModel })
|
|
7
|
+
analytics.setDefaultPropertiesForSanitizationErrors({ osName })
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const setSystemPreferencesProperties = async ({ analytics, systemPreferences }) => {
|
|
11
|
+
if (!systemPreferences) return
|
|
12
|
+
analytics.requireDefaultProperties(['locale'])
|
|
13
|
+
const languages = await systemPreferences.getPreferredLanguages()
|
|
14
|
+
analytics.setDefaultProperties({ locale: languages })
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const setEnvProperties = async ({ analytics, env }) => {
|
|
18
|
+
analytics.setDefaultProperties({
|
|
19
|
+
appPlatform: env.platform,
|
|
20
|
+
appVersion: env.version,
|
|
21
|
+
appBuild: env.build === 'development' ? 'dev' : 'prod',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// just need platform and version since segment
|
|
25
|
+
// makes calls to staging or prod based on API key
|
|
26
|
+
analytics.setDefaultPropertiesForSanitizationErrors({
|
|
27
|
+
appPlatform: env.platform,
|
|
28
|
+
appVersion: env.version,
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const createHeadlessAnalyticsPlugin = ({ analytics, env, getBuildMetadata, systemPreferences }) => {
|
|
33
|
+
const onStart = async () => {
|
|
34
|
+
Promise.all([
|
|
35
|
+
setEnvProperties({ analytics, env }),
|
|
36
|
+
setBuildMetadataProperties({ analytics, getBuildMetadata }),
|
|
37
|
+
setSystemPreferencesProperties({ analytics, systemPreferences }),
|
|
38
|
+
])
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return { onStart }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const analyticsPluginDefinition = {
|
|
45
|
+
id: 'headlessAnalyticsPlugin',
|
|
46
|
+
type: 'plugin',
|
|
47
|
+
factory: createHeadlessAnalyticsPlugin,
|
|
48
|
+
dependencies: ['analytics', 'env', 'getBuildMetadata', 'systemPreferences?'],
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default analyticsPluginDefinition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const logLifecyclePluginDefinition = {
|
|
2
2
|
id: 'logLifecyclePlugin',
|
|
3
3
|
type: 'plugin',
|
|
4
4
|
factory: ({ logger }) => {
|
|
@@ -23,4 +23,4 @@ const logLifecycle = {
|
|
|
23
23
|
dependencies: ['logger'],
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export default
|
|
26
|
+
export default logLifecyclePluginDefinition
|
package/src/plugins/index.js
DELETED