@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.js CHANGED
@@ -110,7 +110,7 @@ var api_default = api;
110
110
 
111
111
  // services/preferences.service.ts
112
112
  var getMyPreferencesApi = async () => {
113
- const { data } = await api_default.get("/preferences/me");
113
+ const { data } = await api_default.get("/chatboat/preferences/me");
114
114
  return data.data;
115
115
  };
116
116
  var savePreferencesApi = async ({
@@ -188,7 +188,7 @@ var savePreferencesApi = async ({
188
188
  if (targetAudience !== void 0) {
189
189
  formData.append("targetAudience", targetAudience);
190
190
  }
191
- const { data } = await api_default.put("/preferences", formData, {
191
+ const { data } = await api_default.put("/chatboat/preferences", formData, {
192
192
  headers: {
193
193
  "Content-Type": "multipart/form-data"
194
194
  }
@@ -325,6 +325,13 @@ function extractArticleContent(raw) {
325
325
  };
326
326
  }
327
327
  }
328
+ var hexToRgba = (hex, opacity) => {
329
+ const sanitizedHex = hex.replace("#", "");
330
+ const r = parseInt(sanitizedHex.substring(0, 2), 16);
331
+ const g = parseInt(sanitizedHex.substring(2, 4), 16);
332
+ const b = parseInt(sanitizedHex.substring(4, 6), 16);
333
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
334
+ };
328
335
 
329
336
  // components/chatbot/ChatWindow.tsx
330
337
  var import_lucide_react4 = require("lucide-react");
@@ -842,19 +849,19 @@ function NewsList({
842
849
 
843
850
  // services/news.service.ts
844
851
  var getTrendingNews = async () => {
845
- const { data } = await api_default.get("/news/trending");
852
+ const { data } = await api_default.get("/chatboat/trending");
846
853
  return data.data;
847
854
  };
848
855
  var getNewsSources = async () => {
849
- const { data } = await api_default.get("/news/sources");
856
+ const { data } = await api_default.get("/chatboat/scrape/sources");
850
857
  return data.data;
851
858
  };
852
859
  var scrapeNewsSource = async (sourceId) => {
853
- const { data } = await api_default.post("/news/scrape-source", { sourceId });
860
+ const { data } = await api_default.post("/chatboat/scrape/source", { sourceId });
854
861
  return data.data;
855
862
  };
856
863
  var getNewsBySource = async (sourceId) => {
857
- const { data } = await api_default.get(`/news/by-source/${sourceId}`);
864
+ const { data } = await api_default.get(`/chatboat/scrape/by-source/${sourceId}`);
858
865
  return data.data;
859
866
  };
860
867
 
@@ -875,7 +882,8 @@ function ChatWindow({
875
882
  onSelectNews,
876
883
  isStreaming = false,
877
884
  analyzedData,
878
- onSelectAction
885
+ onSelectAction,
886
+ onPost: onPostCallback
879
887
  }) {
880
888
  var _a, _b;
881
889
  const { loading, showNewsPanel } = useTheme();
@@ -924,7 +932,7 @@ function ChatWindow({
924
932
  handleCloseModal();
925
933
  };
926
934
  const handlePost = (content, keywords) => {
927
- console.log("Posting:", { content, keywords });
935
+ onPostCallback == null ? void 0 : onPostCallback(content, keywords);
928
936
  handleCloseModal();
929
937
  };
930
938
  (0, import_react6.useLayoutEffect)(() => {
@@ -988,7 +996,6 @@ function ChatWindow({
988
996
  const handleSourceSelect = (option) => {
989
997
  var _a2;
990
998
  const sourceId = (_a2 = option == null ? void 0 : option.value) != null ? _a2 : null;
991
- console.log("Selected source:", option);
992
999
  setSelectedSource(sourceId);
993
1000
  fetchNews(sourceId);
994
1001
  };
@@ -1041,103 +1048,91 @@ function ChatWindow({
1041
1048
  messages.map((msg) => {
1042
1049
  var _a2;
1043
1050
  const parsed = formatAIContent(msg.content);
1044
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-msg", children: [
1045
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-avatar-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1046
- "div",
1051
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: msg.role === "assistant" ? `cnfy-msg-body` : `cnfy-msg-body you`, children: [
1052
+ msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1053
+ "button",
1047
1054
  {
1048
- className: "cnfy-msg-avatar",
1049
- style: {
1050
- backgroundColor: msg.role === "assistant" ? primaryColor : "#1f2937"
1051
- },
1052
- children: msg.role === "assistant" ? "AI" : "You"
1055
+ onClick: () => handleCopy(parsed.blocks, msg.id),
1056
+ className: "cnfy-copy-btn",
1057
+ title: "Copy to clipboard",
1058
+ children: copiedId === msg.id ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Copy, { size: 16 })
1053
1059
  }
1054
1060
  ) }),
1055
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "cnfy-msg-body", children: [
1056
- msg.role === "assistant" && parsed.blocks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-copy-row", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1061
+ parsed.blocks.map((block, idx) => {
1062
+ if (block.type === "h1") {
1063
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1064
+ "h1",
1065
+ {
1066
+ className: "cnfy-block-h1",
1067
+ children: block.text
1068
+ },
1069
+ idx
1070
+ );
1071
+ }
1072
+ if (block.type === "h2") {
1073
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1074
+ "h2",
1075
+ {
1076
+ className: "cnfy-block-h2",
1077
+ children: block.text
1078
+ },
1079
+ idx
1080
+ );
1081
+ }
1082
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "cnfy-block-p", children: block.text }, idx);
1083
+ }),
1084
+ parsed.metaKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1085
+ "span",
1086
+ {
1087
+ className: "cnfy-msg-keyword-tag",
1088
+ children: [
1089
+ "#",
1090
+ tag
1091
+ ]
1092
+ },
1093
+ i
1094
+ )) }) }),
1095
+ msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
1096
+ const IconComponent = ACTION_ICONS[option.id] || import_lucide_react4.FileText;
1097
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1057
1098
  "button",
1058
1099
  {
1059
- onClick: () => handleCopy(parsed.blocks, msg.id),
1060
- className: "cnfy-copy-btn",
1061
- title: "Copy to clipboard",
1062
- children: copiedId === msg.id ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Check, { size: 16, className: "cnfy-copy-icon--copied" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Copy, { size: 16 })
1063
- }
1064
- ) }),
1065
- parsed.blocks.map((block, idx) => {
1066
- if (block.type === "h1") {
1067
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1068
- "h1",
1069
- {
1070
- className: "cnfy-block-h1",
1071
- children: block.text
1072
- },
1073
- idx
1074
- );
1075
- }
1076
- if (block.type === "h2") {
1077
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1078
- "h2",
1079
- {
1080
- className: "cnfy-block-h2",
1081
- children: block.text
1082
- },
1083
- idx
1084
- );
1100
+ onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
1101
+ className: "cnfy-action-btn",
1102
+ children: [
1103
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconComponent, { size: 16 }),
1104
+ option.name
1105
+ ]
1106
+ },
1107
+ option.id
1108
+ );
1109
+ }) }),
1110
+ 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_runtime5.jsxs)("div", { className: "cnfy-msg-actions", children: [
1111
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1112
+ "button",
1113
+ {
1114
+ onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
1115
+ className: "cnfy-btn-edit",
1116
+ children: [
1117
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Edit3, { size: 16 }),
1118
+ "Edit"
1119
+ ]
1085
1120
  }
1086
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "cnfy-block-p", children: block.text }, idx);
1087
- }),
1088
- parsed.metaKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-keywords", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-msg-keywords-list", children: parsed.metaKeywords.map((tag, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1089
- "span",
1121
+ ),
1122
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1123
+ "button",
1090
1124
  {
1091
- className: "cnfy-msg-keyword-tag",
1125
+ onClick: () => handlePost(msg.content, parsed.metaKeywords),
1126
+ className: "cnfy-btn-post",
1127
+ style: { backgroundColor: primaryColor, color: "#fff" },
1092
1128
  children: [
1093
- "#",
1094
- tag
1129
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Send, { size: 16 }),
1130
+ "Post"
1095
1131
  ]
1096
- },
1097
- i
1098
- )) }) }),
1099
- msg.role === "assistant" && (analyzedData == null ? void 0 : analyzedData.messageId) === msg.id && analyzedData.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cnfy-action-options", children: analyzedData.options.map((option) => {
1100
- const IconComponent = ACTION_ICONS[option.id] || import_lucide_react4.FileText;
1101
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1102
- "button",
1103
- {
1104
- onClick: () => onSelectAction == null ? void 0 : onSelectAction(option.id, analyzedData.url, analyzedData.content),
1105
- className: "cnfy-action-btn",
1106
- children: [
1107
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconComponent, { size: 16 }),
1108
- option.name
1109
- ]
1110
- },
1111
- option.id
1112
- );
1113
- }) }),
1114
- 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_runtime5.jsxs)("div", { className: "cnfy-msg-actions", children: [
1115
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1116
- "button",
1117
- {
1118
- onClick: () => handleEdit(parsed.blocks, parsed.metaKeywords, msg.id),
1119
- className: "cnfy-btn-edit",
1120
- children: [
1121
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Edit3, { size: 16 }),
1122
- "Edit"
1123
- ]
1124
- }
1125
- ),
1126
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1127
- "button",
1128
- {
1129
- onClick: () => handlePost(msg.content, parsed.metaKeywords),
1130
- className: "cnfy-btn-post",
1131
- style: { backgroundColor: primaryColor, color: "#fff" },
1132
- children: [
1133
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react4.Send, { size: 16 }),
1134
- "Post"
1135
- ]
1136
- }
1137
- )
1138
- ] })
1132
+ }
1133
+ )
1139
1134
  ] })
1140
- ] }, msg.id);
1135
+ ] }) }, msg.id);
1141
1136
  }),
1142
1137
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: bottomRef })
1143
1138
  ] }) }),
@@ -1377,14 +1372,14 @@ var triggerScrape = async ({
1377
1372
  state,
1378
1373
  cities
1379
1374
  }) => {
1380
- const { data } = await api_default.post("/scrape/trigger", {
1375
+ const { data } = await api_default.post("/chatboat/scrape/trigger", {
1381
1376
  state,
1382
1377
  cities
1383
1378
  });
1384
1379
  return data;
1385
1380
  };
1386
1381
  var getScrapeStatus = async () => {
1387
- const { data } = await api_default.get("/scrape/status");
1382
+ const { data } = await api_default.get("/chatboat/scrape/status");
1388
1383
  return data.data;
1389
1384
  };
1390
1385
 
@@ -1440,23 +1435,6 @@ var LANGUAGE_OPTIONS = [
1440
1435
  { value: "en", label: "English" },
1441
1436
  { value: "hi", label: "Hindi" }
1442
1437
  ];
1443
- var TONE_OPTIONS = [
1444
- { value: "formal", label: "Formal" },
1445
- { value: "casual", label: "Casual" },
1446
- { value: "engaging", label: "Engaging" },
1447
- { value: "professional", label: "Professional" }
1448
- ];
1449
- var STYLE_OPTIONS = [
1450
- { value: "news", label: "News Article" },
1451
- { value: "blog", label: "Blog Post" },
1452
- { value: "editorial", label: "Editorial" },
1453
- { value: "summary", label: "Summary" }
1454
- ];
1455
- var WORD_COUNT_OPTIONS = [
1456
- { value: "short", label: "Short (~300 words)" },
1457
- { value: "medium", label: "Medium (~600 words)" },
1458
- { value: "long", label: "Long (~1000+ words)" }
1459
- ];
1460
1438
  function PreferencesPage() {
1461
1439
  var _a, _b, _c;
1462
1440
  const { preferences, loading, refreshPreferences, updatePreferences } = usePreferences();
@@ -1467,12 +1445,6 @@ function PreferencesPage() {
1467
1445
  const [state, setState] = (0, import_react9.useState)(null);
1468
1446
  const [cities, setCities] = (0, import_react9.useState)([]);
1469
1447
  const [language, setLanguage] = (0, import_react9.useState)(null);
1470
- const [tone, setTone] = (0, import_react9.useState)(null);
1471
- const [style, setStyle] = (0, import_react9.useState)(null);
1472
- const [wordCount, setWordCount] = (0, import_react9.useState)(null);
1473
- const [includeQuotes, setIncludeQuotes] = (0, import_react9.useState)(true);
1474
- const [includeFAQ, setIncludeFAQ] = (0, import_react9.useState)(false);
1475
- const [targetAudience, setTargetAudience] = (0, import_react9.useState)("");
1476
1448
  const [saving, setSaving] = (0, import_react9.useState)(false);
1477
1449
  const [success, setSuccess] = (0, import_react9.useState)(false);
1478
1450
  const [scraping, setScraping] = (0, import_react9.useState)(false);
@@ -1482,13 +1454,7 @@ function PreferencesPage() {
1482
1454
  botName: "",
1483
1455
  state: void 0,
1484
1456
  cities: [],
1485
- language: void 0,
1486
- tone: void 0,
1487
- style: void 0,
1488
- wordCount: void 0,
1489
- includeQuotes: true,
1490
- includeFAQ: false,
1491
- targetAudience: ""
1457
+ language: void 0
1492
1458
  });
1493
1459
  (0, import_react9.useEffect)(() => {
1494
1460
  const fetchScrapeStatus = async () => {
@@ -1528,7 +1494,7 @@ function PreferencesPage() {
1528
1494
  }
1529
1495
  };
1530
1496
  (0, import_react9.useEffect)(() => {
1531
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1497
+ var _a2, _b2, _c2, _d, _e;
1532
1498
  if (preferences) {
1533
1499
  const name = ((_a2 = preferences.chatbot) == null ? void 0 : _a2.name) || "";
1534
1500
  const pState = (_b2 = preferences.localization) == null ? void 0 : _b2.state;
@@ -1546,38 +1512,11 @@ function PreferencesPage() {
1546
1512
  const langOption = LANGUAGE_OPTIONS.find((opt) => opt.value === pLanguage);
1547
1513
  setLanguage(langOption || null);
1548
1514
  }
1549
- const pTone = (_f = preferences.content) == null ? void 0 : _f.tone;
1550
- const pStyle = (_g = preferences.content) == null ? void 0 : _g.style;
1551
- const pWordCount = (_h = preferences.content) == null ? void 0 : _h.wordCount;
1552
- const pIncludeQuotes = (_j = (_i = preferences.content) == null ? void 0 : _i.includeQuotes) != null ? _j : true;
1553
- const pIncludeFAQ = (_l = (_k = preferences.content) == null ? void 0 : _k.includeFAQ) != null ? _l : false;
1554
- const pTargetAudience = ((_m = preferences.content) == null ? void 0 : _m.targetAudience) || "";
1555
- if (pTone) {
1556
- const toneOption = TONE_OPTIONS.find((opt) => opt.value === pTone);
1557
- setTone(toneOption || null);
1558
- }
1559
- if (pStyle) {
1560
- const styleOption = STYLE_OPTIONS.find((opt) => opt.value === pStyle);
1561
- setStyle(styleOption || null);
1562
- }
1563
- if (pWordCount) {
1564
- const wordCountOption = WORD_COUNT_OPTIONS.find((opt) => opt.value === pWordCount);
1565
- setWordCount(wordCountOption || null);
1566
- }
1567
- setIncludeQuotes(pIncludeQuotes);
1568
- setIncludeFAQ(pIncludeFAQ);
1569
- setTargetAudience(pTargetAudience);
1570
1515
  setOriginalValues({
1571
1516
  botName: name,
1572
1517
  state: pState,
1573
1518
  cities: pCities,
1574
- language: pLanguage,
1575
- tone: pTone,
1576
- style: pStyle,
1577
- wordCount: pWordCount,
1578
- includeQuotes: pIncludeQuotes,
1579
- includeFAQ: pIncludeFAQ,
1580
- targetAudience: pTargetAudience
1519
+ language: pLanguage
1581
1520
  });
1582
1521
  }
1583
1522
  }, [preferences]);
@@ -1609,27 +1548,6 @@ function PreferencesPage() {
1609
1548
  if (currentLanguage !== originalValues.language) {
1610
1549
  payload.language = currentLanguage;
1611
1550
  }
1612
- const currentTone = tone == null ? void 0 : tone.value;
1613
- if (currentTone !== originalValues.tone) {
1614
- payload.tone = currentTone;
1615
- }
1616
- const currentStyle = style == null ? void 0 : style.value;
1617
- if (currentStyle !== originalValues.style) {
1618
- payload.style = currentStyle;
1619
- }
1620
- const currentWordCount = wordCount == null ? void 0 : wordCount.value;
1621
- if (currentWordCount !== originalValues.wordCount) {
1622
- payload.wordCount = currentWordCount;
1623
- }
1624
- if (includeQuotes !== originalValues.includeQuotes) {
1625
- payload.includeQuotes = includeQuotes;
1626
- }
1627
- if (includeFAQ !== originalValues.includeFAQ) {
1628
- payload.includeFAQ = includeFAQ;
1629
- }
1630
- if (targetAudience !== originalValues.targetAudience) {
1631
- payload.targetAudience = targetAudience;
1632
- }
1633
1551
  if (Object.keys(payload).length === 0) {
1634
1552
  import_react_hot_toast.default.error("No changes to save");
1635
1553
  setSaving(false);
@@ -1702,150 +1620,6 @@ function PreferencesPage() {
1702
1620
  ] })
1703
1621
  ] })
1704
1622
  ] }),
1705
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
1706
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
1707
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1708
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "State" }),
1709
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1710
- ClientSelect_default,
1711
- {
1712
- options: STATE_OPTIONS,
1713
- value: state,
1714
- onChange: (option) => setState(option),
1715
- placeholder: "Select state"
1716
- }
1717
- )
1718
- ] }),
1719
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1720
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Cities" }),
1721
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1722
- ClientSelect_default,
1723
- {
1724
- isMulti: true,
1725
- options: CITY_OPTIONS,
1726
- value: cities,
1727
- onChange: (options) => setCities(options),
1728
- placeholder: "Select cities",
1729
- isDisabled: !state
1730
- }
1731
- )
1732
- ] }),
1733
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1734
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Language" }),
1735
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1736
- ClientSelect_default,
1737
- {
1738
- options: LANGUAGE_OPTIONS,
1739
- value: language,
1740
- onChange: (option) => setLanguage(option),
1741
- placeholder: "Select language"
1742
- }
1743
- )
1744
- ] })
1745
- ] }),
1746
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
1747
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title", children: "Content Generation Settings" }),
1748
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1749
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Tone" }),
1750
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1751
- ClientSelect_default,
1752
- {
1753
- options: TONE_OPTIONS,
1754
- value: tone,
1755
- onChange: (option) => setTone(option),
1756
- placeholder: "Select tone"
1757
- }
1758
- ),
1759
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "The writing tone for generated content" })
1760
- ] }),
1761
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1762
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Style" }),
1763
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1764
- ClientSelect_default,
1765
- {
1766
- options: STYLE_OPTIONS,
1767
- value: style,
1768
- onChange: (option) => setStyle(option),
1769
- placeholder: "Select style"
1770
- }
1771
- ),
1772
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "The format/style of generated articles" })
1773
- ] }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1775
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Word Count" }),
1776
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1777
- ClientSelect_default,
1778
- {
1779
- options: WORD_COUNT_OPTIONS,
1780
- value: wordCount,
1781
- onChange: (option) => setWordCount(option),
1782
- placeholder: "Select word count"
1783
- }
1784
- ),
1785
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "Target length for generated content" })
1786
- ] }),
1787
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1788
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Target Audience" }),
1789
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1790
- "input",
1791
- {
1792
- value: targetAudience,
1793
- onChange: (e) => setTargetAudience(e.target.value),
1794
- className: "cnfy-dash-input",
1795
- placeholder: "e.g. tech-savvy millennials, business professionals"
1796
- }
1797
- ),
1798
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-hint", children: "Describe your target audience for personalized content" })
1799
- ] }),
1800
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-toggle-group", children: [
1801
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-toggle-row", children: [
1802
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
1803
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-label", children: "Include Quotes" }),
1804
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-desc", children: "Add relevant quotes to generated articles" })
1805
- ] }),
1806
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1807
- "button",
1808
- {
1809
- type: "button",
1810
- role: "switch",
1811
- "aria-checked": includeQuotes,
1812
- onClick: () => setIncludeQuotes(!includeQuotes),
1813
- className: "cnfy-toggle",
1814
- style: { backgroundColor: includeQuotes ? primaryColor : "#d1d5db" },
1815
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1816
- "span",
1817
- {
1818
- className: `cnfy-toggle-thumb ${includeQuotes ? "cnfy-toggle-thumb--on" : ""}`
1819
- }
1820
- )
1821
- }
1822
- )
1823
- ] }),
1824
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-toggle-row", children: [
1825
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
1826
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-label", children: "Include FAQ Section" }),
1827
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-toggle-desc", children: "Add FAQ section at the end of articles" })
1828
- ] }),
1829
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1830
- "button",
1831
- {
1832
- type: "button",
1833
- role: "switch",
1834
- "aria-checked": includeFAQ,
1835
- onClick: () => setIncludeFAQ(!includeFAQ),
1836
- className: "cnfy-toggle",
1837
- style: { backgroundColor: includeFAQ ? primaryColor : "#d1d5db" },
1838
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1839
- "span",
1840
- {
1841
- className: `cnfy-toggle-thumb ${includeFAQ ? "cnfy-toggle-thumb--on" : ""}`
1842
- }
1843
- )
1844
- }
1845
- )
1846
- ] })
1847
- ] })
1848
- ] }),
1849
1623
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
1850
1624
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card-header", children: [
1851
1625
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title-inline", children: "News Scraping" }),
@@ -1883,25 +1657,63 @@ function PreferencesPage() {
1883
1657
  onClick: handleScrape,
1884
1658
  disabled: scraping || (scrapeStatus == null ? void 0 : scrapeStatus.isRunning),
1885
1659
  className: "cnfy-dash-btn-save",
1886
- style: { backgroundColor: primaryColor },
1660
+ style: { backgroundColor: hexToRgba(primaryColor, 0.8) },
1887
1661
  children: scraping ? "Starting Scrape..." : (scrapeStatus == null ? void 0 : scrapeStatus.isRunning) ? "Scraping in Progress..." : "Start Scraping"
1888
1662
  }
1889
1663
  )
1890
1664
  ] })
1891
1665
  ] }),
1892
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-actions", children: [
1893
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1894
- "button",
1895
- {
1896
- onClick: handleSave,
1897
- disabled: saving,
1898
- className: "cnfy-dash-btn-save",
1899
- style: { backgroundColor: primaryColor },
1900
- children: saving ? "Saving..." : "Save Preferences"
1901
- }
1902
- ),
1903
- success && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "cnfy-dash-success", style: { color: primaryColor }, children: "Preferences saved successfully \u2705" })
1904
- ] })
1666
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-card", children: [
1667
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "cnfy-dash-card-title", children: "Localization Settings" }),
1668
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1669
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "State" }),
1670
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1671
+ ClientSelect_default,
1672
+ {
1673
+ options: STATE_OPTIONS,
1674
+ value: state,
1675
+ onChange: (option) => setState(option),
1676
+ placeholder: "Select state"
1677
+ }
1678
+ )
1679
+ ] }),
1680
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1681
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Cities" }),
1682
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1683
+ ClientSelect_default,
1684
+ {
1685
+ isMulti: true,
1686
+ options: CITY_OPTIONS,
1687
+ value: cities,
1688
+ onChange: (options) => setCities(options),
1689
+ placeholder: "Select cities",
1690
+ isDisabled: !state
1691
+ }
1692
+ )
1693
+ ] }),
1694
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "cnfy-dash-field", children: [
1695
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: "cnfy-dash-label", children: "Language" }),
1696
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1697
+ ClientSelect_default,
1698
+ {
1699
+ options: LANGUAGE_OPTIONS,
1700
+ value: language,
1701
+ onChange: (option) => setLanguage(option),
1702
+ placeholder: "Select language"
1703
+ }
1704
+ )
1705
+ ] })
1706
+ ] }),
1707
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "cnfy-dash-actions", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1708
+ "button",
1709
+ {
1710
+ onClick: handleSave,
1711
+ disabled: saving,
1712
+ className: "cnfy-dash-btn-save",
1713
+ style: { backgroundColor: primaryColor },
1714
+ children: saving ? "Saving..." : "Save Preferences"
1715
+ }
1716
+ ) })
1905
1717
  ] });
1906
1718
  }
1907
1719
 
@@ -2019,19 +1831,16 @@ var rewriteNewsStreamApi = async ({
2019
1831
  try {
2020
1832
  const API_BASE_URL = getApiBaseUrl();
2021
1833
  const apiKey = getApiKey();
2022
- console.log("\u{1F680} Starting stream request to:", `${API_BASE_URL}/chat/rewrite/stream`);
2023
- console.log("\u{1F4E6} Payload:", payload);
2024
1834
  const headers = {
2025
1835
  "Content-Type": "application/json"
2026
1836
  };
2027
1837
  if (apiKey) {
2028
1838
  headers["x-api-key"] = apiKey;
2029
1839
  }
2030
- const response = await fetch(`${API_BASE_URL}/chat/rewrite/stream`, {
1840
+ const response = await fetch(`${API_BASE_URL}/chatboat/rewrite/stream`, {
2031
1841
  method: "POST",
2032
1842
  headers,
2033
1843
  credentials: "include",
2034
- // Include cookies for authentication
2035
1844
  body: JSON.stringify(payload)
2036
1845
  });
2037
1846
  console.log("\u{1F4E1} Response status:", response.status);
@@ -2150,7 +1959,7 @@ var rewriteNewsApi = async ({
2150
1959
  var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
2151
1960
  var import_lucide_react7 = require("lucide-react");
2152
1961
  var import_jsx_runtime11 = require("react/jsx-runtime");
2153
- function ChatBot() {
1962
+ function ChatBot({ onPost }) {
2154
1963
  const { loading } = useTheme();
2155
1964
  const { preferences } = usePreferences();
2156
1965
  const [preferencesOpen, setPreferencesOpen] = (0, import_react10.useState)(false);
@@ -2434,7 +2243,8 @@ ${optionsList}`
2434
2243
  onSelectNews: handleRecreate,
2435
2244
  isStreaming,
2436
2245
  analyzedData,
2437
- onSelectAction: handleSelectAction
2246
+ onSelectAction: handleSelectAction,
2247
+ onPost
2438
2248
  }
2439
2249
  ) }),
2440
2250
  !messages.length && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "cnfy-empty-state", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
@@ -2456,11 +2266,11 @@ ${optionsList}`
2456
2266
 
2457
2267
  // src/index.tsx
2458
2268
  var import_jsx_runtime12 = require("react/jsx-runtime");
2459
- function ContenifyChatBot({ apiUrl, apiKey, domain }) {
2269
+ function ContenifyChatBot({ apiUrl, apiKey, domain, onPost }) {
2460
2270
  (0, import_react11.useEffect)(() => {
2461
2271
  setConfig({ apiUrl, apiKey, domain });
2462
2272
  }, [apiUrl, apiKey, domain]);
2463
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PreferencesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChatBot, {}) });
2273
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PreferencesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChatBot, { onPost }) });
2464
2274
  }
2465
2275
  var index_default = ContenifyChatBot;
2466
2276
  // Annotate the CommonJS export names for ESM import in node: