@growth-operations/ui-shared 1.30.0 → 1.30.1

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": "@growth-operations/ui-shared",
3
- "version": "1.30.0",
3
+ "version": "1.30.1",
4
4
  "description": "Shared HubSpot UI-extension modules (Home, Billing) for Growth Operations apps.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -76,7 +76,16 @@ export function makeUsageFetcher({ context, basePath = DEFAULT_BASE_PATH, portal
76
76
 
77
77
  // Hook-free presentational core (exported for tests): stats + stacked chart
78
78
  // from an already-loaded payload.
79
- export function BillingPeriodUsageView({ data, periods, appName, showStats }) {
79
+ export function BillingPeriodUsageView({
80
+ data,
81
+ periods,
82
+ appName,
83
+ showStats,
84
+ emptyTitle = "No usage in this window",
85
+ // Customer-facing default; internal hosts (the GOAA card) override — their
86
+ // viewer isn't the user, so "you run a metered action" reads wrong there.
87
+ emptyBody = null,
88
+ }) {
80
89
  const series = data?.series ?? [];
81
90
  const usedInWindow = data?.used_in_window ?? 0;
82
91
  const remaining = data?.remaining;
@@ -96,10 +105,10 @@ export function BillingPeriodUsageView({ data, periods, appName, showStats }) {
96
105
  )}
97
106
 
98
107
  {series.length === 0 ? (
99
- <EmptyState title="No usage in this window" layout="vertical">
108
+ <EmptyState title={emptyTitle} layout="vertical">
100
109
  <Text>
101
- Once you run a metered {appName} action, your credit usage shows
102
- here by billing period. Try a longer lookback.
110
+ {emptyBody ??
111
+ `Once you run a metered ${appName} action, your credit usage shows here by billing period. Try a longer lookback.`}
103
112
  </Text>
104
113
  </EmptyState>
105
114
  ) : (
@@ -133,6 +142,8 @@ export function BillingPeriodUsage({
133
142
  title = "Usage",
134
143
  titleAs = "heading", // "text" for CRM-card contexts (bold Text, not Heading)
135
144
  showStats = true,
145
+ emptyTitle,
146
+ emptyBody,
136
147
  }) {
137
148
  const [periods, setPeriods] = useState("1");
138
149
  const fetcher = fetchUsage ?? makeUsageFetcher({ context, basePath, portalId });
@@ -167,12 +178,14 @@ export function BillingPeriodUsage({
167
178
  fetchUsage={fetcher}
168
179
  appName={appName}
169
180
  showStats={showStats}
181
+ emptyTitle={emptyTitle}
182
+ emptyBody={emptyBody}
170
183
  />
171
184
  </Flex>
172
185
  );
173
186
  }
174
187
 
175
- function BillingPeriodContent({ periods, fetchUsage, appName, showStats }) {
188
+ function BillingPeriodContent({ periods, fetchUsage, appName, showStats, emptyTitle, emptyBody }) {
176
189
  const [data, setData] = useState(null);
177
190
  const [loading, setLoading] = useState(true);
178
191
  const [error, setError] = useState(null);
@@ -213,6 +226,8 @@ function BillingPeriodContent({ periods, fetchUsage, appName, showStats }) {
213
226
  periods={periods}
214
227
  appName={appName}
215
228
  showStats={showStats}
229
+ emptyTitle={emptyTitle}
230
+ emptyBody={emptyBody}
216
231
  />
217
232
  );
218
233
  }