@streamoid/settings 0.13.0 → 0.15.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/dist/index.d.mts +312 -7
- package/dist/index.d.ts +312 -7
- package/dist/index.js +700 -75
- package/dist/index.mjs +699 -73
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -705,8 +705,28 @@ interface BillingSubscription {
|
|
|
705
705
|
/** Stripe product id; used to look up the matching product in fetched plans. */
|
|
706
706
|
stripeProductId?: string;
|
|
707
707
|
}
|
|
708
|
+
/**
|
|
709
|
+
* Whether the workspace gets paid features, and why: `plan` (its own paid
|
|
710
|
+
* plan) or `pool` (it spends a sponsor's shared credits, on its free plan).
|
|
711
|
+
* The plan and billing actions are unchanged by it; see `./entitlement`.
|
|
712
|
+
*/
|
|
713
|
+
interface BillingEntitlement {
|
|
714
|
+
paid: boolean;
|
|
715
|
+
source: "plan" | "pool" | null;
|
|
716
|
+
/** The sponsor's workspace id, for `pool`. */
|
|
717
|
+
sponsorWorkspaceId?: string;
|
|
718
|
+
sponsorName?: string;
|
|
719
|
+
/** When the sharing ends (ISO); null or absent when it runs until removed. */
|
|
720
|
+
endsAt?: string | null;
|
|
721
|
+
}
|
|
708
722
|
interface SubscriptionResponse {
|
|
709
723
|
data: BillingSubscription | null;
|
|
724
|
+
/**
|
|
725
|
+
* Billing's top-level `entitlement` (beside `data`), passed through.
|
|
726
|
+
* Absent on servers from before it, and from hosts that drop it: then the
|
|
727
|
+
* plan alone decides, as before.
|
|
728
|
+
*/
|
|
729
|
+
entitlement?: BillingEntitlement | null;
|
|
710
730
|
}
|
|
711
731
|
interface PriceMetadata {
|
|
712
732
|
name: string;
|
|
@@ -750,8 +770,32 @@ interface UsageHistoryItem {
|
|
|
750
770
|
/** Stripe transaction id when present. Some usage rows (e.g. internal returns) are emitted without one. */
|
|
751
771
|
transactionId?: string;
|
|
752
772
|
}
|
|
773
|
+
/** Billing's page block on a usage-history response asked for with `limit`. */
|
|
774
|
+
interface UsageHistoryPagination {
|
|
775
|
+
page: number;
|
|
776
|
+
limit: number;
|
|
777
|
+
total: number;
|
|
778
|
+
totalPages: number;
|
|
779
|
+
hasNextPage: boolean;
|
|
780
|
+
hasPreviousPage: boolean;
|
|
781
|
+
skip?: number;
|
|
782
|
+
}
|
|
753
783
|
interface UsageHistoryResponse {
|
|
754
784
|
data: UsageHistoryItem[];
|
|
785
|
+
/** Present when the request carried `limit`; absent from an unpaged one. */
|
|
786
|
+
pagination?: UsageHistoryPagination;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* `fetchUsageLogs`'s query. Pass each through to billing
|
|
790
|
+
* (`get-usage-history`'s `page`, `limit` (≤ 100), `startDate`, `endDate`;
|
|
791
|
+
* dates are ISO strings, both ends inclusive) and return its `pagination`.
|
|
792
|
+
*/
|
|
793
|
+
interface UsageLogsQuery {
|
|
794
|
+
/** 1-based. */
|
|
795
|
+
page?: number;
|
|
796
|
+
limit?: number;
|
|
797
|
+
startDate?: string;
|
|
798
|
+
endDate?: string;
|
|
755
799
|
}
|
|
756
800
|
interface InvoicePdfResponse {
|
|
757
801
|
data: {
|
|
@@ -965,7 +1009,10 @@ interface SettingsApiAdapter {
|
|
|
965
1009
|
fetchPlans: () => Promise<ProductsResponse>;
|
|
966
1010
|
/**
|
|
967
1011
|
* Current active subscription. Returns `{ data: null }` when the workspace
|
|
968
|
-
* has no plan yet (free tier).
|
|
1012
|
+
* has no plan yet (free tier). Pass billing's top-level `entitlement`
|
|
1013
|
+
* through as `entitlement`. For billing's 404 (no subscription) that carries
|
|
1014
|
+
* one, resolve `{ data: null, entitlement }`, or throw an error that keeps
|
|
1015
|
+
* the response body (`body`, `data` or `response.data`).
|
|
969
1016
|
*/
|
|
970
1017
|
fetchCurrentPlan: () => Promise<SubscriptionResponse>;
|
|
971
1018
|
/** Available credit balance for the active workspace. */
|
|
@@ -978,8 +1025,14 @@ interface SettingsApiAdapter {
|
|
|
978
1025
|
buyCredits: (input: BuyCreditsPayload) => Promise<BuyCreditsResponse | {
|
|
979
1026
|
data: BuyCreditsResponse;
|
|
980
1027
|
}>;
|
|
981
|
-
/**
|
|
982
|
-
|
|
1028
|
+
/**
|
|
1029
|
+
* Per-credit usage / deduction logs (CXO: `getUsageHistory(_, "deduct,return")`).
|
|
1030
|
+
* Billing asks for one page at a time (`query`) and expects `pagination`
|
|
1031
|
+
* back. An adapter that ignores `query` and returns every row still works:
|
|
1032
|
+
* Billing pages those itself, but the whole history is still downloaded.
|
|
1033
|
+
* Rejecting shows an inline error in the table.
|
|
1034
|
+
*/
|
|
1035
|
+
fetchUsageLogs?: (query?: UsageLogsQuery) => Promise<UsageHistoryResponse>;
|
|
983
1036
|
/** Upgrade or downgrade a subscription. Returns checkout URL when applicable. */
|
|
984
1037
|
updateSubscription?: (payload: UpdateSubscriptionPayload) => Promise<UpdateSubscriptionResponse>;
|
|
985
1038
|
/** CXO-only: undo a pending plan downgrade before it takes effect. */
|
|
@@ -1424,7 +1477,18 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
|
|
|
1424
1477
|
};
|
|
1425
1478
|
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
1426
1479
|
|
|
1427
|
-
|
|
1480
|
+
/** Previous / Next under the Usage logs table, with the page and the total. */
|
|
1481
|
+
declare function UsageLogsPager({ page, totalPages, total, loading, onPageChange, }: {
|
|
1482
|
+
/** 1-based. */
|
|
1483
|
+
page: number;
|
|
1484
|
+
totalPages: number;
|
|
1485
|
+
/** Logs across every page. */
|
|
1486
|
+
total: number;
|
|
1487
|
+
/** Disables both buttons while a page loads. */
|
|
1488
|
+
loading?: boolean;
|
|
1489
|
+
onPageChange: (page: number) => void;
|
|
1490
|
+
}): react__default.JSX.Element | null;
|
|
1491
|
+
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, showPerUserLimits: showPerUserLimitsProp, onShowPerUserLimitsChange, showSharedCredits: showSharedCreditsProp, onShowSharedCreditsChange, onEntitlementChange, }?: {
|
|
1428
1492
|
embedded?: boolean;
|
|
1429
1493
|
/** Controlled "plans" sub-view flag. When provided, the host (settings
|
|
1430
1494
|
* wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
|
|
@@ -1439,8 +1503,171 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
|
|
|
1439
1503
|
* workspace is in an organization. */
|
|
1440
1504
|
showSharedCredits?: boolean;
|
|
1441
1505
|
onShowSharedCreditsChange?: (open: boolean) => void;
|
|
1506
|
+
/** Called once the current plan has loaded, and again when it changes:
|
|
1507
|
+
* billing's `entitlement` (null from servers without it) and whether the
|
|
1508
|
+
* workspace gets paid features. A workspace spending a sponsor's shared
|
|
1509
|
+
* credits is `paid` on its free plan; gate features on this, not the plan. */
|
|
1510
|
+
onEntitlementChange?: (state: {
|
|
1511
|
+
entitlement: BillingEntitlement | null;
|
|
1512
|
+
paid: boolean;
|
|
1513
|
+
}) => void;
|
|
1442
1514
|
}): react__default.JSX.Element;
|
|
1443
1515
|
|
|
1516
|
+
/** Rows on one page of Billing's Usage logs table. */
|
|
1517
|
+
declare const USAGE_LOGS_PAGE_SIZE = 50;
|
|
1518
|
+
/** Rows per request while exporting: billing's own `limit` ceiling. */
|
|
1519
|
+
declare const USAGE_LOGS_EXPORT_BATCH_SIZE = 100;
|
|
1520
|
+
/** The most rows one CSV export fetches; a larger range is refused. */
|
|
1521
|
+
declare const USAGE_LOGS_EXPORT_MAX_ROWS = 20000;
|
|
1522
|
+
/**
|
|
1523
|
+
* Requests an export may make past the pages `USAGE_LOGS_EXPORT_MAX_ROWS`
|
|
1524
|
+
* needs, to pick up rows that writes during the export pushed further back.
|
|
1525
|
+
*/
|
|
1526
|
+
declare const USAGE_LOGS_EXPORT_EXTRA_REQUESTS = 10;
|
|
1527
|
+
type FetchUsageLogs = (query?: UsageLogsQuery) => Promise<UsageHistoryResponse>;
|
|
1528
|
+
/** One page of the Usage logs table. `page` is 1-based. */
|
|
1529
|
+
interface UsageLogsPage {
|
|
1530
|
+
rows: UsageHistoryItem[];
|
|
1531
|
+
page: number;
|
|
1532
|
+
totalPages: number;
|
|
1533
|
+
total: number;
|
|
1534
|
+
/**
|
|
1535
|
+
* Every row, when the adapter ignored paging and sent them all: Billing
|
|
1536
|
+
* turns pages over these without asking again. Null when billing paged.
|
|
1537
|
+
*/
|
|
1538
|
+
unpaged: UsageHistoryItem[] | null;
|
|
1539
|
+
}
|
|
1540
|
+
/** A page of rows already in hand: an adapter that returned the whole history. */
|
|
1541
|
+
declare function sliceUsageLogsPage(all: UsageHistoryItem[], page: number, pageSize?: number): UsageLogsPage;
|
|
1542
|
+
/**
|
|
1543
|
+
* The table page for `fetchUsageLogs`'s answer to `{ page, limit: pageSize }`.
|
|
1544
|
+
* With billing's `pagination` it is that page as is; without it the adapter
|
|
1545
|
+
* sent everything, and this is `page` of those. Never more than `pageSize` rows.
|
|
1546
|
+
*/
|
|
1547
|
+
declare function usageLogsPage(res: UsageHistoryResponse | null | undefined, page: number, pageSize?: number): UsageLogsPage;
|
|
1548
|
+
declare const EMPTY_USAGE_LOGS_PAGE: UsageLogsPage;
|
|
1549
|
+
/** Billing's Usage logs table: the page on screen and the request behind it. */
|
|
1550
|
+
interface UsageLogsState {
|
|
1551
|
+
logs: UsageLogsPage;
|
|
1552
|
+
/** The page last asked for; Try again asks for it again, not the one on screen. */
|
|
1553
|
+
requestedPage: number;
|
|
1554
|
+
loading: boolean;
|
|
1555
|
+
error: string | null;
|
|
1556
|
+
}
|
|
1557
|
+
declare const INITIAL_USAGE_LOGS_STATE: UsageLogsState;
|
|
1558
|
+
type UsageLogsAction =
|
|
1559
|
+
/** A page was asked for. */
|
|
1560
|
+
{
|
|
1561
|
+
type: "request";
|
|
1562
|
+
page: number;
|
|
1563
|
+
}
|
|
1564
|
+
/** The page asked for arrived. */
|
|
1565
|
+
| {
|
|
1566
|
+
type: "loaded";
|
|
1567
|
+
logs: UsageLogsPage;
|
|
1568
|
+
}
|
|
1569
|
+
/** The page asked for did not; the one on screen stays. */
|
|
1570
|
+
| {
|
|
1571
|
+
type: "failed";
|
|
1572
|
+
error: string;
|
|
1573
|
+
}
|
|
1574
|
+
/** Turn to `page` of the rows an unpaged adapter already sent. */
|
|
1575
|
+
| {
|
|
1576
|
+
type: "turn";
|
|
1577
|
+
page: number;
|
|
1578
|
+
}
|
|
1579
|
+
/** Another workspace: start over at page 1. */
|
|
1580
|
+
| {
|
|
1581
|
+
type: "reset";
|
|
1582
|
+
};
|
|
1583
|
+
declare function usageLogsReducer(state: UsageLogsState, action: UsageLogsAction): UsageLogsState;
|
|
1584
|
+
/**
|
|
1585
|
+
* Whether the usage logs in hand have a row another workspace spent from this
|
|
1586
|
+
* one's shared credits. Every row an unpaged adapter sent counts, not only the
|
|
1587
|
+
* page on screen.
|
|
1588
|
+
*/
|
|
1589
|
+
declare function usageLogsSpentByOthers(logs: UsageLogsPage, workspaceId: string | null | undefined): boolean;
|
|
1590
|
+
interface UsedByNamesLoader {
|
|
1591
|
+
/** Look up `workspaceId`'s names, unless they are saved or being looked up. */
|
|
1592
|
+
load: (workspaceId: string, fetchCreditPool: () => Promise<CreditPoolResponse>) => Promise<void>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Forget what was saved, with the names it saved: the next `load` looks up
|
|
1595
|
+
* again, and an answer still out from before is not saved.
|
|
1596
|
+
*/
|
|
1597
|
+
reset: () => void;
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Looks up the names of the workspaces that spent a workspace's shared
|
|
1601
|
+
* credits, once per workspace. `save` gets each answer and says whether it
|
|
1602
|
+
* kept it (false: that workspace is no longer shown); only a kept answer ends
|
|
1603
|
+
* the lookups for that workspace. A failed or unkept lookup is tried again on
|
|
1604
|
+
* the next call; a call while one for the same workspace is under way starts
|
|
1605
|
+
* no other.
|
|
1606
|
+
*/
|
|
1607
|
+
declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>) => boolean): UsedByNamesLoader;
|
|
1608
|
+
/** The CSV file name for a picked day range, from its local calendar days. */
|
|
1609
|
+
declare function usageLogsExportFileName(start: Date, end: Date): string;
|
|
1610
|
+
/**
|
|
1611
|
+
* ISO bounds for a picked day range in the user's time zone: from the start
|
|
1612
|
+
* of `start`'s day to the last millisecond of `end`'s.
|
|
1613
|
+
*/
|
|
1614
|
+
declare function usageLogsDateRange(start: Date, end: Date): {
|
|
1615
|
+
startDate: string;
|
|
1616
|
+
endDate: string;
|
|
1617
|
+
};
|
|
1618
|
+
type UsageLogsExportResult = {
|
|
1619
|
+
status: "ok";
|
|
1620
|
+
rows: UsageHistoryItem[];
|
|
1621
|
+
total: number;
|
|
1622
|
+
}
|
|
1623
|
+
/** More than `maxRows` rows in the range, by the first count or a later one. */
|
|
1624
|
+
| {
|
|
1625
|
+
status: "too-large";
|
|
1626
|
+
total: number;
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Rows were still missing after `maxRequests` requests: writes kept
|
|
1630
|
+
* shifting billing's pages. Nothing to download.
|
|
1631
|
+
*/
|
|
1632
|
+
| {
|
|
1633
|
+
status: "incomplete";
|
|
1634
|
+
fetched: number;
|
|
1635
|
+
total: number;
|
|
1636
|
+
} | {
|
|
1637
|
+
status: "cancelled";
|
|
1638
|
+
};
|
|
1639
|
+
interface FetchUsageLogsInRangeOptions {
|
|
1640
|
+
batchSize?: number;
|
|
1641
|
+
maxRows?: number;
|
|
1642
|
+
/**
|
|
1643
|
+
* The most requests, the first included. Default: the pages `maxRows`
|
|
1644
|
+
* needs at billing's limit, plus `USAGE_LOGS_EXPORT_EXTRA_REQUESTS`.
|
|
1645
|
+
*/
|
|
1646
|
+
maxRequests?: number;
|
|
1647
|
+
/** After each request: rows so far, and the range's total. */
|
|
1648
|
+
onProgress?: (fetched: number, total: number) => void;
|
|
1649
|
+
/** Stops between requests. */
|
|
1650
|
+
signal?: AbortSignal;
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Every usage log in `range`, fetched `batchSize` at a time. Refuses (status
|
|
1654
|
+
* `too-large`) a range with more than `maxRows`, after one request. Billing
|
|
1655
|
+
* pages newest first by offset, so a row written during the export pushes
|
|
1656
|
+
* older ones onto a later page: it keeps asking while billing says there is a
|
|
1657
|
+
* next page and fewer distinct rows than the range's latest total are in
|
|
1658
|
+
* hand, up to `maxRequests` (then status `incomplete`). An adapter that
|
|
1659
|
+
* ignores the query is asked once, and its rows filtered to the range.
|
|
1660
|
+
* Rejects when a request does.
|
|
1661
|
+
*/
|
|
1662
|
+
declare function fetchUsageLogsInRange(fetchUsageLogs: FetchUsageLogs, range: {
|
|
1663
|
+
startDate: string;
|
|
1664
|
+
endDate: string;
|
|
1665
|
+
}, { batchSize, maxRows, maxRequests, onProgress, signal, }?: FetchUsageLogsInRangeOptions): Promise<UsageLogsExportResult>;
|
|
1666
|
+
/** Header and one row per log, as the Usage logs CSV export writes them. */
|
|
1667
|
+
declare function usageLogsCsvRows(logs: UsageHistoryItem[], userMap: Record<string, string>, formatDate: (iso: string) => string): string[][];
|
|
1668
|
+
/** CSV text: every cell quoted, quotes doubled. */
|
|
1669
|
+
declare function toCsv(rows: string[][]): string;
|
|
1670
|
+
|
|
1444
1671
|
/**
|
|
1445
1672
|
* The one `updateMemberRole` request that saving a member sends, or `null`
|
|
1446
1673
|
* when there is nothing to save.
|
|
@@ -1919,8 +2146,14 @@ interface ExportDateModalProps {
|
|
|
1919
2146
|
title: string;
|
|
1920
2147
|
onClose: () => void;
|
|
1921
2148
|
onExport: (startDate: Date, endDate: Date) => void;
|
|
1922
|
-
|
|
1923
|
-
|
|
2149
|
+
/** An export is running: the button is disabled and reads `busyText`. */
|
|
2150
|
+
busy?: boolean;
|
|
2151
|
+
/** Shown in place of the range while busy, e.g. "Fetched 200 of 1,000 logs…". */
|
|
2152
|
+
busyText?: string;
|
|
2153
|
+
/** Shown under the range, e.g. why the last export did not run. */
|
|
2154
|
+
notice?: string | null;
|
|
2155
|
+
}
|
|
2156
|
+
declare function ExportDateModal({ title, onClose, onExport, busy, busyText, notice, }: ExportDateModalProps): react.JSX.Element;
|
|
1924
2157
|
|
|
1925
2158
|
type CreditCycleUnit = "month" | "year";
|
|
1926
2159
|
type CreditLimitValidation = {
|
|
@@ -2204,6 +2437,78 @@ declare function poolErrorMessage(failure: unknown): string | null;
|
|
|
2204
2437
|
*/
|
|
2205
2438
|
declare function SharedCreditsView(): react.JSX.Element;
|
|
2206
2439
|
|
|
2440
|
+
/**
|
|
2441
|
+
* Whether a workspace gets paid features, and why. Billing reports it at the
|
|
2442
|
+
* top level of the current-subscription answer, beside `data` (200:
|
|
2443
|
+
* `{ success, data, entitlement }`; 404: `{ error, entitlement }`), and
|
|
2444
|
+
* leaves the plan as it is: a workspace spending another's shared credits (a
|
|
2445
|
+
* "sponsored" workspace) still shows the free plan, with
|
|
2446
|
+
* `entitlement.source: 'pool'`.
|
|
2447
|
+
*
|
|
2448
|
+
* So the plan — and every billing action: Upgrade, Cancel downgrade, Buy
|
|
2449
|
+
* credits — stays decided by the plan's amount, and only features are gated
|
|
2450
|
+
* on `entitlement.paid`. Billing servers from before entitlement send none;
|
|
2451
|
+
* then a workspace is paid exactly when its plan is, as before.
|
|
2452
|
+
*/
|
|
2453
|
+
/** `entitlement` as billing sends it, or null when it is absent or malformed. */
|
|
2454
|
+
declare function parseBillingEntitlement(value: unknown): BillingEntitlement | null;
|
|
2455
|
+
/**
|
|
2456
|
+
* The `entitlement` of a current-subscription answer: `body.entitlement`,
|
|
2457
|
+
* never `body.data.entitlement` (`data` is the subscription).
|
|
2458
|
+
*/
|
|
2459
|
+
declare function entitlementFromBody(body: unknown): BillingEntitlement | null;
|
|
2460
|
+
/**
|
|
2461
|
+
* The entitlement a failed read carries: billing's 404 for a workspace with
|
|
2462
|
+
* no subscription of its own still says whether a pool entitles it. The body
|
|
2463
|
+
* is looked for where hosts keep it — the failure itself, `body`, `data`
|
|
2464
|
+
* (`UserFacingError`), `response.data` (axios) and `cause` — to a shallow
|
|
2465
|
+
* depth. Null when there is none.
|
|
2466
|
+
*/
|
|
2467
|
+
declare function entitlementFromFailure(failure: unknown): BillingEntitlement | null;
|
|
2468
|
+
/** Paid by the workspace's own plan: what Buy credits and the plan actions go by. */
|
|
2469
|
+
declare function isPaidPlan(subscription: Pick<BillingSubscription, "plan"> | null | undefined): boolean;
|
|
2470
|
+
/**
|
|
2471
|
+
* Whether the workspace gets paid features: `entitlement.paid` when billing
|
|
2472
|
+
* sent one, else its own plan being paid (servers from before entitlement).
|
|
2473
|
+
*/
|
|
2474
|
+
declare function hasPaidFeatures({ entitlement, subscription, }: {
|
|
2475
|
+
entitlement: BillingEntitlement | null | undefined;
|
|
2476
|
+
subscription: Pick<BillingSubscription, "plan"> | null | undefined;
|
|
2477
|
+
}): boolean;
|
|
2478
|
+
/** A workspace spending another's shared credits, by its entitlement. */
|
|
2479
|
+
declare function isSponsoredEntitlement(entitlement: BillingEntitlement | null | undefined): entitlement is BillingEntitlement & {
|
|
2480
|
+
source: "pool";
|
|
2481
|
+
};
|
|
2482
|
+
/** "Credits shared by Agency." plus " Sharing ends on Mar 1, 2027." when it ends on its own. */
|
|
2483
|
+
declare function sponsoredCreditsText(entitlement: Pick<BillingEntitlement, "sponsorName" | "endsAt">): string;
|
|
2484
|
+
interface CurrentPlanState {
|
|
2485
|
+
/** The workspace's own subscription; null without one. */
|
|
2486
|
+
subscription: BillingSubscription | null;
|
|
2487
|
+
/** Null when billing sent none (servers from before entitlement). */
|
|
2488
|
+
entitlement: BillingEntitlement | null;
|
|
2489
|
+
/** Gate features on this; see `hasPaidFeatures`. */
|
|
2490
|
+
paid: boolean;
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Read the current plan and its entitlement through the host's
|
|
2494
|
+
* `fetchCurrentPlan`. A failure that carries an entitlement — billing's 404
|
|
2495
|
+
* for a sponsored workspace with no subscription of its own — is not an
|
|
2496
|
+
* error: it answers no subscription with that entitlement. Any other failure
|
|
2497
|
+
* is thrown, as before.
|
|
2498
|
+
*/
|
|
2499
|
+
declare function loadCurrentPlan(fetchCurrentPlan: () => Promise<SubscriptionResponse>): Promise<CurrentPlanState>;
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* `loadCurrentPlan` as a hook, for a host gating features on `paid`. Reloads
|
|
2503
|
+
* when `key` (e.g. the workspace id) changes; `fetchCurrentPlan` may be a new
|
|
2504
|
+
* function every render. `state` is null while loading, after a failure, and
|
|
2505
|
+
* while `key` is null.
|
|
2506
|
+
*/
|
|
2507
|
+
declare function useBillingEntitlement(fetchCurrentPlan: (() => Promise<SubscriptionResponse>) | null | undefined, key: string | null | undefined): {
|
|
2508
|
+
state: CurrentPlanState | null;
|
|
2509
|
+
loading: boolean;
|
|
2510
|
+
};
|
|
2511
|
+
|
|
2207
2512
|
type CreditPoolMemberModalProps = {
|
|
2208
2513
|
kind: "add";
|
|
2209
2514
|
/** Workspaces credits can be shared with. */
|
|
@@ -2331,4 +2636,4 @@ interface AppSettingsRowProps {
|
|
|
2331
2636
|
}
|
|
2332
2637
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
2333
2638
|
|
|
2334
|
-
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, 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_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, 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, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, expiryChoiceFor, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, isLimitBelowUsage, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadWorkspaceOrganization, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, readSettingsCaller, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, toLocalDateInput, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|
|
2639
|
+
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, BillingContent, type BillingEntitlement, 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 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 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_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, 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, 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_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, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, readSettingsCaller, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sponsoredCreditsText, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|