types.ts 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. import * as React from 'react';
  2. // FIX: Removed self-import of 'Block' which caused a conflict with the local declaration.
  3. export type NavItemKey = string;
  4. export interface NavSubItem {
  5. name: string;
  6. key: NavItemKey;
  7. }
  8. export interface NavItem {
  9. name:string;
  10. key: NavItemKey;
  11. icon: JSX.Element;
  12. children?: NavSubItem[];
  13. }
  14. // --- Page Builder Types ---
  15. export type BlockType = 'header' | 'link' | 'social' | 'video' | 'image' | 'text' | 'map' | 'pdf' | 'email' | 'phone' | 'news' | 'product' | 'chat' | 'enterprise_info' | 'form' | 'award' | 'footer';
  16. export interface BaseBlock {
  17. id: string;
  18. type: BlockType;
  19. visible: boolean;
  20. titleAlignment?: 'left' | 'center';
  21. }
  22. export interface HeaderBlock extends BaseBlock {
  23. type: 'header';
  24. text: string;
  25. }
  26. export interface LinkBlock extends BaseBlock {
  27. type: 'link';
  28. title: string;
  29. url: string;
  30. thumbnailUrl?: string;
  31. iconUrl?: string;
  32. }
  33. export type SocialPlatform = 'twitter' | 'instagram' | 'facebook' | 'linkedin' | 'youtube' | 'tiktok' | 'github';
  34. export interface SocialLink {
  35. id: string;
  36. platform: SocialPlatform;
  37. url: string;
  38. }
  39. export interface SocialBlock extends BaseBlock {
  40. type: 'social';
  41. links: SocialLink[];
  42. }
  43. export type MediaSource =
  44. | { type: 'url', value: string }
  45. | { type: 'file', value: { name: string, size: number, previewUrl: string } }
  46. | { type: 'aigc', videoId: string };
  47. export interface VideoBlock extends BaseBlock {
  48. type: 'video';
  49. sources: MediaSource[];
  50. layout: 'single' | 'grid';
  51. }
  52. export interface ImageBlock extends BaseBlock {
  53. type: 'image';
  54. sources: MediaSource[];
  55. layout: 'single' | 'grid';
  56. }
  57. export interface TextBlock extends BaseBlock {
  58. type: 'text';
  59. content: string;
  60. textAlign: 'left' | 'center' | 'right';
  61. fontSize: string; // e.g., '16px'
  62. fontColor: string; // e.g., '#000000'
  63. isBold: boolean;
  64. isItalic: boolean;
  65. }
  66. export interface MapBlock extends BaseBlock {
  67. type: 'map';
  68. address: string;
  69. displayStyle?: 'interactiveMap' | 'imageOverlay';
  70. backgroundImageSource?: MediaSource;
  71. }
  72. export interface PdfBlock extends BaseBlock {
  73. type: 'pdf';
  74. source: MediaSource;
  75. }
  76. export interface EmailBlock extends BaseBlock {
  77. type: 'email';
  78. email: string;
  79. label: string;
  80. displayMode: 'labelOnly' | 'labelAndValue';
  81. }
  82. export interface PhoneBlock extends BaseBlock {
  83. type: 'phone';
  84. phone: string;
  85. label: string;
  86. displayMode: 'labelOnly' | 'labelAndValue';
  87. }
  88. export interface NewsItemFromUrl {
  89. id: string;
  90. title: string;
  91. summary: string;
  92. url: string;
  93. }
  94. export type NewsBlock = BaseBlock & {
  95. type: 'news';
  96. layout: 'list' | 'grid';
  97. } & (
  98. | { source: 'aigc'; articleIds: string[]; customItems?: never }
  99. | { source: 'custom'; customItems: NewsItemFromUrl[]; articleIds?: never }
  100. );
  101. export interface ProductItem {
  102. id: string;
  103. url: string;
  104. title: string;
  105. imageUrl: string;
  106. price: string;
  107. }
  108. export interface ProductBlock extends BaseBlock {
  109. type: 'product';
  110. items: ProductItem[];
  111. layout: 'grid' | 'list';
  112. }
  113. export interface ChatBlock extends BaseBlock {
  114. type: 'chat';
  115. layout: 'button' | 'under_avatar' | 'widget';
  116. }
  117. export type EnterpriseInfoIcon = 'building' | 'bank' | 'money' | 'location' | 'calendar' | 'users' | 'lightbulb';
  118. export interface EnterpriseInfoItem {
  119. id: string;
  120. icon: EnterpriseInfoIcon;
  121. label: string;
  122. value: string;
  123. }
  124. export interface EnterpriseInfoBlock extends BaseBlock {
  125. type: 'enterprise_info';
  126. items: EnterpriseInfoItem[];
  127. alignment?: 'left' | 'center';
  128. }
  129. export type FormFieldId = 'name' | 'email' | 'company' | 'phone' | 'industry' | 'position' | 'country';
  130. export interface FormField {
  131. id: FormFieldId;
  132. label: string;
  133. enabled: boolean;
  134. required: boolean;
  135. }
  136. export interface FormPurposeOption {
  137. id: string;
  138. label: string;
  139. }
  140. export interface FormBlock extends BaseBlock {
  141. type: 'form';
  142. title: string;
  143. description: string;
  144. fields: FormField[];
  145. purposeOptions: FormPurposeOption[];
  146. submitButtonText: string;
  147. }
  148. export interface AwardItem {
  149. id: string;
  150. title: string;
  151. subtitle?: string;
  152. year?: string;
  153. imageSource?: MediaSource;
  154. }
  155. export interface AwardBlock extends BaseBlock {
  156. type: 'award';
  157. items: AwardItem[];
  158. layout: 'grid' | 'single';
  159. }
  160. export interface FooterLink {
  161. id: string;
  162. title: string;
  163. url: string;
  164. }
  165. export interface FooterBlock extends BaseBlock {
  166. type: 'footer';
  167. layout: 'standard' | 'centered';
  168. copyrightText: string;
  169. legalText?: string;
  170. statement?: string;
  171. navLinks: FooterLink[];
  172. otherLinks: FooterLink[];
  173. }
  174. export type Block = HeaderBlock | LinkBlock | SocialBlock | VideoBlock | ImageBlock | TextBlock | MapBlock | PdfBlock | EmailBlock | PhoneBlock | NewsBlock | ProductBlock | ChatBlock | EnterpriseInfoBlock | FormBlock | AwardBlock | FooterBlock;
  175. export type ThemeName = 'light' | 'dark' | 'synthwave' | 'retro' | 'custom';
  176. export type ButtonStyle = 'filled' | 'outline';
  177. export type ButtonShape = 'rounded' | 'pill' | 'square';
  178. export type FontFamily = 'sans' | 'serif' | 'mono';
  179. export type BackgroundType = 'color' | 'gradient' | 'image';
  180. export type BannerType = 'color' | 'gradient' | 'image' | 'none';
  181. export interface CustomThemeColors {
  182. background: string;
  183. text: string;
  184. button: string;
  185. buttonText: string;
  186. }
  187. export interface BannerSettings {
  188. type: BannerType;
  189. value: string; // For color and gradient
  190. imageSource: MediaSource; // For image type
  191. height: number; // in pixels
  192. width: 'full' | 'contained';
  193. }
  194. export interface SideNavSettings {
  195. backgroundColor: string;
  196. textColor: string;
  197. activeLinkColor: string;
  198. hoverBackgroundColor: string;
  199. hoverTextColor: string;
  200. fontFamily: FontFamily;
  201. fontSize: string; // e.g. '14px'
  202. navFloatStyle?: 'normal' | 'top' | 'center';
  203. navBackgroundStyle?: 'compact' | 'full';
  204. }
  205. export interface ChatWidgetSettings {
  206. iconColor: string;
  207. headerBackgroundColor: string;
  208. headerTextColor: string;
  209. panelBackgroundColor: string;
  210. userMessageBackgroundColor: string;
  211. userMessageTextColor: string;
  212. aiMessageBackgroundColor: string;
  213. aiMessageTextColor: string;
  214. }
  215. export interface DesignSettings {
  216. theme: ThemeName;
  217. customThemeColors: CustomThemeColors;
  218. buttonStyle: ButtonStyle;
  219. buttonShape: ButtonShape;
  220. fontFamily: FontFamily;
  221. fontColor: string;
  222. fontSize: string; // Tailwind class like 'text-base'
  223. backgroundType: BackgroundType;
  224. backgroundValue: string; // hex code, gradient class, or image URL
  225. userBackgroundImages?: MediaSource[];
  226. avatarSource?: MediaSource;
  227. bannerSettings: BannerSettings;
  228. sideNavSettings: SideNavSettings;
  229. chatWidgetSettings: ChatWidgetSettings;
  230. }
  231. export interface PageSettings {
  232. blocks: Block[];
  233. design: DesignSettings;
  234. }
  235. // --- AI Assistant Types ---
  236. export interface ChatMessage {
  237. id: string;
  238. sender: 'user' | 'ai';
  239. text: string;
  240. }
  241. export interface AIAssistantSettings {
  242. persona: string;
  243. voiceId: string;
  244. language: string;
  245. conversationStyle: 'friendly' | 'professional' | 'witty';
  246. knowledgeBaseFiles: { name: string; size: number; type: string }[];
  247. knowledgeBaseUrls: string[];
  248. forbiddenUserKeywords: string[];
  249. forbiddenAIKeywords: string[];
  250. }
  251. // --- Analytics Types ---
  252. export interface Conversation {
  253. id: string;
  254. visitorId: string;
  255. timestamp: string;
  256. interactions: ChatMessage[];
  257. visitCount: number;
  258. status: 'open' | 'resolved';
  259. firstResponseTime?: number; // in seconds
  260. }
  261. export interface FormSubmissionData {
  262. [key: string]: string;
  263. }
  264. export interface FormSubmission {
  265. id: string;
  266. formId: string;
  267. visitorId: string;
  268. timestamp: string;
  269. data: FormSubmissionData;
  270. }
  271. export interface AnalyticsData {
  272. conversations: Conversation[];
  273. formSubmissions?: FormSubmission[];
  274. }
  275. export interface Visitor {
  276. id: string;
  277. lastSeen: string;
  278. visitCount: number;
  279. conversationCount: number;
  280. formSubmissionCount?: number;
  281. name?: string;
  282. email?: string;
  283. company?: string;
  284. }
  285. // --- AIGC Types ---
  286. export interface AIGCVideo {
  287. id: string;
  288. title: string;
  289. thumbnailUrl: string;
  290. videoUrl: string;
  291. }
  292. export interface AIGCArticle {
  293. id: string;
  294. title: string;
  295. summary: string;
  296. content: string;
  297. publicationDate: string; // ISO string
  298. sourceType: 'generated' | 'url' | 'text';
  299. sourceUrl?: string; // For 'url' type
  300. }
  301. export interface SocialAccount {
  302. id: string;
  303. platform: 'Twitter' | 'Facebook' | 'Instagram' | 'LinkedIn';
  304. username: string;
  305. icon: JSX.Element;
  306. }
  307. export interface ScheduledPost {
  308. id: string;
  309. videoId: string;
  310. date: string; // YYYY-MM-DD
  311. time: string; // HH:MM
  312. caption: string;
  313. socialAccountIds: string[];
  314. status: 'scheduled' | 'distributed';
  315. }
  316. export interface AIGCSettings {
  317. videos: AIGCVideo[];
  318. articles: AIGCArticle[];
  319. schedule: ScheduledPost[];
  320. userMedia?: MediaSource[];
  321. }
  322. // --- Video Creator Types ---
  323. export interface Avatar {
  324. id: string;
  325. name: string;
  326. imageUrl: string;
  327. }
  328. export interface Voice {
  329. id: string;
  330. name: string;
  331. accent: string;
  332. }
  333. export interface ScriptVersion {
  334. id: string;
  335. text: string;
  336. }
  337. export interface ScriptContent {
  338. versions: ScriptVersion[];
  339. selectedVersionId: string;
  340. }
  341. export interface VideoScene {
  342. id: string;
  343. script: ScriptContent;
  344. avatarId: string;
  345. voiceId: string;
  346. background: {
  347. type: 'color' | 'image' | 'video';
  348. value: string; // hex code or image URL
  349. };
  350. avatarPosition: { x: number; y: number }; // In percentages
  351. avatarScale: number;
  352. }
  353. export interface VideoProject {
  354. id:string;
  355. name: string;
  356. scenes: VideoScene[];
  357. aspectRatio: '16:9' | '9:16';
  358. }
  359. // --- MASTER PAGE TYPE ---
  360. export interface GreenPage {
  361. id: string;
  362. name: string;
  363. slug: string;
  364. themeColor: string;
  365. pageSettings: PageSettings;
  366. aiAssistantSettings: AIAssistantSettings;
  367. analyticsData: AnalyticsData;
  368. aigcSettings: AIGCSettings;
  369. }