aizek-chatbot 1.0.7 → 1.0.9
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.cjs +398 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +398 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,25 @@ import remarkGfm from 'remark-gfm';
|
|
|
9
9
|
function cx(...args) {
|
|
10
10
|
return args.filter(Boolean).join(" ");
|
|
11
11
|
}
|
|
12
|
+
function validateHeaders(headers, authConfig, opts = {}) {
|
|
13
|
+
const { caseSensitive = false, allowExtra = false } = opts;
|
|
14
|
+
const normalize = (s) => caseSensitive ? s : s.toLowerCase();
|
|
15
|
+
const headerEntries = Object.entries(headers).map(([k, v]) => [normalize(k), v.trim()]);
|
|
16
|
+
const authEntries = Object.entries(authConfig).map(([k, v]) => [normalize(k), v.trim()]);
|
|
17
|
+
const headerKeys = headerEntries.map(([k]) => k);
|
|
18
|
+
const authKeys = authEntries.map(([k]) => k);
|
|
19
|
+
const requiredSet = new Set(authKeys);
|
|
20
|
+
const missingKeys = authKeys.filter((k) => !headerKeys.includes(k));
|
|
21
|
+
const extraKeys = headerKeys.filter((k) => !requiredSet.has(k));
|
|
22
|
+
const hasAllRequired = missingKeys.length === 0;
|
|
23
|
+
const hasExtraKeys = extraKeys.length > 0 && !allowExtra;
|
|
24
|
+
const emptyValueKeys = authKeys.filter((k) => {
|
|
25
|
+
const val = headerEntries.find(([key]) => key === k)?.[1];
|
|
26
|
+
return !val || val.length === 0;
|
|
27
|
+
});
|
|
28
|
+
const isValid = hasAllRequired && !hasExtraKeys && emptyValueKeys.length === 0;
|
|
29
|
+
return { isValid, missingKeys, extraKeys, emptyValueKeys };
|
|
30
|
+
}
|
|
12
31
|
var base = {
|
|
13
32
|
display: "inline-flex",
|
|
14
33
|
alignItems: "center",
|
|
@@ -78,7 +97,7 @@ var Button = React.forwardRef(
|
|
|
78
97
|
);
|
|
79
98
|
Button.displayName = "Button";
|
|
80
99
|
var useChatbot = (options = {}) => {
|
|
81
|
-
const { mcpUrl, apiKey } = options;
|
|
100
|
+
const { mcpUrl, apiKey, config } = options;
|
|
82
101
|
const client = new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
83
102
|
const [responseId, setResponseId] = useState(null);
|
|
84
103
|
const [messages, setMessages] = useState([]);
|
|
@@ -96,10 +115,168 @@ var useChatbot = (options = {}) => {
|
|
|
96
115
|
setMessages((prev) => [...prev, newMessage]);
|
|
97
116
|
return newMessage;
|
|
98
117
|
};
|
|
118
|
+
const getHtmlUiInstructions = (config2) => {
|
|
119
|
+
const headerColor = config2?.headerBackground || "#f5f5f5";
|
|
120
|
+
const accentColor = config2?.buttonBackground || "#007bff";
|
|
121
|
+
const companyName = config2?.companyName || "AI Assistant";
|
|
122
|
+
const companyLogo = config2?.companyLogo || "\u{1F916}";
|
|
123
|
+
return `
|
|
124
|
+
You are a helpful assistant that creates UI using ONLY HTML tags.
|
|
125
|
+
|
|
126
|
+
Your task:
|
|
127
|
+
- Read the user message and respond.
|
|
128
|
+
- Render your response as a small HTML layout (card OR table OR mini-table).
|
|
129
|
+
- Use inline CSS styles.
|
|
130
|
+
- Use a clean, light (white-based) theme.
|
|
131
|
+
- Use branding and colors from options.config.
|
|
132
|
+
- Return ONLY raw HTML (no markdown, no backticks, no JSON, no explanations).
|
|
133
|
+
|
|
134
|
+
====================
|
|
135
|
+
THEME & BRANDING (from options.config)
|
|
136
|
+
====================
|
|
137
|
+
The chat widget configuration provides:
|
|
138
|
+
|
|
139
|
+
- Header Background Color: ${headerColor}
|
|
140
|
+
- Button / Accent Color: ${accentColor}
|
|
141
|
+
- Company Name: ${companyName}
|
|
142
|
+
- Company Logo: ${companyLogo}
|
|
143
|
+
|
|
144
|
+
How to use these:
|
|
145
|
+
- Use Header Background Color mainly for top headers, title strips, or main highlight areas.
|
|
146
|
+
- Use Button / Accent Color for important accents: borders, highlights, small badges, table headers, key text highlights, links, etc.
|
|
147
|
+
- Use a white or very light background for main surfaces.
|
|
148
|
+
- Text color should generally be dark (#111\u2013#333) for readability.
|
|
149
|
+
|
|
150
|
+
Do NOT create real interactive buttons. You can visually style elements using the accent color, but you must NOT use <button>.
|
|
151
|
+
|
|
152
|
+
====================
|
|
153
|
+
ALLOWED / FORBIDDEN TAGS
|
|
154
|
+
====================
|
|
155
|
+
You may use ANY NON-INTERACTIVE HTML element, for example:
|
|
156
|
+
- Text and headings:
|
|
157
|
+
<h1>, <h2>, <h3>, <h4>, <h5>, <h6>,
|
|
158
|
+
<p>, <span>, <strong>, <em>, <small>, <blockquote>, <code>, <pre>
|
|
159
|
+
- Layout:
|
|
160
|
+
<div>, <section>, <article>, <header>, <footer>
|
|
161
|
+
- Lists:
|
|
162
|
+
<ul>, <ol>, <li>
|
|
163
|
+
- Tables:
|
|
164
|
+
<table>, <thead>, <tbody>, <tr>, <th>, <td>
|
|
165
|
+
- Media:
|
|
166
|
+
<img>, <figure>, <figcaption>
|
|
167
|
+
- Links (non-interactive navigation style only):
|
|
168
|
+
<a>
|
|
169
|
+
|
|
170
|
+
FORBIDDEN (NEVER USE):
|
|
171
|
+
- <button>, <input>, <textarea>, <select>, <option>, <form>, <label>
|
|
172
|
+
- <details>, <summary>, <dialog>
|
|
173
|
+
- <video> or <audio> with controls for user interaction
|
|
174
|
+
- Any inline event handlers like onclick, onmouseover, etc.
|
|
175
|
+
- <script> or any JavaScript code.
|
|
176
|
+
|
|
177
|
+
====================
|
|
178
|
+
LAYOUT TYPE RULES
|
|
179
|
+
====================
|
|
180
|
+
You have exactly THREE layout types you can use:
|
|
181
|
+
|
|
182
|
+
1) CARD
|
|
183
|
+
2) TABLE
|
|
184
|
+
3) MINI TABLE
|
|
185
|
+
|
|
186
|
+
For EACH response:
|
|
187
|
+
- You MUST choose exactly ONE of these layout types.
|
|
188
|
+
- You MUST NOT mix layout types in the same response.
|
|
189
|
+
(Do NOT render card + table together, or table + mini-table together.)
|
|
190
|
+
|
|
191
|
+
Which layout to choose:
|
|
192
|
+
- CARD (DEFAULT):
|
|
193
|
+
- Use this for normal answers, explanations, descriptions, welcome messages,
|
|
194
|
+
and any content that is mostly free text.
|
|
195
|
+
- TABLE:
|
|
196
|
+
- Use this ONLY when the content is clearly structured with multiple columns
|
|
197
|
+
(for example: comparisons, lists of items with several attributes).
|
|
198
|
+
- MINI TABLE:
|
|
199
|
+
- Use this for small, compact key-value style data
|
|
200
|
+
(for example: a few fields like "Token", "Price", "Network"),
|
|
201
|
+
or when a full table would be visually too heavy.
|
|
202
|
+
|
|
203
|
+
If the user does NOT explicitly ask for a table or very structured data,
|
|
204
|
+
you MUST use the CARD layout.
|
|
205
|
+
|
|
206
|
+
====================
|
|
207
|
+
STYLE RULES
|
|
208
|
+
====================
|
|
209
|
+
General style (CARD or container):
|
|
210
|
+
- Use a main wrapper <div> with styles similar to:
|
|
211
|
+
background: #ffffff;
|
|
212
|
+
color: #111111;
|
|
213
|
+
border: 1px solid #e5e5e5;
|
|
214
|
+
border-radius: 8px;
|
|
215
|
+
padding: 12px;
|
|
216
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
217
|
+
- You may add a top header area using the header background color:
|
|
218
|
+
background: ${headerColor};
|
|
219
|
+
|
|
220
|
+
Use branding:
|
|
221
|
+
- Include the company logo and name in a subtle way when appropriate
|
|
222
|
+
(for example, in a small header bar):
|
|
223
|
+
- Logo (emoji or image) on the left,
|
|
224
|
+
- Company name text next to it.
|
|
225
|
+
|
|
226
|
+
Typography:
|
|
227
|
+
- Titles: 18\u201322px, bold.
|
|
228
|
+
- Body text: 12\u201316px, regular.
|
|
229
|
+
- Line-height should be comfortable (around 1.4\u20131.6).
|
|
230
|
+
|
|
231
|
+
Tables:
|
|
232
|
+
- Use <table> with <thead> and <tbody> where appropriate.
|
|
233
|
+
- Header row background: ${accentColor};
|
|
234
|
+
- Header row text color: #ffffff;
|
|
235
|
+
- Body rows background: #ffffff;
|
|
236
|
+
- Row borders: 1px solid #e5e5e5 (or a faint version of the border color).
|
|
237
|
+
|
|
238
|
+
Mini table:
|
|
239
|
+
- Can be a simple two-column table or stacked key-value pairs.
|
|
240
|
+
- Keep it compact (less padding, fewer rows).
|
|
241
|
+
|
|
242
|
+
Links:
|
|
243
|
+
- You can use <a> for styling or static URLs.
|
|
244
|
+
- Use the accent color for links:
|
|
245
|
+
color: ${accentColor};
|
|
246
|
+
|
|
247
|
+
====================
|
|
248
|
+
OUTPUT FORMAT
|
|
249
|
+
====================
|
|
250
|
+
Your final output MUST follow these rules:
|
|
251
|
+
- Output ONLY a single HTML snippet.
|
|
252
|
+
- Do NOT wrap it in backticks or markdown.
|
|
253
|
+
- Do NOT include any explanation text.
|
|
254
|
+
- Do NOT include JSON.
|
|
255
|
+
- Must use exactly ONE of: card, table, mini table.
|
|
256
|
+
- Must respect allowed/forbidden tags.
|
|
257
|
+
- Must use colors derived from:
|
|
258
|
+
- header_background
|
|
259
|
+
- button_background
|
|
260
|
+
and otherwise a light theme.
|
|
261
|
+
|
|
262
|
+
====================
|
|
263
|
+
BEHAVIOR SUMMARY
|
|
264
|
+
====================
|
|
265
|
+
1) Read the user message.
|
|
266
|
+
2) Decide whether CARD, TABLE, or MINI TABLE is most suitable.
|
|
267
|
+
3) Generate a single HTML layout using only allowed, non-interactive tags.
|
|
268
|
+
4) Style the layout with inline CSS using:
|
|
269
|
+
- ${headerColor} for header areas,
|
|
270
|
+
- ${accentColor} for accents,
|
|
271
|
+
- white/light backgrounds and dark text.
|
|
272
|
+
5) Return ONLY the HTML snippet.
|
|
273
|
+
`;
|
|
274
|
+
};
|
|
99
275
|
const sendMessage = async (message) => {
|
|
100
276
|
if (!message.trim() || isLoading) return;
|
|
101
277
|
addMessage(message, "user");
|
|
102
278
|
setIsLoading(true);
|
|
279
|
+
console.log(options.config);
|
|
103
280
|
try {
|
|
104
281
|
let resp;
|
|
105
282
|
console.log(options.headers);
|
|
@@ -115,7 +292,8 @@ var useChatbot = (options = {}) => {
|
|
|
115
292
|
}
|
|
116
293
|
],
|
|
117
294
|
input: message,
|
|
118
|
-
previous_response_id: responseId || void 0
|
|
295
|
+
previous_response_id: responseId || void 0,
|
|
296
|
+
instructions: getHtmlUiInstructions(options.config)
|
|
119
297
|
});
|
|
120
298
|
setResponseId(resp.id);
|
|
121
299
|
let responseText = "";
|
|
@@ -167,6 +345,7 @@ var fetchChatWidgetSettings = async (clientId) => {
|
|
|
167
345
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
168
346
|
}
|
|
169
347
|
const data = await response.json();
|
|
348
|
+
console.log(data);
|
|
170
349
|
return data;
|
|
171
350
|
} catch (error) {
|
|
172
351
|
console.error("Error fetching chat widget settings:", error);
|
|
@@ -572,6 +751,109 @@ var getLoadingSpinnerStyles = () => ({
|
|
|
572
751
|
borderRadius: "50%",
|
|
573
752
|
animation: "spin 1s linear infinite"
|
|
574
753
|
});
|
|
754
|
+
|
|
755
|
+
// src/styles/alertStyles.ts
|
|
756
|
+
var getAlertContainerStyles = (type) => {
|
|
757
|
+
const colors = {
|
|
758
|
+
error: {
|
|
759
|
+
background: "linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",
|
|
760
|
+
border: "#dc2626",
|
|
761
|
+
shadow: "rgba(239, 68, 68, 0.2)"
|
|
762
|
+
},
|
|
763
|
+
warning: {
|
|
764
|
+
background: "linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",
|
|
765
|
+
border: "#d97706",
|
|
766
|
+
shadow: "rgba(245, 158, 11, 0.2)"
|
|
767
|
+
},
|
|
768
|
+
success: {
|
|
769
|
+
background: "linear-gradient(135deg, #10b981 0%, #059669 100%)",
|
|
770
|
+
border: "#059669",
|
|
771
|
+
shadow: "rgba(16, 185, 129, 0.2)"
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
const selectedColor = colors[type];
|
|
775
|
+
return {
|
|
776
|
+
background: selectedColor.background,
|
|
777
|
+
border: `1px solid ${selectedColor.border}`,
|
|
778
|
+
borderRadius: "12px",
|
|
779
|
+
padding: "14px 16px",
|
|
780
|
+
margin: "12px 16px",
|
|
781
|
+
boxShadow: `0 4px 12px ${selectedColor.shadow}`,
|
|
782
|
+
color: "#ffffff",
|
|
783
|
+
fontSize: "13px",
|
|
784
|
+
display: "flex",
|
|
785
|
+
alignItems: "flex-start",
|
|
786
|
+
gap: "12px",
|
|
787
|
+
position: "relative",
|
|
788
|
+
animation: "slideDown 0.3s ease-out"
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
var getAlertIconContainerStyles = () => ({
|
|
792
|
+
display: "flex",
|
|
793
|
+
alignItems: "center",
|
|
794
|
+
justifyContent: "center",
|
|
795
|
+
width: "24px",
|
|
796
|
+
height: "24px",
|
|
797
|
+
flexShrink: 0,
|
|
798
|
+
marginTop: "2px"
|
|
799
|
+
});
|
|
800
|
+
var getAlertContentStyles = () => ({
|
|
801
|
+
flex: 1,
|
|
802
|
+
display: "flex",
|
|
803
|
+
flexDirection: "column",
|
|
804
|
+
gap: "8px"
|
|
805
|
+
});
|
|
806
|
+
var getAlertTitleStyles = () => ({
|
|
807
|
+
fontWeight: 600,
|
|
808
|
+
fontSize: "14px",
|
|
809
|
+
margin: 0,
|
|
810
|
+
lineHeight: 1.4
|
|
811
|
+
});
|
|
812
|
+
var getAlertMessageStyles = () => ({
|
|
813
|
+
margin: 0,
|
|
814
|
+
lineHeight: 1.5,
|
|
815
|
+
opacity: 0.95
|
|
816
|
+
});
|
|
817
|
+
var getAlertListStyles = () => ({
|
|
818
|
+
margin: "8px 0 0 0",
|
|
819
|
+
paddingLeft: "20px",
|
|
820
|
+
listStyle: "none"
|
|
821
|
+
});
|
|
822
|
+
var getAlertListItemStyles = () => ({
|
|
823
|
+
marginBottom: "4px",
|
|
824
|
+
position: "relative",
|
|
825
|
+
paddingLeft: "12px",
|
|
826
|
+
lineHeight: 1.4
|
|
827
|
+
});
|
|
828
|
+
var getAlertCloseButtonStyles = () => ({
|
|
829
|
+
position: "absolute",
|
|
830
|
+
top: "12px",
|
|
831
|
+
right: "12px",
|
|
832
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
833
|
+
border: "none",
|
|
834
|
+
borderRadius: "6px",
|
|
835
|
+
width: "24px",
|
|
836
|
+
height: "24px",
|
|
837
|
+
display: "flex",
|
|
838
|
+
alignItems: "center",
|
|
839
|
+
justifyContent: "center",
|
|
840
|
+
cursor: "pointer",
|
|
841
|
+
color: "#ffffff",
|
|
842
|
+
transition: "all 0.2s ease",
|
|
843
|
+
padding: 0
|
|
844
|
+
});
|
|
845
|
+
var getAlertAnimationStyles = () => `
|
|
846
|
+
@keyframes slideDown {
|
|
847
|
+
from {
|
|
848
|
+
opacity: 0;
|
|
849
|
+
transform: translateY(-10px);
|
|
850
|
+
}
|
|
851
|
+
to {
|
|
852
|
+
opacity: 1;
|
|
853
|
+
transform: translateY(0);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
`;
|
|
575
857
|
var AizekChatBot = ({ clientId, headers }) => {
|
|
576
858
|
const defaultConfig = {
|
|
577
859
|
welcomeMessage: "Merhaba! Size nas\u0131l yard\u0131mc\u0131 olabilirim?",
|
|
@@ -593,11 +875,22 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
593
875
|
const [apiKey, setApiKey] = useState("");
|
|
594
876
|
const { welcomeMessage, buttonBackground, placeholder, buttonPosition, buttonSize, chatWidth, chatHeight, showTypingIndicator, initialOpen, headerBackground, companyLogo, companyName } = config;
|
|
595
877
|
const [isOpen, setIsOpen] = useState(false);
|
|
878
|
+
const [headerValidation, setHeaderValidation] = useState(null);
|
|
879
|
+
const [showAlert, setShowAlert] = useState(true);
|
|
596
880
|
useEffect(() => {
|
|
881
|
+
console.log("render");
|
|
597
882
|
const loadConfig = async () => {
|
|
598
883
|
try {
|
|
599
884
|
setIsConfigLoading(true);
|
|
600
885
|
const apiResponse = await fetchChatWidgetSettings(clientId);
|
|
886
|
+
if (headers && apiResponse.data.auth_config) {
|
|
887
|
+
const validationResult = validateHeaders(headers, apiResponse.data.auth_config, {
|
|
888
|
+
allowExtra: false,
|
|
889
|
+
caseSensitive: true
|
|
890
|
+
});
|
|
891
|
+
console.log(validationResult);
|
|
892
|
+
setHeaderValidation(validationResult);
|
|
893
|
+
}
|
|
601
894
|
setFinalMcpUrl(apiResponse.data.mcp_url);
|
|
602
895
|
setApiKey(apiResponse.data.openai_key || "");
|
|
603
896
|
const apiConfig = mapApiSettingsToConfig(apiResponse.data.chat_widget_settings);
|
|
@@ -613,7 +906,7 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
613
906
|
};
|
|
614
907
|
loadConfig();
|
|
615
908
|
}, [clientId]);
|
|
616
|
-
const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, headers });
|
|
909
|
+
const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, headers, config });
|
|
617
910
|
const messages = internalChatbot.messages;
|
|
618
911
|
const isLoading = internalChatbot.isLoading;
|
|
619
912
|
const handleSendMessage = internalChatbot.sendMessage;
|
|
@@ -633,7 +926,7 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
633
926
|
return /* @__PURE__ */ jsxs("div", { style: getMessageContainerStyles(isUser), children: [
|
|
634
927
|
/* @__PURE__ */ jsx("style", { children: getMarkdownElementStyles(isUser) }),
|
|
635
928
|
/* @__PURE__ */ jsxs("div", { style: getMessageBubbleStyles(isUser), children: [
|
|
636
|
-
/* @__PURE__ */ jsx("div", { style: getMarkdownStyles(), className: "markdown-content", children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content }) }),
|
|
929
|
+
isUser ? /* @__PURE__ */ jsx("div", { style: getMarkdownStyles(), className: "markdown-content", children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content }) }) : /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: message.content } }),
|
|
637
930
|
message.isTyping && /* @__PURE__ */ jsx("div", { style: {
|
|
638
931
|
display: "inline-flex",
|
|
639
932
|
alignItems: "center",
|
|
@@ -659,6 +952,106 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
659
952
|
}, []);
|
|
660
953
|
return /* @__PURE__ */ jsx("span", { children: dots });
|
|
661
954
|
};
|
|
955
|
+
const HeaderValidationAlert = () => {
|
|
956
|
+
if (!headerValidation || !showAlert) return null;
|
|
957
|
+
const { isValid, missingKeys, extraKeys, emptyValueKeys } = headerValidation;
|
|
958
|
+
if (isValid && missingKeys.length === 0 && extraKeys.length === 0 && emptyValueKeys.length === 0) {
|
|
959
|
+
return null;
|
|
960
|
+
}
|
|
961
|
+
const hasErrors = missingKeys.length > 0 || emptyValueKeys.length > 0;
|
|
962
|
+
const hasWarnings = extraKeys.length > 0;
|
|
963
|
+
const alertType = hasErrors ? "error" : "warning";
|
|
964
|
+
const getAlertIcon = () => {
|
|
965
|
+
if (hasErrors) {
|
|
966
|
+
return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) });
|
|
967
|
+
}
|
|
968
|
+
return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) });
|
|
969
|
+
};
|
|
970
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
971
|
+
/* @__PURE__ */ jsx("style", { children: getAlertAnimationStyles() }),
|
|
972
|
+
/* @__PURE__ */ jsxs("div", { style: getAlertContainerStyles(alertType), children: [
|
|
973
|
+
/* @__PURE__ */ jsx("div", { style: getAlertIconContainerStyles(), children: getAlertIcon() }),
|
|
974
|
+
/* @__PURE__ */ jsxs("div", { style: getAlertContentStyles(), children: [
|
|
975
|
+
/* @__PURE__ */ jsx("h4", { style: getAlertTitleStyles(), children: hasErrors ? "Header Do\u011Frulama Hatas\u0131" : "Header Uyar\u0131s\u0131" }),
|
|
976
|
+
/* @__PURE__ */ jsx("p", { style: getAlertMessageStyles(), children: hasErrors && hasWarnings ? "Header yap\u0131land\u0131rman\u0131zda hatalar ve uyar\u0131lar bulundu." : hasErrors ? "Header yap\u0131land\u0131rman\u0131zda hatalar bulundu." : "Header yap\u0131land\u0131rman\u0131zda fazla anahtarlar bulundu." }),
|
|
977
|
+
missingKeys.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
978
|
+
/* @__PURE__ */ jsx("strong", { style: { fontSize: "13px" }, children: "Eksik Header'lar:" }),
|
|
979
|
+
/* @__PURE__ */ jsx("ul", { style: getAlertListStyles(), children: missingKeys.map((key, index) => /* @__PURE__ */ jsxs("li", { style: getAlertListItemStyles(), children: [
|
|
980
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
981
|
+
position: "absolute",
|
|
982
|
+
left: "0",
|
|
983
|
+
top: "2px",
|
|
984
|
+
fontWeight: "bold"
|
|
985
|
+
}, children: "\u2022" }),
|
|
986
|
+
/* @__PURE__ */ jsx("code", { style: {
|
|
987
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
988
|
+
padding: "2px 6px",
|
|
989
|
+
borderRadius: "4px",
|
|
990
|
+
fontFamily: "monospace",
|
|
991
|
+
fontSize: "12px"
|
|
992
|
+
}, children: key })
|
|
993
|
+
] }, index)) })
|
|
994
|
+
] }),
|
|
995
|
+
emptyValueKeys.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
996
|
+
/* @__PURE__ */ jsx("strong", { style: { fontSize: "13px" }, children: "Bo\u015F De\u011Ferli Header'lar:" }),
|
|
997
|
+
/* @__PURE__ */ jsx("ul", { style: getAlertListStyles(), children: emptyValueKeys.map((key, index) => /* @__PURE__ */ jsxs("li", { style: getAlertListItemStyles(), children: [
|
|
998
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
999
|
+
position: "absolute",
|
|
1000
|
+
left: "0",
|
|
1001
|
+
top: "2px",
|
|
1002
|
+
fontWeight: "bold"
|
|
1003
|
+
}, children: "\u2022" }),
|
|
1004
|
+
/* @__PURE__ */ jsx("code", { style: {
|
|
1005
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
1006
|
+
padding: "2px 6px",
|
|
1007
|
+
borderRadius: "4px",
|
|
1008
|
+
fontFamily: "monospace",
|
|
1009
|
+
fontSize: "12px"
|
|
1010
|
+
}, children: key }),
|
|
1011
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
1012
|
+
marginLeft: "6px",
|
|
1013
|
+
fontSize: "11px",
|
|
1014
|
+
opacity: 0.9
|
|
1015
|
+
}, children: "(de\u011Fer bo\u015F olamaz)" })
|
|
1016
|
+
] }, index)) })
|
|
1017
|
+
] }),
|
|
1018
|
+
extraKeys.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
1019
|
+
/* @__PURE__ */ jsx("strong", { style: { fontSize: "13px" }, children: "Fazla Header'lar:" }),
|
|
1020
|
+
/* @__PURE__ */ jsx("ul", { style: getAlertListStyles(), children: extraKeys.map((key, index) => /* @__PURE__ */ jsxs("li", { style: getAlertListItemStyles(), children: [
|
|
1021
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
1022
|
+
position: "absolute",
|
|
1023
|
+
left: "0",
|
|
1024
|
+
top: "2px",
|
|
1025
|
+
fontWeight: "bold"
|
|
1026
|
+
}, children: "\u2022" }),
|
|
1027
|
+
/* @__PURE__ */ jsx("code", { style: {
|
|
1028
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
1029
|
+
padding: "2px 6px",
|
|
1030
|
+
borderRadius: "4px",
|
|
1031
|
+
fontFamily: "monospace",
|
|
1032
|
+
fontSize: "12px"
|
|
1033
|
+
}, children: key })
|
|
1034
|
+
] }, index)) })
|
|
1035
|
+
] })
|
|
1036
|
+
] }),
|
|
1037
|
+
/* @__PURE__ */ jsx(
|
|
1038
|
+
"button",
|
|
1039
|
+
{
|
|
1040
|
+
onClick: () => setShowAlert(false),
|
|
1041
|
+
style: getAlertCloseButtonStyles(),
|
|
1042
|
+
onMouseEnter: (e) => {
|
|
1043
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 0.3)";
|
|
1044
|
+
},
|
|
1045
|
+
onMouseLeave: (e) => {
|
|
1046
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 0.2)";
|
|
1047
|
+
},
|
|
1048
|
+
"aria-label": "Uyar\u0131y\u0131 kapat",
|
|
1049
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) })
|
|
1050
|
+
}
|
|
1051
|
+
)
|
|
1052
|
+
] })
|
|
1053
|
+
] });
|
|
1054
|
+
};
|
|
662
1055
|
const ChatInput = () => {
|
|
663
1056
|
const [message, setMessage] = useState("");
|
|
664
1057
|
const textareaRef = useRef(null);
|
|
@@ -747,6 +1140,7 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
747
1140
|
] })
|
|
748
1141
|
] }),
|
|
749
1142
|
/* @__PURE__ */ jsxs("div", { style: getMessagesContainerStyles(), children: [
|
|
1143
|
+
/* @__PURE__ */ jsx(HeaderValidationAlert, {}),
|
|
750
1144
|
messages.length === 0 ? /* @__PURE__ */ jsxs("div", { style: getEmptyStateStyles(), children: [
|
|
751
1145
|
/* @__PURE__ */ jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "\u{1F4AC}" }),
|
|
752
1146
|
/* @__PURE__ */ jsx("h4", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: welcomeMessage }),
|