@streamoid/settings 0.22.3 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -177,7 +177,9 @@ Billing hides an entry whose adapter method is absent:
177
177
  `formerMembers` (`poolSharesCredits`) gets a Workspace column in its usage
178
178
  logs, on every page: "This workspace", or "Used by <name>" for rows whose
179
179
  `meta.usedBy` is another workspace, named from those members. Without
180
- `fetchCreditPool` the column shows from the first loaded page with such a
180
+ `fetchCreditPool`, or when it fails (a 403 for a member who is not a
181
+ workspace admin; not asked again after a 4xx such as 401/403, once more
182
+ after a network error (no status, or status 0) or 5xx), the column shows from the first loaded page with such a
181
183
  row (every row, for an adapter that sends them all) and stays on every page
182
184
  until the workspace changes; those rows read "Used by another workspace".
183
185
  `setCreditPoolSelfShare` and `removeCreditPoolSelfShare` (mirroring
package/dist/index.d.mts CHANGED
@@ -315,10 +315,18 @@ interface SettingsOrganizationListItem {
315
315
  /** Its email domain; absent for an organization with none. */
316
316
  domain?: string | null;
317
317
  type?: SettingsOrganizationType;
318
+ /** Absent: "open". */
319
+ workspaceJoin?: SettingsOrganizationWorkspaceJoin;
318
320
  }
319
321
  /** "shared": offered to new users from the company domain at signup.
320
322
  * "private": invite-only. */
321
323
  type SettingsOrganizationType = "shared" | "private";
324
+ /** Who may join the organization's shared workspaces. "open": any org member,
325
+ * from the workspace list or picker. "invite": only people invited to that
326
+ * workspace — org admins still see and may join every workspace, and nobody
327
+ * already in one loses it. Absent on `SettingsOrganizationCurrent`: the host
328
+ * doesn't support it — no switch, members join as under "open". */
329
+ type SettingsOrganizationWorkspaceJoin = "open" | "invite";
322
330
  /** Whether the viewer may create an organization, and on which domains
323
331
  * (GET /organization/create-options). */
324
332
  interface SettingsOrganizationCreateOptions {
@@ -336,6 +344,11 @@ interface SettingsOrganizationCurrent {
336
344
  name?: string;
337
345
  /** Absent on organizations created before types existed: treat as shared. */
338
346
  type?: SettingsOrganizationType;
347
+ /** Set it (to "open" when the organization has none stored) only if the
348
+ * host loads it and forwards it in `update`: absent means the host doesn't
349
+ * support the setting, so Organization › Workspaces shows no switch and
350
+ * filters nothing — members may join any shared workspace. */
351
+ workspaceJoin?: SettingsOrganizationWorkspaceJoin;
339
352
  /** The company the organization belongs to ("abfrl.com" for an org on
340
353
  * ownd.abfrl.com). Members from the same company join as members; anyone
341
354
  * else is a guest. Absent for organizations with no domain. */
@@ -492,6 +505,9 @@ interface SettingsOrganizationAdapter {
492
505
  /** Only an admin whose own email is on the org's company may change it,
493
506
  * and only to a domain of the same company. */
494
507
  domain?: string;
508
+ /** Only org admins may change it. Hosts should refresh `current` after
509
+ * saving so the Join buttons follow. */
510
+ workspaceJoin?: SettingsOrganizationWorkspaceJoin;
495
511
  }) => Promise<void>;
496
512
  switch: (id: string) => Promise<void>;
497
513
  delete: (id: string) => Promise<void>;
@@ -1889,19 +1905,22 @@ declare function usageLogsReloadPage(state: UsageLogsState): number;
1889
1905
  /**
1890
1906
  * Whether the usage logs in hand have a row another workspace spent from this
1891
1907
  * one's shared credits. Every row an unpaged adapter sent counts, not only the
1892
- * page on screen.
1908
+ * page on screen. The Workspace column's decision without a credit pool to
1909
+ * read.
1893
1910
  */
1894
1911
  declare function usageLogsSpentByOthers(logs: UsageLogsPage, workspaceId: string | null | undefined): boolean;
1895
1912
  /**
1896
1913
  * Whether the Usage logs table shows its Workspace column: the same on every
1897
1914
  * 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.
1915
+ * shares its credits or did (`poolSharesCredits`). Without it, or when the
1916
+ * pool could not be read (`failed`: a member who is not a workspace admin gets
1917
+ * a 403), whether any page loaded for the workspace so far had a row another
1918
+ * workspace spent: once shown it stays, on every page, until another workspace.
1901
1919
  */
1902
1920
  declare function usageLogsShowWorkspace(state: Pick<UsageLogsState, "spentByOthers">, pool: {
1903
1921
  hasCreditPool: boolean;
1904
1922
  sharesCredits: boolean;
1923
+ failed?: boolean;
1905
1924
  }): boolean;
1906
1925
  interface UsedByNamesLoader {
1907
1926
  /** Look up `workspaceId`'s names, unless they are saved or being looked up. */
@@ -1917,11 +1936,14 @@ interface UsedByNamesLoader {
1917
1936
  * workspaces that spent its shared credits, and the pool itself (whether it
1918
1937
  * shares them at all). `save` gets each answer and says whether it
1919
1938
  * kept it (false: that workspace is no longer shown); only a kept answer ends
1920
- * the lookups for that workspace. A failed or unkept lookup is tried again on
1921
- * the next call; a call while one for the same workspace is under way starts
1922
- * no other.
1923
- */
1924
- declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>, pool: CreditPoolResponse) => boolean): UsedByNamesLoader;
1939
+ * the lookups for that workspace. An unkept lookup is tried again on the next
1940
+ * call. A failed one calls `failed` (the Workspace column falls back to the
1941
+ * rows) and is tried once more on a later call when it was the network
1942
+ * (status 0 included) or a 5xx; a 4xx such as 401/403, or a second failure,
1943
+ * ends the lookups for that workspace until `reset`, so turning pages does not ask again. A call while
1944
+ * one for the same workspace is under way starts no other.
1945
+ */
1946
+ declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>, pool: CreditPoolResponse) => boolean, failed?: (workspaceId: string) => void): UsedByNamesLoader;
1925
1947
  /** The CSV file name for a picked day range, from its local calendar days. */
1926
1948
  declare function usageLogsExportFileName(start: Date, end: Date): string;
1927
1949
  /**
@@ -3159,4 +3181,4 @@ interface AppSettingsRowProps {
3159
3181
  }
3160
3182
  declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
3161
3183
 
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 };
3184
+ 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 SettingsOrganizationWorkspaceJoin, 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
@@ -315,10 +315,18 @@ interface SettingsOrganizationListItem {
315
315
  /** Its email domain; absent for an organization with none. */
316
316
  domain?: string | null;
317
317
  type?: SettingsOrganizationType;
318
+ /** Absent: "open". */
319
+ workspaceJoin?: SettingsOrganizationWorkspaceJoin;
318
320
  }
319
321
  /** "shared": offered to new users from the company domain at signup.
320
322
  * "private": invite-only. */
321
323
  type SettingsOrganizationType = "shared" | "private";
324
+ /** Who may join the organization's shared workspaces. "open": any org member,
325
+ * from the workspace list or picker. "invite": only people invited to that
326
+ * workspace — org admins still see and may join every workspace, and nobody
327
+ * already in one loses it. Absent on `SettingsOrganizationCurrent`: the host
328
+ * doesn't support it — no switch, members join as under "open". */
329
+ type SettingsOrganizationWorkspaceJoin = "open" | "invite";
322
330
  /** Whether the viewer may create an organization, and on which domains
323
331
  * (GET /organization/create-options). */
324
332
  interface SettingsOrganizationCreateOptions {
@@ -336,6 +344,11 @@ interface SettingsOrganizationCurrent {
336
344
  name?: string;
337
345
  /** Absent on organizations created before types existed: treat as shared. */
338
346
  type?: SettingsOrganizationType;
347
+ /** Set it (to "open" when the organization has none stored) only if the
348
+ * host loads it and forwards it in `update`: absent means the host doesn't
349
+ * support the setting, so Organization › Workspaces shows no switch and
350
+ * filters nothing — members may join any shared workspace. */
351
+ workspaceJoin?: SettingsOrganizationWorkspaceJoin;
339
352
  /** The company the organization belongs to ("abfrl.com" for an org on
340
353
  * ownd.abfrl.com). Members from the same company join as members; anyone
341
354
  * else is a guest. Absent for organizations with no domain. */
@@ -492,6 +505,9 @@ interface SettingsOrganizationAdapter {
492
505
  /** Only an admin whose own email is on the org's company may change it,
493
506
  * and only to a domain of the same company. */
494
507
  domain?: string;
508
+ /** Only org admins may change it. Hosts should refresh `current` after
509
+ * saving so the Join buttons follow. */
510
+ workspaceJoin?: SettingsOrganizationWorkspaceJoin;
495
511
  }) => Promise<void>;
496
512
  switch: (id: string) => Promise<void>;
497
513
  delete: (id: string) => Promise<void>;
@@ -1889,19 +1905,22 @@ declare function usageLogsReloadPage(state: UsageLogsState): number;
1889
1905
  /**
1890
1906
  * Whether the usage logs in hand have a row another workspace spent from this
1891
1907
  * one's shared credits. Every row an unpaged adapter sent counts, not only the
1892
- * page on screen.
1908
+ * page on screen. The Workspace column's decision without a credit pool to
1909
+ * read.
1893
1910
  */
1894
1911
  declare function usageLogsSpentByOthers(logs: UsageLogsPage, workspaceId: string | null | undefined): boolean;
1895
1912
  /**
1896
1913
  * Whether the Usage logs table shows its Workspace column: the same on every
1897
1914
  * 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.
1915
+ * shares its credits or did (`poolSharesCredits`). Without it, or when the
1916
+ * pool could not be read (`failed`: a member who is not a workspace admin gets
1917
+ * a 403), whether any page loaded for the workspace so far had a row another
1918
+ * workspace spent: once shown it stays, on every page, until another workspace.
1901
1919
  */
1902
1920
  declare function usageLogsShowWorkspace(state: Pick<UsageLogsState, "spentByOthers">, pool: {
1903
1921
  hasCreditPool: boolean;
1904
1922
  sharesCredits: boolean;
1923
+ failed?: boolean;
1905
1924
  }): boolean;
1906
1925
  interface UsedByNamesLoader {
1907
1926
  /** Look up `workspaceId`'s names, unless they are saved or being looked up. */
@@ -1917,11 +1936,14 @@ interface UsedByNamesLoader {
1917
1936
  * workspaces that spent its shared credits, and the pool itself (whether it
1918
1937
  * shares them at all). `save` gets each answer and says whether it
1919
1938
  * kept it (false: that workspace is no longer shown); only a kept answer ends
1920
- * the lookups for that workspace. A failed or unkept lookup is tried again on
1921
- * the next call; a call while one for the same workspace is under way starts
1922
- * no other.
1923
- */
1924
- declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>, pool: CreditPoolResponse) => boolean): UsedByNamesLoader;
1939
+ * the lookups for that workspace. An unkept lookup is tried again on the next
1940
+ * call. A failed one calls `failed` (the Workspace column falls back to the
1941
+ * rows) and is tried once more on a later call when it was the network
1942
+ * (status 0 included) or a 5xx; a 4xx such as 401/403, or a second failure,
1943
+ * ends the lookups for that workspace until `reset`, so turning pages does not ask again. A call while
1944
+ * one for the same workspace is under way starts no other.
1945
+ */
1946
+ declare function createUsedByNamesLoader(save: (workspaceId: string, names: Record<string, string>, pool: CreditPoolResponse) => boolean, failed?: (workspaceId: string) => void): UsedByNamesLoader;
1925
1947
  /** The CSV file name for a picked day range, from its local calendar days. */
1926
1948
  declare function usageLogsExportFileName(start: Date, end: Date): string;
1927
1949
  /**
@@ -3159,4 +3181,4 @@ interface AppSettingsRowProps {
3159
3181
  }
3160
3182
  declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
3161
3183
 
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 };
3184
+ 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 SettingsOrganizationWorkspaceJoin, 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
@@ -7216,6 +7216,100 @@ function WorkspaceRow({
7216
7216
  }
7217
7217
  );
7218
7218
  }
7219
+ var WORKSPACE_JOIN_TITLE = "Members can join shared workspaces without an invite";
7220
+ function WorkspaceJoinSetting({
7221
+ value,
7222
+ saving,
7223
+ onChange
7224
+ }) {
7225
+ const checked = value !== "invite";
7226
+ const toggle = (next) => {
7227
+ if (!saving) onChange(next ? "open" : "invite");
7228
+ };
7229
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7230
+ "section",
7231
+ {
7232
+ "aria-label": "Workspace access",
7233
+ className: "flex items-start shrink-0 w-full",
7234
+ style: {
7235
+ gap: T11.spXl,
7236
+ padding: T11.sp3xl,
7237
+ backgroundColor: "var(--alias-surface-base)",
7238
+ border: `1px solid ${T11.borderSubtle}`,
7239
+ borderRadius: T11.r3xl
7240
+ },
7241
+ children: [
7242
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col flex-1 min-w-0", style: { gap: T11.spXs }, children: [
7243
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7244
+ "span",
7245
+ {
7246
+ style: {
7247
+ fontFamily: T11.font,
7248
+ fontSize: T11.fsMd,
7249
+ fontWeight: 600,
7250
+ lineHeight: T11.lhSm,
7251
+ color: T11.primary
7252
+ },
7253
+ children: WORKSPACE_JOIN_TITLE
7254
+ }
7255
+ ),
7256
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7257
+ "span",
7258
+ {
7259
+ style: {
7260
+ fontFamily: T11.font,
7261
+ fontSize: T11.fsSm,
7262
+ lineHeight: T11.lhSm,
7263
+ color: T11.muted
7264
+ },
7265
+ children: "When off, people see only the workspaces they're invited to. Admins still see all workspaces, and nobody loses access they already have."
7266
+ }
7267
+ )
7268
+ ] }),
7269
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7270
+ "div",
7271
+ {
7272
+ className: "flex items-center shrink-0",
7273
+ style: { alignSelf: "center", gap: T11.spMd, minHeight: 26 },
7274
+ children: [
7275
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7276
+ "span",
7277
+ {
7278
+ style: {
7279
+ fontFamily: T11.font,
7280
+ fontSize: T11.fsSm,
7281
+ lineHeight: T11.lhSm,
7282
+ color: T11.muted
7283
+ },
7284
+ children: checked ? "On" : "Off"
7285
+ }
7286
+ ),
7287
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { display: "inline-flex", width: 41, height: 25, alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7288
+ import_ui9.ScToggleSwitch,
7289
+ {
7290
+ checked,
7291
+ disabled: saving,
7292
+ onToggle: toggle,
7293
+ role: "switch",
7294
+ "aria-checked": checked,
7295
+ "aria-disabled": saving,
7296
+ "aria-label": WORKSPACE_JOIN_TITLE,
7297
+ tabIndex: 0,
7298
+ onKeyDown: (event) => {
7299
+ if (event.key === " " || event.key === "Enter") {
7300
+ event.preventDefault();
7301
+ toggle(!checked);
7302
+ }
7303
+ }
7304
+ }
7305
+ ) })
7306
+ ]
7307
+ }
7308
+ )
7309
+ ]
7310
+ }
7311
+ );
7312
+ }
7219
7313
  function JoinRequestRow({
7220
7314
  request,
7221
7315
  onApprove,
@@ -7341,6 +7435,12 @@ function OrganizationContent({
7341
7435
  const [workspaces, setWorkspaces] = (0, import_react13.useState)([]);
7342
7436
  const joinRole = current?.role === "admin" || current?.role === "member" ? current.role : null;
7343
7437
  const canJoin = !!joinRole && !!organization.joinWorkspaces;
7438
+ const [workspaceJoin, setWorkspaceJoin] = (0, import_react13.useState)(current?.workspaceJoin);
7439
+ const [savingWorkspaceJoin, setSavingWorkspaceJoin] = (0, import_react13.useState)(false);
7440
+ (0, import_react13.useEffect)(() => {
7441
+ setWorkspaceJoin(current?.workspaceJoin);
7442
+ }, [current?.id, current?.workspaceJoin]);
7443
+ const visibleWorkspaces = workspaceJoin === "invite" && current?.role !== "admin" ? workspaces.filter((ws) => ws.joined !== false) : workspaces;
7344
7444
  const [joiningId, setJoiningId] = (0, import_react13.useState)(null);
7345
7445
  const [joinRequests, setJoinRequests] = (0, import_react13.useState)([]);
7346
7446
  const [highestRole, setHighestRole] = (0, import_react13.useState)("guest");
@@ -7387,6 +7487,23 @@ function OrganizationContent({
7387
7487
  setJoiningId(null);
7388
7488
  }
7389
7489
  };
7490
+ const handleWorkspaceJoinChange = async (next) => {
7491
+ if (!current || workspaceJoin === void 0 || next === workspaceJoin) return;
7492
+ const previous = workspaceJoin;
7493
+ setWorkspaceJoin(next);
7494
+ setSavingWorkspaceJoin(true);
7495
+ try {
7496
+ await organization.update(current.id, { workspaceJoin: next });
7497
+ toast.success(
7498
+ next === "open" ? "Members can now join shared workspaces" : "Members now need an invite to join a workspace"
7499
+ );
7500
+ } catch (err) {
7501
+ setWorkspaceJoin(previous);
7502
+ toast.error(errorMessage(err, { method: "PUT" }));
7503
+ } finally {
7504
+ setSavingWorkspaceJoin(false);
7505
+ }
7506
+ };
7390
7507
  const [manageModalOpen, setManageModalOpen] = (0, import_react13.useState)(false);
7391
7508
  const handleUpdateOrganization = async (name, imageFile, _imageRemoved, details) => {
7392
7509
  if (!current) return false;
@@ -7530,7 +7647,7 @@ function OrganizationContent({
7530
7647
  role: current.role,
7531
7648
  facts: [
7532
7649
  !loadingData && countLabel(members.length, "person", "people"),
7533
- !loadingData && countLabel(workspaces.length, "workspace"),
7650
+ !loadingData && countLabel(visibleWorkspaces.length, "workspace"),
7534
7651
  !loadingData && joinRequests.length > 0 && countLabel(joinRequests.length, "join request")
7535
7652
  ],
7536
7653
  action: current.role === "admin" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -7612,17 +7729,25 @@ function OrganizationContent({
7612
7729
  )
7613
7730
  ] });
7614
7731
  const workspacesView = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7732
+ current.role === "admin" && workspaceJoin !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7733
+ WorkspaceJoinSetting,
7734
+ {
7735
+ value: workspaceJoin,
7736
+ saving: savingWorkspaceJoin,
7737
+ onChange: (next) => void handleWorkspaceJoinChange(next)
7738
+ }
7739
+ ),
7615
7740
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7616
7741
  Section,
7617
7742
  {
7618
7743
  title: "Workspaces in this organization",
7619
- empty: workspaces.length === 0,
7620
- children: workspaces.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7744
+ empty: visibleWorkspaces.length === 0,
7745
+ children: visibleWorkspaces.map((ws) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7621
7746
  WorkspaceRow,
7622
7747
  {
7623
7748
  workspace: ws,
7624
7749
  joining: joiningId === ws._id,
7625
- onJoin: canJoin && ws.joined === false && ws.status !== "inactive" && (joinRole === "admin" || ws.orgVisibility === "shared") ? () => void handleJoinWorkspace(ws) : void 0
7750
+ onJoin: canJoin && ws.joined === false && ws.status !== "inactive" && (joinRole === "admin" || ws.orgVisibility === "shared" && workspaceJoin !== "invite") ? () => void handleJoinWorkspace(ws) : void 0
7626
7751
  },
7627
7752
  ws._id
7628
7753
  ))
@@ -11554,23 +11679,39 @@ function usageLogsSpentByOthers(logs, workspaceId) {
11554
11679
  );
11555
11680
  }
11556
11681
  function usageLogsShowWorkspace(state, pool) {
11557
- return pool.hasCreditPool ? pool.sharesCredits : state.spentByOthers;
11682
+ return pool.hasCreditPool && !pool.failed ? pool.sharesCredits : state.spentByOthers;
11683
+ }
11684
+ function creditPoolFailureRetryable(failure) {
11685
+ const error = failure;
11686
+ const status = [error?.status, error?.statusCode, error?.response?.status].find(
11687
+ (value) => typeof value === "number" && Number.isFinite(value) && value > 0
11688
+ );
11689
+ return status === void 0 || status < 400 || status >= 500;
11558
11690
  }
11559
- function createUsedByNamesLoader(save) {
11691
+ function createUsedByNamesLoader(save, failed) {
11560
11692
  let savedFor = null;
11561
11693
  let inFlight = null;
11694
+ let failedFor = null;
11562
11695
  return {
11563
11696
  async load(workspaceId, fetchCreditPool) {
11564
11697
  if (savedFor === workspaceId || inFlight?.workspaceId === workspaceId) {
11565
11698
  return;
11566
11699
  }
11700
+ if (failedFor?.workspaceId === workspaceId && !failedFor.retry) return;
11567
11701
  const lookup = { workspaceId };
11568
11702
  inFlight = lookup;
11569
11703
  try {
11570
11704
  const pool = await fetchCreditPool();
11571
11705
  if (inFlight !== lookup) return;
11572
11706
  if (save(workspaceId, usedByNamesFrom(pool), pool)) savedFor = workspaceId;
11573
- } catch {
11707
+ } catch (failure) {
11708
+ if (inFlight !== lookup) return;
11709
+ const retried = failedFor?.workspaceId === workspaceId;
11710
+ failedFor = {
11711
+ workspaceId,
11712
+ retry: !retried && creditPoolFailureRetryable(failure)
11713
+ };
11714
+ failed?.(workspaceId);
11574
11715
  } finally {
11575
11716
  if (inFlight === lookup) inFlight = null;
11576
11717
  }
@@ -11578,6 +11719,7 @@ function createUsedByNamesLoader(save) {
11578
11719
  reset() {
11579
11720
  savedFor = null;
11580
11721
  inFlight = null;
11722
+ failedFor = null;
11581
11723
  }
11582
11724
  };
11583
11725
  }
@@ -12943,6 +13085,7 @@ function BillingContent({
12943
13085
  const [sponsorShare, setSponsorShare] = (0, import_react24.useState)(null);
12944
13086
  const [usedByNames, setUsedByNames] = (0, import_react24.useState)({});
12945
13087
  const [sharesCredits, setSharesCredits] = (0, import_react24.useState)(false);
13088
+ const [creditPoolFailed, setCreditPoolFailed] = (0, import_react24.useState)(false);
12946
13089
  const [allProducts, setProducts] = (0, import_react24.useState)([]);
12947
13090
  const workspaceCountry = workspace.current?.country;
12948
13091
  const products = (0, import_react24.useMemo)(
@@ -12966,12 +13109,18 @@ function BillingContent({
12966
13109
  const workspaceIdRef = (0, import_react24.useRef)(workspaceId);
12967
13110
  workspaceIdRef.current = workspaceId;
12968
13111
  const loadUsedByNamesRef = (0, import_react24.useRef)(null);
12969
- loadUsedByNamesRef.current ??= createUsedByNamesLoader((forWorkspace, names, pool) => {
12970
- if (forWorkspace !== workspaceIdRef.current) return false;
12971
- setUsedByNames(names);
12972
- setSharesCredits(poolSharesCredits(pool));
12973
- return true;
12974
- });
13112
+ loadUsedByNamesRef.current ??= createUsedByNamesLoader(
13113
+ (forWorkspace, names, pool) => {
13114
+ if (forWorkspace !== workspaceIdRef.current) return false;
13115
+ setUsedByNames(names);
13116
+ setSharesCredits(poolSharesCredits(pool));
13117
+ setCreditPoolFailed(false);
13118
+ return true;
13119
+ },
13120
+ (forWorkspace) => {
13121
+ if (forWorkspace === workspaceIdRef.current) setCreditPoolFailed(true);
13122
+ }
13123
+ );
12975
13124
  const [userMap, setUserMap] = (0, import_react24.useState)({});
12976
13125
  const [customPlanCredits, setCustomPlanCredits] = (0, import_react24.useState)(
12977
13126
  null
@@ -13254,6 +13403,7 @@ function BillingContent({
13254
13403
  loadUsedByNamesRef.current?.reset();
13255
13404
  setUsedByNames({});
13256
13405
  setSharesCredits(false);
13406
+ setCreditPoolFailed(false);
13257
13407
  }, [workspaceId]);
13258
13408
  (0, import_react24.useEffect)(() => {
13259
13409
  setInitialFetchTriggered(true);
@@ -13961,7 +14111,8 @@ function BillingContent({
13961
14111
  usedByNames,
13962
14112
  showWorkspace: usageLogsShowWorkspace(usageLogsState, {
13963
14113
  hasCreditPool: Boolean(api.fetchCreditPool),
13964
- sharesCredits
14114
+ sharesCredits,
14115
+ failed: creditPoolFailed
13965
14116
  })
13966
14117
  }
13967
14118
  ),
package/dist/index.mjs CHANGED
@@ -5827,7 +5827,7 @@ function TeamsContent({
5827
5827
 
5828
5828
  // src/organization-content.tsx
5829
5829
  import { useCallback as useCallback3, useEffect as useEffect11, useState as useState11 } from "react";
5830
- import { ScButton as ScButton6 } from "@streamoid/ui";
5830
+ import { ScButton as ScButton6, ScToggleSwitch } from "@streamoid/ui";
5831
5831
  import { SiconCheck, SiconCopy, SiconGlobe as SiconGlobe2, SiconSettings } from "@streamoid/icons";
5832
5832
 
5833
5833
  // src/organization-member-modal.tsx
@@ -7068,6 +7068,100 @@ function WorkspaceRow({
7068
7068
  }
7069
7069
  );
7070
7070
  }
7071
+ var WORKSPACE_JOIN_TITLE = "Members can join shared workspaces without an invite";
7072
+ function WorkspaceJoinSetting({
7073
+ value,
7074
+ saving,
7075
+ onChange
7076
+ }) {
7077
+ const checked = value !== "invite";
7078
+ const toggle = (next) => {
7079
+ if (!saving) onChange(next ? "open" : "invite");
7080
+ };
7081
+ return /* @__PURE__ */ jsxs16(
7082
+ "section",
7083
+ {
7084
+ "aria-label": "Workspace access",
7085
+ className: "flex items-start shrink-0 w-full",
7086
+ style: {
7087
+ gap: T11.spXl,
7088
+ padding: T11.sp3xl,
7089
+ backgroundColor: "var(--alias-surface-base)",
7090
+ border: `1px solid ${T11.borderSubtle}`,
7091
+ borderRadius: T11.r3xl
7092
+ },
7093
+ children: [
7094
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col flex-1 min-w-0", style: { gap: T11.spXs }, children: [
7095
+ /* @__PURE__ */ jsx19(
7096
+ "span",
7097
+ {
7098
+ style: {
7099
+ fontFamily: T11.font,
7100
+ fontSize: T11.fsMd,
7101
+ fontWeight: 600,
7102
+ lineHeight: T11.lhSm,
7103
+ color: T11.primary
7104
+ },
7105
+ children: WORKSPACE_JOIN_TITLE
7106
+ }
7107
+ ),
7108
+ /* @__PURE__ */ jsx19(
7109
+ "span",
7110
+ {
7111
+ style: {
7112
+ fontFamily: T11.font,
7113
+ fontSize: T11.fsSm,
7114
+ lineHeight: T11.lhSm,
7115
+ color: T11.muted
7116
+ },
7117
+ children: "When off, people see only the workspaces they're invited to. Admins still see all workspaces, and nobody loses access they already have."
7118
+ }
7119
+ )
7120
+ ] }),
7121
+ /* @__PURE__ */ jsxs16(
7122
+ "div",
7123
+ {
7124
+ className: "flex items-center shrink-0",
7125
+ style: { alignSelf: "center", gap: T11.spMd, minHeight: 26 },
7126
+ children: [
7127
+ /* @__PURE__ */ jsx19(
7128
+ "span",
7129
+ {
7130
+ style: {
7131
+ fontFamily: T11.font,
7132
+ fontSize: T11.fsSm,
7133
+ lineHeight: T11.lhSm,
7134
+ color: T11.muted
7135
+ },
7136
+ children: checked ? "On" : "Off"
7137
+ }
7138
+ ),
7139
+ /* @__PURE__ */ jsx19("span", { style: { display: "inline-flex", width: 41, height: 25, alignItems: "center" }, children: /* @__PURE__ */ jsx19(
7140
+ ScToggleSwitch,
7141
+ {
7142
+ checked,
7143
+ disabled: saving,
7144
+ onToggle: toggle,
7145
+ role: "switch",
7146
+ "aria-checked": checked,
7147
+ "aria-disabled": saving,
7148
+ "aria-label": WORKSPACE_JOIN_TITLE,
7149
+ tabIndex: 0,
7150
+ onKeyDown: (event) => {
7151
+ if (event.key === " " || event.key === "Enter") {
7152
+ event.preventDefault();
7153
+ toggle(!checked);
7154
+ }
7155
+ }
7156
+ }
7157
+ ) })
7158
+ ]
7159
+ }
7160
+ )
7161
+ ]
7162
+ }
7163
+ );
7164
+ }
7071
7165
  function JoinRequestRow({
7072
7166
  request,
7073
7167
  onApprove,
@@ -7193,6 +7287,12 @@ function OrganizationContent({
7193
7287
  const [workspaces, setWorkspaces] = useState11([]);
7194
7288
  const joinRole = current?.role === "admin" || current?.role === "member" ? current.role : null;
7195
7289
  const canJoin = !!joinRole && !!organization.joinWorkspaces;
7290
+ const [workspaceJoin, setWorkspaceJoin] = useState11(current?.workspaceJoin);
7291
+ const [savingWorkspaceJoin, setSavingWorkspaceJoin] = useState11(false);
7292
+ useEffect11(() => {
7293
+ setWorkspaceJoin(current?.workspaceJoin);
7294
+ }, [current?.id, current?.workspaceJoin]);
7295
+ const visibleWorkspaces = workspaceJoin === "invite" && current?.role !== "admin" ? workspaces.filter((ws) => ws.joined !== false) : workspaces;
7196
7296
  const [joiningId, setJoiningId] = useState11(null);
7197
7297
  const [joinRequests, setJoinRequests] = useState11([]);
7198
7298
  const [highestRole, setHighestRole] = useState11("guest");
@@ -7239,6 +7339,23 @@ function OrganizationContent({
7239
7339
  setJoiningId(null);
7240
7340
  }
7241
7341
  };
7342
+ const handleWorkspaceJoinChange = async (next) => {
7343
+ if (!current || workspaceJoin === void 0 || next === workspaceJoin) return;
7344
+ const previous = workspaceJoin;
7345
+ setWorkspaceJoin(next);
7346
+ setSavingWorkspaceJoin(true);
7347
+ try {
7348
+ await organization.update(current.id, { workspaceJoin: next });
7349
+ toast.success(
7350
+ next === "open" ? "Members can now join shared workspaces" : "Members now need an invite to join a workspace"
7351
+ );
7352
+ } catch (err) {
7353
+ setWorkspaceJoin(previous);
7354
+ toast.error(errorMessage(err, { method: "PUT" }));
7355
+ } finally {
7356
+ setSavingWorkspaceJoin(false);
7357
+ }
7358
+ };
7242
7359
  const [manageModalOpen, setManageModalOpen] = useState11(false);
7243
7360
  const handleUpdateOrganization = async (name, imageFile, _imageRemoved, details) => {
7244
7361
  if (!current) return false;
@@ -7382,7 +7499,7 @@ function OrganizationContent({
7382
7499
  role: current.role,
7383
7500
  facts: [
7384
7501
  !loadingData && countLabel(members.length, "person", "people"),
7385
- !loadingData && countLabel(workspaces.length, "workspace"),
7502
+ !loadingData && countLabel(visibleWorkspaces.length, "workspace"),
7386
7503
  !loadingData && joinRequests.length > 0 && countLabel(joinRequests.length, "join request")
7387
7504
  ],
7388
7505
  action: current.role === "admin" ? /* @__PURE__ */ jsx19(
@@ -7464,17 +7581,25 @@ function OrganizationContent({
7464
7581
  )
7465
7582
  ] });
7466
7583
  const workspacesView = /* @__PURE__ */ jsxs16(Fragment8, { children: [
7584
+ current.role === "admin" && workspaceJoin !== void 0 && /* @__PURE__ */ jsx19(
7585
+ WorkspaceJoinSetting,
7586
+ {
7587
+ value: workspaceJoin,
7588
+ saving: savingWorkspaceJoin,
7589
+ onChange: (next) => void handleWorkspaceJoinChange(next)
7590
+ }
7591
+ ),
7467
7592
  /* @__PURE__ */ jsx19(
7468
7593
  Section,
7469
7594
  {
7470
7595
  title: "Workspaces in this organization",
7471
- empty: workspaces.length === 0,
7472
- children: workspaces.map((ws) => /* @__PURE__ */ jsx19(
7596
+ empty: visibleWorkspaces.length === 0,
7597
+ children: visibleWorkspaces.map((ws) => /* @__PURE__ */ jsx19(
7473
7598
  WorkspaceRow,
7474
7599
  {
7475
7600
  workspace: ws,
7476
7601
  joining: joiningId === ws._id,
7477
- onJoin: canJoin && ws.joined === false && ws.status !== "inactive" && (joinRole === "admin" || ws.orgVisibility === "shared") ? () => void handleJoinWorkspace(ws) : void 0
7602
+ onJoin: canJoin && ws.joined === false && ws.status !== "inactive" && (joinRole === "admin" || ws.orgVisibility === "shared" && workspaceJoin !== "invite") ? () => void handleJoinWorkspace(ws) : void 0
7478
7603
  },
7479
7604
  ws._id
7480
7605
  ))
@@ -11429,23 +11554,39 @@ function usageLogsSpentByOthers(logs, workspaceId) {
11429
11554
  );
11430
11555
  }
11431
11556
  function usageLogsShowWorkspace(state, pool) {
11432
- return pool.hasCreditPool ? pool.sharesCredits : state.spentByOthers;
11557
+ return pool.hasCreditPool && !pool.failed ? pool.sharesCredits : state.spentByOthers;
11558
+ }
11559
+ function creditPoolFailureRetryable(failure) {
11560
+ const error = failure;
11561
+ const status = [error?.status, error?.statusCode, error?.response?.status].find(
11562
+ (value) => typeof value === "number" && Number.isFinite(value) && value > 0
11563
+ );
11564
+ return status === void 0 || status < 400 || status >= 500;
11433
11565
  }
11434
- function createUsedByNamesLoader(save) {
11566
+ function createUsedByNamesLoader(save, failed) {
11435
11567
  let savedFor = null;
11436
11568
  let inFlight = null;
11569
+ let failedFor = null;
11437
11570
  return {
11438
11571
  async load(workspaceId, fetchCreditPool) {
11439
11572
  if (savedFor === workspaceId || inFlight?.workspaceId === workspaceId) {
11440
11573
  return;
11441
11574
  }
11575
+ if (failedFor?.workspaceId === workspaceId && !failedFor.retry) return;
11442
11576
  const lookup = { workspaceId };
11443
11577
  inFlight = lookup;
11444
11578
  try {
11445
11579
  const pool = await fetchCreditPool();
11446
11580
  if (inFlight !== lookup) return;
11447
11581
  if (save(workspaceId, usedByNamesFrom(pool), pool)) savedFor = workspaceId;
11448
- } catch {
11582
+ } catch (failure) {
11583
+ if (inFlight !== lookup) return;
11584
+ const retried = failedFor?.workspaceId === workspaceId;
11585
+ failedFor = {
11586
+ workspaceId,
11587
+ retry: !retried && creditPoolFailureRetryable(failure)
11588
+ };
11589
+ failed?.(workspaceId);
11449
11590
  } finally {
11450
11591
  if (inFlight === lookup) inFlight = null;
11451
11592
  }
@@ -11453,6 +11594,7 @@ function createUsedByNamesLoader(save) {
11453
11594
  reset() {
11454
11595
  savedFor = null;
11455
11596
  inFlight = null;
11597
+ failedFor = null;
11456
11598
  }
11457
11599
  };
11458
11600
  }
@@ -12818,6 +12960,7 @@ function BillingContent({
12818
12960
  const [sponsorShare, setSponsorShare] = useState22(null);
12819
12961
  const [usedByNames, setUsedByNames] = useState22({});
12820
12962
  const [sharesCredits, setSharesCredits] = useState22(false);
12963
+ const [creditPoolFailed, setCreditPoolFailed] = useState22(false);
12821
12964
  const [allProducts, setProducts] = useState22([]);
12822
12965
  const workspaceCountry = workspace.current?.country;
12823
12966
  const products = useMemo4(
@@ -12841,12 +12984,18 @@ function BillingContent({
12841
12984
  const workspaceIdRef = useRef12(workspaceId);
12842
12985
  workspaceIdRef.current = workspaceId;
12843
12986
  const loadUsedByNamesRef = useRef12(null);
12844
- loadUsedByNamesRef.current ??= createUsedByNamesLoader((forWorkspace, names, pool) => {
12845
- if (forWorkspace !== workspaceIdRef.current) return false;
12846
- setUsedByNames(names);
12847
- setSharesCredits(poolSharesCredits(pool));
12848
- return true;
12849
- });
12987
+ loadUsedByNamesRef.current ??= createUsedByNamesLoader(
12988
+ (forWorkspace, names, pool) => {
12989
+ if (forWorkspace !== workspaceIdRef.current) return false;
12990
+ setUsedByNames(names);
12991
+ setSharesCredits(poolSharesCredits(pool));
12992
+ setCreditPoolFailed(false);
12993
+ return true;
12994
+ },
12995
+ (forWorkspace) => {
12996
+ if (forWorkspace === workspaceIdRef.current) setCreditPoolFailed(true);
12997
+ }
12998
+ );
12850
12999
  const [userMap, setUserMap] = useState22({});
12851
13000
  const [customPlanCredits, setCustomPlanCredits] = useState22(
12852
13001
  null
@@ -13129,6 +13278,7 @@ function BillingContent({
13129
13278
  loadUsedByNamesRef.current?.reset();
13130
13279
  setUsedByNames({});
13131
13280
  setSharesCredits(false);
13281
+ setCreditPoolFailed(false);
13132
13282
  }, [workspaceId]);
13133
13283
  useEffect19(() => {
13134
13284
  setInitialFetchTriggered(true);
@@ -13836,7 +13986,8 @@ function BillingContent({
13836
13986
  usedByNames,
13837
13987
  showWorkspace: usageLogsShowWorkspace(usageLogsState, {
13838
13988
  hasCreditPool: Boolean(api.fetchCreditPool),
13839
- sharesCredits
13989
+ sharesCredits,
13990
+ failed: creditPoolFailed
13840
13991
  })
13841
13992
  }
13842
13993
  ),
@@ -15055,7 +15206,7 @@ function HistorySkeleton() {
15055
15206
 
15056
15207
  // src/organization-integrations-content.tsx
15057
15208
  import { useState as useState25 } from "react";
15058
- import { ScButton as ScButton18, ScToggleSwitch } from "@streamoid/ui";
15209
+ import { ScButton as ScButton18, ScToggleSwitch as ScToggleSwitch2 } from "@streamoid/ui";
15059
15210
  import { Fragment as Fragment15, jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
15060
15211
  var COLUMN = { app: "6.5rem", workspace: "9rem", date: "6.5rem", action: "4.75rem" };
15061
15212
  function HeaderRow() {
@@ -15184,7 +15335,7 @@ function AccessCard({
15184
15335
  /* @__PURE__ */ jsxs31("div", { className: "flex items-center shrink-0", style: { alignSelf: "center", gap: T16.spMd, minHeight: 26 }, children: [
15185
15336
  /* @__PURE__ */ jsx34("span", { style: { fontFamily: T16.font, fontSize: T16.fsSm, lineHeight: T16.lhSm, color: T16.muted }, children: enabled === null ? "" : enabled ? "On" : "Off" }),
15186
15337
  /* @__PURE__ */ jsx34("span", { style: { display: "inline-flex", width: 41, height: 25, alignItems: "center" }, children: /* @__PURE__ */ jsx34(
15187
- ScToggleSwitch,
15338
+ ScToggleSwitch2,
15188
15339
  {
15189
15340
  checked: !!enabled,
15190
15341
  disabled: enabled === null || loading,
@@ -15374,7 +15525,7 @@ function OrganizationIntegrationsContent() {
15374
15525
 
15375
15526
  // src/organization-login-methods-content.tsx
15376
15527
  import { useState as useState26 } from "react";
15377
- import { ScButton as ScButton19, ScToggleSwitch as ScToggleSwitch2 } from "@streamoid/ui";
15528
+ import { ScButton as ScButton19, ScToggleSwitch as ScToggleSwitch3 } from "@streamoid/ui";
15378
15529
  import { Fragment as Fragment16, jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
15379
15530
  var AT_LEAST_ONE_HINT = "At least one login method must stay on, or nobody can sign in.";
15380
15531
  var NO_SSO_HINT = "Company SSO isn't set up for your organization. Contact Streamoid to set it up.";
@@ -15421,7 +15572,7 @@ function SwitchRow({
15421
15572
  /* @__PURE__ */ jsxs32("div", { className: "flex items-center shrink-0", style: { alignSelf: "center", gap: T16.spMd, minHeight: 26 }, children: [
15422
15573
  /* @__PURE__ */ jsx35("span", { style: { fontFamily: T16.font, fontSize: T16.fsSm, lineHeight: T16.lhSm, color: T16.muted }, children: state.checked ? "On" : "Off" }),
15423
15574
  /* @__PURE__ */ jsx35("span", { style: { display: "inline-flex", width: 41, height: 25, alignItems: "center" }, children: /* @__PURE__ */ jsx35(
15424
- ScToggleSwitch2,
15575
+ ScToggleSwitch3,
15425
15576
  {
15426
15577
  checked: state.checked,
15427
15578
  disabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/settings",
3
- "version": "0.22.3",
3
+ "version": "0.23.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",