@aslaluroba/help-center-react 3.0.13 → 3.0.14
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/README.md +2 -3
- package/dist/components/ui/header.d.ts +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.esm.js +153 -3771
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +153 -3777
- package/dist/index.js.map +1 -1
- package/dist/services.d.ts +3 -0
- package/dist/services.esm.js +13770 -0
- package/dist/services.esm.js.map +1 -0
- package/dist/services.js +13779 -0
- package/dist/services.js.map +1 -0
- package/dist/ui/floating-message.d.ts +2 -2
- package/dist/ui/help-button.d.ts +2 -2
- package/dist/ui/help-center.d.ts +2 -2
- package/dist/ui/help-popup.d.ts +2 -2
- package/package.json +6 -1
- package/src/components/ui/header.tsx +4 -2
- package/src/index.ts +7 -11
- package/src/services.ts +11 -1
- package/src/ui/chatbot-popup/error-screen/index.tsx +2 -2
- package/src/ui/chatbot-popup/home-screen/card.tsx +2 -2
- package/src/ui/chatbot-popup/home-screen/chat-now-card.tsx +3 -3
- package/src/ui/chatbot-popup/home-screen/index.tsx +1 -1
- package/src/ui/chatbot-popup/loading-screen/index.tsx +2 -2
- package/src/ui/floating-message.tsx +5 -2
- package/src/ui/help-button.tsx +4 -2
- package/src/ui/help-center.tsx +10 -8
- package/src/ui/help-popup.tsx +5 -3
- package/src/ui/powered-by.tsx +1 -1
|
@@ -2,5 +2,5 @@ interface FloatingMessageProps {
|
|
|
2
2
|
message: string;
|
|
3
3
|
onClose: () => void;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
declare const FloatingMessage: ({ message, onClose }: FloatingMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default FloatingMessage;
|
package/dist/ui/help-button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface HelpButtonProps {
|
|
2
2
|
onClick: () => void;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
declare const HelpButton: ({ onClick }: HelpButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default HelpButton;
|
package/dist/ui/help-center.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ interface HelpCenterProps {
|
|
|
15
15
|
secondaryColor?: string;
|
|
16
16
|
logoUrl?: string;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
export
|
|
18
|
+
declare const HelpCenter: ({ helpScreenId, user, showArrow, language, messageLabel, showHelpScreen, primaryColor, secondaryColor, logoUrl, }: HelpCenterProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default HelpCenter;
|
package/dist/ui/help-popup.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ type HelpPopupProps = {
|
|
|
20
20
|
showHelpScreen: boolean;
|
|
21
21
|
logoUrl?: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
export
|
|
23
|
+
declare const HelpPopup: ({ onClose, helpScreen, status, error, onStartChat, onSendMessage, onEndChat, messages, assistantStatus, needsAgent, sessionId, selectedOption, setSelectedOption, showHelpScreen, isAblyConnected, logoUrl, }: HelpPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export default HelpPopup;
|
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.0.
|
|
6
|
+
"version": "3.0.14",
|
|
7
7
|
"description": "BabylAI Help Center Widget for React and Next.js",
|
|
8
8
|
"private": false,
|
|
9
9
|
"exports": {
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"require": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
14
|
},
|
|
15
|
+
"./services": {
|
|
16
|
+
"import": "./dist/services.esm.js",
|
|
17
|
+
"require": "./dist/services.js",
|
|
18
|
+
"types": "./dist/services.d.ts"
|
|
19
|
+
},
|
|
15
20
|
"./style.css": {
|
|
16
21
|
"default": "./dist/index.css"
|
|
17
22
|
}
|
|
@@ -6,15 +6,17 @@ interface HeaderProps {
|
|
|
6
6
|
logoUrl?: string
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const Header = ({ onClose, logoUrl }: HeaderProps) => {
|
|
10
10
|
return (
|
|
11
11
|
<header className="babylai-flex babylai-w-full babylai-justify-between babylai-items-center">
|
|
12
12
|
{logoUrl ? (
|
|
13
13
|
<img src={logoUrl} alt="BabylAI Logo" className="babylai-w-10 babylai-h-10" />
|
|
14
14
|
) : (
|
|
15
|
-
<Logo className="babylai-w-10 babylai-h-10" />
|
|
15
|
+
<Logo className="babylai-w-10 babylai-h-10 babylai-text-primary-500" />
|
|
16
16
|
)}
|
|
17
17
|
<CloseCircle className="babylai-w-10 babylai-h-10 babylai-cursor-pointer babylai-text-white" onClick={onClose} />
|
|
18
18
|
</header>
|
|
19
19
|
)
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
export default Header;
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { configService } from './lib/config';
|
|
2
2
|
import { TokenResponse } from './lib/types';
|
|
3
3
|
|
|
4
|
+
// Main component export
|
|
5
|
+
export { default as HelpCenter } from './ui/help-center';
|
|
6
|
+
|
|
7
|
+
// Essential types and functions for HMR compatibility
|
|
4
8
|
export type HelpCenterConfig = {
|
|
5
9
|
baseUrl?: string;
|
|
6
10
|
getToken?: () => Promise<TokenResponse>;
|
|
7
11
|
};
|
|
8
12
|
|
|
13
|
+
// Initialize function - defined here to avoid HMR issues with re-exports
|
|
9
14
|
export function initializeHelpCenter(config: HelpCenterConfig) {
|
|
10
15
|
configService.initialize(config);
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// Types
|
|
17
|
-
export * from './lib/types';
|
|
18
|
-
|
|
19
|
-
// API functions
|
|
20
|
-
export { initializeAPI, getValidToken, apiRequest } from './core/api';
|
|
21
|
-
|
|
22
|
-
// Re-export services for backward compatibility
|
|
23
|
-
export * from './services';
|
|
18
|
+
// Note: Additional services and utilities are available from './services'
|
|
19
|
+
// For services, import them directly: import { ApiService } from 'babylai-fe-react-sdk/services'
|
package/src/services.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
// Services export file
|
|
1
|
+
// Services export file - separate from main component exports
|
|
2
|
+
// This prevents Fast Refresh issues with non-React components
|
|
3
|
+
|
|
4
|
+
// Re-export services for backward compatibility
|
|
2
5
|
export { ApiService } from './core/ApiService';
|
|
3
6
|
export { ClientAblyService as AblyService } from './core/AblyService';
|
|
4
7
|
export { TokenService } from './core/token-service';
|
|
8
|
+
|
|
9
|
+
// Re-export API functions
|
|
10
|
+
export { initializeAPI, getValidToken, apiRequest } from './core/api';
|
|
11
|
+
|
|
12
|
+
// Re-export types that might be needed with services
|
|
13
|
+
export type { TokenResponse } from './lib/types';
|
|
14
|
+
export * from './lib/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Header from '@/components/ui/header'
|
|
2
2
|
|
|
3
3
|
interface ChatBotErrorScreenProps {
|
|
4
4
|
onClose: () => void
|
|
@@ -9,7 +9,7 @@ interface ChatBotErrorScreenProps {
|
|
|
9
9
|
const ChatBotErrorScreen: React.FC<ChatBotErrorScreenProps> = (props) => {
|
|
10
10
|
return (
|
|
11
11
|
<div className="babylai-w-full babylai-h-full babylai-bg-black-white-50 babylai-rounded-3xl babylai-shadow-lg babylai-z-50 babylai-flex babylai-flex-col">
|
|
12
|
-
<div className="babylai-h-full babylai-rounded-3xl babylai-flex babylai-flex-col babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60 babylai-py-6 md:babylai-py-8 babylai-px-6 babylai-gap-4 md:babylai-gap-8">
|
|
12
|
+
<div className="babylai-h-full babylai-rounded-3xl babylai-flex babylai-flex-col babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60 babylai-py-6 md:babylai-py-8 babylai-px-6 babylai-gap-4 md:babylai-gap-8 dark:babylai-from-storm-dust-950 dark:babylai-to-storm-dust-950/60">
|
|
13
13
|
<Header onClose={props.onClose} logoUrl={props.logoUrl} />
|
|
14
14
|
<div className="babylai-flex babylai-flex-col babylai-items-center babylai-justify-center babylai-w-full babylai-h-full babylai-px-6 babylai-py-16 md:babylai-py-28">
|
|
15
15
|
<div className="babylai-text-white babylai-text-lg">Error: {props.error}</div>
|
|
@@ -12,8 +12,8 @@ const Card: React.FC<CardProps> = (props) => {
|
|
|
12
12
|
const isRTL = String(dir) === "rtl";
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<div className="babylai-flex babylai-items-center babylai-justify-between babylai-gap-4 babylai-bg-black-white-50 babylai-rounded-3xl babylai-p-6">
|
|
16
|
-
<p className="babylai-text-base md:babylai-text-lg babylai-font-medium babylai-text-black-white-800">
|
|
15
|
+
<div className="babylai-flex babylai-items-center babylai-justify-between babylai-gap-4 babylai-bg-black-white-50 babylai-rounded-3xl babylai-p-6 dark:babylai-bg-storm-dust-900">
|
|
16
|
+
<p className="babylai-text-base md:babylai-text-lg babylai-font-medium babylai-text-black-white-800 dark:babylai-text-white">
|
|
17
17
|
{props.text}
|
|
18
18
|
</p>
|
|
19
19
|
<Button
|
|
@@ -10,14 +10,14 @@ const ChatNowCard: React.FC<ChatNowCardProps> = (props) => {
|
|
|
10
10
|
const { t } = useLocalTranslation();
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
|
-
<div className="babylai-flex babylai-flex-col babylai-gap-7 babylai-bg-black-white-50 babylai-rounded-3xl babylai-p-8">
|
|
13
|
+
<div className="babylai-flex babylai-flex-col babylai-gap-7 babylai-bg-black-white-50 babylai-rounded-3xl babylai-p-8 dark:babylai-bg-storm-dust-900">
|
|
14
14
|
<div className="babylai-flex babylai-gap-3 babylai-items-center babylai-justify-start">
|
|
15
15
|
<div className="babylai-p-4 babylai-rounded-full babylai-bg-primary-500 babylai-shrink-0">
|
|
16
16
|
<Logo className="babylai-w-12 babylai-h-12 babylai-text-primary-500" />
|
|
17
17
|
</div>
|
|
18
18
|
<div className="babylai-flex babylai-flex-col babylai-gap-0 babylai-text-base">
|
|
19
|
-
<p className="babylai-font-semibold babylai-text-black-white-500">BabylAI</p>
|
|
20
|
-
<p className="babylai-font-semibold babylai-text-black-white-800">
|
|
19
|
+
<p className="babylai-font-semibold babylai-text-black-white-500 dark:babylai-text-white">BabylAI</p>
|
|
20
|
+
<p className="babylai-font-semibold babylai-text-black-white-800 dark:babylai-text-white">
|
|
21
21
|
{t('homeSdk.welcomeMessage')}
|
|
22
22
|
</p>
|
|
23
23
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Header from '@/components/ui/header'
|
|
2
2
|
import Card from '@/ui/chatbot-popup/home-screen/card'
|
|
3
3
|
import ChatNowCard from '@/ui/chatbot-popup/home-screen/chat-now-card'
|
|
4
4
|
import { useLocalTranslation } from '../../../useLocalTranslation'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Header from '@/components/ui/header'
|
|
2
2
|
import { cn } from '@/lib'
|
|
3
3
|
import animatedLogo from '../../../assets/animatedLogo.gif'
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ const ChatBotLoadingScreen: React.FC<ChatBotLoadingScreenProps> = (props) => {
|
|
|
15
15
|
className={cn(
|
|
16
16
|
'babylai-rounded-3xl babylai-h-full babylai-flex babylai-flex-col babylai-py-6 md:babylai-py-8 babylai-px-6 babylai-gap-4 md:babylai-gap-8',
|
|
17
17
|
{
|
|
18
|
-
'babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60': !props.isShowList,
|
|
18
|
+
'babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60 dark:babylai-from-storm-dust-950 dark:babylai-to-storm-dust-950/60': !props.isShowList,
|
|
19
19
|
'babylai-bg-black-white-100 dark:babylai-bg-storm-dust-950': props.isShowList
|
|
20
20
|
}
|
|
21
21
|
)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import CloseIcon from '
|
|
1
|
+
import CloseIcon from '@/assets/icons/close.svg'
|
|
2
2
|
interface FloatingMessageProps {
|
|
3
3
|
message: string
|
|
4
4
|
onClose: () => void
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
const FloatingMessage = ({ message, onClose }: FloatingMessageProps) => {
|
|
7
8
|
return (
|
|
8
9
|
<div
|
|
9
10
|
className="
|
|
@@ -22,3 +23,5 @@ export function FloatingMessage({ message, onClose }: FloatingMessageProps) {
|
|
|
22
23
|
</div>
|
|
23
24
|
)
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
export default FloatingMessage;
|
package/src/ui/help-button.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Logo from '
|
|
1
|
+
import Logo from '@/assets/logo.svg'
|
|
2
2
|
|
|
3
3
|
interface HelpButtonProps {
|
|
4
4
|
onClick: () => void
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const HelpButton = ({ onClick }: HelpButtonProps) => {
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<button
|
|
@@ -20,3 +20,5 @@ export function HelpButton({ onClick }: HelpButtonProps) {
|
|
|
20
20
|
</button>
|
|
21
21
|
)
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
export default HelpButton;
|
package/src/ui/help-center.tsx
CHANGED
|
@@ -4,10 +4,10 @@ import { apiRequest } from '../core/api';
|
|
|
4
4
|
import { ClientAblyService } from '../core/AblyService';
|
|
5
5
|
import { useLocalTranslation } from '../useLocalTranslation';
|
|
6
6
|
import '../globals.css';
|
|
7
|
-
import { HelpScreenData, Message, Option, ReviewProps } from '
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import { HelpScreenData, Message, Option, ReviewProps } from '@/lib/types';
|
|
8
|
+
import FloatingMessage from './floating-message';
|
|
9
|
+
import HelpButton from './help-button';
|
|
10
|
+
import HelpPopup from './help-popup';
|
|
11
11
|
import { defaultLanguage } from '@/i18n';
|
|
12
12
|
import { LanguageProvider } from '@/lib/LanguageContext';
|
|
13
13
|
import { getThemeStyles } from '@/lib/theme-utils';
|
|
@@ -29,7 +29,7 @@ interface HelpCenterProps {
|
|
|
29
29
|
logoUrl?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const HelpCenterContent = ({
|
|
33
33
|
helpScreenId,
|
|
34
34
|
user,
|
|
35
35
|
showArrow = true,
|
|
@@ -38,7 +38,7 @@ function HelpCenterContent({
|
|
|
38
38
|
primaryColor,
|
|
39
39
|
secondaryColor,
|
|
40
40
|
logoUrl,
|
|
41
|
-
}: Omit<HelpCenterProps, 'language'>) {
|
|
41
|
+
}: Omit<HelpCenterProps, 'language'>) => {
|
|
42
42
|
const { t } = useLocalTranslation();
|
|
43
43
|
const [isOpen, setIsOpen] = useState(false);
|
|
44
44
|
const [showArrowAnimation, setShowArrowAnimation] = useState(showArrow);
|
|
@@ -321,7 +321,7 @@ function HelpCenterContent({
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// Main HelpCenter component that provides the language context
|
|
324
|
-
|
|
324
|
+
const HelpCenter = ({
|
|
325
325
|
helpScreenId,
|
|
326
326
|
user,
|
|
327
327
|
showArrow = true,
|
|
@@ -331,7 +331,7 @@ export function HelpCenter({
|
|
|
331
331
|
primaryColor,
|
|
332
332
|
secondaryColor,
|
|
333
333
|
logoUrl,
|
|
334
|
-
}: HelpCenterProps) {
|
|
334
|
+
}: HelpCenterProps) => {
|
|
335
335
|
return (
|
|
336
336
|
<LanguageProvider language={language}>
|
|
337
337
|
<HelpCenterContent
|
|
@@ -347,3 +347,5 @@ export function HelpCenter({
|
|
|
347
347
|
</LanguageProvider>
|
|
348
348
|
);
|
|
349
349
|
}
|
|
350
|
+
|
|
351
|
+
export default HelpCenter;
|
package/src/ui/help-popup.tsx
CHANGED
|
@@ -35,7 +35,7 @@ type HelpPopupProps = {
|
|
|
35
35
|
logoUrl?: string;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const HelpPopup = ({
|
|
39
39
|
onClose,
|
|
40
40
|
helpScreen,
|
|
41
41
|
status,
|
|
@@ -52,7 +52,7 @@ export function HelpPopup({
|
|
|
52
52
|
showHelpScreen,
|
|
53
53
|
isAblyConnected,
|
|
54
54
|
logoUrl,
|
|
55
|
-
}: HelpPopupProps) {
|
|
55
|
+
}: HelpPopupProps) => {
|
|
56
56
|
// ALL HOOKS MUST BE CALLED FIRST - BEFORE ANY EARLY RETURNS
|
|
57
57
|
const [showChat, setShowChat] = useState(false);
|
|
58
58
|
const [isShowList, setIsShowList] = useState<boolean>(!showHelpScreen || false);
|
|
@@ -286,7 +286,7 @@ md:babylai-bottom-[6rem] md:babylai-right-4 babylai-rounded-none md:babylai-roun
|
|
|
286
286
|
className={cn(
|
|
287
287
|
'babylai-h-full babylai-rounded-none md:babylai-rounded-3xl babylai-flex babylai-flex-col babylai-relative',
|
|
288
288
|
{
|
|
289
|
-
'babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60': !isShowList,
|
|
289
|
+
'babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60 dark:babylai-from-storm-dust-950 dark:babylai-to-storm-dust-950/60': !isShowList,
|
|
290
290
|
'babylai-bg-black-white-100 dark:babylai-bg-storm-dust-950': isShowList,
|
|
291
291
|
}
|
|
292
292
|
)}
|
|
@@ -312,3 +312,5 @@ md:babylai-bottom-[6rem] md:babylai-right-4 babylai-rounded-none md:babylai-roun
|
|
|
312
312
|
</div>
|
|
313
313
|
);
|
|
314
314
|
}
|
|
315
|
+
|
|
316
|
+
export default HelpPopup;
|
package/src/ui/powered-by.tsx
CHANGED
|
@@ -4,7 +4,7 @@ const PoweredBy: React.FC = () => {
|
|
|
4
4
|
const { t } = useLocalTranslation();
|
|
5
5
|
|
|
6
6
|
return (
|
|
7
|
-
<section className="babylai-text-primary-500 babylai-font-bold babylai-text-center babylai-px-8 babylai-py-2 babylai-w-full">
|
|
7
|
+
<section className="babylai-text-primary-500 dark:babylai-text-white babylai-font-bold babylai-text-center babylai-px-8 babylai-py-2 babylai-w-full">
|
|
8
8
|
<a
|
|
9
9
|
href="https://www.babylai.net/"
|
|
10
10
|
target="_blank"
|