@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.js
CHANGED
|
@@ -60,9 +60,8 @@ var import_react = require("react");
|
|
|
60
60
|
var import_axios = __toESM(require("axios"));
|
|
61
61
|
|
|
62
62
|
// lib/config.ts
|
|
63
|
-
var DEFAULT_API_BASE_URL = "http://localhost:8080/api";
|
|
64
63
|
function getApiBaseUrl() {
|
|
65
|
-
return process.env.NEXT_PUBLIC_CONTENIFY_API_URL ||
|
|
64
|
+
return process.env.NEXT_PUBLIC_CONTENIFY_API_URL || "http://localhost:8080/api";
|
|
66
65
|
}
|
|
67
66
|
function getServerBaseUrl() {
|
|
68
67
|
const apiUrl = getApiBaseUrl();
|
|
@@ -213,31 +212,31 @@ function ArticleModal({
|
|
|
213
212
|
onClose,
|
|
214
213
|
onRecreate
|
|
215
214
|
}) {
|
|
216
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
217
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "cnfy-article-modal-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "cnfy-article-modal", children: [
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "cnfy-article-modal-header", children: [
|
|
218
217
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "
|
|
220
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: "
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "cnfy-article-modal-source", children: "Source Article" }),
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: "cnfy-article-modal-title", children: article.title })
|
|
221
220
|
] }),
|
|
222
221
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
223
222
|
"button",
|
|
224
223
|
{
|
|
225
224
|
onClick: onClose,
|
|
226
|
-
className: "
|
|
225
|
+
className: "cnfy-article-modal-close-btn",
|
|
227
226
|
"aria-label": "Close modal",
|
|
228
227
|
children: "\u2715"
|
|
229
228
|
}
|
|
230
229
|
)
|
|
231
230
|
] }),
|
|
232
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "
|
|
233
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
234
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "
|
|
235
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "cnfy-article-modal-body", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "cnfy-article-modal-content", children: article.content }) }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "cnfy-article-modal-footer", children: [
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cnfy-article-modal-footer-text", children: "This content will be recreated using AI" }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "cnfy-article-modal-footer-actions", children: [
|
|
236
235
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
237
236
|
"button",
|
|
238
237
|
{
|
|
239
238
|
onClick: onClose,
|
|
240
|
-
className: "
|
|
239
|
+
className: "cnfy-btn-cancel",
|
|
241
240
|
children: "Cancel"
|
|
242
241
|
}
|
|
243
242
|
),
|
|
@@ -248,9 +247,8 @@ function ArticleModal({
|
|
|
248
247
|
title: article.title,
|
|
249
248
|
content: article.content,
|
|
250
249
|
id: article._id
|
|
251
|
-
// Include article ID when available
|
|
252
250
|
}),
|
|
253
|
-
className: "
|
|
251
|
+
className: "cnfy-btn-recreate",
|
|
254
252
|
children: "Recreate Article"
|
|
255
253
|
}
|
|
256
254
|
)
|
|
@@ -322,7 +320,7 @@ function RichTextEditor({
|
|
|
322
320
|
content,
|
|
323
321
|
editorProps: {
|
|
324
322
|
attributes: {
|
|
325
|
-
class: "
|
|
323
|
+
class: "ProseMirror"
|
|
326
324
|
}
|
|
327
325
|
},
|
|
328
326
|
onUpdate: ({ editor: editor2 }) => {
|
|
@@ -335,10 +333,10 @@ function RichTextEditor({
|
|
|
335
333
|
}
|
|
336
334
|
}, [content, editor]);
|
|
337
335
|
if (!editor) {
|
|
338
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "
|
|
336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cnfy-editor-loading", children: "Loading editor..." });
|
|
339
337
|
}
|
|
340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "
|
|
341
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "
|
|
338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "cnfy-editor", children: [
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "cnfy-toolbar", children: [
|
|
342
340
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
343
341
|
ToolbarButton,
|
|
344
342
|
{
|
|
@@ -366,7 +364,7 @@ function RichTextEditor({
|
|
|
366
364
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Pilcrow, { size: 18 })
|
|
367
365
|
}
|
|
368
366
|
),
|
|
369
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cnfy-toolbar-divider" }),
|
|
370
368
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
371
369
|
ToolbarButton,
|
|
372
370
|
{
|
|
@@ -385,7 +383,7 @@ function RichTextEditor({
|
|
|
385
383
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Italic, { size: 18 })
|
|
386
384
|
}
|
|
387
385
|
),
|
|
388
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "
|
|
386
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cnfy-toolbar-divider" }),
|
|
389
387
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
390
388
|
ToolbarButton,
|
|
391
389
|
{
|
|
@@ -404,7 +402,7 @@ function RichTextEditor({
|
|
|
404
402
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.ListOrdered, { size: 18 })
|
|
405
403
|
}
|
|
406
404
|
),
|
|
407
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cnfy-toolbar-divider" }),
|
|
408
406
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
409
407
|
ToolbarButton,
|
|
410
408
|
{
|
|
@@ -424,7 +422,7 @@ function RichTextEditor({
|
|
|
424
422
|
}
|
|
425
423
|
)
|
|
426
424
|
] }),
|
|
427
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.EditorContent, { editor, className: "
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.EditorContent, { editor, className: "cnfy-editor-content" })
|
|
428
426
|
] });
|
|
429
427
|
}
|
|
430
428
|
function ToolbarButton({
|
|
@@ -440,7 +438,7 @@ function ToolbarButton({
|
|
|
440
438
|
onClick,
|
|
441
439
|
disabled,
|
|
442
440
|
title,
|
|
443
|
-
className: `
|
|
441
|
+
className: `cnfy-toolbar-btn ${isActive ? "cnfy-toolbar-btn--active" : ""} ${disabled ? "cnfy-toolbar-btn--disabled" : ""}`,
|
|
444
442
|
children
|
|
445
443
|
}
|
|
446
444
|
);
|
|
@@ -524,29 +522,29 @@ function EditModal({
|
|
|
524
522
|
}
|
|
525
523
|
};
|
|
526
524
|
if (!isOpen) return null;
|
|
527
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "
|
|
525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cnfy-edit-modal-overlay", children: [
|
|
528
526
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
529
527
|
"div",
|
|
530
528
|
{
|
|
531
|
-
className: "
|
|
529
|
+
className: "cnfy-edit-modal-backdrop",
|
|
532
530
|
onClick: onClose
|
|
533
531
|
}
|
|
534
532
|
),
|
|
535
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "
|
|
536
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "
|
|
537
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cnfy-edit-modal", children: [
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cnfy-edit-modal-header", children: [
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "cnfy-edit-modal-title", children: "Edit Article" }),
|
|
538
536
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
539
537
|
"button",
|
|
540
538
|
{
|
|
541
539
|
onClick: onClose,
|
|
542
|
-
className: "
|
|
543
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.X, { size: 20, className: "
|
|
540
|
+
className: "cnfy-edit-modal-close-btn",
|
|
541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.X, { size: 20, className: "cnfy-edit-modal-close-icon" })
|
|
544
542
|
}
|
|
545
543
|
)
|
|
546
544
|
] }),
|
|
547
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cnfy-edit-modal-body", children: [
|
|
548
546
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
549
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "cnfy-edit-label", children: "Article Content" }),
|
|
550
548
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
551
549
|
RichTextEditor,
|
|
552
550
|
{
|
|
@@ -557,11 +555,11 @@ function EditModal({
|
|
|
557
555
|
)
|
|
558
556
|
] }),
|
|
559
557
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
560
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "
|
|
561
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "cnfy-edit-label", children: "Meta Keywords" }),
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "cnfy-keyword-list", children: keywords.map((keyword, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
562
560
|
"span",
|
|
563
561
|
{
|
|
564
|
-
className: "
|
|
562
|
+
className: "cnfy-keyword-tag",
|
|
565
563
|
children: [
|
|
566
564
|
"#",
|
|
567
565
|
keyword,
|
|
@@ -569,7 +567,7 @@ function EditModal({
|
|
|
569
567
|
"button",
|
|
570
568
|
{
|
|
571
569
|
onClick: () => handleRemoveKeyword(index),
|
|
572
|
-
className: "
|
|
570
|
+
className: "cnfy-keyword-remove-btn",
|
|
573
571
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.X, { size: 14 })
|
|
574
572
|
}
|
|
575
573
|
)
|
|
@@ -577,7 +575,7 @@ function EditModal({
|
|
|
577
575
|
},
|
|
578
576
|
index
|
|
579
577
|
)) }),
|
|
580
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cnfy-keyword-input-row", children: [
|
|
581
579
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
582
580
|
"input",
|
|
583
581
|
{
|
|
@@ -586,26 +584,26 @@ function EditModal({
|
|
|
586
584
|
onChange: (e) => setNewKeyword(e.target.value),
|
|
587
585
|
onKeyDown: handleKeyDown,
|
|
588
586
|
placeholder: "Add a keyword...",
|
|
589
|
-
className: "
|
|
587
|
+
className: "cnfy-keyword-input"
|
|
590
588
|
}
|
|
591
589
|
),
|
|
592
590
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
593
591
|
"button",
|
|
594
592
|
{
|
|
595
593
|
onClick: handleAddKeyword,
|
|
596
|
-
className: "
|
|
594
|
+
className: "cnfy-btn-add-keyword",
|
|
597
595
|
children: "Add"
|
|
598
596
|
}
|
|
599
597
|
)
|
|
600
598
|
] })
|
|
601
599
|
] })
|
|
602
600
|
] }),
|
|
603
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "cnfy-edit-modal-footer", children: [
|
|
604
602
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
605
603
|
"button",
|
|
606
604
|
{
|
|
607
605
|
onClick: onClose,
|
|
608
|
-
className: "
|
|
606
|
+
className: "cnfy-btn-footer-cancel",
|
|
609
607
|
children: "Cancel"
|
|
610
608
|
}
|
|
611
609
|
),
|
|
@@ -613,7 +611,7 @@ function EditModal({
|
|
|
613
611
|
"button",
|
|
614
612
|
{
|
|
615
613
|
onClick: () => onSaveDraft(content, keywords),
|
|
616
|
-
className: "
|
|
614
|
+
className: "cnfy-btn-save-draft",
|
|
617
615
|
children: "Save Draft"
|
|
618
616
|
}
|
|
619
617
|
),
|
|
@@ -621,7 +619,7 @@ function EditModal({
|
|
|
621
619
|
"button",
|
|
622
620
|
{
|
|
623
621
|
onClick: () => onPost(content, keywords),
|
|
624
|
-
className: "
|
|
622
|
+
className: "cnfy-btn-post-article",
|
|
625
623
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
626
624
|
children: "Post"
|
|
627
625
|
}
|
|
@@ -676,22 +674,22 @@ function NewsList({
|
|
|
676
674
|
b = Math.round(b + (255 - b) * (percent / 100));
|
|
677
675
|
return `rgb(${r}, ${g}, ${b})`;
|
|
678
676
|
};
|
|
679
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "
|
|
677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-news-list", children: news.flatMap((item) => {
|
|
680
678
|
const publishedDate = new Date(item.publishedAt);
|
|
681
679
|
const links = extractLinksFromContent(item.content);
|
|
682
680
|
if (links.length > 0) {
|
|
683
681
|
return links.map((link, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
684
682
|
"div",
|
|
685
683
|
{
|
|
686
|
-
className: "
|
|
684
|
+
className: "cnfy-news-card",
|
|
687
685
|
children: [
|
|
688
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "
|
|
689
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "
|
|
690
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-news-card-content", children: [
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "cnfy-news-card-title", children: link.title }),
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-news-card-meta", children: [
|
|
691
689
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
692
690
|
"span",
|
|
693
691
|
{
|
|
694
|
-
className: "
|
|
692
|
+
className: "cnfy-news-badge",
|
|
695
693
|
style: {
|
|
696
694
|
backgroundColor: lightenColor(primaryColorState, 95),
|
|
697
695
|
color: primaryColor,
|
|
@@ -701,7 +699,7 @@ function NewsList({
|
|
|
701
699
|
}
|
|
702
700
|
),
|
|
703
701
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u2022" }),
|
|
704
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "cnfy-news-card-category", children: item.category }),
|
|
705
703
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u2022" }),
|
|
706
704
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
707
705
|
dateFormatter.format(publishedDate),
|
|
@@ -710,12 +708,12 @@ function NewsList({
|
|
|
710
708
|
] })
|
|
711
709
|
] })
|
|
712
710
|
] }),
|
|
713
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-news-card-actions", children: [
|
|
714
712
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
715
713
|
"button",
|
|
716
714
|
{
|
|
717
715
|
onClick: () => window.open(link.url, "_blank"),
|
|
718
|
-
className: "
|
|
716
|
+
className: "cnfy-news-action-btn",
|
|
719
717
|
title: "View",
|
|
720
718
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Eye, { size: 16 })
|
|
721
719
|
}
|
|
@@ -727,9 +725,8 @@ function NewsList({
|
|
|
727
725
|
title: link.title,
|
|
728
726
|
content: link.title,
|
|
729
727
|
id: item._id
|
|
730
|
-
// Include article ID
|
|
731
728
|
}),
|
|
732
|
-
className: "
|
|
729
|
+
className: "cnfy-news-action-btn",
|
|
733
730
|
title: "Recreate",
|
|
734
731
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.RefreshCcw, { size: 16 })
|
|
735
732
|
}
|
|
@@ -743,15 +740,15 @@ function NewsList({
|
|
|
743
740
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
744
741
|
"div",
|
|
745
742
|
{
|
|
746
|
-
className: "
|
|
743
|
+
className: "cnfy-news-card",
|
|
747
744
|
children: [
|
|
748
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "
|
|
749
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "
|
|
750
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-news-card-content", children: [
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "cnfy-news-card-title", children: item.title }),
|
|
747
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-news-card-meta", children: [
|
|
751
748
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
752
749
|
"span",
|
|
753
750
|
{
|
|
754
|
-
className: "
|
|
751
|
+
className: "cnfy-news-badge",
|
|
755
752
|
style: {
|
|
756
753
|
backgroundColor: lightenColor(primaryColorState, 95),
|
|
757
754
|
color: primaryColor,
|
|
@@ -761,7 +758,7 @@ function NewsList({
|
|
|
761
758
|
}
|
|
762
759
|
),
|
|
763
760
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u2022" }),
|
|
764
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "cnfy-news-card-category", children: item.category }),
|
|
765
762
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u2022" }),
|
|
766
763
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
767
764
|
dateFormatter.format(publishedDate),
|
|
@@ -770,12 +767,12 @@ function NewsList({
|
|
|
770
767
|
] })
|
|
771
768
|
] })
|
|
772
769
|
] }),
|
|
773
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-news-card-actions", children: [
|
|
774
771
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
775
772
|
"button",
|
|
776
773
|
{
|
|
777
774
|
onClick: () => onView(item),
|
|
778
|
-
className: "
|
|
775
|
+
className: "cnfy-news-action-btn",
|
|
779
776
|
title: "View",
|
|
780
777
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Eye, { size: 16 })
|
|
781
778
|
}
|
|
@@ -787,9 +784,8 @@ function NewsList({
|
|
|
787
784
|
title: item.title,
|
|
788
785
|
content: item.content || item.title,
|
|
789
786
|
id: item._id
|
|
790
|
-
// Include article ID
|
|
791
787
|
}),
|
|
792
|
-
className: "
|
|
788
|
+
className: "cnfy-news-action-btn",
|
|
793
789
|
title: "Recreate",
|
|
794
790
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.RefreshCcw, { size: 16 })
|
|
795
791
|
}
|
|
@@ -998,30 +994,30 @@ function ChatWindow({
|
|
|
998
994
|
});
|
|
999
995
|
return { blocks, metaKeywords };
|
|
1000
996
|
}
|
|
1001
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1002
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-chat", children: [
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-chat-area", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-chat-scroll", children: [
|
|
1003
999
|
messages.map((msg) => {
|
|
1004
1000
|
var _a2;
|
|
1005
1001
|
const parsed = formatAIContent(msg.content);
|
|
1006
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1007
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-msg", children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-msg-avatar-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1008
1004
|
"div",
|
|
1009
1005
|
{
|
|
1010
|
-
className: "
|
|
1006
|
+
className: "cnfy-msg-avatar",
|
|
1011
1007
|
style: {
|
|
1012
1008
|
backgroundColor: msg.role === "assistant" ? primaryColor : "#1f2937"
|
|
1013
1009
|
},
|
|
1014
1010
|
children: msg.role === "assistant" ? "AI" : "You"
|
|
1015
1011
|
}
|
|
1016
1012
|
) }),
|
|
1017
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1018
|
-
msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1013
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-msg-body", children: [
|
|
1014
|
+
msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1019
1015
|
"button",
|
|
1020
1016
|
{
|
|
1021
1017
|
onClick: () => handleCopy(parsed.blocks, msg.id),
|
|
1022
|
-
className: "
|
|
1018
|
+
className: "cnfy-copy-btn",
|
|
1023
1019
|
title: "Copy to clipboard",
|
|
1024
|
-
children: copiedId === msg.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Check, { size: 16, className: "
|
|
1020
|
+
children: copiedId === msg.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Copy, { size: 16 })
|
|
1025
1021
|
}
|
|
1026
1022
|
) }),
|
|
1027
1023
|
parsed.blocks.map((block, idx) => {
|
|
@@ -1029,7 +1025,7 @@ function ChatWindow({
|
|
|
1029
1025
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1030
1026
|
"h1",
|
|
1031
1027
|
{
|
|
1032
|
-
className: "
|
|
1028
|
+
className: "cnfy-block-h1",
|
|
1033
1029
|
children: block.text
|
|
1034
1030
|
},
|
|
1035
1031
|
idx
|
|
@@ -1039,18 +1035,18 @@ function ChatWindow({
|
|
|
1039
1035
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1040
1036
|
"h2",
|
|
1041
1037
|
{
|
|
1042
|
-
className: "
|
|
1038
|
+
className: "cnfy-block-h2",
|
|
1043
1039
|
children: block.text
|
|
1044
1040
|
},
|
|
1045
1041
|
idx
|
|
1046
1042
|
);
|
|
1047
1043
|
}
|
|
1048
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "
|
|
1044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "cnfy-block-p", children: block.text }, idx);
|
|
1049
1045
|
}),
|
|
1050
|
-
parsed.metaKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1046
|
+
parsed.metaKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1051
1047
|
"span",
|
|
1052
1048
|
{
|
|
1053
|
-
className: "
|
|
1049
|
+
className: "cnfy-msg-keyword-tag",
|
|
1054
1050
|
children: [
|
|
1055
1051
|
"#",
|
|
1056
1052
|
tag
|
|
@@ -1058,13 +1054,13 @@ function ChatWindow({
|
|
|
1058
1054
|
},
|
|
1059
1055
|
i
|
|
1060
1056
|
)) }) }),
|
|
1061
|
-
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1057
|
+
msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
|
|
1062
1058
|
const IconComponent = ACTION_ICONS[option.id] || import_lucide_react4.FileText;
|
|
1063
1059
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1064
1060
|
"button",
|
|
1065
1061
|
{
|
|
1066
1062
|
onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
|
|
1067
|
-
className: "
|
|
1063
|
+
className: "cnfy-action-btn",
|
|
1068
1064
|
children: [
|
|
1069
1065
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconComponent, { size: 16 }),
|
|
1070
1066
|
option.name
|
|
@@ -1073,12 +1069,12 @@ function ChatWindow({
|
|
|
1073
1069
|
option.id
|
|
1074
1070
|
);
|
|
1075
1071
|
}) }),
|
|
1076
|
-
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__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1072
|
+
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__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-msg-actions", children: [
|
|
1077
1073
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1078
1074
|
"button",
|
|
1079
1075
|
{
|
|
1080
1076
|
onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
|
|
1081
|
-
className: "
|
|
1077
|
+
className: "cnfy-btn-edit",
|
|
1082
1078
|
children: [
|
|
1083
1079
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Edit3, { size: 16 }),
|
|
1084
1080
|
"Edit"
|
|
@@ -1089,7 +1085,7 @@ function ChatWindow({
|
|
|
1089
1085
|
"button",
|
|
1090
1086
|
{
|
|
1091
1087
|
onClick: () => handlePost(msg.content, parsed.metaKeywords),
|
|
1092
|
-
className: "
|
|
1088
|
+
className: "cnfy-btn-post",
|
|
1093
1089
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1094
1090
|
children: [
|
|
1095
1091
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Send, { size: 16 }),
|
|
@@ -1103,32 +1099,32 @@ function ChatWindow({
|
|
|
1103
1099
|
}),
|
|
1104
1100
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref: bottomRef })
|
|
1105
1101
|
] }) }),
|
|
1106
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1107
|
-
!showNewsPanel && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: dropdownRef, className: "
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-input-area", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-input-inner", children: [
|
|
1103
|
+
!showNewsPanel && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: dropdownRef, className: "cnfy-news-pulse-wrap", children: [
|
|
1108
1104
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1109
1105
|
"button",
|
|
1110
1106
|
{
|
|
1111
1107
|
onClick: handleOpenNewsDropdown,
|
|
1112
|
-
className: "
|
|
1108
|
+
className: "cnfy-news-pulse-btn cnfy-animate-pulse",
|
|
1113
1109
|
title: "Select from trending news",
|
|
1114
1110
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Zap, { size: 16 })
|
|
1115
1111
|
}
|
|
1116
1112
|
),
|
|
1117
|
-
showNewsDropdown && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1118
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1119
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "
|
|
1113
|
+
showNewsDropdown && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-news-dropdown", children: [
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-news-dropdown-header", style: { backgroundColor: primaryColor, color: "#fff" }, children: [
|
|
1115
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cnfy-news-dropdown-title", children: "Select News" }),
|
|
1120
1116
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1121
1117
|
"button",
|
|
1122
1118
|
{
|
|
1123
1119
|
onClick: () => setShowNewsDropdown(false),
|
|
1124
|
-
className: "
|
|
1120
|
+
className: "cnfy-news-dropdown-close",
|
|
1125
1121
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1126
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.X, { size: 14
|
|
1122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.X, { size: 14 })
|
|
1127
1123
|
}
|
|
1128
1124
|
)
|
|
1129
1125
|
] }),
|
|
1130
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "
|
|
1131
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-news-dropdown-source", children: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-news-dropdown-select-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1132
1128
|
import_react_select.default,
|
|
1133
1129
|
{
|
|
1134
1130
|
options: [
|
|
@@ -1179,10 +1175,10 @@ function ChatWindow({
|
|
|
1179
1175
|
{
|
|
1180
1176
|
onClick: handleScrape,
|
|
1181
1177
|
disabled: scraping,
|
|
1182
|
-
className: "
|
|
1178
|
+
className: "cnfy-scrape-btn",
|
|
1183
1179
|
title: "Fetch latest news",
|
|
1184
1180
|
children: [
|
|
1185
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.RefreshCcw, { size: 14, className: scraping ? "animate-spin" : "" }),
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.RefreshCcw, { size: 14, className: scraping ? "cnfy-animate-spin" : "" }),
|
|
1186
1182
|
scraping ? "Scraping..." : "Scrape"
|
|
1187
1183
|
]
|
|
1188
1184
|
}
|
|
@@ -1192,17 +1188,17 @@ function ChatWindow({
|
|
|
1192
1188
|
{
|
|
1193
1189
|
onClick: () => fetchNews(null),
|
|
1194
1190
|
disabled: loadingNews,
|
|
1195
|
-
className: "
|
|
1191
|
+
className: "cnfy-refresh-btn",
|
|
1196
1192
|
children: [
|
|
1197
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.RefreshCcw, { size: 14, className: loadingNews ? "animate-spin" : "" }),
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.RefreshCcw, { size: 14, className: loadingNews ? "cnfy-animate-spin" : "" }),
|
|
1198
1194
|
"Refresh"
|
|
1199
1195
|
]
|
|
1200
1196
|
}
|
|
1201
1197
|
)
|
|
1202
1198
|
] }),
|
|
1203
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-news-dropdown-list", children: loadingNews ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "cnfy-news-dropdown-msg", children: "Loading news..." }) : trendingNews.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "cnfy-news-dropdown-msg", children: [
|
|
1204
1200
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "No news found." }),
|
|
1205
|
-
selectedSource && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "
|
|
1201
|
+
selectedSource && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "cnfy-news-dropdown-hint", children: 'Click "Scrape" to fetch latest news.' })
|
|
1206
1202
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1207
1203
|
NewsList,
|
|
1208
1204
|
{
|
|
@@ -1230,7 +1226,7 @@ function ChatWindow({
|
|
|
1230
1226
|
},
|
|
1231
1227
|
rows: 1,
|
|
1232
1228
|
placeholder: "Ask AI something\u2026",
|
|
1233
|
-
className: `
|
|
1229
|
+
className: `cnfy-chat-textarea ${!showNewsPanel ? "cnfy-chat-textarea--with-pulse" : ""}`,
|
|
1234
1230
|
style: { maxHeight: "200px", overflowY: input.split("\n").length > 6 ? "auto" : "hidden" }
|
|
1235
1231
|
}
|
|
1236
1232
|
),
|
|
@@ -1238,7 +1234,7 @@ function ChatWindow({
|
|
|
1238
1234
|
"button",
|
|
1239
1235
|
{
|
|
1240
1236
|
onClick: handleSend,
|
|
1241
|
-
className: "
|
|
1237
|
+
className: "cnfy-send-btn",
|
|
1242
1238
|
style: { backgroundColor: primaryColor, color: "#fff" },
|
|
1243
1239
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.SendHorizontal, { size: 18 })
|
|
1244
1240
|
}
|
|
@@ -1304,23 +1300,23 @@ function UserMenu({
|
|
|
1304
1300
|
import_react_hot_toast.default.error(err || "Logout failed");
|
|
1305
1301
|
}
|
|
1306
1302
|
}
|
|
1307
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref, className: "
|
|
1303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref, className: "cnfy-user-menu", children: [
|
|
1308
1304
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1309
1305
|
"button",
|
|
1310
1306
|
{
|
|
1311
1307
|
onClick: () => setOpen((v) => !v),
|
|
1312
|
-
className: "
|
|
1308
|
+
className: "cnfy-user-menu-trigger",
|
|
1313
1309
|
"aria-label": "Settings",
|
|
1314
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Settings, { size: 20, className: "
|
|
1310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Settings, { size: 20, className: "cnfy-user-menu-trigger-icon" })
|
|
1315
1311
|
}
|
|
1316
1312
|
),
|
|
1317
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "
|
|
1313
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "cnfy-dropdown", children: [
|
|
1318
1314
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuItem, { icon: import_lucide_react5.User, label: "Account", onClick: () => go("/dashboard/account") }),
|
|
1319
1315
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuItem, { icon: import_lucide_react5.Settings, label: "Preferences", onClick: () => go("/dashboard/preferences") }),
|
|
1320
1316
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuItem, { icon: import_lucide_react5.Palette, label: "Appearance", onClick: () => go("/dashboard/appearance") }),
|
|
1321
1317
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuItem, { icon: import_lucide_react5.HelpCircle, label: "Settings", onClick: () => go("/dashboard/settings") }),
|
|
1322
1318
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuItem, { icon: import_lucide_react5.HelpCircle, label: "Help & Support", onClick: () => go("/dashboard/help") }),
|
|
1323
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "cnfy-dropdown-divider" }),
|
|
1324
1320
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1325
1321
|
MenuItem,
|
|
1326
1322
|
{
|
|
@@ -1343,7 +1339,7 @@ function MenuItem({
|
|
|
1343
1339
|
"button",
|
|
1344
1340
|
{
|
|
1345
1341
|
onClick,
|
|
1346
|
-
className: `
|
|
1342
|
+
className: `cnfy-menu-item ${danger ? "cnfy-menu-item--danger" : ""}`,
|
|
1347
1343
|
children: [
|
|
1348
1344
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: 16 }),
|
|
1349
1345
|
label
|
|
@@ -1359,19 +1355,19 @@ function HeaderBar({
|
|
|
1359
1355
|
onLogout
|
|
1360
1356
|
}) {
|
|
1361
1357
|
const { primaryColor, botName, logoUrl } = useTheme();
|
|
1362
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("header", { className: "
|
|
1363
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "
|
|
1364
|
-
logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: logoUrl, alt: "Logo", className: "
|
|
1358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("header", { className: "cnfy-header", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "cnfy-header-inner", children: [
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "cnfy-header-left", onClick: () => onNavigate == null ? void 0 : onNavigate("/"), children: [
|
|
1360
|
+
logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: logoUrl, alt: "Logo", className: "cnfy-header-logo-img" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1365
1361
|
"div",
|
|
1366
1362
|
{
|
|
1367
|
-
className: "
|
|
1363
|
+
className: "cnfy-header-logo-fallback",
|
|
1368
1364
|
style: { backgroundColor: primaryColor },
|
|
1369
1365
|
children: botName.charAt(0).toUpperCase()
|
|
1370
1366
|
}
|
|
1371
1367
|
),
|
|
1372
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "cnfy-header-brand", children: botName.toUpperCase() })
|
|
1373
1369
|
] }),
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "cnfy-header-right", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UserMenu, { onNavigate, onLogout }) })
|
|
1375
1371
|
] }) });
|
|
1376
1372
|
}
|
|
1377
1373
|
|
|
@@ -1416,12 +1412,12 @@ function TrendingNews({
|
|
|
1416
1412
|
window.open(item.sourceUrl || item.link, "_blank");
|
|
1417
1413
|
}
|
|
1418
1414
|
if (isLoading) {
|
|
1419
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "
|
|
1415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "cnfy-trending-msg", children: "Loading news..." });
|
|
1420
1416
|
}
|
|
1421
1417
|
if (!displayNews || displayNews.length === 0) {
|
|
1422
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "
|
|
1418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "cnfy-trending-msg cnfy-trending-msg--center", children: [
|
|
1423
1419
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "No news found for this source." }),
|
|
1424
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "cnfy-trending-hint", children: 'Click "Scrape" to fetch latest news.' })
|
|
1425
1421
|
] });
|
|
1426
1422
|
}
|
|
1427
1423
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1521,8 +1517,8 @@ function SourceSelector({
|
|
|
1521
1517
|
const selectedOption = options.find(
|
|
1522
1518
|
(opt) => selectedSource === null ? opt.value === ALL_SOURCES_VALUE : opt.value === selectedSource
|
|
1523
1519
|
) || options[0];
|
|
1524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "
|
|
1525
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "
|
|
1520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-source-selector", children: [
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "cnfy-source-selector-select-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1526
1522
|
import_react_select2.default,
|
|
1527
1523
|
{
|
|
1528
1524
|
options,
|
|
@@ -1567,10 +1563,10 @@ function SourceSelector({
|
|
|
1567
1563
|
{
|
|
1568
1564
|
onClick: handleScrape,
|
|
1569
1565
|
disabled: scraping,
|
|
1570
|
-
className: "
|
|
1566
|
+
className: "cnfy-scrape-btn",
|
|
1571
1567
|
title: "Fetch latest news",
|
|
1572
1568
|
children: [
|
|
1573
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.RefreshCcw, { size: 14, className: scraping ? "animate-spin" : "" }),
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.RefreshCcw, { size: 14, className: scraping ? "cnfy-animate-spin" : "" }),
|
|
1574
1570
|
scraping ? "Scraping..." : "Scrape"
|
|
1575
1571
|
]
|
|
1576
1572
|
}
|
|
@@ -1580,9 +1576,9 @@ function SourceSelector({
|
|
|
1580
1576
|
{
|
|
1581
1577
|
onClick: () => fetchNews(null),
|
|
1582
1578
|
disabled: fetchingNews,
|
|
1583
|
-
className: "
|
|
1579
|
+
className: "cnfy-refresh-btn",
|
|
1584
1580
|
children: [
|
|
1585
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.RefreshCcw, { size: 14, className: fetchingNews ? "animate-spin" : "" }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.RefreshCcw, { size: 14, className: fetchingNews ? "cnfy-animate-spin" : "" }),
|
|
1586
1582
|
"Refresh"
|
|
1587
1583
|
]
|
|
1588
1584
|
}
|
|
@@ -1880,7 +1876,7 @@ ${title}`
|
|
|
1880
1876
|
const lang = ((_a = preferences == null ? void 0 : preferences.localization) == null ? void 0 : _a.language) === "hi" ? "Hindi" : "English";
|
|
1881
1877
|
try {
|
|
1882
1878
|
await rewriteNewsStreamApi({
|
|
1883
|
-
article: content,
|
|
1879
|
+
article: content || "",
|
|
1884
1880
|
language: lang,
|
|
1885
1881
|
articleId: id,
|
|
1886
1882
|
tone: contentPrefs == null ? void 0 : contentPrefs.tone,
|
|
@@ -1925,7 +1921,7 @@ ${title}`
|
|
|
1925
1921
|
)
|
|
1926
1922
|
);
|
|
1927
1923
|
const result = await rewriteNewsApi({
|
|
1928
|
-
article: content,
|
|
1924
|
+
article: content || "",
|
|
1929
1925
|
language: lang,
|
|
1930
1926
|
articleId: id,
|
|
1931
1927
|
tone: contentPrefs == null ? void 0 : contentPrefs.tone,
|
|
@@ -2117,83 +2113,77 @@ ${optionsList}`
|
|
|
2117
2113
|
}
|
|
2118
2114
|
};
|
|
2119
2115
|
if (loading) {
|
|
2120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "
|
|
2121
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Loader2, { className: "
|
|
2122
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "
|
|
2116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "cnfy-loading", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "cnfy-loading-inner", children: [
|
|
2117
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Loader2, { className: "cnfy-loading-spinner cnfy-animate-spin" }),
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "cnfy-loading-text", children: "Loading..." })
|
|
2123
2119
|
] }) });
|
|
2124
2120
|
}
|
|
2125
|
-
return (
|
|
2126
|
-
|
|
2127
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className:
|
|
2128
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2132
|
-
SourceSelector,
|
|
2133
|
-
{
|
|
2134
|
-
selectedSource,
|
|
2135
|
-
onSourceChange: (value) => {
|
|
2136
|
-
console.log("Selected source:", value);
|
|
2137
|
-
setSelectedSource(value);
|
|
2138
|
-
},
|
|
2139
|
-
onNewsLoaded: handleNewsLoaded,
|
|
2140
|
-
onLoadingChange: handleLoadingChange
|
|
2141
|
-
}
|
|
2142
|
-
) }),
|
|
2143
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2144
|
-
TrendingNews,
|
|
2145
|
-
{
|
|
2146
|
-
onRecreate: handleRecreate,
|
|
2147
|
-
news,
|
|
2148
|
-
isLoading: newsLoading
|
|
2149
|
-
}
|
|
2150
|
-
)
|
|
2151
|
-
] }),
|
|
2152
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2153
|
-
"section",
|
|
2121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "cnfy-root", children: [
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HeaderBar, { onNavigate, onLogout }),
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `cnfy-main ${showNewsPanel ? "cnfy-main--with-news" : ""}`, children: [
|
|
2124
|
+
showNewsPanel && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("aside", { className: "cnfy-sidebar", children: [
|
|
2125
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2126
|
+
SourceSelector,
|
|
2154
2127
|
{
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
{
|
|
2171
|
-
messages,
|
|
2172
|
-
onSend: handleSendMessage,
|
|
2173
|
-
onSelectNews: handleRecreate,
|
|
2174
|
-
isStreaming,
|
|
2175
|
-
analyzedData,
|
|
2176
|
-
onSelectAction: handleSelectAction
|
|
2177
|
-
}
|
|
2178
|
-
) }),
|
|
2179
|
-
!messages.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center text-center text-gray-400 text-sm px-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2180
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "font-medium", children: "AI News Assistant" }),
|
|
2181
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mt-1", children: "Select a news article or type a message to begin" })
|
|
2182
|
-
] }) })
|
|
2183
|
-
]
|
|
2128
|
+
selectedSource,
|
|
2129
|
+
onSourceChange: (value) => {
|
|
2130
|
+
console.log("Selected source:", value);
|
|
2131
|
+
setSelectedSource(value);
|
|
2132
|
+
},
|
|
2133
|
+
onNewsLoaded: handleNewsLoaded,
|
|
2134
|
+
onLoadingChange: handleLoadingChange
|
|
2135
|
+
}
|
|
2136
|
+
) }),
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2138
|
+
TrendingNews,
|
|
2139
|
+
{
|
|
2140
|
+
onRecreate: handleRecreate,
|
|
2141
|
+
news,
|
|
2142
|
+
isLoading: newsLoading
|
|
2184
2143
|
}
|
|
2185
2144
|
)
|
|
2186
2145
|
] }),
|
|
2187
|
-
|
|
2188
|
-
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2147
|
+
"section",
|
|
2189
2148
|
{
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2149
|
+
className: `cnfy-chat-section ${showNewsPanel ? "cnfy-chat-section--with-news" : "cnfy-chat-section--full"} ${showChatMobile ? "cnfy-chat-section--visible" : "cnfy-chat-section--hidden-mobile"}`,
|
|
2150
|
+
children: [
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "cnfy-mobile-back", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2152
|
+
"button",
|
|
2153
|
+
{
|
|
2154
|
+
onClick: () => setShowChatMobile(false),
|
|
2155
|
+
className: "cnfy-mobile-back-btn",
|
|
2156
|
+
children: "\u2190 Back to news"
|
|
2157
|
+
}
|
|
2158
|
+
) }),
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "cnfy-chat-inner", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2160
|
+
ChatWindow,
|
|
2161
|
+
{
|
|
2162
|
+
messages,
|
|
2163
|
+
onSend: handleSendMessage,
|
|
2164
|
+
onSelectNews: handleRecreate,
|
|
2165
|
+
isStreaming,
|
|
2166
|
+
analyzedData,
|
|
2167
|
+
onSelectAction: handleSelectAction
|
|
2168
|
+
}
|
|
2169
|
+
) }),
|
|
2170
|
+
!messages.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "cnfy-empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "cnfy-empty-state-title", children: "AI News Assistant" }),
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "cnfy-empty-state-subtitle", children: "Select a news article or type a message to begin" })
|
|
2173
|
+
] }) })
|
|
2174
|
+
]
|
|
2193
2175
|
}
|
|
2194
2176
|
)
|
|
2195
|
-
] })
|
|
2196
|
-
|
|
2177
|
+
] }),
|
|
2178
|
+
selectedArticle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2179
|
+
ArticleModal,
|
|
2180
|
+
{
|
|
2181
|
+
article: selectedArticle,
|
|
2182
|
+
onClose: () => setSelectedArticle(null),
|
|
2183
|
+
onRecreate: handleRecreate
|
|
2184
|
+
}
|
|
2185
|
+
)
|
|
2186
|
+
] });
|
|
2197
2187
|
}
|
|
2198
2188
|
|
|
2199
2189
|
// src/index.tsx
|