@aslaluroba/help-center-react 1.0.1

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 (100) hide show
  1. package/README.md +176 -0
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/components/shared/Button/button.d.ts +11 -0
  4. package/dist/components/shared/Button/index.d.ts +1 -0
  5. package/dist/components/shared/Card/card.d.ts +11 -0
  6. package/dist/components/shared/Card/index.d.ts +1 -0
  7. package/dist/components/shared/index.d.ts +2 -0
  8. package/dist/components/ui/agent-response/agent-response.d.ts +9 -0
  9. package/dist/components/ui/header.d.ts +6 -0
  10. package/dist/core/ApiService.d.ts +16 -0
  11. package/dist/core/SignalRService.d.ts +11 -0
  12. package/dist/core/api.d.ts +4 -0
  13. package/dist/core/token-service.d.ts +10 -0
  14. package/dist/i18n.d.ts +2 -0
  15. package/dist/index.d.ts +12 -0
  16. package/dist/index.esm.js +26076 -0
  17. package/dist/index.esm.js.map +1 -0
  18. package/dist/index.js +26110 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/lib/config.d.ts +19 -0
  21. package/dist/lib/custom-hooks/useTypewriter.d.ts +1 -0
  22. package/dist/lib/index.d.ts +1 -0
  23. package/dist/lib/types.d.ts +111 -0
  24. package/dist/lib/utils.d.ts +2 -0
  25. package/dist/ui/chatbot-popup/chat-window-screen/footer.d.ts +9 -0
  26. package/dist/ui/chatbot-popup/chat-window-screen/header.d.ts +11 -0
  27. package/dist/ui/chatbot-popup/chat-window-screen/index.d.ts +10 -0
  28. package/dist/ui/chatbot-popup/error-screen/index.d.ts +7 -0
  29. package/dist/ui/chatbot-popup/home-screen/card.d.ts +7 -0
  30. package/dist/ui/chatbot-popup/home-screen/chat-now-card.d.ts +6 -0
  31. package/dist/ui/chatbot-popup/home-screen/index.d.ts +7 -0
  32. package/dist/ui/chatbot-popup/loading-screen/index.d.ts +7 -0
  33. package/dist/ui/chatbot-popup/options-list-screen/expanded-option.d.ts +8 -0
  34. package/dist/ui/chatbot-popup/options-list-screen/header.d.ts +7 -0
  35. package/dist/ui/chatbot-popup/options-list-screen/index.d.ts +12 -0
  36. package/dist/ui/chatbot-popup/options-list-screen/option-card.d.ts +6 -0
  37. package/dist/ui/floating-message.d.ts +7 -0
  38. package/dist/ui/help-button.d.ts +6 -0
  39. package/dist/ui/help-center.d.ts +17 -0
  40. package/dist/ui/help-popup.d.ts +24 -0
  41. package/dist/useLocalTranslation.d.ts +5 -0
  42. package/package.json +86 -0
  43. package/src/assets/animatedLogo.gif +0 -0
  44. package/src/assets/icons/arrowRight.svg +3 -0
  45. package/src/assets/icons/chat.svg +4 -0
  46. package/src/assets/icons/close.svg +1 -0
  47. package/src/assets/icons/closeCircle.svg +3 -0
  48. package/src/assets/icons/closeCirclePrimary.svg +3 -0
  49. package/src/assets/icons/envelope.svg +3 -0
  50. package/src/assets/icons/seperator.svg +5 -0
  51. package/src/assets/icons/threeDots.svg +3 -0
  52. package/src/assets/icons/user.svg +3 -0
  53. package/src/assets/logo.svg +5 -0
  54. package/src/assets/logoColors.svg +5 -0
  55. package/src/assets/logo_ai.svg +14 -0
  56. package/src/assets/thinking-logo.svg +3 -0
  57. package/src/components/index.ts +1 -0
  58. package/src/components/shared/Button/button.tsx +46 -0
  59. package/src/components/shared/Button/index.ts +1 -0
  60. package/src/components/shared/Card/card.tsx +44 -0
  61. package/src/components/shared/Card/index.ts +1 -0
  62. package/src/components/shared/index.ts +2 -0
  63. package/src/components/ui/agent-response/agent-response.tsx +47 -0
  64. package/src/components/ui/agent-response/doc.md +88 -0
  65. package/src/components/ui/header.tsx +17 -0
  66. package/src/components/ui/index.ts +0 -0
  67. package/src/core/ApiService.ts +118 -0
  68. package/src/core/SignalRService.ts +83 -0
  69. package/src/core/api.ts +71 -0
  70. package/src/core/token-service.ts +35 -0
  71. package/src/globals.css +484 -0
  72. package/src/i18n.ts +17 -0
  73. package/src/index.ts +21 -0
  74. package/src/lib/config.ts +59 -0
  75. package/src/lib/custom-hooks/useTypewriter.ts +24 -0
  76. package/src/lib/index.ts +1 -0
  77. package/src/lib/types.ts +120 -0
  78. package/src/lib/utils.ts +6 -0
  79. package/src/locales/ar.json +13 -0
  80. package/src/locales/en.json +15 -0
  81. package/src/styles/tailwind.css +4 -0
  82. package/src/types/svg.d.ts +5 -0
  83. package/src/types.d.ts +9 -0
  84. package/src/ui/chatbot-popup/chat-window-screen/footer.tsx +42 -0
  85. package/src/ui/chatbot-popup/chat-window-screen/header.tsx +64 -0
  86. package/src/ui/chatbot-popup/chat-window-screen/index.tsx +103 -0
  87. package/src/ui/chatbot-popup/error-screen/index.tsx +22 -0
  88. package/src/ui/chatbot-popup/home-screen/card.tsx +34 -0
  89. package/src/ui/chatbot-popup/home-screen/chat-now-card.tsx +36 -0
  90. package/src/ui/chatbot-popup/home-screen/index.tsx +44 -0
  91. package/src/ui/chatbot-popup/loading-screen/index.tsx +33 -0
  92. package/src/ui/chatbot-popup/options-list-screen/expanded-option.tsx +38 -0
  93. package/src/ui/chatbot-popup/options-list-screen/header.tsx +38 -0
  94. package/src/ui/chatbot-popup/options-list-screen/index.tsx +59 -0
  95. package/src/ui/chatbot-popup/options-list-screen/option-card.tsx +20 -0
  96. package/src/ui/floating-message.tsx +25 -0
  97. package/src/ui/help-button.tsx +22 -0
  98. package/src/ui/help-center.tsx +303 -0
  99. package/src/ui/help-popup.tsx +264 -0
  100. package/src/useLocalTranslation.ts +14 -0
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
@@ -0,0 +1,13 @@
1
+ { "homeSdk": {
2
+ "chatTitle": "تحدث مع",
3
+ "tryBabylAi": "جرّب Babyl AI مجانًا 🎉",
4
+ "contactSdk": "تواصل معنا، دعنا نتحدث!",
5
+ "welcomeMessage": "مرحبًا! 👋 أنا Babyl AI، هنا لمساعدتك.",
6
+ "chatNow": "ابدأ المحادثة",
7
+ "getstarted": "للبدء",
8
+ "pickTopic": "اختر موضوعًا",
9
+ "endChat": "إنهاء المحادثة",
10
+ "needAssistance": "هل تحتاج مساعدة؟ لاتردد في اخباري اضغط هنا",
11
+ "placeholder": "اكتب سؤالك هنا"
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "homeSdk": {
3
+ "chatTitle": "Chat with",
4
+ "tryBabylAi": "Try Babyl AI for Free 🎉",
5
+ "contactSdk": "Contact us, Let's Talk!",
6
+ "welcomeMessage": "Hey there! 👋 I'm Babyl AI, here to assist you.",
7
+ "chatNow": "Chat Now",
8
+ "getstarted":"Get Started",
9
+ "pickTopic": "Pick a Topic to",
10
+ "endChat": "End Chat",
11
+ "needAssistance": "Need assistance Or You want to try the Product? Click here",
12
+ "placeholder":"write your message here..."
13
+
14
+ }
15
+ }
@@ -0,0 +1,4 @@
1
+ @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200..1000&display=swap');
2
+ @tailwind base;
3
+ @tailwind components;
4
+ @tailwind utilities;
@@ -0,0 +1,5 @@
1
+ declare module '*.svg' {
2
+ import React from 'react'
3
+ const SVG: React.FC<React.SVGProps<SVGSVGElement>>
4
+ export default SVG
5
+ }
package/src/types.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ declare module '*.css' {
2
+ const content: { [className: string]: string }
3
+ export default content
4
+ }
5
+
6
+ declare module '*.gif' {
7
+ const src: string
8
+ export default src
9
+ }
@@ -0,0 +1,42 @@
1
+ import { Button } from '@/components';
2
+ import React from 'react';
3
+ import EnvelopeIcon from './../../../assets/icons/envelope.svg';
4
+ import { useLocalTranslation } from '../../../useLocalTranslation'
5
+
6
+ interface ChatWindowFooterProps {
7
+ inputMessage: string;
8
+ setInputMessage: (e: string) => void;
9
+ handleKeyDown: (e: React.KeyboardEvent) => void;
10
+ handleSendMessage: () => void;
11
+ }
12
+
13
+ const ChatWindowFooter: React.FC<ChatWindowFooterProps> = (props) => {
14
+ const { t , i18n} = useLocalTranslation();
15
+ const isRTL = i18n.dir() === 'rtl';
16
+ return (
17
+ <footer className="babylai-flex babylai-items-center babylai-gap-2 babylai-relative babylai-rounded-full babylai-bg-white babylai-m-4 md:babylai-m-6 md:babylai-py-3 md:babylai-px-4">
18
+ <input
19
+ type="text"
20
+ value={props.inputMessage}
21
+ onChange={(e) => props.setInputMessage(e.target.value)}
22
+ onKeyDown={props.handleKeyDown}
23
+ placeholder={t('homeSdk.placeholder')}
24
+ className="babylai-flex-1 babylai-py-2 babylai-px-4 babylai-bg-transparent babylai-outline-none babylai-text-sm"
25
+ />
26
+ <Button
27
+ variant="default"
28
+ size="icon"
29
+ onClick={props.handleSendMessage}
30
+ className="babylai-rounded-full babylai-bg-purple-500 babylai-hover:babylai-bg-purple-600 babylai-w-8 babylai-h-8"
31
+ >
32
+ <EnvelopeIcon
33
+ className={`babylai-w-4 babylai-h-4 ${
34
+ isRTL ? 'babylai-rotate-270' : ''
35
+ }`}
36
+ />
37
+ </Button>
38
+ </footer>
39
+ )
40
+ }
41
+
42
+ export default ChatWindowFooter
@@ -0,0 +1,64 @@
1
+ import Logo from '../../../assets/logo_ai.svg'
2
+ import { Button } from '@/components';
3
+ import React, { useState } from 'react';
4
+ import ArrowRight from './../../../assets/icons/arrowRight.svg';
5
+ import ThreeDots from './../../../assets/icons/threeDots.svg';
6
+ import { useLocalTranslation } from '../../../useLocalTranslation'
7
+
8
+ interface ChatWindowHeaderProps {
9
+ isShowList: boolean;
10
+ setIsShowList?: (isShowList: boolean) => void;
11
+ showChat: boolean;
12
+ onClose: () => void;
13
+ handleBack: () => void;
14
+ handleEndChat: () => void;
15
+ }
16
+
17
+ const ChatWindowHeader: React.FC<ChatWindowHeaderProps> = (props) => {
18
+ const [showMenu, setShowMenu] = useState(false)
19
+ const { t , i18n} = useLocalTranslation();
20
+ const isRTL = i18n.dir() === 'rtl';
21
+
22
+ return (
23
+ <header className="babylai-flex babylai-w-full babylai-items-center babylai-py-[18px] babylai-px-[18px] babylai-justify-between babylai-relative babylai-bg-black-white-50 babylai-rounded-t-3xl">
24
+ <div className="babylai-flex babylai-items-center babylai-gap-2">
25
+ <Button variant="rounded-icon" size="icon" className="babylai-bg-primary-500/10" onClick={props.handleBack}>
26
+ <ArrowRight
27
+ className={`babylai-w-[12px] babylai-h-[12px] ${
28
+ isRTL ? '' : 'babylai-rotate-180'
29
+ } babylai-text-primary-500`}
30
+ /> </Button>
31
+ <div className="babylai-relative babylai-mr-2">
32
+ <Button variant="rounded-icon" size="icon" className="babylai-bg-primary-500/10" onClick={() => setShowMenu(!showMenu)}>
33
+ <ThreeDots className="babylai-w-[14px] babylai-h-[4px] babylai-text-primary-500" />
34
+ </Button>
35
+
36
+ {showMenu && (
37
+ <div className="babylai-absolute babylai-top-10 babylai-left-0 babylai-w-48 babylai-rounded-md babylai-shadow-lg babylai-bg-white babylai-ring-1 babylai-ring-black babylai-ring-opacity-5 babylai-z-10">
38
+ <div className="babylai-py-1" role="menu" aria-orientation="vertical">
39
+ <button
40
+ className="babylai-block babylai-px-4 babylai-py-2 babylai-text-sm babylai-text-gray-700 babylai-hover:babylai-bg-gray-100 babylai-w-full babylai-text-left"
41
+ role="menuitem"
42
+ onClick={(e) => {
43
+ e.stopPropagation()
44
+ props.handleEndChat()
45
+ setShowMenu(false)
46
+ }}
47
+ >
48
+ {t('homeSdk.endChat')}
49
+
50
+ </button>
51
+ </div>
52
+ </div>
53
+ )}
54
+ </div>
55
+ </div>
56
+ <div className="babylai-flex babylai-items-center babylai-gap-2 babylai-absolute babylai-left-1/2 babylai-transform babylai--translate-x-1/2">
57
+ <Logo className="babylai-w-[124px] babylai-h-auto" />
58
+ </div>
59
+
60
+ </header>
61
+ )
62
+
63
+ }
64
+ export default ChatWindowHeader
@@ -0,0 +1,103 @@
1
+ import AgentResponse from '@/components/ui/agent-response/agent-response'
2
+ import { Message } from '@/lib/types'
3
+ import ChatWindowFooter from '@/ui/chatbot-popup/chat-window-screen/footer'
4
+ import React, { useEffect, useRef, useState } from 'react'
5
+ import LoadingGif from './../../../assets/animatedLogo.gif'
6
+ import Seperator from './../../../assets/icons/seperator.svg'
7
+ import LogoIcon from './../../../assets/logo.svg'
8
+
9
+ interface ChatWindowProps {
10
+ onSendMessage: (message: string) => void
11
+ messages: Message[]
12
+ assistantStatus: string
13
+ needsAgent: boolean
14
+ }
15
+
16
+ export function ChatWindow({ onSendMessage, messages, assistantStatus = 'loading' }: ChatWindowProps) {
17
+ const [inputMessage, setInputMessage] = useState('')
18
+ const messagesEndRef = useRef<HTMLDivElement>(null)
19
+
20
+ const scrollToBottom = () => {
21
+ messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' })
22
+ }
23
+
24
+ useEffect(() => {
25
+ scrollToBottom()
26
+ }, [messages, assistantStatus])
27
+
28
+ const handleSendMessage = () => {
29
+ if (inputMessage.trim()) {
30
+ onSendMessage(inputMessage)
31
+ setInputMessage('')
32
+ }
33
+ }
34
+
35
+ const handleKeyDown = (e: React.KeyboardEvent) => {
36
+ if (e.key === 'Enter' && !e.shiftKey) {
37
+ e.preventDefault()
38
+ onSendMessage(inputMessage)
39
+ setInputMessage('')
40
+ }
41
+ }
42
+
43
+ // Find the first human agent message
44
+ const firstHumanAgentIndex = messages.findIndex((message) => message.senderType === 2)
45
+
46
+ return (
47
+ <>
48
+ <div className="babylai-flex-1 babylai-overflow-y-auto babylai-p-4 babylai-h-full">
49
+ {messages.map((message, index) => {
50
+ const isFirstInSequence = index === 0 || messages[index - 1].senderType !== message.senderType
51
+ const isFirstHumanAgentMessage = index === firstHumanAgentIndex && message.senderType === 2
52
+ const textDirection = message.senderType === 1 ? 'justify-end' : 'justify-start'
53
+
54
+ return (
55
+ <div key={message.id}>
56
+ {isFirstHumanAgentMessage && (
57
+ <div className="babylai-flex babylai-justify-center babylai-items-center babylai-my-4">
58
+ <Seperator className="babylai-w-full babylai-text-purple-500" />
59
+ </div>
60
+ )}
61
+ <div className={`babylai-mb-4 babylai-flex ${textDirection}`}>
62
+ {isFirstInSequence && message.senderType === 3 && (
63
+ <div className="babylai-flex-shrink-0 babylai-mr-3">
64
+ <div className="babylai-w-8 babylai-h-8 babylai-rounded-full babylai-bg-purple-500 babylai-flex babylai-items-center babylai-justify-center">
65
+ <LogoIcon className="babylai-w-4 babylai-h-4 babylai-text-white" />
66
+ </div>
67
+ </div>
68
+ )}
69
+ {!isFirstInSequence && <div className="babylai-flex-shrink-0 babylai-mr-3 babylai-w-8"></div>}
70
+
71
+ <AgentResponse
72
+ messageContent={message.messageContent}
73
+ senderType={message.senderType}
74
+ messageId={message.id}
75
+ onType={scrollToBottom} />
76
+ </div>
77
+ </div>
78
+ )
79
+ })}
80
+ {assistantStatus === 'typing' && firstHumanAgentIndex === -1 && (
81
+ <div className="babylai-mb-4 babylai-flex">
82
+ <div className="babylai-flex-shrink-0 babylai-mr-3">
83
+ <div className="babylai-w-8 babylai-h-8 babylai-rounded-full babylai-flex babylai-items-center babylai-justify-center">
84
+ <img src={LoadingGif} alt="Loading" className="babylai-w-8 babylai-h-8" />
85
+ </div>
86
+ </div>
87
+ <div className="babylai-max-w-[80%] babylai-rounded-2xl babylai-p-4 babylai-bg-white">
88
+ <p className="babylai-text-sm babylai-opacity-70">...</p>
89
+ </div>
90
+ </div>
91
+ )}
92
+ <div ref={messagesEndRef} />
93
+ </div>
94
+
95
+ <ChatWindowFooter
96
+ inputMessage={inputMessage}
97
+ handleKeyDown={(e) => handleKeyDown(e)}
98
+ handleSendMessage={handleSendMessage}
99
+ setInputMessage={setInputMessage}
100
+ />
101
+ </>
102
+ )
103
+ }
@@ -0,0 +1,22 @@
1
+ import { Header } from '@/components/ui/header'
2
+ import React from 'react'
3
+
4
+ interface ChatBotErrorScreenProps {
5
+ onClose: () => void
6
+ error: string
7
+ }
8
+
9
+ const ChatBotErrorScreen: React.FC<ChatBotErrorScreenProps> = (props) => {
10
+ return (
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="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 gap-4 md:gap-8">
13
+ <Header onClose={props.onClose} />
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
+ <div className="babylai-text-white babylai-text-lg">Error: {props.error}</div>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ )
20
+ }
21
+
22
+ export default ChatBotErrorScreen
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+
3
+ import { Button } from '@/components/shared';
4
+ import ArrowRight from '../../../assets/icons/arrowRight.svg';
5
+ import { useLocalTranslation } from '../../../useLocalTranslation'
6
+
7
+ interface CardProps {
8
+ text: string;
9
+ handleClick: () => void
10
+ }
11
+
12
+ const Card: React.FC<CardProps> = (props) => {
13
+ const { i18n } = useLocalTranslation();
14
+ const isLTR = i18n.dir() === 'ltr';
15
+ return (
16
+ <div className="babylai-flex babylai-items-center babylai-justify-between babylai-gap-4 babylai-bg-black-white-50 babylai-rounded-3xl babylai-p-6" >
17
+ <p className="babylai-text-base md:babylai-text-lg babylai-font-medium babylai-text-black-white-800">{props.text}</p>
18
+ <Button
19
+ variant="rounded-icon"
20
+ size="icon"
21
+ className="babylai-bg-primary-500 babylai-text-black-white-50 hover:babylai-bg-primary-600 md:!babylai-w-10 md:!babylai-h-10"
22
+ onClick={() => props.handleClick()}
23
+ >
24
+ <ArrowRight
25
+ className={`babylai-w-4 babylai-h-4 ${isLTR ? '' : 'babylai-rotate-180'
26
+ }`}
27
+ />
28
+
29
+ </Button>
30
+ </div>
31
+ )
32
+ }
33
+
34
+ export default Card
@@ -0,0 +1,36 @@
1
+ import React from 'react'
2
+
3
+ import { Button } from '@/components/shared'
4
+ import Logo from '../../../assets/logo.svg'
5
+ import { useLocalTranslation } from '../../../useLocalTranslation'
6
+
7
+
8
+ interface ChatNowCardProps {
9
+ setIsShowList: (isShowList: boolean) => void
10
+ }
11
+
12
+ const ChatNowCard: React.FC<ChatNowCardProps> = (props) => {
13
+ const { t } = useLocalTranslation();
14
+
15
+ return (
16
+ <div className="babylai-flex babylai-flex-col babylai-gap-7 babylai-bg-black-white-50 babylai-rounded-3xl babylai-p-8">
17
+ <div className="babylai-flex babylai-gap-3 babylai-items-center babylai-justify-start">
18
+ <div className="babylai-p-4 babylai-bg-primary-500 babylai-rounded-full">
19
+ <Logo className="babylai-w-12 babylai-h-12" />
20
+ </div>
21
+ <div className="babylai-flex babylai-flex-col babylai-gap-0 babylai-text-base">
22
+ <p className="babylai-font-semibold babylai-text-black-white-500">BabylAI</p>
23
+ <p className="babylai-font-semibold babylai-text-black-white-800">
24
+ {t('homeSdk.welcomeMessage')}
25
+
26
+ </p>
27
+ </div>
28
+ </div>
29
+ <Button variant="default" onClick={() => props.setIsShowList(true)} className='md:!babylai-text-base md:!babylai-p-2 !babylai-h-auto !babylai-font-semibold'>
30
+ {t('homeSdk.chatNow')}
31
+ </Button>
32
+ </div>
33
+ )
34
+ }
35
+
36
+ export default ChatNowCard
@@ -0,0 +1,44 @@
1
+ import { Header } from '@/components/ui/header'
2
+ import Card from '@/ui/chatbot-popup/home-screen/card'
3
+ import ChatNowCard from '@/ui/chatbot-popup/home-screen/chat-now-card'
4
+ import React from 'react'
5
+ import { useLocalTranslation } from '../../../useLocalTranslation'
6
+
7
+ interface HomeScreenProps {
8
+ setIsShowList: (isShowList: boolean) => void
9
+ onClose: () => void
10
+ }
11
+
12
+ const HomeScreen: React.FC<HomeScreenProps> = (props) => {
13
+ const { t } = useLocalTranslation()
14
+
15
+ const handleNavigateTo = () => {
16
+ // replace the current pathname with /features
17
+ const currentUrl = window.location.href
18
+ const url = new URL(currentUrl)
19
+ url.pathname = '/signUp'
20
+ window.location.href = url.toString()
21
+ }
22
+
23
+ return (
24
+ <div className="babylai-h-full babylai-flex babylai-flex-col babylai-overflow-y-auto babylai-py-6 md:babylai-py-8 babylai-px-6 gap-4 md:gap-8">
25
+ <Header onClose={props.onClose} />
26
+
27
+ <h1 className="babylai-text-2xl md:babylai-text-4xl babylai-font-bold babylai-text-white">
28
+ {t('homeSdk.chatTitle')}
29
+ <br />
30
+ BabylAI 🚀
31
+ </h1>
32
+
33
+ <div className="babylai-flex babylai-flex-col gap-3">
34
+ <ChatNowCard setIsShowList={props.setIsShowList} />
35
+
36
+ <Card handleClick={handleNavigateTo} text={t('homeSdk.tryBabylAi')} />
37
+
38
+ <Card handleClick={handleNavigateTo} text={t('homeSdk.contactSdk')} />
39
+ </div>
40
+ </div>
41
+ )
42
+ }
43
+
44
+ export default HomeScreen
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+
3
+ import { Header } from '@/components/ui/header'
4
+ import { cn } from '@/lib'
5
+ import animatedLogo from '../../../assets/animatedLogo.gif'
6
+
7
+ interface ChatBotLoadingScreenProps {
8
+ isShowList: boolean
9
+ onClose: () => void
10
+ }
11
+
12
+ const ChatBotLoadingScreen: React.FC<ChatBotLoadingScreenProps> = (props) => {
13
+ return (
14
+ <div className="babylai-w-full babylai-h-full babylai-bg-black-white-50 babylai-rounded-3xl babylai-shadow-lg babylai-flex babylai-flex-col">
15
+ <div
16
+ className={cn(
17
+ 'babylai-rounded-3xl babylai-h-full babylai-flex babylai-flex-col babylai-py-6 md:babylai-py-8 babylai-px-6 gap-4 md:gap-8',
18
+ {
19
+ 'babylai-bg-gradient-to-b babylai-from-primary-500 babylai-to-primary-500/60': !props.isShowList,
20
+ 'babylai-bg-black-white-100': props.isShowList
21
+ }
22
+ )}
23
+ >
24
+ <Header onClose={props.onClose} />
25
+ <div className="babylai-flex babylai-flex-col babylai-items-center babylai-justify-center babylai-w-full babylai-h-full babylai-py-16 md:babylai-py-28">
26
+ <img src={animatedLogo} alt="Animated Logo" className="babylai-w-20 babylai-h-20" />
27
+ </div>
28
+ </div>
29
+ </div>
30
+ )
31
+ }
32
+
33
+ export default ChatBotLoadingScreen
@@ -0,0 +1,38 @@
1
+ import { Button, CardContent, CardFooter } from '@/components'
2
+ import { Option } from '@/lib/types'
3
+ import React from 'react'
4
+ import { useLocalTranslation } from '../../../useLocalTranslation'
5
+
6
+ interface ExpandedOptionProps {
7
+ option: Option
8
+ handleStartChat: (option: Option) => void
9
+ }
10
+
11
+ const ExpandedOption: React.FC<ExpandedOptionProps> = ({ option, handleStartChat }) => {
12
+ const { t } = useLocalTranslation()
13
+
14
+ return (
15
+ <>
16
+ <CardContent className="babylai-transition-all babylai-duration-300 babylai-ease-in-out babylai-flex babylai-flex-col babylai-gap-1">
17
+ {option.paragraphs.map((paragraph, index) => (
18
+ <p key={index} className="babylai-font-semibold babylai-text-base babylai-text-black-white-800">
19
+ {paragraph}
20
+ </p>
21
+ ))}
22
+ </CardContent>
23
+ {option?.chatWithUs && (
24
+ <CardFooter>
25
+ <Button
26
+ variant="default"
27
+ className="babylai-w-full md:!babylai-p-2 !babylai-h-auto babylai-font-semibold babylai-text-base"
28
+ onClick={() => handleStartChat(option)}
29
+ >
30
+ {t('homeSdk.chatNow')}
31
+ </Button>
32
+ </CardFooter>
33
+ )}
34
+ </>
35
+ )
36
+ }
37
+
38
+ export default ExpandedOption
@@ -0,0 +1,38 @@
1
+ import { Button } from '@/components'
2
+ import React from 'react'
3
+ import ArrowRight from './../../../assets/icons/arrowRight.svg'
4
+ import ThinkingLogo from './../../../assets/thinking-logo.svg'
5
+ import { useLocalTranslation } from '../../../useLocalTranslation'
6
+ import CloseCircle from '../../../assets/icons/closeCirclePrimary.svg'
7
+
8
+ interface OptionsListHeaderProps {
9
+ handleBack: () => void
10
+ showHelpScreen: boolean
11
+ }
12
+
13
+ const OptionsListHeader: React.FC<OptionsListHeaderProps> = ({ handleBack, showHelpScreen }) => {
14
+ const { i18n } = useLocalTranslation()
15
+ const isRTL = i18n.dir() === 'rtl'
16
+
17
+ return (
18
+ <header
19
+ dir={i18n.dir()}
20
+ className={`babylai-flex babylai-w-full babylai-items-center mb-2 ${!showHelpScreen ? 'babylai-justify-end' : 'babylai-justify-between'}`}
21
+ >
22
+ <Button
23
+ variant="rounded-icon"
24
+ size="icon"
25
+ className="!babylai-w-12 !babylai-h-12 babylai-bg-black-white-50 babylai-relative babylai-z-10"
26
+ onClick={handleBack}
27
+ >
28
+ {showHelpScreen ? (
29
+ <ArrowRight className={`${isRTL ? '' : 'babylai-rotate-180'} babylai-text-primary-500`} />
30
+ ) : (
31
+ <CloseCircle className="!babylai-w-full !babylai-h-full babylai-cursor-pointer" />
32
+ )}
33
+ </Button>
34
+ <ThinkingLogo className="babylai-w-40 babylai-h-40 babylai-text-primary-500 babylai-absolute babylai-top-0 babylai-end-1 babylai-overflow-hidden" />
35
+ </header>
36
+ )
37
+ }
38
+ export default OptionsListHeader
@@ -0,0 +1,59 @@
1
+ import { Card } from '@/components'
2
+ import { HelpScreenData, Option } from '@/lib/types'
3
+ import ExpandedOption from '@/ui/chatbot-popup/options-list-screen/expanded-option'
4
+ import OptionsListHeader from '@/ui/chatbot-popup/options-list-screen/header'
5
+ import OptionCard from '@/ui/chatbot-popup/options-list-screen/option-card'
6
+ import React from 'react'
7
+
8
+ interface OptionsListScreenProps {
9
+ helpScreen: HelpScreenData | null
10
+ expandedOption: Option | null
11
+ setExpandedOption: (option: Option | null) => void
12
+ handleStartChat: (option: Option) => void
13
+ handleBack: () => void
14
+ showHelpScreen: boolean
15
+ }
16
+
17
+ const OptionsListScreen: React.FC<OptionsListScreenProps> = ({
18
+ helpScreen,
19
+ expandedOption,
20
+ setExpandedOption,
21
+ handleStartChat,
22
+ handleBack,
23
+ showHelpScreen
24
+ }) => {
25
+ const handleToggleExpandOption = (option: Option) => {
26
+ if (expandedOption?.id === option.id) {
27
+ setExpandedOption(null)
28
+ } else {
29
+ setExpandedOption(option)
30
+ }
31
+ }
32
+
33
+ return (
34
+ <div className="babylai-px-8 babylai-pb-12 babylai-pt-8 babylai-overflow-y-auto babylai-h-full">
35
+ <OptionsListHeader handleBack={handleBack} showHelpScreen={showHelpScreen} />
36
+
37
+ <h1 className="babylai-text-4xl babylai-font-bold babylai-text-black-white-800 mb-4">{helpScreen?.title}</h1>
38
+
39
+ {helpScreen && (
40
+ <div className="babylai-flex babylai-flex-col babylai-gap-3 babylai-mt-3 babylai-mb-3">
41
+ {helpScreen?.options?.map((option) => (
42
+ <Card
43
+ key={option.id}
44
+ variant="rounded"
45
+ className="babylai-cursor-pointer babylai-transition-all babylai-hover:babylai-shadow-md !babylai-px-2 !babylai-py-1"
46
+ onClick={() => handleToggleExpandOption(option)}
47
+ >
48
+ <OptionCard title={option.title} />
49
+
50
+ {expandedOption?.id === option.id && <ExpandedOption option={option} handleStartChat={handleStartChat} />}
51
+ </Card>
52
+ ))}
53
+ </div>
54
+ )}
55
+ </div>
56
+ )
57
+ }
58
+
59
+ export default OptionsListScreen
@@ -0,0 +1,20 @@
1
+ import { Button } from '@/components';
2
+ import React from 'react';
3
+ import ArrowRight from '../../../assets/icons/arrowRight.svg';
4
+
5
+ interface OptionCardProps {
6
+ title: string;
7
+ }
8
+
9
+ const OptionCard: React.FC<OptionCardProps> = (props) => {
10
+ return (
11
+ <div className="babylai-flex babylai-items-center babylai-justify-between babylai-p-4">
12
+ <p className="babylai-text-base babylai-font-semibold babylai-text-black-white-800">{props.title}</p>
13
+ <Button variant="rounded-icon" size="icon" className="!babylai-w-12 !babylai-h-12 babylai-text-primary-500 hover:babylai-bg-primary-100">
14
+ <ArrowRight className={` babylai-text-primary-500 babylai-rotate-90 `}/>
15
+ </Button>
16
+ </div>
17
+ )
18
+ }
19
+
20
+ export default OptionCard
@@ -0,0 +1,25 @@
1
+ import React from 'react'
2
+ import CloseIcon from '../assets/icons/close.svg'
3
+ interface FloatingMessageProps {
4
+ message: string
5
+ onClose: () => void
6
+ }
7
+ export function FloatingMessage({ message, onClose }: FloatingMessageProps) {
8
+ return (
9
+ <div
10
+ className="
11
+ babylai-fixed babylai-bottom-[6rem] babylai-right-4
12
+ babylai-z-50 babylai-flex babylai-flex-col babylai-items-end babylai-animate-[float_2s_infinite_ease-in-out]"
13
+ >
14
+ <div className="babylai-bg-primary-500 babylai-text-white babylai-py-3 babylai-px-4 babylai-rounded-3xl babylai-shadow-lg babylai-mb-4 babylai-max-w-[200px] babylai-relative after:babylai-content-[''] after:babylai-absolute after:babylai--bottom-[10px] after:babylai-right-5 after:babylai-w-0 after:babylai-h-0 after:babylai-border-l-[10px] after:babylai-border-r-[10px] after:babylai-border-t-[10px] after:babylai-border-l-transparent after:babylai-border-r-transparent after:babylai-border-t-primary-500">
15
+ <p className="babylai-text-xs babylai-font-bold babylai-m-0">{message}</p>
16
+ <button
17
+ className="babylai-absolute babylai--top-2 babylai--right-2 babylai-w-5 babylai-h-5 babylai-rounded-full babylai-bg-white babylai-border-none babylai-cursor-pointer babylai-flex babylai-items-center babylai-justify-center babylai-text-black babylai-p-[3px] babylai-hover:bg-primary-400 babylai-hover:text-white shadow-md"
18
+ onClick={onClose}
19
+ >
20
+ <CloseIcon className="babylai-w-8 babylai-h-8" />
21
+ </button>
22
+ </div>
23
+ </div>
24
+ )
25
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+ import Logo from '../assets/logo.svg'
3
+
4
+ interface HelpButtonProps {
5
+ onClick: () => void
6
+ }
7
+
8
+ export function HelpButton({ onClick }: HelpButtonProps) {
9
+ return (
10
+ <button
11
+ className="
12
+ babylai-fixed babylai-z-50 babylai-bottom-4 babylai-right-4
13
+ babylai-w-[80px] babylai-h-[80px]
14
+ babylai-rounded-full babylai-bg-primary-500 babylai-flex babylai-items-center
15
+ babylai-justify-center babylai-border-[0.5px] babylai-border-black-white-50 "
16
+ onClick={onClick}
17
+ aria-label="Need Help?"
18
+ >
19
+ <Logo className="babylai-w-[60%] babylai-h-[60%]" />
20
+ </button>
21
+ )
22
+ }