@contenify/chatbot 0.1.5 → 2.0.0

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.mjs CHANGED
@@ -77,7 +77,7 @@ var api_default = api;
77
77
 
78
78
  // services/preferences.service.ts
79
79
  var getMyPreferencesApi = async () => {
80
- const { data } = await api_default.get("/preferences/me");
80
+ const { data } = await api_default.get("/chatboat/preferences/me");
81
81
  return data.data;
82
82
  };
83
83
  var savePreferencesApi = async ({
@@ -155,7 +155,7 @@ var savePreferencesApi = async ({
155
155
  if (targetAudience !== void 0) {
156
156
  formData.append("targetAudience", targetAudience);
157
157
  }
158
- const { data } = await api_default.put("/preferences", formData, {
158
+ const { data } = await api_default.put("/chatboat/preferences", formData, {
159
159
  headers: {
160
160
  "Content-Type": "multipart/form-data"
161
161
  }
@@ -292,6 +292,13 @@ function extractArticleContent(raw) {
292
292
  };
293
293
  }
294
294
  }
295
+ var hexToRgba = (hex, opacity) => {
296
+ const sanitizedHex = hex.replace("#", "");
297
+ const r = parseInt(sanitizedHex.substring(0, 2), 16);
298
+ const g = parseInt(sanitizedHex.substring(2, 4), 16);
299
+ const b = parseInt(sanitizedHex.substring(4, 6), 16);
300
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
301
+ };
295
302
 
296
303
  // components/chatbot/ChatWindow.tsx
297
304
  import { Check, Copy, Edit3, Send, SendHorizontal, Zap, X as X2, RefreshCcw as RefreshCcw2, FileText, ListChecks, Share2, BookOpen, Mail, Key } from "lucide-react";
@@ -819,19 +826,19 @@ function NewsList({
819
826
 
820
827
  // services/news.service.ts
821
828
  var getTrendingNews = async () => {
822
- const { data } = await api_default.get("/news/trending");
829
+ const { data } = await api_default.get("/chatboat/trending");
823
830
  return data.data;
824
831
  };
825
832
  var getNewsSources = async () => {
826
- const { data } = await api_default.get("/news/sources");
833
+ const { data } = await api_default.get("/chatboat/scrape/sources");
827
834
  return data.data;
828
835
  };
829
836
  var scrapeNewsSource = async (sourceId) => {
830
- const { data } = await api_default.post("/news/scrape-source", { sourceId });
837
+ const { data } = await api_default.post("/chatboat/scrape/source", { sourceId });
831
838
  return data.data;
832
839
  };
833
840
  var getNewsBySource = async (sourceId) => {
834
- const { data } = await api_default.get(`/news/by-source/${sourceId}`);
841
+ const { data } = await api_default.get(`/chatboat/scrape/by-source/${sourceId}`);
835
842
  return data.data;
836
843
  };
837
844
 
@@ -852,7 +859,8 @@ function ChatWindow({
852
859
  onSelectNews,
853
860
  isStreaming = false,
854
861
  analyzedData,
855
- onSelectAction
862
+ onSelectAction,
863
+ onPost: onPostCallback
856
864
  }) {
857
865
  var _a, _b;
858
866
  const { loading, showNewsPanel } = useTheme();
@@ -901,7 +909,7 @@ function ChatWindow({
901
909
  handleCloseModal();
902
910
  };
903
911
  const handlePost = (content, keywords) => {
904
- console.log("Posting:", { content, keywords });
912
+ onPostCallback == null ? void 0 : onPostCallback(content, keywords);
905
913
  handleCloseModal();
906
914
  };
907
915
  useLayoutEffect(() => {
@@ -965,7 +973,6 @@ function ChatWindow({
965
973
  const handleSourceSelect = (option) => {
966
974
  var _a2;
967
975
  const sourceId = (_a2 = option == null ? void 0 : option.value) != null ? _a2 : null;
968
- console.log("Selected source:", option);
969
976
  setSelectedSource(sourceId);
970
977
  fetchNews(sourceId);
971
978
  };
@@ -1018,103 +1025,91 @@ function ChatWindow({
1018
1025
  messages.map((msg) => {
1019
1026
  var _a2;
1020
1027
  const parsed = formatAIContent(msg.content);
1021
- return /* @__PURE__ */ jsxs4("div", { className: "cnfy-msg", children: [
1022
- /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-avatar-wrap", children: /* @__PURE__ */ jsx5(
1023
- "div",
1028
+ return /* @__PURE__ */ jsx5("div", { className: "cnfy-msg", children: /* @__PURE__ */ jsxs4("div", { className: msg.role === "assistant" ? `cnfy-msg-body` : `cnfy-msg-body you`, children: [
1029
+ msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ jsx5(
1030
+ "button",
1024
1031
  {
1025
- className: "cnfy-msg-avatar",
1026
- style: {
1027
- backgroundColor: msg.role === "assistant" ? primaryColor : "#1f2937"
1028
- },
1029
- children: msg.role === "assistant" ? "AI" : "You"
1032
+ onClick: () => handleCopy(parsed.blocks, msg.id),
1033
+ className: "cnfy-copy-btn",
1034
+ title: "Copy to clipboard",
1035
+ children: copiedId === msg.id ? /* @__PURE__ */ jsx5(Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ jsx5(Copy, { size: 16 })
1030
1036
  }
1031
1037
  ) }),
1032
- /* @__PURE__ */ jsxs4("div", { className: "cnfy-msg-body", children: [
1033
- msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ jsx5(
1038
+ parsed.blocks.map((block, idx) => {
1039
+ if (block.type === "h1") {
1040
+ return /* @__PURE__ */ jsx5(
1041
+ "h1",
1042
+ {
1043
+ className: "cnfy-block-h1",
1044
+ children: block.text
1045
+ },
1046
+ idx
1047
+ );
1048
+ }
1049
+ if (block.type === "h2") {
1050
+ return /* @__PURE__ */ jsx5(
1051
+ "h2",
1052
+ {
1053
+ className: "cnfy-block-h2",
1054
+ children: block.text
1055
+ },
1056
+ idx
1057
+ );
1058
+ }
1059
+ return /* @__PURE__ */ jsx5("p", { className: "cnfy-block-p", children: block.text }, idx);
1060
+ }),
1061
+ parsed.metaKeywords.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ jsxs4(
1062
+ "span",
1063
+ {
1064
+ className: "cnfy-msg-keyword-tag",
1065
+ children: [
1066
+ "#",
1067
+ tag
1068
+ ]
1069
+ },
1070
+ i
1071
+ )) }) }),
1072
+ msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
1073
+ const IconComponent = ACTION_ICONS[option.id] || FileText;
1074
+ return /* @__PURE__ */ jsxs4(
1034
1075
  "button",
1035
1076
  {
1036
- onClick: () => handleCopy(parsed.blocks, msg.id),
1037
- className: "cnfy-copy-btn",
1038
- title: "Copy to clipboard",
1039
- children: copiedId === msg.id ? /* @__PURE__ */ jsx5(Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ jsx5(Copy, { size: 16 })
1040
- }
1041
- ) }),
1042
- parsed.blocks.map((block, idx) => {
1043
- if (block.type === "h1") {
1044
- return /* @__PURE__ */ jsx5(
1045
- "h1",
1046
- {
1047
- className: "cnfy-block-h1",
1048
- children: block.text
1049
- },
1050
- idx
1051
- );
1052
- }
1053
- if (block.type === "h2") {
1054
- return /* @__PURE__ */ jsx5(
1055
- "h2",
1056
- {
1057
- className: "cnfy-block-h2",
1058
- children: block.text
1059
- },
1060
- idx
1061
- );
1077
+ onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
1078
+ className: "cnfy-action-btn",
1079
+ children: [
1080
+ /* @__PURE__ */ jsx5(IconComponent, { size: 16 }),
1081
+ option.name
1082
+ ]
1083
+ },
1084
+ option.id
1085
+ );
1086
+ }) }),
1087
+ 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__ */ jsxs4("div", { className: "cnfy-msg-actions", children: [
1088
+ /* @__PURE__ */ jsxs4(
1089
+ "button",
1090
+ {
1091
+ onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
1092
+ className: "cnfy-btn-edit",
1093
+ children: [
1094
+ /* @__PURE__ */ jsx5(Edit3, { size: 16 }),
1095
+ "Edit"
1096
+ ]
1062
1097
  }
1063
- return /* @__PURE__ */ jsx5("p", { className: "cnfy-block-p", children: block.text }, idx);
1064
- }),
1065
- parsed.metaKeywords.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ jsx5("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ jsxs4(
1066
- "span",
1098
+ ),
1099
+ /* @__PURE__ */ jsxs4(
1100
+ "button",
1067
1101
  {
1068
- className: "cnfy-msg-keyword-tag",
1102
+ onClick: () => handlePost(msg.content, parsed.metaKeywords),
1103
+ className: "cnfy-btn-post",
1104
+ style: { backgroundColor: primaryColor, color: "#fff" },
1069
1105
  children: [
1070
- "#",
1071
- tag
1106
+ /* @__PURE__ */ jsx5(Send, { size: 16 }),
1107
+ "Post"
1072
1108
  ]
1073
- },
1074
- i
1075
- )) }) }),
1076
- msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ jsx5("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
1077
- const IconComponent = ACTION_ICONS[option.id] || FileText;
1078
- return /* @__PURE__ */ jsxs4(
1079
- "button",
1080
- {
1081
- onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
1082
- className: "cnfy-action-btn",
1083
- children: [
1084
- /* @__PURE__ */ jsx5(IconComponent, { size: 16 }),
1085
- option.name
1086
- ]
1087
- },
1088
- option.id
1089
- );
1090
- }) }),
1091
- 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__ */ jsxs4("div", { className: "cnfy-msg-actions", children: [
1092
- /* @__PURE__ */ jsxs4(
1093
- "button",
1094
- {
1095
- onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
1096
- className: "cnfy-btn-edit",
1097
- children: [
1098
- /* @__PURE__ */ jsx5(Edit3, { size: 16 }),
1099
- "Edit"
1100
- ]
1101
- }
1102
- ),
1103
- /* @__PURE__ */ jsxs4(
1104
- "button",
1105
- {
1106
- onClick: () => handlePost(msg.content, parsed.metaKeywords),
1107
- className: "cnfy-btn-post",
1108
- style: { backgroundColor: primaryColor, color: "#fff" },
1109
- children: [
1110
- /* @__PURE__ */ jsx5(Send, { size: 16 }),
1111
- "Post"
1112
- ]
1113
- }
1114
- )
1115
- ] })
1109
+ }
1110
+ )
1116
1111
  ] })
1117
- ] }, msg.id);
1112
+ ] }) }, msg.id);
1118
1113
  }),
1119
1114
  /* @__PURE__ */ jsx5("div", { ref: bottomRef })
1120
1115
  ] }) }),
@@ -1354,14 +1349,14 @@ var triggerScrape = async ({
1354
1349
  state,
1355
1350
  cities
1356
1351
  }) => {
1357
- const { data } = await api_default.post("/scrape/trigger", {
1352
+ const { data } = await api_default.post("/chatboat/scrape/trigger", {
1358
1353
  state,
1359
1354
  cities
1360
1355
  });
1361
1356
  return data;
1362
1357
  };
1363
1358
  var getScrapeStatus = async () => {
1364
- const { data } = await api_default.get("/scrape/status");
1359
+ const { data } = await api_default.get("/chatboat/scrape/status");
1365
1360
  return data.data;
1366
1361
  };
1367
1362
 
@@ -1417,23 +1412,6 @@ var LANGUAGE_OPTIONS = [
1417
1412
  { value: "en", label: "English" },
1418
1413
  { value: "hi", label: "Hindi" }
1419
1414
  ];
1420
- var TONE_OPTIONS = [
1421
- { value: "formal", label: "Formal" },
1422
- { value: "casual", label: "Casual" },
1423
- { value: "engaging", label: "Engaging" },
1424
- { value: "professional", label: "Professional" }
1425
- ];
1426
- var STYLE_OPTIONS = [
1427
- { value: "news", label: "News Article" },
1428
- { value: "blog", label: "Blog Post" },
1429
- { value: "editorial", label: "Editorial" },
1430
- { value: "summary", label: "Summary" }
1431
- ];
1432
- var WORD_COUNT_OPTIONS = [
1433
- { value: "short", label: "Short (~300 words)" },
1434
- { value: "medium", label: "Medium (~600 words)" },
1435
- { value: "long", label: "Long (~1000+ words)" }
1436
- ];
1437
1415
  function PreferencesPage() {
1438
1416
  var _a, _b, _c;
1439
1417
  const { preferences, loading, refreshPreferences, updatePreferences } = usePreferences();
@@ -1444,12 +1422,6 @@ function PreferencesPage() {
1444
1422
  const [state, setState] = useState6(null);
1445
1423
  const [cities, setCities] = useState6([]);
1446
1424
  const [language, setLanguage] = useState6(null);
1447
- const [tone, setTone] = useState6(null);
1448
- const [style, setStyle] = useState6(null);
1449
- const [wordCount, setWordCount] = useState6(null);
1450
- const [includeQuotes, setIncludeQuotes] = useState6(true);
1451
- const [includeFAQ, setIncludeFAQ] = useState6(false);
1452
- const [targetAudience, setTargetAudience] = useState6("");
1453
1425
  const [saving, setSaving] = useState6(false);
1454
1426
  const [success, setSuccess] = useState6(false);
1455
1427
  const [scraping, setScraping] = useState6(false);
@@ -1459,13 +1431,7 @@ function PreferencesPage() {
1459
1431
  botName: "",
1460
1432
  state: void 0,
1461
1433
  cities: [],
1462
- language: void 0,
1463
- tone: void 0,
1464
- style: void 0,
1465
- wordCount: void 0,
1466
- includeQuotes: true,
1467
- includeFAQ: false,
1468
- targetAudience: ""
1434
+ language: void 0
1469
1435
  });
1470
1436
  useEffect7(() => {
1471
1437
  const fetchScrapeStatus = async () => {
@@ -1505,7 +1471,7 @@ function PreferencesPage() {
1505
1471
  }
1506
1472
  };
1507
1473
  useEffect7(() => {
1508
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1474
+ var _a2, _b2, _c2, _d, _e;
1509
1475
  if (preferences) {
1510
1476
  const name = ((_a2 = preferences.chatbot) == null ? void 0 : _a2.name) || "";
1511
1477
  const pState = (_b2 = preferences.localization) == null ? void 0 : _b2.state;
@@ -1523,38 +1489,11 @@ function PreferencesPage() {
1523
1489
  const langOption = LANGUAGE_OPTIONS.find((opt) => opt.value === pLanguage);
1524
1490
  setLanguage(langOption || null);
1525
1491
  }
1526
- const pTone = (_f = preferences.content) == null ? void 0 : _f.tone;
1527
- const pStyle = (_g = preferences.content) == null ? void 0 : _g.style;
1528
- const pWordCount = (_h = preferences.content) == null ? void 0 : _h.wordCount;
1529
- const pIncludeQuotes = (_j = (_i = preferences.content) == null ? void 0 : _i.includeQuotes) != null ? _j : true;
1530
- const pIncludeFAQ = (_l = (_k = preferences.content) == null ? void 0 : _k.includeFAQ) != null ? _l : false;
1531
- const pTargetAudience = ((_m = preferences.content) == null ? void 0 : _m.targetAudience) || "";
1532
- if (pTone) {
1533
- const toneOption = TONE_OPTIONS.find((opt) => opt.value === pTone);
1534
- setTone(toneOption || null);
1535
- }
1536
- if (pStyle) {
1537
- const styleOption = STYLE_OPTIONS.find((opt) => opt.value === pStyle);
1538
- setStyle(styleOption || null);
1539
- }
1540
- if (pWordCount) {
1541
- const wordCountOption = WORD_COUNT_OPTIONS.find((opt) => opt.value === pWordCount);
1542
- setWordCount(wordCountOption || null);
1543
- }
1544
- setIncludeQuotes(pIncludeQuotes);
1545
- setIncludeFAQ(pIncludeFAQ);
1546
- setTargetAudience(pTargetAudience);
1547
1492
  setOriginalValues({
1548
1493
  botName: name,
1549
1494
  state: pState,
1550
1495
  cities: pCities,
1551
- language: pLanguage,
1552
- tone: pTone,
1553
- style: pStyle,
1554
- wordCount: pWordCount,
1555
- includeQuotes: pIncludeQuotes,
1556
- includeFAQ: pIncludeFAQ,
1557
- targetAudience: pTargetAudience
1496
+ language: pLanguage
1558
1497
  });
1559
1498
  }
1560
1499
  }, [preferences]);
@@ -1586,27 +1525,6 @@ function PreferencesPage() {
1586
1525
  if (currentLanguage !== originalValues.language) {
1587
1526
  payload.language = currentLanguage;
1588
1527
  }
1589
- const currentTone = tone == null ? void 0 : tone.value;
1590
- if (currentTone !== originalValues.tone) {
1591
- payload.tone = currentTone;
1592
- }
1593
- const currentStyle = style == null ? void 0 : style.value;
1594
- if (currentStyle !== originalValues.style) {
1595
- payload.style = currentStyle;
1596
- }
1597
- const currentWordCount = wordCount == null ? void 0 : wordCount.value;
1598
- if (currentWordCount !== originalValues.wordCount) {
1599
- payload.wordCount = currentWordCount;
1600
- }
1601
- if (includeQuotes !== originalValues.includeQuotes) {
1602
- payload.includeQuotes = includeQuotes;
1603
- }
1604
- if (includeFAQ !== originalValues.includeFAQ) {
1605
- payload.includeFAQ = includeFAQ;
1606
- }
1607
- if (targetAudience !== originalValues.targetAudience) {
1608
- payload.targetAudience = targetAudience;
1609
- }
1610
1528
  if (Object.keys(payload).length === 0) {
1611
1529
  toast.error("No changes to save");
1612
1530
  setSaving(false);
@@ -1679,150 +1597,6 @@ function PreferencesPage() {
1679
1597
  ] })
1680
1598
  ] })
1681
1599
  ] }),
1682
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
1683
- /* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
1684
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1685
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "State" }),
1686
- /* @__PURE__ */ jsx10(
1687
- ClientSelect_default,
1688
- {
1689
- options: STATE_OPTIONS,
1690
- value: state,
1691
- onChange: (option) => setState(option),
1692
- placeholder: "Select state"
1693
- }
1694
- )
1695
- ] }),
1696
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1697
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Cities" }),
1698
- /* @__PURE__ */ jsx10(
1699
- ClientSelect_default,
1700
- {
1701
- isMulti: true,
1702
- options: CITY_OPTIONS,
1703
- value: cities,
1704
- onChange: (options) => setCities(options),
1705
- placeholder: "Select cities",
1706
- isDisabled: !state
1707
- }
1708
- )
1709
- ] }),
1710
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1711
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Language" }),
1712
- /* @__PURE__ */ jsx10(
1713
- ClientSelect_default,
1714
- {
1715
- options: LANGUAGE_OPTIONS,
1716
- value: language,
1717
- onChange: (option) => setLanguage(option),
1718
- placeholder: "Select language"
1719
- }
1720
- )
1721
- ] })
1722
- ] }),
1723
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
1724
- /* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title", children: "Content Generation Settings" }),
1725
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1726
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Tone" }),
1727
- /* @__PURE__ */ jsx10(
1728
- ClientSelect_default,
1729
- {
1730
- options: TONE_OPTIONS,
1731
- value: tone,
1732
- onChange: (option) => setTone(option),
1733
- placeholder: "Select tone"
1734
- }
1735
- ),
1736
- /* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "The writing tone for generated content" })
1737
- ] }),
1738
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1739
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Style" }),
1740
- /* @__PURE__ */ jsx10(
1741
- ClientSelect_default,
1742
- {
1743
- options: STYLE_OPTIONS,
1744
- value: style,
1745
- onChange: (option) => setStyle(option),
1746
- placeholder: "Select style"
1747
- }
1748
- ),
1749
- /* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "The format/style of generated articles" })
1750
- ] }),
1751
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1752
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Word Count" }),
1753
- /* @__PURE__ */ jsx10(
1754
- ClientSelect_default,
1755
- {
1756
- options: WORD_COUNT_OPTIONS,
1757
- value: wordCount,
1758
- onChange: (option) => setWordCount(option),
1759
- placeholder: "Select word count"
1760
- }
1761
- ),
1762
- /* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "Target length for generated content" })
1763
- ] }),
1764
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1765
- /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Target Audience" }),
1766
- /* @__PURE__ */ jsx10(
1767
- "input",
1768
- {
1769
- value: targetAudience,
1770
- onChange: (e) => setTargetAudience(e.target.value),
1771
- className: "cnfy-dash-input",
1772
- placeholder: "e.g. tech-savvy millennials, business professionals"
1773
- }
1774
- ),
1775
- /* @__PURE__ */ jsx10("p", { className: "cnfy-dash-hint", children: "Describe your target audience for personalized content" })
1776
- ] }),
1777
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-toggle-group", children: [
1778
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-toggle-row", children: [
1779
- /* @__PURE__ */ jsxs7("div", { children: [
1780
- /* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-label", children: "Include Quotes" }),
1781
- /* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-desc", children: "Add relevant quotes to generated articles" })
1782
- ] }),
1783
- /* @__PURE__ */ jsx10(
1784
- "button",
1785
- {
1786
- type: "button",
1787
- role: "switch",
1788
- "aria-checked": includeQuotes,
1789
- onClick: () => setIncludeQuotes(!includeQuotes),
1790
- className: "cnfy-toggle",
1791
- style: { backgroundColor: includeQuotes ? primaryColor : "#d1d5db" },
1792
- children: /* @__PURE__ */ jsx10(
1793
- "span",
1794
- {
1795
- className: `cnfy-toggle-thumb ${includeQuotes ? "cnfy-toggle-thumb--on" : ""}`
1796
- }
1797
- )
1798
- }
1799
- )
1800
- ] }),
1801
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-toggle-row", children: [
1802
- /* @__PURE__ */ jsxs7("div", { children: [
1803
- /* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-label", children: "Include FAQ Section" }),
1804
- /* @__PURE__ */ jsx10("p", { className: "cnfy-toggle-desc", children: "Add FAQ section at the end of articles" })
1805
- ] }),
1806
- /* @__PURE__ */ jsx10(
1807
- "button",
1808
- {
1809
- type: "button",
1810
- role: "switch",
1811
- "aria-checked": includeFAQ,
1812
- onClick: () => setIncludeFAQ(!includeFAQ),
1813
- className: "cnfy-toggle",
1814
- style: { backgroundColor: includeFAQ ? primaryColor : "#d1d5db" },
1815
- children: /* @__PURE__ */ jsx10(
1816
- "span",
1817
- {
1818
- className: `cnfy-toggle-thumb ${includeFAQ ? "cnfy-toggle-thumb--on" : ""}`
1819
- }
1820
- )
1821
- }
1822
- )
1823
- ] })
1824
- ] })
1825
- ] }),
1826
1600
  /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
1827
1601
  /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card-header", children: [
1828
1602
  /* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title-inline", children: "News Scraping" }),
@@ -1860,25 +1634,63 @@ function PreferencesPage() {
1860
1634
  onClick: handleScrape,
1861
1635
  disabled: scraping || (scrapeStatus == null ? void 0 : scrapeStatus.isRunning),
1862
1636
  className: "cnfy-dash-btn-save",
1863
- style: { backgroundColor: primaryColor },
1637
+ style: { backgroundColor: hexToRgba(primaryColor, 0.8) },
1864
1638
  children: scraping ? "Starting Scrape..." : (scrapeStatus == null ? void 0 : scrapeStatus.isRunning) ? "Scraping in Progress..." : "Start Scraping"
1865
1639
  }
1866
1640
  )
1867
1641
  ] })
1868
1642
  ] }),
1869
- /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-actions", children: [
1870
- /* @__PURE__ */ jsx10(
1871
- "button",
1872
- {
1873
- onClick: handleSave,
1874
- disabled: saving,
1875
- className: "cnfy-dash-btn-save",
1876
- style: { backgroundColor: primaryColor },
1877
- children: saving ? "Saving..." : "Save Preferences"
1878
- }
1879
- ),
1880
- success && /* @__PURE__ */ jsx10("p", { className: "cnfy-dash-success", style: { color: primaryColor }, children: "Preferences saved successfully \u2705" })
1881
- ] })
1643
+ /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-card", children: [
1644
+ /* @__PURE__ */ jsx10("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
1645
+ /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1646
+ /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "State" }),
1647
+ /* @__PURE__ */ jsx10(
1648
+ ClientSelect_default,
1649
+ {
1650
+ options: STATE_OPTIONS,
1651
+ value: state,
1652
+ onChange: (option) => setState(option),
1653
+ placeholder: "Select state"
1654
+ }
1655
+ )
1656
+ ] }),
1657
+ /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1658
+ /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Cities" }),
1659
+ /* @__PURE__ */ jsx10(
1660
+ ClientSelect_default,
1661
+ {
1662
+ isMulti: true,
1663
+ options: CITY_OPTIONS,
1664
+ value: cities,
1665
+ onChange: (options) => setCities(options),
1666
+ placeholder: "Select cities",
1667
+ isDisabled: !state
1668
+ }
1669
+ )
1670
+ ] }),
1671
+ /* @__PURE__ */ jsxs7("div", { className: "cnfy-dash-field", children: [
1672
+ /* @__PURE__ */ jsx10("label", { className: "cnfy-dash-label", children: "Language" }),
1673
+ /* @__PURE__ */ jsx10(
1674
+ ClientSelect_default,
1675
+ {
1676
+ options: LANGUAGE_OPTIONS,
1677
+ value: language,
1678
+ onChange: (option) => setLanguage(option),
1679
+ placeholder: "Select language"
1680
+ }
1681
+ )
1682
+ ] })
1683
+ ] }),
1684
+ /* @__PURE__ */ jsx10("div", { className: "cnfy-dash-actions", children: /* @__PURE__ */ jsx10(
1685
+ "button",
1686
+ {
1687
+ onClick: handleSave,
1688
+ disabled: saving,
1689
+ className: "cnfy-dash-btn-save",
1690
+ style: { backgroundColor: primaryColor },
1691
+ children: saving ? "Saving..." : "Save Preferences"
1692
+ }
1693
+ ) })
1882
1694
  ] });
1883
1695
  }
1884
1696
 
@@ -1996,19 +1808,16 @@ var rewriteNewsStreamApi = async ({
1996
1808
  try {
1997
1809
  const API_BASE_URL = getApiBaseUrl();
1998
1810
  const apiKey = getApiKey();
1999
- console.log("\u{1F680} Starting stream request to:", `${API_BASE_URL}/chat/rewrite/stream`);
2000
- console.log("\u{1F4E6} Payload:", payload);
2001
1811
  const headers = {
2002
1812
  "Content-Type": "application/json"
2003
1813
  };
2004
1814
  if (apiKey) {
2005
1815
  headers["x-api-key"] = apiKey;
2006
1816
  }
2007
- const response = await fetch(`${API_BASE_URL}/chat/rewrite/stream`, {
1817
+ const response = await fetch(`${API_BASE_URL}/chatboat/rewrite/stream`, {
2008
1818
  method: "POST",
2009
1819
  headers,
2010
1820
  credentials: "include",
2011
- // Include cookies for authentication
2012
1821
  body: JSON.stringify(payload)
2013
1822
  });
2014
1823
  console.log("\u{1F4E1} Response status:", response.status);
@@ -2127,7 +1936,7 @@ var rewriteNewsApi = async ({
2127
1936
  import toast2 from "react-hot-toast";
2128
1937
  import { Loader2 } from "lucide-react";
2129
1938
  import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
2130
- function ChatBot() {
1939
+ function ChatBot({ onPost }) {
2131
1940
  const { loading } = useTheme();
2132
1941
  const { preferences } = usePreferences();
2133
1942
  const [preferencesOpen, setPreferencesOpen] = useState7(false);
@@ -2411,7 +2220,8 @@ ${optionsList}`
2411
2220
  onSelectNews: handleRecreate,
2412
2221
  isStreaming,
2413
2222
  analyzedData,
2414
- onSelectAction: handleSelectAction
2223
+ onSelectAction: handleSelectAction,
2224
+ onPost
2415
2225
  }
2416
2226
  ) }),
2417
2227
  !messages.length && /* @__PURE__ */ jsx11("div", { className: "cnfy-empty-state", children: /* @__PURE__ */ jsxs8("div", { children: [
@@ -2433,11 +2243,11 @@ ${optionsList}`
2433
2243
 
2434
2244
  // src/index.tsx
2435
2245
  import { jsx as jsx12 } from "react/jsx-runtime";
2436
- function ContenifyChatBot({ apiUrl, apiKey, domain }) {
2246
+ function ContenifyChatBot({ apiUrl, apiKey, domain, onPost }) {
2437
2247
  useEffect8(() => {
2438
2248
  setConfig({ apiUrl, apiKey, domain });
2439
2249
  }, [apiUrl, apiKey, domain]);
2440
- return /* @__PURE__ */ jsx12(PreferencesProvider, { children: /* @__PURE__ */ jsx12(ChatBot, {}) });
2250
+ return /* @__PURE__ */ jsx12(PreferencesProvider, { children: /* @__PURE__ */ jsx12(ChatBot, { onPost }) });
2441
2251
  }
2442
2252
  var index_default = ContenifyChatBot;
2443
2253
  export {