@aslaluroba/help-center-react 2.0.2 → 2.0.5

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 (41) hide show
  1. package/dist/core/api.d.ts +4 -1
  2. package/dist/index.d.ts +3 -2
  3. package/dist/index.esm.js +994 -25294
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +995 -25295
  6. package/dist/index.js.map +1 -1
  7. package/dist/lib/config.d.ts +1 -1
  8. package/dist/lib/types.d.ts +4 -0
  9. package/dist/ui/chatbot-popup/chat-window-screen/footer.d.ts +1 -0
  10. package/dist/ui/chatbot-popup/chat-window-screen/index.d.ts +1 -1
  11. package/dist/ui/help-center.d.ts +1 -1
  12. package/dist/ui/help-popup.d.ts +9 -3
  13. package/dist/ui/review-dialog/index.d.ts +8 -0
  14. package/dist/ui/review-dialog/rating.d.ts +12 -0
  15. package/package.json +26 -5
  16. package/src/assets/icons/arrowRight.svg +1 -1
  17. package/src/assets/icons/closeCircle.svg +1 -1
  18. package/src/components/ui/agent-response/agent-response.tsx +36 -34
  19. package/src/components/ui/header.tsx +2 -3
  20. package/src/core/SignalRService.ts +25 -25
  21. package/src/core/api.ts +180 -43
  22. package/src/globals.css +0 -9
  23. package/src/index.ts +3 -2
  24. package/src/lib/config.ts +31 -25
  25. package/src/lib/types.ts +5 -0
  26. package/src/locales/ar.json +18 -1
  27. package/src/locales/en.json +26 -8
  28. package/src/ui/chatbot-popup/chat-window-screen/footer.tsx +31 -34
  29. package/src/ui/chatbot-popup/chat-window-screen/header.tsx +47 -53
  30. package/src/ui/chatbot-popup/chat-window-screen/index.tsx +178 -88
  31. package/src/ui/chatbot-popup/options-list-screen/header.tsx +24 -20
  32. package/src/ui/chatbot-popup/options-list-screen/index.tsx +24 -24
  33. package/src/ui/chatbot-popup/options-list-screen/option-card.tsx +9 -4
  34. package/src/ui/help-center.tsx +367 -141
  35. package/src/ui/help-popup.tsx +239 -165
  36. package/src/ui/review-dialog/index.tsx +106 -0
  37. package/src/ui/review-dialog/rating.tsx +78 -0
  38. package/tsconfig.json +48 -0
  39. package/postcss.config.js +0 -6
  40. package/rollup.config.js +0 -58
  41. package/tailwind.config.js +0 -174
@@ -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
+ }
package/postcss.config.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {}
5
- }
6
- }
package/rollup.config.js DELETED
@@ -1,58 +0,0 @@
1
- import json from '@rollup/plugin-json';
2
- import resolve from '@rollup/plugin-node-resolve'
3
- import commonjs from '@rollup/plugin-commonjs'
4
- import typescript from '@rollup/plugin-typescript'
5
- import postcss from 'rollup-plugin-postcss'
6
- import svgr from '@svgr/rollup'
7
- import image from '@rollup/plugin-image'
8
-
9
- const createConfig = (format) => ({
10
- input: 'src/index.ts',
11
- output: {
12
- file: `dist/index${format === 'esm' ? '.esm' : ''}.js`,
13
- format: format === 'esm' ? 'es' : 'cjs',
14
- sourcemap: true
15
- },
16
- external: ['react', 'react-dom', '@microsoft/signalr', 'axios', 'i18next', 'react-i18next'],
17
- plugins: [
18
- svgr({
19
- svgoConfig: {
20
- plugins: [
21
- {
22
- name: 'preset-default',
23
- params: {
24
- overrides: {
25
- removeViewBox: false
26
- }
27
- }
28
- }
29
- ]
30
- }
31
- }),
32
- image({
33
- include: ['**/*.gif', '**/*.png', '**/*.jpg', '**/*.jpeg'],
34
- limit: 0,
35
- fileName: '[dirname][name][extname]'
36
- }),
37
- resolve(),
38
- json(),
39
- commonjs(),
40
- postcss({
41
- config: {
42
- path: './postcss.config.js'
43
- },
44
- extensions: ['.css'],
45
- minimize: true,
46
- inject: {
47
- insertAt: 'top'
48
- }
49
- }),
50
- typescript({
51
- tsconfig: './tsconfig.json',
52
- declaration: true,
53
- declarationDir: './dist'
54
- })
55
- ]
56
- })
57
-
58
- export default [createConfig('cjs'), createConfig('esm')]
@@ -1,174 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- prefix: 'babylai-',
4
- content: ['./src/**/*.{js,jsx,ts,tsx}', './components/**/*.{js,jsx,ts,tsx}'],
5
- theme: {
6
- extend: {
7
- fontFamily: {
8
- sans: ['Cairo']
9
- },
10
-
11
- rotate: {
12
- 270: '270deg'
13
- },
14
- borderRadius: {
15
- lg: 'var(--radius)',
16
- md: 'calc(var(--radius) - 2px)',
17
- sm: 'calc(var(--radius) - 4px)'
18
- },
19
- colors: {
20
- background: 'hsl(var(--background))',
21
- foreground: 'hsl(var(--foreground))',
22
- borderColor: '#606060',
23
- textDark: '#333333',
24
- black: '#171717',
25
- pureWhite: '#FFFFFF',
26
- primary: {
27
- 100: '#F6ECFC',
28
- 200: '#DEB6F3',
29
- 300: '#D49CEE',
30
- 400: '#C57FEA',
31
- 500: '#AD49E1',
32
- 600: '#672B87',
33
- 700: '#451D5A',
34
- 800: '#220E2D',
35
- 900: '#110716',
36
- 950: '#0A0310',
37
- DEFAULT: '#AD49E1',
38
- foreground: '#FFFFFF'
39
- },
40
- 'black-white': {
41
- 50: '#FFFFFF',
42
- 100: '#F3F3F3',
43
- 200: '#E2E2E2',
44
- 300: '#919191',
45
- 400: '#606060',
46
- 500: '#333333',
47
- 600: '#1F1F1F',
48
- 700: '#171717',
49
- 800: '#0A0A0A',
50
- 900: '#050505',
51
- 950: '#000000',
52
- DEFAULT: '#333333'
53
- },
54
- 'wild-sand': {
55
- 50: '#f8f8f8',
56
- 100: '#f3f3f3',
57
- 200: '#dcdcdc',
58
- 300: '#bdbdbd',
59
- 400: '#989898',
60
- 500: '#7c7c7c',
61
- 600: '#656565',
62
- 700: '#525252',
63
- 800: '#464646',
64
- 900: '#3d3d3d',
65
- 950: '#292929'
66
- },
67
- 'storm-dust': {
68
- 50: '#f6f6f6',
69
- 100: '#e7e7e7',
70
- 200: '#d1d1d1',
71
- 300: '#b0b0b0',
72
- 400: '#888888',
73
- 500: '#6d6d6d',
74
- 600: '#606060',
75
- 700: '#4f4f4f',
76
- 800: '#454545',
77
- 900: '#3d3d3d',
78
- 950: '#262626'
79
- },
80
- card: {
81
- DEFAULT: 'hsl(var(--card))',
82
- foreground: 'hsl(var(--card-foreground))'
83
- },
84
- popover: {
85
- DEFAULT: 'hsl(var(--popover))',
86
- foreground: 'hsl(var(--popover-foreground))'
87
- },
88
- secondary: {
89
- DEFAULT: 'hsl(var(--secondary))',
90
- foreground: 'hsl(var(--secondary-foreground))'
91
- },
92
- muted: {
93
- DEFAULT: 'hsl(var(--muted))',
94
- foreground: 'hsl(var(--muted-foreground))'
95
- },
96
- accent: {
97
- DEFAULT: 'hsl(var(--accent))',
98
- foreground: 'hsl(var(--accent-foreground))'
99
- },
100
- destructive: {
101
- DEFAULT: 'hsl(var(--destructive))',
102
- foreground: 'hsl(var(--destructive-foreground))'
103
- },
104
- border: 'hsl(var(--border))',
105
- input: 'hsl(var(--input))',
106
- ring: 'hsl(var(--ring))',
107
- chart: {
108
- 1: 'hsl(var(--chart-1))',
109
- 2: 'hsl(var(--chart-2))',
110
- 3: 'hsl(var(--chart-3))',
111
- 4: 'hsl(var(--chart-4))',
112
- 5: 'hsl(var(--chart-5))'
113
- },
114
- sidebar: {
115
- DEFAULT: 'hsl(var(--sidebar-background))',
116
- foreground: 'hsl(var(--sidebar-foreground))',
117
- primary: 'hsl(var(--sidebar-primary))',
118
- 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
119
- accent: 'hsl(var(--sidebar-accent))',
120
- 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
121
- border: 'hsl(var(--sidebar-border))',
122
- ring: 'hsl(var(--sidebar-ring))'
123
- }
124
- },
125
- keyframes: {
126
- 'accordion-down': {
127
- from: { height: 0 },
128
- to: { height: 'var(--radix-accordion-content-height)' }
129
- },
130
- 'accordion-up': {
131
- from: { height: 'var(--radix-accordion-content-height)' },
132
- to: { height: 0 }
133
- }
134
- },
135
- animation: {
136
- 'accordion-down': 'accordion-down 0.2s ease-out',
137
- 'accordion-up': 'accordion-up 0.2s ease-out',
138
- float: 'float 3s infinite ease-in-out'
139
- },
140
- screens: {
141
- sm: '640px',
142
- md: '768px',
143
- lg: '1024px',
144
- xl: '1400px',
145
- '2xl': '1600px',
146
- '3xl': '1820px'
147
- },
148
- fontSize: {
149
- '4.5xl': ['2.875rem', { lineHeight: '2.875rem' }],
150
- '3.4xl': ['2.25rem', { lineHeight: '2.25rem' }]
151
- },
152
- boxShadow: {
153
- 'minimal-shadow': 'rgba(100, 100, 111, 0.2) 0px 7px 29px 0px'
154
- },
155
- opacity: {
156
- 15: '0.15'
157
- }
158
- }
159
- },
160
- plugins: [
161
- require('tailwindcss-animate'),
162
- require('tailwindcss-rtl'),
163
- ({ addBase }) => {
164
- addBase({
165
- html: {
166
- fontFamily: '"Cairo", sans-serif'
167
- },
168
- body: {
169
- fontFamily: '"Cairo", sans-serif'
170
- }
171
- })
172
- }
173
- ]
174
- }