@streamoid/settings 0.16.1 → 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 +38 -3
- package/dist/index.d.ts +38 -3
- package/dist/index.js +123 -67
- package/dist/index.mjs +126 -68
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1094,6 +1094,16 @@ interface SettingsApiAdapter {
|
|
|
1094
1094
|
invitationId?: string;
|
|
1095
1095
|
}) => Promise<void>;
|
|
1096
1096
|
resendInvite: (invitationId: string) => Promise<void>;
|
|
1097
|
+
/**
|
|
1098
|
+
* Change a pending invitation's role and access. They are granted when the
|
|
1099
|
+
* invite is accepted; the invite link and its expiry stay as they were.
|
|
1100
|
+
* Admin only. Omit it and pending invites stay read-only (cancel / resend).
|
|
1101
|
+
* Also needs `getServices`: without the workspace's services there is no
|
|
1102
|
+
* way to turn the app switches into `serviceIds`, so editing stays off.
|
|
1103
|
+
*/
|
|
1104
|
+
updateInvite?: (input: {
|
|
1105
|
+
invitationId: string;
|
|
1106
|
+
} & MemberPermissionsPayload) => Promise<void>;
|
|
1097
1107
|
/**
|
|
1098
1108
|
* @deprecated No longer called: `updateMemberRole` makes a member an admin by
|
|
1099
1109
|
* itself, and promoting first made that request fail. Kept so existing
|
|
@@ -1494,6 +1504,14 @@ interface WorkspaceGeneralTabProps {
|
|
|
1494
1504
|
}
|
|
1495
1505
|
declare function WorkspaceGeneralTab({ workspace, loading, memberCount, organizationName, organizationStatus, saving, onSave, onLeave, onDelete, }: WorkspaceGeneralTabProps): react.JSX.Element;
|
|
1496
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
|
+
|
|
1497
1515
|
type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width' | 'height'> & {
|
|
1498
1516
|
color?: string;
|
|
1499
1517
|
strokeWidth?: number | string;
|
|
@@ -1748,6 +1766,14 @@ declare function memberRoleUpdate(current: {
|
|
|
1748
1766
|
}, permissions: UserPermissions, services: ServiceItem[]): ({
|
|
1749
1767
|
userId: string;
|
|
1750
1768
|
} & MemberPermissionsPayload) | null;
|
|
1769
|
+
/**
|
|
1770
|
+
* The `updateInvite` request that saving a pending invite sends. Same shape as
|
|
1771
|
+
* an invite: an admin invite carries no app or store grants (admins hold every
|
|
1772
|
+
* app), a member invite carries exactly the apps switched on.
|
|
1773
|
+
*/
|
|
1774
|
+
declare function inviteUpdate(invitationId: string, permissions: UserPermissions, services: ServiceItem[]): {
|
|
1775
|
+
invitationId: string;
|
|
1776
|
+
} & MemberPermissionsPayload;
|
|
1751
1777
|
declare function TeamsContent({ embedded, onInviteOpen, onInviteOpenChange, onCanInviteChange, inviteRequested, onInviteRequestHandled, workspaceName, workspaceImageUrl, organizationName, hiddenApps, }?: {
|
|
1752
1778
|
embedded?: boolean;
|
|
1753
1779
|
onInviteOpen?: boolean;
|
|
@@ -2160,6 +2186,13 @@ interface InviteUpdateModalProps {
|
|
|
2160
2186
|
*/
|
|
2161
2187
|
hiddenApps?: readonly AppKey[];
|
|
2162
2188
|
allowSubmitWithoutChanges?: boolean;
|
|
2189
|
+
/**
|
|
2190
|
+
* Update mode: whose permissions are being edited. `"invite"` edits a
|
|
2191
|
+
* pending invitation — the dialog says so, its remove button cancels the
|
|
2192
|
+
* invite, and, like the invite form, a member must keep at least one app.
|
|
2193
|
+
* Defaults to `"member"`.
|
|
2194
|
+
*/
|
|
2195
|
+
subject?: "member" | "invite";
|
|
2163
2196
|
initialPermissions?: UserPermissions;
|
|
2164
2197
|
onClose: () => void;
|
|
2165
2198
|
onSave?: (permissions: UserPermissions) => void;
|
|
@@ -2216,7 +2249,7 @@ interface InviteUpdateModalProps {
|
|
|
2216
2249
|
*/
|
|
2217
2250
|
onInvite?: (permissions: UserPermissions, email: string, organizationStanding?: OrganizationStanding) => void;
|
|
2218
2251
|
}
|
|
2219
|
-
declare function InviteUpdateModal({ open, mode, userEmail, stores, hiddenApps, allowSubmitWithoutChanges, initialPermissions, onClose, onSave, onRemove, canRemove, showOrganizationStanding, organizationName, allowGuestStanding, initialOrganizationStanding, organizationDomain: _organizationDomain, allowAdminRole, onInvite, onInviteMany, }: InviteUpdateModalProps): react.JSX.Element | null;
|
|
2252
|
+
declare function InviteUpdateModal({ open, mode, userEmail, stores, hiddenApps, allowSubmitWithoutChanges, subject, initialPermissions, onClose, onSave, onRemove, canRemove, showOrganizationStanding, organizationName, allowGuestStanding, initialOrganizationStanding, organizationDomain: _organizationDomain, allowAdminRole, onInvite, onInviteMany, }: InviteUpdateModalProps): react.JSX.Element | null;
|
|
2220
2253
|
|
|
2221
2254
|
interface ExportDateModalProps {
|
|
2222
2255
|
title: string;
|
|
@@ -2637,13 +2670,15 @@ interface AdministrationOverviewProps {
|
|
|
2637
2670
|
hasOrganization: boolean;
|
|
2638
2671
|
isWorkspaceAdmin: boolean;
|
|
2639
2672
|
showConnectedApps: boolean;
|
|
2673
|
+
/** The signed-in user has a referral code to share. */
|
|
2674
|
+
showReferral?: boolean;
|
|
2640
2675
|
showIntegrations: boolean;
|
|
2641
2676
|
canInvite: boolean;
|
|
2642
2677
|
onNavigate: (tab: SettingsTab) => void;
|
|
2643
2678
|
onInvitePeople?: () => void;
|
|
2644
2679
|
}
|
|
2645
2680
|
/** Scope-first navigation into the existing forms; contains no mutation logic. */
|
|
2646
|
-
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;
|
|
2647
2682
|
|
|
2648
2683
|
/** Shared invitation rule. A result belongs to one authenticated workspace;
|
|
2649
2684
|
* callers must explicitly mark it ready after that workspace's reads settle. */
|
|
@@ -2714,4 +2749,4 @@ interface AppSettingsRowProps {
|
|
|
2714
2749
|
}
|
|
2715
2750
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
2716
2751
|
|
|
2717
|
-
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, 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
|
@@ -1094,6 +1094,16 @@ interface SettingsApiAdapter {
|
|
|
1094
1094
|
invitationId?: string;
|
|
1095
1095
|
}) => Promise<void>;
|
|
1096
1096
|
resendInvite: (invitationId: string) => Promise<void>;
|
|
1097
|
+
/**
|
|
1098
|
+
* Change a pending invitation's role and access. They are granted when the
|
|
1099
|
+
* invite is accepted; the invite link and its expiry stay as they were.
|
|
1100
|
+
* Admin only. Omit it and pending invites stay read-only (cancel / resend).
|
|
1101
|
+
* Also needs `getServices`: without the workspace's services there is no
|
|
1102
|
+
* way to turn the app switches into `serviceIds`, so editing stays off.
|
|
1103
|
+
*/
|
|
1104
|
+
updateInvite?: (input: {
|
|
1105
|
+
invitationId: string;
|
|
1106
|
+
} & MemberPermissionsPayload) => Promise<void>;
|
|
1097
1107
|
/**
|
|
1098
1108
|
* @deprecated No longer called: `updateMemberRole` makes a member an admin by
|
|
1099
1109
|
* itself, and promoting first made that request fail. Kept so existing
|
|
@@ -1494,6 +1504,14 @@ interface WorkspaceGeneralTabProps {
|
|
|
1494
1504
|
}
|
|
1495
1505
|
declare function WorkspaceGeneralTab({ workspace, loading, memberCount, organizationName, organizationStatus, saving, onSave, onLeave, onDelete, }: WorkspaceGeneralTabProps): react.JSX.Element;
|
|
1496
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
|
+
|
|
1497
1515
|
type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width' | 'height'> & {
|
|
1498
1516
|
color?: string;
|
|
1499
1517
|
strokeWidth?: number | string;
|
|
@@ -1748,6 +1766,14 @@ declare function memberRoleUpdate(current: {
|
|
|
1748
1766
|
}, permissions: UserPermissions, services: ServiceItem[]): ({
|
|
1749
1767
|
userId: string;
|
|
1750
1768
|
} & MemberPermissionsPayload) | null;
|
|
1769
|
+
/**
|
|
1770
|
+
* The `updateInvite` request that saving a pending invite sends. Same shape as
|
|
1771
|
+
* an invite: an admin invite carries no app or store grants (admins hold every
|
|
1772
|
+
* app), a member invite carries exactly the apps switched on.
|
|
1773
|
+
*/
|
|
1774
|
+
declare function inviteUpdate(invitationId: string, permissions: UserPermissions, services: ServiceItem[]): {
|
|
1775
|
+
invitationId: string;
|
|
1776
|
+
} & MemberPermissionsPayload;
|
|
1751
1777
|
declare function TeamsContent({ embedded, onInviteOpen, onInviteOpenChange, onCanInviteChange, inviteRequested, onInviteRequestHandled, workspaceName, workspaceImageUrl, organizationName, hiddenApps, }?: {
|
|
1752
1778
|
embedded?: boolean;
|
|
1753
1779
|
onInviteOpen?: boolean;
|
|
@@ -2160,6 +2186,13 @@ interface InviteUpdateModalProps {
|
|
|
2160
2186
|
*/
|
|
2161
2187
|
hiddenApps?: readonly AppKey[];
|
|
2162
2188
|
allowSubmitWithoutChanges?: boolean;
|
|
2189
|
+
/**
|
|
2190
|
+
* Update mode: whose permissions are being edited. `"invite"` edits a
|
|
2191
|
+
* pending invitation — the dialog says so, its remove button cancels the
|
|
2192
|
+
* invite, and, like the invite form, a member must keep at least one app.
|
|
2193
|
+
* Defaults to `"member"`.
|
|
2194
|
+
*/
|
|
2195
|
+
subject?: "member" | "invite";
|
|
2163
2196
|
initialPermissions?: UserPermissions;
|
|
2164
2197
|
onClose: () => void;
|
|
2165
2198
|
onSave?: (permissions: UserPermissions) => void;
|
|
@@ -2216,7 +2249,7 @@ interface InviteUpdateModalProps {
|
|
|
2216
2249
|
*/
|
|
2217
2250
|
onInvite?: (permissions: UserPermissions, email: string, organizationStanding?: OrganizationStanding) => void;
|
|
2218
2251
|
}
|
|
2219
|
-
declare function InviteUpdateModal({ open, mode, userEmail, stores, hiddenApps, allowSubmitWithoutChanges, initialPermissions, onClose, onSave, onRemove, canRemove, showOrganizationStanding, organizationName, allowGuestStanding, initialOrganizationStanding, organizationDomain: _organizationDomain, allowAdminRole, onInvite, onInviteMany, }: InviteUpdateModalProps): react.JSX.Element | null;
|
|
2252
|
+
declare function InviteUpdateModal({ open, mode, userEmail, stores, hiddenApps, allowSubmitWithoutChanges, subject, initialPermissions, onClose, onSave, onRemove, canRemove, showOrganizationStanding, organizationName, allowGuestStanding, initialOrganizationStanding, organizationDomain: _organizationDomain, allowAdminRole, onInvite, onInviteMany, }: InviteUpdateModalProps): react.JSX.Element | null;
|
|
2220
2253
|
|
|
2221
2254
|
interface ExportDateModalProps {
|
|
2222
2255
|
title: string;
|
|
@@ -2637,13 +2670,15 @@ interface AdministrationOverviewProps {
|
|
|
2637
2670
|
hasOrganization: boolean;
|
|
2638
2671
|
isWorkspaceAdmin: boolean;
|
|
2639
2672
|
showConnectedApps: boolean;
|
|
2673
|
+
/** The signed-in user has a referral code to share. */
|
|
2674
|
+
showReferral?: boolean;
|
|
2640
2675
|
showIntegrations: boolean;
|
|
2641
2676
|
canInvite: boolean;
|
|
2642
2677
|
onNavigate: (tab: SettingsTab) => void;
|
|
2643
2678
|
onInvitePeople?: () => void;
|
|
2644
2679
|
}
|
|
2645
2680
|
/** Scope-first navigation into the existing forms; contains no mutation logic. */
|
|
2646
|
-
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;
|
|
2647
2682
|
|
|
2648
2683
|
/** Shared invitation rule. A result belongs to one authenticated workspace;
|
|
2649
2684
|
* callers must explicitly mark it ready after that workspace's reads settle. */
|
|
@@ -2714,4 +2749,4 @@ interface AppSettingsRowProps {
|
|
|
2714
2749
|
}
|
|
2715
2750
|
declare function AppSettingsRow({ title, description, summary, href, onClick, disabled, disabledReason, ariaLabel, trailing }: AppSettingsRowProps): react.JSX.Element;
|
|
2716
2751
|
|
|
2717
|
-
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, 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
|
@@ -108,6 +108,7 @@ __export(index_exports, {
|
|
|
108
108
|
formatPoolSplit: () => formatPoolSplit,
|
|
109
109
|
groupWorkspaceList: () => groupWorkspaceList,
|
|
110
110
|
hasPaidFeatures: () => hasPaidFeatures,
|
|
111
|
+
inviteUpdate: () => inviteUpdate,
|
|
111
112
|
isLimitBelowUsage: () => isLimitBelowUsage,
|
|
112
113
|
isPaidPlan: () => isPaidPlan,
|
|
113
114
|
isSponsoredEntitlement: () => isSponsoredEntitlement,
|
|
@@ -130,6 +131,8 @@ __export(index_exports, {
|
|
|
130
131
|
poolWorkspaceName: () => poolWorkspaceName,
|
|
131
132
|
productsForCountry: () => productsForCountry,
|
|
132
133
|
readSettingsCaller: () => readSettingsCaller,
|
|
134
|
+
referralCodeOf: () => referralCodeOf,
|
|
135
|
+
referralLink: () => referralLink,
|
|
133
136
|
rememberSettingsCaller: () => rememberSettingsCaller,
|
|
134
137
|
resolveSettingsTabFromPath: () => resolveSettingsTabFromPath,
|
|
135
138
|
roundCredits: () => roundCredits,
|
|
@@ -495,7 +498,7 @@ var TAB_DESCRIPTIONS = {
|
|
|
495
498
|
organization: "Everyone in the organization and their role",
|
|
496
499
|
organizationWorkspaces: "Every workspace in this organization, and workspaces asking to join it",
|
|
497
500
|
organizationDomains: "Every workspace in this organization, and workspaces asking to join it",
|
|
498
|
-
referral: "
|
|
501
|
+
referral: "Your link for bringing new people to Streamoid",
|
|
499
502
|
billing: "Workspace plan, credits, invoices and usage history",
|
|
500
503
|
apikey: "Create and revoke keys for calling the Streamoid APIs",
|
|
501
504
|
connectedApps: "Apps like ChatGPT and Codex that you've allowed to use CXO for you",
|
|
@@ -537,6 +540,7 @@ function AdministrationOverview({
|
|
|
537
540
|
isWorkspaceAdmin,
|
|
538
541
|
showConnectedApps,
|
|
539
542
|
showIntegrations,
|
|
543
|
+
showReferral = false,
|
|
540
544
|
canInvite,
|
|
541
545
|
onNavigate,
|
|
542
546
|
onInvitePeople
|
|
@@ -544,7 +548,7 @@ function AdministrationOverview({
|
|
|
544
548
|
const groups = [
|
|
545
549
|
{
|
|
546
550
|
title: "Account",
|
|
547
|
-
tabs: ["profile", "workspaceList", ...showConnectedApps ? ["connectedApps"] : []]
|
|
551
|
+
tabs: ["profile", "workspaceList", ...showConnectedApps ? ["connectedApps"] : [], ...showReferral ? ["referral"] : []]
|
|
548
552
|
},
|
|
549
553
|
...hasWorkspace ? [{
|
|
550
554
|
title: "Workspace",
|
|
@@ -3291,6 +3295,7 @@ function InviteUpdateModal({
|
|
|
3291
3295
|
stores = [],
|
|
3292
3296
|
hiddenApps = [],
|
|
3293
3297
|
allowSubmitWithoutChanges = false,
|
|
3298
|
+
subject = "member",
|
|
3294
3299
|
initialPermissions,
|
|
3295
3300
|
onClose,
|
|
3296
3301
|
onSave,
|
|
@@ -3396,7 +3401,8 @@ function InviteUpdateModal({
|
|
|
3396
3401
|
const notLastShown = (key) => shownApps[shownApps.length - 1] !== key;
|
|
3397
3402
|
const appValue = (key) => role === "admin" || showsApp(key) ? appToggles[key] : false;
|
|
3398
3403
|
const grantsNoApp = role === "member" && shownApps.length > 0 && !shownApps.some((key) => appToggles[key]);
|
|
3399
|
-
const
|
|
3404
|
+
const editsInvite = !isInvite && subject === "invite";
|
|
3405
|
+
const isSubmitDisabled = isInvite ? !hasEmail || grantsNoApp || submitting : editsInvite ? !hasChanges || grantsNoApp : !(allowSubmitWithoutChanges || hasChanges);
|
|
3400
3406
|
function toggleStore(storeId) {
|
|
3401
3407
|
setSelectedStores((prev) => {
|
|
3402
3408
|
const next = new Set(prev);
|
|
@@ -3452,7 +3458,7 @@ function InviteUpdateModal({
|
|
|
3452
3458
|
fontWeight: 600,
|
|
3453
3459
|
lineHeight: T6.lhLg
|
|
3454
3460
|
},
|
|
3455
|
-
children: isInvite ? "Invite" : "Update user"
|
|
3461
|
+
children: isInvite ? "Invite" : editsInvite ? "Edit invitation" : "Update user"
|
|
3456
3462
|
}
|
|
3457
3463
|
),
|
|
3458
3464
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-label": "Close invite dialog", disabled: submitting, className: "shrink-0 cursor-pointer disabled:cursor-wait", onClick: requestClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons5.SiconClose, { className: "w-6 h-6", color: T6.primary }) })
|
|
@@ -4558,7 +4564,7 @@ function InviteUpdateModal({
|
|
|
4558
4564
|
!isInvite && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4559
4565
|
import_ui4.ScButton,
|
|
4560
4566
|
{
|
|
4561
|
-
text: "Remove user",
|
|
4567
|
+
text: editsInvite ? "Cancel invitation" : "Remove user",
|
|
4562
4568
|
variant: "error",
|
|
4563
4569
|
size: "md",
|
|
4564
4570
|
state: canRemove ? "default" : "disabled",
|
|
@@ -4568,7 +4574,7 @@ function InviteUpdateModal({
|
|
|
4568
4574
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4569
4575
|
import_ui4.ScButton,
|
|
4570
4576
|
{
|
|
4571
|
-
text: isInvite ? "Invite User" : allowSubmitWithoutChanges ? "Resend invite" : "Save changes",
|
|
4577
|
+
text: isInvite ? "Invite User" : !editsInvite && allowSubmitWithoutChanges ? "Resend invite" : "Save changes",
|
|
4572
4578
|
variant: "primary",
|
|
4573
4579
|
size: "md",
|
|
4574
4580
|
state: isSubmitDisabled ? "disabled" : "default",
|
|
@@ -4886,6 +4892,17 @@ function memberRoleUpdate(current, permissions, services) {
|
|
|
4886
4892
|
storeIds: permissions.catalogixStores || []
|
|
4887
4893
|
};
|
|
4888
4894
|
}
|
|
4895
|
+
function inviteUpdate(invitationId, permissions, services) {
|
|
4896
|
+
const isAdmin = permissions.role === "admin";
|
|
4897
|
+
return {
|
|
4898
|
+
invitationId,
|
|
4899
|
+
role: permissions.role,
|
|
4900
|
+
creditAccess: permissions.canUseCredits,
|
|
4901
|
+
inviteAccess: permissions.canInviteUser,
|
|
4902
|
+
serviceIds: isAdmin ? [] : permissionServiceIds(services, permissions),
|
|
4903
|
+
storeIds: isAdmin ? [] : permissions.catalogixStores || []
|
|
4904
|
+
};
|
|
4905
|
+
}
|
|
4889
4906
|
function uniqueNonEmpty(values) {
|
|
4890
4907
|
return Array.from(new Set(values.map((v) => v.trim()).filter(Boolean)));
|
|
4891
4908
|
}
|
|
@@ -5534,6 +5551,7 @@ function TeamsContent({
|
|
|
5534
5551
|
setModal({ open: false, mode: "invite" });
|
|
5535
5552
|
};
|
|
5536
5553
|
const currentMemberPermissions = modal.target?.permissions;
|
|
5554
|
+
const canEditInvites = highestRole === "admin" && api.updateInvite !== void 0 && allServices.length > 0;
|
|
5537
5555
|
const handleSave = async (permissions) => {
|
|
5538
5556
|
if (!modal.target) {
|
|
5539
5557
|
closeModal();
|
|
@@ -5544,16 +5562,22 @@ function TeamsContent({
|
|
|
5544
5562
|
closeModal();
|
|
5545
5563
|
return;
|
|
5546
5564
|
}
|
|
5547
|
-
if (modal.target.kind === "invite"
|
|
5565
|
+
if (modal.target.kind === "invite") {
|
|
5566
|
+
if (!modal.target.invitationId || !api.updateInvite) {
|
|
5567
|
+
closeModal();
|
|
5568
|
+
return;
|
|
5569
|
+
}
|
|
5548
5570
|
try {
|
|
5549
|
-
await api.
|
|
5550
|
-
|
|
5551
|
-
|
|
5571
|
+
await api.updateInvite(
|
|
5572
|
+
inviteUpdate(modal.target.invitationId, permissions, allServices)
|
|
5573
|
+
);
|
|
5574
|
+
toast.success("Invitation updated");
|
|
5552
5575
|
} catch (err) {
|
|
5553
|
-
|
|
5554
|
-
|
|
5576
|
+
toast.error(errorMessage(err, { method: "PUT" }));
|
|
5577
|
+
return;
|
|
5555
5578
|
}
|
|
5556
5579
|
closeModal();
|
|
5580
|
+
await fetchData();
|
|
5557
5581
|
return;
|
|
5558
5582
|
}
|
|
5559
5583
|
if (modal.target.kind !== "member" || !modal.target.userId) {
|
|
@@ -5813,7 +5837,7 @@ function TeamsContent({
|
|
|
5813
5837
|
{
|
|
5814
5838
|
member,
|
|
5815
5839
|
variant: activeTab,
|
|
5816
|
-
onClick: activeTab === "active" ? () => openUpdateModal(member) : void 0,
|
|
5840
|
+
onClick: activeTab === "active" || canEditInvites ? () => openUpdateModal(member) : void 0,
|
|
5817
5841
|
onCancelInvite: () => void handleCancelPendingInvite(member),
|
|
5818
5842
|
onResendInvite: () => void handleResendPendingInvite(member)
|
|
5819
5843
|
},
|
|
@@ -5831,7 +5855,7 @@ function TeamsContent({
|
|
|
5831
5855
|
userEmail: modal.target?.userEmail,
|
|
5832
5856
|
stores: allStores,
|
|
5833
5857
|
hiddenApps,
|
|
5834
|
-
|
|
5858
|
+
subject: modal.target?.kind === "invite" ? "invite" : "member",
|
|
5835
5859
|
initialPermissions: currentMemberPermissions,
|
|
5836
5860
|
onClose: closeModal,
|
|
5837
5861
|
onSave: handleSave,
|
|
@@ -14456,6 +14480,20 @@ function ConnectedAppsContent() {
|
|
|
14456
14480
|
);
|
|
14457
14481
|
}
|
|
14458
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
|
+
|
|
14459
14497
|
// src/organization-integrations-content.tsx
|
|
14460
14498
|
var import_react26 = require("react");
|
|
14461
14499
|
var import_ui20 = require("@streamoid/ui");
|
|
@@ -14841,7 +14879,8 @@ function SettingsNav({
|
|
|
14841
14879
|
hasOrganization,
|
|
14842
14880
|
isWorkspaceAdmin,
|
|
14843
14881
|
showConnectedApps = false,
|
|
14844
|
-
showIntegrations = false
|
|
14882
|
+
showIntegrations = false,
|
|
14883
|
+
showReferral = false
|
|
14845
14884
|
}) {
|
|
14846
14885
|
const item = (tab, icon) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
14847
14886
|
SettingsNavItem,
|
|
@@ -14880,7 +14919,8 @@ function SettingsNav({
|
|
|
14880
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" }),
|
|
14881
14920
|
item("profile", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconUser, { className: "w-5 h-5", color })),
|
|
14882
14921
|
item("workspaceList", (color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons18.SiconSwitch, { className: "w-5 h-5", color })),
|
|
14883
|
-
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 }))
|
|
14884
14924
|
] }),
|
|
14885
14925
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_ui21.ScHDivider, {}),
|
|
14886
14926
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
@@ -15889,11 +15929,26 @@ function WorkspaceListTab({
|
|
|
15889
15929
|
}
|
|
15890
15930
|
var WorkspaceTab = WorkspaceListTab;
|
|
15891
15931
|
function ReferralTab() {
|
|
15892
|
-
const { auth } = useSettingsAdapters();
|
|
15893
|
-
const user = auth.user;
|
|
15894
|
-
const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
|
|
15932
|
+
const { auth, toast } = useSettingsAdapters();
|
|
15895
15933
|
const domain = typeof window !== "undefined" ? window.location.origin : "";
|
|
15896
|
-
const
|
|
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
|
+
};
|
|
15897
15952
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
15898
15953
|
"div",
|
|
15899
15954
|
{
|
|
@@ -15908,52 +15963,50 @@ function ReferralTab() {
|
|
|
15908
15963
|
borderRadius: "var(--radius-3xl)",
|
|
15909
15964
|
padding: "var(--spacing-6xl)"
|
|
15910
15965
|
},
|
|
15911
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.
|
|
15912
|
-
|
|
15966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
15967
|
+
import_ui22.ScTextField,
|
|
15913
15968
|
{
|
|
15914
|
-
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
|
|
15933
|
-
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
|
|
15939
|
-
{
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
)
|
|
15956
|
-
]
|
|
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()
|
|
15957
16010
|
}
|
|
15958
16011
|
)
|
|
15959
16012
|
}
|
|
@@ -16018,6 +16071,7 @@ function SettingsContentInner({
|
|
|
16018
16071
|
const isOverview = overviewDetail && showOverview;
|
|
16019
16072
|
const overviewInvite = useWorkspaceInvitePermission(adapters, { enabled: isOverview && !!onInvitePeople });
|
|
16020
16073
|
const showConnectedApps = !!integrations;
|
|
16074
|
+
const showReferral = !!referralCodeOf(adapters.auth.user);
|
|
16021
16075
|
const showIntegrations = !!integrations?.listOrganizationConnections && !!integrations.getOrganizationAccess && organization.current?.role === "admin";
|
|
16022
16076
|
const workspaceId = workspace.current?.id ?? null;
|
|
16023
16077
|
const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
|
|
@@ -16739,6 +16793,7 @@ function SettingsContentInner({
|
|
|
16739
16793
|
isWorkspaceAdmin,
|
|
16740
16794
|
showConnectedApps,
|
|
16741
16795
|
showIntegrations,
|
|
16796
|
+
showReferral,
|
|
16742
16797
|
canInvite: !overviewInvite.isLoading && overviewInvite.canInvite,
|
|
16743
16798
|
onNavigate: setActiveTab,
|
|
16744
16799
|
onInvitePeople
|
|
@@ -16759,7 +16814,8 @@ function SettingsContentInner({
|
|
|
16759
16814
|
organizationName: organizationScopeName,
|
|
16760
16815
|
hasOrganization,
|
|
16761
16816
|
showConnectedApps,
|
|
16762
|
-
showIntegrations
|
|
16817
|
+
showIntegrations,
|
|
16818
|
+
showReferral
|
|
16763
16819
|
}
|
|
16764
16820
|
),
|
|
16765
16821
|
activeTab === "profile" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ProfileTab, {}),
|
|
@@ -16825,7 +16881,7 @@ function SettingsContentInner({
|
|
|
16825
16881
|
}
|
|
16826
16882
|
}
|
|
16827
16883
|
),
|
|
16828
|
-
activeTab === "referral" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ReferralTab, {}),
|
|
16884
|
+
activeTab === "referral" && showReferral && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ReferralTab, {}),
|
|
16829
16885
|
activeTab === "connectedApps" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ConnectedAppsContent, {}),
|
|
16830
16886
|
activeTab === "organizationIntegrations" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OrganizationIntegrationsContent, {}),
|
|
16831
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: "
|
|
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
|
-
|
|
621
|
+
SiconCopy as SiconCopy2,
|
|
622
|
+
SiconCheck as SiconCheck2,
|
|
620
623
|
SiconUpload as SiconUpload2,
|
|
621
624
|
SiconDelete,
|
|
622
625
|
SiconUser,
|
|
@@ -3176,6 +3179,7 @@ function InviteUpdateModal({
|
|
|
3176
3179
|
stores = [],
|
|
3177
3180
|
hiddenApps = [],
|
|
3178
3181
|
allowSubmitWithoutChanges = false,
|
|
3182
|
+
subject = "member",
|
|
3179
3183
|
initialPermissions,
|
|
3180
3184
|
onClose,
|
|
3181
3185
|
onSave,
|
|
@@ -3281,7 +3285,8 @@ function InviteUpdateModal({
|
|
|
3281
3285
|
const notLastShown = (key) => shownApps[shownApps.length - 1] !== key;
|
|
3282
3286
|
const appValue = (key) => role === "admin" || showsApp(key) ? appToggles[key] : false;
|
|
3283
3287
|
const grantsNoApp = role === "member" && shownApps.length > 0 && !shownApps.some((key) => appToggles[key]);
|
|
3284
|
-
const
|
|
3288
|
+
const editsInvite = !isInvite && subject === "invite";
|
|
3289
|
+
const isSubmitDisabled = isInvite ? !hasEmail || grantsNoApp || submitting : editsInvite ? !hasChanges || grantsNoApp : !(allowSubmitWithoutChanges || hasChanges);
|
|
3285
3290
|
function toggleStore(storeId) {
|
|
3286
3291
|
setSelectedStores((prev) => {
|
|
3287
3292
|
const next = new Set(prev);
|
|
@@ -3337,7 +3342,7 @@ function InviteUpdateModal({
|
|
|
3337
3342
|
fontWeight: 600,
|
|
3338
3343
|
lineHeight: T6.lhLg
|
|
3339
3344
|
},
|
|
3340
|
-
children: isInvite ? "Invite" : "Update user"
|
|
3345
|
+
children: isInvite ? "Invite" : editsInvite ? "Edit invitation" : "Update user"
|
|
3341
3346
|
}
|
|
3342
3347
|
),
|
|
3343
3348
|
/* @__PURE__ */ jsx14("button", { type: "button", "aria-label": "Close invite dialog", disabled: submitting, className: "shrink-0 cursor-pointer disabled:cursor-wait", onClick: requestClose, children: /* @__PURE__ */ jsx14(SiconClose2, { className: "w-6 h-6", color: T6.primary }) })
|
|
@@ -4443,7 +4448,7 @@ function InviteUpdateModal({
|
|
|
4443
4448
|
!isInvite && /* @__PURE__ */ jsx14(
|
|
4444
4449
|
ScButton3,
|
|
4445
4450
|
{
|
|
4446
|
-
text: "Remove user",
|
|
4451
|
+
text: editsInvite ? "Cancel invitation" : "Remove user",
|
|
4447
4452
|
variant: "error",
|
|
4448
4453
|
size: "md",
|
|
4449
4454
|
state: canRemove ? "default" : "disabled",
|
|
@@ -4453,7 +4458,7 @@ function InviteUpdateModal({
|
|
|
4453
4458
|
/* @__PURE__ */ jsx14(
|
|
4454
4459
|
ScButton3,
|
|
4455
4460
|
{
|
|
4456
|
-
text: isInvite ? "Invite User" : allowSubmitWithoutChanges ? "Resend invite" : "Save changes",
|
|
4461
|
+
text: isInvite ? "Invite User" : !editsInvite && allowSubmitWithoutChanges ? "Resend invite" : "Save changes",
|
|
4457
4462
|
variant: "primary",
|
|
4458
4463
|
size: "md",
|
|
4459
4464
|
state: isSubmitDisabled ? "disabled" : "default",
|
|
@@ -4771,6 +4776,17 @@ function memberRoleUpdate(current, permissions, services) {
|
|
|
4771
4776
|
storeIds: permissions.catalogixStores || []
|
|
4772
4777
|
};
|
|
4773
4778
|
}
|
|
4779
|
+
function inviteUpdate(invitationId, permissions, services) {
|
|
4780
|
+
const isAdmin = permissions.role === "admin";
|
|
4781
|
+
return {
|
|
4782
|
+
invitationId,
|
|
4783
|
+
role: permissions.role,
|
|
4784
|
+
creditAccess: permissions.canUseCredits,
|
|
4785
|
+
inviteAccess: permissions.canInviteUser,
|
|
4786
|
+
serviceIds: isAdmin ? [] : permissionServiceIds(services, permissions),
|
|
4787
|
+
storeIds: isAdmin ? [] : permissions.catalogixStores || []
|
|
4788
|
+
};
|
|
4789
|
+
}
|
|
4774
4790
|
function uniqueNonEmpty(values) {
|
|
4775
4791
|
return Array.from(new Set(values.map((v) => v.trim()).filter(Boolean)));
|
|
4776
4792
|
}
|
|
@@ -5419,6 +5435,7 @@ function TeamsContent({
|
|
|
5419
5435
|
setModal({ open: false, mode: "invite" });
|
|
5420
5436
|
};
|
|
5421
5437
|
const currentMemberPermissions = modal.target?.permissions;
|
|
5438
|
+
const canEditInvites = highestRole === "admin" && api.updateInvite !== void 0 && allServices.length > 0;
|
|
5422
5439
|
const handleSave = async (permissions) => {
|
|
5423
5440
|
if (!modal.target) {
|
|
5424
5441
|
closeModal();
|
|
@@ -5429,16 +5446,22 @@ function TeamsContent({
|
|
|
5429
5446
|
closeModal();
|
|
5430
5447
|
return;
|
|
5431
5448
|
}
|
|
5432
|
-
if (modal.target.kind === "invite"
|
|
5449
|
+
if (modal.target.kind === "invite") {
|
|
5450
|
+
if (!modal.target.invitationId || !api.updateInvite) {
|
|
5451
|
+
closeModal();
|
|
5452
|
+
return;
|
|
5453
|
+
}
|
|
5433
5454
|
try {
|
|
5434
|
-
await api.
|
|
5435
|
-
|
|
5436
|
-
|
|
5455
|
+
await api.updateInvite(
|
|
5456
|
+
inviteUpdate(modal.target.invitationId, permissions, allServices)
|
|
5457
|
+
);
|
|
5458
|
+
toast.success("Invitation updated");
|
|
5437
5459
|
} catch (err) {
|
|
5438
|
-
|
|
5439
|
-
|
|
5460
|
+
toast.error(errorMessage(err, { method: "PUT" }));
|
|
5461
|
+
return;
|
|
5440
5462
|
}
|
|
5441
5463
|
closeModal();
|
|
5464
|
+
await fetchData();
|
|
5442
5465
|
return;
|
|
5443
5466
|
}
|
|
5444
5467
|
if (modal.target.kind !== "member" || !modal.target.userId) {
|
|
@@ -5698,7 +5721,7 @@ function TeamsContent({
|
|
|
5698
5721
|
{
|
|
5699
5722
|
member,
|
|
5700
5723
|
variant: activeTab,
|
|
5701
|
-
onClick: activeTab === "active" ? () => openUpdateModal(member) : void 0,
|
|
5724
|
+
onClick: activeTab === "active" || canEditInvites ? () => openUpdateModal(member) : void 0,
|
|
5702
5725
|
onCancelInvite: () => void handleCancelPendingInvite(member),
|
|
5703
5726
|
onResendInvite: () => void handleResendPendingInvite(member)
|
|
5704
5727
|
},
|
|
@@ -5716,7 +5739,7 @@ function TeamsContent({
|
|
|
5716
5739
|
userEmail: modal.target?.userEmail,
|
|
5717
5740
|
stores: allStores,
|
|
5718
5741
|
hiddenApps,
|
|
5719
|
-
|
|
5742
|
+
subject: modal.target?.kind === "invite" ? "invite" : "member",
|
|
5720
5743
|
initialPermissions: currentMemberPermissions,
|
|
5721
5744
|
onClose: closeModal,
|
|
5722
5745
|
onSave: handleSave,
|
|
@@ -14370,6 +14393,20 @@ function ConnectedAppsContent() {
|
|
|
14370
14393
|
);
|
|
14371
14394
|
}
|
|
14372
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
|
+
|
|
14373
14410
|
// src/organization-integrations-content.tsx
|
|
14374
14411
|
import { useState as useState24 } from "react";
|
|
14375
14412
|
import { ScButton as ScButton17, ScToggleSwitch } from "@streamoid/ui";
|
|
@@ -14755,7 +14792,8 @@ function SettingsNav({
|
|
|
14755
14792
|
hasOrganization,
|
|
14756
14793
|
isWorkspaceAdmin,
|
|
14757
14794
|
showConnectedApps = false,
|
|
14758
|
-
showIntegrations = false
|
|
14795
|
+
showIntegrations = false,
|
|
14796
|
+
showReferral = false
|
|
14759
14797
|
}) {
|
|
14760
14798
|
const item = (tab, icon) => /* @__PURE__ */ jsx33(
|
|
14761
14799
|
SettingsNavItem,
|
|
@@ -14794,7 +14832,8 @@ function SettingsNav({
|
|
|
14794
14832
|
/* @__PURE__ */ jsx33("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Account" }),
|
|
14795
14833
|
item("profile", (color) => /* @__PURE__ */ jsx33(SiconUser, { className: "w-5 h-5", color })),
|
|
14796
14834
|
item("workspaceList", (color) => /* @__PURE__ */ jsx33(SiconSwitch, { className: "w-5 h-5", color })),
|
|
14797
|
-
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 }))
|
|
14798
14837
|
] }),
|
|
14799
14838
|
/* @__PURE__ */ jsx33(ScHDivider, {}),
|
|
14800
14839
|
/* @__PURE__ */ jsxs30("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
@@ -15803,11 +15842,26 @@ function WorkspaceListTab({
|
|
|
15803
15842
|
}
|
|
15804
15843
|
var WorkspaceTab = WorkspaceListTab;
|
|
15805
15844
|
function ReferralTab() {
|
|
15806
|
-
const { auth } = useSettingsAdapters();
|
|
15807
|
-
const user = auth.user;
|
|
15808
|
-
const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
|
|
15845
|
+
const { auth, toast } = useSettingsAdapters();
|
|
15809
15846
|
const domain = typeof window !== "undefined" ? window.location.origin : "";
|
|
15810
|
-
const
|
|
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
|
+
};
|
|
15811
15865
|
return /* @__PURE__ */ jsx33(
|
|
15812
15866
|
"div",
|
|
15813
15867
|
{
|
|
@@ -15822,52 +15876,50 @@ function ReferralTab() {
|
|
|
15822
15876
|
borderRadius: "var(--radius-3xl)",
|
|
15823
15877
|
padding: "var(--spacing-6xl)"
|
|
15824
15878
|
},
|
|
15825
|
-
children: /* @__PURE__ */
|
|
15826
|
-
|
|
15879
|
+
children: /* @__PURE__ */ jsx33(
|
|
15880
|
+
ScTextField,
|
|
15827
15881
|
{
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
{
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
)
|
|
15870
|
-
]
|
|
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()
|
|
15871
15923
|
}
|
|
15872
15924
|
)
|
|
15873
15925
|
}
|
|
@@ -15932,6 +15984,7 @@ function SettingsContentInner({
|
|
|
15932
15984
|
const isOverview = overviewDetail && showOverview;
|
|
15933
15985
|
const overviewInvite = useWorkspaceInvitePermission(adapters, { enabled: isOverview && !!onInvitePeople });
|
|
15934
15986
|
const showConnectedApps = !!integrations;
|
|
15987
|
+
const showReferral = !!referralCodeOf(adapters.auth.user);
|
|
15935
15988
|
const showIntegrations = !!integrations?.listOrganizationConnections && !!integrations.getOrganizationAccess && organization.current?.role === "admin";
|
|
15936
15989
|
const workspaceId = workspace.current?.id ?? null;
|
|
15937
15990
|
const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
|
|
@@ -16653,6 +16706,7 @@ function SettingsContentInner({
|
|
|
16653
16706
|
isWorkspaceAdmin,
|
|
16654
16707
|
showConnectedApps,
|
|
16655
16708
|
showIntegrations,
|
|
16709
|
+
showReferral,
|
|
16656
16710
|
canInvite: !overviewInvite.isLoading && overviewInvite.canInvite,
|
|
16657
16711
|
onNavigate: setActiveTab,
|
|
16658
16712
|
onInvitePeople
|
|
@@ -16673,7 +16727,8 @@ function SettingsContentInner({
|
|
|
16673
16727
|
organizationName: organizationScopeName,
|
|
16674
16728
|
hasOrganization,
|
|
16675
16729
|
showConnectedApps,
|
|
16676
|
-
showIntegrations
|
|
16730
|
+
showIntegrations,
|
|
16731
|
+
showReferral
|
|
16677
16732
|
}
|
|
16678
16733
|
),
|
|
16679
16734
|
activeTab === "profile" && /* @__PURE__ */ jsx33(ProfileTab, {}),
|
|
@@ -16739,7 +16794,7 @@ function SettingsContentInner({
|
|
|
16739
16794
|
}
|
|
16740
16795
|
}
|
|
16741
16796
|
),
|
|
16742
|
-
activeTab === "referral" && /* @__PURE__ */ jsx33(ReferralTab, {}),
|
|
16797
|
+
activeTab === "referral" && showReferral && /* @__PURE__ */ jsx33(ReferralTab, {}),
|
|
16743
16798
|
activeTab === "connectedApps" && /* @__PURE__ */ jsx33(ConnectedAppsContent, {}),
|
|
16744
16799
|
activeTab === "organizationIntegrations" && /* @__PURE__ */ jsx33(OrganizationIntegrationsContent, {}),
|
|
16745
16800
|
activeTab === "organizationList" && /* @__PURE__ */ jsx33(OrganizationListContent, {}),
|
|
@@ -17780,6 +17835,7 @@ export {
|
|
|
17780
17835
|
formatPoolSplit,
|
|
17781
17836
|
groupWorkspaceList,
|
|
17782
17837
|
hasPaidFeatures,
|
|
17838
|
+
inviteUpdate,
|
|
17783
17839
|
isLimitBelowUsage,
|
|
17784
17840
|
isPaidPlan,
|
|
17785
17841
|
isSponsoredEntitlement,
|
|
@@ -17802,6 +17858,8 @@ export {
|
|
|
17802
17858
|
poolWorkspaceName,
|
|
17803
17859
|
productsForCountry,
|
|
17804
17860
|
readSettingsCaller,
|
|
17861
|
+
referralCodeOf,
|
|
17862
|
+
referralLink,
|
|
17805
17863
|
rememberSettingsCaller,
|
|
17806
17864
|
resolveSettingsTabFromPath,
|
|
17807
17865
|
roundCredits,
|