@opengeni/react 7.4.0-canary.36855269964001 → 7.4.0
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/README.md +3 -48
- package/dist/artifacts-document.js +2 -3
- package/dist/artifacts-presentation.js +2 -3
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +0 -1
- package/dist/artifacts.js +1402 -505
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-R6KK5VKR.js → browser-viewer-2E6R2Y4W.js} +4 -4
- package/dist/{chunk-WUISZ3WU.js → chunk-3E2AITTZ.js} +28 -32
- package/dist/{chunk-WUISZ3WU.js.map → chunk-3E2AITTZ.js.map} +1 -1
- package/dist/{chunk-PWUILT2U.js → chunk-5AZSK6MV.js} +2 -2
- package/dist/{chunk-Y2PRMYLC.js → chunk-DUEBTL3N.js} +3 -4
- package/dist/{chunk-Y2PRMYLC.js.map → chunk-DUEBTL3N.js.map} +1 -1
- package/dist/{chunk-7UAMYXJY.js → chunk-KNDIXZN6.js} +18 -25
- package/dist/{chunk-7UAMYXJY.js.map → chunk-KNDIXZN6.js.map} +1 -1
- package/dist/{chunk-P4G6K2E2.js → chunk-L4OSXQ6H.js} +884 -1119
- package/dist/chunk-L4OSXQ6H.js.map +1 -0
- package/dist/{chunk-LLIH7Q4B.js → chunk-S5JQ4R22.js} +19 -47
- package/dist/chunk-S5JQ4R22.js.map +1 -0
- package/dist/{chunk-A4UJB2MM.js → chunk-SEEVCT36.js} +2 -2
- package/dist/{chunk-UXJCQ5GH.js → chunk-UDD6DLLT.js} +1 -6
- package/dist/chunk-UDD6DLLT.js.map +1 -0
- package/dist/chunk-UGMKPUEM.js +299 -0
- package/dist/chunk-UGMKPUEM.js.map +1 -0
- package/dist/{chunk-ZCZHKJKZ.js → chunk-USXVQACU.js} +3 -3
- package/dist/{chunk-VABBF52G.js → chunk-V2ABIVYJ.js} +6 -70
- package/dist/chunk-V2ABIVYJ.js.map +1 -0
- package/dist/{chunk-TVO6GXR6.js → chunk-X4HIN6TV.js} +162 -71
- package/dist/chunk-X4HIN6TV.js.map +1 -0
- package/dist/{chunk-IIDEIBMC.js → chunk-XEJEOAOV.js} +38 -49
- package/dist/chunk-XEJEOAOV.js.map +1 -0
- package/dist/{chunk-ZKLCPBWN.js → chunk-Y3QTZN2F.js} +5 -5
- package/dist/{chunk-73BUNGLF.js → chunk-YZ3YYMOM.js} +1 -1
- package/dist/components/artifacts/editable-artifact-ui.d.ts +1 -2
- package/dist/components/artifacts/index.d.ts +0 -7
- package/dist/components/browser-select-control.d.ts +1 -3
- package/dist/components/message-timeline.d.ts +1 -18
- package/dist/components/open-geni-links.d.ts +0 -16
- package/dist/components/session-conversation.d.ts +1 -20
- package/dist/composer.js +3 -3
- package/dist/{computer-viewer-DJHPSP2J.js → computer-viewer-WMJE6OA3.js} +3 -3
- package/dist/connect.js +6 -7
- package/dist/connect.js.map +1 -1
- package/dist/hooks/latest-question.d.ts +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js +28 -39
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +4 -4
- package/dist/{latest-question-KGCDK3XX.js → latest-question-QB4EUCW5.js} +3 -3
- package/dist/lib/format.d.ts +0 -3
- package/dist/machines.js +2 -2
- package/dist/{markdown-table-layout-QXSLK4BY.js → markdown-table-layout-PFUEZ2U4.js} +5 -37
- package/dist/markdown-table-layout-PFUEZ2U4.js.map +1 -0
- package/dist/{sandbox-files-4PMXDSDV.js → sandbox-files-PXPIZAFG.js} +2 -2
- package/dist/session-ui.d.ts +2 -5
- package/dist/session-ui.js +13 -23
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +3 -3
- package/dist/sites.js +289 -4
- package/dist/sites.js.map +1 -1
- package/dist/timeline/types.d.ts +1 -7
- package/dist/{timeline-annotation-selection-DMLMM2TX.js → timeline-annotation-selection-ODLVF4OI.js} +1 -6
- package/dist/timeline-annotation-selection-ODLVF4OI.js.map +1 -0
- package/package.json +3 -7
- package/src/artifacts.ts +0 -37
- package/src/components/artifacts/editable-artifact-ui.tsx +1 -3
- package/src/components/artifacts/editable-artifact-workbench.tsx +2 -5
- package/src/components/artifacts/editable-document.tsx +36 -34
- package/src/components/artifacts/editable-presentation.tsx +16 -21
- package/src/components/artifacts/index.ts +0 -41
- package/src/components/browser-select-control.tsx +1 -4
- package/src/components/browser-viewer.tsx +22 -81
- package/src/components/computer-viewer.tsx +23 -51
- package/src/components/markdown-table-layout.ts +5 -49
- package/src/components/markdown.tsx +2 -5
- package/src/components/message-timeline.tsx +434 -515
- package/src/components/open-geni-links.tsx +0 -24
- package/src/components/session-conversation.tsx +20 -131
- package/src/components/timeline-annotation-selection.tsx +0 -7
- package/src/hooks/use-available-models.ts +1 -1
- package/src/index.ts +0 -9
- package/src/lib/format.ts +0 -13
- package/src/session-ui.ts +0 -9
- package/src/timeline/projection.ts +4 -78
- package/src/timeline/types.ts +0 -7
- package/styles/compiled.css +0 -325
- package/dist/chat-interactive-block-VAGABN7J.js +0 -11
- package/dist/chunk-5CVXZA3Y.js +0 -292
- package/dist/chunk-5CVXZA3Y.js.map +0 -1
- package/dist/chunk-B3V6TG77.js +0 -41
- package/dist/chunk-B3V6TG77.js.map +0 -1
- package/dist/chunk-IIDEIBMC.js.map +0 -1
- package/dist/chunk-LLIH7Q4B.js.map +0 -1
- package/dist/chunk-P4G6K2E2.js.map +0 -1
- package/dist/chunk-RAIQYITC.js +0 -1772
- package/dist/chunk-RAIQYITC.js.map +0 -1
- package/dist/chunk-SCOTPE2I.js +0 -589
- package/dist/chunk-SCOTPE2I.js.map +0 -1
- package/dist/chunk-TVO6GXR6.js.map +0 -1
- package/dist/chunk-UXJCQ5GH.js.map +0 -1
- package/dist/chunk-VABBF52G.js.map +0 -1
- package/dist/chunk-WEHMPOXK.js +0 -39
- package/dist/chunk-WEHMPOXK.js.map +0 -1
- package/dist/chunk-XCHWDJ22.js +0 -107
- package/dist/chunk-XCHWDJ22.js.map +0 -1
- package/dist/components/artifacts/artifact-chrome.d.ts +0 -120
- package/dist/components/artifacts/artifact-sandbox.d.ts +0 -27
- package/dist/components/artifacts/chat-interactive-block.d.ts +0 -29
- package/dist/components/artifacts/deferred-chat-media.d.ts +0 -15
- package/dist/components/artifacts/editable-artifact-view.d.ts +0 -46
- package/dist/components/artifacts/latest-task-runner.d.ts +0 -15
- package/dist/components/artifacts/session-artifact-viewer.d.ts +0 -39
- package/dist/components/artifacts/site-view.d.ts +0 -23
- package/dist/components/timeline-pill-geometry.d.ts +0 -6
- package/dist/components/timeline-pill-placement.d.ts +0 -18
- package/dist/components/usage-limit-notice.d.ts +0 -49
- package/dist/components/usage-member-list.d.ts +0 -91
- package/dist/components/usage-meter.d.ts +0 -73
- package/dist/hooks/use-usage.d.ts +0 -40
- package/dist/markdown-table-layout-QXSLK4BY.js.map +0 -1
- package/dist/sandbox-files-4PMXDSDV.js.map +0 -1
- package/dist/timeline/allowance-exhausted-row.d.ts +0 -24
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +0 -1
- package/dist/timeline-pill-geometry-2G6EK47V.js +0 -73
- package/dist/timeline-pill-geometry-2G6EK47V.js.map +0 -1
- package/dist/usage/allowance-copy.d.ts +0 -25
- package/dist/usage/summary.d.ts +0 -35
- package/dist/usage.d.ts +0 -13
- package/dist/usage.js +0 -1073
- package/dist/usage.js.map +0 -1
- package/src/components/artifacts/artifact-chrome.tsx +0 -413
- package/src/components/artifacts/artifact-sandbox.tsx +0 -185
- package/src/components/artifacts/chat-interactive-block.tsx +0 -260
- package/src/components/artifacts/deferred-chat-media.tsx +0 -67
- package/src/components/artifacts/editable-artifact-view.tsx +0 -187
- package/src/components/artifacts/latest-task-runner.ts +0 -49
- package/src/components/artifacts/session-artifact-viewer.tsx +0 -376
- package/src/components/artifacts/site-view.tsx +0 -116
- package/src/components/timeline-pill-geometry.ts +0 -112
- package/src/components/timeline-pill-placement.ts +0 -81
- package/src/components/usage-limit-notice.tsx +0 -179
- package/src/components/usage-member-list.tsx +0 -792
- package/src/components/usage-meter.tsx +0 -382
- package/src/hooks/use-usage.ts +0 -100
- package/src/timeline/allowance-exhausted-row.tsx +0 -86
- package/src/usage/allowance-copy.ts +0 -64
- package/src/usage/summary.ts +0 -93
- package/src/usage.ts +0 -50
- /package/dist/{browser-viewer-R6KK5VKR.js.map → browser-viewer-2E6R2Y4W.js.map} +0 -0
- /package/dist/{chunk-PWUILT2U.js.map → chunk-5AZSK6MV.js.map} +0 -0
- /package/dist/{chunk-A4UJB2MM.js.map → chunk-SEEVCT36.js.map} +0 -0
- /package/dist/{chunk-ZCZHKJKZ.js.map → chunk-USXVQACU.js.map} +0 -0
- /package/dist/{chunk-ZKLCPBWN.js.map → chunk-Y3QTZN2F.js.map} +0 -0
- /package/dist/{chunk-73BUNGLF.js.map → chunk-YZ3YYMOM.js.map} +0 -0
- /package/dist/{chat-interactive-block-VAGABN7J.js.map → computer-viewer-WMJE6OA3.js.map} +0 -0
- /package/dist/{latest-question-KGCDK3XX.js.map → latest-question-QB4EUCW5.js.map} +0 -0
- /package/dist/{computer-viewer-DJHPSP2J.js.map → sandbox-files-PXPIZAFG.js.map} +0 -0
package/src/usage/summary.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
MemberAllowanceUsage,
|
|
3
|
-
UsageAllowanceStatus,
|
|
4
|
-
WorkspaceAllowanceUsage,
|
|
5
|
-
WorkspaceUsageResponse,
|
|
6
|
-
} from "@opengeni/sdk/usage-allowances";
|
|
7
|
-
|
|
8
|
-
import type { AllowanceScope } from "./allowance-copy";
|
|
9
|
-
|
|
10
|
-
/** One ceiling as a person reads it: how much of it is used, and when it resets. */
|
|
11
|
-
export type UsageReading = {
|
|
12
|
-
scope: AllowanceScope;
|
|
13
|
-
/** Used share of the ceiling. Can exceed 1 after post-call overshoot. */
|
|
14
|
-
fraction: number;
|
|
15
|
-
status: UsageAllowanceStatus;
|
|
16
|
-
resetsAt: string | null;
|
|
17
|
-
/** USD micros. Only shown when a host opts in with `formatAmount`. */
|
|
18
|
-
used: number;
|
|
19
|
-
limit: number;
|
|
20
|
-
remaining: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* What a member can still do: `unlimited` when no ceiling applies, otherwise
|
|
25
|
-
* the state of whichever ceiling stops them first (`binding`).
|
|
26
|
-
*/
|
|
27
|
-
export type UsageSummary = {
|
|
28
|
-
state: "unlimited" | "ok" | "warning" | "exhausted";
|
|
29
|
-
/** The ceiling a person would ask to raise; null when unlimited. */
|
|
30
|
-
binding: UsageReading | null;
|
|
31
|
-
/** Their own ceiling, when one applies. */
|
|
32
|
-
member: UsageReading | null;
|
|
33
|
-
/** The shared workspace pool, when one is set. */
|
|
34
|
-
workspace: UsageReading | null;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
function reading(
|
|
38
|
-
scope: AllowanceScope,
|
|
39
|
-
usage: Pick<
|
|
40
|
-
WorkspaceAllowanceUsage | MemberAllowanceUsage,
|
|
41
|
-
"limit" | "used" | "remaining" | "fraction" | "status" | "resetsAt"
|
|
42
|
-
>,
|
|
43
|
-
): UsageReading | null {
|
|
44
|
-
if (usage.limit === null) return null;
|
|
45
|
-
return {
|
|
46
|
-
scope,
|
|
47
|
-
fraction: usage.fraction ?? (usage.limit === 0 ? 1 : usage.used / usage.limit),
|
|
48
|
-
status: usage.status,
|
|
49
|
-
resetsAt: usage.resetsAt,
|
|
50
|
-
used: usage.used,
|
|
51
|
-
limit: usage.limit,
|
|
52
|
-
remaining: Math.max(0, usage.remaining ?? usage.limit - usage.used),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Fold a usage response (normally `/usage/me`) into what to tell one member.
|
|
58
|
-
* The server's `status` decides warning/exhausted (it applies the configured
|
|
59
|
-
* thresholds); when both ceilings apply, the one with less room left binds.
|
|
60
|
-
*/
|
|
61
|
-
export function summarizeUsage(
|
|
62
|
-
usage: WorkspaceUsageResponse,
|
|
63
|
-
subjectId?: string | undefined,
|
|
64
|
-
): UsageSummary {
|
|
65
|
-
const row =
|
|
66
|
-
subjectId === undefined
|
|
67
|
-
? usage.members[0]
|
|
68
|
-
: usage.members.find((member) => member.subjectId === subjectId);
|
|
69
|
-
const member = row ? reading("member", row) : null;
|
|
70
|
-
const workspace = reading("workspace", usage.workspace);
|
|
71
|
-
const readings = [member, workspace].filter((value): value is UsageReading => value !== null);
|
|
72
|
-
if (readings.length === 0) return { state: "unlimited", binding: null, member, workspace };
|
|
73
|
-
// Raising a member ceiling cannot help while the shared pool is spent, so an
|
|
74
|
-
// exhausted workspace binds first.
|
|
75
|
-
const exhausted =
|
|
76
|
-
(workspace?.status === "exhausted" ? workspace : null) ??
|
|
77
|
-
(member?.status === "exhausted" ? member : null);
|
|
78
|
-
if (exhausted) return { state: "exhausted", binding: exhausted, member, workspace };
|
|
79
|
-
const warnings = readings.filter((value) => value.status === "warning");
|
|
80
|
-
const candidates = warnings.length > 0 ? warnings : readings;
|
|
81
|
-
const binding = candidates.reduce((tightest, value) =>
|
|
82
|
-
value.remaining < tightest.remaining ? value : tightest,
|
|
83
|
-
);
|
|
84
|
-
return { state: warnings.length > 0 ? "warning" : "ok", binding, member, workspace };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** A whole-number percentage for display: "<1" for a sliver, never "0" for some use. */
|
|
88
|
-
export function usagePercentLabel(fraction: number): string {
|
|
89
|
-
if (!Number.isFinite(fraction) || fraction <= 0) return "0";
|
|
90
|
-
if (fraction < 0.01) return "<1";
|
|
91
|
-
if (fraction < 1 && Math.round(fraction * 100) === 100) return "99";
|
|
92
|
-
return String(Math.round(fraction * 100));
|
|
93
|
-
}
|
package/src/usage.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// @opengeni/react/usage — usage allowances for people, kept out of the package
|
|
2
|
-
// root and the session entry so hosts that don't meter usage never load it.
|
|
3
|
-
//
|
|
4
|
-
// Member-facing: `useUsage` + `<UsageMeter>` read the signed-in member's own
|
|
5
|
-
// `/usage/me` (the session proxy serves exactly that route) and
|
|
6
|
-
// `<UsageLimitNotice>` is the calm near/at-limit line for a composer header.
|
|
7
|
-
// Admin-facing: `<UsageMemberList>` shows every member against their limit and
|
|
8
|
-
// edits it with a share-of-budget slider; your backend saves the rule.
|
|
9
|
-
//
|
|
10
|
-
// Shares and percentages only by default. Pass `formatAmount` / `amounts` to
|
|
11
|
-
// show money, credits, or plan multiples in your own unit.
|
|
12
|
-
export { useUsage } from "./hooks/use-usage";
|
|
13
|
-
export type { UsageClientLike, UseUsageOptions, UseUsageResult } from "./hooks/use-usage";
|
|
14
|
-
export { summarizeUsage, usagePercentLabel } from "./usage/summary";
|
|
15
|
-
export type { UsageReading, UsageSummary } from "./usage/summary";
|
|
16
|
-
export {
|
|
17
|
-
DEFAULT_ALLOWANCE_LABELS,
|
|
18
|
-
allowanceLabels,
|
|
19
|
-
allowanceResetSentence,
|
|
20
|
-
formatAllowanceDate,
|
|
21
|
-
} from "./usage/allowance-copy";
|
|
22
|
-
export type { AllowanceLabels, AllowanceScope } from "./usage/allowance-copy";
|
|
23
|
-
export { DEFAULT_USAGE_METER_LABELS, UsageMeter, UsageMeterView } from "./components/usage-meter";
|
|
24
|
-
export type {
|
|
25
|
-
UsageMeterBaseProps,
|
|
26
|
-
UsageMeterLabels,
|
|
27
|
-
UsageMeterProps,
|
|
28
|
-
UsageMeterViewProps,
|
|
29
|
-
} from "./components/usage-meter";
|
|
30
|
-
export {
|
|
31
|
-
DEFAULT_USAGE_LIMIT_NOTICE_LABELS,
|
|
32
|
-
UsageLimitNotice,
|
|
33
|
-
UsageLimitNoticeView,
|
|
34
|
-
} from "./components/usage-limit-notice";
|
|
35
|
-
export type {
|
|
36
|
-
UsageLimitNoticeLabels,
|
|
37
|
-
UsageLimitNoticeProps,
|
|
38
|
-
} from "./components/usage-limit-notice";
|
|
39
|
-
export {
|
|
40
|
-
DEFAULT_USAGE_MEMBER_LIST_LABELS,
|
|
41
|
-
UsageMemberList,
|
|
42
|
-
describeMemberLimit,
|
|
43
|
-
} from "./components/usage-member-list";
|
|
44
|
-
export type {
|
|
45
|
-
UsageAmountFormat,
|
|
46
|
-
UsageMemberIdentity,
|
|
47
|
-
UsageMemberListLabels,
|
|
48
|
-
UsageMemberListProps,
|
|
49
|
-
} from "./components/usage-member-list";
|
|
50
|
-
export type { RenderAllowanceExhausted } from "./timeline/allowance-exhausted-row";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|