@streamoid/settings 0.21.0 → 0.22.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 +8 -0
- package/dist/index.d.mts +151 -12
- package/dist/index.d.ts +151 -12
- package/dist/index.js +353 -42
- package/dist/index.mjs +353 -42
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -175,6 +175,14 @@ Billing hides an entry whose adapter method is absent:
|
|
|
175
175
|
A member's balance (`fetchAvailableCredits`) carries `sharedPool`, which
|
|
176
176
|
Billing shows as a banner; usage rows with `meta.usedBy` get a Workspace
|
|
177
177
|
column, named from the pool's `members` and `formerMembers`.
|
|
178
|
+
`setCreditPoolSelfShare` and `removeCreditPoolSelfShare` (mirroring
|
|
179
|
+
`PUT|DELETE /workspace/:id/credit-pool/self`) add a "This workspace" row:
|
|
180
|
+
the share the sponsor keeps for itself. A percent self share counts in the
|
|
181
|
+
same 100% as the members' percent shares (`self`, `allocatedPercent`,
|
|
182
|
+
`unallocatedPercent` on the pool response). Without them the row is hidden,
|
|
183
|
+
unless billing already returns a `self` share, which is then shown read-only.
|
|
184
|
+
A sponsor's balance may carry `sponsorShare: { allowance, used, remaining }`;
|
|
185
|
+
Billing then measures "Credits used" against it and shows what is left of it.
|
|
178
186
|
|
|
179
187
|
## Status
|
|
180
188
|
|
package/dist/index.d.mts
CHANGED
|
@@ -680,9 +680,22 @@ interface SharedPoolBalance {
|
|
|
680
680
|
/** The member's own credits, spent before the pool's. */
|
|
681
681
|
ownCredits?: number;
|
|
682
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* The share a sponsor keeps for itself this cycle (`CreditPoolSelfShare`, as
|
|
685
|
+
* the balance carries it). Present only on a sponsor's balance with a self
|
|
686
|
+
* share: its `availableCredits` are then never more than `remaining`.
|
|
687
|
+
*/
|
|
688
|
+
interface SponsorShareBalance {
|
|
689
|
+
/** What this workspace may spend itself this cycle. */
|
|
690
|
+
allowance: number;
|
|
691
|
+
used: number;
|
|
692
|
+
remaining: number;
|
|
693
|
+
}
|
|
683
694
|
interface AvailableCreditsResponse {
|
|
684
695
|
availableCredits: number;
|
|
685
696
|
sharedPool?: SharedPoolBalance;
|
|
697
|
+
/** A sponsor's own share; optional, older billing omits it. */
|
|
698
|
+
sponsorShare?: SponsorShareBalance;
|
|
686
699
|
}
|
|
687
700
|
interface SubscriptionPlan {
|
|
688
701
|
id: string;
|
|
@@ -976,11 +989,41 @@ interface CreditPoolFormerMember {
|
|
|
976
989
|
memberWorkspaceKey: string;
|
|
977
990
|
memberWorkspaceName: string | null;
|
|
978
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* The share of its own credits a sponsor keeps for itself each billing cycle.
|
|
994
|
+
* A percent share counts in the same 100% as its members' percent shares; the
|
|
995
|
+
* rest stays unallocated for workspaces it may share with later.
|
|
996
|
+
*/
|
|
997
|
+
interface CreditPoolSelfShare {
|
|
998
|
+
mode: CreditPoolMode;
|
|
999
|
+
/** Credits per cycle for `fixed`; a share of the workspace's plan credits, (0–100], for `percent`. */
|
|
1000
|
+
value: number;
|
|
1001
|
+
/** What this workspace may spend itself this cycle. */
|
|
1002
|
+
allowance: number;
|
|
1003
|
+
used: number;
|
|
1004
|
+
remaining: number;
|
|
1005
|
+
cycle?: {
|
|
1006
|
+
start: string;
|
|
1007
|
+
end: string;
|
|
1008
|
+
};
|
|
1009
|
+
/** When the share stops on its own (ISO); null or absent when it runs until removed. */
|
|
1010
|
+
endsAt?: string | null;
|
|
1011
|
+
note?: string;
|
|
1012
|
+
}
|
|
979
1013
|
interface CreditPoolResponse {
|
|
980
1014
|
/** Workspaces this one shares its credits with (active only), oldest first. */
|
|
981
1015
|
members: CreditPoolMember[];
|
|
982
1016
|
/** When this workspace spends another's credits: that membership. */
|
|
983
1017
|
sponsor: CreditPoolMember | null;
|
|
1018
|
+
/**
|
|
1019
|
+
* The share this workspace keeps for itself, or null when it may spend its
|
|
1020
|
+
* whole balance. Optional: older hosts omit it.
|
|
1021
|
+
*/
|
|
1022
|
+
self?: CreditPoolSelfShare | null;
|
|
1023
|
+
/** This workspace's percent share plus its members' percent shares (0–100). Optional: older hosts omit it. */
|
|
1024
|
+
allocatedPercent?: number;
|
|
1025
|
+
/** `100 - allocatedPercent`. Optional: older hosts omit it. */
|
|
1026
|
+
unallocatedPercent?: number;
|
|
984
1027
|
/**
|
|
985
1028
|
* Workspaces this one stopped sharing with. Its usage history still has
|
|
986
1029
|
* their rows, so they are named there. Optional: older hosts omit it.
|
|
@@ -1004,6 +1047,14 @@ interface UpdateCreditPoolMemberInput {
|
|
|
1004
1047
|
/** A new end date (ISO, in the future), or null to clear it; absent leaves it as it is. */
|
|
1005
1048
|
endsAt?: string | null;
|
|
1006
1049
|
}
|
|
1050
|
+
interface SetCreditPoolSelfShareInput {
|
|
1051
|
+
mode: CreditPoolMode;
|
|
1052
|
+
value: number;
|
|
1053
|
+
/** Why — required, at most 500 characters. */
|
|
1054
|
+
note: string;
|
|
1055
|
+
/** When the share stops on its own (an ISO date in the future); null or absent for never. */
|
|
1056
|
+
endsAt?: string | null;
|
|
1057
|
+
}
|
|
1007
1058
|
/** A workspace credits can be shared with (another workspace of the organization). */
|
|
1008
1059
|
interface CreditPoolCandidate {
|
|
1009
1060
|
id: string;
|
|
@@ -1189,6 +1240,15 @@ interface SettingsApiAdapter {
|
|
|
1189
1240
|
removeCreditPoolMember?: (memberId: string, reason: string) => Promise<CreditPoolMember>;
|
|
1190
1241
|
/** Workspaces this one may share with: its organization's others. */
|
|
1191
1242
|
fetchCreditPoolCandidates?: () => Promise<CreditPoolCandidate[]>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Set or change the share this workspace keeps for itself
|
|
1245
|
+
* (`PUT /workspace/:id/credit-pool/self`). Organization admins only. Rejects
|
|
1246
|
+
* like `addCreditPoolMember`. When omitted, Shared credits has no
|
|
1247
|
+
* "This workspace" controls.
|
|
1248
|
+
*/
|
|
1249
|
+
setCreditPoolSelfShare?: (input: SetCreditPoolSelfShareInput) => Promise<unknown>;
|
|
1250
|
+
/** Remove the self share: this workspace may spend its whole balance again. */
|
|
1251
|
+
removeCreditPoolSelfShare?: () => Promise<unknown>;
|
|
1192
1252
|
fetchTokens: (params?: {
|
|
1193
1253
|
showRevoked?: boolean;
|
|
1194
1254
|
}) => Promise<ApiToken[]>;
|
|
@@ -1707,6 +1767,24 @@ declare const BILLING_TABLE_PAGER_STYLE: CSSProperties;
|
|
|
1707
1767
|
*/
|
|
1708
1768
|
declare function productsForCountry(products: readonly BillingProduct[], country: string | null | undefined): BillingProduct[];
|
|
1709
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* What an Invoice history row can download, decided by its `transactionId`:
|
|
1772
|
+
*
|
|
1773
|
+
* - `in_…` — a Stripe invoice; billing returns its `invoice_pdf`.
|
|
1774
|
+
* - `pi_…` — a one-off payment; billing returns the receipt PDF it generated.
|
|
1775
|
+
* - anything else — `null`. Billing's own `T-…` / `TG-…` ids (rollovers,
|
|
1776
|
+
* bonuses, offline and manual credits) have no invoice or receipt behind
|
|
1777
|
+
* them, and asking billing for one fails.
|
|
1778
|
+
*
|
|
1779
|
+
* One rule so the row's Download cell, its click and the export agree.
|
|
1780
|
+
*/
|
|
1781
|
+
type InvoiceDownloadKind = "invoice" | "receipt";
|
|
1782
|
+
declare function invoiceDownloadKind(item: Pick<UsageHistoryItem, "transactionId">): InvoiceDownloadKind | null;
|
|
1783
|
+
/** Shown when a row has nothing to download. */
|
|
1784
|
+
declare const INVOICE_NOT_AVAILABLE_MESSAGE = "There's no invoice for this order. Rolled-over, bonus and manually added credits don't have one.";
|
|
1785
|
+
/** Leads the toast when billing could not hand back a PDF for a row that should have one. */
|
|
1786
|
+
declare const INVOICE_DOWNLOAD_FAILED_MESSAGE = "Couldn't download this invoice.";
|
|
1787
|
+
|
|
1710
1788
|
/** Rows on one page of Billing's Usage logs table. */
|
|
1711
1789
|
declare const USAGE_LOGS_PAGE_SIZE = 50;
|
|
1712
1790
|
/** Rows per request while exporting: billing's own `limit` ceiling. */
|
|
@@ -2648,6 +2726,30 @@ declare function validatePoolText(raw: string, max: number): {
|
|
|
2648
2726
|
ok: false;
|
|
2649
2727
|
reason: string;
|
|
2650
2728
|
};
|
|
2729
|
+
/**
|
|
2730
|
+
* The percent of this workspace's plan credits already given out: its own
|
|
2731
|
+
* percent share plus its members' percent shares. Fixed shares don't count.
|
|
2732
|
+
* `exclude` leaves out the share being edited (a member's `_id`, or `"self"`),
|
|
2733
|
+
* so its new value is checked against the rest.
|
|
2734
|
+
*/
|
|
2735
|
+
declare function poolAllocatedPercent(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined, exclude?: string): number;
|
|
2736
|
+
/** What is left of the 100%: `100 - poolAllocatedPercent`, never below 0. */
|
|
2737
|
+
declare function poolUnallocatedPercent(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined, exclude?: string): number;
|
|
2738
|
+
/**
|
|
2739
|
+
* Whether a percent share fits in what is unallocated: the self share and the
|
|
2740
|
+
* members' percent shares together are at most 100. A fixed share always fits.
|
|
2741
|
+
*/
|
|
2742
|
+
declare function checkPoolPercentTotal(split: {
|
|
2743
|
+
mode: CreditPoolMode;
|
|
2744
|
+
value: number;
|
|
2745
|
+
}, unallocatedPercent: number): {
|
|
2746
|
+
ok: true;
|
|
2747
|
+
} | {
|
|
2748
|
+
ok: false;
|
|
2749
|
+
reason: string;
|
|
2750
|
+
};
|
|
2751
|
+
/** "Allocated 70% · Unallocated 30%". */
|
|
2752
|
+
declare function poolAllocationText(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined): string;
|
|
2651
2753
|
/** `fixed 500` → "500 credits"; `percent 20` → "20%". */
|
|
2652
2754
|
declare function formatPoolSplit(split: {
|
|
2653
2755
|
mode: CreditPoolMode;
|
|
@@ -2704,6 +2806,15 @@ declare function poolRenewsAtCycleEnd(pool: Pick<SharedPoolBalance, "endsAt" | "
|
|
|
2704
2806
|
declare function poolWorkspaceName(name: string | null | undefined): string;
|
|
2705
2807
|
/** The member's Billing banner: "Credits shared by Agency: 80 of 200 left this cycle". */
|
|
2706
2808
|
declare function sharedPoolBannerText(pool: Pick<SharedPoolBalance, "sponsorName" | "allowance" | "remaining">): string;
|
|
2809
|
+
/** The Billing line once a sponsor has spent its own share this cycle. */
|
|
2810
|
+
declare function sponsorShareSpentText(): string;
|
|
2811
|
+
/**
|
|
2812
|
+
* A sponsor's Billing banner for its own share: "This workspace's share:
|
|
2813
|
+
* 20,000 of 30,000 credits left this cycle", or `sponsorShareSpentText` when none is left.
|
|
2814
|
+
*/
|
|
2815
|
+
declare function sponsorShareBannerText(share: Pick<SponsorShareBalance, "allowance" | "remaining">): string;
|
|
2816
|
+
/** The line under the sponsor's banner: why it can't spend all its credits. */
|
|
2817
|
+
declare function sponsorShareDetailText(): string;
|
|
2707
2818
|
/**
|
|
2708
2819
|
* Was the line saying a member's own credits were paused while it used the
|
|
2709
2820
|
* pool's. Billing spends them first, so it now answers `ownCreditsFirstText`
|
|
@@ -2728,12 +2839,14 @@ interface CreditsMeter {
|
|
|
2728
2839
|
* The Billing overview's "Credits used" meter. A workspace spending shared
|
|
2729
2840
|
* credits is measured against its allowance this cycle: its balance is the
|
|
2730
2841
|
* sponsor's, so subtracting it from this workspace's own unexpired credits
|
|
2731
|
-
* says nothing.
|
|
2842
|
+
* says nothing. A sponsor with a self share is measured against that share,
|
|
2843
|
+
* which caps its balance. Otherwise used = own unexpired credits − balance.
|
|
2732
2844
|
*/
|
|
2733
|
-
declare function creditsMeter({ availableCredits, totalCredits, sharedPool, }: {
|
|
2845
|
+
declare function creditsMeter({ availableCredits, totalCredits, sharedPool, sponsorShare, }: {
|
|
2734
2846
|
availableCredits: number | null;
|
|
2735
2847
|
totalCredits: number | null;
|
|
2736
2848
|
sharedPool: Pick<SharedPoolBalance, "allowance" | "used" | "remaining"> | null;
|
|
2849
|
+
sponsorShare?: Pick<SponsorShareBalance, "allowance" | "used" | "remaining"> | null;
|
|
2737
2850
|
}): CreditsMeter;
|
|
2738
2851
|
/**
|
|
2739
2852
|
* The workspace a usage row was spent by, when it is not `currentWorkspaceId`:
|
|
@@ -2843,23 +2956,38 @@ declare function useBillingEntitlement(fetchCurrentPlan: (() => Promise<Subscrip
|
|
|
2843
2956
|
loading: boolean;
|
|
2844
2957
|
};
|
|
2845
2958
|
|
|
2846
|
-
type
|
|
2959
|
+
type PoolModalCommon = {
|
|
2960
|
+
onClose: () => void;
|
|
2961
|
+
/** After a save; the parent refetches. */
|
|
2962
|
+
onSaved: () => void;
|
|
2963
|
+
/**
|
|
2964
|
+
* What is left of the 100% for this share, the share itself left out
|
|
2965
|
+
* (`poolUnallocatedPercent(pool, exclude)`). A percent share over it can't
|
|
2966
|
+
* be saved. Absent skips the check; billing still enforces it.
|
|
2967
|
+
*/
|
|
2968
|
+
unallocatedPercent?: number;
|
|
2969
|
+
};
|
|
2970
|
+
type CreditPoolMemberModalProps = (PoolModalCommon & {
|
|
2847
2971
|
kind: "add";
|
|
2848
2972
|
/** Workspaces credits can be shared with. */
|
|
2849
2973
|
candidates: CreditPoolCandidate[];
|
|
2850
2974
|
onSave: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2851
|
-
|
|
2852
|
-
/** After a save; the parent refetches. */
|
|
2853
|
-
onSaved: () => void;
|
|
2854
|
-
} | {
|
|
2975
|
+
}) | (PoolModalCommon & {
|
|
2855
2976
|
kind: "edit";
|
|
2856
2977
|
member: CreditPoolMember;
|
|
2857
2978
|
memberName: string;
|
|
2858
2979
|
onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2980
|
+
}) | (PoolModalCommon & {
|
|
2981
|
+
/** The share the sponsor keeps for itself: set (`self` null) or change it. */
|
|
2982
|
+
kind: "self";
|
|
2983
|
+
self: CreditPoolSelfShare | null;
|
|
2984
|
+
workspaceName: string;
|
|
2985
|
+
onSave: (input: SetCreditPoolSelfShareInput) => Promise<unknown>;
|
|
2986
|
+
});
|
|
2987
|
+
/**
|
|
2988
|
+
* Share credits with a workspace, change an active member's share, or set the
|
|
2989
|
+
* share the sponsor keeps for itself (`kind: "self"`).
|
|
2990
|
+
*/
|
|
2863
2991
|
declare function CreditPoolMemberModal(props: CreditPoolMemberModalProps): react.JSX.Element;
|
|
2864
2992
|
|
|
2865
2993
|
interface RemovePoolMemberModalProps {
|
|
@@ -2874,6 +3002,17 @@ interface RemovePoolMemberModalProps {
|
|
|
2874
3002
|
}
|
|
2875
3003
|
/** Confirm stopping a member spending this workspace's credits, with a reason. */
|
|
2876
3004
|
declare function RemovePoolMemberModal({ member, memberName, sponsorName, onRemove, onClose, onRemoved, }: RemovePoolMemberModalProps): react.JSX.Element;
|
|
3005
|
+
interface RemoveSelfShareModalProps {
|
|
3006
|
+
self: CreditPoolSelfShare;
|
|
3007
|
+
/** This workspace's name. */
|
|
3008
|
+
workspaceName: string;
|
|
3009
|
+
onRemove: () => Promise<unknown>;
|
|
3010
|
+
onClose: () => void;
|
|
3011
|
+
/** After the share was removed; the parent refetches. */
|
|
3012
|
+
onRemoved: () => void;
|
|
3013
|
+
}
|
|
3014
|
+
/** Confirm removing the share a sponsor keeps for itself: it may spend its whole balance again. */
|
|
3015
|
+
declare function RemoveSelfShareModal({ self, workspaceName, onRemove, onClose, onRemoved, }: RemoveSelfShareModalProps): react.JSX.Element;
|
|
2877
3016
|
|
|
2878
3017
|
declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
2879
3018
|
adapters: SettingsAdapters;
|
|
@@ -2976,4 +3115,4 @@ interface AppSettingsRowProps {
|
|
|
2976
3115
|
}
|
|
2977
3116
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
2978
3117
|
|
|
2979
|
-
export { APP_KEYS, type AddCreditPoolMemberInput, AdministrationOverview, type AdministrationOverviewProps, type AdministrativeNavigationOptions, type ApiToken, type AppKey, AppSettingsHeader, type AppSettingsHeaderProps, AppSettingsPage, type AppSettingsPageProps, AppSettingsRow, type AppSettingsRowProps, AppSettingsSection, type AppSettingsSectionProps, type AvailableCreditsResponse, BILLING_TABLE_FRAME_STYLE, BILLING_TABLE_MIN_HEIGHT, BILLING_TABLE_PAGER_STYLE, BillingContent, type BillingEntitlement, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreatedToken, type CreditCycleUnit, type CreditLimitUnit, type CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type LoginMethodsMember, type LoginMethodsSettings, type LoginMethodsSwitchState, MOCK_REFERRED_USERS, 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, OrganizationLoginMethodsContent, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralHistoryView, type ReferralHistoryViewProps, ReferralTab, type ReferredUser, 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 SettingsLoginMethodsAdapter, 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, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_CREDIT_LIMIT_REACHED, WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceCreditLimit, WorkspaceCreditLimitCard, type WorkspaceCreditLimitSummary, 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, aboveTotalReason, belowUsageReason, canManageOnlyWorkspaceCreditLimit, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, describeWorkspaceCreditLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitAboveTotal, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, isWorkspaceCreditLimitReached, joinMembersWithLimits, lastUsedLabel, limitAboveTotalTotal, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, loginMethodsSwitchState, maximumCreditLimit, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralCountLabel, referralLink, referralSignupDate, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sortReferredUsers, sponsoredCreditsText, ssoLabel, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|
|
3118
|
+
export { APP_KEYS, type AddCreditPoolMemberInput, AdministrationOverview, type AdministrationOverviewProps, type AdministrativeNavigationOptions, type ApiToken, type AppKey, AppSettingsHeader, type AppSettingsHeaderProps, AppSettingsPage, type AppSettingsPageProps, AppSettingsRow, type AppSettingsRowProps, AppSettingsSection, type AppSettingsSectionProps, type AvailableCreditsResponse, BILLING_TABLE_FRAME_STYLE, BILLING_TABLE_MIN_HEIGHT, BILLING_TABLE_PAGER_STYLE, BillingContent, type BillingEntitlement, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreatedToken, type CreditCycleUnit, type CreditLimitUnit, type CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditPoolSelfShare, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, INVOICE_DOWNLOAD_FAILED_MESSAGE, INVOICE_NOT_AVAILABLE_MESSAGE, InviteUpdateModal, type InvoiceDownloadKind, type InvoicePdfResponse, type LoginMethodsMember, type LoginMethodsSettings, type LoginMethodsSwitchState, MOCK_REFERRED_USERS, 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, OrganizationLoginMethodsContent, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralHistoryView, type ReferralHistoryViewProps, ReferralTab, type ReferredUser, RemovePoolMemberModal, type RemovePoolMemberModalProps, RemoveSelfShareModal, type RemoveSelfShareModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SetCreditPoolSelfShareInput, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsLoginMethodsAdapter, 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 SponsorShareBalance, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_CREDIT_LIMIT_REACHED, WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceCreditLimit, WorkspaceCreditLimitCard, type WorkspaceCreditLimitSummary, 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, aboveTotalReason, belowUsageReason, canManageOnlyWorkspaceCreditLimit, canShowSharedCredits, checkPoolPercentTotal, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, describeWorkspaceCreditLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, invoiceDownloadKind, isLimitAboveTotal, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, isWorkspaceCreditLimitReached, joinMembersWithLimits, lastUsedLabel, limitAboveTotalTotal, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, loginMethodsSwitchState, maximumCreditLimit, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolAllocatedPercent, poolAllocationText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolUnallocatedPercent, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralCountLabel, referralLink, referralSignupDate, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sortReferredUsers, sponsorShareBannerText, sponsorShareDetailText, sponsorShareSpentText, sponsoredCreditsText, ssoLabel, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -680,9 +680,22 @@ interface SharedPoolBalance {
|
|
|
680
680
|
/** The member's own credits, spent before the pool's. */
|
|
681
681
|
ownCredits?: number;
|
|
682
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* The share a sponsor keeps for itself this cycle (`CreditPoolSelfShare`, as
|
|
685
|
+
* the balance carries it). Present only on a sponsor's balance with a self
|
|
686
|
+
* share: its `availableCredits` are then never more than `remaining`.
|
|
687
|
+
*/
|
|
688
|
+
interface SponsorShareBalance {
|
|
689
|
+
/** What this workspace may spend itself this cycle. */
|
|
690
|
+
allowance: number;
|
|
691
|
+
used: number;
|
|
692
|
+
remaining: number;
|
|
693
|
+
}
|
|
683
694
|
interface AvailableCreditsResponse {
|
|
684
695
|
availableCredits: number;
|
|
685
696
|
sharedPool?: SharedPoolBalance;
|
|
697
|
+
/** A sponsor's own share; optional, older billing omits it. */
|
|
698
|
+
sponsorShare?: SponsorShareBalance;
|
|
686
699
|
}
|
|
687
700
|
interface SubscriptionPlan {
|
|
688
701
|
id: string;
|
|
@@ -976,11 +989,41 @@ interface CreditPoolFormerMember {
|
|
|
976
989
|
memberWorkspaceKey: string;
|
|
977
990
|
memberWorkspaceName: string | null;
|
|
978
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* The share of its own credits a sponsor keeps for itself each billing cycle.
|
|
994
|
+
* A percent share counts in the same 100% as its members' percent shares; the
|
|
995
|
+
* rest stays unallocated for workspaces it may share with later.
|
|
996
|
+
*/
|
|
997
|
+
interface CreditPoolSelfShare {
|
|
998
|
+
mode: CreditPoolMode;
|
|
999
|
+
/** Credits per cycle for `fixed`; a share of the workspace's plan credits, (0–100], for `percent`. */
|
|
1000
|
+
value: number;
|
|
1001
|
+
/** What this workspace may spend itself this cycle. */
|
|
1002
|
+
allowance: number;
|
|
1003
|
+
used: number;
|
|
1004
|
+
remaining: number;
|
|
1005
|
+
cycle?: {
|
|
1006
|
+
start: string;
|
|
1007
|
+
end: string;
|
|
1008
|
+
};
|
|
1009
|
+
/** When the share stops on its own (ISO); null or absent when it runs until removed. */
|
|
1010
|
+
endsAt?: string | null;
|
|
1011
|
+
note?: string;
|
|
1012
|
+
}
|
|
979
1013
|
interface CreditPoolResponse {
|
|
980
1014
|
/** Workspaces this one shares its credits with (active only), oldest first. */
|
|
981
1015
|
members: CreditPoolMember[];
|
|
982
1016
|
/** When this workspace spends another's credits: that membership. */
|
|
983
1017
|
sponsor: CreditPoolMember | null;
|
|
1018
|
+
/**
|
|
1019
|
+
* The share this workspace keeps for itself, or null when it may spend its
|
|
1020
|
+
* whole balance. Optional: older hosts omit it.
|
|
1021
|
+
*/
|
|
1022
|
+
self?: CreditPoolSelfShare | null;
|
|
1023
|
+
/** This workspace's percent share plus its members' percent shares (0–100). Optional: older hosts omit it. */
|
|
1024
|
+
allocatedPercent?: number;
|
|
1025
|
+
/** `100 - allocatedPercent`. Optional: older hosts omit it. */
|
|
1026
|
+
unallocatedPercent?: number;
|
|
984
1027
|
/**
|
|
985
1028
|
* Workspaces this one stopped sharing with. Its usage history still has
|
|
986
1029
|
* their rows, so they are named there. Optional: older hosts omit it.
|
|
@@ -1004,6 +1047,14 @@ interface UpdateCreditPoolMemberInput {
|
|
|
1004
1047
|
/** A new end date (ISO, in the future), or null to clear it; absent leaves it as it is. */
|
|
1005
1048
|
endsAt?: string | null;
|
|
1006
1049
|
}
|
|
1050
|
+
interface SetCreditPoolSelfShareInput {
|
|
1051
|
+
mode: CreditPoolMode;
|
|
1052
|
+
value: number;
|
|
1053
|
+
/** Why — required, at most 500 characters. */
|
|
1054
|
+
note: string;
|
|
1055
|
+
/** When the share stops on its own (an ISO date in the future); null or absent for never. */
|
|
1056
|
+
endsAt?: string | null;
|
|
1057
|
+
}
|
|
1007
1058
|
/** A workspace credits can be shared with (another workspace of the organization). */
|
|
1008
1059
|
interface CreditPoolCandidate {
|
|
1009
1060
|
id: string;
|
|
@@ -1189,6 +1240,15 @@ interface SettingsApiAdapter {
|
|
|
1189
1240
|
removeCreditPoolMember?: (memberId: string, reason: string) => Promise<CreditPoolMember>;
|
|
1190
1241
|
/** Workspaces this one may share with: its organization's others. */
|
|
1191
1242
|
fetchCreditPoolCandidates?: () => Promise<CreditPoolCandidate[]>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Set or change the share this workspace keeps for itself
|
|
1245
|
+
* (`PUT /workspace/:id/credit-pool/self`). Organization admins only. Rejects
|
|
1246
|
+
* like `addCreditPoolMember`. When omitted, Shared credits has no
|
|
1247
|
+
* "This workspace" controls.
|
|
1248
|
+
*/
|
|
1249
|
+
setCreditPoolSelfShare?: (input: SetCreditPoolSelfShareInput) => Promise<unknown>;
|
|
1250
|
+
/** Remove the self share: this workspace may spend its whole balance again. */
|
|
1251
|
+
removeCreditPoolSelfShare?: () => Promise<unknown>;
|
|
1192
1252
|
fetchTokens: (params?: {
|
|
1193
1253
|
showRevoked?: boolean;
|
|
1194
1254
|
}) => Promise<ApiToken[]>;
|
|
@@ -1707,6 +1767,24 @@ declare const BILLING_TABLE_PAGER_STYLE: CSSProperties;
|
|
|
1707
1767
|
*/
|
|
1708
1768
|
declare function productsForCountry(products: readonly BillingProduct[], country: string | null | undefined): BillingProduct[];
|
|
1709
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* What an Invoice history row can download, decided by its `transactionId`:
|
|
1772
|
+
*
|
|
1773
|
+
* - `in_…` — a Stripe invoice; billing returns its `invoice_pdf`.
|
|
1774
|
+
* - `pi_…` — a one-off payment; billing returns the receipt PDF it generated.
|
|
1775
|
+
* - anything else — `null`. Billing's own `T-…` / `TG-…` ids (rollovers,
|
|
1776
|
+
* bonuses, offline and manual credits) have no invoice or receipt behind
|
|
1777
|
+
* them, and asking billing for one fails.
|
|
1778
|
+
*
|
|
1779
|
+
* One rule so the row's Download cell, its click and the export agree.
|
|
1780
|
+
*/
|
|
1781
|
+
type InvoiceDownloadKind = "invoice" | "receipt";
|
|
1782
|
+
declare function invoiceDownloadKind(item: Pick<UsageHistoryItem, "transactionId">): InvoiceDownloadKind | null;
|
|
1783
|
+
/** Shown when a row has nothing to download. */
|
|
1784
|
+
declare const INVOICE_NOT_AVAILABLE_MESSAGE = "There's no invoice for this order. Rolled-over, bonus and manually added credits don't have one.";
|
|
1785
|
+
/** Leads the toast when billing could not hand back a PDF for a row that should have one. */
|
|
1786
|
+
declare const INVOICE_DOWNLOAD_FAILED_MESSAGE = "Couldn't download this invoice.";
|
|
1787
|
+
|
|
1710
1788
|
/** Rows on one page of Billing's Usage logs table. */
|
|
1711
1789
|
declare const USAGE_LOGS_PAGE_SIZE = 50;
|
|
1712
1790
|
/** Rows per request while exporting: billing's own `limit` ceiling. */
|
|
@@ -2648,6 +2726,30 @@ declare function validatePoolText(raw: string, max: number): {
|
|
|
2648
2726
|
ok: false;
|
|
2649
2727
|
reason: string;
|
|
2650
2728
|
};
|
|
2729
|
+
/**
|
|
2730
|
+
* The percent of this workspace's plan credits already given out: its own
|
|
2731
|
+
* percent share plus its members' percent shares. Fixed shares don't count.
|
|
2732
|
+
* `exclude` leaves out the share being edited (a member's `_id`, or `"self"`),
|
|
2733
|
+
* so its new value is checked against the rest.
|
|
2734
|
+
*/
|
|
2735
|
+
declare function poolAllocatedPercent(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined, exclude?: string): number;
|
|
2736
|
+
/** What is left of the 100%: `100 - poolAllocatedPercent`, never below 0. */
|
|
2737
|
+
declare function poolUnallocatedPercent(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined, exclude?: string): number;
|
|
2738
|
+
/**
|
|
2739
|
+
* Whether a percent share fits in what is unallocated: the self share and the
|
|
2740
|
+
* members' percent shares together are at most 100. A fixed share always fits.
|
|
2741
|
+
*/
|
|
2742
|
+
declare function checkPoolPercentTotal(split: {
|
|
2743
|
+
mode: CreditPoolMode;
|
|
2744
|
+
value: number;
|
|
2745
|
+
}, unallocatedPercent: number): {
|
|
2746
|
+
ok: true;
|
|
2747
|
+
} | {
|
|
2748
|
+
ok: false;
|
|
2749
|
+
reason: string;
|
|
2750
|
+
};
|
|
2751
|
+
/** "Allocated 70% · Unallocated 30%". */
|
|
2752
|
+
declare function poolAllocationText(pool: Pick<CreditPoolResponse, "members" | "self" | "allocatedPercent"> | null | undefined): string;
|
|
2651
2753
|
/** `fixed 500` → "500 credits"; `percent 20` → "20%". */
|
|
2652
2754
|
declare function formatPoolSplit(split: {
|
|
2653
2755
|
mode: CreditPoolMode;
|
|
@@ -2704,6 +2806,15 @@ declare function poolRenewsAtCycleEnd(pool: Pick<SharedPoolBalance, "endsAt" | "
|
|
|
2704
2806
|
declare function poolWorkspaceName(name: string | null | undefined): string;
|
|
2705
2807
|
/** The member's Billing banner: "Credits shared by Agency: 80 of 200 left this cycle". */
|
|
2706
2808
|
declare function sharedPoolBannerText(pool: Pick<SharedPoolBalance, "sponsorName" | "allowance" | "remaining">): string;
|
|
2809
|
+
/** The Billing line once a sponsor has spent its own share this cycle. */
|
|
2810
|
+
declare function sponsorShareSpentText(): string;
|
|
2811
|
+
/**
|
|
2812
|
+
* A sponsor's Billing banner for its own share: "This workspace's share:
|
|
2813
|
+
* 20,000 of 30,000 credits left this cycle", or `sponsorShareSpentText` when none is left.
|
|
2814
|
+
*/
|
|
2815
|
+
declare function sponsorShareBannerText(share: Pick<SponsorShareBalance, "allowance" | "remaining">): string;
|
|
2816
|
+
/** The line under the sponsor's banner: why it can't spend all its credits. */
|
|
2817
|
+
declare function sponsorShareDetailText(): string;
|
|
2707
2818
|
/**
|
|
2708
2819
|
* Was the line saying a member's own credits were paused while it used the
|
|
2709
2820
|
* pool's. Billing spends them first, so it now answers `ownCreditsFirstText`
|
|
@@ -2728,12 +2839,14 @@ interface CreditsMeter {
|
|
|
2728
2839
|
* The Billing overview's "Credits used" meter. A workspace spending shared
|
|
2729
2840
|
* credits is measured against its allowance this cycle: its balance is the
|
|
2730
2841
|
* sponsor's, so subtracting it from this workspace's own unexpired credits
|
|
2731
|
-
* says nothing.
|
|
2842
|
+
* says nothing. A sponsor with a self share is measured against that share,
|
|
2843
|
+
* which caps its balance. Otherwise used = own unexpired credits − balance.
|
|
2732
2844
|
*/
|
|
2733
|
-
declare function creditsMeter({ availableCredits, totalCredits, sharedPool, }: {
|
|
2845
|
+
declare function creditsMeter({ availableCredits, totalCredits, sharedPool, sponsorShare, }: {
|
|
2734
2846
|
availableCredits: number | null;
|
|
2735
2847
|
totalCredits: number | null;
|
|
2736
2848
|
sharedPool: Pick<SharedPoolBalance, "allowance" | "used" | "remaining"> | null;
|
|
2849
|
+
sponsorShare?: Pick<SponsorShareBalance, "allowance" | "used" | "remaining"> | null;
|
|
2737
2850
|
}): CreditsMeter;
|
|
2738
2851
|
/**
|
|
2739
2852
|
* The workspace a usage row was spent by, when it is not `currentWorkspaceId`:
|
|
@@ -2843,23 +2956,38 @@ declare function useBillingEntitlement(fetchCurrentPlan: (() => Promise<Subscrip
|
|
|
2843
2956
|
loading: boolean;
|
|
2844
2957
|
};
|
|
2845
2958
|
|
|
2846
|
-
type
|
|
2959
|
+
type PoolModalCommon = {
|
|
2960
|
+
onClose: () => void;
|
|
2961
|
+
/** After a save; the parent refetches. */
|
|
2962
|
+
onSaved: () => void;
|
|
2963
|
+
/**
|
|
2964
|
+
* What is left of the 100% for this share, the share itself left out
|
|
2965
|
+
* (`poolUnallocatedPercent(pool, exclude)`). A percent share over it can't
|
|
2966
|
+
* be saved. Absent skips the check; billing still enforces it.
|
|
2967
|
+
*/
|
|
2968
|
+
unallocatedPercent?: number;
|
|
2969
|
+
};
|
|
2970
|
+
type CreditPoolMemberModalProps = (PoolModalCommon & {
|
|
2847
2971
|
kind: "add";
|
|
2848
2972
|
/** Workspaces credits can be shared with. */
|
|
2849
2973
|
candidates: CreditPoolCandidate[];
|
|
2850
2974
|
onSave: (input: AddCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2851
|
-
|
|
2852
|
-
/** After a save; the parent refetches. */
|
|
2853
|
-
onSaved: () => void;
|
|
2854
|
-
} | {
|
|
2975
|
+
}) | (PoolModalCommon & {
|
|
2855
2976
|
kind: "edit";
|
|
2856
2977
|
member: CreditPoolMember;
|
|
2857
2978
|
memberName: string;
|
|
2858
2979
|
onSave: (patch: UpdateCreditPoolMemberInput) => Promise<CreditPoolMember>;
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2980
|
+
}) | (PoolModalCommon & {
|
|
2981
|
+
/** The share the sponsor keeps for itself: set (`self` null) or change it. */
|
|
2982
|
+
kind: "self";
|
|
2983
|
+
self: CreditPoolSelfShare | null;
|
|
2984
|
+
workspaceName: string;
|
|
2985
|
+
onSave: (input: SetCreditPoolSelfShareInput) => Promise<unknown>;
|
|
2986
|
+
});
|
|
2987
|
+
/**
|
|
2988
|
+
* Share credits with a workspace, change an active member's share, or set the
|
|
2989
|
+
* share the sponsor keeps for itself (`kind: "self"`).
|
|
2990
|
+
*/
|
|
2863
2991
|
declare function CreditPoolMemberModal(props: CreditPoolMemberModalProps): react.JSX.Element;
|
|
2864
2992
|
|
|
2865
2993
|
interface RemovePoolMemberModalProps {
|
|
@@ -2874,6 +3002,17 @@ interface RemovePoolMemberModalProps {
|
|
|
2874
3002
|
}
|
|
2875
3003
|
/** Confirm stopping a member spending this workspace's credits, with a reason. */
|
|
2876
3004
|
declare function RemovePoolMemberModal({ member, memberName, sponsorName, onRemove, onClose, onRemoved, }: RemovePoolMemberModalProps): react.JSX.Element;
|
|
3005
|
+
interface RemoveSelfShareModalProps {
|
|
3006
|
+
self: CreditPoolSelfShare;
|
|
3007
|
+
/** This workspace's name. */
|
|
3008
|
+
workspaceName: string;
|
|
3009
|
+
onRemove: () => Promise<unknown>;
|
|
3010
|
+
onClose: () => void;
|
|
3011
|
+
/** After the share was removed; the parent refetches. */
|
|
3012
|
+
onRemoved: () => void;
|
|
3013
|
+
}
|
|
3014
|
+
/** Confirm removing the share a sponsor keeps for itself: it may spend its whole balance again. */
|
|
3015
|
+
declare function RemoveSelfShareModal({ self, workspaceName, onRemove, onClose, onRemoved, }: RemoveSelfShareModalProps): react.JSX.Element;
|
|
2877
3016
|
|
|
2878
3017
|
declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
2879
3018
|
adapters: SettingsAdapters;
|
|
@@ -2976,4 +3115,4 @@ interface AppSettingsRowProps {
|
|
|
2976
3115
|
}
|
|
2977
3116
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
2978
3117
|
|
|
2979
|
-
export { APP_KEYS, type AddCreditPoolMemberInput, AdministrationOverview, type AdministrationOverviewProps, type AdministrativeNavigationOptions, type ApiToken, type AppKey, AppSettingsHeader, type AppSettingsHeaderProps, AppSettingsPage, type AppSettingsPageProps, AppSettingsRow, type AppSettingsRowProps, AppSettingsSection, type AppSettingsSectionProps, type AvailableCreditsResponse, BILLING_TABLE_FRAME_STYLE, BILLING_TABLE_MIN_HEIGHT, BILLING_TABLE_PAGER_STYLE, BillingContent, type BillingEntitlement, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreatedToken, type CreditCycleUnit, type CreditLimitUnit, type CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type LoginMethodsMember, type LoginMethodsSettings, type LoginMethodsSwitchState, MOCK_REFERRED_USERS, 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, OrganizationLoginMethodsContent, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralHistoryView, type ReferralHistoryViewProps, ReferralTab, type ReferredUser, 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 SettingsLoginMethodsAdapter, 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, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_CREDIT_LIMIT_REACHED, WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceCreditLimit, WorkspaceCreditLimitCard, type WorkspaceCreditLimitSummary, 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, aboveTotalReason, belowUsageReason, canManageOnlyWorkspaceCreditLimit, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, describeWorkspaceCreditLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitAboveTotal, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, isWorkspaceCreditLimitReached, joinMembersWithLimits, lastUsedLabel, limitAboveTotalTotal, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, loginMethodsSwitchState, maximumCreditLimit, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralCountLabel, referralLink, referralSignupDate, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sortReferredUsers, sponsoredCreditsText, ssoLabel, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|
|
3118
|
+
export { APP_KEYS, type AddCreditPoolMemberInput, AdministrationOverview, type AdministrationOverviewProps, type AdministrativeNavigationOptions, type ApiToken, type AppKey, AppSettingsHeader, type AppSettingsHeaderProps, AppSettingsPage, type AppSettingsPageProps, AppSettingsRow, type AppSettingsRowProps, AppSettingsSection, type AppSettingsSectionProps, type AvailableCreditsResponse, BILLING_TABLE_FRAME_STYLE, BILLING_TABLE_MIN_HEIGHT, BILLING_TABLE_PAGER_STYLE, BillingContent, type BillingEntitlement, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type ConnectedApp, ConnectedAppsContent, type CreatedToken, type CreditCycleUnit, type CreditLimitUnit, type CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditPoolSelfShare, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, INVOICE_DOWNLOAD_FAILED_MESSAGE, INVOICE_NOT_AVAILABLE_MESSAGE, InviteUpdateModal, type InvoiceDownloadKind, type InvoicePdfResponse, type LoginMethodsMember, type LoginMethodsSettings, type LoginMethodsSwitchState, MOCK_REFERRED_USERS, 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, OrganizationLoginMethodsContent, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralHistoryView, type ReferralHistoryViewProps, ReferralTab, type ReferredUser, RemovePoolMemberModal, type RemovePoolMemberModalProps, RemoveSelfShareModal, type RemoveSelfShareModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SetCreditPoolSelfShareInput, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsLoginMethodsAdapter, 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 SponsorShareBalance, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_CREDIT_LIMIT_REACHED, WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceCreditLimit, WorkspaceCreditLimitCard, type WorkspaceCreditLimitSummary, 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, aboveTotalReason, belowUsageReason, canManageOnlyWorkspaceCreditLimit, canShowSharedCredits, checkPoolPercentTotal, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, describeWorkspaceCreditLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, invoiceDownloadKind, isLimitAboveTotal, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, isWorkspaceCreditLimitReached, joinMembersWithLimits, lastUsedLabel, limitAboveTotalTotal, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, loginMethodsSwitchState, maximumCreditLimit, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolAllocatedPercent, poolAllocationText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolUnallocatedPercent, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralCountLabel, referralLink, referralSignupDate, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sortReferredUsers, sponsorShareBannerText, sponsorShareDetailText, sponsorShareSpentText, sponsoredCreditsText, ssoLabel, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|