@burdenoff/fe-libs 2026.1028.5 → 2026.1028.6
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/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/ui/AiCreditBalance.d.ts +36 -0
- package/dist/shared/assistant/ui/AiCreditBalance.js +32 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1013 -1006
- package/dist/shared/assistant/useAiCreditStatus.d.ts +18 -0
- package/dist/shared/assistant/useAiCreditStatus.js +40 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.d.ts +10 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.js +9 -1
- package/dist/shared-assistant.js +198 -196
- package/package.json +1 -1
|
@@ -134,6 +134,7 @@ export * from './ui/AssistantMessageAttachments';
|
|
|
134
134
|
export * from './ui/AssistantPendingWriteCard';
|
|
135
135
|
export * from './ui/AssistantWriteProposalCard';
|
|
136
136
|
export * from './ui/AssistantAiDisclaimer';
|
|
137
|
+
export * from './ui/AiCreditBalance';
|
|
137
138
|
export * from './ui/AssistantWriteConfirmDialog';
|
|
138
139
|
export * from './ui/useWriteProposalConfirm';
|
|
139
140
|
export * from './ui/writeProposalPresentation';
|
|
@@ -305,6 +306,7 @@ export * from './appControls/text';
|
|
|
305
306
|
export * from './turnOutcomeCopy';
|
|
306
307
|
export * from './aiCredits';
|
|
307
308
|
export * from './productAiCredits';
|
|
309
|
+
export * from './useAiCreditStatus';
|
|
308
310
|
export * from './usageReporting';
|
|
309
311
|
export * from './writeProposals';
|
|
310
312
|
export * from './writeReplyBinder';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AiCreditStatus } from '../productAiCredits';
|
|
3
|
+
export interface AiCreditBalanceViewProps {
|
|
4
|
+
/** The workspace's standing; null renders nothing. */
|
|
5
|
+
status: AiCreditStatus | null;
|
|
6
|
+
/** Extra layout classes from the mount point. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Distinguishes the mounts in tests and in Playwright checks. */
|
|
9
|
+
testId?: string;
|
|
10
|
+
/** Number formatting locale. Defaults to the browser's. */
|
|
11
|
+
locale?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Pure presentation of a credit status: nothing for an unknown or unmetered
|
|
15
|
+
* workspace (never a guessed "0 left"), the remaining credits otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AiCreditBalanceView: FC<AiCreditBalanceViewProps>;
|
|
18
|
+
export interface AiCreditBalanceProps extends Omit<AiCreditBalanceViewProps, 'status'> {
|
|
19
|
+
/** Product registry key, for example `fluidgrids`. Reads `<productKey>.ai.credits`. */
|
|
20
|
+
productKey: string;
|
|
21
|
+
/** Workspace to read. Defaults to the shell's active workspace. */
|
|
22
|
+
workspaceId?: string;
|
|
23
|
+
/** False renders nothing and reads nothing (a product that does not meter AI). */
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The remaining AI credits for a product, shown before an AI action
|
|
28
|
+
* (BOFF-3732): under the assistant composer and on a product's own AI surfaces.
|
|
29
|
+
*
|
|
30
|
+
* Re-reads after every charged turn and after a quota wall, so the number
|
|
31
|
+
* follows spend without a reload. Renders nothing while loading, when the read
|
|
32
|
+
* fails, or when the workspace is not metered for the product.
|
|
33
|
+
*
|
|
34
|
+
* Semantic tokens only (`text-text-muted`, `text-status-error-text`).
|
|
35
|
+
*/
|
|
36
|
+
export declare const AiCreditBalance: FC<AiCreditBalanceProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useAiCreditBalanceLabels as e } from "../../providers/shell/useAssistantShellLabels.js";
|
|
2
|
+
import { useAiCreditStatus as t } from "../useAiCreditStatus.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/shared/assistant/ui/AiCreditBalance.tsx
|
|
5
|
+
var r = ({ status: t, className: r, testId: i = "ai-credit-balance", locale: a }) => {
|
|
6
|
+
let o = e();
|
|
7
|
+
if (!t?.provisioned) return null;
|
|
8
|
+
let s, c = "normal";
|
|
9
|
+
if (t.noLimit) s = o.unlimited;
|
|
10
|
+
else if (t.exhausted || t.remaining !== null && t.remaining <= 0) c = "exhausted", s = o.exhausted;
|
|
11
|
+
else if (t.remaining !== null) s = o.remaining(new Intl.NumberFormat(a, { maximumFractionDigits: 0 }).format(Math.floor(t.remaining)));
|
|
12
|
+
else return null;
|
|
13
|
+
return /* @__PURE__ */ n("p", {
|
|
14
|
+
className: `text-[11px] leading-snug ${c === "exhausted" ? "text-status-error-text" : "text-text-muted"}${r ? ` ${r}` : ""}`,
|
|
15
|
+
"data-testid": i,
|
|
16
|
+
"data-tone": c,
|
|
17
|
+
role: "status",
|
|
18
|
+
"aria-live": "polite",
|
|
19
|
+
children: s
|
|
20
|
+
});
|
|
21
|
+
}, i = ({ productKey: e, workspaceId: i, enabled: a = !0, ...o }) => {
|
|
22
|
+
let { status: s } = t(e, {
|
|
23
|
+
enabled: a,
|
|
24
|
+
...i ? { workspaceId: i } : {}
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ n(r, {
|
|
27
|
+
status: a ? s : null,
|
|
28
|
+
...o
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { i as AiCreditBalance, r as AiCreditBalanceView };
|