@exodus/headless 2.0.0-alpha.42 → 2.0.0-alpha.43

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.0.0-alpha.43](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.42...@exodus/headless@2.0.0-alpha.43) (2023-06-16)
7
+
8
+ ### Features
9
+
10
+ - **headless:** integrate ab-testing module ([#1972](https://github.com/ExodusMovement/exodus-hydra/issues/1972)) ([6c063b4](https://github.com/ExodusMovement/exodus-hydra/commit/6c063b4d4f04d08c36f843577822e7d53f002d4f))
11
+
6
12
  ## [2.0.0-alpha.42](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.41...@exodus/headless@2.0.0-alpha.42) (2023-06-15)
7
13
 
8
14
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.42",
3
+ "version": "2.0.0-alpha.43",
4
4
  "description": "The headless Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
@@ -26,6 +26,7 @@
26
26
  "test": "jest --runInBand"
27
27
  },
28
28
  "dependencies": {
29
+ "@exodus/ab-testing": "^5.1.0",
29
30
  "@exodus/address-provider": "^4.0.0",
30
31
  "@exodus/apy-rates": "^2.1.0",
31
32
  "@exodus/atoms": "^4.0.1",
@@ -87,5 +88,5 @@
87
88
  "nock": "^13.3.1",
88
89
  "p-defer": "^4.0.0"
89
90
  },
90
- "gitHead": "bd71b5cf5b53868f90e6741bff3425022df792e9"
91
+ "gitHead": "67ed7c439d9d3626db03d8c926af3e1fbe19cf8f"
91
92
  }
package/src/constants.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export const atomsToAttach = [
2
+ 'abTestingAtom',
2
3
  'apyRatesAtom',
3
4
  'availableAssetNamesAtom',
4
5
  'balancesAtom',
package/src/index.js CHANGED
@@ -4,6 +4,7 @@ import createApi from './api'
4
4
  import attachAtoms from './atoms/attach'
5
5
  import { atomsToAttach } from './constants'
6
6
  import createIOC from './ioc'
7
+ import abTesting from './modules/ab-testing'
7
8
  import connectedOrigins from './modules/connected-origins'
8
9
  import kyc from './modules/kyc'
9
10
  import locale from './modules/locale'
@@ -23,6 +24,7 @@ const createExodus = ({ adapters, config, port }) => {
23
24
  ioc.use(kyc())
24
25
  ioc.use(referrals())
25
26
  ioc.use(connectedOrigins())
27
+ ioc.use(abTesting())
26
28
 
27
29
  ioc.register({ definition: { id: 'port', type: 'port', factory: () => port } })
28
30
 
@@ -0,0 +1,13 @@
1
+ const abTestingApi = ({ abTesting }) => ({
2
+ abTesting: {
3
+ trackEvent: abTesting.trackEvent,
4
+ updateVariant: abTesting.updateVariant,
5
+ },
6
+ })
7
+
8
+ export default {
9
+ id: 'abTestingApi',
10
+ type: 'api',
11
+ factory: abTestingApi,
12
+ dependencies: ['abTesting'],
13
+ }
@@ -0,0 +1,26 @@
1
+ import { abTestingAtomDefinition } from '@exodus/ab-testing/atoms'
2
+ import abTestingDefinition from '@exodus/ab-testing/module'
3
+
4
+ import abTestingApiDefinition from './api'
5
+ import abTestingPluginDefinition from './plugin'
6
+
7
+ const abTesting = () => {
8
+ return {
9
+ id: 'abTesting',
10
+ definitions: [
11
+ {
12
+ definition: abTestingAtomDefinition,
13
+ storage: { namespace: 'abTesting' },
14
+ aliases: [{ implementationId: 'unsafeStorage', interfaceId: 'storage' }],
15
+ },
16
+ {
17
+ definition: abTestingDefinition,
18
+ writesAtom: ['abTestingAtom'],
19
+ },
20
+ { definition: abTestingPluginDefinition },
21
+ { definition: abTestingApiDefinition },
22
+ ],
23
+ }
24
+ }
25
+
26
+ export default abTesting
@@ -0,0 +1,21 @@
1
+ const abTestingLifecyclePlugin = ({ abTesting, featureFlagAtoms }) => {
2
+ const onStart = async () => {
3
+ featureFlagAtoms.abTesting?.get().then(({ isOn }) => {
4
+ if (!isOn) return
5
+ abTesting.load()
6
+ })
7
+ }
8
+
9
+ const onClear = async () => {
10
+ await abTesting.clear()
11
+ }
12
+
13
+ return { onStart, onClear }
14
+ }
15
+
16
+ export default {
17
+ id: 'abTestingLifecyclePlugin',
18
+ type: 'plugin',
19
+ factory: abTestingLifecyclePlugin,
20
+ dependencies: ['abTesting', 'featureFlagAtoms'],
21
+ }