aizek-chatbot 1.0.5 → 1.0.7

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
@@ -1,10 +1,9 @@
1
- "use client";
2
- import * as React from "react";
3
- import { useState, useEffect, useRef } from "react";
4
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import OpenAI from "openai";
6
- import ReactMarkdown from "react-markdown";
7
- import remarkGfm from "remark-gfm";
1
+ import * as React from 'react';
2
+ import { useState, useEffect, useRef } from 'react';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import OpenAI from 'openai';
5
+ import ReactMarkdown from 'react-markdown';
6
+ import remarkGfm from 'remark-gfm';
8
7
 
9
8
  // src/utils/cx.ts
10
9
  function cx(...args) {
@@ -19,18 +18,18 @@ var base = {
19
18
  lineHeight: 1,
20
19
  transition: "background-color .2s ease, color .2s ease, border-color .2s ease",
21
20
  outline: "none",
22
- cursor: "pointer",
21
+ cursor: "pointer"
23
22
  };
24
23
  var sizes = {
25
24
  sm: { height: 36, padding: "0 12px", fontSize: 14 },
26
25
  md: { height: 40, padding: "0 16px", fontSize: 16 },
27
- lg: { height: 44, padding: "0 20px", fontSize: 18 },
26
+ lg: { height: 44, padding: "0 20px", fontSize: 18 }
28
27
  };
29
28
  var palette = {
30
29
  brand: {
31
30
  primary: "#2563eb",
32
- primaryHover: "#1d4ed8",
33
- },
31
+ primaryHover: "#1d4ed8"
32
+ }
34
33
  };
35
34
  function styleFor(variant) {
36
35
  switch (variant) {
@@ -38,45 +37,45 @@ function styleFor(variant) {
38
37
  return {
39
38
  background: "transparent",
40
39
  color: palette.brand.primary,
41
- border: `1px solid ${palette.brand.primary}`,
40
+ border: `1px solid ${palette.brand.primary}`
42
41
  };
43
42
  case "ghost":
44
43
  return {
45
44
  background: "transparent",
46
45
  color: palette.brand.primary,
47
- border: "1px solid transparent",
46
+ border: "1px solid transparent"
48
47
  };
49
48
  default:
50
49
  return {
51
50
  background: palette.brand.primary,
52
51
  color: "#fff",
53
- border: "1px solid transparent",
52
+ border: "1px solid transparent"
54
53
  };
55
54
  }
56
55
  }
57
- var Button = React.forwardRef(({ variant = "primary", size = "md", style, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
58
- const [hover, setHover] = React.useState(false);
59
- const hoverStyle =
60
- variant === "primary"
61
- ? { background: hover ? palette.brand.primaryHover : palette.brand.primary }
62
- : variant === "outline"
63
- ? { borderColor: hover ? palette.brand.primaryHover : palette.brand.primary }
64
- : { background: hover ? "rgba(37, 99, 235, 0.08)" : "transparent" };
65
- return /* @__PURE__ */ jsx("button", {
66
- ref,
67
- className: cx("rui-btn", className),
68
- style: { ...base, ...sizes[size], ...styleFor(variant), ...(hover ? hoverStyle : {}), ...style },
69
- onMouseEnter: (e) => {
70
- setHover(true);
71
- onMouseEnter?.(e);
72
- },
73
- onMouseLeave: (e) => {
74
- setHover(false);
75
- onMouseLeave?.(e);
76
- },
77
- ...props,
78
- });
79
- });
56
+ var Button = React.forwardRef(
57
+ ({ variant = "primary", size = "md", style, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
58
+ const [hover, setHover] = React.useState(false);
59
+ const hoverStyle = variant === "primary" ? { background: hover ? palette.brand.primaryHover : palette.brand.primary } : variant === "outline" ? { borderColor: hover ? palette.brand.primaryHover : palette.brand.primary } : { background: hover ? "rgba(37, 99, 235, 0.08)" : "transparent" };
60
+ return /* @__PURE__ */ jsx(
61
+ "button",
62
+ {
63
+ ref,
64
+ className: cx("rui-btn", className),
65
+ style: { ...base, ...sizes[size], ...styleFor(variant), ...hover ? hoverStyle : {}, ...style },
66
+ onMouseEnter: (e) => {
67
+ setHover(true);
68
+ onMouseEnter?.(e);
69
+ },
70
+ onMouseLeave: (e) => {
71
+ setHover(false);
72
+ onMouseLeave?.(e);
73
+ },
74
+ ...props
75
+ }
76
+ );
77
+ }
78
+ );
80
79
  Button.displayName = "Button";
81
80
  var useChatbot = (options = {}) => {
82
81
  const { mcpUrl, apiKey } = options;
@@ -92,7 +91,7 @@ var useChatbot = (options = {}) => {
92
91
  id: generateId(),
93
92
  content,
94
93
  role,
95
- timestamp: /* @__PURE__ */ new Date(),
94
+ timestamp: /* @__PURE__ */ new Date()
96
95
  };
97
96
  setMessages((prev) => [...prev, newMessage]);
98
97
  return newMessage;
@@ -103,38 +102,21 @@ var useChatbot = (options = {}) => {
103
102
  setIsLoading(true);
104
103
  try {
105
104
  let resp;
106
- if (options.userToken) {
107
- resp = await client.responses.create({
108
- model: "gpt-5",
109
- tools: [
110
- {
111
- type: "mcp",
112
- server_label: "aizek-mcp",
113
- server_url: mcpUrl,
114
- require_approval: "never",
115
- headers: {
116
- Authorization: `Bearer ${options.userToken}`,
117
- },
118
- },
119
- ],
120
- input: message,
121
- previous_response_id: responseId || void 0,
122
- });
123
- } else {
124
- resp = await client.responses.create({
125
- model: "gpt-5",
126
- tools: [
127
- {
128
- type: "mcp",
129
- server_label: "aizek-mcp",
130
- server_url: mcpUrl,
131
- require_approval: "never",
132
- },
133
- ],
134
- input: message,
135
- previous_response_id: responseId || void 0,
136
- });
137
- }
105
+ console.log(options.headers);
106
+ resp = await client.responses.create({
107
+ model: "gpt-5",
108
+ tools: [
109
+ {
110
+ type: "mcp",
111
+ server_label: "aizek-mcp",
112
+ server_url: mcpUrl,
113
+ require_approval: "never",
114
+ headers: options.headers || {}
115
+ }
116
+ ],
117
+ input: message,
118
+ previous_response_id: responseId || void 0
119
+ });
138
120
  setResponseId(resp.id);
139
121
  let responseText = "";
140
122
  if (resp && Array.isArray(resp)) {
@@ -167,7 +149,7 @@ var useChatbot = (options = {}) => {
167
149
  messages,
168
150
  isLoading,
169
151
  sendMessage,
170
- addMessage,
152
+ addMessage
171
153
  };
172
154
  };
173
155
 
@@ -178,8 +160,8 @@ var fetchChatWidgetSettings = async (clientId) => {
178
160
  const response = await fetch(`${API_BASE_URL}/ChatWidgetSettings/GetByClientId?client_id=${clientId}`, {
179
161
  method: "GET",
180
162
  headers: {
181
- "Content-Type": "application/json",
182
- },
163
+ "Content-Type": "application/json"
164
+ }
183
165
  });
184
166
  if (!response.ok) {
185
167
  throw new Error(`HTTP error! status: ${response.status}`);
@@ -196,9 +178,9 @@ var mapApiSettingsToConfig = (apiSettings) => {
196
178
  return null;
197
179
  }
198
180
  const buttonSizeMap = {
199
- small: "sm",
200
- medium: "md",
201
- large: "lg",
181
+ "small": "sm",
182
+ "medium": "md",
183
+ "large": "lg"
202
184
  };
203
185
  return {
204
186
  welcomeMessage: apiSettings.welcome_message,
@@ -212,7 +194,7 @@ var mapApiSettingsToConfig = (apiSettings) => {
212
194
  initialOpen: apiSettings.initial_open,
213
195
  headerBackground: apiSettings.header_background,
214
196
  companyLogo: apiSettings.company_logo || void 0,
215
- companyName: apiSettings.company_name,
197
+ companyName: apiSettings.company_name
216
198
  };
217
199
  };
218
200
 
@@ -226,29 +208,27 @@ var getMessageBubbleStyles = (isUser) => ({
226
208
  lineHeight: 1.4,
227
209
  fontSize: "14px",
228
210
  position: "relative",
229
- ...(isUser
230
- ? {
231
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
232
- color: "#ffffff",
233
- marginLeft: "auto",
234
- marginRight: "0",
235
- }
236
- : {
237
- background: "#f8fafc",
238
- color: "#334155",
239
- border: "1px solid #e2e8f0",
240
- marginLeft: "0",
241
- marginRight: "auto",
242
- }),
211
+ ...isUser ? {
212
+ background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
213
+ color: "#ffffff",
214
+ marginLeft: "auto",
215
+ marginRight: "0"
216
+ } : {
217
+ background: "#f8fafc",
218
+ color: "#334155",
219
+ border: "1px solid #e2e8f0",
220
+ marginLeft: "0",
221
+ marginRight: "auto"
222
+ }
243
223
  });
244
224
  var getTimeStyles = (isUser) => ({
245
225
  fontSize: "11px",
246
226
  opacity: 0.7,
247
227
  marginTop: "4px",
248
- textAlign: isUser ? "right" : "left",
228
+ textAlign: isUser ? "right" : "left"
249
229
  });
250
230
  var getMarkdownStyles = () => ({
251
- lineHeight: 1.6,
231
+ lineHeight: 1.6
252
232
  });
253
233
  var getMarkdownElementStyles = (isUser) => `
254
234
  .markdown-content p {
@@ -409,7 +389,7 @@ var getMessageContainerStyles = (isUser) => ({
409
389
  display: "flex",
410
390
  flexDirection: "column",
411
391
  alignItems: isUser ? "flex-end" : "flex-start",
412
- width: "100%",
392
+ width: "100%"
413
393
  });
414
394
 
415
395
  // src/styles/inputStyles.ts
@@ -420,7 +400,7 @@ var getInputContainerStyles = () => ({
420
400
  padding: "16px",
421
401
  background: "#ffffff",
422
402
  borderTop: "1px solid #e2e8f0",
423
- borderRadius: "0 0 12px 12px",
403
+ borderRadius: "0 0 12px 12px"
424
404
  });
425
405
  var getTextareaStyles = (isLoading) => ({
426
406
  flex: 1,
@@ -437,12 +417,10 @@ var getTextareaStyles = (isLoading) => ({
437
417
  fontFamily: "inherit",
438
418
  background: "#f8fafc",
439
419
  color: "#334155",
440
- ...(isLoading
441
- ? {
442
- opacity: 0.6,
443
- cursor: "not-allowed",
444
- }
445
- : {}),
420
+ ...isLoading ? {
421
+ opacity: 0.6,
422
+ cursor: "not-allowed"
423
+ } : {}
446
424
  });
447
425
  var getSendButtonStyles = (isLoading, hasMessage) => ({
448
426
  width: "44px",
@@ -456,7 +434,7 @@ var getSendButtonStyles = (isLoading, hasMessage) => ({
456
434
  alignItems: "center",
457
435
  justifyContent: "center",
458
436
  transition: "all 0.2s ease",
459
- fontSize: "16px",
437
+ fontSize: "16px"
460
438
  });
461
439
 
462
440
  // src/styles/headerStyles.ts
@@ -466,7 +444,7 @@ var getHeaderStyles = (headerBackground) => ({
466
444
  color: "#ffffff",
467
445
  display: "flex",
468
446
  alignItems: "center",
469
- gap: "12px",
447
+ gap: "12px"
470
448
  });
471
449
  var getLogoContainerStyles = () => ({
472
450
  width: "40px",
@@ -477,34 +455,34 @@ var getLogoContainerStyles = () => ({
477
455
  alignItems: "center",
478
456
  justifyContent: "center",
479
457
  fontSize: "18px",
480
- overflow: "hidden",
458
+ overflow: "hidden"
481
459
  });
482
460
  var getLogoImageStyles = () => ({
483
461
  width: "100%",
484
462
  height: "100%",
485
463
  objectFit: "cover",
486
- borderRadius: "50%",
464
+ borderRadius: "50%"
487
465
  });
488
466
  var getLogoTextStyles = () => ({
489
467
  fontSize: "16px",
490
- fontWeight: "bold",
468
+ fontWeight: "bold"
491
469
  });
492
470
  var getCompanyNameStyles = () => ({
493
471
  margin: 0,
494
472
  fontSize: "16px",
495
- fontWeight: 600,
473
+ fontWeight: 600
496
474
  });
497
475
  var getStatusTextStyles = () => ({
498
476
  margin: 0,
499
477
  fontSize: "12px",
500
- opacity: 0.8,
478
+ opacity: 0.8
501
479
  });
502
480
 
503
481
  // src/styles/containerStyles.ts
504
482
  var getButtonSizes = () => ({
505
483
  sm: { width: "50px", height: "50px", fontSize: "20px" },
506
484
  md: { width: "60px", height: "60px", fontSize: "24px" },
507
- lg: { width: "70px", height: "70px", fontSize: "28px" },
485
+ lg: { width: "70px", height: "70px", fontSize: "28px" }
508
486
  });
509
487
  var getFloatingButtonStyles = (buttonPosition, buttonSize, buttonBackground, isOpen) => {
510
488
  const buttonSizes = getButtonSizes();
@@ -527,7 +505,7 @@ var getFloatingButtonStyles = (buttonPosition, buttonSize, buttonBackground, isO
527
505
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
528
506
  transition: "all 0.3s ease",
529
507
  zIndex: 1e3,
530
- transform: isOpen ? "scale(0.9)" : "scale(1)",
508
+ transform: isOpen ? "scale(0.9)" : "scale(1)"
531
509
  };
532
510
  };
533
511
  var getChatContainerStyles = (buttonPosition, chatWidth, chatHeight, isOpen) => ({
@@ -541,7 +519,7 @@ var getChatContainerStyles = (buttonPosition, chatWidth, chatHeight, isOpen) =>
541
519
  opacity: isOpen ? 1 : 0,
542
520
  visibility: isOpen ? "visible" : "hidden",
543
521
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
544
- transformOrigin: buttonPosition === "bottom-left" ? "bottom left" : "bottom right",
522
+ transformOrigin: buttonPosition === "bottom-left" ? "bottom left" : "bottom right"
545
523
  });
546
524
  var getOverlayStyles = (isOpen) => ({
547
525
  position: "fixed",
@@ -553,7 +531,7 @@ var getOverlayStyles = (isOpen) => ({
553
531
  zIndex: 998,
554
532
  opacity: isOpen ? 1 : 0,
555
533
  visibility: isOpen ? "visible" : "hidden",
556
- transition: "all 0.3s ease",
534
+ transition: "all 0.3s ease"
557
535
  });
558
536
  var getChatbotContainerStyles = () => ({
559
537
  display: "flex",
@@ -563,7 +541,7 @@ var getChatbotContainerStyles = () => ({
563
541
  borderRadius: "12px",
564
542
  boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
565
543
  border: "1px solid #e2e8f0",
566
- overflow: "hidden",
544
+ overflow: "hidden"
567
545
  });
568
546
  var getMessagesContainerStyles = () => ({
569
547
  flex: 1,
@@ -572,7 +550,7 @@ var getMessagesContainerStyles = () => ({
572
550
  display: "flex",
573
551
  flexDirection: "column",
574
552
  gap: "4px",
575
- background: "#f8fafc",
553
+ background: "#f8fafc"
576
554
  });
577
555
  var getEmptyStateStyles = () => ({
578
556
  display: "flex",
@@ -582,7 +560,7 @@ var getEmptyStateStyles = () => ({
582
560
  height: "100%",
583
561
  color: "#64748b",
584
562
  textAlign: "center",
585
- padding: "40px 20px",
563
+ padding: "40px 20px"
586
564
  });
587
565
 
588
566
  // src/styles/loadingStyles.ts
@@ -592,9 +570,9 @@ var getLoadingSpinnerStyles = () => ({
592
570
  border: "2px solid transparent",
593
571
  borderTop: "2px solid currentColor",
594
572
  borderRadius: "50%",
595
- animation: "spin 1s linear infinite",
573
+ animation: "spin 1s linear infinite"
596
574
  });
597
- var AizekChatBot = ({ clientId, userToken }) => {
575
+ var AizekChatBot = ({ clientId, headers }) => {
598
576
  const defaultConfig = {
599
577
  welcomeMessage: "Merhaba! Size nas\u0131l yard\u0131mc\u0131 olabilirim?",
600
578
  buttonBackground: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
@@ -607,7 +585,7 @@ var AizekChatBot = ({ clientId, userToken }) => {
607
585
  initialOpen: true,
608
586
  headerBackground: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
609
587
  companyLogo: void 0,
610
- companyName: "AI Asistan",
588
+ companyName: "AI Asistan"
611
589
  };
612
590
  const [config, setConfig] = useState(defaultConfig);
613
591
  const [isConfigLoading, setIsConfigLoading] = useState(true);
@@ -635,7 +613,7 @@ var AizekChatBot = ({ clientId, userToken }) => {
635
613
  };
636
614
  loadConfig();
637
615
  }, [clientId]);
638
- const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, userToken });
616
+ const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, headers });
639
617
  const messages = internalChatbot.messages;
640
618
  const isLoading = internalChatbot.isLoading;
641
619
  const handleSendMessage = internalChatbot.sendMessage;
@@ -652,34 +630,21 @@ var AizekChatBot = ({ clientId, userToken }) => {
652
630
  }, [messages]);
653
631
  const MessageBubble = ({ message }) => {
654
632
  const isUser = message.role === "user";
655
- return /* @__PURE__ */ jsxs("div", {
656
- style: getMessageContainerStyles(isUser),
657
- children: [
658
- /* @__PURE__ */ jsx("style", { children: getMarkdownElementStyles(isUser) }),
659
- /* @__PURE__ */ jsxs("div", {
660
- style: getMessageBubbleStyles(isUser),
661
- children: [
662
- /* @__PURE__ */ jsx("div", { style: getMarkdownStyles(), className: "markdown-content", children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: message.content }) }),
663
- message.isTyping &&
664
- /* @__PURE__ */ jsx("div", {
665
- style: {
666
- display: "inline-flex",
667
- alignItems: "center",
668
- marginLeft: "8px",
669
- },
670
- children: /* @__PURE__ */ jsx(TypingDots, {}),
671
- }),
672
- ],
673
- }),
674
- /* @__PURE__ */ jsx("div", {
675
- style: getTimeStyles(isUser),
676
- children: message.timestamp.toLocaleTimeString("tr-TR", {
677
- hour: "2-digit",
678
- minute: "2-digit",
679
- }),
680
- }),
681
- ],
682
- });
633
+ return /* @__PURE__ */ jsxs("div", { style: getMessageContainerStyles(isUser), children: [
634
+ /* @__PURE__ */ jsx("style", { children: getMarkdownElementStyles(isUser) }),
635
+ /* @__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 }) }),
637
+ message.isTyping && /* @__PURE__ */ jsx("div", { style: {
638
+ display: "inline-flex",
639
+ alignItems: "center",
640
+ marginLeft: "8px"
641
+ }, children: /* @__PURE__ */ jsx(TypingDots, {}) })
642
+ ] }),
643
+ /* @__PURE__ */ jsx("div", { style: getTimeStyles(isUser), children: message.timestamp.toLocaleTimeString("tr-TR", {
644
+ hour: "2-digit",
645
+ minute: "2-digit"
646
+ }) })
647
+ ] });
683
648
  };
684
649
  const TypingDots = () => {
685
650
  const [dots, setDots] = useState("");
@@ -719,20 +684,22 @@ var AizekChatBot = ({ clientId, userToken }) => {
719
684
  textarea.style.height = "auto";
720
685
  textarea.style.height = Math.min(textarea.scrollHeight, 120) + "px";
721
686
  };
722
- return /* @__PURE__ */ jsxs("form", {
723
- onSubmit: handleSubmit,
724
- style: getInputContainerStyles(),
725
- children: [
726
- /* @__PURE__ */ jsx("textarea", {
687
+ return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, style: getInputContainerStyles(), children: [
688
+ /* @__PURE__ */ jsx(
689
+ "textarea",
690
+ {
727
691
  ref: textareaRef,
728
692
  value: message,
729
693
  onChange: handleInputChange,
730
694
  onKeyDown: handleKeyDown,
731
695
  placeholder,
732
696
  disabled: isLoading,
733
- style: getTextareaStyles(isLoading),
734
- }),
735
- /* @__PURE__ */ jsx("button", {
697
+ style: getTextareaStyles(isLoading)
698
+ }
699
+ ),
700
+ /* @__PURE__ */ jsx(
701
+ "button",
702
+ {
736
703
  type: "submit",
737
704
  disabled: isLoading || !message.trim(),
738
705
  style: getSendButtonStyles(isLoading, !!message.trim()),
@@ -744,12 +711,10 @@ var AizekChatBot = ({ clientId, userToken }) => {
744
711
  onMouseLeave: (e) => {
745
712
  e.currentTarget.style.transform = "scale(1)";
746
713
  },
747
- children: isLoading
748
- ? /* @__PURE__ */ jsx(LoadingSpinner, {})
749
- : /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) }),
750
- }),
751
- ],
752
- });
714
+ children: isLoading ? /* @__PURE__ */ jsx(LoadingSpinner, {}) : /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) })
715
+ }
716
+ )
717
+ ] });
753
718
  };
754
719
  const LoadingSpinner = () => {
755
720
  return /* @__PURE__ */ jsx("div", { style: getLoadingSpinnerStyles() });
@@ -757,73 +722,55 @@ var AizekChatBot = ({ clientId, userToken }) => {
757
722
  if (isConfigLoading) {
758
723
  return /* @__PURE__ */ jsx("div", { style: getFloatingButtonStyles(buttonPosition, buttonSize, buttonBackground, false), children: /* @__PURE__ */ jsx("div", { style: getLoadingSpinnerStyles() }) });
759
724
  }
760
- return /* @__PURE__ */ jsxs(Fragment, {
761
- children: [
762
- isOpen &&
763
- /* @__PURE__ */ jsx("div", {
764
- style: getOverlayStyles(isOpen),
765
- onClick: toggleChat,
766
- className: "floating-chat-overlay",
767
- }),
768
- /* @__PURE__ */ jsx("div", {
769
- style: getChatContainerStyles(buttonPosition, chatWidth, chatHeight, isOpen),
770
- className: "floating-chat-container",
771
- children: /* @__PURE__ */ jsxs("div", {
772
- style: getChatbotContainerStyles(),
773
- children: [
774
- /* @__PURE__ */ jsxs("div", {
775
- style: getHeaderStyles(headerBackground),
776
- children: [
777
- /* @__PURE__ */ jsx("div", {
778
- style: getLogoContainerStyles(),
779
- children: companyLogo
780
- ? companyLogo.startsWith("http") || companyLogo.startsWith("data:")
781
- ? /* @__PURE__ */ jsx("img", {
782
- src: companyLogo,
783
- alt: "Company Logo",
784
- style: getLogoImageStyles(),
785
- })
786
- : /* @__PURE__ */ jsx("span", { style: getLogoTextStyles(), children: companyLogo })
787
- : "\u{1F916}",
788
- }),
789
- /* @__PURE__ */ jsxs("div", {
790
- children: [/* @__PURE__ */ jsx("h3", { style: getCompanyNameStyles(), children: companyName }), /* @__PURE__ */ jsx("p", { style: getStatusTextStyles(), children: isLoading ? "Yaz\u0131yor..." : "\xC7evrimi\xE7i" })],
791
- }),
792
- ],
793
- }),
794
- /* @__PURE__ */ jsxs("div", {
795
- style: getMessagesContainerStyles(),
796
- children: [
797
- messages.length === 0
798
- ? /* @__PURE__ */ jsxs("div", {
799
- style: getEmptyStateStyles(),
800
- children: [
801
- /* @__PURE__ */ jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "\u{1F4AC}" }),
802
- /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: welcomeMessage }),
803
- /* @__PURE__ */ jsx("p", { style: { margin: 0, fontSize: "14px", opacity: 0.8 }, children: "A\u015Fa\u011F\u0131daki alana mesaj\u0131n\u0131z\u0131 yazarak ba\u015Flayabilirsiniz." }),
804
- ],
805
- })
806
- : messages.map((message) => /* @__PURE__ */ jsx(MessageBubble, { message }, message.id)),
807
- showTypingIndicator &&
808
- isLoading &&
809
- messages.length > 0 &&
810
- /* @__PURE__ */ jsx(MessageBubble, {
811
- message: {
812
- id: "typing",
813
- content: "",
814
- role: "assistant",
815
- timestamp: /* @__PURE__ */ new Date(),
816
- isTyping: true,
817
- },
818
- }),
819
- /* @__PURE__ */ jsx("div", { ref: messagesEndRef }),
820
- ],
821
- }),
822
- /* @__PURE__ */ jsx(ChatInput, {}),
823
- ],
824
- }),
825
- }),
826
- /* @__PURE__ */ jsx("button", {
725
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
726
+ isOpen && /* @__PURE__ */ jsx(
727
+ "div",
728
+ {
729
+ style: getOverlayStyles(isOpen),
730
+ onClick: toggleChat,
731
+ className: "floating-chat-overlay"
732
+ }
733
+ ),
734
+ /* @__PURE__ */ jsx("div", { style: getChatContainerStyles(buttonPosition, chatWidth, chatHeight, isOpen), className: "floating-chat-container", children: /* @__PURE__ */ jsxs("div", { style: getChatbotContainerStyles(), children: [
735
+ /* @__PURE__ */ jsxs("div", { style: getHeaderStyles(headerBackground), children: [
736
+ /* @__PURE__ */ jsx("div", { style: getLogoContainerStyles(), children: companyLogo ? companyLogo.startsWith("http") || companyLogo.startsWith("data:") ? /* @__PURE__ */ jsx(
737
+ "img",
738
+ {
739
+ src: companyLogo,
740
+ alt: "Company Logo",
741
+ style: getLogoImageStyles()
742
+ }
743
+ ) : /* @__PURE__ */ jsx("span", { style: getLogoTextStyles(), children: companyLogo }) : "\u{1F916}" }),
744
+ /* @__PURE__ */ jsxs("div", { children: [
745
+ /* @__PURE__ */ jsx("h3", { style: getCompanyNameStyles(), children: companyName }),
746
+ /* @__PURE__ */ jsx("p", { style: getStatusTextStyles(), children: isLoading ? "Yaz\u0131yor..." : "\xC7evrimi\xE7i" })
747
+ ] })
748
+ ] }),
749
+ /* @__PURE__ */ jsxs("div", { style: getMessagesContainerStyles(), children: [
750
+ messages.length === 0 ? /* @__PURE__ */ jsxs("div", { style: getEmptyStateStyles(), children: [
751
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "\u{1F4AC}" }),
752
+ /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: welcomeMessage }),
753
+ /* @__PURE__ */ jsx("p", { style: { margin: 0, fontSize: "14px", opacity: 0.8 }, children: "A\u015Fa\u011F\u0131daki alana mesaj\u0131n\u0131z\u0131 yazarak ba\u015Flayabilirsiniz." })
754
+ ] }) : messages.map((message) => /* @__PURE__ */ jsx(MessageBubble, { message }, message.id)),
755
+ showTypingIndicator && isLoading && messages.length > 0 && /* @__PURE__ */ jsx(
756
+ MessageBubble,
757
+ {
758
+ message: {
759
+ id: "typing",
760
+ content: "",
761
+ role: "assistant",
762
+ timestamp: /* @__PURE__ */ new Date(),
763
+ isTyping: true
764
+ }
765
+ }
766
+ ),
767
+ /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
768
+ ] }),
769
+ /* @__PURE__ */ jsx(ChatInput, {})
770
+ ] }) }),
771
+ /* @__PURE__ */ jsx(
772
+ "button",
773
+ {
827
774
  onClick: toggleChat,
828
775
  style: getFloatingButtonStyles(buttonPosition, buttonSize, buttonBackground, isOpen),
829
776
  onMouseEnter: (e) => {
@@ -836,26 +783,12 @@ var AizekChatBot = ({ clientId, userToken }) => {
836
783
  },
837
784
  className: "floating-chat-button",
838
785
  "aria-label": isOpen ? "Chati kapat" : "Chati a\xE7",
839
- children: isOpen
840
- ? /* @__PURE__ */ jsx("svg", {
841
- width: "24",
842
- height: "24",
843
- viewBox: "0 0 24 24",
844
- fill: "currentColor",
845
- 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" }),
846
- })
847
- : /* @__PURE__ */ jsx("svg", {
848
- width: "24",
849
- height: "24",
850
- viewBox: "0 0 24 24",
851
- fill: "currentColor",
852
- children: /* @__PURE__ */ jsx("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4l4 4 4-4h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z" }),
853
- }),
854
- }),
855
- ],
856
- });
786
+ children: isOpen ? /* @__PURE__ */ jsx("svg", { width: "24", height: "24", 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" }) }) : /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4l4 4 4-4h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z" }) })
787
+ }
788
+ )
789
+ ] });
857
790
  };
858
791
 
859
792
  export { AizekChatBot, Button, useChatbot };
860
793
  //# sourceMappingURL=index.mjs.map
861
- //# sourceMappingURL=index.mjs.map
794
+ //# sourceMappingURL=index.mjs.map