import { SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core'; /** * Supported social platforms */ export type SocialPlatformType = 'youtube' | 'threads' | 'x' | 'bluesky' | 'facebook'; /** * Account connection status */ export type AccountStatus = 'connected' | 'disconnected' | 'expired' | 'missing_permissions' | 'error'; /** * Link behavior for posts with links */ export type LinkBehavior = 'description' | 'inline' | 'attachment' | 'reply' | 'none'; /** * Controls how far publish operations are allowed to go. */ export type PublishMode = 'dry_run' | 'stage_remote' | 'private_or_scheduled' | 'public'; /** * Social account creation options */ export interface SocialAccountOptions extends SmrtObjectOptions { /** * Human-readable name for the account */ name?: string; /** * Social platform type */ platform?: SocialPlatformType; /** * Platform-specific user ID */ platformUserId?: string | null; /** * Platform username/handle */ platformUsername?: string | null; /** * Profile URL on the platform */ platformUrl?: string | null; /** * Deprecated raw OAuth access token */ accessToken?: string | null; /** * Deprecated raw OAuth refresh token */ refreshToken?: string | null; /** * Secret name containing the full platform credential payload */ credentialSecretId?: string | null; /** * Secret name containing the OAuth access token */ accessTokenSecretName?: string | null; /** * Secret name containing the OAuth refresh token */ refreshTokenSecretName?: string | null; /** * Token expiration time */ tokenExpiresAt?: Date | null; /** * Whether the account is active * @default true */ isActive?: boolean; /** * Default hashtags to add to posts */ defaultHashtags?: string[]; /** * Granted OAuth scopes or platform permissions */ scopes?: string[]; /** * Required permissions that still need approval/granting */ missingPermissions?: string[]; /** * How to handle links in posts * @default 'description' */ linkBehavior?: LinkBehavior; /** * Safety mode for publish operations. * @default 'dry_run' */ publishMode?: PublishMode; /** * Separate latch required before public publishing can happen. * @default false */ publicPublishingAllowed?: boolean; /** * Account connection status * @default 'connected' */ status?: AccountStatus; /** * Error message if status is 'error' */ errorMessage?: string | null; /** * Tenant ID for multi-tenant isolation */ tenantId?: string | null; } /** * Connected social media account for publishing * * SocialAccount represents a connected social platform account * with OAuth credentials and publishing settings. Accounts can * be used to publish content to multiple platforms. * * @example * ```typescript * import { SocialAccount } from '@happyvertical/smrt-social'; * * const account = new SocialAccount({ * name: 'Bentley News YouTube', * platform: 'youtube', * platformUserId: 'UC...', * platformUsername: 'Bentley News', * accessToken: '...encrypted...', * refreshToken: '...encrypted...', * tokenExpiresAt: new Date('2026-02-25'), * defaultHashtags: ['news', 'local', 'bentley'], * linkBehavior: 'description', * }); * await account.save(); * ``` */ export declare class SocialAccount extends SmrtObject { /** * Tenant ID for multi-tenant isolation */ tenantId: string | null; /** * Human-readable name for the account */ name: string; /** * Social platform type */ platform: SocialPlatformType; /** * Platform-specific user ID */ platformUserId: string | null; /** * Platform username/handle */ platformUsername: string | null; /** * Profile URL on the platform */ platformUrl: string | null; /** * Deprecated raw OAuth access token. * Prefer credentialSecretId/accessTokenSecretName. */ accessToken: string | null; /** * Deprecated raw OAuth refresh token. * Prefer credentialSecretId/refreshTokenSecretName. */ refreshToken: string | null; /** * Secret name containing the complete platform credential payload. */ credentialSecretId: string | null; /** * Secret name containing only the access token. */ accessTokenSecretName: string | null; /** * Secret name containing only the refresh token. */ refreshTokenSecretName: string | null; /** * Token expiration time */ tokenExpiresAt: Date | null; /** * Whether the account is active */ isActive: boolean; /** * Default hashtags to add to posts */ defaultHashtags: string[]; /** * Granted OAuth scopes or platform permissions. */ scopes: string[]; /** * Required permissions that still need app review or user grant. */ missingPermissions: string[]; /** * How to handle links in posts * - description: Include link in post body/description * - reply: Post link as a reply (better for X algorithm) * - none: Don't include link */ linkBehavior: LinkBehavior; /** * Safety mode for publish operations. */ publishMode: PublishMode; /** * Separate latch required before public publishing is allowed. */ publicPublishingAllowed: boolean; /** * Account connection status */ status: AccountStatus; /** * Error message if status is 'error' */ errorMessage: string | null; constructor(options?: SocialAccountOptions); /** * Social accounts need a slug identity that is scoped by tenant and platform. * A newsroom may connect `@localnews` on X, YouTube, Threads, and Facebook; * the generic name-derived slug would make those accounts overwrite each * other through SMRT's slug/context upsert identity. */ getSlug(): Promise; /** * Check if the token is expired or will expire soon */ get isTokenExpired(): boolean; /** * Check if the account needs attention (expired or error) */ get needsAttention(): boolean; /** * Check if the account is ready for publishing */ get isReady(): boolean; /** * Effective publish mode after applying the public-publishing latch. */ get effectivePublishMode(): PublishMode; /** * Check whether any usable credential reference exists. */ get hasCredentials(): boolean; /** * Store all platform credentials in smrt-secrets as a single JSON payload. */ setCredentials(credentials: Record, options?: { description?: string; category?: string; }): Promise; /** * Retrieve platform credentials from smrt-secrets, falling back to deprecated fields. */ getCredentials(): Promise | null>; private withCredentialTenantContext; private getCredentialTenantId; private requireCredentialTenantId; } //# sourceMappingURL=social-account.d.ts.map