@streamoid/settings 0.9.1 → 0.10.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
@@ -159,6 +159,18 @@ usually what you want.
159
159
 
160
160
  See [`src/adapters.ts`](src/adapters.ts) for full type definitions.
161
161
 
162
+ ### Optional billing features
163
+
164
+ Billing hides an entry whose adapter method is absent:
165
+
166
+ - **Per-user usage limits:** `api.fetchMemberCreditLimits` (plus
167
+ `setMemberCreditLimit`, `removeMemberCreditLimit`, `setDefaultCreditLimit`).
168
+ - **Credit allocations:** `api.fetchCreditAllocations`, and the workspace must
169
+ be in an organization. `createCreditAllocation`, `updateCreditAllocation`,
170
+ `cancelCreditAllocation`, `fetchCreditTransfers` and
171
+ `fetchAllocationTargets` light up the rest. Only organization admins
172
+ change allocations; the server says so with `canManage`.
173
+
162
174
  ## Status
163
175
 
164
176
  - **0.1.0** — Adapter surface and package scaffold. Tab content lands in
package/dist/index.d.mts CHANGED
@@ -832,6 +832,102 @@ interface MemberCreditLimitsResponse {
832
832
  /** Only members with an override or with usage; the rest follow the default. */
833
833
  users: MemberCreditLimit[];
834
834
  }
835
+ type CreditAllocationMode = "fixed" | "percent";
836
+ type CreditAllocationStatus = "active" | "canceled";
837
+ /**
838
+ * A workspace sending part of its credits to another workspace of its
839
+ * organization: once when created, and again out of every renewal grant while
840
+ * `recurring`. Workspace ids are the host's workspace ids (`*WorkspaceKey`).
841
+ */
842
+ interface CreditAllocation {
843
+ _id: string;
844
+ /** The sponsor (source) workspace. */
845
+ sourceWorkspaceKey: string;
846
+ sourceWorkspaceName?: string | null;
847
+ /** The receiving (target) workspace. */
848
+ targetWorkspaceKey: string;
849
+ targetWorkspaceName?: string | null;
850
+ mode: CreditAllocationMode;
851
+ /** Credits for `fixed`; a share of each grant, (0–100], for `percent`. */
852
+ value: number;
853
+ recurring: boolean;
854
+ status: CreditAllocationStatus;
855
+ /** This allocation moved the target off the free plan, so cancelling moves it back. */
856
+ targetPlanChanged?: boolean;
857
+ /**
858
+ * The first move, from the source's balance, when the allocation was made.
859
+ * `failed` means the allocation is active (renewals still split) but those
860
+ * first credits did NOT move.
861
+ */
862
+ initialTransfer?: {
863
+ status: "done" | "failed";
864
+ credits: number;
865
+ error?: string;
866
+ };
867
+ note?: string;
868
+ requestedBy?: string;
869
+ createdBy?: string;
870
+ createdAt?: string;
871
+ updatedAt?: string;
872
+ canceledAt?: string;
873
+ canceledBy?: string;
874
+ cancelReason?: string;
875
+ }
876
+ interface CreditAllocationsResponse {
877
+ /** Allocations this workspace sponsors, canceled ones included, newest first. */
878
+ giving: CreditAllocation[];
879
+ /** Allocations sponsoring this workspace (at most one active). */
880
+ receiving: CreditAllocation[];
881
+ /** The viewer may create, change and cancel (an admin of the organization). */
882
+ canManage: boolean;
883
+ }
884
+ interface CreateCreditAllocationInput {
885
+ targetWorkspaceId: string;
886
+ mode: CreditAllocationMode;
887
+ value: number;
888
+ recurring: boolean;
889
+ /** Why — required, at most 500 characters. */
890
+ note: string;
891
+ }
892
+ type UpdateCreditAllocationInput = {
893
+ mode: CreditAllocationMode;
894
+ value: number;
895
+ recurring?: boolean;
896
+ } | {
897
+ recurring: boolean;
898
+ };
899
+ interface CancelCreditAllocationResult {
900
+ allocation: CreditAllocation;
901
+ /** The target was moved back to the free plan. */
902
+ targetMovedToFree: boolean;
903
+ /** Why billing left the target on its plan on purpose (bought its own, already on free). */
904
+ reason?: string;
905
+ /** Set when moving the target back to free failed; the allocation is canceled anyway. */
906
+ error?: string;
907
+ }
908
+ interface CreditTransfer {
909
+ id: string;
910
+ direction: "sent" | "received";
911
+ credits: number;
912
+ createdAt: string | null;
913
+ expiresAt?: string | null;
914
+ allocationId: string | null;
915
+ kind: "initial" | "renewal";
916
+ counterpartWorkspaceId: string | null;
917
+ counterpartWorkspaceName: string | null;
918
+ }
919
+ interface CreditTransfersPage {
920
+ transfers: CreditTransfer[];
921
+ page: number;
922
+ limit: number;
923
+ total: number;
924
+ }
925
+ /** A workspace credits can be allocated to (another workspace of the organization). */
926
+ interface CreditAllocationTarget {
927
+ id: string;
928
+ name: string;
929
+ imageUrl?: string;
930
+ }
835
931
  /**
836
932
  * The API adapter is split into three concern areas (billing / teams /
837
933
  * tokens) but kept flat to match the original spec. Methods are grouped with
@@ -967,6 +1063,27 @@ interface SettingsApiAdapter {
967
1063
  /** Set the workspace default per-member limit; `null` means Unlimited.
968
1064
  * Applies to members without their own override. Throws on error. */
969
1065
  setDefaultCreditLimit?: (limit: number | null) => Promise<void>;
1066
+ /**
1067
+ * What this workspace gives to and receives from other workspaces of its
1068
+ * organization. When omitted, Billing hides the "Credit allocations" entry.
1069
+ */
1070
+ fetchCreditAllocations?: () => Promise<CreditAllocationsResponse>;
1071
+ /** Organization admins only. Moves the first share now. Rejects with the
1072
+ * billing `code` (`INSUFFICIENT_CREDITS`, `ALLOCATION_NOT_ALLOWED`,
1073
+ * `SOURCE_ON_FREE_PLAN`, `TARGET_PLAN_CHANGE_FAILED`) on the error body. */
1074
+ createCreditAllocation?: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
1075
+ /** Change the split and/or repeat; applies from the next renewal. */
1076
+ updateCreditAllocation?: (allocationId: string, patch: UpdateCreditAllocationInput) => Promise<CreditAllocation>;
1077
+ /** Stop an allocation. Resolves even when the target could not be moved
1078
+ * back to free — check `targetMovedToFree` / `error`. */
1079
+ cancelCreditAllocation?: (allocationId: string, reason: string) => Promise<CancelCreditAllocationResult>;
1080
+ /** Transfers this workspace sent or received, newest first. */
1081
+ fetchCreditTransfers?: (input: {
1082
+ page: number;
1083
+ limit: number;
1084
+ }) => Promise<CreditTransfersPage>;
1085
+ /** Workspaces this one may allocate to: its organization's others. */
1086
+ fetchAllocationTargets?: () => Promise<CreditAllocationTarget[]>;
970
1087
  fetchTokens: (params?: {
971
1088
  showRevoked?: boolean;
972
1089
  }) => Promise<ApiToken[]>;
@@ -1284,7 +1401,7 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
1284
1401
  };
1285
1402
  declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
1286
1403
 
1287
- declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, }?: {
1404
+ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showCreditAllocations: showCreditAllocationsProp, onShowCreditAllocationsChange, }?: {
1288
1405
  embedded?: boolean;
1289
1406
  /** Controlled "plans" sub-view flag. When provided, the host (settings
1290
1407
  * wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
@@ -1294,6 +1411,11 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
1294
1411
  * Only reachable when `api.fetchMemberCreditLimits` exists. */
1295
1412
  showPerUserLimits?: boolean;
1296
1413
  onShowPerUserLimitsChange?: (open: boolean) => void;
1414
+ /** Controlled "credit allocations" sub-view flag; same contract as
1415
+ * `showPlans`. Only reachable when `api.fetchCreditAllocations` exists and
1416
+ * the workspace is in an organization. */
1417
+ showCreditAllocations?: boolean;
1418
+ onShowCreditAllocationsChange?: (open: boolean) => void;
1297
1419
  }): react__default.JSX.Element;
1298
1420
 
1299
1421
  /**
@@ -1850,6 +1972,13 @@ declare function isLimitBelowUsage(failure: unknown): boolean;
1850
1972
  * spent more since. `null` when the failure is not one, or carries no figure.
1851
1973
  */
1852
1974
  declare function limitBelowUsageUsed(failure: unknown): number | null;
1975
+ /**
1976
+ * The error object carrying one of the billing `codes`, wherever the failure
1977
+ * keeps it. `UserFacingError` rewrites `err.code` to a category, so the
1978
+ * original body is searched: `code`, `error.*`, `body.*`, `data.*`,
1979
+ * `publicError.*` and `cause`, to a shallow depth. `null` when none matches.
1980
+ */
1981
+ declare function findBillingError(failure: unknown, codes: readonly string[]): Record<string, unknown> | null;
1853
1982
 
1854
1983
  /** Billing sub-view: per-member credit limits for the current billing cycle. */
1855
1984
  declare function PerUserLimitsView(): react.JSX.Element;
@@ -1893,6 +2022,141 @@ interface MemberCreditLimitModalProps {
1893
2022
  /** A fixed number of credits per cycle, or unlimited — for one member or the workspace default. */
1894
2023
  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;
1895
2024
 
2025
+ /**
2026
+ * Credit allocation rules and copy, kept out of the components so a host can
2027
+ * test them. The server (billing, behind unified-backend) is the authority;
2028
+ * these only stop an obviously bad request and say clearly what happened.
2029
+ */
2030
+ declare const ALLOCATION_NOTE_MAX_LENGTH = 500;
2031
+ declare const CANCEL_REASON_MAX_LENGTH = 500;
2032
+ /**
2033
+ * Whether Billing offers credit allocations: the host implements them, and the
2034
+ * workspace is in an organization (allocations move credits between one
2035
+ * organization's workspaces, so a personal workspace has nowhere to send them).
2036
+ */
2037
+ declare function canShowCreditAllocations(api: Pick<SettingsApiAdapter, "fetchCreditAllocations">, workspace: Pick<SettingsWorkspaceCurrent, "organizationId"> | null | undefined, organization: Pick<SettingsOrganizationCurrent, "id"> | null | undefined): boolean;
2038
+ type AllocationValueValidation = {
2039
+ ok: true;
2040
+ value: number;
2041
+ } | {
2042
+ ok: false;
2043
+ reason: string;
2044
+ };
2045
+ /** Digits and one `.` — what the value input keeps as the user types. */
2046
+ declare function cleanAllocationValueInput(raw: string): string;
2047
+ /**
2048
+ * A split value as billing accepts it: > 0, at most two decimals, and at most
2049
+ * 100 for a percent. A fixed share over `balance` (when known) is refused too —
2050
+ * the first share moves from the balance right away.
2051
+ */
2052
+ declare function validateAllocationValue(mode: CreditAllocationMode, raw: string, balance?: number | null): AllocationValueValidation;
2053
+ /** A required note or reason: trimmed, non-empty, at most `max` characters. */
2054
+ declare function validateAllocationText(raw: string, max: number): {
2055
+ ok: true;
2056
+ value: string;
2057
+ } | {
2058
+ ok: false;
2059
+ reason: string;
2060
+ };
2061
+ /** `fixed 500` → "500 credits"; `percent 20` → "20%". */
2062
+ declare function formatAllocationSplit(split: {
2063
+ mode: CreditAllocationMode;
2064
+ value: number;
2065
+ }): string;
2066
+ /** "Every renewal" or "Once". */
2067
+ declare function formatAllocationRepeat(recurring: boolean): string;
2068
+ /** "500 credits every renewal", "20% of each renewal", "500 credits once". */
2069
+ declare function describeAllocation(allocation: Pick<CreditAllocation, "mode" | "value" | "recurring">): string;
2070
+ /** The other workspace's name, or a stand-in when it could not be resolved. */
2071
+ declare function allocationWorkspaceName(name: string | null | undefined): string;
2072
+ /**
2073
+ * Why the first transfer did not happen, when it failed. The allocation was
2074
+ * still made — so without this an admin would assume the credits moved.
2075
+ */
2076
+ declare function initialTransferWarning(allocation: Pick<CreditAllocation, "initialTransfer">): string | null;
2077
+ /** "Sent 500 credits at setup", when the first transfer went through. */
2078
+ declare function initialTransferSummary(allocation: Pick<CreditAllocation, "initialTransfer">): string | null;
2079
+ /**
2080
+ * What still needs doing after a cancel, or `null` when nothing does.
2081
+ *
2082
+ * Billing cancels the allocation even when moving the target back to free
2083
+ * fails (`error`). A target this allocation moved off free (`targetPlanChanged`)
2084
+ * that was not moved back stays on the $0 Custom plan, without its free monthly
2085
+ * credits. No customer-facing action moves a workspace to free immediately, so
2086
+ * the way out is Streamoid support. When billing left the target's plan on
2087
+ * purpose it says why (`reason`: it bought a plan of its own, or is already on
2088
+ * free), and nothing needs fixing; nor does a target that was never moved.
2089
+ */
2090
+ declare function cancelOutcomeWarning(result: Pick<CancelCreditAllocationResult, "targetMovedToFree" | "reason" | "error"> & {
2091
+ allocation?: Pick<CreditAllocation, "targetPlanChanged"> | null;
2092
+ }, targetName: string): string | null;
2093
+ /**
2094
+ * The toast after a cancel that needs nothing fixed: plain, or saying why
2095
+ * billing left a target this allocation had moved off free on its plan.
2096
+ */
2097
+ declare function cancelOutcomeSummary(result: Pick<CancelCreditAllocationResult, "targetMovedToFree" | "reason">, targetName: string): string;
2098
+ declare const ALLOCATION_ERROR_CODES: readonly ["INSUFFICIENT_CREDITS", "SOURCE_ON_FREE_PLAN", "ALLOCATION_NOT_ALLOWED", "TARGET_PLAN_CHANGE_FAILED"];
2099
+ type AllocationErrorCode = (typeof ALLOCATION_ERROR_CODES)[number];
2100
+ /** The billing allocation error in a failure: its code, details and server message. */
2101
+ declare function findAllocationError(failure: unknown): {
2102
+ code: AllocationErrorCode;
2103
+ details: Record<string, unknown>;
2104
+ message: string | null;
2105
+ } | null;
2106
+ /**
2107
+ * A plain sentence for a billing allocation refusal, or `null` when the
2108
+ * failure is not one (the caller then falls back to its generic message).
2109
+ */
2110
+ declare function allocationErrorMessage(failure: unknown): string | null;
2111
+
2112
+ /**
2113
+ * Billing sub-view: credits this workspace shares with, or receives from,
2114
+ * other workspaces of its organization. Changes are for organization admins
2115
+ * (`canManage` from the server); everyone else who reaches Billing reads.
2116
+ */
2117
+ declare function CreditAllocationsView(): react.JSX.Element;
2118
+
2119
+ type CreditAllocationModalProps = {
2120
+ kind: "create";
2121
+ /** Workspaces credits can go to. */
2122
+ targets: CreditAllocationTarget[];
2123
+ /** This workspace's available credits, when known: the first share comes out of it. */
2124
+ balance: number | null;
2125
+ onSave: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
2126
+ onClose: () => void;
2127
+ /** After a save (or a failure that still left an allocation); the parent refetches. */
2128
+ onSaved: () => void;
2129
+ } | {
2130
+ kind: "edit";
2131
+ allocation: CreditAllocation;
2132
+ targetName: string;
2133
+ onSave: (patch: UpdateCreditAllocationInput) => Promise<CreditAllocation>;
2134
+ onClose: () => void;
2135
+ onSaved: () => void;
2136
+ };
2137
+ /** Create an allocation, or change an active one's split and repeat. */
2138
+ declare function CreditAllocationModal(props: CreditAllocationModalProps): react.JSX.Element;
2139
+
2140
+ interface CancelCreditAllocationModalProps {
2141
+ allocation: CreditAllocation;
2142
+ targetName: string;
2143
+ onCancel: (reason: string) => Promise<CancelCreditAllocationResult>;
2144
+ onClose: () => void;
2145
+ /**
2146
+ * After the allocation was canceled; the parent refetches. `planNotRestored`
2147
+ * is true when the target was left on the Custom plan and someone has to fix it.
2148
+ */
2149
+ onCanceled: (result: {
2150
+ planNotRestored: boolean;
2151
+ }) => void;
2152
+ }
2153
+ /**
2154
+ * Confirm a cancel with a reason. Billing cancels even when moving the target
2155
+ * back to free fails; that outcome stays on screen (not a toast that can be
2156
+ * missed) until the admin acknowledges it.
2157
+ */
2158
+ declare function CancelCreditAllocationModal({ allocation, targetName, onCancel, onClose, onCanceled, }: CancelCreditAllocationModalProps): react.JSX.Element;
2159
+
1896
2160
  declare function SettingsAdaptersProvider({ adapters, children, }: {
1897
2161
  adapters: SettingsAdapters;
1898
2162
  children: ReactNode;
@@ -1904,4 +2168,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
1904
2168
  */
1905
2169
  declare function useSettingsAdapters(): SettingsAdapters;
1906
2170
 
1907
- export { APP_KEYS, 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 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 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 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, cleanCreditLimitInput, countLabel, creditCycleUnit, describeDefaultLimit, describeMemberLimit, formatCreditLimit, formatCredits, groupWorkspaceList, isLimitBelowUsage, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadWorkspaceOrganization, memberRoleUpdate, minimumCreditLimit, resolveSettingsTabFromPath, roundCredits, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput };
2171
+ 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 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 };
package/dist/index.d.ts CHANGED
@@ -832,6 +832,102 @@ interface MemberCreditLimitsResponse {
832
832
  /** Only members with an override or with usage; the rest follow the default. */
833
833
  users: MemberCreditLimit[];
834
834
  }
835
+ type CreditAllocationMode = "fixed" | "percent";
836
+ type CreditAllocationStatus = "active" | "canceled";
837
+ /**
838
+ * A workspace sending part of its credits to another workspace of its
839
+ * organization: once when created, and again out of every renewal grant while
840
+ * `recurring`. Workspace ids are the host's workspace ids (`*WorkspaceKey`).
841
+ */
842
+ interface CreditAllocation {
843
+ _id: string;
844
+ /** The sponsor (source) workspace. */
845
+ sourceWorkspaceKey: string;
846
+ sourceWorkspaceName?: string | null;
847
+ /** The receiving (target) workspace. */
848
+ targetWorkspaceKey: string;
849
+ targetWorkspaceName?: string | null;
850
+ mode: CreditAllocationMode;
851
+ /** Credits for `fixed`; a share of each grant, (0–100], for `percent`. */
852
+ value: number;
853
+ recurring: boolean;
854
+ status: CreditAllocationStatus;
855
+ /** This allocation moved the target off the free plan, so cancelling moves it back. */
856
+ targetPlanChanged?: boolean;
857
+ /**
858
+ * The first move, from the source's balance, when the allocation was made.
859
+ * `failed` means the allocation is active (renewals still split) but those
860
+ * first credits did NOT move.
861
+ */
862
+ initialTransfer?: {
863
+ status: "done" | "failed";
864
+ credits: number;
865
+ error?: string;
866
+ };
867
+ note?: string;
868
+ requestedBy?: string;
869
+ createdBy?: string;
870
+ createdAt?: string;
871
+ updatedAt?: string;
872
+ canceledAt?: string;
873
+ canceledBy?: string;
874
+ cancelReason?: string;
875
+ }
876
+ interface CreditAllocationsResponse {
877
+ /** Allocations this workspace sponsors, canceled ones included, newest first. */
878
+ giving: CreditAllocation[];
879
+ /** Allocations sponsoring this workspace (at most one active). */
880
+ receiving: CreditAllocation[];
881
+ /** The viewer may create, change and cancel (an admin of the organization). */
882
+ canManage: boolean;
883
+ }
884
+ interface CreateCreditAllocationInput {
885
+ targetWorkspaceId: string;
886
+ mode: CreditAllocationMode;
887
+ value: number;
888
+ recurring: boolean;
889
+ /** Why — required, at most 500 characters. */
890
+ note: string;
891
+ }
892
+ type UpdateCreditAllocationInput = {
893
+ mode: CreditAllocationMode;
894
+ value: number;
895
+ recurring?: boolean;
896
+ } | {
897
+ recurring: boolean;
898
+ };
899
+ interface CancelCreditAllocationResult {
900
+ allocation: CreditAllocation;
901
+ /** The target was moved back to the free plan. */
902
+ targetMovedToFree: boolean;
903
+ /** Why billing left the target on its plan on purpose (bought its own, already on free). */
904
+ reason?: string;
905
+ /** Set when moving the target back to free failed; the allocation is canceled anyway. */
906
+ error?: string;
907
+ }
908
+ interface CreditTransfer {
909
+ id: string;
910
+ direction: "sent" | "received";
911
+ credits: number;
912
+ createdAt: string | null;
913
+ expiresAt?: string | null;
914
+ allocationId: string | null;
915
+ kind: "initial" | "renewal";
916
+ counterpartWorkspaceId: string | null;
917
+ counterpartWorkspaceName: string | null;
918
+ }
919
+ interface CreditTransfersPage {
920
+ transfers: CreditTransfer[];
921
+ page: number;
922
+ limit: number;
923
+ total: number;
924
+ }
925
+ /** A workspace credits can be allocated to (another workspace of the organization). */
926
+ interface CreditAllocationTarget {
927
+ id: string;
928
+ name: string;
929
+ imageUrl?: string;
930
+ }
835
931
  /**
836
932
  * The API adapter is split into three concern areas (billing / teams /
837
933
  * tokens) but kept flat to match the original spec. Methods are grouped with
@@ -967,6 +1063,27 @@ interface SettingsApiAdapter {
967
1063
  /** Set the workspace default per-member limit; `null` means Unlimited.
968
1064
  * Applies to members without their own override. Throws on error. */
969
1065
  setDefaultCreditLimit?: (limit: number | null) => Promise<void>;
1066
+ /**
1067
+ * What this workspace gives to and receives from other workspaces of its
1068
+ * organization. When omitted, Billing hides the "Credit allocations" entry.
1069
+ */
1070
+ fetchCreditAllocations?: () => Promise<CreditAllocationsResponse>;
1071
+ /** Organization admins only. Moves the first share now. Rejects with the
1072
+ * billing `code` (`INSUFFICIENT_CREDITS`, `ALLOCATION_NOT_ALLOWED`,
1073
+ * `SOURCE_ON_FREE_PLAN`, `TARGET_PLAN_CHANGE_FAILED`) on the error body. */
1074
+ createCreditAllocation?: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
1075
+ /** Change the split and/or repeat; applies from the next renewal. */
1076
+ updateCreditAllocation?: (allocationId: string, patch: UpdateCreditAllocationInput) => Promise<CreditAllocation>;
1077
+ /** Stop an allocation. Resolves even when the target could not be moved
1078
+ * back to free — check `targetMovedToFree` / `error`. */
1079
+ cancelCreditAllocation?: (allocationId: string, reason: string) => Promise<CancelCreditAllocationResult>;
1080
+ /** Transfers this workspace sent or received, newest first. */
1081
+ fetchCreditTransfers?: (input: {
1082
+ page: number;
1083
+ limit: number;
1084
+ }) => Promise<CreditTransfersPage>;
1085
+ /** Workspaces this one may allocate to: its organization's others. */
1086
+ fetchAllocationTargets?: () => Promise<CreditAllocationTarget[]>;
970
1087
  fetchTokens: (params?: {
971
1088
  showRevoked?: boolean;
972
1089
  }) => Promise<ApiToken[]>;
@@ -1284,7 +1401,7 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
1284
1401
  };
1285
1402
  declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
1286
1403
 
1287
- declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, }?: {
1404
+ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showCreditAllocations: showCreditAllocationsProp, onShowCreditAllocationsChange, }?: {
1288
1405
  embedded?: boolean;
1289
1406
  /** Controlled "plans" sub-view flag. When provided, the host (settings
1290
1407
  * wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
@@ -1294,6 +1411,11 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
1294
1411
  * Only reachable when `api.fetchMemberCreditLimits` exists. */
1295
1412
  showPerUserLimits?: boolean;
1296
1413
  onShowPerUserLimitsChange?: (open: boolean) => void;
1414
+ /** Controlled "credit allocations" sub-view flag; same contract as
1415
+ * `showPlans`. Only reachable when `api.fetchCreditAllocations` exists and
1416
+ * the workspace is in an organization. */
1417
+ showCreditAllocations?: boolean;
1418
+ onShowCreditAllocationsChange?: (open: boolean) => void;
1297
1419
  }): react__default.JSX.Element;
1298
1420
 
1299
1421
  /**
@@ -1850,6 +1972,13 @@ declare function isLimitBelowUsage(failure: unknown): boolean;
1850
1972
  * spent more since. `null` when the failure is not one, or carries no figure.
1851
1973
  */
1852
1974
  declare function limitBelowUsageUsed(failure: unknown): number | null;
1975
+ /**
1976
+ * The error object carrying one of the billing `codes`, wherever the failure
1977
+ * keeps it. `UserFacingError` rewrites `err.code` to a category, so the
1978
+ * original body is searched: `code`, `error.*`, `body.*`, `data.*`,
1979
+ * `publicError.*` and `cause`, to a shallow depth. `null` when none matches.
1980
+ */
1981
+ declare function findBillingError(failure: unknown, codes: readonly string[]): Record<string, unknown> | null;
1853
1982
 
1854
1983
  /** Billing sub-view: per-member credit limits for the current billing cycle. */
1855
1984
  declare function PerUserLimitsView(): react.JSX.Element;
@@ -1893,6 +2022,141 @@ interface MemberCreditLimitModalProps {
1893
2022
  /** A fixed number of credits per cycle, or unlimited — for one member or the workspace default. */
1894
2023
  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;
1895
2024
 
2025
+ /**
2026
+ * Credit allocation rules and copy, kept out of the components so a host can
2027
+ * test them. The server (billing, behind unified-backend) is the authority;
2028
+ * these only stop an obviously bad request and say clearly what happened.
2029
+ */
2030
+ declare const ALLOCATION_NOTE_MAX_LENGTH = 500;
2031
+ declare const CANCEL_REASON_MAX_LENGTH = 500;
2032
+ /**
2033
+ * Whether Billing offers credit allocations: the host implements them, and the
2034
+ * workspace is in an organization (allocations move credits between one
2035
+ * organization's workspaces, so a personal workspace has nowhere to send them).
2036
+ */
2037
+ declare function canShowCreditAllocations(api: Pick<SettingsApiAdapter, "fetchCreditAllocations">, workspace: Pick<SettingsWorkspaceCurrent, "organizationId"> | null | undefined, organization: Pick<SettingsOrganizationCurrent, "id"> | null | undefined): boolean;
2038
+ type AllocationValueValidation = {
2039
+ ok: true;
2040
+ value: number;
2041
+ } | {
2042
+ ok: false;
2043
+ reason: string;
2044
+ };
2045
+ /** Digits and one `.` — what the value input keeps as the user types. */
2046
+ declare function cleanAllocationValueInput(raw: string): string;
2047
+ /**
2048
+ * A split value as billing accepts it: > 0, at most two decimals, and at most
2049
+ * 100 for a percent. A fixed share over `balance` (when known) is refused too —
2050
+ * the first share moves from the balance right away.
2051
+ */
2052
+ declare function validateAllocationValue(mode: CreditAllocationMode, raw: string, balance?: number | null): AllocationValueValidation;
2053
+ /** A required note or reason: trimmed, non-empty, at most `max` characters. */
2054
+ declare function validateAllocationText(raw: string, max: number): {
2055
+ ok: true;
2056
+ value: string;
2057
+ } | {
2058
+ ok: false;
2059
+ reason: string;
2060
+ };
2061
+ /** `fixed 500` → "500 credits"; `percent 20` → "20%". */
2062
+ declare function formatAllocationSplit(split: {
2063
+ mode: CreditAllocationMode;
2064
+ value: number;
2065
+ }): string;
2066
+ /** "Every renewal" or "Once". */
2067
+ declare function formatAllocationRepeat(recurring: boolean): string;
2068
+ /** "500 credits every renewal", "20% of each renewal", "500 credits once". */
2069
+ declare function describeAllocation(allocation: Pick<CreditAllocation, "mode" | "value" | "recurring">): string;
2070
+ /** The other workspace's name, or a stand-in when it could not be resolved. */
2071
+ declare function allocationWorkspaceName(name: string | null | undefined): string;
2072
+ /**
2073
+ * Why the first transfer did not happen, when it failed. The allocation was
2074
+ * still made — so without this an admin would assume the credits moved.
2075
+ */
2076
+ declare function initialTransferWarning(allocation: Pick<CreditAllocation, "initialTransfer">): string | null;
2077
+ /** "Sent 500 credits at setup", when the first transfer went through. */
2078
+ declare function initialTransferSummary(allocation: Pick<CreditAllocation, "initialTransfer">): string | null;
2079
+ /**
2080
+ * What still needs doing after a cancel, or `null` when nothing does.
2081
+ *
2082
+ * Billing cancels the allocation even when moving the target back to free
2083
+ * fails (`error`). A target this allocation moved off free (`targetPlanChanged`)
2084
+ * that was not moved back stays on the $0 Custom plan, without its free monthly
2085
+ * credits. No customer-facing action moves a workspace to free immediately, so
2086
+ * the way out is Streamoid support. When billing left the target's plan on
2087
+ * purpose it says why (`reason`: it bought a plan of its own, or is already on
2088
+ * free), and nothing needs fixing; nor does a target that was never moved.
2089
+ */
2090
+ declare function cancelOutcomeWarning(result: Pick<CancelCreditAllocationResult, "targetMovedToFree" | "reason" | "error"> & {
2091
+ allocation?: Pick<CreditAllocation, "targetPlanChanged"> | null;
2092
+ }, targetName: string): string | null;
2093
+ /**
2094
+ * The toast after a cancel that needs nothing fixed: plain, or saying why
2095
+ * billing left a target this allocation had moved off free on its plan.
2096
+ */
2097
+ declare function cancelOutcomeSummary(result: Pick<CancelCreditAllocationResult, "targetMovedToFree" | "reason">, targetName: string): string;
2098
+ declare const ALLOCATION_ERROR_CODES: readonly ["INSUFFICIENT_CREDITS", "SOURCE_ON_FREE_PLAN", "ALLOCATION_NOT_ALLOWED", "TARGET_PLAN_CHANGE_FAILED"];
2099
+ type AllocationErrorCode = (typeof ALLOCATION_ERROR_CODES)[number];
2100
+ /** The billing allocation error in a failure: its code, details and server message. */
2101
+ declare function findAllocationError(failure: unknown): {
2102
+ code: AllocationErrorCode;
2103
+ details: Record<string, unknown>;
2104
+ message: string | null;
2105
+ } | null;
2106
+ /**
2107
+ * A plain sentence for a billing allocation refusal, or `null` when the
2108
+ * failure is not one (the caller then falls back to its generic message).
2109
+ */
2110
+ declare function allocationErrorMessage(failure: unknown): string | null;
2111
+
2112
+ /**
2113
+ * Billing sub-view: credits this workspace shares with, or receives from,
2114
+ * other workspaces of its organization. Changes are for organization admins
2115
+ * (`canManage` from the server); everyone else who reaches Billing reads.
2116
+ */
2117
+ declare function CreditAllocationsView(): react.JSX.Element;
2118
+
2119
+ type CreditAllocationModalProps = {
2120
+ kind: "create";
2121
+ /** Workspaces credits can go to. */
2122
+ targets: CreditAllocationTarget[];
2123
+ /** This workspace's available credits, when known: the first share comes out of it. */
2124
+ balance: number | null;
2125
+ onSave: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
2126
+ onClose: () => void;
2127
+ /** After a save (or a failure that still left an allocation); the parent refetches. */
2128
+ onSaved: () => void;
2129
+ } | {
2130
+ kind: "edit";
2131
+ allocation: CreditAllocation;
2132
+ targetName: string;
2133
+ onSave: (patch: UpdateCreditAllocationInput) => Promise<CreditAllocation>;
2134
+ onClose: () => void;
2135
+ onSaved: () => void;
2136
+ };
2137
+ /** Create an allocation, or change an active one's split and repeat. */
2138
+ declare function CreditAllocationModal(props: CreditAllocationModalProps): react.JSX.Element;
2139
+
2140
+ interface CancelCreditAllocationModalProps {
2141
+ allocation: CreditAllocation;
2142
+ targetName: string;
2143
+ onCancel: (reason: string) => Promise<CancelCreditAllocationResult>;
2144
+ onClose: () => void;
2145
+ /**
2146
+ * After the allocation was canceled; the parent refetches. `planNotRestored`
2147
+ * is true when the target was left on the Custom plan and someone has to fix it.
2148
+ */
2149
+ onCanceled: (result: {
2150
+ planNotRestored: boolean;
2151
+ }) => void;
2152
+ }
2153
+ /**
2154
+ * Confirm a cancel with a reason. Billing cancels even when moving the target
2155
+ * back to free fails; that outcome stays on screen (not a toast that can be
2156
+ * missed) until the admin acknowledges it.
2157
+ */
2158
+ declare function CancelCreditAllocationModal({ allocation, targetName, onCancel, onClose, onCanceled, }: CancelCreditAllocationModalProps): react.JSX.Element;
2159
+
1896
2160
  declare function SettingsAdaptersProvider({ adapters, children, }: {
1897
2161
  adapters: SettingsAdapters;
1898
2162
  children: ReactNode;
@@ -1904,4 +2168,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
1904
2168
  */
1905
2169
  declare function useSettingsAdapters(): SettingsAdapters;
1906
2170
 
1907
- export { APP_KEYS, 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 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 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 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, cleanCreditLimitInput, countLabel, creditCycleUnit, describeDefaultLimit, describeMemberLimit, formatCreditLimit, formatCredits, groupWorkspaceList, isLimitBelowUsage, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadWorkspaceOrganization, memberRoleUpdate, minimumCreditLimit, resolveSettingsTabFromPath, roundCredits, useSettingsAdapters, useWorkspaceOrganization, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput };
2171
+ 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 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 };