@aslaluroba/help-center-react 3.0.4 → 3.0.6
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 +28 -33
- package/dist/components/shared/Button/button.d.ts +1 -2
- package/dist/components/ui/agent-response/agent-response.d.ts +1 -2
- package/dist/components/ui/header.d.ts +1 -2
- package/dist/i18n.d.ts +2 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +36042 -11149
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36049 -11158
- package/dist/index.js.map +1 -1
- package/dist/ui/chatbot-popup/chat-window-screen/footer.d.ts +0 -1
- package/dist/ui/chatbot-popup/chat-window-screen/header.d.ts +1 -1
- package/dist/ui/chatbot-popup/chat-window-screen/index.d.ts +1 -1
- package/dist/ui/chatbot-popup/error-screen/index.d.ts +0 -1
- package/dist/ui/chatbot-popup/home-screen/card.d.ts +0 -1
- package/dist/ui/chatbot-popup/home-screen/chat-now-card.d.ts +0 -1
- package/dist/ui/chatbot-popup/home-screen/index.d.ts +0 -1
- package/dist/ui/chatbot-popup/loading-screen/index.d.ts +0 -1
- package/dist/ui/chatbot-popup/options-list-screen/expanded-option.d.ts +0 -1
- package/dist/ui/chatbot-popup/options-list-screen/header.d.ts +0 -1
- package/dist/ui/chatbot-popup/options-list-screen/index.d.ts +0 -1
- package/dist/ui/chatbot-popup/options-list-screen/option-card.d.ts +0 -1
- package/dist/ui/confirmation-modal/index.d.ts +1 -2
- package/dist/ui/floating-message.d.ts +1 -2
- package/dist/ui/help-button.d.ts +1 -2
- package/dist/ui/help-center.d.ts +1 -2
- package/dist/ui/help-popup.d.ts +1 -2
- package/dist/ui/review-dialog/index.d.ts +0 -1
- package/package.json +25 -25
- package/src/components/shared/Button/button.tsx +0 -1
- package/src/components/ui/agent-response/agent-response.tsx +0 -1
- package/src/components/ui/header.tsx +0 -1
- package/src/globals.css +1 -1
- package/src/i18n.ts +9 -5
- package/src/index.ts +1 -3
- package/src/types/svg.d.ts +4 -4
- package/src/ui/chatbot-popup/chat-window-screen/footer.tsx +0 -1
- package/src/ui/chatbot-popup/chat-window-screen/header.tsx +42 -26
- package/src/ui/chatbot-popup/error-screen/index.tsx +0 -1
- package/src/ui/chatbot-popup/home-screen/card.tsx +25 -25
- package/src/ui/chatbot-popup/home-screen/chat-now-card.tsx +0 -2
- package/src/ui/chatbot-popup/home-screen/index.tsx +0 -1
- package/src/ui/chatbot-popup/loading-screen/index.tsx +0 -2
- package/src/ui/chatbot-popup/options-list-screen/expanded-option.tsx +0 -1
- package/src/ui/chatbot-popup/options-list-screen/header.tsx +14 -12
- package/src/ui/chatbot-popup/options-list-screen/index.tsx +0 -1
- package/src/ui/chatbot-popup/options-list-screen/option-card.tsx +26 -19
- package/src/ui/confirmation-modal/index.tsx +0 -1
- package/src/ui/floating-message.tsx +0 -1
- package/src/ui/help-button.tsx +0 -1
- package/src/ui/help-center.tsx +3 -2
- package/src/ui/help-popup.tsx +1 -1
- package/src/ui/review-dialog/index.tsx +4 -4
- package/src/useLocalTranslation.ts +5 -5
- package/tsconfig.json +19 -8
- package/src/.DS_Store +0 -0
- package/src/styles/tailwind.css +0 -4
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import { Button } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useTranslation } from 'react-i18next'
|
|
1
|
+
import { Button } from "@/components";
|
|
2
|
+
import ArrowRight from "../../../assets/icons/arrowRight.svg";
|
|
3
|
+
import { useLocalTranslation } from "@/useLocalTranslation";
|
|
5
4
|
|
|
6
5
|
interface OptionCardProps {
|
|
7
|
-
|
|
6
|
+
title: string;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
const OptionCard: React.FC<OptionCardProps> = (props) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const i18n = useLocalTranslation();
|
|
11
|
+
const isLTR = i18n.dir == "ltr";
|
|
12
|
+
return (
|
|
13
|
+
<div className="babylai-flex babylai-items-center babylai-justify-between babylai-p-2">
|
|
14
|
+
<p className="babylai-text-sm babylai-font-medium babylai-text-black-white-800 dark:babylai-text-white">
|
|
15
|
+
{props.title}
|
|
16
|
+
</p>
|
|
17
|
+
<Button
|
|
18
|
+
variant="rounded-icon"
|
|
19
|
+
size="icon"
|
|
20
|
+
className="babylai-text-primary-500 hover:babylai-bg-primary-100"
|
|
21
|
+
>
|
|
22
|
+
<ArrowRight
|
|
23
|
+
className={`babylai-w-[12px] babylai-h-[12px] ${
|
|
24
|
+
isLTR ? "" : "babylai-rotate-180"
|
|
25
|
+
} babylai-text-primary-500`}
|
|
26
|
+
/>
|
|
27
|
+
</Button>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
24
31
|
|
|
25
|
-
export default OptionCard
|
|
32
|
+
export default OptionCard;
|
package/src/ui/help-button.tsx
CHANGED
package/src/ui/help-center.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ReviewDialog from '@/ui/review-dialog';
|
|
2
|
-
import
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { apiRequest } from '../core/api';
|
|
4
4
|
import { ClientAblyService } from '../core/AblyService';
|
|
5
5
|
import { useLocalTranslation } from '../useLocalTranslation';
|
|
@@ -8,6 +8,7 @@ import { HelpScreenData, Message, Option, ReviewProps } from '../lib/types';
|
|
|
8
8
|
import { FloatingMessage } from './floating-message';
|
|
9
9
|
import { HelpButton } from './help-button';
|
|
10
10
|
import { HelpPopup } from './help-popup';
|
|
11
|
+
import { defaultLanguage } from '@/i18n';
|
|
11
12
|
|
|
12
13
|
interface HelpCenterProps {
|
|
13
14
|
helpScreenId: string;
|
|
@@ -27,7 +28,7 @@ export function HelpCenter({
|
|
|
27
28
|
helpScreenId,
|
|
28
29
|
user,
|
|
29
30
|
showArrow = true,
|
|
30
|
-
language =
|
|
31
|
+
language = defaultLanguage,
|
|
31
32
|
messageLabel = null,
|
|
32
33
|
showHelpScreen = false,
|
|
33
34
|
}: HelpCenterProps) {
|
package/src/ui/help-popup.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import ChatBotErrorScreen from '@/ui/chatbot-popup/error-screen';
|
|
|
5
5
|
import HomeScreen from '@/ui/chatbot-popup/home-screen';
|
|
6
6
|
import ChatBotLoadingScreen from '@/ui/chatbot-popup/loading-screen';
|
|
7
7
|
import OptionsListScreen from '@/ui/chatbot-popup/options-list-screen';
|
|
8
|
-
import
|
|
8
|
+
import { useEffect, useRef, useState, useCallback, useMemo } from 'react';
|
|
9
9
|
import ChatIcon from '../assets/icons/chat.svg';
|
|
10
10
|
import { Button } from '@/components';
|
|
11
11
|
import { HelpScreenData, Message, Option } from '@/lib/types';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReviewProps } from '@/lib/types'
|
|
2
2
|
import { Rating } from '@/ui/review-dialog/rating'
|
|
3
|
-
import React from 'react'
|
|
4
3
|
import { useLocalTranslation } from '../../useLocalTranslation'
|
|
5
4
|
import CloseCircle from '../../assets/icons/closeCircle.svg'
|
|
5
|
+
import { useState } from 'react';
|
|
6
6
|
|
|
7
7
|
interface ReviewDialogProps {
|
|
8
8
|
handleSubmit: ({ comment, rating }: ReviewProps) => void;
|
|
@@ -11,9 +11,9 @@ interface ReviewDialogProps {
|
|
|
11
11
|
|
|
12
12
|
const ReviewDialog: React.FC<ReviewDialogProps> = (props) => {
|
|
13
13
|
const { t } = useLocalTranslation()
|
|
14
|
-
const [comment, setComment] =
|
|
15
|
-
const [rating, setRating] =
|
|
16
|
-
const [error, setError] =
|
|
14
|
+
const [comment, setComment] = useState<string>('')
|
|
15
|
+
const [rating, setRating] = useState<number>(0)
|
|
16
|
+
const [error, setError] = useState<{ comment?: string; rating?: string }>({})
|
|
17
17
|
|
|
18
18
|
const isCommentValid = comment.length >= 10 && comment.length <= 500
|
|
19
19
|
const isRatingValid = rating >= 1 && rating <= 5
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { createHelpCenterI18n } from './i18n';
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { createHelpCenterI18n, defaultLanguage } from "./i18n";
|
|
4
3
|
|
|
5
4
|
export const useLocalTranslation = (languageFromProps?: string) => {
|
|
6
|
-
const language =
|
|
5
|
+
const language =
|
|
6
|
+
languageFromProps || localStorage.getItem("app-language") || defaultLanguage;
|
|
7
7
|
|
|
8
8
|
const i18n = useMemo(() => createHelpCenterI18n(language), [language]);
|
|
9
9
|
|
|
10
10
|
const t = (key: string) => i18n.t(key);
|
|
11
11
|
const dir = i18n.dir();
|
|
12
12
|
|
|
13
|
-
return { t, dir
|
|
13
|
+
return { t, dir, i18n };
|
|
14
14
|
};
|
package/tsconfig.json
CHANGED
|
@@ -22,23 +22,34 @@
|
|
|
22
22
|
"noUnusedParameters": true,
|
|
23
23
|
"noImplicitReturns": true,
|
|
24
24
|
"noFallthroughCasesInSwitch": true,
|
|
25
|
-
"moduleResolution": "
|
|
26
|
-
"jsx": "react",
|
|
25
|
+
"moduleResolution": "bundler",
|
|
26
|
+
"jsx": "react-jsx",
|
|
27
27
|
"resolveJsonModule": true,
|
|
28
28
|
"esModuleInterop": true,
|
|
29
29
|
"skipLibCheck": true,
|
|
30
30
|
"forceConsistentCasingInFileNames": true,
|
|
31
31
|
"baseUrl": ".",
|
|
32
|
-
|
|
33
|
-
"@/*": [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"@/
|
|
37
|
-
|
|
32
|
+
"paths": {
|
|
33
|
+
"@/*": [
|
|
34
|
+
"src/*"
|
|
35
|
+
],
|
|
36
|
+
"@/components/*": [
|
|
37
|
+
"src/components/*"
|
|
38
|
+
],
|
|
39
|
+
"@/ui/*": [
|
|
40
|
+
"src/ui/*"
|
|
41
|
+
],
|
|
42
|
+
"@/lib/*": [
|
|
43
|
+
"src/lib/*"
|
|
44
|
+
],
|
|
45
|
+
"@/assets/*": [
|
|
46
|
+
"src/assets/*"
|
|
47
|
+
]
|
|
38
48
|
},
|
|
39
49
|
},
|
|
40
50
|
"include": [
|
|
41
51
|
"src",
|
|
52
|
+
"src/types",
|
|
42
53
|
"assets"
|
|
43
54
|
],
|
|
44
55
|
"exclude": [
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/styles/tailwind.css
DELETED