nnews-react 0.2.5 → 2.0.2

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.ts CHANGED
@@ -8,6 +8,22 @@ import * as LabelPrimitive from '@radix-ui/react-label';
8
8
  import * as React_2 from 'react';
9
9
  import { VariantProps } from 'class-variance-authority';
10
10
 
11
+ export declare function AIArticleGenerator({ mode, articleId, onSuccess, onCancel, className, }: AIArticleGeneratorProps): JSX_2.Element;
12
+
13
+ export declare interface AIArticleGeneratorProps {
14
+ mode: 'create' | 'update';
15
+ articleId?: number;
16
+ onSuccess: (article: Article) => void;
17
+ onCancel?: () => void;
18
+ className?: string;
19
+ }
20
+
21
+ export declare interface AIArticleRequest {
22
+ articleId?: number;
23
+ prompt: string;
24
+ generateImage?: boolean;
25
+ }
26
+
11
27
  export declare interface Article {
12
28
  articleId: number;
13
29
  categoryId?: number;
@@ -15,6 +31,7 @@ export declare interface Article {
15
31
  title: string;
16
32
  content: string;
17
33
  imageName?: string;
34
+ imageUrl?: string;
18
35
  status: ArticleStatus;
19
36
  dateAt?: string | Date;
20
37
  createdAt?: string | Date;
@@ -55,6 +72,18 @@ export declare class ArticleAPI {
55
72
  * Delete an article
56
73
  */
57
74
  deleteArticle(id: number): Promise<void>;
75
+ /**
76
+ * Create a new article using AI
77
+ * @param request - AI article request with prompt and options
78
+ * @returns Created article
79
+ */
80
+ createArticleWithAI(request: AIArticleRequest): Promise<Article>;
81
+ /**
82
+ * Update an existing article using AI
83
+ * @param request - AI article request with articleId, prompt and options
84
+ * @returns Updated article
85
+ */
86
+ updateArticleWithAI(request: AIArticleRequest): Promise<Article>;
58
87
  /**
59
88
  * Transform date strings to Date objects for a single article
60
89
  */
@@ -65,7 +94,7 @@ export declare class ArticleAPI {
65
94
  private transformArticleDates;
66
95
  }
67
96
 
68
- export declare function ArticleEditor({ article, categories, tags, onSave, onCancel, loading, }: ArticleEditorProps_2): JSX_2.Element;
97
+ export declare function ArticleEditor({ article, categories, onSave, onCancel, loading, }: ArticleEditorProps_2): JSX_2.Element;
69
98
 
70
99
  export declare interface ArticleEditorProps {
71
100
  articleId?: number;
@@ -80,7 +109,6 @@ export declare interface ArticleEditorProps {
80
109
  declare interface ArticleEditorProps_2 {
81
110
  article?: Article | null;
82
111
  categories?: Category[];
83
- tags?: Tag[];
84
112
  onSave: (article: ArticleInput | ArticleUpdate) => Promise<void>;
85
113
  onCancel: () => void;
86
114
  loading?: boolean;
@@ -93,7 +121,7 @@ export declare interface ArticleInput {
93
121
  status: ArticleStatus;
94
122
  categoryId?: number;
95
123
  dateAt?: string | Date;
96
- tagIds?: number[];
124
+ tagList?: string;
97
125
  roleIds?: string[];
98
126
  }
99
127
 
@@ -320,6 +348,7 @@ declare interface MarkdownEditorProps {
320
348
  export declare interface NNewsConfig {
321
349
  apiUrl: string;
322
350
  apiClient?: AxiosInstance;
351
+ headers?: Record<string, string>;
323
352
  }
324
353
 
325
354
  export declare interface NNewsContextValue {
@@ -370,6 +399,11 @@ declare interface Role {
370
399
  name: string;
371
400
  }
372
401
 
402
+ /**
403
+ * Convert comma-separated string to tags preview array
404
+ */
405
+ export declare function stringToTagsPreview(tagList: string): string[];
406
+
373
407
  export declare interface Tag {
374
408
  tagId?: number;
375
409
  title: string;
@@ -467,6 +501,11 @@ export declare interface TagSearchParams {
467
501
  pageSize?: number;
468
502
  }
469
503
 
504
+ /**
505
+ * Convert tags array to comma-separated string
506
+ */
507
+ export declare function tagsToString(tags: Tag[]): string;
508
+
470
509
  export declare interface TagUpdate extends TagInput {
471
510
  tagId: number;
472
511
  id?: number;
@@ -550,4 +589,21 @@ export declare function validatePasswordStrength(password: string, options?: {
550
589
  */
551
590
  export declare function validatePhone(phone: string): boolean;
552
591
 
592
+ /**
593
+ * Validate AI prompt
594
+ */
595
+ export declare function validatePrompt(prompt: string): {
596
+ valid: boolean;
597
+ error?: string;
598
+ };
599
+
600
+ /**
601
+ * Validate tag list string
602
+ */
603
+ export declare function validateTagList(tagList: string): {
604
+ valid: boolean;
605
+ error?: string;
606
+ tags?: string[];
607
+ };
608
+
553
609
  export { }