@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/README.md +7 -5
- package/dist/index.d.mts +175 -184
- package/dist/index.d.ts +175 -184
- package/dist/index.js +373 -514
- package/dist/index.mjs +373 -514
- 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,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
|
|
850
|
-
type
|
|
871
|
+
type CreditPoolMode = "fixed" | "percent";
|
|
872
|
+
type CreditPoolMemberStatus = "active" | "canceled";
|
|
851
873
|
/**
|
|
852
|
-
* A workspace
|
|
853
|
-
*
|
|
854
|
-
*
|
|
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
|
|
878
|
+
interface CreditPoolMember {
|
|
857
879
|
_id: string;
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
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
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
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
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
/**
|
|
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
|
|
899
|
-
|
|
900
|
-
mode:
|
|
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
|
-
|
|
907
|
-
mode:
|
|
930
|
+
interface UpdateCreditPoolMemberInput {
|
|
931
|
+
mode: CreditPoolMode;
|
|
908
932
|
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 {
|
|
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
|
-
*
|
|
1082
|
-
*
|
|
1076
|
+
* Who this workspace shares its credits with, or whose it spends. When
|
|
1077
|
+
* omitted, Billing hides the "Shared credits" entry.
|
|
1083
1078
|
*/
|
|
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[]>;
|
|
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,
|
|
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 "
|
|
1429
|
-
* `showPlans`. Only reachable when `api.
|
|
1430
|
-
*
|
|
1431
|
-
|
|
1432
|
-
|
|
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
|
-
*
|
|
2041
|
-
* test them.
|
|
2042
|
-
*
|
|
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
|
|
2045
|
-
declare const
|
|
2035
|
+
declare const POOL_NOTE_MAX_LENGTH = 500;
|
|
2036
|
+
declare const REMOVE_REASON_MAX_LENGTH = 500;
|
|
2046
2037
|
/**
|
|
2047
|
-
* Whether Billing offers
|
|
2048
|
-
* workspace is in an organization (
|
|
2049
|
-
* organization's workspaces, so a personal workspace has
|
|
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
|
|
2052
|
-
type
|
|
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
|
|
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;
|
|
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
|
|
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
|
|
2077
|
-
mode:
|
|
2063
|
+
declare function formatPoolSplit(split: {
|
|
2064
|
+
mode: CreditPoolMode;
|
|
2078
2065
|
value: number;
|
|
2079
2066
|
}): 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;
|
|
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
|
|
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
|
-
*
|
|
2088
|
-
*
|
|
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
|
|
2091
|
-
|
|
2092
|
-
|
|
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
|
-
*
|
|
2095
|
-
*
|
|
2096
|
-
*
|
|
2097
|
-
*
|
|
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
|
|
2105
|
-
|
|
2106
|
-
|
|
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
|
|
2109
|
-
*
|
|
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
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
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
|
|
2122
|
-
*
|
|
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
|
|
2123
|
+
declare function poolErrorMessage(failure: unknown): string | null;
|
|
2125
2124
|
|
|
2126
2125
|
/**
|
|
2127
|
-
* Billing sub-view:
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
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
|
|
2131
|
+
declare function SharedCreditsView(): react.JSX.Element;
|
|
2132
2132
|
|
|
2133
|
-
type
|
|
2134
|
-
kind: "
|
|
2135
|
-
/** Workspaces credits can
|
|
2136
|
-
|
|
2137
|
-
|
|
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
|
|
2139
|
+
/** After a save; the parent refetches. */
|
|
2142
2140
|
onSaved: () => void;
|
|
2143
2141
|
} | {
|
|
2144
2142
|
kind: "edit";
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
onSave: (patch:
|
|
2143
|
+
member: CreditPoolMember;
|
|
2144
|
+
memberName: string;
|
|
2145
|
+
onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2148
2146
|
onClose: () => void;
|
|
2149
2147
|
onSaved: () => void;
|
|
2150
2148
|
};
|
|
2151
|
-
/**
|
|
2152
|
-
declare function
|
|
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
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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 };
|