@streamoid/settings 0.10.0 → 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 +182 -184
- package/dist/index.d.ts +182 -184
- package/dist/index.js +439 -514
- package/dist/index.mjs +442 -517
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -411,6 +411,13 @@ interface OrganizationWorkspaceItem {
|
|
|
411
411
|
/** "inactive" workspaces are listed to org admins but can't be joined. */
|
|
412
412
|
status?: string;
|
|
413
413
|
}
|
|
414
|
+
/** A shared organization of the viewer's company that they aren't in yet. */
|
|
415
|
+
interface SettingsOrganizationJoinableItem {
|
|
416
|
+
_id: string;
|
|
417
|
+
name: string;
|
|
418
|
+
imageUrl?: string;
|
|
419
|
+
domain?: string | null;
|
|
420
|
+
}
|
|
414
421
|
/** A shared workspace in the organization that the viewer isn't in yet. */
|
|
415
422
|
interface OrganizationJoinableWorkspace {
|
|
416
423
|
_id: string;
|
|
@@ -466,6 +473,13 @@ interface SettingsOrganizationAdapter {
|
|
|
466
473
|
* company admins, public email users and the Streamoid team. Without it, or
|
|
467
474
|
* without `create`, the button never shows. */
|
|
468
475
|
getCreateOptions?: () => Promise<SettingsOrganizationCreateOptions>;
|
|
476
|
+
/** Optional: the viewer's company's shared organizations they are not in
|
|
477
|
+
* yet — the same ones a new user is offered at sign-up. Listed under
|
|
478
|
+
* "Other organizations" with a Join button (with `join`). */
|
|
479
|
+
listJoinable?: () => Promise<SettingsOrganizationJoinableItem[]>;
|
|
480
|
+
/** Optional: join one of `listJoinable` as a member. No workspace comes
|
|
481
|
+
* with it; they open the org and pick or create one. */
|
|
482
|
+
join?: (id: string) => Promise<void>;
|
|
469
483
|
update: (id: string, patch: {
|
|
470
484
|
name?: string;
|
|
471
485
|
imageFile?: File | null;
|
|
@@ -644,8 +658,25 @@ interface MemberPermissionsPayload {
|
|
|
644
658
|
}
|
|
645
659
|
/** `SettingsWorkspaceCurrent.usage`; re-exported from `@streamoid/ui`. */
|
|
646
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
|
+
}
|
|
647
677
|
interface AvailableCreditsResponse {
|
|
648
678
|
availableCredits: number;
|
|
679
|
+
sharedPool?: SharedPoolBalance;
|
|
649
680
|
}
|
|
650
681
|
interface SubscriptionPlan {
|
|
651
682
|
id: string;
|
|
@@ -702,6 +733,9 @@ interface UsageHistoryItem {
|
|
|
702
733
|
meta?: {
|
|
703
734
|
info?: string;
|
|
704
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;
|
|
705
739
|
};
|
|
706
740
|
service?: {
|
|
707
741
|
serviceGroupName: string;
|
|
@@ -832,37 +866,31 @@ interface MemberCreditLimitsResponse {
|
|
|
832
866
|
/** Only members with an override or with usage; the rest follow the default. */
|
|
833
867
|
users: MemberCreditLimit[];
|
|
834
868
|
}
|
|
835
|
-
type
|
|
836
|
-
type
|
|
869
|
+
type CreditPoolMode = "fixed" | "percent";
|
|
870
|
+
type CreditPoolMemberStatus = "active" | "canceled";
|
|
837
871
|
/**
|
|
838
|
-
* A workspace
|
|
839
|
-
*
|
|
840
|
-
*
|
|
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`).
|
|
841
875
|
*/
|
|
842
|
-
interface
|
|
876
|
+
interface CreditPoolMember {
|
|
843
877
|
_id: string;
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
mode: CreditAllocationMode;
|
|
851
|
-
/** 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`. */
|
|
852
884
|
value: number;
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
initialTransfer?: {
|
|
863
|
-
status: "done" | "failed";
|
|
864
|
-
credits: number;
|
|
865
|
-
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;
|
|
866
894
|
};
|
|
867
895
|
note?: string;
|
|
868
896
|
requestedBy?: string;
|
|
@@ -873,57 +901,36 @@ interface CreditAllocation {
|
|
|
873
901
|
canceledBy?: string;
|
|
874
902
|
cancelReason?: string;
|
|
875
903
|
}
|
|
876
|
-
interface
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
/**
|
|
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). */
|
|
882
919
|
canManage: boolean;
|
|
883
920
|
}
|
|
884
|
-
interface
|
|
885
|
-
|
|
886
|
-
mode:
|
|
921
|
+
interface AddCreditPoolMemberInput {
|
|
922
|
+
memberWorkspaceId: string;
|
|
923
|
+
mode: CreditPoolMode;
|
|
887
924
|
value: number;
|
|
888
|
-
recurring: boolean;
|
|
889
925
|
/** Why — required, at most 500 characters. */
|
|
890
926
|
note: string;
|
|
891
927
|
}
|
|
892
|
-
|
|
893
|
-
mode:
|
|
928
|
+
interface UpdateCreditPoolMemberInput {
|
|
929
|
+
mode: CreditPoolMode;
|
|
894
930
|
value: number;
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
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 {
|
|
931
|
+
}
|
|
932
|
+
/** A workspace credits can be shared with (another workspace of the organization). */
|
|
933
|
+
interface CreditPoolCandidate {
|
|
927
934
|
id: string;
|
|
928
935
|
name: string;
|
|
929
936
|
imageUrl?: string;
|
|
@@ -1064,26 +1071,19 @@ interface SettingsApiAdapter {
|
|
|
1064
1071
|
* Applies to members without their own override. Throws on error. */
|
|
1065
1072
|
setDefaultCreditLimit?: (limit: number | null) => Promise<void>;
|
|
1066
1073
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1074
|
+
* Who this workspace shares its credits with, or whose it spends. When
|
|
1075
|
+
* omitted, Billing hides the "Shared credits" entry.
|
|
1069
1076
|
*/
|
|
1070
|
-
|
|
1071
|
-
/** Organization admins only.
|
|
1072
|
-
* billing `code` (`
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
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[]>;
|
|
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[]>;
|
|
1087
1087
|
fetchTokens: (params?: {
|
|
1088
1088
|
showRevoked?: boolean;
|
|
1089
1089
|
}) => Promise<ApiToken[]>;
|
|
@@ -1401,7 +1401,7 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
|
|
|
1401
1401
|
};
|
|
1402
1402
|
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
1403
1403
|
|
|
1404
|
-
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange,
|
|
1404
|
+
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showSharedCredits: showSharedCreditsProp, onShowSharedCreditsChange, }?: {
|
|
1405
1405
|
embedded?: boolean;
|
|
1406
1406
|
/** Controlled "plans" sub-view flag. When provided, the host (settings
|
|
1407
1407
|
* wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
|
|
@@ -1411,11 +1411,11 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
|
|
|
1411
1411
|
* Only reachable when `api.fetchMemberCreditLimits` exists. */
|
|
1412
1412
|
showPerUserLimits?: boolean;
|
|
1413
1413
|
onShowPerUserLimitsChange?: (open: boolean) => void;
|
|
1414
|
-
/** Controlled "
|
|
1415
|
-
* `showPlans`. Only reachable when `api.
|
|
1416
|
-
*
|
|
1417
|
-
|
|
1418
|
-
|
|
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;
|
|
1419
1419
|
}): react__default.JSX.Element;
|
|
1420
1420
|
|
|
1421
1421
|
/**
|
|
@@ -2023,19 +2023,22 @@ interface MemberCreditLimitModalProps {
|
|
|
2023
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;
|
|
2024
2024
|
|
|
2025
2025
|
/**
|
|
2026
|
-
*
|
|
2027
|
-
* test them.
|
|
2028
|
-
*
|
|
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.
|
|
2029
2032
|
*/
|
|
2030
|
-
declare const
|
|
2031
|
-
declare const
|
|
2033
|
+
declare const POOL_NOTE_MAX_LENGTH = 500;
|
|
2034
|
+
declare const REMOVE_REASON_MAX_LENGTH = 500;
|
|
2032
2035
|
/**
|
|
2033
|
-
* Whether Billing offers
|
|
2034
|
-
* workspace is in an organization (
|
|
2035
|
-
* 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).
|
|
2036
2039
|
*/
|
|
2037
|
-
declare function
|
|
2038
|
-
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 = {
|
|
2039
2042
|
ok: true;
|
|
2040
2043
|
value: number;
|
|
2041
2044
|
} | {
|
|
@@ -2043,15 +2046,11 @@ type AllocationValueValidation = {
|
|
|
2043
2046
|
reason: string;
|
|
2044
2047
|
};
|
|
2045
2048
|
/** Digits and one `.` — what the value input keeps as the user types. */
|
|
2046
|
-
declare function
|
|
2047
|
-
/**
|
|
2048
|
-
|
|
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;
|
|
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;
|
|
2053
2052
|
/** A required note or reason: trimmed, non-empty, at most `max` characters. */
|
|
2054
|
-
declare function
|
|
2053
|
+
declare function validatePoolText(raw: string, max: number): {
|
|
2055
2054
|
ok: true;
|
|
2056
2055
|
value: string;
|
|
2057
2056
|
} | {
|
|
@@ -2059,103 +2058,102 @@ declare function validateAllocationText(raw: string, max: number): {
|
|
|
2059
2058
|
reason: string;
|
|
2060
2059
|
};
|
|
2061
2060
|
/** `fixed 500` → "500 credits"; `percent 20` → "20%". */
|
|
2062
|
-
declare function
|
|
2063
|
-
mode:
|
|
2061
|
+
declare function formatPoolSplit(split: {
|
|
2062
|
+
mode: CreditPoolMode;
|
|
2064
2063
|
value: number;
|
|
2065
2064
|
}): string;
|
|
2066
|
-
/** "
|
|
2067
|
-
declare function
|
|
2068
|
-
/** "500 credits every renewal", "20% of each renewal", "500 credits once". */
|
|
2069
|
-
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;
|
|
2070
2067
|
/** The other workspace's name, or a stand-in when it could not be resolved. */
|
|
2071
|
-
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
|
+
}
|
|
2072
2081
|
/**
|
|
2073
|
-
*
|
|
2074
|
-
*
|
|
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.
|
|
2075
2086
|
*/
|
|
2076
|
-
declare function
|
|
2077
|
-
|
|
2078
|
-
|
|
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;
|
|
2079
2092
|
/**
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
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.
|
|
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.
|
|
2089
2096
|
*/
|
|
2090
|
-
declare function
|
|
2091
|
-
allocation?: Pick<CreditAllocation, "targetPlanChanged"> | null;
|
|
2092
|
-
}, targetName: string): string | null;
|
|
2097
|
+
declare function usedByWorkspaceKey(log: Pick<UsageHistoryItem, "meta">, currentWorkspaceId: string | null | undefined): string | null;
|
|
2093
2098
|
/**
|
|
2094
|
-
*
|
|
2095
|
-
*
|
|
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.
|
|
2096
2102
|
*/
|
|
2097
|
-
declare function
|
|
2098
|
-
declare const
|
|
2099
|
-
type
|
|
2100
|
-
/** The billing
|
|
2101
|
-
declare function
|
|
2102
|
-
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;
|
|
2103
2109
|
details: Record<string, unknown>;
|
|
2104
2110
|
message: string | null;
|
|
2105
2111
|
} | null;
|
|
2106
2112
|
/**
|
|
2107
|
-
* A plain sentence for a billing
|
|
2108
|
-
*
|
|
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).
|
|
2109
2115
|
*/
|
|
2110
|
-
declare function
|
|
2116
|
+
declare function poolErrorMessage(failure: unknown): string | null;
|
|
2111
2117
|
|
|
2112
2118
|
/**
|
|
2113
|
-
* Billing sub-view:
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
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.
|
|
2116
2123
|
*/
|
|
2117
|
-
declare function
|
|
2124
|
+
declare function SharedCreditsView(): react.JSX.Element;
|
|
2118
2125
|
|
|
2119
|
-
type
|
|
2120
|
-
kind: "
|
|
2121
|
-
/** Workspaces credits can
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
balance: number | null;
|
|
2125
|
-
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>;
|
|
2126
2131
|
onClose: () => void;
|
|
2127
|
-
/** After a save
|
|
2132
|
+
/** After a save; the parent refetches. */
|
|
2128
2133
|
onSaved: () => void;
|
|
2129
2134
|
} | {
|
|
2130
2135
|
kind: "edit";
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
onSave: (patch:
|
|
2136
|
+
member: CreditPoolMember;
|
|
2137
|
+
memberName: string;
|
|
2138
|
+
onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2134
2139
|
onClose: () => void;
|
|
2135
2140
|
onSaved: () => void;
|
|
2136
2141
|
};
|
|
2137
|
-
/**
|
|
2138
|
-
declare function
|
|
2142
|
+
/** Share credits with a workspace, or change an active member's share. */
|
|
2143
|
+
declare function CreditPoolMemberModal(props: CreditPoolMemberModalProps): react.JSX.Element;
|
|
2139
2144
|
|
|
2140
|
-
interface
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
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>;
|
|
2144
2151
|
onClose: () => void;
|
|
2145
|
-
/**
|
|
2146
|
-
|
|
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
|
+
/** After the member was removed; the parent refetches. */
|
|
2153
|
+
onRemoved: () => void;
|
|
2152
2154
|
}
|
|
2153
|
-
/**
|
|
2154
|
-
|
|
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;
|
|
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;
|
|
2159
2157
|
|
|
2160
2158
|
declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
2161
2159
|
adapters: SettingsAdapters;
|
|
@@ -2168,4 +2166,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
2168
2166
|
*/
|
|
2169
2167
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
2170
2168
|
|
|
2171
|
-
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 };
|