@pagamio/frontend-commons-lib 0.8.214 → 0.8.215
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.
|
@@ -7,7 +7,7 @@ import { FilterComponent, Tab } from '../components';
|
|
|
7
7
|
import { useMediaQueries } from '../shared';
|
|
8
8
|
import ErrorState from './components/ErrorState';
|
|
9
9
|
import FilterComponentSkeleton from './components/FilterComponentSkeleton';
|
|
10
|
-
import { defaultDashboardApiPaths, getFilterOptionsData, getGridColProps } from './utils';
|
|
10
|
+
import { DashboardPaths, defaultDashboardApiPaths, getFilterOptionsData, getGridColProps, } from './utils';
|
|
11
11
|
import componentRegistry from './visualRegistry';
|
|
12
12
|
const OverviewContent = ({ visualData, renderContent, renderVisual }) => {
|
|
13
13
|
return (_jsxs(_Fragment, { children: [renderContent(), _jsx("main", { children: visualData.map((section) => (_jsxs("div", { className: "mb-2", children: [section.sectionTitle && _jsx("h2", { className: "mb-2 text-1xl font-semibold", children: section.sectionTitle }), _jsx(Grid, { gutter: "md", align: "stretch", className: "mb-[6px]", children: section.data.map((visual) => {
|
|
@@ -170,9 +170,15 @@ const DashboardWrapper = ({ data, showVisualHeader = true, showEventsTabbedLayou
|
|
|
170
170
|
return null;
|
|
171
171
|
}
|
|
172
172
|
// Determine URL based on component type and custom apiPaths
|
|
173
|
-
//
|
|
173
|
+
// Priority:
|
|
174
|
+
// 1. metricData.url (Specific override)
|
|
175
|
+
// 2. apiPaths.metrics/query (Configured path)
|
|
176
|
+
// 3. DashboardPaths.METRICS/QUERY (Library default)
|
|
174
177
|
const isTileType = metricData.type === 'Tile' || metricData.type === 'MetricSummaryCard';
|
|
175
|
-
|
|
178
|
+
// Determine the API path or fallback default
|
|
179
|
+
const defaultPath = isTileType ? DashboardPaths.METRICS : DashboardPaths.QUERY;
|
|
180
|
+
const apiPath = isTileType ? apiPaths.metrics : apiPaths.query;
|
|
181
|
+
const defaultUrl = apiPath || defaultPath;
|
|
176
182
|
const url = metricData.url || defaultUrl;
|
|
177
183
|
const props = {
|
|
178
184
|
data: metricData.data,
|
|
@@ -4,8 +4,9 @@ import Card from '../components/CardWrapper';
|
|
|
4
4
|
import ChartWrapper from '../components/ChartWrapper';
|
|
5
5
|
import { useChartData } from '../hooks/useChartData';
|
|
6
6
|
import { DashboardPaths, formatValue } from '../utils';
|
|
7
|
-
const Tile = ({ query, title, format, url
|
|
8
|
-
const
|
|
7
|
+
const Tile = ({ query, title, format, url, details, valueKey, previousValueKey, changeKey, currency: propCurrency, currencyDisplaySymbol, ...props }) => {
|
|
8
|
+
const effectiveUrl = url || DashboardPaths.METRICS;
|
|
9
|
+
const { data, error, loading, isEmpty, refresh } = useChartData(effectiveUrl, query);
|
|
9
10
|
// Safe default values - handle both flat and nested data structures
|
|
10
11
|
let value = 0;
|
|
11
12
|
if (data) {
|
|
@@ -168,8 +168,14 @@ export function DashboardWrapperV2({ data, showVisualHeader = true, showEventsTa
|
|
|
168
168
|
return null;
|
|
169
169
|
}
|
|
170
170
|
// Determine API URL based on component type
|
|
171
|
+
// Priority:
|
|
172
|
+
// 1. metricData.url (Specific override)
|
|
173
|
+
// 2. apiPaths.metrics/query (Configured path)
|
|
174
|
+
// 3. Fallback to hardcoded defaults (if apiPaths is incomplete)
|
|
171
175
|
const isTileType = metricData.type === 'Tile' || metricData.type === 'StatCard' || metricData.type === 'MetricCard';
|
|
172
|
-
const
|
|
176
|
+
const defaultPath = isTileType ? defaultDashboardApiPaths.metrics : defaultDashboardApiPaths.query;
|
|
177
|
+
const apiPath = isTileType ? apiPaths.metrics : apiPaths.query;
|
|
178
|
+
const defaultUrl = apiPath || defaultPath;
|
|
173
179
|
const url = metricData.url || defaultUrl;
|
|
174
180
|
// Build props compatible with V2 components
|
|
175
181
|
const props = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagamio/frontend-commons-lib",
|
|
3
3
|
"description": "Pagamio library for Frontend reusable components like the form engine and table container",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.215",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|