@streamoid/settings 0.10.1 → 0.11.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/dist/index.d.ts CHANGED
@@ -658,8 +658,27 @@ interface MemberPermissionsPayload {
658
658
  }
659
659
  /** `SettingsWorkspaceCurrent.usage`; re-exported from `@streamoid/ui`. */
660
660
  type WorkspaceUsageResponse = WorkspaceUsage;
661
+ /**
662
+ * Where a shared-pool member's credits come from. Present only on a member's
663
+ * balance: its `availableCredits` are then its sponsor's, never more than this
664
+ * allowance has left.
665
+ */
666
+ interface SharedPoolBalance {
667
+ /** The sponsor's workspace id. */
668
+ sponsorWorkspaceId: string;
669
+ sponsorName: string | null;
670
+ /** What the member may spend this cycle. */
671
+ allowance: number;
672
+ used: number;
673
+ remaining: number;
674
+ /** When the sponsor's billing cycle ends and the allowance starts again. */
675
+ cycleEnd: string;
676
+ /** The member's own credits: still its own, but paused while it is a member. */
677
+ ownCredits?: number;
678
+ }
661
679
  interface AvailableCreditsResponse {
662
680
  availableCredits: number;
681
+ sharedPool?: SharedPoolBalance;
663
682
  }
664
683
  interface SubscriptionPlan {
665
684
  id: string;
@@ -716,6 +735,9 @@ interface UsageHistoryItem {
716
735
  meta?: {
717
736
  info?: string;
718
737
  stripeInvoiceId?: string;
738
+ /** The workspace id that spent it, on a row of a sponsor's shared credits. */
739
+ usedBy?: string;
740
+ poolMemberId?: string;
719
741
  };
720
742
  service?: {
721
743
  serviceGroupName: string;
@@ -846,37 +868,31 @@ interface MemberCreditLimitsResponse {
846
868
  /** Only members with an override or with usage; the rest follow the default. */
847
869
  users: MemberCreditLimit[];
848
870
  }
849
- type CreditAllocationMode = "fixed" | "percent";
850
- type CreditAllocationStatus = "active" | "canceled";
871
+ type CreditPoolMode = "fixed" | "percent";
872
+ type CreditPoolMemberStatus = "active" | "canceled";
851
873
  /**
852
- * A workspace sending part of its credits to another workspace of its
853
- * organization: once when created, and again out of every renewal grant while
854
- * `recurring`. Workspace ids are the host's workspace ids (`*WorkspaceKey`).
874
+ * A workspace allowed to spend another workspace's credits (the sponsor's), up
875
+ * to an allowance per sponsor billing cycle. Every credit stays with the
876
+ * sponsor. Workspace ids are the host's workspace ids (`*WorkspaceKey`).
855
877
  */
856
- interface CreditAllocation {
878
+ interface CreditPoolMember {
857
879
  _id: string;
858
- /** The sponsor (source) workspace. */
859
- sourceWorkspaceKey: string;
860
- sourceWorkspaceName?: string | null;
861
- /** The receiving (target) workspace. */
862
- targetWorkspaceKey: string;
863
- targetWorkspaceName?: string | null;
864
- mode: CreditAllocationMode;
865
- /** Credits for `fixed`; a share of each grant, (0–100], for `percent`. */
880
+ sponsorWorkspaceKey: string;
881
+ sponsorWorkspaceName?: string | null;
882
+ memberWorkspaceKey: string;
883
+ memberWorkspaceName?: string | null;
884
+ mode: CreditPoolMode;
885
+ /** Credits per cycle for `fixed`; a share of the sponsor's plan credits, (0–100], for `percent`. */
866
886
  value: number;
867
- recurring: boolean;
868
- status: CreditAllocationStatus;
869
- /** This allocation moved the target off the free plan, so cancelling moves it back. */
870
- targetPlanChanged?: boolean;
871
- /**
872
- * The first move, from the source's balance, when the allocation was made.
873
- * `failed` means the allocation is active (renewals still split) but those
874
- * first credits did NOT move.
875
- */
876
- initialTransfer?: {
877
- status: "done" | "failed";
878
- credits: number;
879
- error?: string;
887
+ status: CreditPoolMemberStatus;
888
+ /** What the member may spend this cycle. */
889
+ allowance: number;
890
+ used: number;
891
+ remaining: number;
892
+ cycle?: {
893
+ start: string;
894
+ end: string;
895
+ base: number;
880
896
  };
881
897
  note?: string;
882
898
  requestedBy?: string;
@@ -887,57 +903,36 @@ interface CreditAllocation {
887
903
  canceledBy?: string;
888
904
  cancelReason?: string;
889
905
  }
890
- interface CreditAllocationsResponse {
891
- /** Allocations this workspace sponsors, canceled ones included, newest first. */
892
- giving: CreditAllocation[];
893
- /** Allocations sponsoring this workspace (at most one active). */
894
- receiving: CreditAllocation[];
895
- /** The viewer may create, change and cancel (an admin of the organization). */
906
+ interface CreditPoolFormerMember {
907
+ memberWorkspaceKey: string;
908
+ memberWorkspaceName: string | null;
909
+ }
910
+ interface CreditPoolResponse {
911
+ /** Workspaces this one shares its credits with (active only), oldest first. */
912
+ members: CreditPoolMember[];
913
+ /** When this workspace spends another's credits: that membership. */
914
+ sponsor: CreditPoolMember | null;
915
+ /**
916
+ * Workspaces this one stopped sharing with. Its usage history still has
917
+ * their rows, so they are named there. Optional: older hosts omit it.
918
+ */
919
+ formerMembers?: CreditPoolFormerMember[];
920
+ /** The viewer may add, change and remove members (an admin of the organization). */
896
921
  canManage: boolean;
897
922
  }
898
- interface CreateCreditAllocationInput {
899
- targetWorkspaceId: string;
900
- mode: CreditAllocationMode;
923
+ interface AddCreditPoolMemberInput {
924
+ memberWorkspaceId: string;
925
+ mode: CreditPoolMode;
901
926
  value: number;
902
- recurring: boolean;
903
927
  /** Why — required, at most 500 characters. */
904
928
  note: string;
905
929
  }
906
- type UpdateCreditAllocationInput = {
907
- mode: CreditAllocationMode;
930
+ interface UpdateCreditPoolMemberInput {
931
+ mode: CreditPoolMode;
908
932
  value: number;
909
- recurring?: boolean;
910
- } | {
911
- recurring: boolean;
912
- };
913
- interface CancelCreditAllocationResult {
914
- allocation: CreditAllocation;
915
- /** The target was moved back to the free plan. */
916
- targetMovedToFree: boolean;
917
- /** Why billing left the target on its plan on purpose (bought its own, already on free). */
918
- reason?: string;
919
- /** Set when moving the target back to free failed; the allocation is canceled anyway. */
920
- error?: string;
921
- }
922
- interface CreditTransfer {
923
- id: string;
924
- direction: "sent" | "received";
925
- credits: number;
926
- createdAt: string | null;
927
- expiresAt?: string | null;
928
- allocationId: string | null;
929
- kind: "initial" | "renewal";
930
- counterpartWorkspaceId: string | null;
931
- counterpartWorkspaceName: string | null;
932
- }
933
- interface CreditTransfersPage {
934
- transfers: CreditTransfer[];
935
- page: number;
936
- limit: number;
937
- total: number;
938
- }
939
- /** A workspace credits can be allocated to (another workspace of the organization). */
940
- interface CreditAllocationTarget {
933
+ }
934
+ /** A workspace credits can be shared with (another workspace of the organization). */
935
+ interface CreditPoolCandidate {
941
936
  id: string;
942
937
  name: string;
943
938
  imageUrl?: string;
@@ -1078,26 +1073,19 @@ interface SettingsApiAdapter {
1078
1073
  * Applies to members without their own override. Throws on error. */
1079
1074
  setDefaultCreditLimit?: (limit: number | null) => Promise<void>;
1080
1075
  /**
1081
- * What this workspace gives to and receives from other workspaces of its
1082
- * organization. When omitted, Billing hides the "Credit allocations" entry.
1076
+ * Who this workspace shares its credits with, or whose it spends. When
1077
+ * omitted, Billing hides the "Shared credits" entry.
1083
1078
  */
1084
- fetchCreditAllocations?: () => Promise<CreditAllocationsResponse>;
1085
- /** Organization admins only. Moves the first share now. Rejects with the
1086
- * billing `code` (`INSUFFICIENT_CREDITS`, `ALLOCATION_NOT_ALLOWED`,
1087
- * `SOURCE_ON_FREE_PLAN`, `TARGET_PLAN_CHANGE_FAILED`) on the error body. */
1088
- createCreditAllocation?: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
1089
- /** Change the split and/or repeat; applies from the next renewal. */
1090
- updateCreditAllocation?: (allocationId: string, patch: UpdateCreditAllocationInput) => Promise<CreditAllocation>;
1091
- /** Stop an allocation. Resolves even when the target could not be moved
1092
- * back to free — check `targetMovedToFree` / `error`. */
1093
- cancelCreditAllocation?: (allocationId: string, reason: string) => Promise<CancelCreditAllocationResult>;
1094
- /** Transfers this workspace sent or received, newest first. */
1095
- fetchCreditTransfers?: (input: {
1096
- page: number;
1097
- limit: number;
1098
- }) => Promise<CreditTransfersPage>;
1099
- /** Workspaces this one may allocate to: its organization's others. */
1100
- fetchAllocationTargets?: () => Promise<CreditAllocationTarget[]>;
1079
+ fetchCreditPool?: () => Promise<CreditPoolResponse>;
1080
+ /** Organization admins only. The member can spend at once. Rejects with the
1081
+ * billing `code` (`POOL_NOT_ALLOWED`, `SPONSOR_ON_FREE_PLAN`) on the error body. */
1082
+ addCreditPoolMember?: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
1083
+ /** Change a member's share; applies immediately. */
1084
+ updateCreditPoolMember?: (memberId: string, patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
1085
+ /** Stop a member spending this workspace's credits, immediately. */
1086
+ removeCreditPoolMember?: (memberId: string, reason: string) => Promise<CreditPoolMember>;
1087
+ /** Workspaces this one may share with: its organization's others. */
1088
+ fetchCreditPoolCandidates?: () => Promise<CreditPoolCandidate[]>;
1101
1089
  fetchTokens: (params?: {
1102
1090
  showRevoked?: boolean;
1103
1091
  }) => Promise<ApiToken[]>;
@@ -1415,7 +1403,7 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
1415
1403
  };
1416
1404
  declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
1417
1405
 
1418
- declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showCreditAllocations: showCreditAllocationsProp, onShowCreditAllocationsChange, }?: {
1406
+ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showSharedCredits: showSharedCreditsProp, onShowSharedCreditsChange, }?: {
1419
1407
  embedded?: boolean;
1420
1408
  /** Controlled "plans" sub-view flag. When provided, the host (settings
1421
1409
  * wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
@@ -1425,11 +1413,11 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
1425
1413
  * Only reachable when `api.fetchMemberCreditLimits` exists. */
1426
1414
  showPerUserLimits?: boolean;
1427
1415
  onShowPerUserLimitsChange?: (open: boolean) => void;
1428
- /** Controlled "credit allocations" sub-view flag; same contract as
1429
- * `showPlans`. Only reachable when `api.fetchCreditAllocations` exists and
1430
- * the workspace is in an organization. */
1431
- showCreditAllocations?: boolean;
1432
- onShowCreditAllocationsChange?: (open: boolean) => void;
1416
+ /** Controlled "shared credits" sub-view flag; same contract as
1417
+ * `showPlans`. Only reachable when `api.fetchCreditPool` exists and the
1418
+ * workspace is in an organization. */
1419
+ showSharedCredits?: boolean;
1420
+ onShowSharedCreditsChange?: (open: boolean) => void;
1433
1421
  }): react__default.JSX.Element;
1434
1422
 
1435
1423
  /**
@@ -2037,19 +2025,22 @@ interface MemberCreditLimitModalProps {
2037
2025
  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;
2038
2026
 
2039
2027
  /**
2040
- * Credit allocation rules and copy, kept out of the components so a host can
2041
- * test them. The server (billing, behind unified-backend) is the authority;
2042
- * these only stop an obviously bad request and say clearly what happened.
2028
+ * Shared credit pool rules and copy, kept out of the components so a host can
2029
+ * test them. A sponsor workspace keeps all of its credits and lets other
2030
+ * workspaces of its organization spend them, each up to an allowance per
2031
+ * billing cycle. The server (billing, behind unified-backend) is the
2032
+ * authority; these only stop an obviously bad request and say clearly what
2033
+ * happened.
2043
2034
  */
2044
- declare const ALLOCATION_NOTE_MAX_LENGTH = 500;
2045
- declare const CANCEL_REASON_MAX_LENGTH = 500;
2035
+ declare const POOL_NOTE_MAX_LENGTH = 500;
2036
+ declare const REMOVE_REASON_MAX_LENGTH = 500;
2046
2037
  /**
2047
- * Whether Billing offers credit allocations: the host implements them, and the
2048
- * workspace is in an organization (allocations move credits between one
2049
- * organization's workspaces, so a personal workspace has nowhere to send them).
2038
+ * Whether Billing offers shared credits: the host implements them, and the
2039
+ * workspace is in an organization (credits are shared between one
2040
+ * organization's workspaces, so a personal workspace has no one to share with).
2050
2041
  */
2051
- declare function canShowCreditAllocations(api: Pick<SettingsApiAdapter, "fetchCreditAllocations">, workspace: Pick<SettingsWorkspaceCurrent, "organizationId"> | null | undefined, organization: Pick<SettingsOrganizationCurrent, "id"> | null | undefined): boolean;
2052
- type AllocationValueValidation = {
2042
+ declare function canShowSharedCredits(api: Pick<SettingsApiAdapter, "fetchCreditPool">, workspace: Pick<SettingsWorkspaceCurrent, "organizationId"> | null | undefined, organization: Pick<SettingsOrganizationCurrent, "id"> | null | undefined): boolean;
2043
+ type PoolValueValidation = {
2053
2044
  ok: true;
2054
2045
  value: number;
2055
2046
  } | {
@@ -2057,15 +2048,11 @@ type AllocationValueValidation = {
2057
2048
  reason: string;
2058
2049
  };
2059
2050
  /** Digits and one `.` — what the value input keeps as the user types. */
2060
- declare function cleanAllocationValueInput(raw: string): string;
2061
- /**
2062
- * A split value as billing accepts it: > 0, at most two decimals, and at most
2063
- * 100 for a percent. A fixed share over `balance` (when known) is refused too —
2064
- * the first share moves from the balance right away.
2065
- */
2066
- declare function validateAllocationValue(mode: CreditAllocationMode, raw: string, balance?: number | null): AllocationValueValidation;
2051
+ declare function cleanPoolValueInput(raw: string): string;
2052
+ /** A share as billing accepts it: > 0, at most two decimals, and at most 100 for a percent. */
2053
+ declare function validatePoolValue(mode: CreditPoolMode, raw: string): PoolValueValidation;
2067
2054
  /** A required note or reason: trimmed, non-empty, at most `max` characters. */
2068
- declare function validateAllocationText(raw: string, max: number): {
2055
+ declare function validatePoolText(raw: string, max: number): {
2069
2056
  ok: true;
2070
2057
  value: string;
2071
2058
  } | {
@@ -2073,103 +2060,107 @@ declare function validateAllocationText(raw: string, max: number): {
2073
2060
  reason: string;
2074
2061
  };
2075
2062
  /** `fixed 500` → "500 credits"; `percent 20` → "20%". */
2076
- declare function formatAllocationSplit(split: {
2077
- mode: CreditAllocationMode;
2063
+ declare function formatPoolSplit(split: {
2064
+ mode: CreditPoolMode;
2078
2065
  value: number;
2079
2066
  }): string;
2080
- /** "Every renewal" or "Once". */
2081
- declare function formatAllocationRepeat(recurring: boolean): string;
2082
- /** "500 credits every renewal", "20% of each renewal", "500 credits once". */
2083
- declare function describeAllocation(allocation: Pick<CreditAllocation, "mode" | "value" | "recurring">): string;
2067
+ /** "20% · 200 credits this cycle", or "200 credits this cycle" for a fixed share. */
2068
+ declare function describeAllowance(member: Pick<CreditPoolMember, "mode" | "value" | "allowance">): string;
2084
2069
  /** The other workspace's name, or a stand-in when it could not be resolved. */
2085
- declare function allocationWorkspaceName(name: string | null | undefined): string;
2070
+ declare function poolWorkspaceName(name: string | null | undefined): string;
2071
+ /** The member's Billing banner: "Credits shared by Agency: 80 of 200 left this cycle". */
2072
+ declare function sharedPoolBannerText(pool: Pick<SharedPoolBalance, "sponsorName" | "allowance" | "remaining">): string;
2086
2073
  /**
2087
- * Why the first transfer did not happen, when it failed. The allocation was
2088
- * still made — so without this an admin would assume the credits moved.
2074
+ * The line under the member's banner: its own credits are still its own,
2075
+ * only paused while it spends shared ones.
2089
2076
  */
2090
- declare function initialTransferWarning(allocation: Pick<CreditAllocation, "initialTransfer">): string | null;
2091
- /** "Sent 500 credits at setup", when the first transfer went through. */
2092
- declare function initialTransferSummary(allocation: Pick<CreditAllocation, "initialTransfer">): string | null;
2077
+ declare function pausedOwnCreditsText(pool: Pick<SharedPoolBalance, "ownCredits">): string;
2078
+ interface CreditsMeter {
2079
+ /** Credits spent; `null` when there is not enough data to say. */
2080
+ used: number | null;
2081
+ /** Credits left; `null` when the balance is unknown. */
2082
+ remaining: number | null;
2083
+ /** Percentage of the total spent, 0–100; fills the bar. */
2084
+ progressPct: number;
2085
+ /** `100 - progressPct`. */
2086
+ remainingPct: number;
2087
+ }
2093
2088
  /**
2094
- * What still needs doing after a cancel, or `null` when nothing does.
2095
- *
2096
- * Billing cancels the allocation even when moving the target back to free
2097
- * fails (`error`). A target this allocation moved off free (`targetPlanChanged`)
2098
- * that was not moved back stays on the $0 Custom plan, without its free monthly
2099
- * credits. No customer-facing action moves a workspace to free immediately, so
2100
- * the way out is Streamoid support. When billing left the target's plan on
2101
- * purpose it says why (`reason`: it bought a plan of its own, or is already on
2102
- * free), and nothing needs fixing; nor does a target that was never moved.
2089
+ * The Billing overview's "Credits used" meter. A workspace spending shared
2090
+ * credits is measured against its allowance this cycle: its balance is the
2091
+ * sponsor's, so subtracting it from this workspace's own unexpired credits
2092
+ * says nothing. Otherwise used = own unexpired credits − balance.
2103
2093
  */
2104
- declare function cancelOutcomeWarning(result: Pick<CancelCreditAllocationResult, "targetMovedToFree" | "reason" | "error"> & {
2105
- allocation?: Pick<CreditAllocation, "targetPlanChanged"> | null;
2106
- }, targetName: string): string | null;
2094
+ declare function creditsMeter({ availableCredits, totalCredits, sharedPool, }: {
2095
+ availableCredits: number | null;
2096
+ totalCredits: number | null;
2097
+ sharedPool: Pick<SharedPoolBalance, "allowance" | "used" | "remaining"> | null;
2098
+ }): CreditsMeter;
2107
2099
  /**
2108
- * The toast after a cancel that needs nothing fixed: plain, or saying why
2109
- * billing left a target this allocation had moved off free on its plan.
2100
+ * The workspace a usage row was spent by, when it is not `currentWorkspaceId`:
2101
+ * a member's spending from this workspace's shared credits. `null` for this
2102
+ * workspace's own usage.
2110
2103
  */
2111
- declare function cancelOutcomeSummary(result: Pick<CancelCreditAllocationResult, "targetMovedToFree" | "reason">, targetName: string): string;
2112
- declare const ALLOCATION_ERROR_CODES: readonly ["INSUFFICIENT_CREDITS", "SOURCE_ON_FREE_PLAN", "ALLOCATION_NOT_ALLOWED", "TARGET_PLAN_CHANGE_FAILED"];
2113
- type AllocationErrorCode = (typeof ALLOCATION_ERROR_CODES)[number];
2114
- /** The billing allocation error in a failure: its code, details and server message. */
2115
- declare function findAllocationError(failure: unknown): {
2116
- code: AllocationErrorCode;
2104
+ declare function usedByWorkspaceKey(log: Pick<UsageHistoryItem, "meta">, currentWorkspaceId: string | null | undefined): string | null;
2105
+ /**
2106
+ * Names for the `usedBy` workspaces in this workspace's usage, keyed by the
2107
+ * lower-cased key: its current members and the ones it stopped sharing with,
2108
+ * whose rows stay in its history.
2109
+ */
2110
+ declare function usedByNamesFrom(pool: Pick<CreditPoolResponse, "members" | "formerMembers"> | null | undefined): Record<string, string>;
2111
+ declare const POOL_ERROR_CODES: readonly ["SPONSOR_ON_FREE_PLAN", "POOL_NOT_ALLOWED"];
2112
+ type PoolErrorCode = (typeof POOL_ERROR_CODES)[number];
2113
+ /** The billing pool error in a failure: its code, details and server message. */
2114
+ declare function findPoolError(failure: unknown): {
2115
+ code: PoolErrorCode;
2117
2116
  details: Record<string, unknown>;
2118
2117
  message: string | null;
2119
2118
  } | null;
2120
2119
  /**
2121
- * A plain sentence for a billing allocation refusal, or `null` when the
2122
- * failure is not one (the caller then falls back to its generic message).
2120
+ * A plain sentence for a billing pool refusal, or `null` when the failure is
2121
+ * not one (the caller then falls back to its generic message).
2123
2122
  */
2124
- declare function allocationErrorMessage(failure: unknown): string | null;
2123
+ declare function poolErrorMessage(failure: unknown): string | null;
2125
2124
 
2126
2125
  /**
2127
- * Billing sub-view: credits this workspace shares with, or receives from,
2128
- * other workspaces of its organization. Changes are for organization admins
2129
- * (`canManage` from the server); everyone else who reaches Billing reads.
2126
+ * Billing sub-view: the workspaces that may spend this workspace's credits,
2127
+ * each up to an allowance per billing cycle, or the workspace whose credits
2128
+ * this one spends. Changes are for organization admins (`canManage` from the
2129
+ * server); everyone else who reaches Billing reads.
2130
2130
  */
2131
- declare function CreditAllocationsView(): react.JSX.Element;
2131
+ declare function SharedCreditsView(): react.JSX.Element;
2132
2132
 
2133
- type CreditAllocationModalProps = {
2134
- kind: "create";
2135
- /** Workspaces credits can go to. */
2136
- targets: CreditAllocationTarget[];
2137
- /** This workspace's available credits, when known: the first share comes out of it. */
2138
- balance: number | null;
2139
- onSave: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
2133
+ type CreditPoolMemberModalProps = {
2134
+ kind: "add";
2135
+ /** Workspaces credits can be shared with. */
2136
+ candidates: CreditPoolCandidate[];
2137
+ onSave: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
2140
2138
  onClose: () => void;
2141
- /** After a save (or a failure that still left an allocation); the parent refetches. */
2139
+ /** After a save; the parent refetches. */
2142
2140
  onSaved: () => void;
2143
2141
  } | {
2144
2142
  kind: "edit";
2145
- allocation: CreditAllocation;
2146
- targetName: string;
2147
- onSave: (patch: UpdateCreditAllocationInput) => Promise<CreditAllocation>;
2143
+ member: CreditPoolMember;
2144
+ memberName: string;
2145
+ onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
2148
2146
  onClose: () => void;
2149
2147
  onSaved: () => void;
2150
2148
  };
2151
- /** Create an allocation, or change an active one's split and repeat. */
2152
- declare function CreditAllocationModal(props: CreditAllocationModalProps): react.JSX.Element;
2149
+ /** Share credits with a workspace, or change an active member's share. */
2150
+ declare function CreditPoolMemberModal(props: CreditPoolMemberModalProps): react.JSX.Element;
2153
2151
 
2154
- interface CancelCreditAllocationModalProps {
2155
- allocation: CreditAllocation;
2156
- targetName: string;
2157
- onCancel: (reason: string) => Promise<CancelCreditAllocationResult>;
2152
+ interface RemovePoolMemberModalProps {
2153
+ member: CreditPoolMember;
2154
+ memberName: string;
2155
+ /** This workspace's name, the one sharing its credits. */
2156
+ sponsorName: string;
2157
+ onRemove: (reason: string) => Promise<CreditPoolMember>;
2158
2158
  onClose: () => void;
2159
- /**
2160
- * After the allocation was canceled; the parent refetches. `planNotRestored`
2161
- * is true when the target was left on the Custom plan and someone has to fix it.
2162
- */
2163
- onCanceled: (result: {
2164
- planNotRestored: boolean;
2165
- }) => void;
2159
+ /** After the member was removed; the parent refetches. */
2160
+ onRemoved: () => void;
2166
2161
  }
2167
- /**
2168
- * Confirm a cancel with a reason. Billing cancels even when moving the target
2169
- * back to free fails; that outcome stays on screen (not a toast that can be
2170
- * missed) until the admin acknowledges it.
2171
- */
2172
- declare function CancelCreditAllocationModal({ allocation, targetName, onCancel, onClose, onCanceled, }: CancelCreditAllocationModalProps): react.JSX.Element;
2162
+ /** Confirm stopping a member spending this workspace's credits, with a reason. */
2163
+ declare function RemovePoolMemberModal({ member, memberName, sponsorName, onRemove, onClose, onRemoved, }: RemovePoolMemberModalProps): react.JSX.Element;
2173
2164
 
2174
2165
  declare function SettingsAdaptersProvider({ adapters, children, }: {
2175
2166
  adapters: SettingsAdapters;
@@ -2182,4 +2173,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
2182
2173
  */
2183
2174
  declare function useSettingsAdapters(): SettingsAdapters;
2184
2175
 
2185
- export { ALLOCATION_ERROR_CODES, ALLOCATION_NOTE_MAX_LENGTH, APP_KEYS, type AllocationErrorCode, type AllocationValueValidation, type ApiToken, type AppKey, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, CANCEL_REASON_MAX_LENGTH, CancelCreditAllocationModal, type CancelCreditAllocationModalProps, type CancelCreditAllocationResult, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreateCreditAllocationInput, type CreatedToken, type CreditAllocation, CreditAllocationModal, type CreditAllocationModalProps, type CreditAllocationMode, type CreditAllocationStatus, type CreditAllocationTarget, type CreditAllocationsResponse, CreditAllocationsView, type CreditCycleUnit, type CreditLimitValidation, type CreditTransfer, type CreditTransfersPage, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, 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, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, PerUserLimitsView, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, 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, 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, USER_LANGUAGES, type UpdateCreditAllocationInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, 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, allocationErrorMessage, allocationWorkspaceName, belowUsageReason, canShowCreditAllocations, cancelOutcomeSummary, cancelOutcomeWarning, cleanAllocationValueInput, cleanCreditLimitInput, countLabel, creditCycleUnit, describeAllocation, describeDefaultLimit, describeMemberLimit, findAllocationError, findBillingError, formatAllocationRepeat, formatAllocationSplit, formatCreditLimit, formatCredits, groupWorkspaceList, initialTransferSummary, initialTransferWarning, isLimitBelowUsage, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadWorkspaceOrganization, memberRoleUpdate, minimumCreditLimit, resolveSettingsTabFromPath, roundCredits, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel, validateAllocationText, validateAllocationValue, validateCreditLimitInput, validateDefaultCreditLimitInput };
2176
+ export { APP_KEYS, type AddCreditPoolMemberInput, type ApiToken, type AppKey, type AvailableCreditsResponse, BillingContent, 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 CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, 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, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolErrorCode, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralTab, 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 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, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, 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, creditCycleUnit, creditsMeter, describeAllowance, describeDefaultLimit, describeMemberLimit, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolSplit, groupWorkspaceList, isLimitBelowUsage, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadWorkspaceOrganization, memberRoleUpdate, minimumCreditLimit, pausedOwnCreditsText, poolErrorMessage, poolWorkspaceName, resolveSettingsTabFromPath, roundCredits, sharedPoolBannerText, useSettingsAdapters, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };