@exodus/ui-config 3.0.0 → 3.1.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/package.json +8 -4
- package/redux/id.js +1 -0
- package/redux/index.js +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ui-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Helper for storing various UI-specific settings/config.",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"utils.js",
|
|
19
19
|
"plugin",
|
|
20
20
|
"api",
|
|
21
|
-
"utils"
|
|
21
|
+
"utils",
|
|
22
|
+
"redux",
|
|
23
|
+
"!**/__tests__/**"
|
|
22
24
|
],
|
|
23
25
|
"scripts": {
|
|
24
26
|
"lint": "eslint . --ignore-path ../../.gitignore",
|
|
@@ -32,8 +34,10 @@
|
|
|
32
34
|
"lodash": "^4.17.21"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
37
|
+
"@exodus/redux-dependency-injection": "^3.0.0",
|
|
35
38
|
"eslint": "^8.44.0",
|
|
36
|
-
"jest": "^29.1.2"
|
|
39
|
+
"jest": "^29.1.2",
|
|
40
|
+
"redux": "^4.2.1"
|
|
37
41
|
},
|
|
38
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "6971e131f985a06823cca580d424122f53e7f93a"
|
|
39
43
|
}
|
package/redux/id.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'uiConfig'
|
package/redux/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import id from './id'
|
|
2
|
+
import { getAtomId } from '../utils'
|
|
3
|
+
|
|
4
|
+
const createUiConfigReduxDefinition = (config) => {
|
|
5
|
+
const configValues = Object.values(config)
|
|
6
|
+
const configAtomMap = configValues.map(({ id }) => [id, getAtomId(id)])
|
|
7
|
+
const initialState = Object.fromEntries(configValues.map(({ id }) => [id, undefined]))
|
|
8
|
+
const eventReducers = Object.fromEntries(
|
|
9
|
+
configAtomMap.map(([configId, atomId]) => [
|
|
10
|
+
atomId,
|
|
11
|
+
(state, payload) => {
|
|
12
|
+
return { ...state, [configId]: payload }
|
|
13
|
+
},
|
|
14
|
+
])
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
id,
|
|
19
|
+
type: 'redux-module',
|
|
20
|
+
initialState,
|
|
21
|
+
eventReducers,
|
|
22
|
+
selectorDefinitions: [],
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default createUiConfigReduxDefinition
|