@streamoid/settings 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1504,6 +1504,14 @@ interface WorkspaceGeneralTabProps {
1504
1504
  }
1505
1505
  declare function WorkspaceGeneralTab({ workspace, loading, memberCount, organizationName, organizationStatus, saving, onSave, onLeave, onDelete, }: WorkspaceGeneralTabProps): react.JSX.Element;
1506
1506
 
1507
+ /** The signed-in user's referral code, or `""` when they have none. Accepts
1508
+ * the spellings hosts have shipped (`referralCode`, `referral_code` and the
1509
+ * misspelt `referal*`). */
1510
+ declare function referralCodeOf(user: unknown): string;
1511
+ /** `<origin>?referral_code=<code>`; `""` without a code or an origin. A new
1512
+ * account created from this link is recorded as the code owner's referral. */
1513
+ declare function referralLink(code: string, origin: string): string;
1514
+
1507
1515
  type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width' | 'height'> & {
1508
1516
  color?: string;
1509
1517
  strokeWidth?: number | string;
@@ -2662,13 +2670,15 @@ interface AdministrationOverviewProps {
2662
2670
  hasOrganization: boolean;
2663
2671
  isWorkspaceAdmin: boolean;
2664
2672
  showConnectedApps: boolean;
2673
+ /** The signed-in user has a referral code to share. */
2674
+ showReferral?: boolean;
2665
2675
  showIntegrations: boolean;
2666
2676
  canInvite: boolean;
2667
2677
  onNavigate: (tab: SettingsTab) => void;
2668
2678
  onInvitePeople?: () => void;
2669
2679
  }
2670
2680
  /** Scope-first navigation into the existing forms; contains no mutation logic. */
2671
- declare function AdministrationOverview({ workspaceName, organizationName, hasWorkspace, hasOrganization, isWorkspaceAdmin, showConnectedApps, showIntegrations, canInvite, onNavigate, onInvitePeople, }: AdministrationOverviewProps): react.JSX.Element;
2681
+ declare function AdministrationOverview({ workspaceName, organizationName, hasWorkspace, hasOrganization, isWorkspaceAdmin, showConnectedApps, showIntegrations, showReferral, canInvite, onNavigate, onInvitePeople, }: AdministrationOverviewProps): react.JSX.Element;
2672
2682
 
2673
2683
  /** Shared invitation rule. A result belongs to one authenticated workspace;
2674
2684
  * callers must explicitly mark it ready after that workspace's reads settle. */
@@ -2739,4 +2749,4 @@ interface AppSettingsRowProps {
2739
2749
  }
2740
2750
  declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
2741
2751
 
2742
- 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 CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type MemberCreditLimit, MemberCreditLimitModal, type MemberCreditLimitRow, type MemberCreditLimitSource, type MemberCreditLimitsResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationDetails, OrganizationIntegrationsContent, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralTab, RemovePoolMemberModal, type RemovePoolMemberModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCreateOptions, type SettingsOrganizationCurrent, type SettingsOrganizationJoinableItem, type SettingsOrganizationListItem, type SettingsOrganizationType, type SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SharedCreditsView, type SharedPoolBalance, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerGroup, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, belowUsageReason, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sponsoredCreditsText, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
2752
+ 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 CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type MemberCreditLimit, MemberCreditLimitModal, type MemberCreditLimitRow, type MemberCreditLimitSource, type MemberCreditLimitsResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationDetails, OrganizationIntegrationsContent, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralTab, RemovePoolMemberModal, type RemovePoolMemberModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCreateOptions, type SettingsOrganizationCurrent, type SettingsOrganizationJoinableItem, type SettingsOrganizationListItem, type SettingsOrganizationType, type SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SharedCreditsView, type SharedPoolBalance, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerGroup, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, belowUsageReason, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralLink, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sponsoredCreditsText, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
package/dist/index.d.ts CHANGED
@@ -1504,6 +1504,14 @@ interface WorkspaceGeneralTabProps {
1504
1504
  }
1505
1505
  declare function WorkspaceGeneralTab({ workspace, loading, memberCount, organizationName, organizationStatus, saving, onSave, onLeave, onDelete, }: WorkspaceGeneralTabProps): react.JSX.Element;
1506
1506
 
1507
+ /** The signed-in user's referral code, or `""` when they have none. Accepts
1508
+ * the spellings hosts have shipped (`referralCode`, `referral_code` and the
1509
+ * misspelt `referal*`). */
1510
+ declare function referralCodeOf(user: unknown): string;
1511
+ /** `<origin>?referral_code=<code>`; `""` without a code or an origin. A new
1512
+ * account created from this link is recorded as the code owner's referral. */
1513
+ declare function referralLink(code: string, origin: string): string;
1514
+
1507
1515
  type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width' | 'height'> & {
1508
1516
  color?: string;
1509
1517
  strokeWidth?: number | string;
@@ -2662,13 +2670,15 @@ interface AdministrationOverviewProps {
2662
2670
  hasOrganization: boolean;
2663
2671
  isWorkspaceAdmin: boolean;
2664
2672
  showConnectedApps: boolean;
2673
+ /** The signed-in user has a referral code to share. */
2674
+ showReferral?: boolean;
2665
2675
  showIntegrations: boolean;
2666
2676
  canInvite: boolean;
2667
2677
  onNavigate: (tab: SettingsTab) => void;
2668
2678
  onInvitePeople?: () => void;
2669
2679
  }
2670
2680
  /** Scope-first navigation into the existing forms; contains no mutation logic. */
2671
- declare function AdministrationOverview({ workspaceName, organizationName, hasWorkspace, hasOrganization, isWorkspaceAdmin, showConnectedApps, showIntegrations, canInvite, onNavigate, onInvitePeople, }: AdministrationOverviewProps): react.JSX.Element;
2681
+ declare function AdministrationOverview({ workspaceName, organizationName, hasWorkspace, hasOrganization, isWorkspaceAdmin, showConnectedApps, showIntegrations, showReferral, canInvite, onNavigate, onInvitePeople, }: AdministrationOverviewProps): react.JSX.Element;
2672
2682
 
2673
2683
  /** Shared invitation rule. A result belongs to one authenticated workspace;
2674
2684
  * callers must explicitly mark it ready after that workspace's reads settle. */
@@ -2739,4 +2749,4 @@ interface AppSettingsRowProps {
2739
2749
  }
2740
2750
  declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
2741
2751
 
2742
- 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 CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type MemberCreditLimit, MemberCreditLimitModal, type MemberCreditLimitRow, type MemberCreditLimitSource, type MemberCreditLimitsResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationDetails, OrganizationIntegrationsContent, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralTab, RemovePoolMemberModal, type RemovePoolMemberModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCreateOptions, type SettingsOrganizationCurrent, type SettingsOrganizationJoinableItem, type SettingsOrganizationListItem, type SettingsOrganizationType, type SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SharedCreditsView, type SharedPoolBalance, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerGroup, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, belowUsageReason, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sponsoredCreditsText, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
2752
+ 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 CreditLimitValidation, type CreditPoolCandidate, type CreditPoolFormerMember, type CreditPoolMember, CreditPoolMemberModal, type CreditPoolMemberModalProps, type CreditPoolMemberStatus, type CreditPoolMode, type CreditPoolResponse, type CreditsMeter, type CurrentPlanState, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, DEFAULT_USER_LANGUAGE, EMPTY_USAGE_LOGS_PAGE, ExportDateModal, type FetchUsageLogs, type FetchUsageLogsInRangeOptions, INITIAL_USAGE_LOGS_STATE, InviteUpdateModal, type InvoicePdfResponse, type MemberCreditLimit, MemberCreditLimitModal, type MemberCreditLimitRow, type MemberCreditLimitSource, type MemberCreditLimitsResponse, MemberListFrame, type MemberListFrameProps, type MemberListTab, MemberListToolbar, type MemberListToolbarProps, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationDetails, OrganizationIntegrationsContent, type OrganizationInvite, type OrganizationJoinRequest, type OrganizationJoinableWorkspace, type OrganizationMember, OrganizationMemberModal, type OrganizationMemberModalProps, type OrganizationMemberRole, OrganizationModal, OrganizationPicker, type OrganizationPickerItem, type OrganizationPickerProps, type OrganizationPickerType, type OrganizationView, type OrganizationWorkspaceItem, POOL_ERROR_CODES, POOL_EXPIRY_MAX_MONTHS, POOL_NOTE_MAX_LENGTH, PerUserLimitsView, type PoolEndsAtResult, type PoolErrorCode, type PoolExpiryChoice, type PoolValueValidation, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, REMOVE_REASON_MAX_LENGTH, ReferralTab, RemovePoolMemberModal, type RemovePoolMemberModalProps, SCOPE_LABELS, ScopeHeader, type ScopeHeaderProps, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsIntegrationsAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCreateOptions, type SettingsOrganizationCurrent, type SettingsOrganizationJoinableItem, type SettingsOrganizationListItem, type SettingsOrganizationType, type SettingsScope, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SharedCreditsView, type SharedPoolBalance, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_SCOPE, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, USAGE_LOGS_EXPORT_BATCH_SIZE, USAGE_LOGS_EXPORT_EXTRA_REQUESTS, USAGE_LOGS_EXPORT_MAX_ROWS, USAGE_LOGS_PAGE_SIZE, USER_LANGUAGES, type UpdateCreditPoolMemberInput, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryPagination, type UsageHistoryResponse, type UsageLogsAction, type UsageLogsExportResult, type UsageLogsPage, UsageLogsPager, type UsageLogsQuery, type UsageLogsState, type UsedByNamesLoader, type UserLanguage, type UserPermissions, WORKSPACE_LIST_PAGE_SIZE, type WorkspaceData, WorkspaceGeneralTab, type WorkspaceGeneralTabProps, type WorkspaceInvite, type WorkspaceListOrganization, WorkspaceListTab, type WorkspaceMember, WorkspaceModal, type WorkspaceOrganization, type WorkspaceOrganizationRequest, WorkspacePicker, type WorkspacePickerGroup, type WorkspacePickerItem, type WorkspacePickerProps, WorkspaceTab, type WorkspaceUsageResponse, belowUsageReason, canShowSharedCredits, cleanCreditLimitInput, cleanPoolValueInput, countLabel, createUsedByNamesLoader, creditCycleUnit, creditsMeter, deriveWorkspaceInvitePermission, describeAllowance, describeDefaultLimit, describeMemberLimit, entitlementFromBody, entitlementFromFailure, expiryChoiceFor, fetchUsageLogsInRange, findBillingError, findPoolError, formatCreditLimit, formatCredits, formatPoolEndsAt, formatPoolSplit, groupWorkspaceList, hasPaidFeatures, inviteUpdate, isLimitBelowUsage, isPaidPlan, isSponsoredEntitlement, joinMembersWithLimits, lastUsedLabel, limitBelowUsageUsed, limitSourceLabel, loadCurrentPlan, loadWorkspaceOrganization, memberRoleUpdate, minPoolEndDate, minimumCreditLimit, ownCreditsFirstText, parseBillingEntitlement, parseInviteEmails, pausedOwnCreditsText, poolEndsAtFrom, poolErrorMessage, poolRenewsAtCycleEnd, poolWorkspaceName, productsForCountry, readSettingsCaller, referralCodeOf, referralLink, rememberSettingsCaller, resolveSettingsTabFromPath, roundCredits, settingsReturnTarget, sharedPoolBannerText, sharedPoolEndsText, sliceUsageLogsPage, sponsoredCreditsText, toCsv, toLocalDateInput, usageLogsCsvRows, usageLogsDateRange, usageLogsExportFileName, usageLogsPage, usageLogsReducer, usageLogsReloadPage, usageLogsSpentByOthers, useBillingEntitlement, useSettingsAdapters, useWorkspaceInvitePermission, useWorkspaceOrganization, usedByNamesFrom, usedByWorkspaceKey, userLanguageLabel, validateCreditLimitInput, validateDefaultCreditLimitInput, validatePoolText, validatePoolValue };
package/dist/index.js CHANGED
@@ -131,6 +131,8 @@ __export(index_exports, {
131
131
  poolWorkspaceName: () => poolWorkspaceName,
132
132
  productsForCountry: () => productsForCountry,
133
133
  readSettingsCaller: () => readSettingsCaller,
134
+ referralCodeOf: () => referralCodeOf,
135
+ referralLink: () => referralLink,
134
136
  rememberSettingsCaller: () => rememberSettingsCaller,
135
137
  resolveSettingsTabFromPath: () => resolveSettingsTabFromPath,
136
138
  roundCredits: () => roundCredits,
@@ -496,7 +498,7 @@ var TAB_DESCRIPTIONS = {
496
498
  organization: "Everyone in the organization and their role",
497
499
  organizationWorkspaces: "Every workspace in this organization, and workspaces asking to join it",
498
500
  organizationDomains: "Every workspace in this organization, and workspaces asking to join it",
499
- referral: "Invite friends to Streamoid and track the rewards you have earned",
501
+ referral: "Your link for bringing new people to Streamoid",
500
502
  billing: "Workspace plan, credits, invoices and usage history",
501
503
  apikey: "Create and revoke keys for calling the Streamoid APIs",
502
504
  connectedApps: "Apps like ChatGPT and Codex that you've allowed to use CXO for you",
@@ -538,6 +540,7 @@ function AdministrationOverview({
538
540
  isWorkspaceAdmin,
539
541
  showConnectedApps,
540
542
  showIntegrations,
543
+ showReferral = false,
541
544
  canInvite,
542
545
  onNavigate,
543
546
  onInvitePeople
@@ -545,7 +548,7 @@ function AdministrationOverview({
545
548
  const groups = [
546
549
  {
547
550
  title: "Account",
548
- tabs: ["profile", "workspaceList", ...showConnectedApps ? ["connectedApps"] : []]
551
+ tabs: ["profile", "workspaceList", ...showConnectedApps ? ["connectedApps"] : [], ...showReferral ? ["referral"] : []]
549
552
  },
550
553
  ...hasWorkspace ? [{
551
554
  title: "Workspace",
@@ -14477,6 +14480,20 @@ function ConnectedAppsContent() {
14477
14480
  );
14478
14481
  }
14479
14482
 
14483
+ // src/referral.ts
14484
+ function referralCodeOf(user) {
14485
+ if (!user || typeof user !== "object") return "";
14486
+ const u = user;
14487
+ for (const key of ["referralCode", "referral_code", "referalCode", "referal_code"]) {
14488
+ const value = u[key];
14489
+ if (typeof value === "string" && value.trim()) return value.trim();
14490
+ }
14491
+ return "";
14492
+ }
14493
+ function referralLink(code, origin) {
14494
+ return code && origin ? `${origin}?referral_code=${encodeURIComponent(code)}` : "";
14495
+ }
14496
+
14480
14497
  // src/organization-integrations-content.tsx
14481
14498
  var import_react26 = require("react");
14482
14499
  var import_ui20 = require("@streamoid/ui");
@@ -14862,7 +14879,8 @@ function SettingsNav({
14862
14879
  hasOrganization,
14863
14880
  isWorkspaceAdmin,
14864
14881
  showConnectedApps = false,
14865
- showIntegrations = false
14882
+ showIntegrations = false,
14883
+ showReferral = false
14866
14884
  }) {
14867
14885
  const item = (tab, icon) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
14868
14886
  SettingsNavItem,
@@ -14901,7 +14919,8 @@ function SettingsNav({
14901
14919
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Account" }),
14902
14920
  item("profile", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconUser, { className: "w-5 h-5", color })),
14903
14921
  item("workspaceList", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconSwitch, { className: "w-5 h-5", color })),
14904
- showConnectedApps && item("connectedApps", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiconPlug_default, { className: "w-5 h-5", color }))
14922
+ showConnectedApps && item("connectedApps", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiconPlug_default, { className: "w-5 h-5", color })),
14923
+ showReferral && item("referral", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconReferral, { className: "w-5 h-5", color }))
14905
14924
  ] }),
14906
14925
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_ui21.ScHDivider, {}),
14907
14926
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
@@ -15910,11 +15929,26 @@ function WorkspaceListTab({
15910
15929
  }
15911
15930
  var WorkspaceTab = WorkspaceListTab;
15912
15931
  function ReferralTab() {
15913
- const { auth } = useSettingsAdapters();
15914
- const user = auth.user;
15915
- const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
15932
+ const { auth, toast } = useSettingsAdapters();
15916
15933
  const domain = typeof window !== "undefined" ? window.location.origin : "";
15917
- const referralLink = referralCode && domain ? `${domain}?referral_code=${encodeURIComponent(referralCode)}` : "";
15934
+ const link = referralLink(referralCodeOf(auth.user), domain);
15935
+ const [copied, setCopied] = (0, import_react27.useState)(false);
15936
+ const copiedTimer = (0, import_react27.useRef)(null);
15937
+ (0, import_react27.useEffect)(() => () => {
15938
+ if (copiedTimer.current) clearTimeout(copiedTimer.current);
15939
+ }, []);
15940
+ const copyLink = async () => {
15941
+ if (!link) return;
15942
+ try {
15943
+ await navigator.clipboard.writeText(link);
15944
+ toast.success("Referral link copied");
15945
+ setCopied(true);
15946
+ if (copiedTimer.current) clearTimeout(copiedTimer.current);
15947
+ copiedTimer.current = setTimeout(() => setCopied(false), 2e3);
15948
+ } catch {
15949
+ toast.error("Couldn't copy the referral link");
15950
+ }
15951
+ };
15918
15952
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15919
15953
  "div",
15920
15954
  {
@@ -15929,52 +15963,50 @@ function ReferralTab() {
15929
15963
  borderRadius: "var(--radius-3xl)",
15930
15964
  padding: "var(--spacing-6xl)"
15931
15965
  },
15932
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15933
- "div",
15966
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15967
+ import_ui22.ScTextField,
15934
15968
  {
15935
- className: "flex items-start w-full",
15936
- style: { gap: "var(--spacing-3xl)" },
15937
- children: [
15938
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15939
- import_ui22.ScTextField,
15940
- {
15941
- label: "Your Referral Link",
15942
- labelGroup: "label",
15943
- state: "filled",
15944
- value: referralLink,
15945
- placeholderFilled: "https://your-domain.com?referral_code=ABC123",
15946
- tfGroup: "icon-right",
15947
- tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15948
- import_icons18.SiconBolt,
15949
- {
15950
- className: "w-6 h-6",
15951
- color: "var(--alias-text---icons-primary)"
15952
- }
15953
- ),
15954
- className: "sc-text-field-full-width flex-1 min-w-0",
15955
- readOnly: true
15956
- }
15957
- ),
15958
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15959
- import_ui22.ScTextField,
15960
- {
15961
- label: "Invite through email",
15962
- labelGroup: "label",
15963
- state: "filled",
15964
- value: user?.email ?? "",
15965
- placeholderFilled: "chris@kepler.com",
15966
- tfGroup: "icon-right",
15967
- tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15968
- import_icons18.SiconSend,
15969
- {
15970
- className: "w-6 h-6",
15971
- color: "var(--alias-text---icons-primary)"
15972
- }
15973
- ),
15974
- className: "sc-text-field-full-width flex-1 min-w-0"
15975
- }
15976
- )
15977
- ]
15969
+ label: "Your Referral Link",
15970
+ labelGroup: "label",
15971
+ state: "filled",
15972
+ value: link,
15973
+ placeholderFilled: "https://your-domain.com?referral_code=ABC123",
15974
+ tfGroup: "none",
15975
+ rightSlot: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15976
+ "button",
15977
+ {
15978
+ type: "button",
15979
+ "aria-label": copied ? "Copied" : "Copy referral link",
15980
+ title: copied ? "Copied" : "Copy referral link",
15981
+ disabled: !link,
15982
+ onClick: () => void copyLink(),
15983
+ className: "flex items-center justify-center shrink-0 cursor-pointer border-none",
15984
+ style: {
15985
+ gap: "var(--spacing-xs)",
15986
+ padding: "0 var(--spacing-md)",
15987
+ height: 32,
15988
+ borderRadius: "var(--radius-lg)",
15989
+ background: "transparent",
15990
+ color: "var(--alias-text---icons-primary)",
15991
+ fontSize: "var(--font-size-font-size-sm)",
15992
+ fontWeight: 500
15993
+ },
15994
+ onMouseEnter: (e) => {
15995
+ e.currentTarget.style.background = "var(--alias-fill-neutral-neutralplus)";
15996
+ },
15997
+ onMouseLeave: (e) => {
15998
+ e.currentTarget.style.background = "transparent";
15999
+ },
16000
+ children: [
16001
+ copied ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconCheck, { className: "w-4 h-4", color: "var(--alias-text---icons-primary)" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconCopy, { className: "w-4 h-4", color: "var(--alias-text---icons-primary)" }),
16002
+ copied ? "Copied" : "Copy"
16003
+ ]
16004
+ }
16005
+ ),
16006
+ desc: "Share this link. When someone opens it and creates a new Streamoid account, it's recorded as your referral.",
16007
+ className: "sc-text-field-full-width w-full min-w-0",
16008
+ readOnly: true,
16009
+ onFocus: (e) => e.currentTarget.select()
15978
16010
  }
15979
16011
  )
15980
16012
  }
@@ -16039,6 +16071,7 @@ function SettingsContentInner({
16039
16071
  const isOverview = overviewDetail && showOverview;
16040
16072
  const overviewInvite = useWorkspaceInvitePermission(adapters, { enabled: isOverview && !!onInvitePeople });
16041
16073
  const showConnectedApps = !!integrations;
16074
+ const showReferral = !!referralCodeOf(adapters.auth.user);
16042
16075
  const showIntegrations = !!integrations?.listOrganizationConnections && !!integrations.getOrganizationAccess && organization.current?.role === "admin";
16043
16076
  const workspaceId = workspace.current?.id ?? null;
16044
16077
  const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
@@ -16760,6 +16793,7 @@ function SettingsContentInner({
16760
16793
  isWorkspaceAdmin,
16761
16794
  showConnectedApps,
16762
16795
  showIntegrations,
16796
+ showReferral,
16763
16797
  canInvite: !overviewInvite.isLoading && overviewInvite.canInvite,
16764
16798
  onNavigate: setActiveTab,
16765
16799
  onInvitePeople
@@ -16780,7 +16814,8 @@ function SettingsContentInner({
16780
16814
  organizationName: organizationScopeName,
16781
16815
  hasOrganization,
16782
16816
  showConnectedApps,
16783
- showIntegrations
16817
+ showIntegrations,
16818
+ showReferral
16784
16819
  }
16785
16820
  ),
16786
16821
  activeTab === "profile" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ProfileTab, {}),
@@ -16846,7 +16881,7 @@ function SettingsContentInner({
16846
16881
  }
16847
16882
  }
16848
16883
  ),
16849
- activeTab === "referral" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ReferralTab, {}),
16884
+ activeTab === "referral" && showReferral && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ReferralTab, {}),
16850
16885
  activeTab === "connectedApps" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ConnectedAppsContent, {}),
16851
16886
  activeTab === "organizationIntegrations" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OrganizationIntegrationsContent, {}),
16852
16887
  activeTab === "organizationList" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OrganizationListContent, {}),
package/dist/index.mjs CHANGED
@@ -332,7 +332,7 @@ var TAB_DESCRIPTIONS = {
332
332
  organization: "Everyone in the organization and their role",
333
333
  organizationWorkspaces: "Every workspace in this organization, and workspaces asking to join it",
334
334
  organizationDomains: "Every workspace in this organization, and workspaces asking to join it",
335
- referral: "Invite friends to Streamoid and track the rewards you have earned",
335
+ referral: "Your link for bringing new people to Streamoid",
336
336
  billing: "Workspace plan, credits, invoices and usage history",
337
337
  apikey: "Create and revoke keys for calling the Streamoid APIs",
338
338
  connectedApps: "Apps like ChatGPT and Codex that you've allowed to use CXO for you",
@@ -374,6 +374,7 @@ function AdministrationOverview({
374
374
  isWorkspaceAdmin,
375
375
  showConnectedApps,
376
376
  showIntegrations,
377
+ showReferral = false,
377
378
  canInvite,
378
379
  onNavigate,
379
380
  onInvitePeople
@@ -381,7 +382,7 @@ function AdministrationOverview({
381
382
  const groups = [
382
383
  {
383
384
  title: "Account",
384
- tabs: ["profile", "workspaceList", ...showConnectedApps ? ["connectedApps"] : []]
385
+ tabs: ["profile", "workspaceList", ...showConnectedApps ? ["connectedApps"] : [], ...showReferral ? ["referral"] : []]
385
386
  },
386
387
  ...hasWorkspace ? [{
387
388
  title: "Workspace",
@@ -615,8 +616,10 @@ import {
615
616
  SiconTeam,
616
617
  SiconWorkspace as SiconWorkspace2,
617
618
  SiconPlus as SiconPlus3,
619
+ SiconReferral,
618
620
  SiconBolt,
619
- SiconSend,
621
+ SiconCopy as SiconCopy2,
622
+ SiconCheck as SiconCheck2,
620
623
  SiconUpload as SiconUpload2,
621
624
  SiconDelete,
622
625
  SiconUser,
@@ -14390,6 +14393,20 @@ function ConnectedAppsContent() {
14390
14393
  );
14391
14394
  }
14392
14395
 
14396
+ // src/referral.ts
14397
+ function referralCodeOf(user) {
14398
+ if (!user || typeof user !== "object") return "";
14399
+ const u = user;
14400
+ for (const key of ["referralCode", "referral_code", "referalCode", "referal_code"]) {
14401
+ const value = u[key];
14402
+ if (typeof value === "string" && value.trim()) return value.trim();
14403
+ }
14404
+ return "";
14405
+ }
14406
+ function referralLink(code, origin) {
14407
+ return code && origin ? `${origin}?referral_code=${encodeURIComponent(code)}` : "";
14408
+ }
14409
+
14393
14410
  // src/organization-integrations-content.tsx
14394
14411
  import { useState as useState24 } from "react";
14395
14412
  import { ScButton as ScButton17, ScToggleSwitch } from "@streamoid/ui";
@@ -14775,7 +14792,8 @@ function SettingsNav({
14775
14792
  hasOrganization,
14776
14793
  isWorkspaceAdmin,
14777
14794
  showConnectedApps = false,
14778
- showIntegrations = false
14795
+ showIntegrations = false,
14796
+ showReferral = false
14779
14797
  }) {
14780
14798
  const item = (tab, icon) => /* @__PURE__ */ jsx33(
14781
14799
  SettingsNavItem,
@@ -14814,7 +14832,8 @@ function SettingsNav({
14814
14832
  /* @__PURE__ */ jsx33("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Account" }),
14815
14833
  item("profile", (color) => /* @__PURE__ */ jsx33(SiconUser, { className: "w-5 h-5", color })),
14816
14834
  item("workspaceList", (color) => /* @__PURE__ */ jsx33(SiconSwitch, { className: "w-5 h-5", color })),
14817
- showConnectedApps && item("connectedApps", (color) => /* @__PURE__ */ jsx33(SiconPlug_default, { className: "w-5 h-5", color }))
14835
+ showConnectedApps && item("connectedApps", (color) => /* @__PURE__ */ jsx33(SiconPlug_default, { className: "w-5 h-5", color })),
14836
+ showReferral && item("referral", (color) => /* @__PURE__ */ jsx33(SiconReferral, { className: "w-5 h-5", color }))
14818
14837
  ] }),
14819
14838
  /* @__PURE__ */ jsx33(ScHDivider, {}),
14820
14839
  /* @__PURE__ */ jsxs30("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
@@ -15823,11 +15842,26 @@ function WorkspaceListTab({
15823
15842
  }
15824
15843
  var WorkspaceTab = WorkspaceListTab;
15825
15844
  function ReferralTab() {
15826
- const { auth } = useSettingsAdapters();
15827
- const user = auth.user;
15828
- const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
15845
+ const { auth, toast } = useSettingsAdapters();
15829
15846
  const domain = typeof window !== "undefined" ? window.location.origin : "";
15830
- const referralLink = referralCode && domain ? `${domain}?referral_code=${encodeURIComponent(referralCode)}` : "";
15847
+ const link = referralLink(referralCodeOf(auth.user), domain);
15848
+ const [copied, setCopied] = useState25(false);
15849
+ const copiedTimer = useRef12(null);
15850
+ useEffect20(() => () => {
15851
+ if (copiedTimer.current) clearTimeout(copiedTimer.current);
15852
+ }, []);
15853
+ const copyLink = async () => {
15854
+ if (!link) return;
15855
+ try {
15856
+ await navigator.clipboard.writeText(link);
15857
+ toast.success("Referral link copied");
15858
+ setCopied(true);
15859
+ if (copiedTimer.current) clearTimeout(copiedTimer.current);
15860
+ copiedTimer.current = setTimeout(() => setCopied(false), 2e3);
15861
+ } catch {
15862
+ toast.error("Couldn't copy the referral link");
15863
+ }
15864
+ };
15831
15865
  return /* @__PURE__ */ jsx33(
15832
15866
  "div",
15833
15867
  {
@@ -15842,52 +15876,50 @@ function ReferralTab() {
15842
15876
  borderRadius: "var(--radius-3xl)",
15843
15877
  padding: "var(--spacing-6xl)"
15844
15878
  },
15845
- children: /* @__PURE__ */ jsxs30(
15846
- "div",
15879
+ children: /* @__PURE__ */ jsx33(
15880
+ ScTextField,
15847
15881
  {
15848
- className: "flex items-start w-full",
15849
- style: { gap: "var(--spacing-3xl)" },
15850
- children: [
15851
- /* @__PURE__ */ jsx33(
15852
- ScTextField,
15853
- {
15854
- label: "Your Referral Link",
15855
- labelGroup: "label",
15856
- state: "filled",
15857
- value: referralLink,
15858
- placeholderFilled: "https://your-domain.com?referral_code=ABC123",
15859
- tfGroup: "icon-right",
15860
- tfRightIcon: /* @__PURE__ */ jsx33(
15861
- SiconBolt,
15862
- {
15863
- className: "w-6 h-6",
15864
- color: "var(--alias-text---icons-primary)"
15865
- }
15866
- ),
15867
- className: "sc-text-field-full-width flex-1 min-w-0",
15868
- readOnly: true
15869
- }
15870
- ),
15871
- /* @__PURE__ */ jsx33(
15872
- ScTextField,
15873
- {
15874
- label: "Invite through email",
15875
- labelGroup: "label",
15876
- state: "filled",
15877
- value: user?.email ?? "",
15878
- placeholderFilled: "chris@kepler.com",
15879
- tfGroup: "icon-right",
15880
- tfRightIcon: /* @__PURE__ */ jsx33(
15881
- SiconSend,
15882
- {
15883
- className: "w-6 h-6",
15884
- color: "var(--alias-text---icons-primary)"
15885
- }
15886
- ),
15887
- className: "sc-text-field-full-width flex-1 min-w-0"
15888
- }
15889
- )
15890
- ]
15882
+ label: "Your Referral Link",
15883
+ labelGroup: "label",
15884
+ state: "filled",
15885
+ value: link,
15886
+ placeholderFilled: "https://your-domain.com?referral_code=ABC123",
15887
+ tfGroup: "none",
15888
+ rightSlot: /* @__PURE__ */ jsxs30(
15889
+ "button",
15890
+ {
15891
+ type: "button",
15892
+ "aria-label": copied ? "Copied" : "Copy referral link",
15893
+ title: copied ? "Copied" : "Copy referral link",
15894
+ disabled: !link,
15895
+ onClick: () => void copyLink(),
15896
+ className: "flex items-center justify-center shrink-0 cursor-pointer border-none",
15897
+ style: {
15898
+ gap: "var(--spacing-xs)",
15899
+ padding: "0 var(--spacing-md)",
15900
+ height: 32,
15901
+ borderRadius: "var(--radius-lg)",
15902
+ background: "transparent",
15903
+ color: "var(--alias-text---icons-primary)",
15904
+ fontSize: "var(--font-size-font-size-sm)",
15905
+ fontWeight: 500
15906
+ },
15907
+ onMouseEnter: (e) => {
15908
+ e.currentTarget.style.background = "var(--alias-fill-neutral-neutralplus)";
15909
+ },
15910
+ onMouseLeave: (e) => {
15911
+ e.currentTarget.style.background = "transparent";
15912
+ },
15913
+ children: [
15914
+ copied ? /* @__PURE__ */ jsx33(SiconCheck2, { className: "w-4 h-4", color: "var(--alias-text---icons-primary)" }) : /* @__PURE__ */ jsx33(SiconCopy2, { className: "w-4 h-4", color: "var(--alias-text---icons-primary)" }),
15915
+ copied ? "Copied" : "Copy"
15916
+ ]
15917
+ }
15918
+ ),
15919
+ desc: "Share this link. When someone opens it and creates a new Streamoid account, it's recorded as your referral.",
15920
+ className: "sc-text-field-full-width w-full min-w-0",
15921
+ readOnly: true,
15922
+ onFocus: (e) => e.currentTarget.select()
15891
15923
  }
15892
15924
  )
15893
15925
  }
@@ -15952,6 +15984,7 @@ function SettingsContentInner({
15952
15984
  const isOverview = overviewDetail && showOverview;
15953
15985
  const overviewInvite = useWorkspaceInvitePermission(adapters, { enabled: isOverview && !!onInvitePeople });
15954
15986
  const showConnectedApps = !!integrations;
15987
+ const showReferral = !!referralCodeOf(adapters.auth.user);
15955
15988
  const showIntegrations = !!integrations?.listOrganizationConnections && !!integrations.getOrganizationAccess && organization.current?.role === "admin";
15956
15989
  const workspaceId = workspace.current?.id ?? null;
15957
15990
  const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
@@ -16673,6 +16706,7 @@ function SettingsContentInner({
16673
16706
  isWorkspaceAdmin,
16674
16707
  showConnectedApps,
16675
16708
  showIntegrations,
16709
+ showReferral,
16676
16710
  canInvite: !overviewInvite.isLoading && overviewInvite.canInvite,
16677
16711
  onNavigate: setActiveTab,
16678
16712
  onInvitePeople
@@ -16693,7 +16727,8 @@ function SettingsContentInner({
16693
16727
  organizationName: organizationScopeName,
16694
16728
  hasOrganization,
16695
16729
  showConnectedApps,
16696
- showIntegrations
16730
+ showIntegrations,
16731
+ showReferral
16697
16732
  }
16698
16733
  ),
16699
16734
  activeTab === "profile" && /* @__PURE__ */ jsx33(ProfileTab, {}),
@@ -16759,7 +16794,7 @@ function SettingsContentInner({
16759
16794
  }
16760
16795
  }
16761
16796
  ),
16762
- activeTab === "referral" && /* @__PURE__ */ jsx33(ReferralTab, {}),
16797
+ activeTab === "referral" && showReferral && /* @__PURE__ */ jsx33(ReferralTab, {}),
16763
16798
  activeTab === "connectedApps" && /* @__PURE__ */ jsx33(ConnectedAppsContent, {}),
16764
16799
  activeTab === "organizationIntegrations" && /* @__PURE__ */ jsx33(OrganizationIntegrationsContent, {}),
16765
16800
  activeTab === "organizationList" && /* @__PURE__ */ jsx33(OrganizationListContent, {}),
@@ -17823,6 +17858,8 @@ export {
17823
17858
  poolWorkspaceName,
17824
17859
  productsForCountry,
17825
17860
  readSettingsCaller,
17861
+ referralCodeOf,
17862
+ referralLink,
17826
17863
  rememberSettingsCaller,
17827
17864
  resolveSettingsTabFromPath,
17828
17865
  roundCredits,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/settings",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",