@contenify/chatbot 0.1.1 → 0.1.4
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/README.md +101 -21
- package/dist/index.js +182 -192
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +182 -192
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1355 -36
- package/package.json +1 -3
package/dist/index.mjs
CHANGED
|
@@ -26,9 +26,8 @@ import { createContext, useContext, useState, useEffect } from "react";
|
|
|
26
26
|
import axios from "axios";
|
|
27
27
|
|
|
28
28
|
// lib/config.ts
|
|
29
|
-
var DEFAULT_API_BASE_URL = "http://localhost:8080/api";
|
|
30
29
|
function getApiBaseUrl() {
|
|
31
|
-
return process.env.NEXT_PUBLIC_CONTENIFY_API_URL ||
|
|
30
|
+
return process.env.NEXT_PUBLIC_CONTENIFY_API_URL || "http://localhost:8080/api";
|
|
32
31
|
}
|
|
33
32
|
function getServerBaseUrl() {
|
|
34
33
|
const apiUrl = getApiBaseUrl();
|
|
@@ -179,31 +178,31 @@ function ArticleModal({
|
|
|
179
178
|
onClose,
|
|
180
179
|
onRecreate
|
|
181
180
|
}) {
|
|
182
|
-
return /* @__PURE__ */ jsx2("div", { className: "
|
|
183
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
181
|
+
return /* @__PURE__ */ jsx2("div", { className: "cnfy-article-modal-overlay", children: /* @__PURE__ */ jsxs("div", { className: "cnfy-article-modal", children: [
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "cnfy-article-modal-header", children: [
|
|
184
183
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
185
|
-
/* @__PURE__ */ jsx2("p", { className: "
|
|
186
|
-
/* @__PURE__ */ jsx2("h2", { className: "
|
|
184
|
+
/* @__PURE__ */ jsx2("p", { className: "cnfy-article-modal-source", children: "Source Article" }),
|
|
185
|
+
/* @__PURE__ */ jsx2("h2", { className: "cnfy-article-modal-title", children: article.title })
|
|
187
186
|
] }),
|
|
188
187
|
/* @__PURE__ */ jsx2(
|
|
189
188
|
"button",
|
|
190
189
|
{
|
|
191
190
|
onClick: onClose,
|
|
192
|
-
className: "
|
|
191
|
+
className: "cnfy-article-modal-close-btn",
|
|
193
192
|
"aria-label": "Close modal",
|
|
194
193
|
children: "\u2715"
|
|
195
194
|
}
|
|
196
195
|
)
|
|
197
196
|
] }),
|
|
198
|
-
/* @__PURE__ */ jsx2("div", { className: "
|
|
199
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
200
|
-
/* @__PURE__ */ jsx2("span", { className: "
|
|
201
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
197
|
+
/* @__PURE__ */ jsx2("div", { className: "cnfy-article-modal-body", children: /* @__PURE__ */ jsx2("div", { className: "cnfy-article-modal-content", children: article.content }) }),
|
|
198
|
+
/* @__PURE__ */ jsxs("div", { className: "cnfy-article-modal-footer", children: [
|
|
199
|
+
/* @__PURE__ */ jsx2("span", { className: "cnfy-article-modal-footer-text", children: "This content will be recreated using AI" }),
|
|
200
|
+
/* @__PURE__ */ jsxs("div", { className: "cnfy-article-modal-footer-actions", children: [
|
|
202
201
|
/* @__PURE__ */ jsx2(
|
|
203
202
|
"button",
|
|
204
203
|
{
|
|
205
204
|
onClick: onClose,
|
|
206
|
-
className: "
|
|
205
|
+
className: "cnfy-btn-cancel",
|
|
207
206
|
children: "Cancel"
|
|
208
207
|
}
|
|
209
208
|
),
|
|
@@ -214,9 +213,8 @@ function ArticleModal({
|
|
|
214
213
|
title: article.title,
|
|
215
214
|
content: article.content,
|
|
216
215
|
id: article._id
|
|
217
|
-
// Include article ID when available
|
|
218
216
|
}),
|
|
219
|
-
className: "
|
|
217
|
+
className: "cnfy-btn-recreate",
|
|
220
218
|
children: "Recreate Article"
|
|
221
219
|
}
|
|
222
220
|
)
|
|
@@ -298,7 +296,7 @@ function RichTextEditor({
|
|
|
298
296
|
content,
|
|
299
297
|
editorProps: {
|
|
300
298
|
attributes: {
|
|
301
|
-
class: "
|
|
299
|
+
class: "ProseMirror"
|
|
302
300
|
}
|
|
303
301
|
},
|
|
304
302
|
onUpdate: ({ editor: editor2 }) => {
|
|
@@ -311,10 +309,10 @@ function RichTextEditor({
|
|
|
311
309
|
}
|
|
312
310
|
}, [content, editor]);
|
|
313
311
|
if (!editor) {
|
|
314
|
-
return /* @__PURE__ */ jsx3("div", { className: "
|
|
312
|
+
return /* @__PURE__ */ jsx3("div", { className: "cnfy-editor-loading", children: "Loading editor..." });
|
|
315
313
|
}
|
|
316
|
-
return /* @__PURE__ */ jsxs2("div", { className: "
|
|
317
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
314
|
+
return /* @__PURE__ */ jsxs2("div", { className: "cnfy-editor", children: [
|
|
315
|
+
/* @__PURE__ */ jsxs2("div", { className: "cnfy-toolbar", children: [
|
|
318
316
|
/* @__PURE__ */ jsx3(
|
|
319
317
|
ToolbarButton,
|
|
320
318
|
{
|
|
@@ -342,7 +340,7 @@ function RichTextEditor({
|
|
|
342
340
|
children: /* @__PURE__ */ jsx3(Pilcrow, { size: 18 })
|
|
343
341
|
}
|
|
344
342
|
),
|
|
345
|
-
/* @__PURE__ */ jsx3("div", { className: "
|
|
343
|
+
/* @__PURE__ */ jsx3("div", { className: "cnfy-toolbar-divider" }),
|
|
346
344
|
/* @__PURE__ */ jsx3(
|
|
347
345
|
ToolbarButton,
|
|
348
346
|
{
|
|
@@ -361,7 +359,7 @@ function RichTextEditor({
|
|
|
361
359
|
children: /* @__PURE__ */ jsx3(Italic, { size: 18 })
|
|
362
360
|
}
|
|
363
361
|
),
|
|
364
|
-
/* @__PURE__ */ jsx3("div", { className: "
|
|
362
|
+
/* @__PURE__ */ jsx3("div", { className: "cnfy-toolbar-divider" }),
|
|
365
363
|
/* @__PURE__ */ jsx3(
|
|
366
364
|
ToolbarButton,
|
|
367
365
|
{
|
|
@@ -380,7 +378,7 @@ function RichTextEditor({
|
|
|
380
378
|
children: /* @__PURE__ */ jsx3(ListOrdered, { size: 18 })
|
|
381
379
|
}
|
|
382
380
|
),
|
|
383
|
-
/* @__PURE__ */ jsx3("div", { className: "
|
|
381
|
+
/* @__PURE__ */ jsx3("div", { className: "cnfy-toolbar-divider" }),
|
|
384
382
|
/* @__PURE__ */ jsx3(
|
|
385
383
|
ToolbarButton,
|
|
386
384
|
{
|
|
@@ -400,7 +398,7 @@ function RichTextEditor({
|
|
|
400
398
|
}
|
|
401
399
|
)
|
|
402
400
|
] }),
|
|
403
|
-
/* @__PURE__ */ jsx3(EditorContent, { editor, className: "
|
|
401
|
+
/* @__PURE__ */ jsx3(EditorContent, { editor, className: "cnfy-editor-content" })
|
|
404
402
|
] });
|
|
405
403
|
}
|
|
406
404
|
function ToolbarButton({
|
|
@@ -416,7 +414,7 @@ function ToolbarButton({
|
|
|
416
414
|
onClick,
|
|
417
415
|
disabled,
|
|
418
416
|
title,
|
|
419
|
-
className: `
|
|
417
|
+
className: `cnfy-toolbar-btn ${isActive ? "cnfy-toolbar-btn--active" : ""} ${disabled ? "cnfy-toolbar-btn--disabled" : ""}`,
|
|
420
418
|
children
|
|
421
419
|
}
|
|
422
420
|
);
|
|
@@ -500,29 +498,29 @@ function EditModal({
|
|
|
500
498
|
}
|
|
501
499
|
};
|
|
502
500
|
if (!isOpen) return null;
|
|
503
|
-
return /* @__PURE__ */ jsxs3("div", { className: "
|
|
501
|
+
return /* @__PURE__ */ jsxs3("div", { className: "cnfy-edit-modal-overlay", children: [
|
|
504
502
|
/* @__PURE__ */ jsx4(
|
|
505
503
|
"div",
|
|
506
504
|
{
|
|
507
|
-
className: "
|
|
505
|
+
className: "cnfy-edit-modal-backdrop",
|
|
508
506
|
onClick: onClose
|
|
509
507
|
}
|
|
510
508
|
),
|
|
511
|
-
/* @__PURE__ */ jsxs3("div", { className: "
|
|
512
|
-
/* @__PURE__ */ jsxs3("div", { className: "
|
|
513
|
-
/* @__PURE__ */ jsx4("h2", { className: "
|
|
509
|
+
/* @__PURE__ */ jsxs3("div", { className: "cnfy-edit-modal", children: [
|
|
510
|
+
/* @__PURE__ */ jsxs3("div", { className: "cnfy-edit-modal-header", children: [
|
|
511
|
+
/* @__PURE__ */ jsx4("h2", { className: "cnfy-edit-modal-title", children: "Edit Article" }),
|
|
514
512
|
/* @__PURE__ */ jsx4(
|
|
515
513
|
"button",
|
|
516
514
|
{
|
|
517
515
|
onClick: onClose,
|
|
518
|
-
className: "
|
|
519
|
-
children: /* @__PURE__ */ jsx4(X, { size: 20, className: "
|
|
516
|
+
className: "cnfy-edit-modal-close-btn",
|
|
517
|
+
children: /* @__PURE__ */ jsx4(X, { size: 20, className: "cnfy-edit-modal-close-icon" })
|
|
520
518
|
}
|
|
521
519
|
)
|
|
522
520
|
] }),
|
|
523
|
-
/* @__PURE__ */ jsxs3("div", { className: "
|
|
521
|
+
/* @__PURE__ */ jsxs3("div", { className: "cnfy-edit-modal-body", children: [
|
|
524
522
|
/* @__PURE__ */ jsxs3("div", { children: [
|
|
525
|
-
/* @__PURE__ */ jsx4("label", { className: "
|
|
523
|
+
/* @__PURE__ */ jsx4("label", { className: "cnfy-edit-label", children: "Article Content" }),
|
|
526
524
|
/* @__PURE__ */ jsx4(
|
|
527
525
|
RichTextEditor,
|
|
528
526
|
{
|
|
@@ -533,11 +531,11 @@ function EditModal({
|
|
|
533
531
|
)
|
|
534
532
|
] }),
|
|
535
533
|
/* @__PURE__ */ jsxs3("div", { children: [
|
|
536
|
-
/* @__PURE__ */ jsx4("label", { className: "
|
|
537
|
-
/* @__PURE__ */ jsx4("div", { className: "
|
|
534
|
+
/* @__PURE__ */ jsx4("label", { className: "cnfy-edit-label", children: "Meta Keywords" }),
|
|
535
|
+
/* @__PURE__ */ jsx4("div", { className: "cnfy-keyword-list", children: keywords.map((keyword, index) => /* @__PURE__ */ jsxs3(
|
|
538
536
|
"span",
|
|
539
537
|
{
|
|
540
|
-
className: "
|
|
538
|
+
className: "cnfy-keyword-tag",
|
|
541
539
|
children: [
|
|
542
540
|
"#",
|
|
543
541
|
keyword,
|
|
@@ -545,7 +543,7 @@ function EditModal({
|
|
|
545
543
|
"button",
|
|
546
544
|
{
|
|
547
545
|
onClick: () => handleRemoveKeyword(index),
|
|
548
|
-
className: "
|
|
546
|
+
className: "cnfy-keyword-remove-btn",
|
|
549
547
|
children: /* @__PURE__ */ jsx4(X, { size: 14 })
|
|
550
548
|
}
|
|
551
549
|
)
|
|
@@ -553,7 +551,7 @@ function EditModal({
|
|
|
553
551
|
},
|
|
554
552
|
index
|
|
555
553
|
)) }),
|
|
556
|
-
/* @__PURE__ */ jsxs3("div", { className: "
|
|
554
|
+
/* @__PURE__ */ jsxs3("div", { className: "cnfy-keyword-input-row", children: [
|
|
557
555
|
/* @__PURE__ */ jsx4(
|
|
558
556
|
"input",
|
|
559
557
|
{
|
|
@@ -562,26 +560,26 @@ function EditModal({
|
|
|
562
560
|
onChange: (e) => setNewKeyword(e.target.value),
|
|
563
561
|
onKeyDown: handleKeyDown,
|
|
564
562
|
placeholder: "Add a keyword...",
|
|
565
|
-
className: "
|
|
563
|
+
className: "cnfy-keyword-input"
|
|
566
564
|
}
|
|
567
565
|
),
|
|
568
566
|
/* @__PURE__ */ jsx4(
|
|
569
567
|
"button",
|
|
570
568
|
{
|
|
571
569
|
onClick: handleAddKeyword,
|
|
572
|
-
className: "
|
|
570
|
+
className: "cnfy-btn-add-keyword",
|
|
573
571
|
children: "Add"
|
|
574
572
|
}
|
|
575
573
|
)
|
|
576
574
|
] })
|
|
577
575
|
] })
|
|
578
576
|
] }),
|
|
579
|
-
/* @__PURE__ */ jsxs3("div", { className: "
|
|
577
|
+
/* @__PURE__ */ jsxs3("div", { className: "cnfy-edit-modal-footer", children: [
|
|
580
578
|
/* @__PURE__ */ jsx4(
|
|
581
579
|
"button",
|
|
582
580
|
{
|
|
583
581
|
onClick: onClose,
|
|
584
|
-
className: "
|
|
582
|
+
className: "cnfy-btn-footer-cancel",
|
|
585
583
|
children: "Cancel"
|
|
586
584
|
}
|
|
587
585
|
),
|
|
@@ -589,7 +587,7 @@ function EditModal({
|
|
|
589
587
|
"button",
|
|
590
588
|
{
|
|
591
589
|
onClick: () => onSaveDraft(content, keywords),
|
|
592
|
-
className: "
|
|
590
|
+
className: "cnfy-btn-save-draft",
|
|
593
591
|
children: "Save Draft"
|
|
594
592
|
}
|
|
595
593
|
),
|
|
@@ -597,7 +595,7 @@ function EditModal({
|
|
|
597
595
|
"button",
|
|
598
596
|
{
|
|
599
597
|
onClick: () => onPost(content, keywords),
|
|
600
|
-
className: "
|
|
598
|
+
className: "cnfy-btn-post-article",
|
|
601
599
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
602
600
|
children: "Post"
|
|
603
601
|
}
|
|
@@ -652,22 +650,22 @@ function NewsList({
|
|
|
652
650
|
b = Math.round(b + (255 - b) * (percent / 100));
|
|
653
651
|
return `rgb(${r}, ${g}, ${b})`;
|
|
654
652
|
};
|
|
655
|
-
return /* @__PURE__ */ jsx5("div", { className: "
|
|
653
|
+
return /* @__PURE__ */ jsx5("div", { className: "cnfy-news-list", children: news.flatMap((item) => {
|
|
656
654
|
const publishedDate = new Date(item.publishedAt);
|
|
657
655
|
const links = extractLinksFromContent(item.content);
|
|
658
656
|
if (links.length > 0) {
|
|
659
657
|
return links.map((link, idx) => /* @__PURE__ */ jsxs4(
|
|
660
658
|
"div",
|
|
661
659
|
{
|
|
662
|
-
className: "
|
|
660
|
+
className: "cnfy-news-card",
|
|
663
661
|
children: [
|
|
664
|
-
/* @__PURE__ */ jsxs4("div", { className: "
|
|
665
|
-
/* @__PURE__ */ jsx5("p", { className: "
|
|
666
|
-
/* @__PURE__ */ jsxs4("div", { className: "
|
|
662
|
+
/* @__PURE__ */ jsxs4("div", { className: "cnfy-news-card-content", children: [
|
|
663
|
+
/* @__PURE__ */ jsx5("p", { className: "cnfy-news-card-title", children: link.title }),
|
|
664
|
+
/* @__PURE__ */ jsxs4("div", { className: "cnfy-news-card-meta", children: [
|
|
667
665
|
/* @__PURE__ */ jsx5(
|
|
668
666
|
"span",
|
|
669
667
|
{
|
|
670
|
-
className: "
|
|
668
|
+
className: "cnfy-news-badge",
|
|
671
669
|
style: {
|
|
672
670
|
backgroundColor: lightenColor(primaryColorState, 95),
|
|
673
671
|
color: primaryColor,
|
|
@@ -677,7 +675,7 @@ function NewsList({
|
|
|
677
675
|
}
|
|
678
676
|
),
|
|
679
677
|
/* @__PURE__ */ jsx5("span", { children: "\u2022" }),
|
|
680
|
-
/* @__PURE__ */ jsx5("span", { className: "
|
|
678
|
+
/* @__PURE__ */ jsx5("span", { className: "cnfy-news-card-category", children: item.category }),
|
|
681
679
|
/* @__PURE__ */ jsx5("span", { children: "\u2022" }),
|
|
682
680
|
/* @__PURE__ */ jsxs4("span", { children: [
|
|
683
681
|
dateFormatter.format(publishedDate),
|
|
@@ -686,12 +684,12 @@ function NewsList({
|
|
|
686
684
|
] })
|
|
687
685
|
] })
|
|
688
686
|
] }),
|
|
689
|
-
/* @__PURE__ */ jsxs4("div", { className: "
|
|
687
|
+
/* @__PURE__ */ jsxs4("div", { className: "cnfy-news-card-actions", children: [
|
|
690
688
|
/* @__PURE__ */ jsx5(
|
|
691
689
|
"button",
|
|
692
690
|
{
|
|
693
691
|
onClick: () => window.open(link.url, "_blank"),
|
|
694
|
-
className: "
|
|
692
|
+
className: "cnfy-news-action-btn",
|
|
695
693
|
title: "View",
|
|
696
694
|
children: /* @__PURE__ */ jsx5(Eye, { size: 16 })
|
|
697
695
|
}
|
|
@@ -703,9 +701,8 @@ function NewsList({
|
|
|
703
701
|
title: link.title,
|
|
704
702
|
content: link.title,
|
|
705
703
|
id: item._id
|
|
706
|
-
// Include article ID
|
|
707
704
|
}),
|
|
708
|
-
className: "
|
|
705
|
+
className: "cnfy-news-action-btn",
|
|
709
706
|
title: "Recreate",
|
|
710
707
|
children: /* @__PURE__ */ jsx5(RefreshCcw, { size: 16 })
|
|
711
708
|
}
|
|
@@ -719,15 +716,15 @@ function NewsList({
|
|
|
719
716
|
return /* @__PURE__ */ jsxs4(
|
|
720
717
|
"div",
|
|
721
718
|
{
|
|
722
|
-
className: "
|
|
719
|
+
className: "cnfy-news-card",
|
|
723
720
|
children: [
|
|
724
|
-
/* @__PURE__ */ jsxs4("div", { className: "
|
|
725
|
-
/* @__PURE__ */ jsx5("p", { className: "
|
|
726
|
-
/* @__PURE__ */ jsxs4("div", { className: "
|
|
721
|
+
/* @__PURE__ */ jsxs4("div", { className: "cnfy-news-card-content", children: [
|
|
722
|
+
/* @__PURE__ */ jsx5("p", { className: "cnfy-news-card-title", children: item.title }),
|
|
723
|
+
/* @__PURE__ */ jsxs4("div", { className: "cnfy-news-card-meta", children: [
|
|
727
724
|
/* @__PURE__ */ jsx5(
|
|
728
725
|
"span",
|
|
729
726
|
{
|
|
730
|
-
className: "
|
|
727
|
+
className: "cnfy-news-badge",
|
|
731
728
|
style: {
|
|
732
729
|
backgroundColor: lightenColor(primaryColorState, 95),
|
|
733
730
|
color: primaryColor,
|
|
@@ -737,7 +734,7 @@ function NewsList({
|
|
|
737
734
|
}
|
|
738
735
|
),
|
|
739
736
|
/* @__PURE__ */ jsx5("span", { children: "\u2022" }),
|
|
740
|
-
/* @__PURE__ */ jsx5("span", { className: "
|
|
737
|
+
/* @__PURE__ */ jsx5("span", { className: "cnfy-news-card-category", children: item.category }),
|
|
741
738
|
/* @__PURE__ */ jsx5("span", { children: "\u2022" }),
|
|
742
739
|
/* @__PURE__ */ jsxs4("span", { children: [
|
|
743
740
|
dateFormatter.format(publishedDate),
|
|
@@ -746,12 +743,12 @@ function NewsList({
|
|
|
746
743
|
] })
|
|
747
744
|
] })
|
|
748
745
|
] }),
|
|
749
|
-
/* @__PURE__ */ jsxs4("div", { className: "
|
|
746
|
+
/* @__PURE__ */ jsxs4("div", { className: "cnfy-news-card-actions", children: [
|
|
750
747
|
/* @__PURE__ */ jsx5(
|
|
751
748
|
"button",
|
|
752
749
|
{
|
|
753
750
|
onClick: () => onView(item),
|
|
754
|
-
className: "
|
|
751
|
+
className: "cnfy-news-action-btn",
|
|
755
752
|
title: "View",
|
|
756
753
|
children: /* @__PURE__ */ jsx5(Eye, { size: 16 })
|
|
757
754
|
}
|
|
@@ -763,9 +760,8 @@ function NewsList({
|
|
|
763
760
|
title: item.title,
|
|
764
761
|
content: item.content || item.title,
|
|
765
762
|
id: item._id
|
|
766
|
-
// Include article ID
|
|
767
763
|
}),
|
|
768
|
-
className: "
|
|
764
|
+
className: "cnfy-news-action-btn",
|
|
769
765
|
title: "Recreate",
|
|
770
766
|
children: /* @__PURE__ */ jsx5(RefreshCcw, { size: 16 })
|
|
771
767
|
}
|
|
@@ -974,30 +970,30 @@ function ChatWindow({
|
|
|
974
970
|
});
|
|
975
971
|
return { blocks, metaKeywords };
|
|
976
972
|
}
|
|
977
|
-
return /* @__PURE__ */ jsxs5("div", { className: "
|
|
978
|
-
/* @__PURE__ */ jsx6("div", { className: "
|
|
973
|
+
return /* @__PURE__ */ jsxs5("div", { className: "cnfy-chat", children: [
|
|
974
|
+
/* @__PURE__ */ jsx6("div", { className: "cnfy-chat-area", children: /* @__PURE__ */ jsxs5("div", { className: "cnfy-chat-scroll", children: [
|
|
979
975
|
messages.map((msg) => {
|
|
980
976
|
var _a2;
|
|
981
977
|
const parsed = formatAIContent(msg.content);
|
|
982
|
-
return /* @__PURE__ */ jsxs5("div", { className: "
|
|
983
|
-
/* @__PURE__ */ jsx6("div", { className: "
|
|
978
|
+
return /* @__PURE__ */ jsxs5("div", { className: "cnfy-msg", children: [
|
|
979
|
+
/* @__PURE__ */ jsx6("div", { className: "cnfy-msg-avatar-wrap", children: /* @__PURE__ */ jsx6(
|
|
984
980
|
"div",
|
|
985
981
|
{
|
|
986
|
-
className: "
|
|
982
|
+
className: "cnfy-msg-avatar",
|
|
987
983
|
style: {
|
|
988
984
|
backgroundColor: msg.role === "assistant" ? primaryColor : "#1f2937"
|
|
989
985
|
},
|
|
990
986
|
children: msg.role === "assistant" ? "AI" : "You"
|
|
991
987
|
}
|
|
992
988
|
) }),
|
|
993
|
-
/* @__PURE__ */ jsxs5("div", { className: "
|
|
994
|
-
msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ jsx6("div", { className: "
|
|
989
|
+
/* @__PURE__ */ jsxs5("div", { className: "cnfy-msg-body", children: [
|
|
990
|
+
msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ jsx6("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ jsx6(
|
|
995
991
|
"button",
|
|
996
992
|
{
|
|
997
993
|
onClick: () => handleCopy(parsed.blocks, msg.id),
|
|
998
|
-
className: "
|
|
994
|
+
className: "cnfy-copy-btn",
|
|
999
995
|
title: "Copy to clipboard",
|
|
1000
|
-
children: copiedId === msg.id ? /* @__PURE__ */ jsx6(Check, { size: 16, className: "
|
|
996
|
+
children: copiedId === msg.id ? /* @__PURE__ */ jsx6(Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ jsx6(Copy, { size: 16 })
|
|
1001
997
|
}
|
|
1002
998
|
) }),
|
|
1003
999
|
parsed.blocks.map((block, idx) => {
|
|
@@ -1005,7 +1001,7 @@ function ChatWindow({
|
|
|
1005
1001
|
return /* @__PURE__ */ jsx6(
|
|
1006
1002
|
"h1",
|
|
1007
1003
|
{
|
|
1008
|
-
className: "
|
|
1004
|
+
className: "cnfy-block-h1",
|
|
1009
1005
|
children: block.text
|
|
1010
1006
|
},
|
|
1011
1007
|
idx
|
|
@@ -1015,18 +1011,18 @@ function ChatWindow({
|
|
|
1015
1011
|
return /* @__PURE__ */ jsx6(
|
|
1016
1012
|
"h2",
|
|
1017
1013
|
{
|
|
1018
|
-
className: "
|
|
1014
|
+
className: "cnfy-block-h2",
|
|
1019
1015
|
children: block.text
|
|
1020
1016
|
},
|
|
1021
1017
|
idx
|
|
1022
1018
|
);
|
|
1023
1019
|
}
|
|
1024
|
-
return /* @__PURE__ */ jsx6("p", { className: "
|
|
1020
|
+
return /* @__PURE__ */ jsx6("p", { className: "cnfy-block-p", children: block.text }, idx);
|
|
1025
1021
|
}),
|
|
1026
|
-
parsed.metaKeywords.length > 0 && /* @__PURE__ */ jsx6("div", { className: "
|
|
1022
|
+
parsed.metaKeywords.length > 0 && /* @__PURE__ */ jsx6("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ jsx6("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ jsxs5(
|
|
1027
1023
|
"span",
|
|
1028
1024
|
{
|
|
1029
|
-
className: "
|
|
1025
|
+
className: "cnfy-msg-keyword-tag",
|
|
1030
1026
|
children: [
|
|
1031
1027
|
"#",
|
|
1032
1028
|
tag
|
|
@@ -1034,13 +1030,13 @@ function ChatWindow({
|
|
|
1034
1030
|
},
|
|
1035
1031
|
i
|
|
1036
1032
|
)) }) }),
|
|
1037
|
-
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ jsx6("div", { className: "
|
|
1033
|
+
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ jsx6("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
|
|
1038
1034
|
const IconComponent = ACTION_ICONS[option.id] || FileText;
|
|
1039
1035
|
return /* @__PURE__ */ jsxs5(
|
|
1040
1036
|
"button",
|
|
1041
1037
|
{
|
|
1042
1038
|
onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
|
|
1043
|
-
className: "
|
|
1039
|
+
className: "cnfy-action-btn",
|
|
1044
1040
|
children: [
|
|
1045
1041
|
/* @__PURE__ */ jsx6(IconComponent, { size: 16 }),
|
|
1046
1042
|
option.name
|
|
@@ -1049,12 +1045,12 @@ function ChatWindow({
|
|
|
1049
1045
|
option.id
|
|
1050
1046
|
);
|
|
1051
1047
|
}) }),
|
|
1052
|
-
msg.role === "assistant" && parsed.blocks.length > 0 && !(analyzedData == null ? void 0 : analyzedData.messageId) && (!isStreaming || msg.id !== ((_a2 = messages[messages.length - 1]) == null ? void 0 : _a2.id)) && /* @__PURE__ */ jsxs5("div", { className: "
|
|
1048
|
+
msg.role === "assistant" && parsed.blocks.length > 0 && !(analyzedData == null ? void 0 : analyzedData.messageId) && (!isStreaming || msg.id !== ((_a2 = messages[messages.length - 1]) == null ? void 0 : _a2.id)) && /* @__PURE__ */ jsxs5("div", { className: "cnfy-msg-actions", children: [
|
|
1053
1049
|
/* @__PURE__ */ jsxs5(
|
|
1054
1050
|
"button",
|
|
1055
1051
|
{
|
|
1056
1052
|
onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
|
|
1057
|
-
className: "
|
|
1053
|
+
className: "cnfy-btn-edit",
|
|
1058
1054
|
children: [
|
|
1059
1055
|
/* @__PURE__ */ jsx6(Edit3, { size: 16 }),
|
|
1060
1056
|
"Edit"
|
|
@@ -1065,7 +1061,7 @@ function ChatWindow({
|
|
|
1065
1061
|
"button",
|
|
1066
1062
|
{
|
|
1067
1063
|
onClick: () => handlePost(msg.content, parsed.metaKeywords),
|
|
1068
|
-
className: "
|
|
1064
|
+
className: "cnfy-btn-post",
|
|
1069
1065
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1070
1066
|
children: [
|
|
1071
1067
|
/* @__PURE__ */ jsx6(Send, { size: 16 }),
|
|
@@ -1079,32 +1075,32 @@ function ChatWindow({
|
|
|
1079
1075
|
}),
|
|
1080
1076
|
/* @__PURE__ */ jsx6("div", { ref: bottomRef })
|
|
1081
1077
|
] }) }),
|
|
1082
|
-
/* @__PURE__ */ jsx6("div", { className: "
|
|
1083
|
-
!showNewsPanel && /* @__PURE__ */ jsxs5("div", { ref: dropdownRef, className: "
|
|
1078
|
+
/* @__PURE__ */ jsx6("div", { className: "cnfy-input-area", children: /* @__PURE__ */ jsxs5("div", { className: "cnfy-input-inner", children: [
|
|
1079
|
+
!showNewsPanel && /* @__PURE__ */ jsxs5("div", { ref: dropdownRef, className: "cnfy-news-pulse-wrap", children: [
|
|
1084
1080
|
/* @__PURE__ */ jsx6(
|
|
1085
1081
|
"button",
|
|
1086
1082
|
{
|
|
1087
1083
|
onClick: handleOpenNewsDropdown,
|
|
1088
|
-
className: "
|
|
1084
|
+
className: "cnfy-news-pulse-btn cnfy-animate-pulse",
|
|
1089
1085
|
title: "Select from trending news",
|
|
1090
1086
|
children: /* @__PURE__ */ jsx6(Zap, { size: 16 })
|
|
1091
1087
|
}
|
|
1092
1088
|
),
|
|
1093
|
-
showNewsDropdown && /* @__PURE__ */ jsxs5("div", { className: "
|
|
1094
|
-
/* @__PURE__ */ jsxs5("div", { className: "
|
|
1095
|
-
/* @__PURE__ */ jsx6("span", { className: "
|
|
1089
|
+
showNewsDropdown && /* @__PURE__ */ jsxs5("div", { className: "cnfy-news-dropdown", children: [
|
|
1090
|
+
/* @__PURE__ */ jsxs5("div", { className: "cnfy-news-dropdown-header", style: { backgroundColor: primaryColor, color: "#fff" }, children: [
|
|
1091
|
+
/* @__PURE__ */ jsx6("span", { className: "cnfy-news-dropdown-title", children: "Select News" }),
|
|
1096
1092
|
/* @__PURE__ */ jsx6(
|
|
1097
1093
|
"button",
|
|
1098
1094
|
{
|
|
1099
1095
|
onClick: () => setShowNewsDropdown(false),
|
|
1100
|
-
className: "
|
|
1096
|
+
className: "cnfy-news-dropdown-close",
|
|
1101
1097
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1102
|
-
children: /* @__PURE__ */ jsx6(X2, { size: 14
|
|
1098
|
+
children: /* @__PURE__ */ jsx6(X2, { size: 14 })
|
|
1103
1099
|
}
|
|
1104
1100
|
)
|
|
1105
1101
|
] }),
|
|
1106
|
-
/* @__PURE__ */ jsxs5("div", { className: "
|
|
1107
|
-
/* @__PURE__ */ jsx6("div", { className: "
|
|
1102
|
+
/* @__PURE__ */ jsxs5("div", { className: "cnfy-news-dropdown-source", children: [
|
|
1103
|
+
/* @__PURE__ */ jsx6("div", { className: "cnfy-news-dropdown-select-wrap", children: /* @__PURE__ */ jsx6(
|
|
1108
1104
|
Select,
|
|
1109
1105
|
{
|
|
1110
1106
|
options: [
|
|
@@ -1155,10 +1151,10 @@ function ChatWindow({
|
|
|
1155
1151
|
{
|
|
1156
1152
|
onClick: handleScrape,
|
|
1157
1153
|
disabled: scraping,
|
|
1158
|
-
className: "
|
|
1154
|
+
className: "cnfy-scrape-btn",
|
|
1159
1155
|
title: "Fetch latest news",
|
|
1160
1156
|
children: [
|
|
1161
|
-
/* @__PURE__ */ jsx6(RefreshCcw2, { size: 14, className: scraping ? "animate-spin" : "" }),
|
|
1157
|
+
/* @__PURE__ */ jsx6(RefreshCcw2, { size: 14, className: scraping ? "cnfy-animate-spin" : "" }),
|
|
1162
1158
|
scraping ? "Scraping..." : "Scrape"
|
|
1163
1159
|
]
|
|
1164
1160
|
}
|
|
@@ -1168,17 +1164,17 @@ function ChatWindow({
|
|
|
1168
1164
|
{
|
|
1169
1165
|
onClick: () => fetchNews(null),
|
|
1170
1166
|
disabled: loadingNews,
|
|
1171
|
-
className: "
|
|
1167
|
+
className: "cnfy-refresh-btn",
|
|
1172
1168
|
children: [
|
|
1173
|
-
/* @__PURE__ */ jsx6(RefreshCcw2, { size: 14, className: loadingNews ? "animate-spin" : "" }),
|
|
1169
|
+
/* @__PURE__ */ jsx6(RefreshCcw2, { size: 14, className: loadingNews ? "cnfy-animate-spin" : "" }),
|
|
1174
1170
|
"Refresh"
|
|
1175
1171
|
]
|
|
1176
1172
|
}
|
|
1177
1173
|
)
|
|
1178
1174
|
] }),
|
|
1179
|
-
/* @__PURE__ */ jsx6("div", { className: "
|
|
1175
|
+
/* @__PURE__ */ jsx6("div", { className: "cnfy-news-dropdown-list", children: loadingNews ? /* @__PURE__ */ jsx6("div", { className: "cnfy-news-dropdown-msg", children: "Loading news..." }) : trendingNews.length === 0 ? /* @__PURE__ */ jsxs5("div", { className: "cnfy-news-dropdown-msg", children: [
|
|
1180
1176
|
/* @__PURE__ */ jsx6("p", { children: "No news found." }),
|
|
1181
|
-
selectedSource && /* @__PURE__ */ jsx6("p", { className: "
|
|
1177
|
+
selectedSource && /* @__PURE__ */ jsx6("p", { className: "cnfy-news-dropdown-hint", children: 'Click "Scrape" to fetch latest news.' })
|
|
1182
1178
|
] }) : /* @__PURE__ */ jsx6(
|
|
1183
1179
|
NewsList,
|
|
1184
1180
|
{
|
|
@@ -1206,7 +1202,7 @@ function ChatWindow({
|
|
|
1206
1202
|
},
|
|
1207
1203
|
rows: 1,
|
|
1208
1204
|
placeholder: "Ask AI something\u2026",
|
|
1209
|
-
className: `
|
|
1205
|
+
className: `cnfy-chat-textarea ${!showNewsPanel ? "cnfy-chat-textarea--with-pulse" : ""}`,
|
|
1210
1206
|
style: { maxHeight: "200px", overflowY: input.split("\n").length > 6 ? "auto" : "hidden" }
|
|
1211
1207
|
}
|
|
1212
1208
|
),
|
|
@@ -1214,7 +1210,7 @@ function ChatWindow({
|
|
|
1214
1210
|
"button",
|
|
1215
1211
|
{
|
|
1216
1212
|
onClick: handleSend,
|
|
1217
|
-
className: "
|
|
1213
|
+
className: "cnfy-send-btn",
|
|
1218
1214
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1219
1215
|
children: /* @__PURE__ */ jsx6(SendHorizontal, { size: 18 })
|
|
1220
1216
|
}
|
|
@@ -1286,23 +1282,23 @@ function UserMenu({
|
|
|
1286
1282
|
toast.error(err || "Logout failed");
|
|
1287
1283
|
}
|
|
1288
1284
|
}
|
|
1289
|
-
return /* @__PURE__ */ jsxs6("div", { ref, className: "
|
|
1285
|
+
return /* @__PURE__ */ jsxs6("div", { ref, className: "cnfy-user-menu", children: [
|
|
1290
1286
|
/* @__PURE__ */ jsx7(
|
|
1291
1287
|
"button",
|
|
1292
1288
|
{
|
|
1293
1289
|
onClick: () => setOpen((v) => !v),
|
|
1294
|
-
className: "
|
|
1290
|
+
className: "cnfy-user-menu-trigger",
|
|
1295
1291
|
"aria-label": "Settings",
|
|
1296
|
-
children: /* @__PURE__ */ jsx7(Settings, { size: 20, className: "
|
|
1292
|
+
children: /* @__PURE__ */ jsx7(Settings, { size: 20, className: "cnfy-user-menu-trigger-icon" })
|
|
1297
1293
|
}
|
|
1298
1294
|
),
|
|
1299
|
-
open && /* @__PURE__ */ jsxs6("div", { className: "
|
|
1295
|
+
open && /* @__PURE__ */ jsxs6("div", { className: "cnfy-dropdown", children: [
|
|
1300
1296
|
/* @__PURE__ */ jsx7(MenuItem, { icon: User, label: "Account", onClick: () => go("/dashboard/account") }),
|
|
1301
1297
|
/* @__PURE__ */ jsx7(MenuItem, { icon: Settings, label: "Preferences", onClick: () => go("/dashboard/preferences") }),
|
|
1302
1298
|
/* @__PURE__ */ jsx7(MenuItem, { icon: Palette, label: "Appearance", onClick: () => go("/dashboard/appearance") }),
|
|
1303
1299
|
/* @__PURE__ */ jsx7(MenuItem, { icon: HelpCircle, label: "Settings", onClick: () => go("/dashboard/settings") }),
|
|
1304
1300
|
/* @__PURE__ */ jsx7(MenuItem, { icon: HelpCircle, label: "Help & Support", onClick: () => go("/dashboard/help") }),
|
|
1305
|
-
/* @__PURE__ */ jsx7("div", { className: "
|
|
1301
|
+
/* @__PURE__ */ jsx7("div", { className: "cnfy-dropdown-divider" }),
|
|
1306
1302
|
/* @__PURE__ */ jsx7(
|
|
1307
1303
|
MenuItem,
|
|
1308
1304
|
{
|
|
@@ -1325,7 +1321,7 @@ function MenuItem({
|
|
|
1325
1321
|
"button",
|
|
1326
1322
|
{
|
|
1327
1323
|
onClick,
|
|
1328
|
-
className: `
|
|
1324
|
+
className: `cnfy-menu-item ${danger ? "cnfy-menu-item--danger" : ""}`,
|
|
1329
1325
|
children: [
|
|
1330
1326
|
/* @__PURE__ */ jsx7(Icon, { size: 16 }),
|
|
1331
1327
|
label
|
|
@@ -1341,19 +1337,19 @@ function HeaderBar({
|
|
|
1341
1337
|
onLogout
|
|
1342
1338
|
}) {
|
|
1343
1339
|
const { primaryColor, botName, logoUrl } = useTheme();
|
|
1344
|
-
return /* @__PURE__ */ jsx8("header", { className: "
|
|
1345
|
-
/* @__PURE__ */ jsxs7("div", { className: "
|
|
1346
|
-
logoUrl ? /* @__PURE__ */ jsx8("img", { src: logoUrl, alt: "Logo", className: "
|
|
1340
|
+
return /* @__PURE__ */ jsx8("header", { className: "cnfy-header", children: /* @__PURE__ */ jsxs7("div", { className: "cnfy-header-inner", children: [
|
|
1341
|
+
/* @__PURE__ */ jsxs7("div", { className: "cnfy-header-left", onClick: () => onNavigate == null ? void 0 : onNavigate("/"), children: [
|
|
1342
|
+
logoUrl ? /* @__PURE__ */ jsx8("img", { src: logoUrl, alt: "Logo", className: "cnfy-header-logo-img" }) : /* @__PURE__ */ jsx8(
|
|
1347
1343
|
"div",
|
|
1348
1344
|
{
|
|
1349
|
-
className: "
|
|
1345
|
+
className: "cnfy-header-logo-fallback",
|
|
1350
1346
|
style: { backgroundColor: primaryColor },
|
|
1351
1347
|
children: botName.charAt(0).toUpperCase()
|
|
1352
1348
|
}
|
|
1353
1349
|
),
|
|
1354
|
-
/* @__PURE__ */ jsx8("span", { className: "
|
|
1350
|
+
/* @__PURE__ */ jsx8("span", { className: "cnfy-header-brand", children: botName.toUpperCase() })
|
|
1355
1351
|
] }),
|
|
1356
|
-
/* @__PURE__ */ jsx8("div", { className: "
|
|
1352
|
+
/* @__PURE__ */ jsx8("div", { className: "cnfy-header-right", children: /* @__PURE__ */ jsx8(UserMenu, { onNavigate, onLogout }) })
|
|
1357
1353
|
] }) });
|
|
1358
1354
|
}
|
|
1359
1355
|
|
|
@@ -1398,12 +1394,12 @@ function TrendingNews({
|
|
|
1398
1394
|
window.open(item.sourceUrl || item.link, "_blank");
|
|
1399
1395
|
}
|
|
1400
1396
|
if (isLoading) {
|
|
1401
|
-
return /* @__PURE__ */ jsx9("div", { className: "
|
|
1397
|
+
return /* @__PURE__ */ jsx9("div", { className: "cnfy-trending-msg", children: "Loading news..." });
|
|
1402
1398
|
}
|
|
1403
1399
|
if (!displayNews || displayNews.length === 0) {
|
|
1404
|
-
return /* @__PURE__ */ jsxs8("div", { className: "
|
|
1400
|
+
return /* @__PURE__ */ jsxs8("div", { className: "cnfy-trending-msg cnfy-trending-msg--center", children: [
|
|
1405
1401
|
/* @__PURE__ */ jsx9("p", { children: "No news found for this source." }),
|
|
1406
|
-
/* @__PURE__ */ jsx9("p", { className: "
|
|
1402
|
+
/* @__PURE__ */ jsx9("p", { className: "cnfy-trending-hint", children: 'Click "Scrape" to fetch latest news.' })
|
|
1407
1403
|
] });
|
|
1408
1404
|
}
|
|
1409
1405
|
return /* @__PURE__ */ jsx9(
|
|
@@ -1503,8 +1499,8 @@ function SourceSelector({
|
|
|
1503
1499
|
const selectedOption = options.find(
|
|
1504
1500
|
(opt) => selectedSource === null ? opt.value === ALL_SOURCES_VALUE : opt.value === selectedSource
|
|
1505
1501
|
) || options[0];
|
|
1506
|
-
return /* @__PURE__ */ jsxs9("div", { className: "
|
|
1507
|
-
/* @__PURE__ */ jsx10("div", { className: "
|
|
1502
|
+
return /* @__PURE__ */ jsxs9("div", { className: "cnfy-source-selector", children: [
|
|
1503
|
+
/* @__PURE__ */ jsx10("div", { className: "cnfy-source-selector-select-wrap", children: /* @__PURE__ */ jsx10(
|
|
1508
1504
|
Select2,
|
|
1509
1505
|
{
|
|
1510
1506
|
options,
|
|
@@ -1549,10 +1545,10 @@ function SourceSelector({
|
|
|
1549
1545
|
{
|
|
1550
1546
|
onClick: handleScrape,
|
|
1551
1547
|
disabled: scraping,
|
|
1552
|
-
className: "
|
|
1548
|
+
className: "cnfy-scrape-btn",
|
|
1553
1549
|
title: "Fetch latest news",
|
|
1554
1550
|
children: [
|
|
1555
|
-
/* @__PURE__ */ jsx10(RefreshCcw3, { size: 14, className: scraping ? "animate-spin" : "" }),
|
|
1551
|
+
/* @__PURE__ */ jsx10(RefreshCcw3, { size: 14, className: scraping ? "cnfy-animate-spin" : "" }),
|
|
1556
1552
|
scraping ? "Scraping..." : "Scrape"
|
|
1557
1553
|
]
|
|
1558
1554
|
}
|
|
@@ -1562,9 +1558,9 @@ function SourceSelector({
|
|
|
1562
1558
|
{
|
|
1563
1559
|
onClick: () => fetchNews(null),
|
|
1564
1560
|
disabled: fetchingNews,
|
|
1565
|
-
className: "
|
|
1561
|
+
className: "cnfy-refresh-btn",
|
|
1566
1562
|
children: [
|
|
1567
|
-
/* @__PURE__ */ jsx10(RefreshCcw3, { size: 14, className: fetchingNews ? "animate-spin" : "" }),
|
|
1563
|
+
/* @__PURE__ */ jsx10(RefreshCcw3, { size: 14, className: fetchingNews ? "cnfy-animate-spin" : "" }),
|
|
1568
1564
|
"Refresh"
|
|
1569
1565
|
]
|
|
1570
1566
|
}
|
|
@@ -1862,7 +1858,7 @@ ${title}`
|
|
|
1862
1858
|
const lang = ((_a = preferences == null ? void 0 : preferences.localization) == null ? void 0 : _a.language) === "hi" ? "Hindi" : "English";
|
|
1863
1859
|
try {
|
|
1864
1860
|
await rewriteNewsStreamApi({
|
|
1865
|
-
article: content,
|
|
1861
|
+
article: content || "",
|
|
1866
1862
|
language: lang,
|
|
1867
1863
|
articleId: id,
|
|
1868
1864
|
tone: contentPrefs == null ? void 0 : contentPrefs.tone,
|
|
@@ -1907,7 +1903,7 @@ ${title}`
|
|
|
1907
1903
|
)
|
|
1908
1904
|
);
|
|
1909
1905
|
const result = await rewriteNewsApi({
|
|
1910
|
-
article: content,
|
|
1906
|
+
article: content || "",
|
|
1911
1907
|
language: lang,
|
|
1912
1908
|
articleId: id,
|
|
1913
1909
|
tone: contentPrefs == null ? void 0 : contentPrefs.tone,
|
|
@@ -2099,83 +2095,77 @@ ${optionsList}`
|
|
|
2099
2095
|
}
|
|
2100
2096
|
};
|
|
2101
2097
|
if (loading) {
|
|
2102
|
-
return /* @__PURE__ */ jsx11("div", { className: "
|
|
2103
|
-
/* @__PURE__ */ jsx11(Loader2, { className: "
|
|
2104
|
-
/* @__PURE__ */ jsx11("p", { className: "
|
|
2098
|
+
return /* @__PURE__ */ jsx11("div", { className: "cnfy-loading", children: /* @__PURE__ */ jsxs10("div", { className: "cnfy-loading-inner", children: [
|
|
2099
|
+
/* @__PURE__ */ jsx11(Loader2, { className: "cnfy-loading-spinner cnfy-animate-spin" }),
|
|
2100
|
+
/* @__PURE__ */ jsx11("p", { className: "cnfy-loading-text", children: "Loading..." })
|
|
2105
2101
|
] }) });
|
|
2106
2102
|
}
|
|
2107
|
-
return (
|
|
2108
|
-
|
|
2109
|
-
/* @__PURE__ */ jsxs10("div", { className:
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
/* @__PURE__ */ jsx11("div", { className: "", children: /* @__PURE__ */ jsx11(
|
|
2114
|
-
SourceSelector,
|
|
2115
|
-
{
|
|
2116
|
-
selectedSource,
|
|
2117
|
-
onSourceChange: (value) => {
|
|
2118
|
-
console.log("Selected source:", value);
|
|
2119
|
-
setSelectedSource(value);
|
|
2120
|
-
},
|
|
2121
|
-
onNewsLoaded: handleNewsLoaded,
|
|
2122
|
-
onLoadingChange: handleLoadingChange
|
|
2123
|
-
}
|
|
2124
|
-
) }),
|
|
2125
|
-
/* @__PURE__ */ jsx11(
|
|
2126
|
-
TrendingNews,
|
|
2127
|
-
{
|
|
2128
|
-
onRecreate: handleRecreate,
|
|
2129
|
-
news,
|
|
2130
|
-
isLoading: newsLoading
|
|
2131
|
-
}
|
|
2132
|
-
)
|
|
2133
|
-
] }),
|
|
2134
|
-
/* @__PURE__ */ jsxs10(
|
|
2135
|
-
"section",
|
|
2103
|
+
return /* @__PURE__ */ jsxs10("div", { className: "cnfy-root", children: [
|
|
2104
|
+
/* @__PURE__ */ jsx11(HeaderBar, { onNavigate, onLogout }),
|
|
2105
|
+
/* @__PURE__ */ jsxs10("div", { className: `cnfy-main ${showNewsPanel ? "cnfy-main--with-news" : ""}`, children: [
|
|
2106
|
+
showNewsPanel && /* @__PURE__ */ jsxs10("aside", { className: "cnfy-sidebar", children: [
|
|
2107
|
+
/* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11(
|
|
2108
|
+
SourceSelector,
|
|
2136
2109
|
{
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
{
|
|
2153
|
-
messages,
|
|
2154
|
-
onSend: handleSendMessage,
|
|
2155
|
-
onSelectNews: handleRecreate,
|
|
2156
|
-
isStreaming,
|
|
2157
|
-
analyzedData,
|
|
2158
|
-
onSelectAction: handleSelectAction
|
|
2159
|
-
}
|
|
2160
|
-
) }),
|
|
2161
|
-
!messages.length && /* @__PURE__ */ jsx11("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center text-center text-gray-400 text-sm px-4", children: /* @__PURE__ */ jsxs10("div", { children: [
|
|
2162
|
-
/* @__PURE__ */ jsx11("p", { className: "font-medium", children: "AI News Assistant" }),
|
|
2163
|
-
/* @__PURE__ */ jsx11("p", { className: "mt-1", children: "Select a news article or type a message to begin" })
|
|
2164
|
-
] }) })
|
|
2165
|
-
]
|
|
2110
|
+
selectedSource,
|
|
2111
|
+
onSourceChange: (value) => {
|
|
2112
|
+
console.log("Selected source:", value);
|
|
2113
|
+
setSelectedSource(value);
|
|
2114
|
+
},
|
|
2115
|
+
onNewsLoaded: handleNewsLoaded,
|
|
2116
|
+
onLoadingChange: handleLoadingChange
|
|
2117
|
+
}
|
|
2118
|
+
) }),
|
|
2119
|
+
/* @__PURE__ */ jsx11(
|
|
2120
|
+
TrendingNews,
|
|
2121
|
+
{
|
|
2122
|
+
onRecreate: handleRecreate,
|
|
2123
|
+
news,
|
|
2124
|
+
isLoading: newsLoading
|
|
2166
2125
|
}
|
|
2167
2126
|
)
|
|
2168
2127
|
] }),
|
|
2169
|
-
|
|
2170
|
-
|
|
2128
|
+
/* @__PURE__ */ jsxs10(
|
|
2129
|
+
"section",
|
|
2171
2130
|
{
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2131
|
+
className: `cnfy-chat-section ${showNewsPanel ? "cnfy-chat-section--with-news" : "cnfy-chat-section--full"} ${showChatMobile ? "cnfy-chat-section--visible" : "cnfy-chat-section--hidden-mobile"}`,
|
|
2132
|
+
children: [
|
|
2133
|
+
/* @__PURE__ */ jsx11("div", { className: "cnfy-mobile-back", children: /* @__PURE__ */ jsx11(
|
|
2134
|
+
"button",
|
|
2135
|
+
{
|
|
2136
|
+
onClick: () => setShowChatMobile(false),
|
|
2137
|
+
className: "cnfy-mobile-back-btn",
|
|
2138
|
+
children: "\u2190 Back to news"
|
|
2139
|
+
}
|
|
2140
|
+
) }),
|
|
2141
|
+
/* @__PURE__ */ jsx11("div", { className: "cnfy-chat-inner", children: /* @__PURE__ */ jsx11(
|
|
2142
|
+
ChatWindow,
|
|
2143
|
+
{
|
|
2144
|
+
messages,
|
|
2145
|
+
onSend: handleSendMessage,
|
|
2146
|
+
onSelectNews: handleRecreate,
|
|
2147
|
+
isStreaming,
|
|
2148
|
+
analyzedData,
|
|
2149
|
+
onSelectAction: handleSelectAction
|
|
2150
|
+
}
|
|
2151
|
+
) }),
|
|
2152
|
+
!messages.length && /* @__PURE__ */ jsx11("div", { className: "cnfy-empty-state", children: /* @__PURE__ */ jsxs10("div", { children: [
|
|
2153
|
+
/* @__PURE__ */ jsx11("p", { className: "cnfy-empty-state-title", children: "AI News Assistant" }),
|
|
2154
|
+
/* @__PURE__ */ jsx11("p", { className: "cnfy-empty-state-subtitle", children: "Select a news article or type a message to begin" })
|
|
2155
|
+
] }) })
|
|
2156
|
+
]
|
|
2175
2157
|
}
|
|
2176
2158
|
)
|
|
2177
|
-
] })
|
|
2178
|
-
|
|
2159
|
+
] }),
|
|
2160
|
+
selectedArticle && /* @__PURE__ */ jsx11(
|
|
2161
|
+
ArticleModal,
|
|
2162
|
+
{
|
|
2163
|
+
article: selectedArticle,
|
|
2164
|
+
onClose: () => setSelectedArticle(null),
|
|
2165
|
+
onRecreate: handleRecreate
|
|
2166
|
+
}
|
|
2167
|
+
)
|
|
2168
|
+
] });
|
|
2179
2169
|
}
|
|
2180
2170
|
|
|
2181
2171
|
// src/index.tsx
|