@streamoid/settings 0.10.1 → 0.11.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 +7 -5
- package/dist/index.d.mts +168 -184
- package/dist/index.d.ts +168 -184
- package/dist/index.js +365 -514
- package/dist/index.mjs +366 -515
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,11 +165,13 @@ 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
|
-
- **
|
|
169
|
-
|
|
170
|
-
`
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
- **Shared credits:** `api.fetchCreditPool`, and the workspace must be in an
|
|
169
|
+
organization. `addCreditPoolMember`, `updateCreditPoolMember`,
|
|
170
|
+
`removeCreditPoolMember` and `fetchCreditPoolCandidates` light up the rest.
|
|
171
|
+
Only organization admins change them; the server says so with `canManage`.
|
|
172
|
+
A member's balance (`fetchAvailableCredits`) carries `sharedPool`, which
|
|
173
|
+
Billing shows as a banner; usage rows with `meta.usedBy` get a Workspace
|
|
174
|
+
column, named from the pool's `members` and `formerMembers`.
|
|
173
175
|
|
|
174
176
|
## Status
|
|
175
177
|
|
package/dist/index.d.mts
CHANGED
|
@@ -658,8 +658,25 @@ 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
|
+
}
|
|
661
677
|
interface AvailableCreditsResponse {
|
|
662
678
|
availableCredits: number;
|
|
679
|
+
sharedPool?: SharedPoolBalance;
|
|
663
680
|
}
|
|
664
681
|
interface SubscriptionPlan {
|
|
665
682
|
id: string;
|
|
@@ -716,6 +733,9 @@ interface UsageHistoryItem {
|
|
|
716
733
|
meta?: {
|
|
717
734
|
info?: string;
|
|
718
735
|
stripeInvoiceId?: string;
|
|
736
|
+
/** The workspace id that spent it, on a row of a sponsor's shared credits. */
|
|
737
|
+
usedBy?: string;
|
|
738
|
+
poolMemberId?: string;
|
|
719
739
|
};
|
|
720
740
|
service?: {
|
|
721
741
|
serviceGroupName: string;
|
|
@@ -846,37 +866,31 @@ interface MemberCreditLimitsResponse {
|
|
|
846
866
|
/** Only members with an override or with usage; the rest follow the default. */
|
|
847
867
|
users: MemberCreditLimit[];
|
|
848
868
|
}
|
|
849
|
-
type
|
|
850
|
-
type
|
|
869
|
+
type CreditPoolMode = "fixed" | "percent";
|
|
870
|
+
type CreditPoolMemberStatus = "active" | "canceled";
|
|
851
871
|
/**
|
|
852
|
-
* A workspace
|
|
853
|
-
*
|
|
854
|
-
*
|
|
872
|
+
* A workspace allowed to spend another workspace's credits (the sponsor's), up
|
|
873
|
+
* to an allowance per sponsor billing cycle. Every credit stays with the
|
|
874
|
+
* sponsor. Workspace ids are the host's workspace ids (`*WorkspaceKey`).
|
|
855
875
|
*/
|
|
856
|
-
interface
|
|
876
|
+
interface CreditPoolMember {
|
|
857
877
|
_id: string;
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
mode: CreditAllocationMode;
|
|
865
|
-
/** Credits for `fixed`; a share of each grant, (0–100], for `percent`. */
|
|
878
|
+
sponsorWorkspaceKey: string;
|
|
879
|
+
sponsorWorkspaceName?: string | null;
|
|
880
|
+
memberWorkspaceKey: string;
|
|
881
|
+
memberWorkspaceName?: string | null;
|
|
882
|
+
mode: CreditPoolMode;
|
|
883
|
+
/** Credits per cycle for `fixed`; a share of the sponsor's plan credits, (0–100], for `percent`. */
|
|
866
884
|
value: number;
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
initialTransfer?: {
|
|
877
|
-
status: "done" | "failed";
|
|
878
|
-
credits: number;
|
|
879
|
-
error?: string;
|
|
885
|
+
status: CreditPoolMemberStatus;
|
|
886
|
+
/** What the member may spend this cycle. */
|
|
887
|
+
allowance: number;
|
|
888
|
+
used: number;
|
|
889
|
+
remaining: number;
|
|
890
|
+
cycle?: {
|
|
891
|
+
start: string;
|
|
892
|
+
end: string;
|
|
893
|
+
base: number;
|
|
880
894
|
};
|
|
881
895
|
note?: string;
|
|
882
896
|
requestedBy?: string;
|
|
@@ -887,57 +901,36 @@ interface CreditAllocation {
|
|
|
887
901
|
canceledBy?: string;
|
|
888
902
|
cancelReason?: string;
|
|
889
903
|
}
|
|
890
|
-
interface
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
/**
|
|
904
|
+
interface CreditPoolFormerMember {
|
|
905
|
+
memberWorkspaceKey: string;
|
|
906
|
+
memberWorkspaceName: string | null;
|
|
907
|
+
}
|
|
908
|
+
interface CreditPoolResponse {
|
|
909
|
+
/** Workspaces this one shares its credits with (active only), oldest first. */
|
|
910
|
+
members: CreditPoolMember[];
|
|
911
|
+
/** When this workspace spends another's credits: that membership. */
|
|
912
|
+
sponsor: CreditPoolMember | null;
|
|
913
|
+
/**
|
|
914
|
+
* Workspaces this one stopped sharing with. Its usage history still has
|
|
915
|
+
* their rows, so they are named there. Optional: older hosts omit it.
|
|
916
|
+
*/
|
|
917
|
+
formerMembers?: CreditPoolFormerMember[];
|
|
918
|
+
/** The viewer may add, change and remove members (an admin of the organization). */
|
|
896
919
|
canManage: boolean;
|
|
897
920
|
}
|
|
898
|
-
interface
|
|
899
|
-
|
|
900
|
-
mode:
|
|
921
|
+
interface AddCreditPoolMemberInput {
|
|
922
|
+
memberWorkspaceId: string;
|
|
923
|
+
mode: CreditPoolMode;
|
|
901
924
|
value: number;
|
|
902
|
-
recurring: boolean;
|
|
903
925
|
/** Why — required, at most 500 characters. */
|
|
904
926
|
note: string;
|
|
905
927
|
}
|
|
906
|
-
|
|
907
|
-
mode:
|
|
928
|
+
interface UpdateCreditPoolMemberInput {
|
|
929
|
+
mode: CreditPoolMode;
|
|
908
930
|
value: number;
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
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 {
|
|
931
|
+
}
|
|
932
|
+
/** A workspace credits can be shared with (another workspace of the organization). */
|
|
933
|
+
interface CreditPoolCandidate {
|
|
941
934
|
id: string;
|
|
942
935
|
name: string;
|
|
943
936
|
imageUrl?: string;
|
|
@@ -1078,26 +1071,19 @@ interface SettingsApiAdapter {
|
|
|
1078
1071
|
* Applies to members without their own override. Throws on error. */
|
|
1079
1072
|
setDefaultCreditLimit?: (limit: number | null) => Promise<void>;
|
|
1080
1073
|
/**
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1074
|
+
* Who this workspace shares its credits with, or whose it spends. When
|
|
1075
|
+
* omitted, Billing hides the "Shared credits" entry.
|
|
1083
1076
|
*/
|
|
1084
|
-
|
|
1085
|
-
/** Organization admins only.
|
|
1086
|
-
* billing `code` (`
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
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[]>;
|
|
1077
|
+
fetchCreditPool?: () => Promise<CreditPoolResponse>;
|
|
1078
|
+
/** Organization admins only. The member can spend at once. Rejects with the
|
|
1079
|
+
* billing `code` (`POOL_NOT_ALLOWED`, `SPONSOR_ON_FREE_PLAN`) on the error body. */
|
|
1080
|
+
addCreditPoolMember?: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
1081
|
+
/** Change a member's share; applies immediately. */
|
|
1082
|
+
updateCreditPoolMember?: (memberId: string, patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
1083
|
+
/** Stop a member spending this workspace's credits, immediately. */
|
|
1084
|
+
removeCreditPoolMember?: (memberId: string, reason: string) => Promise<CreditPoolMember>;
|
|
1085
|
+
/** Workspaces this one may share with: its organization's others. */
|
|
1086
|
+
fetchCreditPoolCandidates?: () => Promise<CreditPoolCandidate[]>;
|
|
1101
1087
|
fetchTokens: (params?: {
|
|
1102
1088
|
showRevoked?: boolean;
|
|
1103
1089
|
}) => Promise<ApiToken[]>;
|
|
@@ -1415,7 +1401,7 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
|
|
|
1415
1401
|
};
|
|
1416
1402
|
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
1417
1403
|
|
|
1418
|
-
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange,
|
|
1404
|
+
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showSharedCredits: showSharedCreditsProp, onShowSharedCreditsChange, }?: {
|
|
1419
1405
|
embedded?: boolean;
|
|
1420
1406
|
/** Controlled "plans" sub-view flag. When provided, the host (settings
|
|
1421
1407
|
* wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
|
|
@@ -1425,11 +1411,11 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
|
|
|
1425
1411
|
* Only reachable when `api.fetchMemberCreditLimits` exists. */
|
|
1426
1412
|
showPerUserLimits?: boolean;
|
|
1427
1413
|
onShowPerUserLimitsChange?: (open: boolean) => void;
|
|
1428
|
-
/** Controlled "
|
|
1429
|
-
* `showPlans`. Only reachable when `api.
|
|
1430
|
-
*
|
|
1431
|
-
|
|
1432
|
-
|
|
1414
|
+
/** Controlled "shared credits" sub-view flag; same contract as
|
|
1415
|
+
* `showPlans`. Only reachable when `api.fetchCreditPool` exists and the
|
|
1416
|
+
* workspace is in an organization. */
|
|
1417
|
+
showSharedCredits?: boolean;
|
|
1418
|
+
onShowSharedCreditsChange?: (open: boolean) => void;
|
|
1433
1419
|
}): react__default.JSX.Element;
|
|
1434
1420
|
|
|
1435
1421
|
/**
|
|
@@ -2037,19 +2023,22 @@ interface MemberCreditLimitModalProps {
|
|
|
2037
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;
|
|
2038
2024
|
|
|
2039
2025
|
/**
|
|
2040
|
-
*
|
|
2041
|
-
* test them.
|
|
2042
|
-
*
|
|
2026
|
+
* Shared credit pool rules and copy, kept out of the components so a host can
|
|
2027
|
+
* test them. A sponsor workspace keeps all of its credits and lets other
|
|
2028
|
+
* workspaces of its organization spend them, each up to an allowance per
|
|
2029
|
+
* billing cycle. The server (billing, behind unified-backend) is the
|
|
2030
|
+
* authority; these only stop an obviously bad request and say clearly what
|
|
2031
|
+
* happened.
|
|
2043
2032
|
*/
|
|
2044
|
-
declare const
|
|
2045
|
-
declare const
|
|
2033
|
+
declare const POOL_NOTE_MAX_LENGTH = 500;
|
|
2034
|
+
declare const REMOVE_REASON_MAX_LENGTH = 500;
|
|
2046
2035
|
/**
|
|
2047
|
-
* Whether Billing offers
|
|
2048
|
-
* workspace is in an organization (
|
|
2049
|
-
* organization's workspaces, so a personal workspace has
|
|
2036
|
+
* Whether Billing offers shared credits: the host implements them, and the
|
|
2037
|
+
* workspace is in an organization (credits are shared between one
|
|
2038
|
+
* organization's workspaces, so a personal workspace has no one to share with).
|
|
2050
2039
|
*/
|
|
2051
|
-
declare function
|
|
2052
|
-
type
|
|
2040
|
+
declare function canShowSharedCredits(api: Pick<SettingsApiAdapter, "fetchCreditPool">, workspace: Pick<SettingsWorkspaceCurrent, "organizationId"> | null | undefined, organization: Pick<SettingsOrganizationCurrent, "id"> | null | undefined): boolean;
|
|
2041
|
+
type PoolValueValidation = {
|
|
2053
2042
|
ok: true;
|
|
2054
2043
|
value: number;
|
|
2055
2044
|
} | {
|
|
@@ -2057,15 +2046,11 @@ type AllocationValueValidation = {
|
|
|
2057
2046
|
reason: string;
|
|
2058
2047
|
};
|
|
2059
2048
|
/** Digits and one `.` — what the value input keeps as the user types. */
|
|
2060
|
-
declare function
|
|
2061
|
-
/**
|
|
2062
|
-
|
|
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;
|
|
2049
|
+
declare function cleanPoolValueInput(raw: string): string;
|
|
2050
|
+
/** A share as billing accepts it: > 0, at most two decimals, and at most 100 for a percent. */
|
|
2051
|
+
declare function validatePoolValue(mode: CreditPoolMode, raw: string): PoolValueValidation;
|
|
2067
2052
|
/** A required note or reason: trimmed, non-empty, at most `max` characters. */
|
|
2068
|
-
declare function
|
|
2053
|
+
declare function validatePoolText(raw: string, max: number): {
|
|
2069
2054
|
ok: true;
|
|
2070
2055
|
value: string;
|
|
2071
2056
|
} | {
|
|
@@ -2073,103 +2058,102 @@ declare function validateAllocationText(raw: string, max: number): {
|
|
|
2073
2058
|
reason: string;
|
|
2074
2059
|
};
|
|
2075
2060
|
/** `fixed 500` → "500 credits"; `percent 20` → "20%". */
|
|
2076
|
-
declare function
|
|
2077
|
-
mode:
|
|
2061
|
+
declare function formatPoolSplit(split: {
|
|
2062
|
+
mode: CreditPoolMode;
|
|
2078
2063
|
value: number;
|
|
2079
2064
|
}): string;
|
|
2080
|
-
/** "
|
|
2081
|
-
declare function
|
|
2082
|
-
/** "500 credits every renewal", "20% of each renewal", "500 credits once". */
|
|
2083
|
-
declare function describeAllocation(allocation: Pick<CreditAllocation, "mode" | "value" | "recurring">): string;
|
|
2065
|
+
/** "20% · 200 credits this cycle", or "200 credits this cycle" for a fixed share. */
|
|
2066
|
+
declare function describeAllowance(member: Pick<CreditPoolMember, "mode" | "value" | "allowance">): string;
|
|
2084
2067
|
/** The other workspace's name, or a stand-in when it could not be resolved. */
|
|
2085
|
-
declare function
|
|
2068
|
+
declare function poolWorkspaceName(name: string | null | undefined): string;
|
|
2069
|
+
/** The member's Billing banner: "Credits shared by Agency: 80 of 200 left this cycle". */
|
|
2070
|
+
declare function sharedPoolBannerText(pool: Pick<SharedPoolBalance, "sponsorName" | "allowance" | "remaining">): string;
|
|
2071
|
+
interface CreditsMeter {
|
|
2072
|
+
/** Credits spent; `null` when there is not enough data to say. */
|
|
2073
|
+
used: number | null;
|
|
2074
|
+
/** Credits left; `null` when the balance is unknown. */
|
|
2075
|
+
remaining: number | null;
|
|
2076
|
+
/** Percentage of the total spent, 0–100; fills the bar. */
|
|
2077
|
+
progressPct: number;
|
|
2078
|
+
/** `100 - progressPct`. */
|
|
2079
|
+
remainingPct: number;
|
|
2080
|
+
}
|
|
2086
2081
|
/**
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2082
|
+
* The Billing overview's "Credits used" meter. A workspace spending shared
|
|
2083
|
+
* credits is measured against its allowance this cycle: its balance is the
|
|
2084
|
+
* sponsor's, so subtracting it from this workspace's own unexpired credits
|
|
2085
|
+
* says nothing. Otherwise used = own unexpired credits − balance.
|
|
2089
2086
|
*/
|
|
2090
|
-
declare function
|
|
2091
|
-
|
|
2092
|
-
|
|
2087
|
+
declare function creditsMeter({ availableCredits, totalCredits, sharedPool, }: {
|
|
2088
|
+
availableCredits: number | null;
|
|
2089
|
+
totalCredits: number | null;
|
|
2090
|
+
sharedPool: Pick<SharedPoolBalance, "allowance" | "used" | "remaining"> | null;
|
|
2091
|
+
}): CreditsMeter;
|
|
2093
2092
|
/**
|
|
2094
|
-
*
|
|
2095
|
-
*
|
|
2096
|
-
*
|
|
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.
|
|
2093
|
+
* The workspace a usage row was spent by, when it is not `currentWorkspaceId`:
|
|
2094
|
+
* a member's spending from this workspace's shared credits. `null` for this
|
|
2095
|
+
* workspace's own usage.
|
|
2103
2096
|
*/
|
|
2104
|
-
declare function
|
|
2105
|
-
allocation?: Pick<CreditAllocation, "targetPlanChanged"> | null;
|
|
2106
|
-
}, targetName: string): string | null;
|
|
2097
|
+
declare function usedByWorkspaceKey(log: Pick<UsageHistoryItem, "meta">, currentWorkspaceId: string | null | undefined): string | null;
|
|
2107
2098
|
/**
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2099
|
+
* Names for the `usedBy` workspaces in this workspace's usage, keyed by the
|
|
2100
|
+
* lower-cased key: its current members and the ones it stopped sharing with,
|
|
2101
|
+
* whose rows stay in its history.
|
|
2110
2102
|
*/
|
|
2111
|
-
declare function
|
|
2112
|
-
declare const
|
|
2113
|
-
type
|
|
2114
|
-
/** The billing
|
|
2115
|
-
declare function
|
|
2116
|
-
code:
|
|
2103
|
+
declare function usedByNamesFrom(pool: Pick<CreditPoolResponse, "members" | "formerMembers"> | null | undefined): Record<string, string>;
|
|
2104
|
+
declare const POOL_ERROR_CODES: readonly ["SPONSOR_ON_FREE_PLAN", "POOL_NOT_ALLOWED"];
|
|
2105
|
+
type PoolErrorCode = (typeof POOL_ERROR_CODES)[number];
|
|
2106
|
+
/** The billing pool error in a failure: its code, details and server message. */
|
|
2107
|
+
declare function findPoolError(failure: unknown): {
|
|
2108
|
+
code: PoolErrorCode;
|
|
2117
2109
|
details: Record<string, unknown>;
|
|
2118
2110
|
message: string | null;
|
|
2119
2111
|
} | null;
|
|
2120
2112
|
/**
|
|
2121
|
-
* A plain sentence for a billing
|
|
2122
|
-
*
|
|
2113
|
+
* A plain sentence for a billing pool refusal, or `null` when the failure is
|
|
2114
|
+
* not one (the caller then falls back to its generic message).
|
|
2123
2115
|
*/
|
|
2124
|
-
declare function
|
|
2116
|
+
declare function poolErrorMessage(failure: unknown): string | null;
|
|
2125
2117
|
|
|
2126
2118
|
/**
|
|
2127
|
-
* Billing sub-view:
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2119
|
+
* Billing sub-view: the workspaces that may spend this workspace's credits,
|
|
2120
|
+
* each up to an allowance per billing cycle, or the workspace whose credits
|
|
2121
|
+
* this one spends. Changes are for organization admins (`canManage` from the
|
|
2122
|
+
* server); everyone else who reaches Billing reads.
|
|
2130
2123
|
*/
|
|
2131
|
-
declare function
|
|
2124
|
+
declare function SharedCreditsView(): react.JSX.Element;
|
|
2132
2125
|
|
|
2133
|
-
type
|
|
2134
|
-
kind: "
|
|
2135
|
-
/** Workspaces credits can
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
balance: number | null;
|
|
2139
|
-
onSave: (input: CreateCreditAllocationInput) => Promise<CreditAllocation>;
|
|
2126
|
+
type CreditPoolMemberModalProps = {
|
|
2127
|
+
kind: "add";
|
|
2128
|
+
/** Workspaces credits can be shared with. */
|
|
2129
|
+
candidates: CreditPoolCandidate[];
|
|
2130
|
+
onSave: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2140
2131
|
onClose: () => void;
|
|
2141
|
-
/** After a save
|
|
2132
|
+
/** After a save; the parent refetches. */
|
|
2142
2133
|
onSaved: () => void;
|
|
2143
2134
|
} | {
|
|
2144
2135
|
kind: "edit";
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
onSave: (patch:
|
|
2136
|
+
member: CreditPoolMember;
|
|
2137
|
+
memberName: string;
|
|
2138
|
+
onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2148
2139
|
onClose: () => void;
|
|
2149
2140
|
onSaved: () => void;
|
|
2150
2141
|
};
|
|
2151
|
-
/**
|
|
2152
|
-
declare function
|
|
2142
|
+
/** Share credits with a workspace, or change an active member's share. */
|
|
2143
|
+
declare function CreditPoolMemberModal(props: CreditPoolMemberModalProps): react.JSX.Element;
|
|
2153
2144
|
|
|
2154
|
-
interface
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2145
|
+
interface RemovePoolMemberModalProps {
|
|
2146
|
+
member: CreditPoolMember;
|
|
2147
|
+
memberName: string;
|
|
2148
|
+
/** This workspace's name, the one sharing its credits. */
|
|
2149
|
+
sponsorName: string;
|
|
2150
|
+
onRemove: (reason: string) => Promise<CreditPoolMember>;
|
|
2158
2151
|
onClose: () => void;
|
|
2159
|
-
/**
|
|
2160
|
-
|
|
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;
|
|
2152
|
+
/** After the member was removed; the parent refetches. */
|
|
2153
|
+
onRemoved: () => void;
|
|
2166
2154
|
}
|
|
2167
|
-
/**
|
|
2168
|
-
|
|
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;
|
|
2155
|
+
/** Confirm stopping a member spending this workspace's credits, with a reason. */
|
|
2156
|
+
declare function RemovePoolMemberModal({ member, memberName, sponsorName, onRemove, onClose, onRemoved, }: RemovePoolMemberModalProps): react.JSX.Element;
|
|
2173
2157
|
|
|
2174
2158
|
declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
2175
2159
|
adapters: SettingsAdapters;
|
|
@@ -2182,4 +2166,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
2182
2166
|
*/
|
|
2183
2167
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
2184
2168
|
|
|
2185
|
-
export {
|
|
2169
|
+
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, poolErrorMessage, poolWorkspaceName, resolveSettingsTabFromPath, roundCredits, sharedPoolBannerText, useSettingsAdapters, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|