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.cjs
CHANGED
|
@@ -35,6 +35,25 @@ var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
|
35
35
|
function cx(...args) {
|
|
36
36
|
return args.filter(Boolean).join(" ");
|
|
37
37
|
}
|
|
38
|
+
function validateHeaders(headers, authConfig, opts = {}) {
|
|
39
|
+
const { caseSensitive = false, allowExtra = false } = opts;
|
|
40
|
+
const normalize = (s) => caseSensitive ? s : s.toLowerCase();
|
|
41
|
+
const headerEntries = Object.entries(headers).map(([k, v]) => [normalize(k), v.trim()]);
|
|
42
|
+
const authEntries = Object.entries(authConfig).map(([k, v]) => [normalize(k), v.trim()]);
|
|
43
|
+
const headerKeys = headerEntries.map(([k]) => k);
|
|
44
|
+
const authKeys = authEntries.map(([k]) => k);
|
|
45
|
+
const requiredSet = new Set(authKeys);
|
|
46
|
+
const missingKeys = authKeys.filter((k) => !headerKeys.includes(k));
|
|
47
|
+
const extraKeys = headerKeys.filter((k) => !requiredSet.has(k));
|
|
48
|
+
const hasAllRequired = missingKeys.length === 0;
|
|
49
|
+
const hasExtraKeys = extraKeys.length > 0 && !allowExtra;
|
|
50
|
+
const emptyValueKeys = authKeys.filter((k) => {
|
|
51
|
+
const val = headerEntries.find(([key]) => key === k)?.[1];
|
|
52
|
+
return !val || val.length === 0;
|
|
53
|
+
});
|
|
54
|
+
const isValid = hasAllRequired && !hasExtraKeys && emptyValueKeys.length === 0;
|
|
55
|
+
return { isValid, missingKeys, extraKeys, emptyValueKeys };
|
|
56
|
+
}
|
|
38
57
|
var base = {
|
|
39
58
|
display: "inline-flex",
|
|
40
59
|
alignItems: "center",
|
|
@@ -104,7 +123,7 @@ var Button = React__namespace.forwardRef(
|
|
|
104
123
|
);
|
|
105
124
|
Button.displayName = "Button";
|
|
106
125
|
var useChatbot = (options = {}) => {
|
|
107
|
-
const { mcpUrl, apiKey } = options;
|
|
126
|
+
const { mcpUrl, apiKey, config } = options;
|
|
108
127
|
const client = new OpenAI__default.default({ apiKey, dangerouslyAllowBrowser: true });
|
|
109
128
|
const [responseId, setResponseId] = React.useState(null);
|
|
110
129
|
const [messages, setMessages] = React.useState([]);
|
|
@@ -122,10 +141,168 @@ var useChatbot = (options = {}) => {
|
|
|
122
141
|
setMessages((prev) => [...prev, newMessage]);
|
|
123
142
|
return newMessage;
|
|
124
143
|
};
|
|
144
|
+
const getHtmlUiInstructions = (config2) => {
|
|
145
|
+
const headerColor = config2?.headerBackground || "#f5f5f5";
|
|
146
|
+
const accentColor = config2?.buttonBackground || "#007bff";
|
|
147
|
+
const companyName = config2?.companyName || "AI Assistant";
|
|
148
|
+
const companyLogo = config2?.companyLogo || "\u{1F916}";
|
|
149
|
+
return `
|
|
150
|
+
You are a helpful assistant that creates UI using ONLY HTML tags.
|
|
151
|
+
|
|
152
|
+
Your task:
|
|
153
|
+
- Read the user message and respond.
|
|
154
|
+
- Render your response as a small HTML layout (card OR table OR mini-table).
|
|
155
|
+
- Use inline CSS styles.
|
|
156
|
+
- Use a clean, light (white-based) theme.
|
|
157
|
+
- Use branding and colors from options.config.
|
|
158
|
+
- Return ONLY raw HTML (no markdown, no backticks, no JSON, no explanations).
|
|
159
|
+
|
|
160
|
+
====================
|
|
161
|
+
THEME & BRANDING (from options.config)
|
|
162
|
+
====================
|
|
163
|
+
The chat widget configuration provides:
|
|
164
|
+
|
|
165
|
+
- Header Background Color: ${headerColor}
|
|
166
|
+
- Button / Accent Color: ${accentColor}
|
|
167
|
+
- Company Name: ${companyName}
|
|
168
|
+
- Company Logo: ${companyLogo}
|
|
169
|
+
|
|
170
|
+
How to use these:
|
|
171
|
+
- Use Header Background Color mainly for top headers, title strips, or main highlight areas.
|
|
172
|
+
- Use Button / Accent Color for important accents: borders, highlights, small badges, table headers, key text highlights, links, etc.
|
|
173
|
+
- Use a white or very light background for main surfaces.
|
|
174
|
+
- Text color should generally be dark (#111\u2013#333) for readability.
|
|
175
|
+
|
|
176
|
+
Do NOT create real interactive buttons. You can visually style elements using the accent color, but you must NOT use <button>.
|
|
177
|
+
|
|
178
|
+
====================
|
|
179
|
+
ALLOWED / FORBIDDEN TAGS
|
|
180
|
+
====================
|
|
181
|
+
You may use ANY NON-INTERACTIVE HTML element, for example:
|
|
182
|
+
- Text and headings:
|
|
183
|
+
<h1>, <h2>, <h3>, <h4>, <h5>, <h6>,
|
|
184
|
+
<p>, <span>, <strong>, <em>, <small>, <blockquote>, <code>, <pre>
|
|
185
|
+
- Layout:
|
|
186
|
+
<div>, <section>, <article>, <header>, <footer>
|
|
187
|
+
- Lists:
|
|
188
|
+
<ul>, <ol>, <li>
|
|
189
|
+
- Tables:
|
|
190
|
+
<table>, <thead>, <tbody>, <tr>, <th>, <td>
|
|
191
|
+
- Media:
|
|
192
|
+
<img>, <figure>, <figcaption>
|
|
193
|
+
- Links (non-interactive navigation style only):
|
|
194
|
+
<a>
|
|
195
|
+
|
|
196
|
+
FORBIDDEN (NEVER USE):
|
|
197
|
+
- <button>, <input>, <textarea>, <select>, <option>, <form>, <label>
|
|
198
|
+
- <details>, <summary>, <dialog>
|
|
199
|
+
- <video> or <audio> with controls for user interaction
|
|
200
|
+
- Any inline event handlers like onclick, onmouseover, etc.
|
|
201
|
+
- <script> or any JavaScript code.
|
|
202
|
+
|
|
203
|
+
====================
|
|
204
|
+
LAYOUT TYPE RULES
|
|
205
|
+
====================
|
|
206
|
+
You have exactly THREE layout types you can use:
|
|
207
|
+
|
|
208
|
+
1) CARD
|
|
209
|
+
2) TABLE
|
|
210
|
+
3) MINI TABLE
|
|
211
|
+
|
|
212
|
+
For EACH response:
|
|
213
|
+
- You MUST choose exactly ONE of these layout types.
|
|
214
|
+
- You MUST NOT mix layout types in the same response.
|
|
215
|
+
(Do NOT render card + table together, or table + mini-table together.)
|
|
216
|
+
|
|
217
|
+
Which layout to choose:
|
|
218
|
+
- CARD (DEFAULT):
|
|
219
|
+
- Use this for normal answers, explanations, descriptions, welcome messages,
|
|
220
|
+
and any content that is mostly free text.
|
|
221
|
+
- TABLE:
|
|
222
|
+
- Use this ONLY when the content is clearly structured with multiple columns
|
|
223
|
+
(for example: comparisons, lists of items with several attributes).
|
|
224
|
+
- MINI TABLE:
|
|
225
|
+
- Use this for small, compact key-value style data
|
|
226
|
+
(for example: a few fields like "Token", "Price", "Network"),
|
|
227
|
+
or when a full table would be visually too heavy.
|
|
228
|
+
|
|
229
|
+
If the user does NOT explicitly ask for a table or very structured data,
|
|
230
|
+
you MUST use the CARD layout.
|
|
231
|
+
|
|
232
|
+
====================
|
|
233
|
+
STYLE RULES
|
|
234
|
+
====================
|
|
235
|
+
General style (CARD or container):
|
|
236
|
+
- Use a main wrapper <div> with styles similar to:
|
|
237
|
+
background: #ffffff;
|
|
238
|
+
color: #111111;
|
|
239
|
+
border: 1px solid #e5e5e5;
|
|
240
|
+
border-radius: 8px;
|
|
241
|
+
padding: 12px;
|
|
242
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
243
|
+
- You may add a top header area using the header background color:
|
|
244
|
+
background: ${headerColor};
|
|
245
|
+
|
|
246
|
+
Use branding:
|
|
247
|
+
- Include the company logo and name in a subtle way when appropriate
|
|
248
|
+
(for example, in a small header bar):
|
|
249
|
+
- Logo (emoji or image) on the left,
|
|
250
|
+
- Company name text next to it.
|
|
251
|
+
|
|
252
|
+
Typography:
|
|
253
|
+
- Titles: 18\u201322px, bold.
|
|
254
|
+
- Body text: 12\u201316px, regular.
|
|
255
|
+
- Line-height should be comfortable (around 1.4\u20131.6).
|
|
256
|
+
|
|
257
|
+
Tables:
|
|
258
|
+
- Use <table> with <thead> and <tbody> where appropriate.
|
|
259
|
+
- Header row background: ${accentColor};
|
|
260
|
+
- Header row text color: #ffffff;
|
|
261
|
+
- Body rows background: #ffffff;
|
|
262
|
+
- Row borders: 1px solid #e5e5e5 (or a faint version of the border color).
|
|
263
|
+
|
|
264
|
+
Mini table:
|
|
265
|
+
- Can be a simple two-column table or stacked key-value pairs.
|
|
266
|
+
- Keep it compact (less padding, fewer rows).
|
|
267
|
+
|
|
268
|
+
Links:
|
|
269
|
+
- You can use <a> for styling or static URLs.
|
|
270
|
+
- Use the accent color for links:
|
|
271
|
+
color: ${accentColor};
|
|
272
|
+
|
|
273
|
+
====================
|
|
274
|
+
OUTPUT FORMAT
|
|
275
|
+
====================
|
|
276
|
+
Your final output MUST follow these rules:
|
|
277
|
+
- Output ONLY a single HTML snippet.
|
|
278
|
+
- Do NOT wrap it in backticks or markdown.
|
|
279
|
+
- Do NOT include any explanation text.
|
|
280
|
+
- Do NOT include JSON.
|
|
281
|
+
- Must use exactly ONE of: card, table, mini table.
|
|
282
|
+
- Must respect allowed/forbidden tags.
|
|
283
|
+
- Must use colors derived from:
|
|
284
|
+
- header_background
|
|
285
|
+
- button_background
|
|
286
|
+
and otherwise a light theme.
|
|
287
|
+
|
|
288
|
+
====================
|
|
289
|
+
BEHAVIOR SUMMARY
|
|
290
|
+
====================
|
|
291
|
+
1) Read the user message.
|
|
292
|
+
2) Decide whether CARD, TABLE, or MINI TABLE is most suitable.
|
|
293
|
+
3) Generate a single HTML layout using only allowed, non-interactive tags.
|
|
294
|
+
4) Style the layout with inline CSS using:
|
|
295
|
+
- ${headerColor} for header areas,
|
|
296
|
+
- ${accentColor} for accents,
|
|
297
|
+
- white/light backgrounds and dark text.
|
|
298
|
+
5) Return ONLY the HTML snippet.
|
|
299
|
+
`;
|
|
300
|
+
};
|
|
125
301
|
const sendMessage = async (message) => {
|
|
126
302
|
if (!message.trim() || isLoading) return;
|
|
127
303
|
addMessage(message, "user");
|
|
128
304
|
setIsLoading(true);
|
|
305
|
+
console.log(options.config);
|
|
129
306
|
try {
|
|
130
307
|
let resp;
|
|
131
308
|
console.log(options.headers);
|
|
@@ -141,7 +318,8 @@ var useChatbot = (options = {}) => {
|
|
|
141
318
|
}
|
|
142
319
|
],
|
|
143
320
|
input: message,
|
|
144
|
-
previous_response_id: responseId || void 0
|
|
321
|
+
previous_response_id: responseId || void 0,
|
|
322
|
+
instructions: getHtmlUiInstructions(options.config)
|
|
145
323
|
});
|
|
146
324
|
setResponseId(resp.id);
|
|
147
325
|
let responseText = "";
|
|
@@ -193,6 +371,7 @@ var fetchChatWidgetSettings = async (clientId) => {
|
|
|
193
371
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
194
372
|
}
|
|
195
373
|
const data = await response.json();
|
|
374
|
+
console.log(data);
|
|
196
375
|
return data;
|
|
197
376
|
} catch (error) {
|
|
198
377
|
console.error("Error fetching chat widget settings:", error);
|
|
@@ -598,6 +777,109 @@ var getLoadingSpinnerStyles = () => ({
|
|
|
598
777
|
borderRadius: "50%",
|
|
599
778
|
animation: "spin 1s linear infinite"
|
|
600
779
|
});
|
|
780
|
+
|
|
781
|
+
// src/styles/alertStyles.ts
|
|
782
|
+
var getAlertContainerStyles = (type) => {
|
|
783
|
+
const colors = {
|
|
784
|
+
error: {
|
|
785
|
+
background: "linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",
|
|
786
|
+
border: "#dc2626",
|
|
787
|
+
shadow: "rgba(239, 68, 68, 0.2)"
|
|
788
|
+
},
|
|
789
|
+
warning: {
|
|
790
|
+
background: "linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",
|
|
791
|
+
border: "#d97706",
|
|
792
|
+
shadow: "rgba(245, 158, 11, 0.2)"
|
|
793
|
+
},
|
|
794
|
+
success: {
|
|
795
|
+
background: "linear-gradient(135deg, #10b981 0%, #059669 100%)",
|
|
796
|
+
border: "#059669",
|
|
797
|
+
shadow: "rgba(16, 185, 129, 0.2)"
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
const selectedColor = colors[type];
|
|
801
|
+
return {
|
|
802
|
+
background: selectedColor.background,
|
|
803
|
+
border: `1px solid ${selectedColor.border}`,
|
|
804
|
+
borderRadius: "12px",
|
|
805
|
+
padding: "14px 16px",
|
|
806
|
+
margin: "12px 16px",
|
|
807
|
+
boxShadow: `0 4px 12px ${selectedColor.shadow}`,
|
|
808
|
+
color: "#ffffff",
|
|
809
|
+
fontSize: "13px",
|
|
810
|
+
display: "flex",
|
|
811
|
+
alignItems: "flex-start",
|
|
812
|
+
gap: "12px",
|
|
813
|
+
position: "relative",
|
|
814
|
+
animation: "slideDown 0.3s ease-out"
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
var getAlertIconContainerStyles = () => ({
|
|
818
|
+
display: "flex",
|
|
819
|
+
alignItems: "center",
|
|
820
|
+
justifyContent: "center",
|
|
821
|
+
width: "24px",
|
|
822
|
+
height: "24px",
|
|
823
|
+
flexShrink: 0,
|
|
824
|
+
marginTop: "2px"
|
|
825
|
+
});
|
|
826
|
+
var getAlertContentStyles = () => ({
|
|
827
|
+
flex: 1,
|
|
828
|
+
display: "flex",
|
|
829
|
+
flexDirection: "column",
|
|
830
|
+
gap: "8px"
|
|
831
|
+
});
|
|
832
|
+
var getAlertTitleStyles = () => ({
|
|
833
|
+
fontWeight: 600,
|
|
834
|
+
fontSize: "14px",
|
|
835
|
+
margin: 0,
|
|
836
|
+
lineHeight: 1.4
|
|
837
|
+
});
|
|
838
|
+
var getAlertMessageStyles = () => ({
|
|
839
|
+
margin: 0,
|
|
840
|
+
lineHeight: 1.5,
|
|
841
|
+
opacity: 0.95
|
|
842
|
+
});
|
|
843
|
+
var getAlertListStyles = () => ({
|
|
844
|
+
margin: "8px 0 0 0",
|
|
845
|
+
paddingLeft: "20px",
|
|
846
|
+
listStyle: "none"
|
|
847
|
+
});
|
|
848
|
+
var getAlertListItemStyles = () => ({
|
|
849
|
+
marginBottom: "4px",
|
|
850
|
+
position: "relative",
|
|
851
|
+
paddingLeft: "12px",
|
|
852
|
+
lineHeight: 1.4
|
|
853
|
+
});
|
|
854
|
+
var getAlertCloseButtonStyles = () => ({
|
|
855
|
+
position: "absolute",
|
|
856
|
+
top: "12px",
|
|
857
|
+
right: "12px",
|
|
858
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
859
|
+
border: "none",
|
|
860
|
+
borderRadius: "6px",
|
|
861
|
+
width: "24px",
|
|
862
|
+
height: "24px",
|
|
863
|
+
display: "flex",
|
|
864
|
+
alignItems: "center",
|
|
865
|
+
justifyContent: "center",
|
|
866
|
+
cursor: "pointer",
|
|
867
|
+
color: "#ffffff",
|
|
868
|
+
transition: "all 0.2s ease",
|
|
869
|
+
padding: 0
|
|
870
|
+
});
|
|
871
|
+
var getAlertAnimationStyles = () => `
|
|
872
|
+
@keyframes slideDown {
|
|
873
|
+
from {
|
|
874
|
+
opacity: 0;
|
|
875
|
+
transform: translateY(-10px);
|
|
876
|
+
}
|
|
877
|
+
to {
|
|
878
|
+
opacity: 1;
|
|
879
|
+
transform: translateY(0);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
`;
|
|
601
883
|
var AizekChatBot = ({ clientId, headers }) => {
|
|
602
884
|
const defaultConfig = {
|
|
603
885
|
welcomeMessage: "Merhaba! Size nas\u0131l yard\u0131mc\u0131 olabilirim?",
|
|
@@ -619,11 +901,22 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
619
901
|
const [apiKey, setApiKey] = React.useState("");
|
|
620
902
|
const { welcomeMessage, buttonBackground, placeholder, buttonPosition, buttonSize, chatWidth, chatHeight, showTypingIndicator, initialOpen, headerBackground, companyLogo, companyName } = config;
|
|
621
903
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
904
|
+
const [headerValidation, setHeaderValidation] = React.useState(null);
|
|
905
|
+
const [showAlert, setShowAlert] = React.useState(true);
|
|
622
906
|
React.useEffect(() => {
|
|
907
|
+
console.log("render");
|
|
623
908
|
const loadConfig = async () => {
|
|
624
909
|
try {
|
|
625
910
|
setIsConfigLoading(true);
|
|
626
911
|
const apiResponse = await fetchChatWidgetSettings(clientId);
|
|
912
|
+
if (headers && apiResponse.data.auth_config) {
|
|
913
|
+
const validationResult = validateHeaders(headers, apiResponse.data.auth_config, {
|
|
914
|
+
allowExtra: false,
|
|
915
|
+
caseSensitive: true
|
|
916
|
+
});
|
|
917
|
+
console.log(validationResult);
|
|
918
|
+
setHeaderValidation(validationResult);
|
|
919
|
+
}
|
|
627
920
|
setFinalMcpUrl(apiResponse.data.mcp_url);
|
|
628
921
|
setApiKey(apiResponse.data.openai_key || "");
|
|
629
922
|
const apiConfig = mapApiSettingsToConfig(apiResponse.data.chat_widget_settings);
|
|
@@ -639,7 +932,7 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
639
932
|
};
|
|
640
933
|
loadConfig();
|
|
641
934
|
}, [clientId]);
|
|
642
|
-
const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, headers });
|
|
935
|
+
const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, headers, config });
|
|
643
936
|
const messages = internalChatbot.messages;
|
|
644
937
|
const isLoading = internalChatbot.isLoading;
|
|
645
938
|
const handleSendMessage = internalChatbot.sendMessage;
|
|
@@ -659,7 +952,7 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
659
952
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getMessageContainerStyles(isUser), children: [
|
|
660
953
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: getMarkdownElementStyles(isUser) }),
|
|
661
954
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: getMessageBubbleStyles(isUser), children: [
|
|
662
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: getMarkdownStyles(), className: "markdown-content", children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown__default.default, { remarkPlugins: [remarkGfm__default.default], children: message.content }) }),
|
|
955
|
+
isUser ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: getMarkdownStyles(), className: "markdown-content", children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown__default.default, { remarkPlugins: [remarkGfm__default.default], children: message.content }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: message.content } }),
|
|
663
956
|
message.isTyping && /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
664
957
|
display: "inline-flex",
|
|
665
958
|
alignItems: "center",
|
|
@@ -685,6 +978,106 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
685
978
|
}, []);
|
|
686
979
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { children: dots });
|
|
687
980
|
};
|
|
981
|
+
const HeaderValidationAlert = () => {
|
|
982
|
+
if (!headerValidation || !showAlert) return null;
|
|
983
|
+
const { isValid, missingKeys, extraKeys, emptyValueKeys } = headerValidation;
|
|
984
|
+
if (isValid && missingKeys.length === 0 && extraKeys.length === 0 && emptyValueKeys.length === 0) {
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
const hasErrors = missingKeys.length > 0 || emptyValueKeys.length > 0;
|
|
988
|
+
const hasWarnings = extraKeys.length > 0;
|
|
989
|
+
const alertType = hasErrors ? "error" : "warning";
|
|
990
|
+
const getAlertIcon = () => {
|
|
991
|
+
if (hasErrors) {
|
|
992
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.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" }) });
|
|
993
|
+
}
|
|
994
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) });
|
|
995
|
+
};
|
|
996
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: getAlertAnimationStyles() }),
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: getAlertContainerStyles(alertType), children: [
|
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: getAlertIconContainerStyles(), children: getAlertIcon() }),
|
|
1000
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: getAlertContentStyles(), children: [
|
|
1001
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { style: getAlertTitleStyles(), children: hasErrors ? "Header Do\u011Frulama Hatas\u0131" : "Header Uyar\u0131s\u0131" }),
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.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." }),
|
|
1003
|
+
missingKeys.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { style: { fontSize: "13px" }, children: "Eksik Header'lar:" }),
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { style: getAlertListStyles(), children: missingKeys.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { style: getAlertListItemStyles(), children: [
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: {
|
|
1007
|
+
position: "absolute",
|
|
1008
|
+
left: "0",
|
|
1009
|
+
top: "2px",
|
|
1010
|
+
fontWeight: "bold"
|
|
1011
|
+
}, children: "\u2022" }),
|
|
1012
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { style: {
|
|
1013
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
1014
|
+
padding: "2px 6px",
|
|
1015
|
+
borderRadius: "4px",
|
|
1016
|
+
fontFamily: "monospace",
|
|
1017
|
+
fontSize: "12px"
|
|
1018
|
+
}, children: key })
|
|
1019
|
+
] }, index)) })
|
|
1020
|
+
] }),
|
|
1021
|
+
emptyValueKeys.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1022
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { style: { fontSize: "13px" }, children: "Bo\u015F De\u011Ferli Header'lar:" }),
|
|
1023
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { style: getAlertListStyles(), children: emptyValueKeys.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { style: getAlertListItemStyles(), children: [
|
|
1024
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: {
|
|
1025
|
+
position: "absolute",
|
|
1026
|
+
left: "0",
|
|
1027
|
+
top: "2px",
|
|
1028
|
+
fontWeight: "bold"
|
|
1029
|
+
}, children: "\u2022" }),
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { style: {
|
|
1031
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
1032
|
+
padding: "2px 6px",
|
|
1033
|
+
borderRadius: "4px",
|
|
1034
|
+
fontFamily: "monospace",
|
|
1035
|
+
fontSize: "12px"
|
|
1036
|
+
}, children: key }),
|
|
1037
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: {
|
|
1038
|
+
marginLeft: "6px",
|
|
1039
|
+
fontSize: "11px",
|
|
1040
|
+
opacity: 0.9
|
|
1041
|
+
}, children: "(de\u011Fer bo\u015F olamaz)" })
|
|
1042
|
+
] }, index)) })
|
|
1043
|
+
] }),
|
|
1044
|
+
extraKeys.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1045
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { style: { fontSize: "13px" }, children: "Fazla Header'lar:" }),
|
|
1046
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { style: getAlertListStyles(), children: extraKeys.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { style: getAlertListItemStyles(), children: [
|
|
1047
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: {
|
|
1048
|
+
position: "absolute",
|
|
1049
|
+
left: "0",
|
|
1050
|
+
top: "2px",
|
|
1051
|
+
fontWeight: "bold"
|
|
1052
|
+
}, children: "\u2022" }),
|
|
1053
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { style: {
|
|
1054
|
+
background: "rgba(255, 255, 255, 0.2)",
|
|
1055
|
+
padding: "2px 6px",
|
|
1056
|
+
borderRadius: "4px",
|
|
1057
|
+
fontFamily: "monospace",
|
|
1058
|
+
fontSize: "12px"
|
|
1059
|
+
}, children: key })
|
|
1060
|
+
] }, index)) })
|
|
1061
|
+
] })
|
|
1062
|
+
] }),
|
|
1063
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
"button",
|
|
1065
|
+
{
|
|
1066
|
+
onClick: () => setShowAlert(false),
|
|
1067
|
+
style: getAlertCloseButtonStyles(),
|
|
1068
|
+
onMouseEnter: (e) => {
|
|
1069
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 0.3)";
|
|
1070
|
+
},
|
|
1071
|
+
onMouseLeave: (e) => {
|
|
1072
|
+
e.currentTarget.style.background = "rgba(255, 255, 255, 0.2)";
|
|
1073
|
+
},
|
|
1074
|
+
"aria-label": "Uyar\u0131y\u0131 kapat",
|
|
1075
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.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" }) })
|
|
1076
|
+
}
|
|
1077
|
+
)
|
|
1078
|
+
] })
|
|
1079
|
+
] });
|
|
1080
|
+
};
|
|
688
1081
|
const ChatInput = () => {
|
|
689
1082
|
const [message, setMessage] = React.useState("");
|
|
690
1083
|
const textareaRef = React.useRef(null);
|
|
@@ -773,6 +1166,7 @@ var AizekChatBot = ({ clientId, headers }) => {
|
|
|
773
1166
|
] })
|
|
774
1167
|
] }),
|
|
775
1168
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: getMessagesContainerStyles(), children: [
|
|
1169
|
+
/* @__PURE__ */ jsxRuntime.jsx(HeaderValidationAlert, {}),
|
|
776
1170
|
messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getEmptyStateStyles(), children: [
|
|
777
1171
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "\u{1F4AC}" }),
|
|
778
1172
|
/* @__PURE__ */ jsxRuntime.jsx("h4", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: welcomeMessage }),
|