@streamoid/settings 0.20.1 → 0.22.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 CHANGED
@@ -165,6 +165,9 @@ Billing hides an entry whose adapter method is absent:
165
165
 
166
166
  - **Per-user usage limits:** `api.fetchMemberCreditLimits` (plus
167
167
  `setMemberCreditLimit`, `removeMemberCreditLimit`, `setDefaultCreditLimit`).
168
+ - **Workspace credit limit:** `api.fetchWorkspaceCreditLimit` (plus
169
+ `setWorkspaceCreditLimit` for Edit). The card sits on the per-user limits
170
+ page, or on Billing itself when there is no `fetchMemberCreditLimits`.
168
171
  - **Shared credits:** `api.fetchCreditPool`, and the workspace must be in an
169
172
  organization. `addCreditPoolMember`, `updateCreditPoolMember`,
170
173
  `removeCreditPoolMember` and `fetchCreditPoolCandidates` light up the rest.
@@ -172,6 +175,14 @@ Billing hides an entry whose adapter method is absent:
172
175
  A member's balance (`fetchAvailableCredits`) carries `sharedPool`, which
173
176
  Billing shows as a banner; usage rows with `meta.usedBy` get a Workspace
174
177
  column, named from the pool's `members` and `formerMembers`.
178
+ `setCreditPoolSelfShare` and `removeCreditPoolSelfShare` (mirroring
179
+ `PUT|DELETE /workspace/:id/credit-pool/self`) add a "This workspace" row:
180
+ the share the sponsor keeps for itself. A percent self share counts in the
181
+ same 100% as the members' percent shares (`self`, `allocatedPercent`,
182
+ `unallocatedPercent` on the pool response). Without them the row is hidden,
183
+ unless billing already returns a `self` share, which is then shown read-only.
184
+ A sponsor's balance may carry `sponsorShare: { allowance, used, remaining }`;
185
+ Billing then measures "Credits used" against it and shows what is left of it.
175
186
 
176
187
  ## Status
177
188
 
package/dist/index.d.mts CHANGED
@@ -680,9 +680,22 @@ interface SharedPoolBalance {
680
680
  /** The member's own credits, spent before the pool's. */
681
681
  ownCredits?: number;
682
682
  }
683
+ /**
684
+ * The share a sponsor keeps for itself this cycle (`CreditPoolSelfShare`, as
685
+ * the balance carries it). Present only on a sponsor's balance with a self
686
+ * share: its `availableCredits` are then never more than `remaining`.
687
+ */
688
+ interface SponsorShareBalance {
689
+ /** What this workspace may spend itself this cycle. */
690
+ allowance: number;
691
+ used: number;
692
+ remaining: number;
693
+ }
683
694
  interface AvailableCreditsResponse {
684
695
  availableCredits: number;
685
696
  sharedPool?: SharedPoolBalance;
697
+ /** A sponsor's own share; optional, older billing omits it. */
698
+ sponsorShare?: SponsorShareBalance;
686
699
  }
687
700
  interface SubscriptionPlan {
688
701
  id: string;
@@ -919,6 +932,22 @@ interface MemberCreditLimitsResponse {
919
932
  /** Only members with an override or with usage; the rest follow the default. */
920
933
  users: MemberCreditLimit[];
921
934
  }
935
+ /**
936
+ * The cap on what the whole workspace may spend per billing cycle, and its
937
+ * usage this cycle. Mirrors billing's `GET /workspace-credit-limit/:id`.
938
+ */
939
+ interface WorkspaceCreditLimit {
940
+ /** `null` = no limit: the workspace may spend all its credits. */
941
+ limit: number | null;
942
+ /** Credits the workspace's own members spent this cycle. */
943
+ used: number;
944
+ /** Used this cycle plus the available balance: the most a limit can be. */
945
+ totalCredits: number;
946
+ /** `limit - used`; `null` when there is no limit. */
947
+ remaining: number | null;
948
+ setBy?: string;
949
+ updatedAt?: string;
950
+ }
922
951
  type CreditPoolMode = "fixed" | "percent";
923
952
  type CreditPoolMemberStatus = "active" | "canceled";
924
953
  /**
@@ -960,11 +989,41 @@ interface CreditPoolFormerMember {
960
989
  memberWorkspaceKey: string;
961
990
  memberWorkspaceName: string | null;
962
991
  }
992
+ /**
993
+ * The share of its own credits a sponsor keeps for itself each billing cycle.
994
+ * A percent share counts in the same 100% as its members' percent shares; the
995
+ * rest stays unallocated for workspaces it may share with later.
996
+ */
997
+ interface CreditPoolSelfShare {
998
+ mode: CreditPoolMode;
999
+ /** Credits per cycle for `fixed`; a share of the workspace's plan credits, (0–100], for `percent`. */
1000
+ value: number;
1001
+ /** What this workspace may spend itself this cycle. */
1002
+ allowance: number;
1003
+ used: number;
1004
+ remaining: number;
1005
+ cycle?: {
1006
+ start: string;
1007
+ end: string;
1008
+ };
1009
+ /** When the share stops on its own (ISO); null or absent when it runs until removed. */
1010
+ endsAt?: string | null;
1011
+ note?: string;
1012
+ }
963
1013
  interface CreditPoolResponse {
964
1014
  /** Workspaces this one shares its credits with (active only), oldest first. */
965
1015
  members: CreditPoolMember[];
966
1016
  /** When this workspace spends another's credits: that membership. */
967
1017
  sponsor: CreditPoolMember | null;
1018
+ /**
1019
+ * The share this workspace keeps for itself, or null when it may spend its
1020
+ * whole balance. Optional: older hosts omit it.
1021
+ */
1022
+ self?: CreditPoolSelfShare | null;
1023
+ /** This workspace's percent share plus its members' percent shares (0–100). Optional: older hosts omit it. */
1024
+ allocatedPercent?: number;
1025
+ /** `100 - allocatedPercent`. Optional: older hosts omit it. */
1026
+ unallocatedPercent?: number;
968
1027
  /**
969
1028
  * Workspaces this one stopped sharing with. Its usage history still has
970
1029
  * their rows, so they are named there. Optional: older hosts omit it.
@@ -988,6 +1047,14 @@ interface UpdateCreditPoolMemberInput {
988
1047
  /** A new end date (ISO, in the future), or null to clear it; absent leaves it as it is. */
989
1048
  endsAt?: string | null;
990
1049
  }
1050
+ interface SetCreditPoolSelfShareInput {
1051
+ mode: CreditPoolMode;
1052
+ value: number;
1053
+ /** Why — required, at most 500 characters. */
1054
+ note: string;
1055
+ /** When the share stops on its own (an ISO date in the future); null or absent for never. */
1056
+ endsAt?: string | null;
1057
+ }
991
1058
  /** A workspace credits can be shared with (another workspace of the organization). */
992
1059
  interface CreditPoolCandidate {
993
1060
  id: string;
@@ -1148,6 +1215,17 @@ interface SettingsApiAdapter {
1148
1215
  /** Set the workspace default per-member limit; `null` means Unlimited.
1149
1216
  * Applies to members without their own override. Throws on error. */
1150
1217
  setDefaultCreditLimit?: (limit: number | null) => Promise<void>;
1218
+ /**
1219
+ * The workspace-wide credit limit for the current billing cycle. Shown on
1220
+ * the per-user limits page, or on Billing itself when the host has no
1221
+ * `fetchMemberCreditLimits`. When omitted, there is no "Workspace credit
1222
+ * limit" card.
1223
+ */
1224
+ fetchWorkspaceCreditLimit?: () => Promise<WorkspaceCreditLimit>;
1225
+ /** Set the workspace limit; `null` = no limit. Rejects with code
1226
+ * `LIMIT_BELOW_USAGE` (under `used`) or `LIMIT_ABOVE_TOTAL` (over
1227
+ * `totalCredits`), each carrying `used`, `limit` and `totalCredits`. */
1228
+ setWorkspaceCreditLimit?: (limit: number | null) => Promise<void>;
1151
1229
  /**
1152
1230
  * Who this workspace shares its credits with, or whose it spends. When
1153
1231
  * omitted, Billing hides the "Shared credits" entry.
@@ -1162,6 +1240,15 @@ interface SettingsApiAdapter {
1162
1240
  removeCreditPoolMember?: (memberId: string, reason: string) => Promise<CreditPoolMember>;
1163
1241
  /** Workspaces this one may share with: its organization's others. */
1164
1242
  fetchCreditPoolCandidates?: () => Promise<CreditPoolCandidate[]>;
1243
+ /**
1244
+ * Set or change the share this workspace keeps for itself
1245
+ * (`PUT /workspace/:id/credit-pool/self`). Organization admins only. Rejects
1246
+ * like `addCreditPoolMember`. When omitted, Shared credits has no
1247
+ * "This workspace" controls.
1248
+ */
1249
+ setCreditPoolSelfShare?: (input: SetCreditPoolSelfShareInput) => Promise<unknown>;
1250
+ /** Remove the self share: this workspace may spend its whole balance again. */
1251
+ removeCreditPoolSelfShare?: () => Promise<unknown>;
1165
1252
  fetchTokens: (params?: {
1166
1253
  showRevoked?: boolean;
1167
1254
  }) => Promise<ApiToken[]>;
@@ -2385,6 +2472,12 @@ interface ExportDateModalProps {
2385
2472
  declare function ExportDateModal({ title, onClose, onExport, busy, busyText, notice, }: ExportDateModalProps): react.JSX.Element;
2386
2473
 
2387
2474
  type CreditCycleUnit = "month" | "year";
2475
+ /**
2476
+ * The unit a limit is shown in: "cycle" when the cycle's length isn't known
2477
+ * (an org admin who isn't a workspace admin can't read the per-user limits,
2478
+ * which carry it).
2479
+ */
2480
+ type CreditLimitUnit = CreditCycleUnit | "cycle";
2388
2481
  type CreditLimitValidation = {
2389
2482
  ok: true;
2390
2483
  value: number;
@@ -2430,8 +2523,15 @@ declare function validateDefaultCreditLimitInput(raw: string): CreditLimitValida
2430
2523
  * 4005.
2431
2524
  */
2432
2525
  declare function cleanCreditLimitInput(value: string): string;
2433
- /** Digits-only input, an integer, and not below what was already used. */
2434
- declare function validateCreditLimitInput(raw: string, used: number): CreditLimitValidation;
2526
+ /** The largest whole-number limit allowed under `total`: what the input can take. */
2527
+ declare function maximumCreditLimit(total: number): number;
2528
+ /**
2529
+ * Digits-only input, an integer, not below what was already used and, when
2530
+ * `total` is given (the workspace limit), not above the workspace's total credits.
2531
+ */
2532
+ declare function validateCreditLimitInput(raw: string, used: number, total?: number): CreditLimitValidation;
2533
+ /** Why a workspace limit was refused for being over its `total` credits, naming the most it can be. */
2534
+ declare function aboveTotalReason(total: number): string;
2435
2535
  /** Why a limit was refused for being under `used`, naming the least it can be. */
2436
2536
  declare function belowUsageReason(used: number): string;
2437
2537
  /** The default limit as text: "500 credits / month", or "Unlimited" (also when unset). */
@@ -2445,6 +2545,38 @@ declare function limitSourceLabel(row: Pick<MemberCreditLimitRow, "source">): "C
2445
2545
  * follow the workspace default (none set = unlimited), with no usage.
2446
2546
  */
2447
2547
  declare function joinMembersWithLimits(members: WorkspaceMember[], response: MemberCreditLimitsResponse | null | undefined): MemberCreditLimitRow[];
2548
+ /** The workspace credit limit as the card shows it. */
2549
+ interface WorkspaceCreditLimitSummary {
2550
+ /** "30,000 credits / month"; with no limit, the total credits. */
2551
+ limitText: string;
2552
+ /** No limit set: the workspace may spend all its credits. */
2553
+ noLimit: boolean;
2554
+ usedText: string;
2555
+ remainingText: string;
2556
+ /** A limit is set and this cycle's usage has reached it: generation is refused. */
2557
+ reached: boolean;
2558
+ }
2559
+ /**
2560
+ * No limit reads as the total credits (and says so); remaining is what is left
2561
+ * under the limit, or of the total when there is none — never below zero.
2562
+ */
2563
+ declare function describeWorkspaceCreditLimit(state: WorkspaceCreditLimit, unit: CreditLimitUnit): WorkspaceCreditLimitSummary;
2564
+ /**
2565
+ * An org admin of the workspace's own organization who is not a workspace
2566
+ * admin: Billing shows them the workspace credit limit and nothing else.
2567
+ * Hosts can fall back to another organization the user belongs to as
2568
+ * `organization.current`, so its id must be the workspace's organization.
2569
+ */
2570
+ declare function canManageOnlyWorkspaceCreditLimit({ isWorkspaceAdmin, organization, workspaceOrganizationId, hasWorkspaceCreditLimit, }: {
2571
+ isWorkspaceAdmin: boolean;
2572
+ organization: {
2573
+ id: string;
2574
+ role?: string;
2575
+ } | null | undefined;
2576
+ workspaceOrganizationId: string | null | undefined;
2577
+ /** The host passed `api.fetchWorkspaceCreditLimit`. */
2578
+ hasWorkspaceCreditLimit: boolean;
2579
+ }): boolean;
2448
2580
 
2449
2581
  /**
2450
2582
  * True when a per-user credit limit was rejected for being under what the
@@ -2460,6 +2592,19 @@ declare function isLimitBelowUsage(failure: unknown): boolean;
2460
2592
  * spent more since. `null` when the failure is not one, or carries no figure.
2461
2593
  */
2462
2594
  declare function limitBelowUsageUsed(failure: unknown): number | null;
2595
+ /** True when a workspace credit limit was rejected for being over the workspace's total credits. */
2596
+ declare function isLimitAboveTotal(failure: unknown): boolean;
2597
+ /**
2598
+ * The workspace's total credits from a `LIMIT_ABOVE_TOTAL` rejection: fresher
2599
+ * than the figure the page loaded with, if credits were spent or bought since.
2600
+ * `null` when the failure is not one, or carries no figure.
2601
+ */
2602
+ declare function limitAboveTotalTotal(failure: unknown): number | null;
2603
+ declare const WORKSPACE_CREDIT_LIMIT_REACHED = "WORKSPACE_CREDIT_LIMIT_REACHED";
2604
+ /** What to tell a member whose generation the workspace credit limit refused. */
2605
+ declare const WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE = "Your workspace has reached its credit limit for this cycle. Ask an admin to raise it.";
2606
+ /** True when a deduct was refused because the workspace reached its credit limit this cycle. */
2607
+ declare function isWorkspaceCreditLimitReached(failure: unknown): boolean;
2463
2608
  /**
2464
2609
  * The error object carrying one of the billing `codes`, wherever the failure
2465
2610
  * keeps it. `UserFacingError` rewrites `err.code` to a category, so the
@@ -2486,11 +2631,19 @@ interface MemberCreditLimitModalProps {
2486
2631
  resetKey?: string;
2487
2632
  /** Credits used this billing cycle; 0 for the default, so no "at least" rule. */
2488
2633
  used: number;
2634
+ /**
2635
+ * The workspace's total credits this cycle: the most the limit can be. Only
2636
+ * for the workspace limit, which then also shows usage against it; omit for
2637
+ * member limits, which have no upper bound.
2638
+ */
2639
+ total?: number;
2489
2640
  /** Limit to pre-select; `null` = Unlimited. */
2490
2641
  initialLimit: number | null;
2491
2642
  /** Whether a stored value exists. When false, saving is always allowed (it creates one). */
2492
2643
  isSet: boolean;
2493
- unit: CreditCycleUnit;
2644
+ unit: CreditLimitUnit;
2645
+ /** Label of the no-limit choice; defaults to "Unlimited usage". */
2646
+ unlimitedLabel?: string;
2494
2647
  /** Persist the limit (`null` = Unlimited). Throw on failure. */
2495
2648
  onSave: (limit: number | null) => Promise<void>;
2496
2649
  /** Persist removal. When omitted, no Remove button. */
@@ -2508,7 +2661,17 @@ interface MemberCreditLimitModalProps {
2508
2661
  onStale?: () => void;
2509
2662
  }
2510
2663
  /** A fixed number of credits per cycle, or unlimited — for one member or the workspace default. */
2511
- declare function MemberCreditLimitModal({ open, title, description, subject, resetKey, used, initialLimit, isSet, unit, onSave, onRemove, removeLabel, removeHint, saveSuccessMessage, removeSuccessMessage, onClose, onSaved, onStale, }: MemberCreditLimitModalProps): react.JSX.Element | null;
2664
+ declare function MemberCreditLimitModal({ open, title, description, subject, resetKey, used, total, initialLimit, isSet, unit, unlimitedLabel, onSave, onRemove, removeLabel, removeHint, saveSuccessMessage, removeSuccessMessage, onClose, onSaved, onStale, }: MemberCreditLimitModalProps): react.JSX.Element | null;
2665
+
2666
+ /**
2667
+ * The cap on what the whole workspace may spend per billing cycle: limit, used
2668
+ * and remaining, and Edit for hosts that can change it. Renders nothing when the
2669
+ * host has no `api.fetchWorkspaceCreditLimit`. Without `unit` (the cycle's
2670
+ * length isn't known) amounts read "credits / cycle".
2671
+ */
2672
+ declare function WorkspaceCreditLimitCard({ unit: cycleUnit }: {
2673
+ unit?: CreditCycleUnit;
2674
+ }): react.JSX.Element | null;
2512
2675
 
2513
2676
  /**
2514
2677
  * Shared credit pool rules and copy, kept out of the components so a host can
@@ -2545,6 +2708,30 @@ declare function validatePoolText(raw: string, max: number): {
2545
2708
  ok: false;
2546
2709
  reason: string;
2547
2710
  };
2711
+ /**
2712
+ * The percent of this workspace's plan credits already given out: its own
2713
+ * percent share plus its members' percent shares. Fixed shares don't count.
2714
+ * `exclude` leaves out the share being edited (a member's `_id`, or `"self"`),
2715
+ * so its new value is checked against the rest.
2716
+ */
2717
+ declare function poolAllocatedPercent(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined, exclude?: string): number;
2718
+ /** What is left of the 100%: `100 - poolAllocatedPercent`, never below 0. */
2719
+ declare function poolUnallocatedPercent(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined, exclude?: string): number;
2720
+ /**
2721
+ * Whether a percent share fits in what is unallocated: the self share and the
2722
+ * members' percent shares together are at most 100. A fixed share always fits.
2723
+ */
2724
+ declare function checkPoolPercentTotal(split: {
2725
+ mode: CreditPoolMode;
2726
+ value: number;
2727
+ }, unallocatedPercent: number): {
2728
+ ok: true;
2729
+ } | {
2730
+ ok: false;
2731
+ reason: string;
2732
+ };
2733
+ /** "Allocated 70% · Unallocated 30%". */
2734
+ declare function poolAllocationText(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined): string;
2548
2735
  /** `fixed 500` → "500 credits"; `percent 20` → "20%". */
2549
2736
  declare function formatPoolSplit(split: {
2550
2737
  mode: CreditPoolMode;
@@ -2601,6 +2788,15 @@ declare function poolRenewsAtCycleEnd(pool: Pick<SharedPoolBalance, "endsAt" | "
2601
2788
  declare function poolWorkspaceName(name: string | null | undefined): string;
2602
2789
  /** The member's Billing banner: "Credits shared by Agency: 80 of 200 left this cycle". */
2603
2790
  declare function sharedPoolBannerText(pool: Pick<SharedPoolBalance, "sponsorName" | "allowance" | "remaining">): string;
2791
+ /** The Billing line once a sponsor has spent its own share this cycle. */
2792
+ declare function sponsorShareSpentText(): string;
2793
+ /**
2794
+ * A sponsor's Billing banner for its own share: "This workspace's share:
2795
+ * 20,000 of 30,000 credits left this cycle", or `sponsorShareSpentText` when none is left.
2796
+ */
2797
+ declare function sponsorShareBannerText(share: Pick<SponsorShareBalance, "allowance" | "remaining">): string;
2798
+ /** The line under the sponsor's banner: why it can't spend all its credits. */
2799
+ declare function sponsorShareDetailText(): string;
2604
2800
  /**
2605
2801
  * Was the line saying a member's own credits were paused while it used the
2606
2802
  * pool's. Billing spends them first, so it now answers `ownCreditsFirstText`
@@ -2625,12 +2821,14 @@ interface CreditsMeter {
2625
2821
  * The Billing overview's "Credits used" meter. A workspace spending shared
2626
2822
  * credits is measured against its allowance this cycle: its balance is the
2627
2823
  * sponsor's, so subtracting it from this workspace's own unexpired credits
2628
- * says nothing. Otherwise used = own unexpired credits − balance.
2824
+ * says nothing. A sponsor with a self share is measured against that share,
2825
+ * which caps its balance. Otherwise used = own unexpired credits − balance.
2629
2826
  */
2630
- declare function creditsMeter({ availableCredits, totalCredits, sharedPool, }: {
2827
+ declare function creditsMeter({ availableCredits, totalCredits, sharedPool, sponsorShare, }: {
2631
2828
  availableCredits: number | null;
2632
2829
  totalCredits: number | null;
2633
2830
  sharedPool: Pick<SharedPoolBalance, "allowance" | "used" | "remaining"> | null;
2831
+ sponsorShare?: Pick<SponsorShareBalance, "allowance" | "used" | "remaining"> | null;
2634
2832
  }): CreditsMeter;
2635
2833
  /**
2636
2834
  * The workspace a usage row was spent by, when it is not `currentWorkspaceId`:
@@ -2740,23 +2938,38 @@ declare function useBillingEntitlement(fetchCurrentPlan: (() => Promise<Subscrip
2740
2938
  loading: boolean;
2741
2939
  };
2742
2940
 
2743
- type CreditPoolMemberModalProps = {
2941
+ type PoolModalCommon = {
2942
+ onClose: () => void;
2943
+ /** After a save; the parent refetches. */
2944
+ onSaved: () => void;
2945
+ /**
2946
+ * What is left of the 100% for this share, the share itself left out
2947
+ * (`poolUnallocatedPercent(pool, exclude)`). A percent share over it can't
2948
+ * be saved. Absent skips the check; billing still enforces it.
2949
+ */
2950
+ unallocatedPercent?: number;
2951
+ };
2952
+ type CreditPoolMemberModalProps = (PoolModalCommon & {
2744
2953
  kind: "add";
2745
2954
  /** Workspaces credits can be shared with. */
2746
2955
  candidates: CreditPoolCandidate[];
2747
2956
  onSave: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
2748
- onClose: () => void;
2749
- /** After a save; the parent refetches. */
2750
- onSaved: () => void;
2751
- } | {
2957
+ }) | (PoolModalCommon & {
2752
2958
  kind: "edit";
2753
2959
  member: CreditPoolMember;
2754
2960
  memberName: string;
2755
2961
  onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
2756
- onClose: () => void;
2757
- onSaved: () => void;
2758
- };
2759
- /** Share credits with a workspace, or change an active member's share. */
2962
+ }) | (PoolModalCommon & {
2963
+ /** The share the sponsor keeps for itself: set (`self` null) or change it. */
2964
+ kind: "self";
2965
+ self: CreditPoolSelfShare | null;
2966
+ workspaceName: string;
2967
+ onSave: (input: SetCreditPoolSelfShareInput) => Promise<unknown>;
2968
+ });
2969
+ /**
2970
+ * Share credits with a workspace, change an active member's share, or set the
2971
+ * share the sponsor keeps for itself (`kind: "self"`).
2972
+ */
2760
2973
  declare function CreditPoolMemberModal(props: CreditPoolMemberModalProps): react.JSX.Element;
2761
2974
 
2762
2975
  interface RemovePoolMemberModalProps {
@@ -2771,6 +2984,17 @@ interface RemovePoolMemberModalProps {
2771
2984
  }
2772
2985
  /** Confirm stopping a member spending this workspace's credits, with a reason. */
2773
2986
  declare function RemovePoolMemberModal({ member, memberName, sponsorName, onRemove, onClose, onRemoved, }: RemovePoolMemberModalProps): react.JSX.Element;
2987
+ interface RemoveSelfShareModalProps {
2988
+ self: CreditPoolSelfShare;
2989
+ /** This workspace's name. */
2990
+ workspaceName: string;
2991
+ onRemove: () => Promise<unknown>;
2992
+ onClose: () => void;
2993
+ /** After the share was removed; the parent refetches. */
2994
+ onRemoved: () => void;
2995
+ }
2996
+ /** Confirm removing the share a sponsor keeps for itself: it may spend its whole balance again. */
2997
+ declare function RemoveSelfShareModal({ self, workspaceName, onRemove, onClose, onRemoved, }: RemoveSelfShareModalProps): react.JSX.Element;
2774
2998
 
2775
2999
  declare function SettingsAdaptersProvider({ adapters, children, }: {
2776
3000
  adapters: SettingsAdapters;
@@ -2789,6 +3013,8 @@ interface AdministrationOverviewProps {
2789
3013
  hasWorkspace: boolean;
2790
3014
  hasOrganization: boolean;
2791
3015
  isWorkspaceAdmin: boolean;
3016
+ /** An org admin who isn't a workspace admin: Billing, holding only the workspace credit limit. */
3017
+ showWorkspaceCreditLimitOnly?: boolean;
2792
3018
  showConnectedApps: boolean;
2793
3019
  /** The signed-in user has a referral code to share. */
2794
3020
  showReferral?: boolean;
@@ -2800,7 +3026,7 @@ interface AdministrationOverviewProps {
2800
3026
  onInvitePeople?: () => void;
2801
3027
  }
2802
3028
  /** Scope-first navigation into the existing forms; contains no mutation logic. */
2803
- declare function AdministrationOverview({ workspaceName, organizationName, hasWorkspace, hasOrganization, isWorkspaceAdmin, showConnectedApps, showIntegrations, showLoginMethods, showReferral, canInvite, onNavigate, onInvitePeople, }: AdministrationOverviewProps): react.JSX.Element;
3029
+ declare function AdministrationOverview({ workspaceName, organizationName, hasWorkspace, hasOrganization, isWorkspaceAdmin, showWorkspaceCreditLimitOnly, showConnectedApps, showIntegrations, showLoginMethods, showReferral, canInvite, onNavigate, onInvitePeople, }: AdministrationOverviewProps): react.JSX.Element;
2804
3030
 
2805
3031
  /** Shared invitation rule. A result belongs to one authenticated workspace;
2806
3032
  * callers must explicitly mark it ready after that workspace's reads settle. */
@@ -2871,4 +3097,4 @@ interface AppSettingsRowProps {
2871
3097
  }
2872
3098
  declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
2873
3099
 
2874
- export { APP_KEYS, type AddCreditPoolMemberInput, AdministrationOverview, type AdministrationOverviewProps, type AdministrativeNavigationOptions, type ApiToken, type AppKey, AppSettingsHeader, type AppSettingsHeaderProps, AppSettingsPage, type AppSettingsPageProps, AppSettingsRow, type AppSettingsRowProps, AppSettingsSection, type AppSettingsSectionProps, type AvailableCreditsResponse, BILLING_TABLE_FRAME_STYLE, BILLING_TABLE_MIN_HEIGHT, BILLING_TABLE_PAGER_STYLE, BillingContent, type BillingEntitlement, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreatedToken, type CreditCycleUnit, type CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type LoginMethodsMember, type LoginMethodsSettings, type LoginMethodsSwitchState, MOCK_REFERRED_USERS, type MemberCreditLimit, MemberCreditLimitModal, type MemberCreditLimitRow, type MemberCreditLimitSource, type MemberCreditLimitsResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationDetails, OrganizationIntegrationsContent, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, OrganizationLoginMethodsContent, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralHistoryView, type ReferralHistoryViewProps, ReferralTab, type ReferredUser, RemovePoolMemberModal, type RemovePoolMemberModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsLoginMethodsAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCreateOptions, type SettingsOrganizationCurrent, type SettingsOrganizationJoinableItem, type SettingsOrganizationListItem, type SettingsOrganizationType, type SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SharedCreditsView, type SharedPoolBalance, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerGroup, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, belowUsageReason, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, loginMethodsSwitchState, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralCountLabel, referralLink, referralSignupDate, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sortReferredUsers, sponsoredCreditsText, ssoLabel, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
3100
+ export { APP_KEYS, type AddCreditPoolMemberInput, AdministrationOverview, type AdministrationOverviewProps, type AdministrativeNavigationOptions, type ApiToken, type AppKey, AppSettingsHeader, type AppSettingsHeaderProps, AppSettingsPage, type AppSettingsPageProps, AppSettingsRow, type AppSettingsRowProps, AppSettingsSection, type AppSettingsSectionProps, type AvailableCreditsResponse, BILLING_TABLE_FRAME_STYLE, BILLING_TABLE_MIN_HEIGHT, BILLING_TABLE_PAGER_STYLE, BillingContent, type BillingEntitlement, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreatedToken, type CreditCycleUnit, type CreditLimitUnit, type CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditPoolSelfShare, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type LoginMethodsMember, type LoginMethodsSettings, type LoginMethodsSwitchState, MOCK_REFERRED_USERS, type MemberCreditLimit, MemberCreditLimitModal, type MemberCreditLimitRow, type MemberCreditLimitSource, type MemberCreditLimitsResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationDetails, OrganizationIntegrationsContent, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, OrganizationLoginMethodsContent, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralHistoryView, type ReferralHistoryViewProps, ReferralTab, type ReferredUser, RemovePoolMemberModal, type RemovePoolMemberModalProps, RemoveSelfShareModal, type RemoveSelfShareModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SetCreditPoolSelfShareInput, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsLoginMethodsAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCreateOptions, type SettingsOrganizationCurrent, type SettingsOrganizationJoinableItem, type SettingsOrganizationListItem, type SettingsOrganizationType, type SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SharedCreditsView, type SharedPoolBalance, SiconKey, type SponsorShareBalance, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_CREDIT_LIMIT_REACHED, WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceCreditLimit, WorkspaceCreditLimitCard, type WorkspaceCreditLimitSummary, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerGroup, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, aboveTotalReason, belowUsageReason, canManageOnlyWorkspaceCreditLimit, canShowSharedCredits, checkPoolPercentTotal, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, describeWorkspaceCreditLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitAboveTotal, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, isWorkspaceCreditLimitReached, joinMembersWithLimits, lastUsedLabel, limitAboveTotalTotal, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, loginMethodsSwitchState, maximumCreditLimit, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolAllocatedPercent, poolAllocationText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolUnallocatedPercent, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralCountLabel, referralLink, referralSignupDate, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sortReferredUsers, sponsorShareBannerText, sponsorShareDetailText, sponsorShareSpentText, sponsoredCreditsText, ssoLabel, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };