writekit/studio/src/types.ts
2026-01-09 00:16:46 +02:00

128 lines
2.7 KiB
TypeScript

export interface Post {
id: string
slug: string
title: string
description: string
cover_image?: string
content?: string
date: string
draft: boolean
members_only: boolean
tags: string[]
created_at: string
updated_at: string
}
export interface Settings {
site_name?: string
site_description?: string
author_name?: string
author_role?: string
author_bio?: string
author_photo?: string
twitter_handle?: string
github_handle?: string
linkedin_handle?: string
email?: string
show_powered_by?: string
accent_color?: string
code_theme?: string
font?: string
layout?: string
compactness?: 'compact' | 'cozy' | 'spacious'
custom_css?: string
}
export interface InteractionConfig {
comments_enabled: boolean
reactions_enabled: boolean
reaction_mode: string
reaction_emojis: string
upvote_icon: string
reactions_require_auth: boolean
}
export interface Asset {
id: string
filename: string
url: string
content_type: string
size: number
created_at: string
}
export interface APIKey {
key: string
name: string
created_at: string
last_used_at: string | null
}
export interface AnalyticsSummary {
total_views: number
total_page_views: number
unique_visitors: number
total_bandwidth: number
views_change: number
top_pages: { path: string; views: number }[]
top_referrers: { referrer: string; views: number }[]
views_by_day: { date: string; views: number; visitors: number }[]
browsers: { name: string; count: number }[]
os: { name: string; count: number }[]
devices: { name: string; count: number }[]
countries: { name: string; count: number }[]
}
export type WebhookEvent = 'post.published' | 'post.updated' | 'post.deleted'
export interface Webhook {
id: string
name: string
url: string
events: WebhookEvent[]
secret?: string
enabled: boolean
created_at: string
last_triggered_at: string | null
last_status: 'success' | 'failed' | null
}
export interface WebhookDelivery {
id: number
webhook_id: string
event: string
payload: string
status: 'success' | 'failed'
response_code: number | null
response_body: string | null
attempts: number
created_at: string
}
export type Tier = 'free' | 'pro'
export interface TierConfig {
name: string
description: string
monthly_price: number
annual_price: number
custom_domain: boolean
badge_required: boolean
analytics_retention: number
api_rate_limit: number
max_webhooks: number
webhook_deliveries: number
max_plugins: number
plugin_executions: number
}
export interface Usage {
webhooks: number
plugins: number
}
export interface BillingInfo {
current_tier: Tier
tiers: Record<Tier, TierConfig>
usage: Usage
}