@stoker-platform/web-app 0.5.31 → 0.5.32

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.32
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: add custom list metric
8
+ - @stoker-platform/node-client@0.5.20
9
+ - @stoker-platform/utils@0.5.14
10
+ - @stoker-platform/web-client@0.5.15
11
+
3
12
  ## 0.5.31
4
13
 
5
14
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.31",
3
+ "version": "0.5.32",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -51,9 +51,9 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "@react-google-maps/api": "^2.20.8",
53
53
  "@sentry/react": "^10.38.0",
54
- "@stoker-platform/node-client": "0.5.19",
55
- "@stoker-platform/utils": "0.5.13",
56
- "@stoker-platform/web-client": "0.5.14",
54
+ "@stoker-platform/node-client": "0.5.20",
55
+ "@stoker-platform/utils": "0.5.14",
56
+ "@stoker-platform/web-client": "0.5.15",
57
57
  "@tanstack/react-table": "^8.21.3",
58
58
  "@types/react": "18.3.13",
59
59
  "@types/react-dom": "18.3.1",
package/src/List.tsx CHANGED
@@ -1133,7 +1133,10 @@ export function List({
1133
1133
  const values: Record<string, MetricValue> = {}
1134
1134
  metrics?.forEach((metric: Metric | Chart, index: number) => {
1135
1135
  if (permissions?.Role && (!metric.roles || metric.roles.includes(permissions?.Role))) {
1136
- if (metric.type === "count") {
1136
+ if (metric.type === "custom" && metric.formula) {
1137
+ // eslint-disable-next-line security/detect-object-injection
1138
+ values[index] = metric.formula(list).toString() || ""
1139
+ } else if (metric.type === "count") {
1137
1140
  let value = (list?.length || 0).toString()
1138
1141
  if (metric.prefix) {
1139
1142
  value = `${metric.prefix}${value}`
@@ -1316,7 +1319,8 @@ export function List({
1316
1319
  if (
1317
1320
  metric.type === "sum" ||
1318
1321
  metric.type === "average" ||
1319
- metric.type === "count"
1322
+ metric.type === "count" ||
1323
+ metric.type === "custom"
1320
1324
  ) {
1321
1325
  const metricTitle =
1322
1326
  metric.title || `Total ${collectionTitle || labels.collection}`