@cdc/waffle-chart 4.25.6 → 4.25.8

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/waffle-chart",
3
- "version": "4.25.6",
3
+ "version": "4.25.8",
4
4
  "description": "React component for displaying a single piece of data in a card module",
5
5
  "moduleName": "CdcWaffleChart",
6
6
  "main": "dist/cdcwafflechart",
@@ -27,7 +27,7 @@
27
27
  "license": "Apache-2.0",
28
28
  "homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
29
29
  "dependencies": {
30
- "@cdc/core": "^4.25.6",
30
+ "@cdc/core": "^4.25.8",
31
31
  "@visx/shape": "^3.12.0",
32
32
  "@visx/text": "^3.12.0",
33
33
  "chroma": "0.0.1",
@@ -37,5 +37,5 @@
37
37
  "react": "^18.2.0",
38
38
  "react-dom": "^18.2.0"
39
39
  },
40
- "gitHead": "6097de1ff814001880d9ac64bd66becdc092d63c"
40
+ "gitHead": "e369994230b5e3facff224e1d89d5937528ac5a0"
41
41
  }
@@ -28,6 +28,7 @@ import useDataVizClasses from '@cdc/core/helpers/useDataVizClasses'
28
28
  import './scss/main.scss'
29
29
  import Title from '@cdc/core/components/ui/Title'
30
30
  import Layout from '@cdc/core/components/Layout'
31
+ import { publishAnalyticsEvent } from '@cdc/core/helpers/metrics/helpers'
31
32
 
32
33
  type CdcWaffleChartProps = {
33
34
  configUrl?: string
@@ -36,6 +37,7 @@ type CdcWaffleChartProps = {
36
37
  isEditor?: boolean
37
38
  link?: string
38
39
  setConfig?: () => void
40
+ interactionLabel?: string
39
41
  }
40
42
 
41
43
  const WaffleChart = ({ config, isEditor, link = '', showConfigConfirm, updateConfig }) => {
@@ -438,7 +440,8 @@ const CdcWaffleChart = ({
438
440
  config: configObj,
439
441
  isDashboard = false,
440
442
  isEditor = false,
441
- setConfig: setParentConfig
443
+ setConfig: setParentConfig,
444
+ interactionLabel = ''
442
445
  }: CdcWaffleChartProps) => {
443
446
  // Default States
444
447
  const [state, dispatch] = useReducer(chartReducer, {
@@ -506,6 +509,7 @@ const CdcWaffleChart = ({
506
509
  useEffect(() => {
507
510
  if (config && !coveLoadedHasRan && container) {
508
511
  publish('cove_loaded', { config: config })
512
+ publishAnalyticsEvent('waffle-chart_loaded', 'load', interactionLabel, 'waffle-chart')
509
513
  dispatch({ type: 'SET_COVE_LOADED_HAS_RAN', payload: true })
510
514
  }
511
515
  }, [config, container])
package/src/index.jsx CHANGED
@@ -12,6 +12,10 @@ let domContainer = document.getElementsByClassName('react-container')[0]
12
12
 
13
13
  ReactDOM.createRoot(domContainer).render(
14
14
  <React.StrictMode>
15
- <CdcWaffleChart configUrl={domContainer.attributes['data-config'].value} isEditor={isEditor} />
15
+ <CdcWaffleChart
16
+ configUrl={domContainer.attributes['data-config'].value}
17
+ interactionLabel={domContainer.attributes['data-config'].value}
18
+ isEditor={isEditor}
19
+ />
16
20
  </React.StrictMode>
17
21
  )