droplinked-chatbot-next 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.
@@ -0,0 +1,12 @@
1
+ import Chatbot from './Chatbot';
2
+ export { Chatbot };
3
+ export type ChatbotProps = {
4
+ apiBaseUrl?: string;
5
+ apiKey?: string;
6
+ user?: {
7
+ id?: string;
8
+ name?: string;
9
+ email?: string;
10
+ };
11
+ };
12
+ export default Chatbot;
@@ -0,0 +1,5 @@
1
+ export { A as ApiError, C as Chatbot, c as ChatbotAPI, f as formatTimestamp, a as generateMessageId, i as isExternalUrl, b as isValidEmail, s as sanitizeText, t as truncateText } from './index.client-n6MaYrH1.js';
2
+ import 'react/jsx-runtime';
3
+ import '@chakra-ui/react';
4
+ import 'react';
5
+ //# sourceMappingURL=index.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
package/dist/index.d.ts CHANGED
@@ -1,19 +1,18 @@
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';
18
+ export declare const SSRSafeComponents: {};
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as Chakra from '@chakra-ui/react';
3
- import { VStack, Text, Box, Input, Button, HStack, Image as Image$1, Spacer, IconButton, Link, Grid, Flex, Tooltip as Tooltip$1, Center, DrawerHeader, useDisclosure, useBreakpointValue, DrawerBody } from '@chakra-ui/react';
3
+ import { VStack, Text, Box, Input, Button, HStack, Image as Image$1, Spacer, IconButton, Link, Grid, Flex, Tooltip as Tooltip$1, Center, DrawerHeader, useDisclosure, DrawerBody } from '@chakra-ui/react';
4
4
  import * as React from 'react';
5
5
  import React__default, { useState, useMemo, useRef, useEffect, useCallback } from 'react';
6
6
 
@@ -66256,282 +66256,12 @@ function ChatHeader(_ref) {
66256
66256
  });
66257
66257
  }
66258
66258
 
66259
- function EmbeddedChatButton(_ref) {
66260
- var showIconOnly = _ref.showIconOnly,
66261
- onClick = _ref.onClick;
66262
- return jsxs(Button, {
66263
- onClick: onClick,
66264
- bg: "transparent",
66265
- color: "white",
66266
- borderRadius: "12px",
66267
- px: "12px",
66268
- py: "8px",
66269
- h: "36px",
66270
- minW: "36px",
66271
- fontWeight: "500",
66272
- fontSize: "14px",
66273
- lineHeight: "20px",
66274
- transition: "all 0.2s ease-in-out",
66275
- position: "relative",
66276
- overflow: "hidden",
66277
- leftIcon: jsx(AIMd, {
66278
- color: "currentColor"
66279
- }),
66280
- _hover: {
66281
- bg: "#2BCFA1",
66282
- color: "#FFFFFF"
66283
- },
66284
- _active: {
66285
- bg: "#26B894",
66286
- color: "#FFFFFF"
66287
- },
66288
- _focus: {
66289
- boxShadow: "none"
66290
- },
66291
- _focusVisible: {
66292
- boxShadow: "0 0 0 2px rgba(43, 207, 161, 0.3)"
66293
- },
66294
- children: [!showIconOnly && "AI Assistant", jsx(Box, {
66295
- position: "absolute",
66296
- bottom: 0,
66297
- left: 0,
66298
- right: 0,
66299
- width: "100%",
66300
- height: "36px",
66301
- pointerEvents: "none",
66302
- opacity: 0,
66303
- transition: "opacity 0.2s ease-in-out",
66304
- sx: {
66305
- '.chakra-button:hover &': {
66306
- opacity: 1
66307
- },
66308
- '.chakra-button:active &': {
66309
- opacity: 1
66310
- }
66311
- },
66312
- children: jsxs("svg", {
66313
- xmlns: "http://www.w3.org/2000/svg",
66314
- width: "100%",
66315
- height: "100%",
66316
- viewBox: "0 0 188 48",
66317
- fill: "none",
66318
- preserveAspectRatio: "none",
66319
- children: [jsxs("g", {
66320
- clipPath: "url(#clip0_ai_overlay)",
66321
- children: [jsx("rect", {
66322
- width: "188",
66323
- height: "48",
66324
- rx: "12",
66325
- fill: "url(#paint0_radial_ai_overlay)"
66326
- }), jsx("g", {
66327
- style: {
66328
- mixBlendMode: "hard-light"
66329
- },
66330
- filter: "url(#filter0_f_ai_overlay)",
66331
- children: jsx("path", {
66332
- 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",
66333
- fill: "#2BCFA1"
66334
- })
66335
- }), jsx("g", {
66336
- style: {
66337
- mixBlendMode: "color-dodge"
66338
- },
66339
- filter: "url(#filter1_f_ai_overlay)",
66340
- children: jsx("path", {
66341
- 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",
66342
- fill: "white"
66343
- })
66344
- }), jsx("g", {
66345
- style: {
66346
- mixBlendMode: "plus-lighter"
66347
- },
66348
- filter: "url(#filter2_f_ai_overlay)",
66349
- children: jsx("path", {
66350
- 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",
66351
- fill: "white"
66352
- })
66353
- })]
66354
- }), jsxs("defs", {
66355
- children: [jsxs("filter", {
66356
- id: "filter0_f_ai_overlay",
66357
- x: "-58.067",
66358
- y: "1.26699",
66359
- width: "302.828",
66360
- height: "77.633",
66361
- filterUnits: "userSpaceOnUse",
66362
- colorInterpolationFilters: "sRGB",
66363
- children: [jsx("feFlood", {
66364
- floodOpacity: "0",
66365
- result: "BackgroundImageFix"
66366
- }), jsx("feBlend", {
66367
- mode: "normal",
66368
- "in": "SourceGraphic",
66369
- in2: "BackgroundImageFix",
66370
- result: "shape"
66371
- }), jsx("feGaussianBlur", {
66372
- stdDeviation: "9.45",
66373
- result: "effect1_foregroundBlur_ai_overlay"
66374
- })]
66375
- }), jsxs("filter", {
66376
- id: "filter1_f_ai_overlay",
66377
- x: "-61.1716",
66378
- y: "33.3003",
66379
- width: "309.038",
66380
- height: "38.2333",
66381
- filterUnits: "userSpaceOnUse",
66382
- colorInterpolationFilters: "sRGB",
66383
- children: [jsx("feFlood", {
66384
- floodOpacity: "0",
66385
- result: "BackgroundImageFix"
66386
- }), jsx("feBlend", {
66387
- mode: "normal",
66388
- "in": "SourceGraphic",
66389
- in2: "BackgroundImageFix",
66390
- result: "shape"
66391
- }), jsx("feGaussianBlur", {
66392
- stdDeviation: "6.43333",
66393
- result: "effect1_foregroundBlur_ai_overlay"
66394
- })]
66395
- }), jsxs("filter", {
66396
- id: "filter2_f_ai_overlay",
66397
- x: "-30.5781",
66398
- y: "27.2",
66399
- width: "247.85",
66400
- height: "45.1",
66401
- filterUnits: "userSpaceOnUse",
66402
- colorInterpolationFilters: "sRGB",
66403
- children: [jsx("feFlood", {
66404
- floodOpacity: "0",
66405
- result: "BackgroundImageFix"
66406
- }), jsx("feBlend", {
66407
- mode: "normal",
66408
- "in": "SourceGraphic",
66409
- in2: "BackgroundImageFix",
66410
- result: "shape"
66411
- }), jsx("feGaussianBlur", {
66412
- stdDeviation: "6.15",
66413
- result: "effect1_foregroundBlur_ai_overlay"
66414
- })]
66415
- }), jsxs("radialGradient", {
66416
- id: "paint0_radial_ai_overlay",
66417
- cx: "0",
66418
- cy: "0",
66419
- r: "1",
66420
- gradientUnits: "userSpaceOnUse",
66421
- gradientTransform: "translate(94 -5.33333) rotate(90) scale(70.8333 150.489)",
66422
- children: [jsx("stop", {
66423
- offset: "0.707302",
66424
- stopOpacity: "0"
66425
- }), jsx("stop", {
66426
- offset: "0.897964",
66427
- stopColor: "#2BCFA1"
66428
- })]
66429
- }), jsx("clipPath", {
66430
- id: "clip0_ai_overlay",
66431
- children: jsx("rect", {
66432
- width: "188",
66433
- height: "48",
66434
- rx: "12",
66435
- fill: "white"
66436
- })
66437
- })]
66438
- })]
66439
- })
66440
- })]
66441
- });
66442
- }
66443
-
66444
- function FloatingChatButton(_ref) {
66445
- var onClick = _ref.onClick,
66446
- _ref$isVisible = _ref.isVisible,
66447
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
66448
- if (!isVisible) return null;
66449
- return jsxs(Box, {
66450
- position: "fixed",
66451
- bottom: 6,
66452
- right: 6,
66453
- zIndex: 1000,
66454
- onClick: onClick,
66455
- cursor: "pointer",
66456
- css: {
66457
- "&:hover .animated-bg": {
66458
- transform: "scale(1)"
66459
- },
66460
- "&:hover .text-label": {
66461
- color: "black"
66462
- }
66463
- },
66464
- children: [jsx(Box, {
66465
- position: "absolute",
66466
- inset: 0,
66467
- borderRadius: "32px",
66468
- bg: "rgba(43, 207, 161, 0.2)",
66469
- border: "1px solid rgba(43, 207, 161, 0.10)",
66470
- backdropFilter: "blur(24px)",
66471
- transition: "all 0.2s"
66472
- }), jsx(Box, {
66473
- className: "animated-bg",
66474
- position: "absolute",
66475
- inset: 0,
66476
- borderRadius: "32px",
66477
- bg: "#2BCFA1",
66478
- transform: "scale(0)",
66479
- transformOrigin: "20px center",
66480
- transition: "transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)"
66481
- }), jsxs(Flex, {
66482
- display: "inline-flex",
66483
- justifyContent: "flex-start",
66484
- alignItems: "center",
66485
- position: "relative",
66486
- zIndex: 1,
66487
- pl: 1,
66488
- pr: 4,
66489
- py: 1,
66490
- gap: 2,
66491
- children: [jsx(Box, {
66492
- position: "absolute",
66493
- left: "4px",
66494
- top: "4px",
66495
- w: "32px",
66496
- h: "32px",
66497
- borderRadius: "24px",
66498
- bg: "#2BCFA1"
66499
- }), jsx(Flex, {
66500
- justifyContent: "center",
66501
- alignItems: "center",
66502
- position: "relative",
66503
- zIndex: 1,
66504
- w: "32px",
66505
- h: "32px",
66506
- p: 2,
66507
- borderRadius: "24px",
66508
- bg: "#2BCFA1",
66509
- children: jsx(AIMd, {
66510
- color: "black"
66511
- })
66512
- }), jsx(Text, {
66513
- className: "text-label",
66514
- position: "relative",
66515
- zIndex: 1,
66516
- color: "white",
66517
- fontSize: "sm",
66518
- fontWeight: "medium",
66519
- lineHeight: "tight",
66520
- transition: "color 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)",
66521
- children: "AI Assistant"
66522
- })]
66523
- })]
66524
- });
66525
- }
66526
-
66527
66259
  function Chatbot(_ref) {
66528
- var _useBreakpointValue;
66529
66260
  var apiBaseUrl = _ref.apiBaseUrl,
66530
66261
  apiKey = _ref.apiKey,
66531
- _ref$buttonType = _ref.buttonType,
66532
- buttonType = _ref$buttonType === void 0 ? "floating" : _ref$buttonType,
66533
66262
  _ref$user = _ref.user,
66534
- initialUser = _ref$user === void 0 ? null : _ref$user;
66263
+ initialUser = _ref$user === void 0 ? null : _ref$user,
66264
+ drawerTrigger = _ref.drawerTrigger;
66535
66265
  var _useDisclosure = useDisclosure(),
66536
66266
  isOpen = _useDisclosure.isOpen,
66537
66267
  onOpen = _useDisclosure.onOpen,
@@ -66556,17 +66286,8 @@ function Chatbot(_ref) {
66556
66286
  handleSendMessage = _useChatbot.handleSendMessage,
66557
66287
  handleRetryLastMessage = _useChatbot.handleRetryLastMessage,
66558
66288
  clearProcessingMessageId = _useChatbot.clearProcessingMessageId;
66559
- var showIconOnly = (_useBreakpointValue = useBreakpointValue({
66560
- base: true,
66561
- md: false
66562
- })) !== null && _useBreakpointValue !== void 0 ? _useBreakpointValue : false;
66563
66289
  return jsxs(Fragment, {
66564
- children: [buttonType === "floating" ? jsx(FloatingChatButton, {
66565
- onClick: onOpen
66566
- }) : jsx(EmbeddedChatButton, {
66567
- showIconOnly: showIconOnly,
66568
- onClick: onOpen
66569
- }), jsxs(ChatDrawer, {
66290
+ children: [drawerTrigger(onOpen), jsxs(ChatDrawer, {
66570
66291
  isOpen: isOpen,
66571
66292
  onClose: onClose,
66572
66293
  currentView: currentView,
@@ -66604,5 +66325,5 @@ function Chatbot(_ref) {
66604
66325
  });
66605
66326
  }
66606
66327
 
66607
- 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 };
66608
66329
  //# sourceMappingURL=index.esm.js.map