File tree Expand file tree Collapse file tree
js-packages/storybook/changelog
packages/premium-analytics
packages/widgets-toolkit/src/components/chart-comparative-line
widgets/average-order-value Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change 11/**
22 * External dependencies
33 */
4+ import { LineChart } from '@automattic/charts' ;
45import { formatDate , formatMetricValue } from '@jetpack-premium-analytics/formatters' ;
56import { Stack } from '@wordpress/ui' ;
67import clsx from 'clsx' ;
@@ -9,7 +10,6 @@ import { type ComponentProps } from 'react';
910/**
1011 * Internal dependencies
1112 */
12- import { LineChart } from '../../../../../../../js-packages/charts/src/charts/line-chart' ;
1313import { RESIZE_DEBOUNCE_MS } from '../../constants' ;
1414import { isEmptyChartData , getEmptyChartDomain } from '../../helpers' ;
1515import { ChartTooltip } from '../chart-tooltip' ;
Original file line number Diff line number Diff line change 77 "@jetpack-premium-analytics/widgets-toolkit" : " link:../../packages/widgets-toolkit" ,
88 "@wordpress/i18n" : " ^6.9.0" ,
99 "@wordpress/icons" : " ^13.0.0" ,
10- "@wordpress/ui " : " 0.13.0 " ,
10+ "@wordpress/widget-primitives " : " next " ,
1111 "react" : " 18.3.1"
1212 }
1313}
Original file line number Diff line number Diff line change @@ -6,10 +6,17 @@ import {
66 WidgetRoot ,
77 type ReportParamsFieldAttributes ,
88} from '@jetpack-premium-analytics/widgets-toolkit' ;
9+ import type { AverageOrderValueAttributes } from './widget' ;
10+ import type { WidgetRenderProps } from '@wordpress/widget-primitives' ;
11+ import type { ComponentProps } from 'react' ;
912
10- type AverageOrderValueRenderProps = {
11- attributes ?: Partial < ReportParamsFieldAttributes > ;
12- setError ?: Parameters < typeof WidgetRoot > [ 0 ] [ 'setError' ] ;
13+ // Report params are usually URL-driven (WidgetRoot's fallback), but callers may
14+ // also pass them via `attributes`. Compose the render-only shape to cover both.
15+ type AverageOrderValueRenderAttributes = AverageOrderValueAttributes &
16+ Partial < ReportParamsFieldAttributes > ;
17+
18+ type AverageOrderValueRenderProps = WidgetRenderProps < AverageOrderValueRenderAttributes > & {
19+ setError ?: ComponentProps < typeof WidgetRoot > [ 'setError' ] ;
1320} ;
1421
1522/**
@@ -21,7 +28,7 @@ type AverageOrderValueRenderProps = {
2128 * comparison delta and sparkline.
2229 */
2330export default function AverageOrderValueRender ( {
24- attributes,
31+ attributes = { } ,
2532 setError,
2633} : AverageOrderValueRenderProps ) {
2734 return (
Original file line number Diff line number Diff line change 44import { __ } from '@wordpress/i18n' ;
55import { chartBar } from '@wordpress/icons' ;
66
7+ /**
8+ * The widget has no user-configurable attributes. Report params still reach it
9+ * through WidgetRoot: the dashboard date range, or `attributes.reportParams`
10+ * when a host injects them (e.g. Storybook and dashboard previews).
11+ */
12+ export type AverageOrderValueAttributes = Record < never , never > ;
13+
714/**
815 * Widget type definition.
916 *
You can’t perform that action at this time.
0 commit comments