@aslaluroba/help-center-react 3.2.17 → 3.2.18

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.
Files changed (101) hide show
  1. package/dist/components/shared/Button/button.d.ts +1 -1
  2. package/dist/components/shared/Card/card.d.ts +1 -4
  3. package/dist/components/ui/agent-response/agent-response.d.ts +2 -1
  4. package/dist/index.css +1424 -1
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.esm.js +19194 -38923
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.js +19198 -38927
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/LanguageContext.d.ts +1 -1
  11. package/dist/lib/custom-hooks/useAblyConnection.d.ts +25 -0
  12. package/dist/lib/custom-hooks/useActionHandler.d.ts +1 -7
  13. package/dist/lib/custom-hooks/useChatSession.d.ts +37 -0
  14. package/dist/lib/custom-hooks/useMessageQueue.d.ts +16 -0
  15. package/dist/lib/custom-hooks/useReview.d.ts +14 -0
  16. package/dist/lib/index.d.ts +1 -2
  17. package/dist/services.d.ts +9 -6
  18. package/dist/services.esm.js +1 -14348
  19. package/dist/services.esm.js.map +1 -1
  20. package/dist/services.js +19 -14344
  21. package/dist/services.js.map +1 -1
  22. package/dist/ui/chatbot-popup/chat-window-screen/footer.d.ts +1 -1
  23. package/dist/ui/chatbot-popup/chat-window-screen/in-chat-review.d.ts +1 -1
  24. package/dist/ui/chatbot-popup/chat-window-screen/index.d.ts +2 -2
  25. package/dist/ui/chatbot-popup/options-list-screen/helpscreen-list.d.ts +1 -1
  26. package/dist/ui/chatbot-popup/options-list-screen/helpscreen-option.d.ts +1 -1
  27. package/dist/ui/chatbot-popup/options-list-screen/index.d.ts +1 -1
  28. package/dist/ui/help-center.d.ts +1 -1
  29. package/dist/ui/help-popup.d.ts +4 -27
  30. package/dist/ui/review-dialog/index.d.ts +1 -1
  31. package/package.json +12 -26
  32. package/postcss.config.js +5 -0
  33. package/rollup.config.mjs +34 -0
  34. package/dist/core/AblyService.d.ts +0 -16
  35. package/dist/core/ApiService.d.ts +0 -16
  36. package/dist/core/api.d.ts +0 -10
  37. package/dist/core/token-service.d.ts +0 -10
  38. package/dist/i18n.d.ts +0 -3
  39. package/dist/lib/config.d.ts +0 -18
  40. package/dist/lib/theme-utils.d.ts +0 -10
  41. package/dist/lib/types.d.ts +0 -145
  42. package/dist/lib/utils.d.ts +0 -2
  43. package/src/assets/animatedLogo.gif +0 -0
  44. package/src/assets/logo.svg +0 -5
  45. package/src/assets/seperator.svg +0 -5
  46. package/src/components/index.ts +0 -1
  47. package/src/components/shared/Button/button.tsx +0 -38
  48. package/src/components/shared/Button/index.ts +0 -1
  49. package/src/components/shared/Card/card.tsx +0 -44
  50. package/src/components/shared/Card/index.ts +0 -1
  51. package/src/components/shared/index.ts +0 -2
  52. package/src/components/ui/agent-response/agent-response.tsx +0 -57
  53. package/src/components/ui/agent-response/doc.md +0 -88
  54. package/src/components/ui/image-attachment.tsx +0 -119
  55. package/src/components/ui/image-preview-dialog.tsx +0 -400
  56. package/src/components/ui/index.ts +0 -3
  57. package/src/core/AblyService.ts +0 -243
  58. package/src/core/ApiService.ts +0 -116
  59. package/src/core/api.ts +0 -278
  60. package/src/core/token-service.ts +0 -35
  61. package/src/globals.css +0 -268
  62. package/src/i18n.ts +0 -21
  63. package/src/index.ts +0 -19
  64. package/src/lib/LanguageContext.tsx +0 -28
  65. package/src/lib/config.ts +0 -52
  66. package/src/lib/custom-hooks/useActionHandler.ts +0 -102
  67. package/src/lib/custom-hooks/useTypewriter.ts +0 -26
  68. package/src/lib/index.ts +0 -4
  69. package/src/lib/theme-utils.ts +0 -56
  70. package/src/lib/types.ts +0 -158
  71. package/src/lib/utils.ts +0 -6
  72. package/src/locales/ar.json +0 -45
  73. package/src/locales/en.json +0 -45
  74. package/src/services.ts +0 -14
  75. package/src/types/icons.d.ts +0 -6
  76. package/src/types/svg.d.ts +0 -5
  77. package/src/types.d.ts +0 -9
  78. package/src/ui/chatbot-popup/active-chat-actions.tsx +0 -39
  79. package/src/ui/chatbot-popup/chat-window-screen/action-button.tsx +0 -37
  80. package/src/ui/chatbot-popup/chat-window-screen/footer.tsx +0 -313
  81. package/src/ui/chatbot-popup/chat-window-screen/header.tsx +0 -53
  82. package/src/ui/chatbot-popup/chat-window-screen/in-chat-review.tsx +0 -116
  83. package/src/ui/chatbot-popup/chat-window-screen/index.tsx +0 -366
  84. package/src/ui/chatbot-popup/chat-window-screen/typing-indicator.tsx +0 -31
  85. package/src/ui/chatbot-popup/error-screen/index.tsx +0 -22
  86. package/src/ui/chatbot-popup/loading-screen/index.tsx +0 -21
  87. package/src/ui/chatbot-popup/options-list-screen/company-card.tsx +0 -39
  88. package/src/ui/chatbot-popup/options-list-screen/header.tsx +0 -23
  89. package/src/ui/chatbot-popup/options-list-screen/helpscreen-intro.tsx +0 -32
  90. package/src/ui/chatbot-popup/options-list-screen/helpscreen-list.tsx +0 -57
  91. package/src/ui/chatbot-popup/options-list-screen/helpscreen-option.tsx +0 -56
  92. package/src/ui/chatbot-popup/options-list-screen/index.tsx +0 -70
  93. package/src/ui/confirmation-modal/index.tsx +0 -62
  94. package/src/ui/floating-message.tsx +0 -29
  95. package/src/ui/help-button.tsx +0 -25
  96. package/src/ui/help-center.tsx +0 -448
  97. package/src/ui/help-popup.tsx +0 -367
  98. package/src/ui/powered-by.tsx +0 -62
  99. package/src/ui/review-dialog/index.tsx +0 -149
  100. package/src/ui/review-dialog/rating.tsx +0 -79
  101. package/src/useLocalTranslation.ts +0 -15
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  interface ChatWindowFooterProps {
3
3
  inputMessage: string;
4
4
  setInputMessage: (e: string) => void;
5
- handleSendMessage: (attachmentIds: string[]) => void;
5
+ handleSendMessage: (attachmentIds: string[], previewUrls: string[]) => void;
6
6
  isLoading: boolean;
7
7
  isChatClosed?: boolean;
8
8
  onEnsureSession: () => Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ReviewProps } from '@/lib/types';
2
+ import { ReviewProps } from '@aslaluroba/help-center-core';
3
3
  interface InChatReviewProps {
4
4
  onSubmit: (payload: ReviewProps) => void | Promise<void>;
5
5
  onDone?: () => void;
@@ -1,7 +1,7 @@
1
- import { Message, ReviewProps } from '@/lib/types';
1
+ import { Message, ReviewProps } from '@aslaluroba/help-center-core';
2
2
  import React from 'react';
3
3
  interface ChatWindowProps {
4
- onSendMessage: (message: string, attachmentIds: string[]) => void;
4
+ onSendMessage: (message: string, attachmentIds: string[], previewUrls?: string[]) => void;
5
5
  onEnsureSession: () => Promise<string>;
6
6
  messages: Message[];
7
7
  assistantStatus: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Option } from '@/lib/types';
2
+ import { Option } from '@aslaluroba/help-center-core';
3
3
  interface HelpscreenListProps {
4
4
  options: Option[] | undefined;
5
5
  selectedOption: Option | null;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Option } from '@/lib/types';
2
+ import { Option } from '@aslaluroba/help-center-core';
3
3
  interface HelpscreenOptionProps {
4
4
  option: Option;
5
5
  isSelected: boolean;
@@ -1,4 +1,4 @@
1
- import { HelpScreenData, Option } from '@/lib/types';
1
+ import { HelpScreenData, Option } from '@aslaluroba/help-center-core';
2
2
  interface OptionsListScreenProps {
3
3
  helpScreen: HelpScreenData | null;
4
4
  handleStartChat: (option: Option) => void;
@@ -1,4 +1,4 @@
1
- import '../globals.css';
1
+ import '@aslaluroba/help-center-core/styles';
2
2
  interface HelpCenterProps {
3
3
  helpScreenId: string;
4
4
  language?: 'ar' | 'en';
@@ -1,4 +1,5 @@
1
- import { HelpScreenData, Message, Option, ReviewProps } from '@/lib/types';
1
+ import { HelpScreenData } from '@aslaluroba/help-center-core';
2
+ import type { ChatSession } from '@/lib/custom-hooks/useChatSession';
2
3
  type HelpPopupProps = {
3
4
  isOpen: boolean;
4
5
  isClosing?: boolean;
@@ -7,31 +8,7 @@ type HelpPopupProps = {
7
8
  helpScreen: HelpScreenData | null;
8
9
  status: string;
9
10
  error: string | null;
10
- user: unknown;
11
- onStartChat: (option: Option) => void;
12
- onSendMessage: (message: string, attachmentIds: string[]) => void;
13
- onEnsureSession: () => Promise<string>;
14
- onEndChat: (options?: {
15
- fromChatScreen?: boolean;
16
- sessionClosedByServer?: boolean;
17
- }) => void | Promise<void>;
18
- messages: Message[];
19
- needsAgent: boolean;
20
- assistantStatus: string;
21
- sessionId: string | null;
22
- isChatClosed: boolean;
23
- selectedOption: Option | null;
24
- setSelectedOption: (option: Option | null) => void;
25
- inChatReviewSessionId?: string | null;
26
- onInChatReviewSubmit?: (payload: ReviewProps) => void | Promise<void>;
27
- onInChatReviewDone?: () => void;
28
- navigateToOptionsListAfterReview?: boolean;
29
- onNavigatedToOptionsList?: () => void;
30
- isReviewDialogOpen?: boolean;
31
- reviewSessionId?: string | null;
32
- isSubmittingReview?: boolean;
33
- onReviewDialogSubmit?: (payload: ReviewProps) => void | Promise<void>;
34
- onReviewDialogClose?: () => void;
11
+ session: ChatSession;
35
12
  };
36
- declare const HelpPopup: ({ isOpen, isClosing, onClose, onCloseAnimationEnd, helpScreen, status, error, onStartChat, onSendMessage, onEnsureSession, onEndChat, messages, assistantStatus, needsAgent, sessionId, isChatClosed, selectedOption, setSelectedOption, inChatReviewSessionId, onInChatReviewSubmit, onInChatReviewDone, navigateToOptionsListAfterReview, onNavigatedToOptionsList, isReviewDialogOpen, reviewSessionId, isSubmittingReview, onReviewDialogSubmit, onReviewDialogClose, }: HelpPopupProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const HelpPopup: ({ isOpen, isClosing, onClose, onCloseAnimationEnd, helpScreen, status, error, session, }: HelpPopupProps) => import("react/jsx-runtime").JSX.Element;
37
14
  export default HelpPopup;
@@ -1,4 +1,4 @@
1
- import { ReviewProps } from '@/lib/types';
1
+ import { ReviewProps } from '@aslaluroba/help-center-core';
2
2
  interface ReviewDialogProps {
3
3
  handleSubmit: ({ rating }: ReviewProps) => void;
4
4
  onClose: () => void;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "dist/index.js",
4
4
  "module": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
- "version": "3.2.17",
6
+ "version": "3.2.18",
7
7
  "description": "BabylAI Help Center Widget for React and Next.js",
8
8
  "private": false,
9
9
  "exports": {
@@ -21,25 +21,8 @@
21
21
  "default": "./dist/index.css"
22
22
  }
23
23
  },
24
- "scripts": {
25
- "build": "rollup -c",
26
- "dev": "rollup --watch --config rollup.dev.config.mjs",
27
- "test": "jest",
28
- "clean": "rimraf dist",
29
- "version:patch": "npm version patch --no-git-tag-version",
30
- "version:minor": "npm version minor --no-git-tag-version",
31
- "version:major": "npm version major --no-git-tag-version",
32
- "publish:patch": "yarn clean && yarn build && yarn version:patch && yarn publish --access public",
33
- "publish:minor": "yarn clean && yarn build && yarn version:minor && yarn publish --access public",
34
- "publish:major": "yarn clean && yarn build && yarn version:major && yarn publish --access public",
35
- "watch": "concurrently \"yarn dev\" \"yalc publish --watch --push\"",
36
- "setup:dev": "./scripts/setup-dev.sh",
37
- "setup:dev:with-test": "./scripts/setup-dev.sh --create-test-project"
38
- },
39
24
  "files": [
40
25
  "dist",
41
- "src",
42
- "globals.css",
43
26
  "package.json",
44
27
  "tsconfig.json",
45
28
  "./postcss.config.js",
@@ -62,15 +45,11 @@
62
45
  "react-dom": "^18 || ^19"
63
46
  },
64
47
  "dependencies": {
65
- "@ably/chat": "^1.3.0",
66
48
  "@tabler/icons-react": "^3.40.0",
67
49
  "@tailwindcss/postcss": "^4.2.2",
68
- "ably": "^2.21.0",
69
- "axios": "^1.13.6",
70
50
  "class-variance-authority": "^0.7.1",
71
- "clsx": "^2.1.1",
72
51
  "react-markdown": "^10.1.0",
73
- "tailwind-merge": "^3.5.0"
52
+ "@aslaluroba/help-center-core": "1.0.0"
74
53
  },
75
54
  "devDependencies": {
76
55
  "@babel/core": "^7.29.0",
@@ -102,7 +81,6 @@
102
81
  "i18next": "^25.10.9",
103
82
  "postcss": "^8.5.8",
104
83
  "react-i18next": "^16.6.6",
105
- "react-markdown": "^10.1.0",
106
84
  "rimraf": "^6.1.3",
107
85
  "rollup": "^4.60.0",
108
86
  "rollup-plugin-postcss": "^4.0.2",
@@ -117,5 +95,13 @@
117
95
  "publishConfig": {
118
96
  "access": "public"
119
97
  },
120
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
121
- }
98
+ "scripts": {
99
+ "build": "rollup -c",
100
+ "dev": "rollup --watch --config rollup.dev.config.mjs",
101
+ "test": "echo \"No tests configured\" && exit 0",
102
+ "clean": "rimraf dist",
103
+ "watch": "concurrently \"pnpm dev\" \"yalc publish --watch --push\"",
104
+ "setup:dev": "./scripts/setup-dev.sh",
105
+ "setup:dev:with-test": "./scripts/setup-dev.sh --create-test-project"
106
+ }
107
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ }
5
+ }
@@ -0,0 +1,34 @@
1
+ import { makeExternal, pluginsCommon } from "./rollup.base.config.mjs";
2
+
3
+ export default [
4
+ // Main component bundle
5
+ {
6
+ input: "src/index.ts",
7
+ output: [
8
+ { file: "dist/index.js", format: "cjs", sourcemap: true, exports: "named" },
9
+ { file: "dist/index.esm.js", format: "esm", sourcemap: true },
10
+ ],
11
+ external: makeExternal(),
12
+ plugins: pluginsCommon({
13
+ emitCss: true,
14
+ minimizeCss: true, // minify CSS for publish
15
+ declarations: true, // emit .d.ts
16
+ }),
17
+ treeshake: { moduleSideEffects: false },
18
+ },
19
+ // Services bundle
20
+ {
21
+ input: "src/services.ts",
22
+ output: [
23
+ { file: "dist/services.js", format: "cjs", sourcemap: true, exports: "named" },
24
+ { file: "dist/services.esm.js", format: "esm", sourcemap: true },
25
+ ],
26
+ external: makeExternal(),
27
+ plugins: pluginsCommon({
28
+ emitCss: false, // No CSS for services
29
+ minimizeCss: true,
30
+ declarations: true,
31
+ }),
32
+ treeshake: { moduleSideEffects: false },
33
+ },
34
+ ];
@@ -1,16 +0,0 @@
1
- type ActionHandlerCallback = (actionType: string | undefined | null, messageData: any) => void | Promise<void>;
2
- export declare class ClientAblyService {
3
- private static client;
4
- private static channel;
5
- private static isConnected;
6
- private static sessionId;
7
- private static messageUnsubscribe;
8
- private static onActionReceived;
9
- static startConnection(sessionId: string, ablyToken: string, onMessageReceived: Function, tenantId: string, onActionReceived?: ActionHandlerCallback): Promise<void>;
10
- private static joinChannel;
11
- static stopConnection(): Promise<void>;
12
- static isConnectionActive(): boolean;
13
- static getConnectionState(): string;
14
- static sendMessage(messageContent: string, senderType?: number): Promise<void>;
15
- }
16
- export {};
@@ -1,16 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { HelpCenterConfig } from '../lib/types';
3
- export declare class ApiService {
4
- private axiosInstance;
5
- private config;
6
- private tokenExpiryTime;
7
- private currentToken;
8
- constructor(config: HelpCenterConfig);
9
- private setupInterceptors;
10
- private getValidToken;
11
- get<T>(endpoint: string, config?: AxiosRequestConfig): Promise<T>;
12
- post<T>(endpoint: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
13
- put<T>(endpoint: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
14
- delete<T>(endpoint: string, config?: AxiosRequestConfig): Promise<T>;
15
- private handleError;
16
- }
@@ -1,10 +0,0 @@
1
- import { TokenResponse, PresignUploadResponse, PresignDownloadResponse } from '@/lib/types';
2
- export declare function initializeAPI(url: string, getToken: () => Promise<TokenResponse>): void;
3
- export declare function getValidToken(forceRefresh?: boolean): Promise<string>;
4
- export declare function apiRequest(endpoint: string, method: string | undefined, body: any | undefined, options: {
5
- cache?: boolean;
6
- timeout?: number;
7
- language?: 'ar' | 'en';
8
- }): Promise<any>;
9
- export declare function presignUpload(chatSessionId: string, file: File, language?: 'ar' | 'en'): Promise<PresignUploadResponse>;
10
- export declare function presignDownload(fileId: string, language?: 'ar' | 'en'): Promise<PresignDownloadResponse>;
@@ -1,10 +0,0 @@
1
- type TokenResponse = {
2
- token: string;
3
- expiresIn: number;
4
- };
5
- export declare class TokenService {
6
- private baseUrl;
7
- constructor(baseUrl: string);
8
- getToken(): Promise<TokenResponse>;
9
- }
10
- export {};
package/dist/i18n.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { i18n as I18nType } from "i18next";
2
- export declare const defaultLanguage = "ar";
3
- export declare const createHelpCenterI18n: (lng?: string) => I18nType;
@@ -1,18 +0,0 @@
1
- import { TokenResponse } from './types';
2
- type Config = {
3
- baseUrl?: string;
4
- tenantId?: string;
5
- apiKey?: string;
6
- getToken?: () => Promise<TokenResponse>;
7
- };
8
- declare class ConfigService {
9
- private static instance;
10
- private config;
11
- private constructor();
12
- static getInstance(): ConfigService;
13
- initialize(config: Config): void;
14
- getConfig(): Config;
15
- getToken(): Promise<string>;
16
- }
17
- export declare const configService: ConfigService;
18
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Utility functions for dynamic theming
3
- */
4
- export interface ThemeColors {
5
- primaryColor?: string;
6
- }
7
- /**
8
- * Generate dynamic styles for primary color
9
- */
10
- export declare const getPrimaryColorStyles: (primaryColor?: string) => import("react").CSSProperties;
@@ -1,145 +0,0 @@
1
- export interface HelpCenterProps extends React.HTMLAttributes<HTMLDivElement> {
2
- helpScreenId: string;
3
- primaryColor?: string;
4
- language?: 'ar' | 'en';
5
- }
6
- export interface Theme {
7
- primary: string;
8
- secondary: string;
9
- text: string;
10
- background: string;
11
- error: string;
12
- success: string;
13
- }
14
- export interface UserData {
15
- id: string;
16
- name: string;
17
- email: string;
18
- avatar?: string;
19
- }
20
- export interface Message {
21
- id: number;
22
- senderType: number;
23
- messageContent: string;
24
- sentAt: Date;
25
- isSeen: boolean;
26
- attachmentIds?: string[];
27
- attachmentUrls?: string[];
28
- }
29
- export interface ChatSession {
30
- id: string;
31
- messages: Message[];
32
- participants: UserData[];
33
- status: 'active' | 'closed';
34
- createdAt: Date;
35
- updatedAt: Date;
36
- }
37
- export interface ChatSessionData {
38
- helpScreenId: string;
39
- user: UserData;
40
- initialMessage?: string;
41
- }
42
- export interface HelpCenterConfig {
43
- baseUrl: string;
44
- getToken: () => Promise<{
45
- token: string;
46
- expiresIn: number;
47
- }>;
48
- helpScreenId: string;
49
- user?: UserData;
50
- theme?: Partial<Theme>;
51
- onMessageReceived?: (message: Message) => void;
52
- onSessionClosed?: () => void;
53
- onError?: (error: Error) => void;
54
- }
55
- export interface HelpScreenOption {
56
- id: string;
57
- title: string;
58
- paragraphs?: string[];
59
- nestedOptions?: HelpScreenOption[];
60
- chatWithUs?: boolean;
61
- }
62
- export interface HelpScreen {
63
- id: string;
64
- title: string;
65
- options: HelpScreenOption[];
66
- }
67
- export interface ApiResponse<T> {
68
- data: T;
69
- success: boolean;
70
- error?: string;
71
- }
72
- export interface TokenResponse {
73
- token: string;
74
- expiresIn: number;
75
- }
76
- export interface HelpScreenData {
77
- id: string;
78
- tenantId: string;
79
- tenant: {
80
- id: string;
81
- name: string;
82
- key: string;
83
- logoUrl: string;
84
- settings: {
85
- description: string;
86
- };
87
- };
88
- title: string;
89
- description: string;
90
- options: Option[];
91
- chatWithUs: boolean;
92
- }
93
- export interface Option {
94
- id: string;
95
- helpScreenId: string;
96
- parentOptionId: string | null;
97
- parentOption: Option | null;
98
- files: any[];
99
- nestedOptions: Option[];
100
- title: string;
101
- paragraphs: string[];
102
- chatWithUs: boolean;
103
- assistantId?: string;
104
- assistant?: {
105
- id: string;
106
- tenantId: string;
107
- tenant: {
108
- id: string;
109
- name: string;
110
- key: string;
111
- };
112
- name: string;
113
- openAIAssistantId: string;
114
- greeting: string;
115
- closing: string;
116
- };
117
- hasNestedOptions: boolean;
118
- order: number;
119
- }
120
- export interface ReviewProps {
121
- comment?: string;
122
- rating: number;
123
- }
124
- export interface PresignUploadRequestDto {
125
- name: string;
126
- contentType: string;
127
- sizeBytes: number;
128
- pathData: {
129
- type: number;
130
- chatSessionId: string;
131
- };
132
- }
133
- export interface PresignUploadResponse {
134
- id: string;
135
- uploadUrl: string;
136
- path: string;
137
- expiresAt: string;
138
- }
139
- export interface PresignDownloadResponse {
140
- id: string;
141
- name: string;
142
- downloadUrl: string;
143
- contentType: string;
144
- expiresAt: string;
145
- }
@@ -1,2 +0,0 @@
1
- import { type ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
Binary file
@@ -1,5 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 55 53">
2
- <path fill="#E5E5E5" d="M8.531 19.135c0-6.855 5.557-12.412 12.412-12.412H41.63c6.855 0 12.412 5.557 12.412 12.412v33.099H20.943c-6.855 0-12.412-5.557-12.412-12.412V19.135Z"/>
3
- <path fill="#fff" d="M0 12.412C0 5.557 5.557 0 12.412 0h20.687C39.954 0 45.51 5.557 45.51 12.412v20.687c0 6.855-5.558 12.412-12.413 12.412H0V12.412Z"/>
4
- <path fill="currentColor" d="m14.368 15.22.002-.007c.18-.631 1.076-.631 1.256 0l.002.007.006.022a8.848 8.848 0 0 0 6.102 6.102l.022.006.007.002c.631.18.631 1.075 0 1.256l-.007.002-.022.006a8.848 8.848 0 0 0-6.102 6.102l-.006.021-.002.007c-.18.632-1.075.632-1.256 0l-.002-.007-.006-.02a8.848 8.848 0 0 0-6.13-6.111c-.632-.18-.632-1.076 0-1.256l.007-.002.02-.006a8.848 8.848 0 0 0 6.103-6.102l.006-.022Zm22.352 6.63c0 3.07-2.431 5.56-5.43 5.56-3 0-5.43-2.49-5.43-5.56 0-3.07 2.43-5.56 5.43-5.56 2.999 0 5.43 2.49 5.43 5.56Z"/>
5
- </svg>
@@ -1,5 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 327 14">
2
- <path stroke="currentColor" d="M132.5 7.5H0"/>
3
- <path fill="currentColor" d="m162.891.465.002-.007c.174-.61 1.04-.61 1.214 0l.002.007.006.02a8.553 8.553 0 0 0 5.9 5.9l.02.006.007.002c.611.174.611 1.04 0 1.214l-.007.002-.02.006a8.553 8.553 0 0 0-5.9 5.9l-.006.02-.002.007c-.174.61-1.04.61-1.214 0l-.002-.007-.006-.02a8.553 8.553 0 0 0-5.9-5.9l-.02-.006-.007-.002c-.611-.174-.611-1.04 0-1.214l.007-.002.02-.006a8.553 8.553 0 0 0 5.9-5.9l.006-.02Z"/>
4
- <path stroke="currentColor" d="M327 7.5H194.5"/>
5
- </svg>
@@ -1 +0,0 @@
1
- export * from './shared'
@@ -1,38 +0,0 @@
1
- import { cn } from '../../../lib'
2
- import { cva, type VariantProps } from 'class-variance-authority'
3
-
4
- const buttonVariants = cva(
5
- 'babylai:border babylai:disabled:bg-black-white-300 babylai:cursor-pointer babylai:text-xl! babylai:transition-all babylai:w-full babylai:disabled:border-black-white-300 babylai:disabled:cursor-not-allowed babylai:disabled:text-white babylai:duration-200 babylai:ease-out babylai:flex babylai:gap-1 babylai:items-center babylai:justify-center babylai:p-3 babylai:relative babylai:rounded-2xl',
6
- {
7
- variants: {
8
- variant: {
9
- default: 'babylai:bg-primary babylai:border-primary babylai:text-white babylai:hover:bg-primary-600 babylai:hover:border-primary-600',
10
- secondary:
11
- 'babylai:bg-transparent babylai:border-primary babylai:text-primary babylai:hover:bg-primary-100 babylai:hover:border-primary-200',
12
- ghost:
13
- 'babylai:bg-transparent babylai:p-2 babylai:text-secondary-foreground babylai:shadow-sm babylai:hover:bg-secondary/80',
14
- },
15
- size: {
16
- default: '',
17
- sm: 'babylai:h-8 babylai:rounded-full babylai:px-3 babylai:text-xs',
18
- lg: '',
19
- icon: 'babylai:h-7 babylai:w-7'
20
- }
21
- },
22
- defaultVariants: {
23
- variant: 'default'
24
- }
25
- }
26
- )
27
-
28
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
29
- asChild?: boolean
30
- }
31
-
32
- export const Button = ({ children, className, variant, ...props }: ButtonProps) => {
33
- return (
34
- <button className={cn(buttonVariants({ variant, className }), className)} {...props}>
35
- {children}
36
- </button>
37
- )
38
- }
@@ -1 +0,0 @@
1
- export * from './button'
@@ -1,44 +0,0 @@
1
- import * as React from 'react'
2
- import { cn } from '@/lib/utils'
3
-
4
- interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
5
- variant?: 'default' | 'rounded' | 'shadowed'
6
- }
7
-
8
- const Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, variant = 'default', ...props }, ref) => {
9
- const variantStyles = {
10
- default: 'babylai:rounded-xl babylai:border babylai:bg-card babylai:text-card-foreground babylai:shadow',
11
- rounded: 'babylai:rounded-3xl babylai:bg-black-white-50 babylai:py-4 babylai:px-3',
12
- shadowed: 'babylai:rounded-xl babylai:border babylai:bg-card babylai:text-card-foreground babylai:shadow-lg'
13
- }
14
-
15
- return <div ref={ref} className={cn(variantStyles[variant], className)} {...props} />
16
- })
17
- Card.displayName = 'Card'
18
-
19
- const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
20
- <div ref={ref} className={cn('babylai:flex babylai:flex-col babylai:space-y-1.5 babylai:p-6', className)} {...props} />
21
- ))
22
- CardHeader.displayName = 'CardHeader'
23
-
24
- const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
25
- <div ref={ref} className={cn('babylai:font-semibold babylai:leading-none babylai:tracking-tight', className)} {...props} />
26
- ))
27
- CardTitle.displayName = 'CardTitle'
28
-
29
- const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
30
- <div ref={ref} className={cn('babylai:text-sm babylai:text-muted-foreground', className)} {...props} />
31
- ))
32
- CardDescription.displayName = 'CardDescription'
33
-
34
- const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
35
- <div ref={ref} className={cn('babylai:p-6 babylai:pt-0', className)} {...props} />
36
- ))
37
- CardContent.displayName = 'CardContent'
38
-
39
- const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
40
- <div ref={ref} className={cn('babylai:flex babylai:items-center babylai:p-6 babylai:pt-0', className)} {...props} />
41
- ))
42
- CardFooter.displayName = 'CardFooter'
43
-
44
- export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
@@ -1 +0,0 @@
1
- export * from './card'
@@ -1,2 +0,0 @@
1
- export * from './Button'
2
- export * from './Card'
@@ -1,57 +0,0 @@
1
- import { useTypewriter } from "@/lib/custom-hooks/useTypewriter";
2
- import Markdown from "react-markdown";
3
- import type { Element } from "hast";
4
-
5
- interface AgentResponseProps {
6
- messageContent: string;
7
- senderType: number;
8
- messageId: number;
9
- onType?: () => void;
10
- }
11
-
12
- const seenMessagesRef = new Set<number>();
13
-
14
- const AgentResponse = ({
15
- senderType,
16
- messageContent,
17
- messageId,
18
- onType,
19
- }: AgentResponseProps) => {
20
- // Ensure messageContent is always a string to prevent errors
21
- const safeMessageContent = messageContent ?? "";
22
- const shouldAnimate =
23
- (senderType === 2 || senderType === 3) && !seenMessagesRef.has(messageId);
24
- const animatedText = useTypewriter(safeMessageContent, 20, onType);
25
- const finalMessage = shouldAnimate ? animatedText : safeMessageContent;
26
-
27
- // Mark message as "seen" after full animation
28
- if (shouldAnimate && finalMessage === safeMessageContent) {
29
- seenMessagesRef.add(messageId);
30
- }
31
-
32
- return (
33
- <div
34
- dir="auto"
35
- className={`babylai:rounded-2xl babylai:p-4 ${
36
- senderType === 1
37
- ? "babylai:bg-primary-500 babylai:text-black-white-50 babylai:max-w-[220px]"
38
- : "babylai:bg-card"
39
- }`}
40
- >
41
- <Markdown
42
- components={{
43
- p: ({ node, ...props }: { node?: Element; [key: string]: any }) => (
44
- <p
45
- className="babylai:m-0 babylai:leading-snug babylai:text-sm babylai:font-sans babylai:wrap-break-word"
46
- {...props}
47
- />
48
- ),
49
- }}
50
- >
51
- {finalMessage}
52
- </Markdown>
53
- </div>
54
- );
55
- };
56
-
57
- export default AgentResponse;