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.cjs CHANGED
@@ -1,35 +1,24 @@
1
- "use client";
2
- "use strict";
1
+ 'use strict';
3
2
 
4
- var React = require("react");
5
- var jsxRuntime = require("react/jsx-runtime");
6
- var OpenAI = require("openai");
7
- var ReactMarkdown = require("react-markdown");
8
- var remarkGfm = require("remark-gfm");
3
+ var React = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var OpenAI = require('openai');
6
+ var ReactMarkdown = require('react-markdown');
7
+ var remarkGfm = require('remark-gfm');
9
8
 
10
- function _interopDefault(e) {
11
- return e && e.__esModule ? e : { default: e };
12
- }
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
10
 
14
11
  function _interopNamespace(e) {
15
12
  if (e && e.__esModule) return e;
16
13
  var n = Object.create(null);
17
14
  if (e) {
18
15
  Object.keys(e).forEach(function (k) {
19
- if (k !== "default") {
16
+ if (k !== 'default') {
20
17
  var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(
22
- n,
23
- k,
24
- d.get
25
- ? d
26
- : {
27
- enumerable: true,
28
- get: function () {
29
- return e[k];
30
- },
31
- }
32
- );
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
33
22
  }
34
23
  });
35
24
  }
@@ -37,10 +26,10 @@ function _interopNamespace(e) {
37
26
  return Object.freeze(n);
38
27
  }
39
28
 
40
- var React__namespace = /*#__PURE__*/ _interopNamespace(React);
41
- var OpenAI__default = /*#__PURE__*/ _interopDefault(OpenAI);
42
- var ReactMarkdown__default = /*#__PURE__*/ _interopDefault(ReactMarkdown);
43
- var remarkGfm__default = /*#__PURE__*/ _interopDefault(remarkGfm);
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+ var OpenAI__default = /*#__PURE__*/_interopDefault(OpenAI);
31
+ var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
32
+ var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
44
33
 
45
34
  // src/utils/cx.ts
46
35
  function cx(...args) {
@@ -55,18 +44,18 @@ var base = {
55
44
  lineHeight: 1,
56
45
  transition: "background-color .2s ease, color .2s ease, border-color .2s ease",
57
46
  outline: "none",
58
- cursor: "pointer",
47
+ cursor: "pointer"
59
48
  };
60
49
  var sizes = {
61
50
  sm: { height: 36, padding: "0 12px", fontSize: 14 },
62
51
  md: { height: 40, padding: "0 16px", fontSize: 16 },
63
- lg: { height: 44, padding: "0 20px", fontSize: 18 },
52
+ lg: { height: 44, padding: "0 20px", fontSize: 18 }
64
53
  };
65
54
  var palette = {
66
55
  brand: {
67
56
  primary: "#2563eb",
68
- primaryHover: "#1d4ed8",
69
- },
57
+ primaryHover: "#1d4ed8"
58
+ }
70
59
  };
71
60
  function styleFor(variant) {
72
61
  switch (variant) {
@@ -74,45 +63,45 @@ function styleFor(variant) {
74
63
  return {
75
64
  background: "transparent",
76
65
  color: palette.brand.primary,
77
- border: `1px solid ${palette.brand.primary}`,
66
+ border: `1px solid ${palette.brand.primary}`
78
67
  };
79
68
  case "ghost":
80
69
  return {
81
70
  background: "transparent",
82
71
  color: palette.brand.primary,
83
- border: "1px solid transparent",
72
+ border: "1px solid transparent"
84
73
  };
85
74
  default:
86
75
  return {
87
76
  background: palette.brand.primary,
88
77
  color: "#fff",
89
- border: "1px solid transparent",
78
+ border: "1px solid transparent"
90
79
  };
91
80
  }
92
81
  }
93
- var Button = React__namespace.forwardRef(({ variant = "primary", size = "md", style, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
94
- const [hover, setHover] = React__namespace.useState(false);
95
- const hoverStyle =
96
- variant === "primary"
97
- ? { background: hover ? palette.brand.primaryHover : palette.brand.primary }
98
- : variant === "outline"
99
- ? { borderColor: hover ? palette.brand.primaryHover : palette.brand.primary }
100
- : { background: hover ? "rgba(37, 99, 235, 0.08)" : "transparent" };
101
- return /* @__PURE__ */ jsxRuntime.jsx("button", {
102
- ref,
103
- className: cx("rui-btn", className),
104
- style: { ...base, ...sizes[size], ...styleFor(variant), ...(hover ? hoverStyle : {}), ...style },
105
- onMouseEnter: (e) => {
106
- setHover(true);
107
- onMouseEnter?.(e);
108
- },
109
- onMouseLeave: (e) => {
110
- setHover(false);
111
- onMouseLeave?.(e);
112
- },
113
- ...props,
114
- });
115
- });
82
+ var Button = React__namespace.forwardRef(
83
+ ({ variant = "primary", size = "md", style, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
84
+ const [hover, setHover] = React__namespace.useState(false);
85
+ 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" };
86
+ return /* @__PURE__ */ jsxRuntime.jsx(
87
+ "button",
88
+ {
89
+ ref,
90
+ className: cx("rui-btn", className),
91
+ style: { ...base, ...sizes[size], ...styleFor(variant), ...hover ? hoverStyle : {}, ...style },
92
+ onMouseEnter: (e) => {
93
+ setHover(true);
94
+ onMouseEnter?.(e);
95
+ },
96
+ onMouseLeave: (e) => {
97
+ setHover(false);
98
+ onMouseLeave?.(e);
99
+ },
100
+ ...props
101
+ }
102
+ );
103
+ }
104
+ );
116
105
  Button.displayName = "Button";
117
106
  var useChatbot = (options = {}) => {
118
107
  const { mcpUrl, apiKey } = options;
@@ -128,7 +117,7 @@ var useChatbot = (options = {}) => {
128
117
  id: generateId(),
129
118
  content,
130
119
  role,
131
- timestamp: /* @__PURE__ */ new Date(),
120
+ timestamp: /* @__PURE__ */ new Date()
132
121
  };
133
122
  setMessages((prev) => [...prev, newMessage]);
134
123
  return newMessage;
@@ -139,38 +128,21 @@ var useChatbot = (options = {}) => {
139
128
  setIsLoading(true);
140
129
  try {
141
130
  let resp;
142
- if (options.userToken) {
143
- resp = await client.responses.create({
144
- model: "gpt-5",
145
- tools: [
146
- {
147
- type: "mcp",
148
- server_label: "aizek-mcp",
149
- server_url: mcpUrl,
150
- require_approval: "never",
151
- headers: {
152
- Authorization: `Bearer ${options.userToken}`,
153
- },
154
- },
155
- ],
156
- input: message,
157
- previous_response_id: responseId || void 0,
158
- });
159
- } else {
160
- resp = await client.responses.create({
161
- model: "gpt-5",
162
- tools: [
163
- {
164
- type: "mcp",
165
- server_label: "aizek-mcp",
166
- server_url: mcpUrl,
167
- require_approval: "never",
168
- },
169
- ],
170
- input: message,
171
- previous_response_id: responseId || void 0,
172
- });
173
- }
131
+ console.log(options.headers);
132
+ resp = await client.responses.create({
133
+ model: "gpt-5",
134
+ tools: [
135
+ {
136
+ type: "mcp",
137
+ server_label: "aizek-mcp",
138
+ server_url: mcpUrl,
139
+ require_approval: "never",
140
+ headers: options.headers || {}
141
+ }
142
+ ],
143
+ input: message,
144
+ previous_response_id: responseId || void 0
145
+ });
174
146
  setResponseId(resp.id);
175
147
  let responseText = "";
176
148
  if (resp && Array.isArray(resp)) {
@@ -203,7 +175,7 @@ var useChatbot = (options = {}) => {
203
175
  messages,
204
176
  isLoading,
205
177
  sendMessage,
206
- addMessage,
178
+ addMessage
207
179
  };
208
180
  };
209
181
 
@@ -214,8 +186,8 @@ var fetchChatWidgetSettings = async (clientId) => {
214
186
  const response = await fetch(`${API_BASE_URL}/ChatWidgetSettings/GetByClientId?client_id=${clientId}`, {
215
187
  method: "GET",
216
188
  headers: {
217
- "Content-Type": "application/json",
218
- },
189
+ "Content-Type": "application/json"
190
+ }
219
191
  });
220
192
  if (!response.ok) {
221
193
  throw new Error(`HTTP error! status: ${response.status}`);
@@ -232,9 +204,9 @@ var mapApiSettingsToConfig = (apiSettings) => {
232
204
  return null;
233
205
  }
234
206
  const buttonSizeMap = {
235
- small: "sm",
236
- medium: "md",
237
- large: "lg",
207
+ "small": "sm",
208
+ "medium": "md",
209
+ "large": "lg"
238
210
  };
239
211
  return {
240
212
  welcomeMessage: apiSettings.welcome_message,
@@ -248,7 +220,7 @@ var mapApiSettingsToConfig = (apiSettings) => {
248
220
  initialOpen: apiSettings.initial_open,
249
221
  headerBackground: apiSettings.header_background,
250
222
  companyLogo: apiSettings.company_logo || void 0,
251
- companyName: apiSettings.company_name,
223
+ companyName: apiSettings.company_name
252
224
  };
253
225
  };
254
226
 
@@ -262,29 +234,27 @@ var getMessageBubbleStyles = (isUser) => ({
262
234
  lineHeight: 1.4,
263
235
  fontSize: "14px",
264
236
  position: "relative",
265
- ...(isUser
266
- ? {
267
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
268
- color: "#ffffff",
269
- marginLeft: "auto",
270
- marginRight: "0",
271
- }
272
- : {
273
- background: "#f8fafc",
274
- color: "#334155",
275
- border: "1px solid #e2e8f0",
276
- marginLeft: "0",
277
- marginRight: "auto",
278
- }),
237
+ ...isUser ? {
238
+ background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
239
+ color: "#ffffff",
240
+ marginLeft: "auto",
241
+ marginRight: "0"
242
+ } : {
243
+ background: "#f8fafc",
244
+ color: "#334155",
245
+ border: "1px solid #e2e8f0",
246
+ marginLeft: "0",
247
+ marginRight: "auto"
248
+ }
279
249
  });
280
250
  var getTimeStyles = (isUser) => ({
281
251
  fontSize: "11px",
282
252
  opacity: 0.7,
283
253
  marginTop: "4px",
284
- textAlign: isUser ? "right" : "left",
254
+ textAlign: isUser ? "right" : "left"
285
255
  });
286
256
  var getMarkdownStyles = () => ({
287
- lineHeight: 1.6,
257
+ lineHeight: 1.6
288
258
  });
289
259
  var getMarkdownElementStyles = (isUser) => `
290
260
  .markdown-content p {
@@ -445,7 +415,7 @@ var getMessageContainerStyles = (isUser) => ({
445
415
  display: "flex",
446
416
  flexDirection: "column",
447
417
  alignItems: isUser ? "flex-end" : "flex-start",
448
- width: "100%",
418
+ width: "100%"
449
419
  });
450
420
 
451
421
  // src/styles/inputStyles.ts
@@ -456,7 +426,7 @@ var getInputContainerStyles = () => ({
456
426
  padding: "16px",
457
427
  background: "#ffffff",
458
428
  borderTop: "1px solid #e2e8f0",
459
- borderRadius: "0 0 12px 12px",
429
+ borderRadius: "0 0 12px 12px"
460
430
  });
461
431
  var getTextareaStyles = (isLoading) => ({
462
432
  flex: 1,
@@ -473,12 +443,10 @@ var getTextareaStyles = (isLoading) => ({
473
443
  fontFamily: "inherit",
474
444
  background: "#f8fafc",
475
445
  color: "#334155",
476
- ...(isLoading
477
- ? {
478
- opacity: 0.6,
479
- cursor: "not-allowed",
480
- }
481
- : {}),
446
+ ...isLoading ? {
447
+ opacity: 0.6,
448
+ cursor: "not-allowed"
449
+ } : {}
482
450
  });
483
451
  var getSendButtonStyles = (isLoading, hasMessage) => ({
484
452
  width: "44px",
@@ -492,7 +460,7 @@ var getSendButtonStyles = (isLoading, hasMessage) => ({
492
460
  alignItems: "center",
493
461
  justifyContent: "center",
494
462
  transition: "all 0.2s ease",
495
- fontSize: "16px",
463
+ fontSize: "16px"
496
464
  });
497
465
 
498
466
  // src/styles/headerStyles.ts
@@ -502,7 +470,7 @@ var getHeaderStyles = (headerBackground) => ({
502
470
  color: "#ffffff",
503
471
  display: "flex",
504
472
  alignItems: "center",
505
- gap: "12px",
473
+ gap: "12px"
506
474
  });
507
475
  var getLogoContainerStyles = () => ({
508
476
  width: "40px",
@@ -513,34 +481,34 @@ var getLogoContainerStyles = () => ({
513
481
  alignItems: "center",
514
482
  justifyContent: "center",
515
483
  fontSize: "18px",
516
- overflow: "hidden",
484
+ overflow: "hidden"
517
485
  });
518
486
  var getLogoImageStyles = () => ({
519
487
  width: "100%",
520
488
  height: "100%",
521
489
  objectFit: "cover",
522
- borderRadius: "50%",
490
+ borderRadius: "50%"
523
491
  });
524
492
  var getLogoTextStyles = () => ({
525
493
  fontSize: "16px",
526
- fontWeight: "bold",
494
+ fontWeight: "bold"
527
495
  });
528
496
  var getCompanyNameStyles = () => ({
529
497
  margin: 0,
530
498
  fontSize: "16px",
531
- fontWeight: 600,
499
+ fontWeight: 600
532
500
  });
533
501
  var getStatusTextStyles = () => ({
534
502
  margin: 0,
535
503
  fontSize: "12px",
536
- opacity: 0.8,
504
+ opacity: 0.8
537
505
  });
538
506
 
539
507
  // src/styles/containerStyles.ts
540
508
  var getButtonSizes = () => ({
541
509
  sm: { width: "50px", height: "50px", fontSize: "20px" },
542
510
  md: { width: "60px", height: "60px", fontSize: "24px" },
543
- lg: { width: "70px", height: "70px", fontSize: "28px" },
511
+ lg: { width: "70px", height: "70px", fontSize: "28px" }
544
512
  });
545
513
  var getFloatingButtonStyles = (buttonPosition, buttonSize, buttonBackground, isOpen) => {
546
514
  const buttonSizes = getButtonSizes();
@@ -563,7 +531,7 @@ var getFloatingButtonStyles = (buttonPosition, buttonSize, buttonBackground, isO
563
531
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
564
532
  transition: "all 0.3s ease",
565
533
  zIndex: 1e3,
566
- transform: isOpen ? "scale(0.9)" : "scale(1)",
534
+ transform: isOpen ? "scale(0.9)" : "scale(1)"
567
535
  };
568
536
  };
569
537
  var getChatContainerStyles = (buttonPosition, chatWidth, chatHeight, isOpen) => ({
@@ -577,7 +545,7 @@ var getChatContainerStyles = (buttonPosition, chatWidth, chatHeight, isOpen) =>
577
545
  opacity: isOpen ? 1 : 0,
578
546
  visibility: isOpen ? "visible" : "hidden",
579
547
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
580
- transformOrigin: buttonPosition === "bottom-left" ? "bottom left" : "bottom right",
548
+ transformOrigin: buttonPosition === "bottom-left" ? "bottom left" : "bottom right"
581
549
  });
582
550
  var getOverlayStyles = (isOpen) => ({
583
551
  position: "fixed",
@@ -589,7 +557,7 @@ var getOverlayStyles = (isOpen) => ({
589
557
  zIndex: 998,
590
558
  opacity: isOpen ? 1 : 0,
591
559
  visibility: isOpen ? "visible" : "hidden",
592
- transition: "all 0.3s ease",
560
+ transition: "all 0.3s ease"
593
561
  });
594
562
  var getChatbotContainerStyles = () => ({
595
563
  display: "flex",
@@ -599,7 +567,7 @@ var getChatbotContainerStyles = () => ({
599
567
  borderRadius: "12px",
600
568
  boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
601
569
  border: "1px solid #e2e8f0",
602
- overflow: "hidden",
570
+ overflow: "hidden"
603
571
  });
604
572
  var getMessagesContainerStyles = () => ({
605
573
  flex: 1,
@@ -608,7 +576,7 @@ var getMessagesContainerStyles = () => ({
608
576
  display: "flex",
609
577
  flexDirection: "column",
610
578
  gap: "4px",
611
- background: "#f8fafc",
579
+ background: "#f8fafc"
612
580
  });
613
581
  var getEmptyStateStyles = () => ({
614
582
  display: "flex",
@@ -618,7 +586,7 @@ var getEmptyStateStyles = () => ({
618
586
  height: "100%",
619
587
  color: "#64748b",
620
588
  textAlign: "center",
621
- padding: "40px 20px",
589
+ padding: "40px 20px"
622
590
  });
623
591
 
624
592
  // src/styles/loadingStyles.ts
@@ -628,9 +596,9 @@ var getLoadingSpinnerStyles = () => ({
628
596
  border: "2px solid transparent",
629
597
  borderTop: "2px solid currentColor",
630
598
  borderRadius: "50%",
631
- animation: "spin 1s linear infinite",
599
+ animation: "spin 1s linear infinite"
632
600
  });
633
- var AizekChatBot = ({ clientId, userToken }) => {
601
+ var AizekChatBot = ({ clientId, headers }) => {
634
602
  const defaultConfig = {
635
603
  welcomeMessage: "Merhaba! Size nas\u0131l yard\u0131mc\u0131 olabilirim?",
636
604
  buttonBackground: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
@@ -643,7 +611,7 @@ var AizekChatBot = ({ clientId, userToken }) => {
643
611
  initialOpen: true,
644
612
  headerBackground: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
645
613
  companyLogo: void 0,
646
- companyName: "AI Asistan",
614
+ companyName: "AI Asistan"
647
615
  };
648
616
  const [config, setConfig] = React.useState(defaultConfig);
649
617
  const [isConfigLoading, setIsConfigLoading] = React.useState(true);
@@ -671,7 +639,7 @@ var AizekChatBot = ({ clientId, userToken }) => {
671
639
  };
672
640
  loadConfig();
673
641
  }, [clientId]);
674
- const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, userToken });
642
+ const internalChatbot = useChatbot({ mcpUrl: finalMcpUrl, apiKey, headers });
675
643
  const messages = internalChatbot.messages;
676
644
  const isLoading = internalChatbot.isLoading;
677
645
  const handleSendMessage = internalChatbot.sendMessage;
@@ -688,38 +656,21 @@ var AizekChatBot = ({ clientId, userToken }) => {
688
656
  }, [messages]);
689
657
  const MessageBubble = ({ message }) => {
690
658
  const isUser = message.role === "user";
691
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
692
- style: getMessageContainerStyles(isUser),
693
- children: [
694
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: getMarkdownElementStyles(isUser) }),
695
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
696
- style: getMessageBubbleStyles(isUser),
697
- children: [
698
- /* @__PURE__ */ jsxRuntime.jsx("div", {
699
- style: getMarkdownStyles(),
700
- className: "markdown-content",
701
- children: /* @__PURE__ */ jsxRuntime.jsx(ReactMarkdown__default.default, { remarkPlugins: [remarkGfm__default.default], children: message.content }),
702
- }),
703
- message.isTyping &&
704
- /* @__PURE__ */ jsxRuntime.jsx("div", {
705
- style: {
706
- display: "inline-flex",
707
- alignItems: "center",
708
- marginLeft: "8px",
709
- },
710
- children: /* @__PURE__ */ jsxRuntime.jsx(TypingDots, {}),
711
- }),
712
- ],
713
- }),
714
- /* @__PURE__ */ jsxRuntime.jsx("div", {
715
- style: getTimeStyles(isUser),
716
- children: message.timestamp.toLocaleTimeString("tr-TR", {
717
- hour: "2-digit",
718
- minute: "2-digit",
719
- }),
720
- }),
721
- ],
722
- });
659
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getMessageContainerStyles(isUser), children: [
660
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: getMarkdownElementStyles(isUser) }),
661
+ /* @__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 }) }),
663
+ message.isTyping && /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
664
+ display: "inline-flex",
665
+ alignItems: "center",
666
+ marginLeft: "8px"
667
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(TypingDots, {}) })
668
+ ] }),
669
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: getTimeStyles(isUser), children: message.timestamp.toLocaleTimeString("tr-TR", {
670
+ hour: "2-digit",
671
+ minute: "2-digit"
672
+ }) })
673
+ ] });
723
674
  };
724
675
  const TypingDots = () => {
725
676
  const [dots, setDots] = React.useState("");
@@ -759,20 +710,22 @@ var AizekChatBot = ({ clientId, userToken }) => {
759
710
  textarea.style.height = "auto";
760
711
  textarea.style.height = Math.min(textarea.scrollHeight, 120) + "px";
761
712
  };
762
- return /* @__PURE__ */ jsxRuntime.jsxs("form", {
763
- onSubmit: handleSubmit,
764
- style: getInputContainerStyles(),
765
- children: [
766
- /* @__PURE__ */ jsxRuntime.jsx("textarea", {
713
+ return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, style: getInputContainerStyles(), children: [
714
+ /* @__PURE__ */ jsxRuntime.jsx(
715
+ "textarea",
716
+ {
767
717
  ref: textareaRef,
768
718
  value: message,
769
719
  onChange: handleInputChange,
770
720
  onKeyDown: handleKeyDown,
771
721
  placeholder,
772
722
  disabled: isLoading,
773
- style: getTextareaStyles(isLoading),
774
- }),
775
- /* @__PURE__ */ jsxRuntime.jsx("button", {
723
+ style: getTextareaStyles(isLoading)
724
+ }
725
+ ),
726
+ /* @__PURE__ */ jsxRuntime.jsx(
727
+ "button",
728
+ {
776
729
  type: "submit",
777
730
  disabled: isLoading || !message.trim(),
778
731
  style: getSendButtonStyles(isLoading, !!message.trim()),
@@ -784,12 +737,10 @@ var AizekChatBot = ({ clientId, userToken }) => {
784
737
  onMouseLeave: (e) => {
785
738
  e.currentTarget.style.transform = "scale(1)";
786
739
  },
787
- children: isLoading
788
- ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, {})
789
- : /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) }),
790
- }),
791
- ],
792
- });
740
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, {}) : /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) })
741
+ }
742
+ )
743
+ ] });
793
744
  };
794
745
  const LoadingSpinner = () => {
795
746
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: getLoadingSpinnerStyles() });
@@ -797,76 +748,55 @@ var AizekChatBot = ({ clientId, userToken }) => {
797
748
  if (isConfigLoading) {
798
749
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: getFloatingButtonStyles(buttonPosition, buttonSize, buttonBackground, false), children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: getLoadingSpinnerStyles() }) });
799
750
  }
800
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
801
- children: [
802
- isOpen &&
803
- /* @__PURE__ */ jsxRuntime.jsx("div", {
804
- style: getOverlayStyles(isOpen),
805
- onClick: toggleChat,
806
- className: "floating-chat-overlay",
807
- }),
808
- /* @__PURE__ */ jsxRuntime.jsx("div", {
809
- style: getChatContainerStyles(buttonPosition, chatWidth, chatHeight, isOpen),
810
- className: "floating-chat-container",
811
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
812
- style: getChatbotContainerStyles(),
813
- children: [
814
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
815
- style: getHeaderStyles(headerBackground),
816
- children: [
817
- /* @__PURE__ */ jsxRuntime.jsx("div", {
818
- style: getLogoContainerStyles(),
819
- children: companyLogo
820
- ? companyLogo.startsWith("http") || companyLogo.startsWith("data:")
821
- ? /* @__PURE__ */ jsxRuntime.jsx("img", {
822
- src: companyLogo,
823
- alt: "Company Logo",
824
- style: getLogoImageStyles(),
825
- })
826
- : /* @__PURE__ */ jsxRuntime.jsx("span", { style: getLogoTextStyles(), children: companyLogo })
827
- : "\u{1F916}",
828
- }),
829
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
830
- children: [
831
- /* @__PURE__ */ jsxRuntime.jsx("h3", { style: getCompanyNameStyles(), children: companyName }),
832
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: getStatusTextStyles(), children: isLoading ? "Yaz\u0131yor..." : "\xC7evrimi\xE7i" }),
833
- ],
834
- }),
835
- ],
836
- }),
837
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
838
- style: getMessagesContainerStyles(),
839
- children: [
840
- messages.length === 0
841
- ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
842
- style: getEmptyStateStyles(),
843
- children: [
844
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "\u{1F4AC}" }),
845
- /* @__PURE__ */ jsxRuntime.jsx("h4", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: welcomeMessage }),
846
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "14px", opacity: 0.8 }, children: "A\u015Fa\u011F\u0131daki alana mesaj\u0131n\u0131z\u0131 yazarak ba\u015Flayabilirsiniz." }),
847
- ],
848
- })
849
- : messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx(MessageBubble, { message }, message.id)),
850
- showTypingIndicator &&
851
- isLoading &&
852
- messages.length > 0 &&
853
- /* @__PURE__ */ jsxRuntime.jsx(MessageBubble, {
854
- message: {
855
- id: "typing",
856
- content: "",
857
- role: "assistant",
858
- timestamp: /* @__PURE__ */ new Date(),
859
- isTyping: true,
860
- },
861
- }),
862
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: messagesEndRef }),
863
- ],
864
- }),
865
- /* @__PURE__ */ jsxRuntime.jsx(ChatInput, {}),
866
- ],
867
- }),
868
- }),
869
- /* @__PURE__ */ jsxRuntime.jsx("button", {
751
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
752
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx(
753
+ "div",
754
+ {
755
+ style: getOverlayStyles(isOpen),
756
+ onClick: toggleChat,
757
+ className: "floating-chat-overlay"
758
+ }
759
+ ),
760
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: getChatContainerStyles(buttonPosition, chatWidth, chatHeight, isOpen), className: "floating-chat-container", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getChatbotContainerStyles(), children: [
761
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getHeaderStyles(headerBackground), children: [
762
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: getLogoContainerStyles(), children: companyLogo ? companyLogo.startsWith("http") || companyLogo.startsWith("data:") ? /* @__PURE__ */ jsxRuntime.jsx(
763
+ "img",
764
+ {
765
+ src: companyLogo,
766
+ alt: "Company Logo",
767
+ style: getLogoImageStyles()
768
+ }
769
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: getLogoTextStyles(), children: companyLogo }) : "\u{1F916}" }),
770
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
771
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { style: getCompanyNameStyles(), children: companyName }),
772
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: getStatusTextStyles(), children: isLoading ? "Yaz\u0131yor..." : "\xC7evrimi\xE7i" })
773
+ ] })
774
+ ] }),
775
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getMessagesContainerStyles(), children: [
776
+ messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: getEmptyStateStyles(), children: [
777
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "\u{1F4AC}" }),
778
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: welcomeMessage }),
779
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "14px", opacity: 0.8 }, children: "A\u015Fa\u011F\u0131daki alana mesaj\u0131n\u0131z\u0131 yazarak ba\u015Flayabilirsiniz." })
780
+ ] }) : messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx(MessageBubble, { message }, message.id)),
781
+ showTypingIndicator && isLoading && messages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
782
+ MessageBubble,
783
+ {
784
+ message: {
785
+ id: "typing",
786
+ content: "",
787
+ role: "assistant",
788
+ timestamp: /* @__PURE__ */ new Date(),
789
+ isTyping: true
790
+ }
791
+ }
792
+ ),
793
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: messagesEndRef })
794
+ ] }),
795
+ /* @__PURE__ */ jsxRuntime.jsx(ChatInput, {})
796
+ ] }) }),
797
+ /* @__PURE__ */ jsxRuntime.jsx(
798
+ "button",
799
+ {
870
800
  onClick: toggleChat,
871
801
  style: getFloatingButtonStyles(buttonPosition, buttonSize, buttonBackground, isOpen),
872
802
  onMouseEnter: (e) => {
@@ -879,28 +809,14 @@ var AizekChatBot = ({ clientId, userToken }) => {
879
809
  },
880
810
  className: "floating-chat-button",
881
811
  "aria-label": isOpen ? "Chati kapat" : "Chati a\xE7",
882
- children: isOpen
883
- ? /* @__PURE__ */ jsxRuntime.jsx("svg", {
884
- width: "24",
885
- height: "24",
886
- viewBox: "0 0 24 24",
887
- fill: "currentColor",
888
- 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" }),
889
- })
890
- : /* @__PURE__ */ jsxRuntime.jsx("svg", {
891
- width: "24",
892
- height: "24",
893
- viewBox: "0 0 24 24",
894
- fill: "currentColor",
895
- children: /* @__PURE__ */ jsxRuntime.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" }),
896
- }),
897
- }),
898
- ],
899
- });
812
+ children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", 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" }) }) : /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.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" }) })
813
+ }
814
+ )
815
+ ] });
900
816
  };
901
817
 
902
818
  exports.AizekChatBot = AizekChatBot;
903
819
  exports.Button = Button;
904
820
  exports.useChatbot = useChatbot;
905
821
  //# sourceMappingURL=index.cjs.map
906
- //# sourceMappingURL=index.cjs.map
822
+ //# sourceMappingURL=index.cjs.map