@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.2
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/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
- package/package.json +2 -2
|
@@ -3,134 +3,135 @@ import { AI_SPEND_WINDOWS as t, formatMicroUsd as n, formatProductKey as r } fro
|
|
|
3
3
|
import { formatNumber as i } from "../../../shared/utils/format.js";
|
|
4
4
|
import { statusTokens as a } from "../../../shared/utils/tokens.js";
|
|
5
5
|
import { useState as o } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ThemedSelect as s } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
import { AlertTriangle as c, RefreshCw as l, Sparkles as u } from "lucide-react";
|
|
8
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
9
|
// src/billing/modules/usage/components/WorkspaceAiSpendPanel.tsx
|
|
9
|
-
var
|
|
10
|
-
let [
|
|
11
|
-
if (
|
|
12
|
-
let
|
|
13
|
-
return /* @__PURE__ */
|
|
10
|
+
var m = ({ workspaceId: m }) => {
|
|
11
|
+
let [h, g] = o("month"), { summary: _, truncated: v, isLoading: y, isForbidden: b, error: x, refetch: S } = e(m, h);
|
|
12
|
+
if (b) return null;
|
|
13
|
+
let C = t.find((e) => e.value === h)?.label ?? "";
|
|
14
|
+
return /* @__PURE__ */ p("section", {
|
|
14
15
|
"aria-labelledby": "workspace-ai-spend-heading",
|
|
15
16
|
"data-testid": "workspace-ai-spend",
|
|
16
17
|
className: "rounded-card border border-border-seam bg-bg-surface shadow-elevation-1 p-4 space-y-3",
|
|
17
18
|
children: [
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ p("div", {
|
|
19
20
|
className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",
|
|
20
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ p("div", {
|
|
21
22
|
className: "flex items-center gap-2",
|
|
22
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ f("span", {
|
|
23
24
|
className: `flex size-7 items-center justify-center rounded-lg ${a.info.bg}`,
|
|
24
|
-
children: /* @__PURE__ */
|
|
25
|
-
}), /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ f(u, { className: `size-4 ${a.info.icon}` })
|
|
26
|
+
}), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h3", {
|
|
26
27
|
id: "workspace-ai-spend-heading",
|
|
27
28
|
className: "text-sm font-semibold text-text-primary",
|
|
28
29
|
children: "AI spend"
|
|
29
|
-
}), /* @__PURE__ */
|
|
30
|
+
}), /* @__PURE__ */ f("p", {
|
|
30
31
|
className: "text-xs text-text-secondary",
|
|
31
32
|
children: "What AI calls cost this workspace, in US dollars."
|
|
32
33
|
})] })]
|
|
33
|
-
}), /* @__PURE__ */
|
|
34
|
+
}), /* @__PURE__ */ p("div", {
|
|
34
35
|
className: "flex items-center gap-2",
|
|
35
36
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ f("label", {
|
|
37
38
|
htmlFor: "workspace-ai-spend-window",
|
|
38
39
|
className: "sr-only",
|
|
39
40
|
children: "AI spend period"
|
|
40
41
|
}),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ f(s, {
|
|
42
43
|
id: "workspace-ai-spend-window",
|
|
43
|
-
value:
|
|
44
|
-
onChange: (e) =>
|
|
44
|
+
value: h,
|
|
45
|
+
onChange: (e) => g(e.target.value),
|
|
45
46
|
className: "px-2 py-1.5 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary",
|
|
46
|
-
children: t.map((e) => /* @__PURE__ */
|
|
47
|
+
children: t.map((e) => /* @__PURE__ */ f("option", {
|
|
47
48
|
value: e.value,
|
|
48
49
|
children: e.label
|
|
49
50
|
}, e.value))
|
|
50
51
|
}),
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ f("button", {
|
|
52
53
|
type: "button",
|
|
53
|
-
onClick:
|
|
54
|
+
onClick: S,
|
|
54
55
|
className: "p-2 border border-border-subtle rounded-button text-text-secondary hover:text-text-primary hover:bg-bg-sunken transition-colors",
|
|
55
56
|
"aria-label": "Refresh AI spend",
|
|
56
57
|
title: "Refresh AI spend",
|
|
57
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ f(l, { className: "size-4" })
|
|
58
59
|
})
|
|
59
60
|
]
|
|
60
61
|
})]
|
|
61
62
|
}),
|
|
62
|
-
|
|
63
|
+
y && !_ && /* @__PURE__ */ f("div", {
|
|
63
64
|
className: "h-16 bg-bg-sunken animate-pulse rounded-card",
|
|
64
65
|
"aria-busy": "true"
|
|
65
66
|
}),
|
|
66
|
-
|
|
67
|
+
x && !_ && /* @__PURE__ */ p("div", {
|
|
67
68
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
68
69
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ f(c, { className: `size-4 ${a.error.icon}` }),
|
|
71
|
+
/* @__PURE__ */ f("span", { children: "AI spend could not be loaded." }),
|
|
72
|
+
/* @__PURE__ */ f("button", {
|
|
72
73
|
type: "button",
|
|
73
|
-
onClick:
|
|
74
|
+
onClick: S,
|
|
74
75
|
className: "underline text-text-primary hover:text-text-secondary",
|
|
75
76
|
children: "Retry"
|
|
76
77
|
})
|
|
77
78
|
]
|
|
78
79
|
}),
|
|
79
|
-
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
_ && /* @__PURE__ */ p(d, { children: [
|
|
81
|
+
/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
|
|
81
82
|
className: "text-2xl font-semibold tabular-nums text-text-primary",
|
|
82
83
|
"data-testid": "workspace-ai-spend-total",
|
|
83
|
-
children: n(
|
|
84
|
-
}), /* @__PURE__ */
|
|
84
|
+
children: n(_.totalMicroUsd)
|
|
85
|
+
}), /* @__PURE__ */ p("p", {
|
|
85
86
|
className: "text-xs text-text-secondary",
|
|
86
87
|
children: [
|
|
87
|
-
|
|
88
|
+
C,
|
|
88
89
|
" (UTC) · ",
|
|
89
|
-
i(
|
|
90
|
+
i(_.attempts),
|
|
90
91
|
" AI",
|
|
91
92
|
" ",
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
_.attempts === 1 ? "call" : "calls",
|
|
94
|
+
_.unpricedAttempts > 0 && ` · ${i(_.unpricedAttempts)} without a recorded cost`
|
|
94
95
|
]
|
|
95
96
|
})] }),
|
|
96
|
-
|
|
97
|
+
_.products.length === 0 ? /* @__PURE__ */ f("p", {
|
|
97
98
|
className: "text-sm text-text-secondary",
|
|
98
99
|
children: "No AI usage in this period."
|
|
99
|
-
}) : /* @__PURE__ */
|
|
100
|
+
}) : /* @__PURE__ */ f("div", {
|
|
100
101
|
className: "overflow-x-auto",
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ p("table", {
|
|
102
103
|
className: "w-full text-sm",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", {
|
|
104
105
|
className: "text-left text-xs text-text-secondary border-b border-border-seam",
|
|
105
106
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ f("th", {
|
|
107
108
|
scope: "col",
|
|
108
109
|
className: "py-2 pr-4 font-medium",
|
|
109
110
|
children: "Product"
|
|
110
111
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ f("th", {
|
|
112
113
|
scope: "col",
|
|
113
114
|
className: "py-2 pr-4 font-medium text-right",
|
|
114
115
|
children: "AI calls"
|
|
115
116
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ f("th", {
|
|
117
118
|
scope: "col",
|
|
118
119
|
className: "py-2 font-medium text-right",
|
|
119
120
|
children: "Cost (USD)"
|
|
120
121
|
})
|
|
121
122
|
]
|
|
122
|
-
}) }), /* @__PURE__ */
|
|
123
|
+
}) }), /* @__PURE__ */ f("tbody", { children: _.products.map((e) => /* @__PURE__ */ p("tr", {
|
|
123
124
|
className: "border-b border-border-seam last:border-0",
|
|
124
125
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ f("td", {
|
|
126
127
|
className: "py-2 pr-4 text-text-primary",
|
|
127
128
|
children: r(e.productKey)
|
|
128
129
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ f("td", {
|
|
130
131
|
className: "py-2 pr-4 text-right tabular-nums text-text-secondary",
|
|
131
132
|
children: i(e.attempts)
|
|
132
133
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ f("td", {
|
|
134
135
|
className: "py-2 text-right tabular-nums text-text-primary",
|
|
135
136
|
children: n(e.costMicroUsd)
|
|
136
137
|
})
|
|
@@ -138,14 +139,14 @@ var p = ({ workspaceId: p }) => {
|
|
|
138
139
|
}, e.productKey)) })]
|
|
139
140
|
})
|
|
140
141
|
}),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ p("p", {
|
|
142
143
|
className: "text-xs text-text-secondary",
|
|
143
|
-
children: ["Costs come from the workspace's AI ledger at the provider prices recorded for each call. AI credits are charged at USD 0.000003 per credit.",
|
|
144
|
+
children: ["Costs come from the workspace's AI ledger at the provider prices recorded for each call. AI credits are charged at USD 0.000003 per credit.", v && " Only the products with the highest cost are listed."]
|
|
144
145
|
})
|
|
145
146
|
] })
|
|
146
147
|
]
|
|
147
148
|
});
|
|
148
149
|
};
|
|
149
|
-
export {
|
|
150
|
+
export { m as WorkspaceAiSpendPanel };
|
|
150
151
|
|
|
151
152
|
//# sourceMappingURL=WorkspaceAiSpendPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceAiSpendPanel.js","names":["_Fragment","Fragment$1","WorkspaceAiSpendPanel","spendWindow","setSpendWindow","useState","useWorkspaceAiSpend","workspaceId","isForbidden","windowLabel","AI_SPEND_WINDOWS","option","statusTokens","Sparkles","event","refetch","RefreshCw","isLoading","summary","error","AlertTriangle","formatMicroUsd","formatNumber","formatProductKey","row","truncated"],"sources":["../../../../../src/billing/modules/usage/components/WorkspaceAiSpendPanel.tsx"],"sourcesContent":["/**\n * Workspace AI spend in US dollars (BOFF-10273).\n *\n * Sits in the workspace view of the usage page, above the workspace quotas, so\n * a workspace admin sees what AI cost the workspace in dollars next to the AI\n * credit quota that limits it. Members who may not read the AI ledger see\n * nothing: the gateway refuses the query and the panel stays hidden.\n */\n\nimport { useState, type FC } from 'react';\nimport { AlertTriangle, RefreshCw, Sparkles } from 'lucide-react';\nimport { useWorkspaceAiSpend } from '../hooks/useWorkspaceAiSpend';\nimport {\n AI_SPEND_WINDOWS,\n formatMicroUsd,\n formatProductKey,\n type AiSpendWindow,\n} from '../utils/aiSpend';\nimport { formatNumber } from '../../../shared/utils/format';\nimport { statusTokens } from '../../../shared/utils/tokens';\n\ninterface WorkspaceAiSpendPanelProps {\n workspaceId: string;\n}\n\nexport const WorkspaceAiSpendPanel: FC<WorkspaceAiSpendPanelProps> = ({ workspaceId }) => {\n const [spendWindow, setSpendWindow] = useState<AiSpendWindow>('month');\n const { summary, truncated, isLoading, isForbidden, error, refetch } = useWorkspaceAiSpend(\n workspaceId,\n spendWindow\n );\n\n if (isForbidden) return null;\n\n const windowLabel = AI_SPEND_WINDOWS.find((option) => option.value === spendWindow)?.label ?? '';\n\n return (\n <section\n aria-labelledby=\"workspace-ai-spend-heading\"\n data-testid=\"workspace-ai-spend\"\n className=\"rounded-card border border-border-seam bg-bg-surface shadow-elevation-1 p-4 space-y-3\"\n >\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex items-center gap-2\">\n <span\n className={`flex size-7 items-center justify-center rounded-lg ${statusTokens.info.bg}`}\n >\n <Sparkles className={`size-4 ${statusTokens.info.icon}`} />\n </span>\n <div>\n <h3 id=\"workspace-ai-spend-heading\" className=\"text-sm font-semibold text-text-primary\">\n AI spend\n </h3>\n <p className=\"text-xs text-text-secondary\">\n What AI calls cost this workspace, in US dollars.\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <label htmlFor=\"workspace-ai-spend-window\" className=\"sr-only\">\n AI spend period\n </label>\n <
|
|
1
|
+
{"version":3,"file":"WorkspaceAiSpendPanel.js","names":["_Fragment","Fragment$1","WorkspaceAiSpendPanel","spendWindow","setSpendWindow","useState","useWorkspaceAiSpend","workspaceId","isForbidden","windowLabel","AI_SPEND_WINDOWS","option","statusTokens","Sparkles","ThemedSelect","event","refetch","RefreshCw","isLoading","summary","error","AlertTriangle","formatMicroUsd","formatNumber","formatProductKey","row","truncated"],"sources":["../../../../../src/billing/modules/usage/components/WorkspaceAiSpendPanel.tsx"],"sourcesContent":["/**\n * Workspace AI spend in US dollars (BOFF-10273).\n *\n * Sits in the workspace view of the usage page, above the workspace quotas, so\n * a workspace admin sees what AI cost the workspace in dollars next to the AI\n * credit quota that limits it. Members who may not read the AI ledger see\n * nothing: the gateway refuses the query and the panel stays hidden.\n */\n\nimport { useState, type FC } from 'react';\nimport { AlertTriangle, RefreshCw, Sparkles } from 'lucide-react';\nimport { useWorkspaceAiSpend } from '../hooks/useWorkspaceAiSpend';\nimport {\n AI_SPEND_WINDOWS,\n formatMicroUsd,\n formatProductKey,\n type AiSpendWindow,\n} from '../utils/aiSpend';\nimport { formatNumber } from '../../../shared/utils/format';\nimport { statusTokens } from '../../../shared/utils/tokens';\nimport { ThemedSelect } from '@burdenoff/fe-libs/ui';\n\ninterface WorkspaceAiSpendPanelProps {\n workspaceId: string;\n}\n\nexport const WorkspaceAiSpendPanel: FC<WorkspaceAiSpendPanelProps> = ({ workspaceId }) => {\n const [spendWindow, setSpendWindow] = useState<AiSpendWindow>('month');\n const { summary, truncated, isLoading, isForbidden, error, refetch } = useWorkspaceAiSpend(\n workspaceId,\n spendWindow\n );\n\n if (isForbidden) return null;\n\n const windowLabel = AI_SPEND_WINDOWS.find((option) => option.value === spendWindow)?.label ?? '';\n\n return (\n <section\n aria-labelledby=\"workspace-ai-spend-heading\"\n data-testid=\"workspace-ai-spend\"\n className=\"rounded-card border border-border-seam bg-bg-surface shadow-elevation-1 p-4 space-y-3\"\n >\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex items-center gap-2\">\n <span\n className={`flex size-7 items-center justify-center rounded-lg ${statusTokens.info.bg}`}\n >\n <Sparkles className={`size-4 ${statusTokens.info.icon}`} />\n </span>\n <div>\n <h3 id=\"workspace-ai-spend-heading\" className=\"text-sm font-semibold text-text-primary\">\n AI spend\n </h3>\n <p className=\"text-xs text-text-secondary\">\n What AI calls cost this workspace, in US dollars.\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <label htmlFor=\"workspace-ai-spend-window\" className=\"sr-only\">\n AI spend period\n </label>\n <ThemedSelect\n id=\"workspace-ai-spend-window\"\n value={spendWindow}\n onChange={(event) => setSpendWindow(event.target.value as AiSpendWindow)}\n className=\"px-2 py-1.5 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary\"\n >\n {AI_SPEND_WINDOWS.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </ThemedSelect>\n <button\n type=\"button\"\n onClick={refetch}\n className=\"p-2 border border-border-subtle rounded-button text-text-secondary hover:text-text-primary hover:bg-bg-sunken transition-colors\"\n aria-label=\"Refresh AI spend\"\n title=\"Refresh AI spend\"\n >\n <RefreshCw className=\"size-4\" />\n </button>\n </div>\n </div>\n\n {isLoading && !summary && (\n <div className=\"h-16 bg-bg-sunken animate-pulse rounded-card\" aria-busy=\"true\" />\n )}\n\n {error && !summary && (\n <div className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <AlertTriangle className={`size-4 ${statusTokens.error.icon}`} />\n <span>AI spend could not be loaded.</span>\n <button\n type=\"button\"\n onClick={refetch}\n className=\"underline text-text-primary hover:text-text-secondary\"\n >\n Retry\n </button>\n </div>\n )}\n\n {summary && (\n <>\n <div>\n <p\n className=\"text-2xl font-semibold tabular-nums text-text-primary\"\n data-testid=\"workspace-ai-spend-total\"\n >\n {formatMicroUsd(summary.totalMicroUsd)}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {windowLabel} (UTC) · {formatNumber(summary.attempts)} AI{' '}\n {summary.attempts === 1 ? 'call' : 'calls'}\n {summary.unpricedAttempts > 0 &&\n ` · ${formatNumber(summary.unpricedAttempts)} without a recorded cost`}\n </p>\n </div>\n\n {summary.products.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">No AI usage in this period.</p>\n ) : (\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"text-left text-xs text-text-secondary border-b border-border-seam\">\n <th scope=\"col\" className=\"py-2 pr-4 font-medium\">\n Product\n </th>\n <th scope=\"col\" className=\"py-2 pr-4 font-medium text-right\">\n AI calls\n </th>\n <th scope=\"col\" className=\"py-2 font-medium text-right\">\n Cost (USD)\n </th>\n </tr>\n </thead>\n <tbody>\n {summary.products.map((row) => (\n <tr key={row.productKey} className=\"border-b border-border-seam last:border-0\">\n <td className=\"py-2 pr-4 text-text-primary\">\n {formatProductKey(row.productKey)}\n </td>\n <td className=\"py-2 pr-4 text-right tabular-nums text-text-secondary\">\n {formatNumber(row.attempts)}\n </td>\n <td className=\"py-2 text-right tabular-nums text-text-primary\">\n {formatMicroUsd(row.costMicroUsd)}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n\n <p className=\"text-xs text-text-secondary\">\n Costs come from the workspace's AI ledger at the provider prices recorded for each\n call. AI credits are charged at USD 0.000003 per credit.\n {truncated && ' Only the products with the highest cost are listed.'}\n </p>\n </>\n )}\n </section>\n );\n};\n"],"mappings":";;;;;;;;;AA0BA,IAAaE,KAAyD,EAAE,qBAAkB;CACxF,IAAM,CAACC,GAAaC,KAAkBC,EAAwB,OAAO,GAC/D,EAAE,YAAS,cAAW,cAAW,gBAAa,UAAO,eAAYC,EACrEC,GACAJ,CACF;CAEA,IAAIK,GAAa,OAAO;CAExB,IAAMC,IAAcC,EAAiB,MAAM,MAAWC,EAAO,UAAUR,CAAW,CAAC,EAAE,SAAS;CAE9F,OACE,kBAAC,WAAD;EACE,mBAAgB;EAChB,eAAY;EACZ,WAAU;EAHZ,UAAA;GAKE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,QAAD;MACE,WAAW,sDAAsDS,EAAa,KAAK;MAEnF,UAAA,kBAACC,GAAD,EAAU,WAAW,UAAUD,EAAa,KAAK,OAAS,CAAA;KACtD,CAAA,GACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;MAAI,IAAG;MAA6B,WAAU;MAA0C,UAAA;KAEpF,CAAA,GACJ,kBAAC,KAAD;MAAG,WAAU;MAA8B,UAAA;KAExC,CAAA,CACA,EAAA,CAAA,CACF;IACL,CAAA,GAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,SAAD;OAAO,SAAQ;OAA4B,WAAU;OAAU,UAAA;MAExD,CAAA;MACP,kBAACE,GAAD;OACE,IAAG;OACH,OAAOX;OACP,WAAW,MAAUC,EAAeW,EAAM,OAAO,KAAsB;OACvE,WAAU;OAET,UAAAL,EAAiB,KAAK,MAC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