droplinked-chatbot-next 1.0.6 → 1.0.8

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.
@@ -2,8 +2,8 @@ import { ChatbotUser } from "../types";
2
2
  interface ChatbotProps {
3
3
  apiBaseUrl: string;
4
4
  apiKey?: string;
5
- buttonType?: "floating" | "solid";
6
5
  user?: Partial<ChatbotUser> | null;
6
+ drawerTrigger: (onClick: () => void) => React.ReactNode;
7
7
  }
8
- declare function Chatbot({ apiBaseUrl, apiKey, buttonType, user: initialUser, }: ChatbotProps): import("react/jsx-runtime").JSX.Element;
8
+ declare function Chatbot({ apiBaseUrl, apiKey, user: initialUser, drawerTrigger, }: ChatbotProps): import("react/jsx-runtime").JSX.Element;
9
9
  export default Chatbot;
@@ -1,5 +1,6 @@
1
1
  interface SolidChatButtonProps {
2
+ showIconOnly: boolean;
2
3
  onClick: () => void;
3
4
  }
4
- declare function EmbeddedChatButton({ onClick }: SolidChatButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function EmbeddedChatButton({ showIconOnly, onClick }: SolidChatButtonProps): import("react/jsx-runtime").JSX.Element;
5
6
  export default EmbeddedChatButton;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,17 @@
1
1
  export { default as Chatbot } from './components/Chatbot';
2
+ export { default as ChatDrawer } from './components/ChatDrawer';
3
+ export { default as ChatHeader } from './components/ChatHeader';
4
+ export { default as GradualMessageDisplay } from './components/GradualMessageDisplay';
2
5
  export { default as MessageInput } from './components/input/MessageInput';
6
+ export { default as MarkdownRenderer } from './components/MarkdownRenderer';
3
7
  export { default as MessageList } from './components/MessageList';
4
8
  export { default as TypingIndicator } from './components/TypingIndicator';
5
- export { default as GradualMessageDisplay } from './components/GradualMessageDisplay';
6
- export { default as MarkdownRenderer } from './components/MarkdownRenderer';
7
- export { default as FloatingChatButton } from './components/FloatingChatButton';
8
- export { default as SolidChatButton } from './components/EmbeddedChatButton';
9
- export { default as ChatDrawer } from './components/ChatDrawer';
10
- export { default as ChatHeader } from './components/ChatHeader';
11
- export { default as HelloPage } from './views/HelloPage';
12
9
  export { default as ChatPage } from './views/ChatPage';
10
+ export { default as HelloPage } from './views/HelloPage';
13
11
  export { useChatbot } from './hooks/useChatbot';
14
12
  export type { UseChatbotProps } from './hooks/useChatbot';
15
- export type { Message, ChatbotUser, NavigationLink, MessageSuggestion, ChatbotView, ApiResponse, StartChatResponse, SendMessageResponse, ConversationMessage, Pagination, ChatHistoryResponse } from './types';
16
- export { isValidEmail, generateMessageId, formatTimestamp, sanitizeText, truncateText, isExternalUrl } from './utils/helpers';
17
- export { ChatbotAPI } from './services/client';
13
+ export type { ApiResponse, ChatbotUser, ChatbotView, ChatHistoryResponse, ConversationMessage, Message, MessageSuggestion, NavigationLink, Pagination, SendMessageResponse, StartChatResponse } from './types';
14
+ export { formatTimestamp, generateMessageId, isExternalUrl, isValidEmail, sanitizeText, truncateText } from './utils/helpers';
18
15
  export { ApiError } from './services/axiosClient';
19
- export type { StartChatRequest, SendMessageRequest, GetHistoryParams } from './services/client';
16
+ export { ChatbotAPI } from './services/client';
17
+ export type { GetHistoryParams, SendMessageRequest, StartChatRequest } from './services/client';
package/dist/index.esm.js CHANGED
@@ -66256,280 +66256,12 @@ function ChatHeader(_ref) {
66256
66256
  });
66257
66257
  }
66258
66258
 
66259
- function EmbeddedChatButton(_ref) {
66260
- var onClick = _ref.onClick;
66261
- return jsxs(Button, {
66262
- onClick: onClick,
66263
- bg: "transparent",
66264
- color: "white",
66265
- borderRadius: "12px",
66266
- px: "12px",
66267
- py: "8px",
66268
- h: "36px",
66269
- minW: "36px",
66270
- fontWeight: "500",
66271
- fontSize: "14px",
66272
- lineHeight: "20px",
66273
- transition: "all 0.2s ease-in-out",
66274
- position: "relative",
66275
- overflow: "hidden",
66276
- leftIcon: jsx(AIMd, {
66277
- color: "currentColor"
66278
- }),
66279
- _hover: {
66280
- bg: "#2BCFA1",
66281
- color: "#FFFFFF"
66282
- },
66283
- _active: {
66284
- bg: "#26B894",
66285
- color: "#FFFFFF"
66286
- },
66287
- _focus: {
66288
- boxShadow: "none"
66289
- },
66290
- _focusVisible: {
66291
- boxShadow: "0 0 0 2px rgba(43, 207, 161, 0.3)"
66292
- },
66293
- children: ["AI Assistant", jsx(Box, {
66294
- position: "absolute",
66295
- bottom: 0,
66296
- left: 0,
66297
- right: 0,
66298
- width: "100%",
66299
- height: "36px",
66300
- pointerEvents: "none",
66301
- opacity: 0,
66302
- transition: "opacity 0.2s ease-in-out",
66303
- sx: {
66304
- '.chakra-button:hover &': {
66305
- opacity: 1
66306
- },
66307
- '.chakra-button:active &': {
66308
- opacity: 1
66309
- }
66310
- },
66311
- children: jsxs("svg", {
66312
- xmlns: "http://www.w3.org/2000/svg",
66313
- width: "100%",
66314
- height: "100%",
66315
- viewBox: "0 0 188 48",
66316
- fill: "none",
66317
- preserveAspectRatio: "none",
66318
- children: [jsxs("g", {
66319
- clipPath: "url(#clip0_ai_overlay)",
66320
- children: [jsx("rect", {
66321
- width: "188",
66322
- height: "48",
66323
- rx: "12",
66324
- fill: "url(#paint0_radial_ai_overlay)"
66325
- }), jsx("g", {
66326
- style: {
66327
- mixBlendMode: "hard-light"
66328
- },
66329
- filter: "url(#filter0_f_ai_overlay)",
66330
- children: jsx("path", {
66331
- d: "M221.009 20.167C224.17 22.8539 225.861 25.6847 225.861 28.6104C225.861 45.9462 166.533 60 93.3477 60C20.1622 60 -39.167 45.9462 -39.167 28.6104C-39.1668 25.6847 -37.4754 22.8539 -34.3145 20.167C-18.7449 33.4011 32.5139 43.1123 93.3477 43.1123C154.181 43.1123 205.439 33.401 221.009 20.167Z",
66332
- fill: "#2BCFA1"
66333
- })
66334
- }), jsx("g", {
66335
- style: {
66336
- mixBlendMode: "color-dodge"
66337
- },
66338
- filter: "url(#filter1_f_ai_overlay)",
66339
- children: jsx("path", {
66340
- d: "M229.808 46.167C233.191 47.0105 234.999 47.8979 235 48.8164C235 54.2565 171.58 58.667 93.3474 58.667C15.1147 58.667 -48.3049 54.2565 -48.3049 48.8164C-48.3045 47.8979 -46.4965 47.0105 -43.1145 46.167C-26.4654 50.3193 28.3245 53.3672 93.3474 53.3672C158.369 53.3672 213.158 50.3192 229.808 46.167Z",
66341
- fill: "white"
66342
- })
66343
- }), jsx("g", {
66344
- style: {
66345
- mixBlendMode: "plus-lighter"
66346
- },
66347
- filter: "url(#filter2_f_ai_overlay)",
66348
- children: jsx("path", {
66349
- d: "M200.885 39.5C203.548 40.8829 204.972 42.3399 204.972 43.8457C204.972 52.7675 154.996 60 93.3469 60C31.6984 60 -18.2778 52.7675 -18.2781 43.8457C-18.2781 42.3401 -16.8545 40.8827 -14.1921 39.5C-1.07789 46.3111 42.1018 51.3086 93.3469 51.3086C144.591 51.3086 187.769 46.3108 200.885 39.5Z",
66350
- fill: "white"
66351
- })
66352
- })]
66353
- }), jsxs("defs", {
66354
- children: [jsxs("filter", {
66355
- id: "filter0_f_ai_overlay",
66356
- x: "-58.067",
66357
- y: "1.26699",
66358
- width: "302.828",
66359
- height: "77.633",
66360
- filterUnits: "userSpaceOnUse",
66361
- colorInterpolationFilters: "sRGB",
66362
- children: [jsx("feFlood", {
66363
- floodOpacity: "0",
66364
- result: "BackgroundImageFix"
66365
- }), jsx("feBlend", {
66366
- mode: "normal",
66367
- "in": "SourceGraphic",
66368
- in2: "BackgroundImageFix",
66369
- result: "shape"
66370
- }), jsx("feGaussianBlur", {
66371
- stdDeviation: "9.45",
66372
- result: "effect1_foregroundBlur_ai_overlay"
66373
- })]
66374
- }), jsxs("filter", {
66375
- id: "filter1_f_ai_overlay",
66376
- x: "-61.1716",
66377
- y: "33.3003",
66378
- width: "309.038",
66379
- height: "38.2333",
66380
- filterUnits: "userSpaceOnUse",
66381
- colorInterpolationFilters: "sRGB",
66382
- children: [jsx("feFlood", {
66383
- floodOpacity: "0",
66384
- result: "BackgroundImageFix"
66385
- }), jsx("feBlend", {
66386
- mode: "normal",
66387
- "in": "SourceGraphic",
66388
- in2: "BackgroundImageFix",
66389
- result: "shape"
66390
- }), jsx("feGaussianBlur", {
66391
- stdDeviation: "6.43333",
66392
- result: "effect1_foregroundBlur_ai_overlay"
66393
- })]
66394
- }), jsxs("filter", {
66395
- id: "filter2_f_ai_overlay",
66396
- x: "-30.5781",
66397
- y: "27.2",
66398
- width: "247.85",
66399
- height: "45.1",
66400
- filterUnits: "userSpaceOnUse",
66401
- colorInterpolationFilters: "sRGB",
66402
- children: [jsx("feFlood", {
66403
- floodOpacity: "0",
66404
- result: "BackgroundImageFix"
66405
- }), jsx("feBlend", {
66406
- mode: "normal",
66407
- "in": "SourceGraphic",
66408
- in2: "BackgroundImageFix",
66409
- result: "shape"
66410
- }), jsx("feGaussianBlur", {
66411
- stdDeviation: "6.15",
66412
- result: "effect1_foregroundBlur_ai_overlay"
66413
- })]
66414
- }), jsxs("radialGradient", {
66415
- id: "paint0_radial_ai_overlay",
66416
- cx: "0",
66417
- cy: "0",
66418
- r: "1",
66419
- gradientUnits: "userSpaceOnUse",
66420
- gradientTransform: "translate(94 -5.33333) rotate(90) scale(70.8333 150.489)",
66421
- children: [jsx("stop", {
66422
- offset: "0.707302",
66423
- stopOpacity: "0"
66424
- }), jsx("stop", {
66425
- offset: "0.897964",
66426
- stopColor: "#2BCFA1"
66427
- })]
66428
- }), jsx("clipPath", {
66429
- id: "clip0_ai_overlay",
66430
- children: jsx("rect", {
66431
- width: "188",
66432
- height: "48",
66433
- rx: "12",
66434
- fill: "white"
66435
- })
66436
- })]
66437
- })]
66438
- })
66439
- })]
66440
- });
66441
- }
66442
-
66443
- function FloatingChatButton(_ref) {
66444
- var onClick = _ref.onClick,
66445
- _ref$isVisible = _ref.isVisible,
66446
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
66447
- if (!isVisible) return null;
66448
- return jsxs(Box, {
66449
- position: "fixed",
66450
- bottom: 6,
66451
- right: 6,
66452
- zIndex: 1000,
66453
- onClick: onClick,
66454
- cursor: "pointer",
66455
- css: {
66456
- "&:hover .animated-bg": {
66457
- transform: "scale(1)"
66458
- },
66459
- "&:hover .text-label": {
66460
- color: "black"
66461
- }
66462
- },
66463
- children: [jsx(Box, {
66464
- position: "absolute",
66465
- inset: 0,
66466
- borderRadius: "32px",
66467
- bg: "rgba(43, 207, 161, 0.2)",
66468
- border: "1px solid rgba(43, 207, 161, 0.10)",
66469
- backdropFilter: "blur(24px)",
66470
- transition: "all 0.2s"
66471
- }), jsx(Box, {
66472
- className: "animated-bg",
66473
- position: "absolute",
66474
- inset: 0,
66475
- borderRadius: "32px",
66476
- bg: "#2BCFA1",
66477
- transform: "scale(0)",
66478
- transformOrigin: "20px center",
66479
- transition: "transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)"
66480
- }), jsxs(Flex, {
66481
- display: "inline-flex",
66482
- justifyContent: "flex-start",
66483
- alignItems: "center",
66484
- position: "relative",
66485
- zIndex: 1,
66486
- pl: 1,
66487
- pr: 4,
66488
- py: 1,
66489
- gap: 2,
66490
- children: [jsx(Box, {
66491
- position: "absolute",
66492
- left: "4px",
66493
- top: "4px",
66494
- w: "32px",
66495
- h: "32px",
66496
- borderRadius: "24px",
66497
- bg: "#2BCFA1"
66498
- }), jsx(Flex, {
66499
- justifyContent: "center",
66500
- alignItems: "center",
66501
- position: "relative",
66502
- zIndex: 1,
66503
- w: "32px",
66504
- h: "32px",
66505
- p: 2,
66506
- borderRadius: "24px",
66507
- bg: "#2BCFA1",
66508
- children: jsx(AIMd, {
66509
- color: "black"
66510
- })
66511
- }), jsx(Text, {
66512
- className: "text-label",
66513
- position: "relative",
66514
- zIndex: 1,
66515
- color: "white",
66516
- fontSize: "sm",
66517
- fontWeight: "medium",
66518
- lineHeight: "tight",
66519
- transition: "color 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)",
66520
- children: "AI Assistant"
66521
- })]
66522
- })]
66523
- });
66524
- }
66525
-
66526
66259
  function Chatbot(_ref) {
66527
66260
  var apiBaseUrl = _ref.apiBaseUrl,
66528
66261
  apiKey = _ref.apiKey,
66529
- _ref$buttonType = _ref.buttonType,
66530
- buttonType = _ref$buttonType === void 0 ? "floating" : _ref$buttonType,
66531
66262
  _ref$user = _ref.user,
66532
- initialUser = _ref$user === void 0 ? null : _ref$user;
66263
+ initialUser = _ref$user === void 0 ? null : _ref$user,
66264
+ drawerTrigger = _ref.drawerTrigger;
66533
66265
  var _useDisclosure = useDisclosure(),
66534
66266
  isOpen = _useDisclosure.isOpen,
66535
66267
  onOpen = _useDisclosure.onOpen,
@@ -66555,11 +66287,7 @@ function Chatbot(_ref) {
66555
66287
  handleRetryLastMessage = _useChatbot.handleRetryLastMessage,
66556
66288
  clearProcessingMessageId = _useChatbot.clearProcessingMessageId;
66557
66289
  return jsxs(Fragment, {
66558
- children: [buttonType === "floating" ? jsx(FloatingChatButton, {
66559
- onClick: onOpen
66560
- }) : jsx(EmbeddedChatButton, {
66561
- onClick: onOpen
66562
- }), jsxs(ChatDrawer, {
66290
+ children: [drawerTrigger(onOpen), jsxs(ChatDrawer, {
66563
66291
  isOpen: isOpen,
66564
66292
  onClose: onClose,
66565
66293
  currentView: currentView,
@@ -66597,5 +66325,5 @@ function Chatbot(_ref) {
66597
66325
  });
66598
66326
  }
66599
66327
 
66600
- export { ApiError, ChatDrawer, ChatHeader, ChatPage, Chatbot, ChatbotAPI, FloatingChatButton, GradualMessageDisplay, HelloPage, MarkdownRenderer, MessageInput, MessageList, EmbeddedChatButton as SolidChatButton, TypingIndicator, formatTimestamp, generateMessageId, isExternalUrl, isValidEmail, sanitizeText, truncateText, useChatbot };
66328
+ export { ApiError, ChatDrawer, ChatHeader, ChatPage, Chatbot, ChatbotAPI, GradualMessageDisplay, HelloPage, MarkdownRenderer, MessageInput, MessageList, TypingIndicator, formatTimestamp, generateMessageId, isExternalUrl, isValidEmail, sanitizeText, truncateText, useChatbot };
66601
66329
  //# sourceMappingURL=index.esm.js.map