@streamoid/settings 0.22.1 → 0.22.3
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 -2
- package/dist/index.d.mts +49 -5
- package/dist/index.d.ts +49 -5
- package/dist/index.js +47 -28
- package/dist/index.mjs +47 -28
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -173,8 +173,13 @@ Billing hides an entry whose adapter method is absent:
|
|
|
173
173
|
`removeCreditPoolMember` and `fetchCreditPoolCandidates` light up the rest.
|
|
174
174
|
Only organization admins change them; the server says so with `canManage`.
|
|
175
175
|
A member's balance (`fetchAvailableCredits`) carries `sharedPool`, which
|
|
176
|
-
Billing shows as a banner
|
|
177
|
-
|
|
176
|
+
Billing shows as a banner. A workspace whose pool has `members` or
|
|
177
|
+
`formerMembers` (`poolSharesCredits`) gets a Workspace column in its usage
|
|
178
|
+
logs, on every page: "This workspace", or "Used by <name>" for rows whose
|
|
179
|
+
`meta.usedBy` is another workspace, named from those members. Without
|
|
180
|
+
`fetchCreditPool` the column shows from the first loaded page with such a
|
|
181
|
+
row (every row, for an adapter that sends them all) and stays on every page
|
|
182
|
+
until the workspace changes; those rows read "Used by another workspace".
|
|
178
183
|
`setCreditPoolSelfShare` and `removeCreditPoolSelfShare` (mirroring
|
|
179
184
|
`PUT|DELETE /workspace/:id/credit-pool/self`) add a "This workspace" row:
|
|
180
185
|
the share the sponsor keeps for itself. A percent self share counts in the
|
package/dist/index.d.mts
CHANGED
|
@@ -1700,6 +1700,25 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
|
|
|
1700
1700
|
};
|
|
1701
1701
|
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
1702
1702
|
|
|
1703
|
+
declare function UsageLogsTable({ logs, userMap, loading, error, onRetry, currentWorkspaceId, usedByNames, showWorkspace, }: {
|
|
1704
|
+
/** One page of rows: the table renders every row it is given. */
|
|
1705
|
+
logs: UsageHistoryItem[];
|
|
1706
|
+
userMap: Record<string, string>;
|
|
1707
|
+
loading: boolean;
|
|
1708
|
+
/** Shown in place of the rows when the page could not be loaded. */
|
|
1709
|
+
error?: string | null;
|
|
1710
|
+
onRetry?: () => void;
|
|
1711
|
+
/** Rows another workspace spent from this one's shared credits name it. */
|
|
1712
|
+
currentWorkspaceId?: string | null;
|
|
1713
|
+
/** Those workspaces' names, by lower-cased id. */
|
|
1714
|
+
usedByNames?: Record<string, string>;
|
|
1715
|
+
/**
|
|
1716
|
+
* A "Workspace" column: which workspace spent each row, for a workspace that
|
|
1717
|
+
* shares its credits (`poolSharesCredits`). The table's own decision, not
|
|
1718
|
+
* the rows': every page has the same columns.
|
|
1719
|
+
*/
|
|
1720
|
+
showWorkspace?: boolean;
|
|
1721
|
+
}): react__default.JSX.Element;
|
|
1703
1722
|
/** Previous / Next under the Usage logs table, with the page and the total. */
|
|
1704
1723
|
declare function UsageLogsPager({ page, totalPages, total, loading, onPageChange, }: {
|
|
1705
1724
|
/** 1-based. */
|
|
@@ -1825,6 +1844,12 @@ interface UsageLogsState {
|
|
|
1825
1844
|
requestedPage: number;
|
|
1826
1845
|
loading: boolean;
|
|
1827
1846
|
error: string | null;
|
|
1847
|
+
/**
|
|
1848
|
+
* Some page loaded for this workspace had a row another workspace spent
|
|
1849
|
+
* (`usageLogsSpentByOthers`); stays true until `reset`. The Workspace
|
|
1850
|
+
* column's decision for a host without `fetchCreditPool`.
|
|
1851
|
+
*/
|
|
1852
|
+
spentByOthers: boolean;
|
|
1828
1853
|
}
|
|
1829
1854
|
declare const INITIAL_USAGE_LOGS_STATE: UsageLogsState;
|
|
1830
1855
|
type UsageLogsAction =
|
|
@@ -1833,10 +1858,11 @@ type UsageLogsAction =
|
|
|
1833
1858
|
type: "request";
|
|
1834
1859
|
page: number;
|
|
1835
1860
|
}
|
|
1836
|
-
/** The page asked for arrived
|
|
1861
|
+
/** The page asked for arrived, for workspace `workspaceId`. */
|
|
1837
1862
|
| {
|
|
1838
1863
|
type: "loaded";
|
|
1839
1864
|
logs: UsageLogsPage;
|
|
1865
|
+
workspaceId?: string | null;
|
|
1840
1866
|
}
|
|
1841
1867
|
/** The page asked for did not; the one on screen stays. */
|
|
1842
1868
|
| {
|
|
@@ -1866,6 +1892,17 @@ declare function usageLogsReloadPage(state: UsageLogsState): number;
|
|
|
1866
1892
|
* page on screen.
|
|
1867
1893
|
*/
|
|
1868
1894
|
declare function usageLogsSpentByOthers(logs: UsageLogsPage, workspaceId: string | null | undefined): boolean;
|
|
1895
|
+
/**
|
|
1896
|
+
* Whether the Usage logs table shows its Workspace column: the same on every
|
|
1897
|
+
* page of a workspace's logs. With `fetchCreditPool`, whether the workspace
|
|
1898
|
+
* shares its credits or did (`poolSharesCredits`). Without it, whether any
|
|
1899
|
+
* page loaded for the workspace so far had a row another workspace spent:
|
|
1900
|
+
* once shown it stays, on every page, until another workspace.
|
|
1901
|
+
*/
|
|
1902
|
+
declare function usageLogsShowWorkspace(state: Pick<UsageLogsState, "spentByOthers">, pool: {
|
|
1903
|
+
hasCreditPool: boolean;
|
|
1904
|
+
sharesCredits: boolean;
|
|
1905
|
+
}): boolean;
|
|
1869
1906
|
interface UsedByNamesLoader {
|
|
1870
1907
|
/** Look up `workspaceId`'s names, unless they are saved or being looked up. */
|
|
1871
1908
|
load: (workspaceId: string, fetchCreditPool: () => Promise<CreditPoolResponse>) => Promise<void>;
|
|
@@ -1876,14 +1913,15 @@ interface UsedByNamesLoader {
|
|
|
1876
1913
|
reset: () => void;
|
|
1877
1914
|
}
|
|
1878
1915
|
/**
|
|
1879
|
-
* Looks up
|
|
1880
|
-
*
|
|
1916
|
+
* Looks up a workspace's credit pool, once per workspace: the names of the
|
|
1917
|
+
* workspaces that spent its shared credits, and the pool itself (whether it
|
|
1918
|
+
* shares them at all). `save` gets each answer and says whether it
|
|
1881
1919
|
* kept it (false: that workspace is no longer shown); only a kept answer ends
|
|
1882
1920
|
* the lookups for that workspace. A failed or unkept lookup is tried again on
|
|
1883
1921
|
* the next call; a call while one for the same workspace is under way starts
|
|
1884
1922
|
* no other.
|
|
1885
1923
|
*/
|
|
1886
|
-
declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string
|
|
1924
|
+
declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>, pool: CreditPoolResponse) => boolean): UsedByNamesLoader;
|
|
1887
1925
|
/** The CSV file name for a picked day range, from its local calendar days. */
|
|
1888
1926
|
declare function usageLogsExportFileName(start: Date, end: Date): string;
|
|
1889
1927
|
/**
|
|
@@ -2860,6 +2898,12 @@ declare function usedByWorkspaceKey(log: Pick<UsageHistoryItem, "meta">, current
|
|
|
2860
2898
|
* whose rows stay in its history.
|
|
2861
2899
|
*/
|
|
2862
2900
|
declare function usedByNamesFrom(pool: Pick<CreditPoolResponse, "members" | "formerMembers"> | null | undefined): Record<string, string>;
|
|
2901
|
+
/**
|
|
2902
|
+
* Whether other workspaces may have spent this one's credits: it shares them,
|
|
2903
|
+
* or did. The usage logs table's "Workspace" column follows this, the same on
|
|
2904
|
+
* every page, never the rows of the page on screen.
|
|
2905
|
+
*/
|
|
2906
|
+
declare function poolSharesCredits(pool: Pick<CreditPoolResponse, "members" | "formerMembers"> | null | undefined): boolean;
|
|
2863
2907
|
declare const POOL_ERROR_CODES: readonly ["SPONSOR_ON_FREE_PLAN", "POOL_NOT_ALLOWED"];
|
|
2864
2908
|
type PoolErrorCode = (typeof POOL_ERROR_CODES)[number];
|
|
2865
2909
|
/** The billing pool error in a failure: its code, details and server message. */
|
|
@@ -3115,4 +3159,4 @@ interface AppSettingsRowProps {
|
|
|
3115
3159
|
}
|
|
3116
3160
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
3117
3161
|
|
|
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 };
|
|
3162
|
+
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, UsageLogsTable, 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, poolSharesCredits, 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, usageLogsShowWorkspace, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1700,6 +1700,25 @@ type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width'
|
|
|
1700
1700
|
};
|
|
1701
1701
|
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
1702
1702
|
|
|
1703
|
+
declare function UsageLogsTable({ logs, userMap, loading, error, onRetry, currentWorkspaceId, usedByNames, showWorkspace, }: {
|
|
1704
|
+
/** One page of rows: the table renders every row it is given. */
|
|
1705
|
+
logs: UsageHistoryItem[];
|
|
1706
|
+
userMap: Record<string, string>;
|
|
1707
|
+
loading: boolean;
|
|
1708
|
+
/** Shown in place of the rows when the page could not be loaded. */
|
|
1709
|
+
error?: string | null;
|
|
1710
|
+
onRetry?: () => void;
|
|
1711
|
+
/** Rows another workspace spent from this one's shared credits name it. */
|
|
1712
|
+
currentWorkspaceId?: string | null;
|
|
1713
|
+
/** Those workspaces' names, by lower-cased id. */
|
|
1714
|
+
usedByNames?: Record<string, string>;
|
|
1715
|
+
/**
|
|
1716
|
+
* A "Workspace" column: which workspace spent each row, for a workspace that
|
|
1717
|
+
* shares its credits (`poolSharesCredits`). The table's own decision, not
|
|
1718
|
+
* the rows': every page has the same columns.
|
|
1719
|
+
*/
|
|
1720
|
+
showWorkspace?: boolean;
|
|
1721
|
+
}): react__default.JSX.Element;
|
|
1703
1722
|
/** Previous / Next under the Usage logs table, with the page and the total. */
|
|
1704
1723
|
declare function UsageLogsPager({ page, totalPages, total, loading, onPageChange, }: {
|
|
1705
1724
|
/** 1-based. */
|
|
@@ -1825,6 +1844,12 @@ interface UsageLogsState {
|
|
|
1825
1844
|
requestedPage: number;
|
|
1826
1845
|
loading: boolean;
|
|
1827
1846
|
error: string | null;
|
|
1847
|
+
/**
|
|
1848
|
+
* Some page loaded for this workspace had a row another workspace spent
|
|
1849
|
+
* (`usageLogsSpentByOthers`); stays true until `reset`. The Workspace
|
|
1850
|
+
* column's decision for a host without `fetchCreditPool`.
|
|
1851
|
+
*/
|
|
1852
|
+
spentByOthers: boolean;
|
|
1828
1853
|
}
|
|
1829
1854
|
declare const INITIAL_USAGE_LOGS_STATE: UsageLogsState;
|
|
1830
1855
|
type UsageLogsAction =
|
|
@@ -1833,10 +1858,11 @@ type UsageLogsAction =
|
|
|
1833
1858
|
type: "request";
|
|
1834
1859
|
page: number;
|
|
1835
1860
|
}
|
|
1836
|
-
/** The page asked for arrived
|
|
1861
|
+
/** The page asked for arrived, for workspace `workspaceId`. */
|
|
1837
1862
|
| {
|
|
1838
1863
|
type: "loaded";
|
|
1839
1864
|
logs: UsageLogsPage;
|
|
1865
|
+
workspaceId?: string | null;
|
|
1840
1866
|
}
|
|
1841
1867
|
/** The page asked for did not; the one on screen stays. */
|
|
1842
1868
|
| {
|
|
@@ -1866,6 +1892,17 @@ declare function usageLogsReloadPage(state: UsageLogsState): number;
|
|
|
1866
1892
|
* page on screen.
|
|
1867
1893
|
*/
|
|
1868
1894
|
declare function usageLogsSpentByOthers(logs: UsageLogsPage, workspaceId: string | null | undefined): boolean;
|
|
1895
|
+
/**
|
|
1896
|
+
* Whether the Usage logs table shows its Workspace column: the same on every
|
|
1897
|
+
* page of a workspace's logs. With `fetchCreditPool`, whether the workspace
|
|
1898
|
+
* shares its credits or did (`poolSharesCredits`). Without it, whether any
|
|
1899
|
+
* page loaded for the workspace so far had a row another workspace spent:
|
|
1900
|
+
* once shown it stays, on every page, until another workspace.
|
|
1901
|
+
*/
|
|
1902
|
+
declare function usageLogsShowWorkspace(state: Pick<UsageLogsState, "spentByOthers">, pool: {
|
|
1903
|
+
hasCreditPool: boolean;
|
|
1904
|
+
sharesCredits: boolean;
|
|
1905
|
+
}): boolean;
|
|
1869
1906
|
interface UsedByNamesLoader {
|
|
1870
1907
|
/** Look up `workspaceId`'s names, unless they are saved or being looked up. */
|
|
1871
1908
|
load: (workspaceId: string, fetchCreditPool: () => Promise<CreditPoolResponse>) => Promise<void>;
|
|
@@ -1876,14 +1913,15 @@ interface UsedByNamesLoader {
|
|
|
1876
1913
|
reset: () => void;
|
|
1877
1914
|
}
|
|
1878
1915
|
/**
|
|
1879
|
-
* Looks up
|
|
1880
|
-
*
|
|
1916
|
+
* Looks up a workspace's credit pool, once per workspace: the names of the
|
|
1917
|
+
* workspaces that spent its shared credits, and the pool itself (whether it
|
|
1918
|
+
* shares them at all). `save` gets each answer and says whether it
|
|
1881
1919
|
* kept it (false: that workspace is no longer shown); only a kept answer ends
|
|
1882
1920
|
* the lookups for that workspace. A failed or unkept lookup is tried again on
|
|
1883
1921
|
* the next call; a call while one for the same workspace is under way starts
|
|
1884
1922
|
* no other.
|
|
1885
1923
|
*/
|
|
1886
|
-
declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string
|
|
1924
|
+
declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>, pool: CreditPoolResponse) => boolean): UsedByNamesLoader;
|
|
1887
1925
|
/** The CSV file name for a picked day range, from its local calendar days. */
|
|
1888
1926
|
declare function usageLogsExportFileName(start: Date, end: Date): string;
|
|
1889
1927
|
/**
|
|
@@ -2860,6 +2898,12 @@ declare function usedByWorkspaceKey(log: Pick<UsageHistoryItem, "meta">, current
|
|
|
2860
2898
|
* whose rows stay in its history.
|
|
2861
2899
|
*/
|
|
2862
2900
|
declare function usedByNamesFrom(pool: Pick<CreditPoolResponse, "members" | "formerMembers"> | null | undefined): Record<string, string>;
|
|
2901
|
+
/**
|
|
2902
|
+
* Whether other workspaces may have spent this one's credits: it shares them,
|
|
2903
|
+
* or did. The usage logs table's "Workspace" column follows this, the same on
|
|
2904
|
+
* every page, never the rows of the page on screen.
|
|
2905
|
+
*/
|
|
2906
|
+
declare function poolSharesCredits(pool: Pick<CreditPoolResponse, "members" | "formerMembers"> | null | undefined): boolean;
|
|
2863
2907
|
declare const POOL_ERROR_CODES: readonly ["SPONSOR_ON_FREE_PLAN", "POOL_NOT_ALLOWED"];
|
|
2864
2908
|
type PoolErrorCode = (typeof POOL_ERROR_CODES)[number];
|
|
2865
2909
|
/** The billing pool error in a failure: its code, details and server message. */
|
|
@@ -3115,4 +3159,4 @@ interface AppSettingsRowProps {
|
|
|
3115
3159
|
}
|
|
3116
3160
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
3117
3161
|
|
|
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 };
|
|
3162
|
+
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, UsageLogsTable, 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, poolSharesCredits, 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, usageLogsShowWorkspace, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
|
package/dist/index.js
CHANGED
|
@@ -84,6 +84,7 @@ __export(index_exports, {
|
|
|
84
84
|
USAGE_LOGS_PAGE_SIZE: () => USAGE_LOGS_PAGE_SIZE,
|
|
85
85
|
USER_LANGUAGES: () => USER_LANGUAGES,
|
|
86
86
|
UsageLogsPager: () => UsageLogsPager,
|
|
87
|
+
UsageLogsTable: () => UsageLogsTable,
|
|
87
88
|
WORKSPACE_CREDIT_LIMIT_REACHED: () => WORKSPACE_CREDIT_LIMIT_REACHED,
|
|
88
89
|
WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE: () => WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE,
|
|
89
90
|
WORKSPACE_LIST_PAGE_SIZE: () => WORKSPACE_LIST_PAGE_SIZE,
|
|
@@ -149,6 +150,7 @@ __export(index_exports, {
|
|
|
149
150
|
poolEndsAtFrom: () => poolEndsAtFrom,
|
|
150
151
|
poolErrorMessage: () => poolErrorMessage,
|
|
151
152
|
poolRenewsAtCycleEnd: () => poolRenewsAtCycleEnd,
|
|
153
|
+
poolSharesCredits: () => poolSharesCredits,
|
|
152
154
|
poolUnallocatedPercent: () => poolUnallocatedPercent,
|
|
153
155
|
poolWorkspaceName: () => poolWorkspaceName,
|
|
154
156
|
productsForCountry: () => productsForCountry,
|
|
@@ -178,6 +180,7 @@ __export(index_exports, {
|
|
|
178
180
|
usageLogsPage: () => usageLogsPage,
|
|
179
181
|
usageLogsReducer: () => usageLogsReducer,
|
|
180
182
|
usageLogsReloadPage: () => usageLogsReloadPage,
|
|
183
|
+
usageLogsShowWorkspace: () => usageLogsShowWorkspace,
|
|
181
184
|
usageLogsSpentByOthers: () => usageLogsSpentByOthers,
|
|
182
185
|
useBillingEntitlement: () => useBillingEntitlement,
|
|
183
186
|
useSettingsAdapters: () => useSettingsAdapters,
|
|
@@ -10361,6 +10364,9 @@ function usedByNamesFrom(pool) {
|
|
|
10361
10364
|
}
|
|
10362
10365
|
return names;
|
|
10363
10366
|
}
|
|
10367
|
+
function poolSharesCredits(pool) {
|
|
10368
|
+
return (pool?.members?.length ?? 0) > 0 || (pool?.formerMembers?.length ?? 0) > 0;
|
|
10369
|
+
}
|
|
10364
10370
|
var POOL_ERROR_CODES = ["SPONSOR_ON_FREE_PLAN", "POOL_NOT_ALLOWED"];
|
|
10365
10371
|
function findPoolError(failure) {
|
|
10366
10372
|
const error = findBillingError(failure, POOL_ERROR_CODES);
|
|
@@ -11513,7 +11519,8 @@ var INITIAL_USAGE_LOGS_STATE = {
|
|
|
11513
11519
|
logs: EMPTY_USAGE_LOGS_PAGE,
|
|
11514
11520
|
requestedPage: 1,
|
|
11515
11521
|
loading: false,
|
|
11516
|
-
error: null
|
|
11522
|
+
error: null,
|
|
11523
|
+
spentByOthers: false
|
|
11517
11524
|
};
|
|
11518
11525
|
function usageLogsReducer(state, action) {
|
|
11519
11526
|
switch (action.type) {
|
|
@@ -11524,7 +11531,8 @@ function usageLogsReducer(state, action) {
|
|
|
11524
11531
|
logs: action.logs,
|
|
11525
11532
|
requestedPage: action.logs.page,
|
|
11526
11533
|
loading: false,
|
|
11527
|
-
error: null
|
|
11534
|
+
error: null,
|
|
11535
|
+
spentByOthers: state.spentByOthers || usageLogsSpentByOthers(action.logs, action.workspaceId)
|
|
11528
11536
|
};
|
|
11529
11537
|
case "failed":
|
|
11530
11538
|
return { ...state, loading: false, error: action.error };
|
|
@@ -11545,6 +11553,9 @@ function usageLogsSpentByOthers(logs, workspaceId) {
|
|
|
11545
11553
|
(log) => usedByWorkspaceKey(log, workspaceId) !== null
|
|
11546
11554
|
);
|
|
11547
11555
|
}
|
|
11556
|
+
function usageLogsShowWorkspace(state, pool) {
|
|
11557
|
+
return pool.hasCreditPool ? pool.sharesCredits : state.spentByOthers;
|
|
11558
|
+
}
|
|
11548
11559
|
function createUsedByNamesLoader(save) {
|
|
11549
11560
|
let savedFor = null;
|
|
11550
11561
|
let inFlight = null;
|
|
@@ -11558,7 +11569,7 @@ function createUsedByNamesLoader(save) {
|
|
|
11558
11569
|
try {
|
|
11559
11570
|
const pool = await fetchCreditPool();
|
|
11560
11571
|
if (inFlight !== lookup) return;
|
|
11561
|
-
if (save(workspaceId, usedByNamesFrom(pool))) savedFor = workspaceId;
|
|
11572
|
+
if (save(workspaceId, usedByNamesFrom(pool), pool)) savedFor = workspaceId;
|
|
11562
11573
|
} catch {
|
|
11563
11574
|
} finally {
|
|
11564
11575
|
if (inFlight === lookup) inFlight = null;
|
|
@@ -12539,9 +12550,9 @@ function UsageLogsTable({
|
|
|
12539
12550
|
error = null,
|
|
12540
12551
|
onRetry,
|
|
12541
12552
|
currentWorkspaceId = null,
|
|
12542
|
-
usedByNames = {}
|
|
12553
|
+
usedByNames = {},
|
|
12554
|
+
showWorkspace = false
|
|
12543
12555
|
}) {
|
|
12544
|
-
const showWorkspace = logs.some((log) => usedByWorkspaceKey(log, currentWorkspaceId));
|
|
12545
12556
|
if (loading) {
|
|
12546
12557
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
12547
12558
|
"div",
|
|
@@ -12931,6 +12942,7 @@ function BillingContent({
|
|
|
12931
12942
|
const [sharedPool, setSharedPool] = (0, import_react24.useState)(null);
|
|
12932
12943
|
const [sponsorShare, setSponsorShare] = (0, import_react24.useState)(null);
|
|
12933
12944
|
const [usedByNames, setUsedByNames] = (0, import_react24.useState)({});
|
|
12945
|
+
const [sharesCredits, setSharesCredits] = (0, import_react24.useState)(false);
|
|
12934
12946
|
const [allProducts, setProducts] = (0, import_react24.useState)([]);
|
|
12935
12947
|
const workspaceCountry = workspace.current?.country;
|
|
12936
12948
|
const products = (0, import_react24.useMemo)(
|
|
@@ -12954,9 +12966,10 @@ function BillingContent({
|
|
|
12954
12966
|
const workspaceIdRef = (0, import_react24.useRef)(workspaceId);
|
|
12955
12967
|
workspaceIdRef.current = workspaceId;
|
|
12956
12968
|
const loadUsedByNamesRef = (0, import_react24.useRef)(null);
|
|
12957
|
-
loadUsedByNamesRef.current ??= createUsedByNamesLoader((forWorkspace, names) => {
|
|
12969
|
+
loadUsedByNamesRef.current ??= createUsedByNamesLoader((forWorkspace, names, pool) => {
|
|
12958
12970
|
if (forWorkspace !== workspaceIdRef.current) return false;
|
|
12959
12971
|
setUsedByNames(names);
|
|
12972
|
+
setSharesCredits(poolSharesCredits(pool));
|
|
12960
12973
|
return true;
|
|
12961
12974
|
});
|
|
12962
12975
|
const [userMap, setUserMap] = (0, import_react24.useState)({});
|
|
@@ -13047,19 +13060,14 @@ function BillingContent({
|
|
|
13047
13060
|
} catch {
|
|
13048
13061
|
}
|
|
13049
13062
|
}, [api]);
|
|
13050
|
-
const ensureUsedByNames = (0, import_react24.useCallback)(
|
|
13051
|
-
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
() => fetchCreditPool.call(api)
|
|
13059
|
-
);
|
|
13060
|
-
},
|
|
13061
|
-
[api, workspaceId]
|
|
13062
|
-
);
|
|
13063
|
+
const ensureUsedByNames = (0, import_react24.useCallback)(() => {
|
|
13064
|
+
const fetchCreditPool = api.fetchCreditPool;
|
|
13065
|
+
if (!fetchCreditPool || !workspaceId) return;
|
|
13066
|
+
void loadUsedByNamesRef.current?.load(
|
|
13067
|
+
workspaceId,
|
|
13068
|
+
() => fetchCreditPool.call(api)
|
|
13069
|
+
);
|
|
13070
|
+
}, [api, workspaceId]);
|
|
13063
13071
|
const loadUsageLogsPage = (0, import_react24.useCallback)(
|
|
13064
13072
|
async (page) => {
|
|
13065
13073
|
const request = ++usageLogsRequestRef.current;
|
|
@@ -13068,6 +13076,7 @@ function BillingContent({
|
|
|
13068
13076
|
return;
|
|
13069
13077
|
}
|
|
13070
13078
|
dispatchUsageLogs({ type: "request", page });
|
|
13079
|
+
ensureUsedByNames();
|
|
13071
13080
|
try {
|
|
13072
13081
|
const res = await api.fetchUsageLogs({
|
|
13073
13082
|
page,
|
|
@@ -13075,8 +13084,11 @@ function BillingContent({
|
|
|
13075
13084
|
});
|
|
13076
13085
|
if (request !== usageLogsRequestRef.current) return;
|
|
13077
13086
|
const next = usageLogsPage(res, page);
|
|
13078
|
-
dispatchUsageLogs({
|
|
13079
|
-
|
|
13087
|
+
dispatchUsageLogs({
|
|
13088
|
+
type: "loaded",
|
|
13089
|
+
logs: next,
|
|
13090
|
+
workspaceId: workspaceIdRef.current
|
|
13091
|
+
});
|
|
13080
13092
|
} catch (err) {
|
|
13081
13093
|
if (request !== usageLogsRequestRef.current) return;
|
|
13082
13094
|
dispatchUsageLogs({
|
|
@@ -13091,7 +13103,7 @@ function BillingContent({
|
|
|
13091
13103
|
(page) => {
|
|
13092
13104
|
if (usageLogs.unpaged && !usageLogsError) {
|
|
13093
13105
|
dispatchUsageLogs({ type: "turn", page });
|
|
13094
|
-
ensureUsedByNames(
|
|
13106
|
+
ensureUsedByNames();
|
|
13095
13107
|
return;
|
|
13096
13108
|
}
|
|
13097
13109
|
void loadUsageLogsPage(page);
|
|
@@ -13241,6 +13253,7 @@ function BillingContent({
|
|
|
13241
13253
|
usageLogsStateRef.current = INITIAL_USAGE_LOGS_STATE;
|
|
13242
13254
|
loadUsedByNamesRef.current?.reset();
|
|
13243
13255
|
setUsedByNames({});
|
|
13256
|
+
setSharesCredits(false);
|
|
13244
13257
|
}, [workspaceId]);
|
|
13245
13258
|
(0, import_react24.useEffect)(() => {
|
|
13246
13259
|
setInitialFetchTriggered(true);
|
|
@@ -13945,7 +13958,11 @@ function BillingContent({
|
|
|
13945
13958
|
error: usageLogsError,
|
|
13946
13959
|
onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
|
|
13947
13960
|
currentWorkspaceId: workspaceId,
|
|
13948
|
-
usedByNames
|
|
13961
|
+
usedByNames,
|
|
13962
|
+
showWorkspace: usageLogsShowWorkspace(usageLogsState, {
|
|
13963
|
+
hasCreditPool: Boolean(api.fetchCreditPool),
|
|
13964
|
+
sharesCredits
|
|
13965
|
+
})
|
|
13949
13966
|
}
|
|
13950
13967
|
),
|
|
13951
13968
|
!usageLogsError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -17244,11 +17261,13 @@ function SettingsContentInner({
|
|
|
17244
17261
|
return true;
|
|
17245
17262
|
};
|
|
17246
17263
|
(0, import_react29.useEffect)(() => {
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17264
|
+
setLocalWorkspaces(null);
|
|
17265
|
+
}, [workspaceId]);
|
|
17266
|
+
const displayWorkspaces = (localWorkspaces ?? workspaceList.map(toWorkspaceData)).map(
|
|
17267
|
+
(ws) => toWorkspaceInfo(
|
|
17268
|
+
workspaceId ? { ...ws, isCurrent: ws.id === workspaceId } : ws
|
|
17269
|
+
)
|
|
17270
|
+
);
|
|
17252
17271
|
const currentWorkspaceInfo = displayWorkspaces.find((ws) => ws.isCurrent) ?? null;
|
|
17253
17272
|
const currentWorkspaceData = currentWorkspaceInfo ? {
|
|
17254
17273
|
...toWorkspaceData(currentWorkspaceInfo),
|
package/dist/index.mjs
CHANGED
|
@@ -10239,6 +10239,9 @@ function usedByNamesFrom(pool) {
|
|
|
10239
10239
|
}
|
|
10240
10240
|
return names;
|
|
10241
10241
|
}
|
|
10242
|
+
function poolSharesCredits(pool) {
|
|
10243
|
+
return (pool?.members?.length ?? 0) > 0 || (pool?.formerMembers?.length ?? 0) > 0;
|
|
10244
|
+
}
|
|
10242
10245
|
var POOL_ERROR_CODES = ["SPONSOR_ON_FREE_PLAN", "POOL_NOT_ALLOWED"];
|
|
10243
10246
|
function findPoolError(failure) {
|
|
10244
10247
|
const error = findBillingError(failure, POOL_ERROR_CODES);
|
|
@@ -11391,7 +11394,8 @@ var INITIAL_USAGE_LOGS_STATE = {
|
|
|
11391
11394
|
logs: EMPTY_USAGE_LOGS_PAGE,
|
|
11392
11395
|
requestedPage: 1,
|
|
11393
11396
|
loading: false,
|
|
11394
|
-
error: null
|
|
11397
|
+
error: null,
|
|
11398
|
+
spentByOthers: false
|
|
11395
11399
|
};
|
|
11396
11400
|
function usageLogsReducer(state, action) {
|
|
11397
11401
|
switch (action.type) {
|
|
@@ -11402,7 +11406,8 @@ function usageLogsReducer(state, action) {
|
|
|
11402
11406
|
logs: action.logs,
|
|
11403
11407
|
requestedPage: action.logs.page,
|
|
11404
11408
|
loading: false,
|
|
11405
|
-
error: null
|
|
11409
|
+
error: null,
|
|
11410
|
+
spentByOthers: state.spentByOthers || usageLogsSpentByOthers(action.logs, action.workspaceId)
|
|
11406
11411
|
};
|
|
11407
11412
|
case "failed":
|
|
11408
11413
|
return { ...state, loading: false, error: action.error };
|
|
@@ -11423,6 +11428,9 @@ function usageLogsSpentByOthers(logs, workspaceId) {
|
|
|
11423
11428
|
(log) => usedByWorkspaceKey(log, workspaceId) !== null
|
|
11424
11429
|
);
|
|
11425
11430
|
}
|
|
11431
|
+
function usageLogsShowWorkspace(state, pool) {
|
|
11432
|
+
return pool.hasCreditPool ? pool.sharesCredits : state.spentByOthers;
|
|
11433
|
+
}
|
|
11426
11434
|
function createUsedByNamesLoader(save) {
|
|
11427
11435
|
let savedFor = null;
|
|
11428
11436
|
let inFlight = null;
|
|
@@ -11436,7 +11444,7 @@ function createUsedByNamesLoader(save) {
|
|
|
11436
11444
|
try {
|
|
11437
11445
|
const pool = await fetchCreditPool();
|
|
11438
11446
|
if (inFlight !== lookup) return;
|
|
11439
|
-
if (save(workspaceId, usedByNamesFrom(pool))) savedFor = workspaceId;
|
|
11447
|
+
if (save(workspaceId, usedByNamesFrom(pool), pool)) savedFor = workspaceId;
|
|
11440
11448
|
} catch {
|
|
11441
11449
|
} finally {
|
|
11442
11450
|
if (inFlight === lookup) inFlight = null;
|
|
@@ -12417,9 +12425,9 @@ function UsageLogsTable({
|
|
|
12417
12425
|
error = null,
|
|
12418
12426
|
onRetry,
|
|
12419
12427
|
currentWorkspaceId = null,
|
|
12420
|
-
usedByNames = {}
|
|
12428
|
+
usedByNames = {},
|
|
12429
|
+
showWorkspace = false
|
|
12421
12430
|
}) {
|
|
12422
|
-
const showWorkspace = logs.some((log) => usedByWorkspaceKey(log, currentWorkspaceId));
|
|
12423
12431
|
if (loading) {
|
|
12424
12432
|
return /* @__PURE__ */ jsx30(
|
|
12425
12433
|
"div",
|
|
@@ -12809,6 +12817,7 @@ function BillingContent({
|
|
|
12809
12817
|
const [sharedPool, setSharedPool] = useState22(null);
|
|
12810
12818
|
const [sponsorShare, setSponsorShare] = useState22(null);
|
|
12811
12819
|
const [usedByNames, setUsedByNames] = useState22({});
|
|
12820
|
+
const [sharesCredits, setSharesCredits] = useState22(false);
|
|
12812
12821
|
const [allProducts, setProducts] = useState22([]);
|
|
12813
12822
|
const workspaceCountry = workspace.current?.country;
|
|
12814
12823
|
const products = useMemo4(
|
|
@@ -12832,9 +12841,10 @@ function BillingContent({
|
|
|
12832
12841
|
const workspaceIdRef = useRef12(workspaceId);
|
|
12833
12842
|
workspaceIdRef.current = workspaceId;
|
|
12834
12843
|
const loadUsedByNamesRef = useRef12(null);
|
|
12835
|
-
loadUsedByNamesRef.current ??= createUsedByNamesLoader((forWorkspace, names) => {
|
|
12844
|
+
loadUsedByNamesRef.current ??= createUsedByNamesLoader((forWorkspace, names, pool) => {
|
|
12836
12845
|
if (forWorkspace !== workspaceIdRef.current) return false;
|
|
12837
12846
|
setUsedByNames(names);
|
|
12847
|
+
setSharesCredits(poolSharesCredits(pool));
|
|
12838
12848
|
return true;
|
|
12839
12849
|
});
|
|
12840
12850
|
const [userMap, setUserMap] = useState22({});
|
|
@@ -12925,19 +12935,14 @@ function BillingContent({
|
|
|
12925
12935
|
} catch {
|
|
12926
12936
|
}
|
|
12927
12937
|
}, [api]);
|
|
12928
|
-
const ensureUsedByNames = useCallback9(
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
() => fetchCreditPool.call(api)
|
|
12937
|
-
);
|
|
12938
|
-
},
|
|
12939
|
-
[api, workspaceId]
|
|
12940
|
-
);
|
|
12938
|
+
const ensureUsedByNames = useCallback9(() => {
|
|
12939
|
+
const fetchCreditPool = api.fetchCreditPool;
|
|
12940
|
+
if (!fetchCreditPool || !workspaceId) return;
|
|
12941
|
+
void loadUsedByNamesRef.current?.load(
|
|
12942
|
+
workspaceId,
|
|
12943
|
+
() => fetchCreditPool.call(api)
|
|
12944
|
+
);
|
|
12945
|
+
}, [api, workspaceId]);
|
|
12941
12946
|
const loadUsageLogsPage = useCallback9(
|
|
12942
12947
|
async (page) => {
|
|
12943
12948
|
const request = ++usageLogsRequestRef.current;
|
|
@@ -12946,6 +12951,7 @@ function BillingContent({
|
|
|
12946
12951
|
return;
|
|
12947
12952
|
}
|
|
12948
12953
|
dispatchUsageLogs({ type: "request", page });
|
|
12954
|
+
ensureUsedByNames();
|
|
12949
12955
|
try {
|
|
12950
12956
|
const res = await api.fetchUsageLogs({
|
|
12951
12957
|
page,
|
|
@@ -12953,8 +12959,11 @@ function BillingContent({
|
|
|
12953
12959
|
});
|
|
12954
12960
|
if (request !== usageLogsRequestRef.current) return;
|
|
12955
12961
|
const next = usageLogsPage(res, page);
|
|
12956
|
-
dispatchUsageLogs({
|
|
12957
|
-
|
|
12962
|
+
dispatchUsageLogs({
|
|
12963
|
+
type: "loaded",
|
|
12964
|
+
logs: next,
|
|
12965
|
+
workspaceId: workspaceIdRef.current
|
|
12966
|
+
});
|
|
12958
12967
|
} catch (err) {
|
|
12959
12968
|
if (request !== usageLogsRequestRef.current) return;
|
|
12960
12969
|
dispatchUsageLogs({
|
|
@@ -12969,7 +12978,7 @@ function BillingContent({
|
|
|
12969
12978
|
(page) => {
|
|
12970
12979
|
if (usageLogs.unpaged && !usageLogsError) {
|
|
12971
12980
|
dispatchUsageLogs({ type: "turn", page });
|
|
12972
|
-
ensureUsedByNames(
|
|
12981
|
+
ensureUsedByNames();
|
|
12973
12982
|
return;
|
|
12974
12983
|
}
|
|
12975
12984
|
void loadUsageLogsPage(page);
|
|
@@ -13119,6 +13128,7 @@ function BillingContent({
|
|
|
13119
13128
|
usageLogsStateRef.current = INITIAL_USAGE_LOGS_STATE;
|
|
13120
13129
|
loadUsedByNamesRef.current?.reset();
|
|
13121
13130
|
setUsedByNames({});
|
|
13131
|
+
setSharesCredits(false);
|
|
13122
13132
|
}, [workspaceId]);
|
|
13123
13133
|
useEffect19(() => {
|
|
13124
13134
|
setInitialFetchTriggered(true);
|
|
@@ -13823,7 +13833,11 @@ function BillingContent({
|
|
|
13823
13833
|
error: usageLogsError,
|
|
13824
13834
|
onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
|
|
13825
13835
|
currentWorkspaceId: workspaceId,
|
|
13826
|
-
usedByNames
|
|
13836
|
+
usedByNames,
|
|
13837
|
+
showWorkspace: usageLogsShowWorkspace(usageLogsState, {
|
|
13838
|
+
hasCreditPool: Boolean(api.fetchCreditPool),
|
|
13839
|
+
sharesCredits
|
|
13840
|
+
})
|
|
13827
13841
|
}
|
|
13828
13842
|
),
|
|
13829
13843
|
!usageLogsError && /* @__PURE__ */ jsx30(
|
|
@@ -17128,11 +17142,13 @@ function SettingsContentInner({
|
|
|
17128
17142
|
return true;
|
|
17129
17143
|
};
|
|
17130
17144
|
useEffect21(() => {
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17145
|
+
setLocalWorkspaces(null);
|
|
17146
|
+
}, [workspaceId]);
|
|
17147
|
+
const displayWorkspaces = (localWorkspaces ?? workspaceList.map(toWorkspaceData)).map(
|
|
17148
|
+
(ws) => toWorkspaceInfo(
|
|
17149
|
+
workspaceId ? { ...ws, isCurrent: ws.id === workspaceId } : ws
|
|
17150
|
+
)
|
|
17151
|
+
);
|
|
17136
17152
|
const currentWorkspaceInfo = displayWorkspaces.find((ws) => ws.isCurrent) ?? null;
|
|
17137
17153
|
const currentWorkspaceData = currentWorkspaceInfo ? {
|
|
17138
17154
|
...toWorkspaceData(currentWorkspaceInfo),
|
|
@@ -18731,6 +18747,7 @@ export {
|
|
|
18731
18747
|
USAGE_LOGS_PAGE_SIZE,
|
|
18732
18748
|
USER_LANGUAGES,
|
|
18733
18749
|
UsageLogsPager,
|
|
18750
|
+
UsageLogsTable,
|
|
18734
18751
|
WORKSPACE_CREDIT_LIMIT_REACHED,
|
|
18735
18752
|
WORKSPACE_CREDIT_LIMIT_REACHED_MESSAGE,
|
|
18736
18753
|
WORKSPACE_LIST_PAGE_SIZE,
|
|
@@ -18796,6 +18813,7 @@ export {
|
|
|
18796
18813
|
poolEndsAtFrom,
|
|
18797
18814
|
poolErrorMessage,
|
|
18798
18815
|
poolRenewsAtCycleEnd,
|
|
18816
|
+
poolSharesCredits,
|
|
18799
18817
|
poolUnallocatedPercent,
|
|
18800
18818
|
poolWorkspaceName,
|
|
18801
18819
|
productsForCountry,
|
|
@@ -18825,6 +18843,7 @@ export {
|
|
|
18825
18843
|
usageLogsPage,
|
|
18826
18844
|
usageLogsReducer,
|
|
18827
18845
|
usageLogsReloadPage,
|
|
18846
|
+
usageLogsShowWorkspace,
|
|
18828
18847
|
usageLogsSpentByOthers,
|
|
18829
18848
|
useBillingEntitlement,
|
|
18830
18849
|
useSettingsAdapters,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamoid/settings",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@types/react-dom": "^19.0.0",
|
|
33
33
|
"@streamoid/icons": "*",
|
|
34
34
|
"@streamoid/ui": "*",
|
|
35
|
+
"jsdom": "^29.1.1",
|
|
35
36
|
"react": "^19.0.0",
|
|
36
37
|
"react-dom": "^19.0.0",
|
|
37
38
|
"tsup": "^8.0.0",
|