@aslaluroba/help-center-react 2.0.4 → 2.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/dist/core/api.d.ts +4 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.esm.js +994 -25294
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +995 -25295
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/types.d.ts +4 -0
- package/dist/ui/chatbot-popup/chat-window-screen/footer.d.ts +1 -0
- package/dist/ui/chatbot-popup/chat-window-screen/index.d.ts +1 -1
- package/dist/ui/help-center.d.ts +1 -1
- package/dist/ui/help-popup.d.ts +9 -3
- package/dist/ui/review-dialog/index.d.ts +8 -0
- package/dist/ui/review-dialog/rating.d.ts +12 -0
- package/package.json +26 -5
- package/src/assets/icons/arrowRight.svg +1 -1
- package/src/assets/icons/closeCircle.svg +1 -1
- package/src/components/ui/agent-response/agent-response.tsx +36 -34
- package/src/components/ui/header.tsx +2 -3
- package/src/core/SignalRService.ts +25 -25
- package/src/core/api.ts +180 -44
- package/src/globals.css +0 -9
- package/src/index.ts +3 -2
- package/src/lib/config.ts +25 -25
- package/src/lib/types.ts +5 -0
- package/src/locales/ar.json +18 -1
- package/src/locales/en.json +26 -8
- package/src/ui/chatbot-popup/chat-window-screen/footer.tsx +31 -33
- package/src/ui/chatbot-popup/chat-window-screen/header.tsx +47 -53
- package/src/ui/chatbot-popup/chat-window-screen/index.tsx +182 -88
- package/src/ui/chatbot-popup/options-list-screen/header.tsx +24 -20
- package/src/ui/chatbot-popup/options-list-screen/index.tsx +24 -24
- package/src/ui/chatbot-popup/options-list-screen/option-card.tsx +9 -4
- package/src/ui/help-center.tsx +189 -159
- package/src/ui/help-popup.tsx +241 -165
- package/src/ui/review-dialog/index.tsx +106 -0
- package/src/ui/review-dialog/rating.tsx +78 -0
- package/tsconfig.json +48 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cn } from '@/lib'
|
|
2
|
+
import { IconHeart as Heart, IconStar as Star, IconThumbUp as ThumbsUp } from '@tabler/icons-react'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
export interface RatingProps {
|
|
6
|
+
value: number
|
|
7
|
+
onChange?: (value: number) => void
|
|
8
|
+
max?: number
|
|
9
|
+
icon?: 'star' | 'heart' | 'thumbsUp'
|
|
10
|
+
size?: 'sm' | 'md' | 'lg'
|
|
11
|
+
readOnly?: boolean
|
|
12
|
+
className?: string
|
|
13
|
+
style?: React.CSSProperties
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const iconMap = {
|
|
17
|
+
star: Star,
|
|
18
|
+
heart: Heart,
|
|
19
|
+
thumbsUp: ThumbsUp
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const sizeMap = {
|
|
23
|
+
sm: 'w-4 h-4',
|
|
24
|
+
md: 'w-6 h-6',
|
|
25
|
+
lg: 'w-8 h-8'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
|
|
29
|
+
({ value, onChange, max = 5, icon = 'star', size = 'md', readOnly = false, className, ...props }, ref) => {
|
|
30
|
+
const [hoverValue, setHoverValue] = React.useState<number | null>(null)
|
|
31
|
+
const Icon = iconMap[icon]
|
|
32
|
+
|
|
33
|
+
const handleMouseEnter = (index: number) => {
|
|
34
|
+
if (!readOnly) {
|
|
35
|
+
setHoverValue(index)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const handleMouseLeave = () => {
|
|
40
|
+
setHoverValue(null)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const handleClick = (index: number) => {
|
|
44
|
+
if (!readOnly && onChange) {
|
|
45
|
+
onChange(index)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div ref={ref} className={cn('flex items-center', className)} {...props}>
|
|
51
|
+
{[...Array(max)].map((_, index) => {
|
|
52
|
+
const filled = (hoverValue !== null ? hoverValue : value) > index
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Icon
|
|
56
|
+
key={index}
|
|
57
|
+
className={cn(
|
|
58
|
+
sizeMap[size],
|
|
59
|
+
'cursor-pointer transition-colors',
|
|
60
|
+
filled ? 'text-yellow-400 fill-yellow-400' : 'text-gray-300',
|
|
61
|
+
readOnly && 'cursor-default'
|
|
62
|
+
)}
|
|
63
|
+
onMouseEnter={() => handleMouseEnter(index + 1)}
|
|
64
|
+
onMouseLeave={handleMouseLeave}
|
|
65
|
+
onClick={() => handleClick(index + 1)}
|
|
66
|
+
aria-hidden={readOnly}
|
|
67
|
+
role={readOnly ? undefined : 'button'}
|
|
68
|
+
tabIndex={readOnly ? -1 : 0}
|
|
69
|
+
aria-label={`Rate ${index + 1} out of ${max}`}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
})}
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
Rating.displayName = 'Rating'
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2018",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"lib": [
|
|
6
|
+
"dom",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"importHelpers": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"rootDir": "./src",
|
|
13
|
+
"outDir": "./dist",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noImplicitAny": true,
|
|
16
|
+
"strictNullChecks": true,
|
|
17
|
+
"strictFunctionTypes": true,
|
|
18
|
+
"strictPropertyInitialization": true,
|
|
19
|
+
"noImplicitThis": true,
|
|
20
|
+
"alwaysStrict": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"noImplicitReturns": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"moduleResolution": "node",
|
|
26
|
+
"jsx": "react",
|
|
27
|
+
"resolveJsonModule": true,
|
|
28
|
+
"esModuleInterop": true,
|
|
29
|
+
"skipLibCheck": true,
|
|
30
|
+
"forceConsistentCasingInFileNames": true,
|
|
31
|
+
"baseUrl": ".",
|
|
32
|
+
"paths": {
|
|
33
|
+
"@/*": ["src/*"],
|
|
34
|
+
"@/components/*": ["src/components/*"],
|
|
35
|
+
"@/ui/*": ["src/ui/*"],
|
|
36
|
+
"@/lib/*": ["src/lib/*"],
|
|
37
|
+
"@/assets/*": ["src/assets/*"]
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
"include": [
|
|
41
|
+
"src",
|
|
42
|
+
"assets"
|
|
43
|
+
],
|
|
44
|
+
"exclude": [
|
|
45
|
+
"node_modules",
|
|
46
|
+
"dist"
|
|
47
|
+
]
|
|
48
|
+
}
|