@cdc/filtered-text 4.23.4 → 4.23.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/filtered-text",
3
- "version": "4.23.4",
3
+ "version": "4.23.6",
4
4
  "description": "React component for adding filtered text on dashboards.",
5
5
  "moduleName": "CdcFilteredText",
6
6
  "main": "dist/cdcfilteredtext",
@@ -25,7 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
27
27
  "dependencies": {
28
- "@cdc/core": "^4.23.4",
28
+ "@cdc/core": "^4.23.6",
29
29
  "html-react-parser": "^3.0.8",
30
30
  "papaparse": "^5.3.2"
31
31
  },
@@ -33,5 +33,5 @@
33
33
  "react": "^18.2.0",
34
34
  "react-dom": "^18.2.0"
35
35
  },
36
- "gitHead": "dcd395d76f70b2d113f2b4c6fe50a52522655cd1"
36
+ "gitHead": "aaed0388b487adfeb3e7e278b4ce74df09cbaade"
37
37
  }
@@ -1,17 +1,26 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
 
3
+ // context & initial state
4
+ import ConfigContext from './ConfigContext'
5
+ import defaults from './data/initial-state'
6
+
7
+ // components
3
8
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
4
- import DataTransform from '@cdc/core/helpers/DataTransform'
5
9
  import Loading from '@cdc/core/components/Loading'
6
10
  import EditorPanel from './components/EditorPanel'
7
- import defaults from './data/initial-state'
8
- import ConfigContext from './ConfigContext'
11
+
12
+ // helpers
13
+ import DataTransform from '@cdc/core/helpers/DataTransform'
14
+ import useDataVizClasses from '@cdc/core/helpers/useDataVizClasses'
15
+ import coveUpdateWorker from '@cdc/core/helpers/coveUpdateWorker'
16
+
17
+ // external
9
18
  import parse from 'html-react-parser'
19
+
20
+ // styles
10
21
  import './scss/main.scss'
11
- import useDataVizClasses from '@cdc/core/helpers/useDataVizClasses'
12
22
 
13
23
  const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, isEditor = false, setConfig: setParentConfig }) => {
14
-
15
24
  const transform = new DataTransform()
16
25
  // Default States
17
26
  const [config, setConfig] = useState(defaults)
@@ -46,7 +55,9 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
46
55
  }
47
56
 
48
57
  let newConfig = { ...config, ...response }
49
- updateConfig(newConfig)
58
+ const processedConfig = { ...(await coveUpdateWorker(newConfig)) }
59
+
60
+ updateConfig(processedConfig)
50
61
  setLoading(false)
51
62
  }
52
63
 
@@ -61,6 +72,7 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
61
72
  newConfig.runtime.uniqueId = Date.now()
62
73
 
63
74
  newConfig.runtime.editorErrorMessage = ''
75
+
64
76
  setConfig(newConfig)
65
77
  }
66
78
 
@@ -126,7 +138,7 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
126
138
  )
127
139
 
128
140
  content = (
129
- <div className={`cove ${config.theme} `} style={isDashboard ? { marginTop: '3rem' } : null}>
141
+ <div className={`cove ${config.theme} `}>
130
142
  {isEditor && <EditorPanel>{body}</EditorPanel>}
131
143
  {!isEditor && body}
132
144
  </div>