interview-widget 0.0.1 → 0.0.3
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 +104 -221
- package/dist/components/interview/answer-area.d.ts +10 -0
- package/dist/components/interview/interview-header.d.ts +6 -0
- package/dist/components/interview/question-display.d.ts +7 -0
- package/dist/components/media/video-feed.d.ts +6 -0
- package/dist/components/onboarding-modal.d.ts +8 -0
- package/dist/components/ui/button.d.ts +9 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/textarea.d.ts +8 -0
- package/dist/index.d.ts +5 -7
- package/dist/interview-widget.d.ts +4 -0
- package/dist/types.d.ts +14 -17
- package/dist/widget.css +1 -0
- package/dist/widget.es.js +405 -0
- package/dist/widget.umd.js +9 -0
- package/package.json +6 -2
- package/dist/ChatWidget.d.ts +0 -4
- package/dist/Message.d.ts +0 -9
- package/dist/chat-widget.css +0 -1
- package/dist/chat-widget.es.js +0 -193
- package/dist/chat-widget.umd.js +0 -9
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Interview Widget
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A customizable React interview widget that can be easily embedded into any website or React application via CDN.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 📸 **Video capture** with camera integration
|
|
8
8
|
- 📱 **Responsive design** with mobile support
|
|
9
9
|
- 🔧 **Flexible positioning** (inline, fixed bottom-right/left)
|
|
10
|
-
-
|
|
10
|
+
- 🧩 **TypeScript support** with full type definitions
|
|
11
11
|
- 🎯 **CDN-ready** for easy integration into any website
|
|
12
|
-
- 🔄 **
|
|
13
|
-
- 💬 **
|
|
12
|
+
- 🔄 **Q&A structured interview flow**
|
|
13
|
+
- 💬 **Configurable questions** for different interview types
|
|
14
14
|
- 🎪 **Tailwind CSS** with prefixed classes to avoid conflicts
|
|
15
15
|
- ✨ **Smooth animations** and modern UI
|
|
16
16
|
|
|
@@ -22,56 +22,104 @@ Add these scripts to your HTML:
|
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
24
|
<!-- Load React and ReactDOM from CDN -->
|
|
25
|
-
<script
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
25
|
+
<script
|
|
26
|
+
crossorigin
|
|
27
|
+
src="https://unpkg.com/react@18/umd/react.production.min.js"
|
|
28
|
+
></script>
|
|
29
|
+
<script
|
|
30
|
+
crossorigin
|
|
31
|
+
src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
|
|
32
|
+
></script>
|
|
33
|
+
|
|
34
|
+
<!-- Load the interview widget CSS -->
|
|
35
|
+
<link
|
|
36
|
+
rel="stylesheet"
|
|
37
|
+
href="https://unpkg.com/interview-widget@latest/dist/widget.css"
|
|
38
|
+
/>
|
|
30
39
|
|
|
31
|
-
<!-- Load the
|
|
32
|
-
<script src="https://
|
|
40
|
+
<!-- Load the interview widget JavaScript -->
|
|
41
|
+
<script src="https://unpkg.com/interview-widget@latest/dist/widget.umd.js"></script>
|
|
33
42
|
|
|
34
43
|
<script>
|
|
35
|
-
document.addEventListener(
|
|
36
|
-
const {
|
|
37
|
-
|
|
44
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
45
|
+
const { InterviewWidget } = window.InterviewWidget;
|
|
46
|
+
|
|
47
|
+
// Define your interview questions
|
|
48
|
+
const questions = [
|
|
49
|
+
{
|
|
50
|
+
id: "1",
|
|
51
|
+
text: "Can you please introduce yourself?",
|
|
52
|
+
timestamp: new Date(),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "2",
|
|
56
|
+
text: "What experience do you have with our required technologies?",
|
|
57
|
+
timestamp: new Date(),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "3",
|
|
61
|
+
text: "What are your strengths and weaknesses?",
|
|
62
|
+
timestamp: new Date(),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
38
66
|
ReactDOM.render(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
React.createElement(InterviewWidget, {
|
|
68
|
+
title: "Developer Interview",
|
|
69
|
+
questions: questions,
|
|
70
|
+
position: "bottom-right",
|
|
71
|
+
}),
|
|
72
|
+
document.getElementById("interview-widget-container")
|
|
45
73
|
);
|
|
46
|
-
});
|
|
74
|
+
});
|
|
47
75
|
</script>
|
|
48
76
|
```
|
|
49
77
|
|
|
50
78
|
### React Application Integration
|
|
51
79
|
|
|
52
80
|
```bash
|
|
53
|
-
npm install
|
|
81
|
+
npm install interview-widget
|
|
54
82
|
```
|
|
55
83
|
|
|
56
84
|
```tsx
|
|
57
|
-
import React from
|
|
58
|
-
import {
|
|
85
|
+
import React, { useState } from "react";
|
|
86
|
+
import {
|
|
87
|
+
InterviewWidget,
|
|
88
|
+
InterviewQuestion,
|
|
89
|
+
InterviewAnswer,
|
|
90
|
+
} from "interview-widget";
|
|
59
91
|
|
|
60
92
|
function App() {
|
|
61
|
-
const [
|
|
93
|
+
const questions: InterviewQuestion[] = [
|
|
94
|
+
{
|
|
95
|
+
id: "1",
|
|
96
|
+
text: "Can you please introduce yourself?",
|
|
97
|
+
timestamp: new Date(),
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "2",
|
|
101
|
+
text: "What experience do you have with our required technologies?",
|
|
102
|
+
timestamp: new Date(),
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
const handleAnswerSubmit = (answer: InterviewAnswer) => {
|
|
107
|
+
// Handle submitting answer to your backend
|
|
108
|
+
console.log("User answered:", answer);
|
|
109
|
+
};
|
|
62
110
|
|
|
63
|
-
const
|
|
64
|
-
// Handle
|
|
65
|
-
console.log(
|
|
111
|
+
const handleComplete = (answers: InterviewAnswer[]) => {
|
|
112
|
+
// Handle interview completion
|
|
113
|
+
console.log("All answers:", answers);
|
|
66
114
|
};
|
|
67
115
|
|
|
68
116
|
return (
|
|
69
117
|
<div>
|
|
70
|
-
<
|
|
71
|
-
title="
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
118
|
+
<InterviewWidget
|
|
119
|
+
title="Technical Interview"
|
|
120
|
+
questions={questions}
|
|
121
|
+
onAnswerSubmit={handleAnswerSubmit}
|
|
122
|
+
onComplete={handleComplete}
|
|
75
123
|
/>
|
|
76
124
|
</div>
|
|
77
125
|
);
|
|
@@ -80,202 +128,37 @@ function App() {
|
|
|
80
128
|
|
|
81
129
|
## API Reference
|
|
82
130
|
|
|
83
|
-
###
|
|
131
|
+
### InterviewWidget Props
|
|
84
132
|
|
|
85
|
-
| Prop
|
|
86
|
-
|
|
87
|
-
| `title`
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `width` | `string` | `"350px"` | Width of the chat widget |
|
|
96
|
-
| `position` | `'bottom-right' \| 'bottom-left' \| 'inline'` | `"inline"` | Widget positioning |
|
|
97
|
-
| `theme` | `'light' \| 'dark'` | `"light"` | Color theme |
|
|
133
|
+
| Prop | Type | Default | Description |
|
|
134
|
+
| ---------------- | -------------------------------------- | ------------- | --------------------------------------- | --- |
|
|
135
|
+
| `title` | `string` | `"Interview"` | Title displayed in the interview header |
|
|
136
|
+
| `candidateName` | `string` | `""` | Optional name of the candidate |
|
|
137
|
+
| `questions` | `InterviewQuestion[]` | Required | Array of interview questions |
|
|
138
|
+
| `onAnswerSubmit` | `(answer: InterviewAnswer) => void` | `undefined` | Callback when user submits an answer |
|
|
139
|
+
| `onComplete` | `(answers: InterviewAnswer[]) => void` | `undefined` | Callback when interview is completed |
|
|
140
|
+
| `className` | `string` | `""` | Additional CSS classes |
|
|
141
|
+
| `height` | `string` | `"600px"` | Height of the interview widget |
|
|
142
|
+
| `width` | `string` | `"100%"` | Width of the interview widget | |
|
|
98
143
|
|
|
99
|
-
###
|
|
144
|
+
### InterviewQuestion Interface
|
|
100
145
|
|
|
101
146
|
```typescript
|
|
102
|
-
interface
|
|
147
|
+
interface InterviewQuestion {
|
|
103
148
|
id: string;
|
|
104
149
|
text: string;
|
|
105
|
-
|
|
150
|
+
type?: "text" | "code" | "multiple-choice";
|
|
151
|
+
options?: string[]; // For multiple choice questions
|
|
106
152
|
timestamp: Date;
|
|
107
153
|
}
|
|
108
154
|
```
|
|
109
155
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### Standalone Widget (Auto-reply)
|
|
113
|
-
|
|
114
|
-
```tsx
|
|
115
|
-
<ChatWidget
|
|
116
|
-
title="AI Assistant"
|
|
117
|
-
placeholder="Ask me anything..."
|
|
118
|
-
botName="AI Helper"
|
|
119
|
-
userName="Visitor"
|
|
120
|
-
/>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Controlled Widget
|
|
156
|
+
### InterviewAnswer Interface
|
|
124
157
|
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const userMessage = {
|
|
131
|
-
id: Date.now().toString(),
|
|
132
|
-
text,
|
|
133
|
-
sender: 'user' as const,
|
|
134
|
-
timestamp: new Date()
|
|
135
|
-
};
|
|
136
|
-
setMessages(prev => [...prev, userMessage]);
|
|
137
|
-
|
|
138
|
-
// Get bot response from your API
|
|
139
|
-
const response = await fetch('/api/chat', {
|
|
140
|
-
method: 'POST',
|
|
141
|
-
body: JSON.stringify({ message: text })
|
|
142
|
-
});
|
|
143
|
-
const data = await response.json();
|
|
144
|
-
|
|
145
|
-
// Add bot response
|
|
146
|
-
const botMessage = {
|
|
147
|
-
id: (Date.now() + 1).toString(),
|
|
148
|
-
text: data.reply,
|
|
149
|
-
sender: 'bot' as const,
|
|
150
|
-
timestamp: new Date()
|
|
151
|
-
};
|
|
152
|
-
setMessages(prev => [...prev, botMessage]);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
<ChatWidget
|
|
156
|
-
messages={messages}
|
|
157
|
-
onSendMessage={handleMessage}
|
|
158
|
-
/>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Fixed Position Widget
|
|
162
|
-
|
|
163
|
-
```tsx
|
|
164
|
-
<ChatWidget
|
|
165
|
-
title="Help & Support"
|
|
166
|
-
position="bottom-right"
|
|
167
|
-
height="500px"
|
|
168
|
-
width="300px"
|
|
169
|
-
/>
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Dark Theme
|
|
173
|
-
|
|
174
|
-
```tsx
|
|
175
|
-
<ChatWidget
|
|
176
|
-
theme="dark"
|
|
177
|
-
title="Night Support"
|
|
178
|
-
botName="Night Owl Bot"
|
|
179
|
-
/>
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## Development
|
|
183
|
-
|
|
184
|
-
### Setup
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
git clone https://github.com/your-username/chat-widget.git
|
|
188
|
-
cd chat-widget
|
|
189
|
-
npm install
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Development Server
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
npm run dev
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Open http://localhost:5173 to see the development examples.
|
|
199
|
-
|
|
200
|
-
### Build
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
npm run build
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
This creates:
|
|
207
|
-
- `dist/chat-widget.umd.js` - UMD build for CDN
|
|
208
|
-
- `dist/chat-widget.es.js` - ES modules build
|
|
209
|
-
- `dist/chat-widget.css` - Styles
|
|
210
|
-
- `dist/index.d.ts` - TypeScript definitions
|
|
211
|
-
|
|
212
|
-
### Testing Examples
|
|
213
|
-
|
|
214
|
-
After building, you can test the CDN integration by opening `examples/cdn-example.html` in your browser.
|
|
215
|
-
|
|
216
|
-
## Customization
|
|
217
|
-
|
|
218
|
-
### Custom Styles
|
|
219
|
-
|
|
220
|
-
The widget uses Tailwind CSS with the `cw-` prefix to avoid conflicts. You can override styles:
|
|
221
|
-
|
|
222
|
-
```css
|
|
223
|
-
.chat-widget-container {
|
|
224
|
-
/* Your custom styles */
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.cw-bg-primary-500 {
|
|
228
|
-
background-color: your-brand-color !important;
|
|
158
|
+
```typescript
|
|
159
|
+
interface InterviewAnswer {
|
|
160
|
+
questionId: string;
|
|
161
|
+
answerText: string;
|
|
162
|
+
timestamp: Date;
|
|
229
163
|
}
|
|
230
164
|
```
|
|
231
|
-
|
|
232
|
-
### API Integration
|
|
233
|
-
|
|
234
|
-
For production use, implement your chat API:
|
|
235
|
-
|
|
236
|
-
```tsx
|
|
237
|
-
const handleSendMessage = async (message: string) => {
|
|
238
|
-
try {
|
|
239
|
-
const response = await fetch('/api/chat', {
|
|
240
|
-
method: 'POST',
|
|
241
|
-
headers: { 'Content-Type': 'application/json' },
|
|
242
|
-
body: JSON.stringify({
|
|
243
|
-
message,
|
|
244
|
-
sessionId: 'user-session-id',
|
|
245
|
-
timestamp: new Date().toISOString()
|
|
246
|
-
})
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
const data = await response.json();
|
|
250
|
-
// Handle response...
|
|
251
|
-
} catch (error) {
|
|
252
|
-
// Handle error...
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Browser Support
|
|
258
|
-
|
|
259
|
-
- Chrome (latest)
|
|
260
|
-
- Firefox (latest)
|
|
261
|
-
- Safari (latest)
|
|
262
|
-
- Edge (latest)
|
|
263
|
-
- IE 11+ (with polyfills)
|
|
264
|
-
|
|
265
|
-
## License
|
|
266
|
-
|
|
267
|
-
MIT License - see LICENSE file for details.
|
|
268
|
-
|
|
269
|
-
## Contributing
|
|
270
|
-
|
|
271
|
-
1. Fork the repository
|
|
272
|
-
2. Create a feature branch
|
|
273
|
-
3. Make your changes
|
|
274
|
-
4. Add tests if applicable
|
|
275
|
-
5. Submit a pull request
|
|
276
|
-
|
|
277
|
-
## Support
|
|
278
|
-
|
|
279
|
-
- 📧 Email: support@yourcompany.com
|
|
280
|
-
- 🐛 Issues: [GitHub Issues](https://github.com/your-username/chat-widget/issues)
|
|
281
|
-
- 📖 Docs: [Documentation](https://your-docs-site.com)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface AnswerAreaProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
5
|
+
onSubmit: () => void;
|
|
6
|
+
isSubmitDisabled: boolean;
|
|
7
|
+
remainingTimeText?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const AnswerArea: React.FC<AnswerAreaProps>;
|
|
10
|
+
export default AnswerArea;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: "primary" | "secondary" | "outline" | "text" | "gradient";
|
|
4
|
+
size?: "sm" | "md" | "lg";
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const Button: React.FC<ButtonProps>;
|
|
9
|
+
export default Button;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
|
+
label?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Textarea: React.FC<TextareaProps>;
|
|
8
|
+
export default Textarea;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
|
|
3
|
-
export { ChatWidget, Message };
|
|
1
|
+
import { default as InterviewWidget } from './interview-widget';
|
|
2
|
+
export { InterviewWidget };
|
|
4
3
|
export * from './types';
|
|
5
|
-
export {
|
|
4
|
+
export { InterviewWidget as default };
|
|
6
5
|
declare global {
|
|
7
6
|
interface Window {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Message: typeof Message;
|
|
7
|
+
InterviewWidget: {
|
|
8
|
+
InterviewWidget: typeof InterviewWidget;
|
|
11
9
|
};
|
|
12
10
|
React: any;
|
|
13
11
|
ReactDOM: any;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface InterviewQuestion {
|
|
2
2
|
id: string;
|
|
3
3
|
text: string;
|
|
4
|
-
|
|
4
|
+
type?: "text" | "code" | "multiple-choice";
|
|
5
|
+
options?: string[];
|
|
5
6
|
timestamp: Date;
|
|
6
7
|
}
|
|
7
|
-
export interface
|
|
8
|
+
export interface InterviewAnswer {
|
|
9
|
+
questionId: string;
|
|
10
|
+
answerText: string;
|
|
11
|
+
timestamp: Date;
|
|
12
|
+
}
|
|
13
|
+
export interface InterviewWidgetProps {
|
|
8
14
|
title?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
candidateName?: string;
|
|
16
|
+
questions: InterviewQuestion[];
|
|
17
|
+
onComplete?: (answers: InterviewAnswer[]) => void;
|
|
18
|
+
onAnswerSubmit?: (answer: InterviewAnswer) => void;
|
|
12
19
|
className?: string;
|
|
13
|
-
botName?: string;
|
|
14
|
-
userName?: string;
|
|
15
|
-
height?: string;
|
|
16
20
|
width?: string;
|
|
17
|
-
|
|
18
|
-
theme?: 'light' | 'dark';
|
|
19
|
-
}
|
|
20
|
-
export interface ChatWidgetConfig {
|
|
21
|
-
apiEndpoint?: string;
|
|
22
|
-
apiKey?: string;
|
|
23
|
-
autoReply?: boolean;
|
|
24
|
-
welcomeMessage?: string;
|
|
21
|
+
height?: string;
|
|
25
22
|
}
|
package/dist/widget.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.iw-fixed{position:fixed!important}.iw-relative{position:relative!important}.iw-inset-0{top:0!important;right:0!important;bottom:0!important;left:0!important}.iw-z-50{z-index:50!important}.iw-mx-4{margin-left:1rem!important;margin-right:1rem!important}.iw-mx-auto{margin-left:auto!important;margin-right:auto!important}.iw-mb-1{margin-bottom:.25rem!important}.iw-mb-2{margin-bottom:.5rem!important}.iw-mb-3{margin-bottom:.75rem!important}.iw-mb-4{margin-bottom:1rem!important}.iw-mr-2{margin-right:.5rem!important}.iw-mt-1{margin-top:.25rem!important}.iw-mt-2{margin-top:.5rem!important}.iw-mt-3{margin-top:.75rem!important}.iw-mt-4{margin-top:1rem!important}.iw-mt-auto{margin-top:auto!important}.iw-block{display:block!important}.iw-flex{display:flex!important}.iw-inline-flex{display:inline-flex!important}.iw-grid{display:grid!important}.iw-h-12{height:3rem!important}.iw-h-4{height:1rem!important}.iw-h-64{height:16rem!important}.iw-h-7{height:1.75rem!important}.iw-h-\[400px\]{height:400px!important}.iw-h-full{height:100%!important}.iw-h-px{height:1px!important}.iw-h-screen{height:100vh!important}.iw-min-h-\[112px\]{min-height:112px!important}.iw-w-12{width:3rem!important}.iw-w-4{width:1rem!important}.iw-w-7{width:1.75rem!important}.iw-w-full{width:100%!important}.iw-w-screen{width:100vw!important}.iw-max-w-3xl{max-width:48rem!important}.iw-flex-1{flex:1 1 0%!important}.iw-flex-grow{flex-grow:1!important}@keyframes iw-spin{to{transform:rotate(360deg)}}.iw-animate-spin{animation:iw-spin 1s linear infinite!important}.iw-cursor-pointer{cursor:pointer!important}.iw-resize-none{resize:none!important}.iw-list-disc{list-style-type:disc!important}.iw-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))!important}.iw-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.iw-flex-col{flex-direction:column!important}.iw-items-center{align-items:center!important}.iw-justify-center{justify-content:center!important}.iw-justify-between{justify-content:space-between!important}.iw-gap-2{gap:.5rem!important}.iw-gap-3{gap:.75rem!important}.iw-gap-4{gap:1rem!important}.iw-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0 !important;margin-right:calc(.5rem * var(--tw-space-x-reverse))!important;margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))!important}.iw-space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0 !important;margin-right:calc(.75rem * var(--tw-space-x-reverse))!important;margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))!important}.iw-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0 !important;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)))!important;margin-bottom:calc(.5rem * var(--tw-space-y-reverse))!important}.iw-overflow-hidden{overflow:hidden!important}.iw-rounded{border-radius:.25rem!important}.iw-rounded-lg{border-radius:.5rem!important}.iw-rounded-md{border-radius:.375rem!important}.iw-rounded-none{border-radius:0!important}.iw-rounded-xl{border-radius:.75rem!important}.iw-border{border-width:1px!important}.iw-border-b{border-bottom-width:1px!important}.iw-border-gray-200{--tw-border-opacity: 1 !important;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))!important}.iw-border-gray-300{--tw-border-opacity: 1 !important;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))!important}.iw-border-indigo-100{--tw-border-opacity: 1 !important;border-color:rgb(224 231 255 / var(--tw-border-opacity, 1))!important}.iw-border-primary-500{--tw-border-opacity: 1 !important;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))!important}.iw-border-red-500{--tw-border-opacity: 1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))!important}.iw-border-transparent{border-color:transparent!important}.iw-bg-black\/50{background-color:#00000080!important}.iw-bg-gray-200{--tw-bg-opacity: 1 !important;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))!important}.iw-bg-gray-50{--tw-bg-opacity: 1 !important;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))!important}.iw-bg-gray-900{--tw-bg-opacity: 1 !important;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))!important}.iw-bg-primary-100{--tw-bg-opacity: 1 !important;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))!important}.iw-bg-primary-600{--tw-bg-opacity: 1 !important;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))!important}.iw-bg-purple-500{--tw-bg-opacity: 1 !important;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))!important}.iw-bg-transparent{background-color:transparent!important}.iw-bg-white{--tw-bg-opacity: 1 !important;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))!important}.iw-bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))!important}.iw-bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))!important}.iw-from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position) !important;--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position) !important;--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important}.iw-from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position) !important;--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position) !important;--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important}.iw-to-indigo-500{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position) !important}.iw-to-white{--tw-gradient-to: #fff var(--tw-gradient-to-position) !important}.iw-object-cover{-o-object-fit:cover!important;object-fit:cover!important}.iw-p-2{padding:.5rem!important}.iw-p-4{padding:1rem!important}.iw-p-5{padding:1.25rem!important}.iw-px-3{padding-left:.75rem!important;padding-right:.75rem!important}.iw-px-4{padding-left:1rem!important;padding-right:1rem!important}.iw-px-5{padding-left:1.25rem!important;padding-right:1.25rem!important}.iw-py-1\.5{padding-top:.375rem!important;padding-bottom:.375rem!important}.iw-py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.iw-py-2\.5{padding-top:.625rem!important;padding-bottom:.625rem!important}.iw-py-3{padding-top:.75rem!important;padding-bottom:.75rem!important}.iw-py-4{padding-top:1rem!important;padding-bottom:1rem!important}.iw-py-5{padding-top:1.25rem!important;padding-bottom:1.25rem!important}.iw-pl-4{padding-left:1rem!important}.iw-pt-2{padding-top:.5rem!important}.iw-text-center{text-align:center!important}.iw-text-\[15px\]{font-size:15px!important}.iw-text-base{font-size:1rem!important;line-height:1.5rem!important}.iw-text-sm{font-size:.875rem!important;line-height:1.25rem!important}.iw-text-xl{font-size:1.25rem!important;line-height:1.75rem!important}.iw-text-xs{font-size:.75rem!important;line-height:1rem!important}.iw-font-bold{font-weight:700!important}.iw-font-medium{font-weight:500!important}.iw-font-semibold{font-weight:600!important}.iw-leading-6{line-height:1.5rem!important}.iw-text-gray-500{--tw-text-opacity: 1 !important;color:rgb(107 114 128 / var(--tw-text-opacity, 1))!important}.iw-text-gray-700{--tw-text-opacity: 1 !important;color:rgb(55 65 81 / var(--tw-text-opacity, 1))!important}.iw-text-gray-800{--tw-text-opacity: 1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1))!important}.iw-text-gray-900{--tw-text-opacity: 1 !important;color:rgb(17 24 39 / var(--tw-text-opacity, 1))!important}.iw-text-primary-600{--tw-text-opacity: 1 !important;color:rgb(37 99 235 / var(--tw-text-opacity, 1))!important}.iw-text-primary-700{--tw-text-opacity: 1 !important;color:rgb(29 78 216 / var(--tw-text-opacity, 1))!important}.iw-text-red-600{--tw-text-opacity: 1 !important;color:rgb(220 38 38 / var(--tw-text-opacity, 1))!important}.iw-text-white{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1))!important}.iw-opacity-25{opacity:.25!important}.iw-opacity-75{opacity:.75!important}.iw-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25) !important;--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.iw-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1) !important;--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.iw-shadow-none{--tw-shadow: 0 0 #0000 !important;--tw-shadow-colored: 0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.iw-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05) !important;--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.iw-backdrop-blur-sm{--tw-backdrop-blur: blur(4px) !important;-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)!important;backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)!important}.iw-transition-all{transition-property:all!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important;transition-duration:.15s!important}.iw-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important;transition-duration:.15s!important}:root{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-opacity: .5}.interview-widget-container{font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.interview-messages::-webkit-scrollbar{width:6px}.interview-messages::-webkit-scrollbar-track{background:#f1f1f1}.interview-messages::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.interview-messages::-webkit-scrollbar-thumb:hover{background:#a8a8a8}@keyframes slideIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.message-animation{animation:slideIn .3s ease-out}.iw-hover\:bg-primary-600:hover{background-color:#2563eb!important}.iw-focus\:outline-none:focus{outline:2px solid transparent!important;outline-offset:2px!important}.iw-focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)!important}.iw-focus\:ring-primary-500:focus{--tw-ring-opacity: 1 !important;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1)) !important}.iw-disabled\:opacity-50:disabled{opacity:.5!important}.iw-disabled\:cursor-not-allowed:disabled{cursor:not-allowed!important}@media (min-width: 1024px){.iw-lg\:max-w-md{max-width:28rem!important}}@media (min-width: 768px){.iw-md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}}.hover\:iw-from-purple-600:hover{--tw-gradient-from: #9333ea var(--tw-gradient-from-position) !important;--tw-gradient-to: rgb(147 51 234 / 0) var(--tw-gradient-to-position) !important;--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important}.hover\:iw-to-indigo-600:hover{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position) !important}.hover\:iw-text-gray-700:hover{--tw-text-opacity: 1 !important;color:rgb(55 65 81 / var(--tw-text-opacity, 1))!important}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { useRef as j, useState as c, useEffect as E, useMemo as z } from "react";
|
|
2
|
+
var I = { exports: {} }, y = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var F = Symbol.for("react.transitional.element"), G = Symbol.for("react.fragment");
|
|
13
|
+
function $(r, s, i) {
|
|
14
|
+
var a = null;
|
|
15
|
+
if (i !== void 0 && (a = "" + i), s.key !== void 0 && (a = "" + s.key), "key" in s) {
|
|
16
|
+
i = {};
|
|
17
|
+
for (var t in s)
|
|
18
|
+
t !== "key" && (i[t] = s[t]);
|
|
19
|
+
} else i = s;
|
|
20
|
+
return s = i.ref, {
|
|
21
|
+
$$typeof: F,
|
|
22
|
+
type: r,
|
|
23
|
+
key: a,
|
|
24
|
+
ref: s !== void 0 ? s : null,
|
|
25
|
+
props: i
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
y.Fragment = G;
|
|
29
|
+
y.jsx = $;
|
|
30
|
+
y.jsxs = $;
|
|
31
|
+
I.exports = y;
|
|
32
|
+
var e = I.exports;
|
|
33
|
+
const k = ({
|
|
34
|
+
children: r,
|
|
35
|
+
variant: s = "primary",
|
|
36
|
+
size: i = "md",
|
|
37
|
+
fullWidth: a = !1,
|
|
38
|
+
isLoading: t = !1,
|
|
39
|
+
disabled: o,
|
|
40
|
+
className: w = "",
|
|
41
|
+
...l
|
|
42
|
+
}) => {
|
|
43
|
+
const m = "iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2", x = {
|
|
44
|
+
primary: "iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",
|
|
45
|
+
secondary: "iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",
|
|
46
|
+
outline: "iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",
|
|
47
|
+
text: "iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",
|
|
48
|
+
gradient: "iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"
|
|
49
|
+
}, h = {
|
|
50
|
+
sm: "iw-px-3 iw-py-1.5 iw-text-sm",
|
|
51
|
+
md: "iw-px-4 iw-py-2 iw-text-sm",
|
|
52
|
+
lg: "iw-px-5 iw-py-2.5 iw-text-base"
|
|
53
|
+
}, d = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", u = a ? "iw-w-full" : "";
|
|
54
|
+
return /* @__PURE__ */ e.jsxs(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
className: `${m} ${x[s]} ${h[i]} ${u} ${d} ${w}`,
|
|
58
|
+
disabled: o || t,
|
|
59
|
+
...l,
|
|
60
|
+
children: [
|
|
61
|
+
t && /* @__PURE__ */ e.jsxs(
|
|
62
|
+
"svg",
|
|
63
|
+
{
|
|
64
|
+
className: "iw-animate-spin iw-mr-2 iw-h-4 iw-w-4 iw-text-white",
|
|
65
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
66
|
+
fill: "none",
|
|
67
|
+
viewBox: "0 0 24 24",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ e.jsx(
|
|
70
|
+
"circle",
|
|
71
|
+
{
|
|
72
|
+
className: "iw-opacity-25",
|
|
73
|
+
cx: "12",
|
|
74
|
+
cy: "12",
|
|
75
|
+
r: "10",
|
|
76
|
+
stroke: "currentColor",
|
|
77
|
+
strokeWidth: "4"
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ e.jsx(
|
|
81
|
+
"path",
|
|
82
|
+
{
|
|
83
|
+
className: "iw-opacity-75",
|
|
84
|
+
fill: "currentColor",
|
|
85
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
r
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}, Q = ({
|
|
96
|
+
isOpen: r,
|
|
97
|
+
onStart: s,
|
|
98
|
+
onClose: i
|
|
99
|
+
}) => {
|
|
100
|
+
var g;
|
|
101
|
+
const a = j(null), t = j(null), [o, w] = c(!1), [l, m] = c(null), [x, h] = c(!1), d = () => {
|
|
102
|
+
t.current && (t.current.getTracks().forEach((n) => n.stop()), t.current = null);
|
|
103
|
+
}, u = async () => {
|
|
104
|
+
h(!0), m(null);
|
|
105
|
+
try {
|
|
106
|
+
const n = await navigator.mediaDevices.getUserMedia({
|
|
107
|
+
video: { width: { ideal: 1280 }, height: { ideal: 720 } },
|
|
108
|
+
audio: !0
|
|
109
|
+
});
|
|
110
|
+
t.current = n, a.current && (a.current.srcObject = n), w(!0);
|
|
111
|
+
} catch (n) {
|
|
112
|
+
console.error("Media permission error:", n);
|
|
113
|
+
let f = "Unable to access camera or microphone.";
|
|
114
|
+
(n == null ? void 0 : n.name) === "NotAllowedError" ? f = "Permissions denied. Please allow access to camera and microphone." : (n == null ? void 0 : n.name) === "NotFoundError" ? f = "No camera/microphone found. Please connect a device and retry." : n != null && n.message && (f = n.message), w(!1), m(f);
|
|
115
|
+
} finally {
|
|
116
|
+
h(!1);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
if (E(() => {
|
|
120
|
+
if (!r) {
|
|
121
|
+
d();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return u(), () => {
|
|
125
|
+
d();
|
|
126
|
+
};
|
|
127
|
+
}, [r]), !r) return null;
|
|
128
|
+
const N = () => {
|
|
129
|
+
s(), d();
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ e.jsx("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/50 iw-backdrop-blur-sm", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-bg-white iw-rounded-xl iw-shadow-2xl iw-w-full iw-max-w-3xl iw-mx-4", children: [
|
|
132
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-px-5 iw-py-4 iw-border-b iw-border-gray-200 iw-flex iw-items-center iw-justify-between", children: [
|
|
133
|
+
/* @__PURE__ */ e.jsx("h2", { className: "iw-text-base iw-font-semibold", children: "Camera & Microphone Check" }),
|
|
134
|
+
i && /* @__PURE__ */ e.jsx(
|
|
135
|
+
"button",
|
|
136
|
+
{
|
|
137
|
+
"aria-label": "Close",
|
|
138
|
+
className: "iw-text-gray-500 hover:iw-text-gray-700",
|
|
139
|
+
onClick: () => {
|
|
140
|
+
d(), i == null || i();
|
|
141
|
+
},
|
|
142
|
+
children: "✕"
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] }),
|
|
146
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-p-4 iw-grid iw-grid-cols-1 iw-md:grid-cols-2 iw-gap-4", children: [
|
|
147
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-border iw-border-gray-200 iw-rounded-lg iw-overflow-hidden iw-bg-gray-900", children: /* @__PURE__ */ e.jsx(
|
|
148
|
+
"video",
|
|
149
|
+
{
|
|
150
|
+
ref: a,
|
|
151
|
+
autoPlay: !0,
|
|
152
|
+
playsInline: !0,
|
|
153
|
+
muted: !0,
|
|
154
|
+
className: "iw-w-full iw-h-64 iw-object-cover"
|
|
155
|
+
}
|
|
156
|
+
) }),
|
|
157
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-3", children: [
|
|
158
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-text-gray-700", children: "We will need access to your camera and microphone. Grant permission to preview your setup and to enable the Start Interview button." }),
|
|
159
|
+
!((g = navigator.mediaDevices) != null && g.getUserMedia) && /* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-red-600", children: "Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox." }),
|
|
160
|
+
l && /* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-red-600", children: l }),
|
|
161
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-2", children: [
|
|
162
|
+
/* @__PURE__ */ e.jsx(
|
|
163
|
+
k,
|
|
164
|
+
{
|
|
165
|
+
onClick: u,
|
|
166
|
+
isLoading: x,
|
|
167
|
+
variant: "outline",
|
|
168
|
+
size: "sm",
|
|
169
|
+
children: o ? "Recheck Permissions" : "Enable Camera & Mic"
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ e.jsx(
|
|
173
|
+
k,
|
|
174
|
+
{
|
|
175
|
+
onClick: N,
|
|
176
|
+
disabled: !o,
|
|
177
|
+
size: "sm",
|
|
178
|
+
variant: "gradient",
|
|
179
|
+
children: "Start Interview"
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ e.jsxs("ul", { className: "iw-text-xs iw-text-gray-500 iw-pt-2 iw-list-disc iw-pl-4", children: [
|
|
184
|
+
/* @__PURE__ */ e.jsx("li", { children: "Your preview is muted to avoid echo." }),
|
|
185
|
+
/* @__PURE__ */ e.jsx("li", { children: "You can change devices from your browser’s site settings." })
|
|
186
|
+
] })
|
|
187
|
+
] })
|
|
188
|
+
] })
|
|
189
|
+
] }) });
|
|
190
|
+
}, Y = ({ title: r }) => /* @__PURE__ */ e.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
|
|
191
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3", children: [
|
|
192
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
|
|
193
|
+
/* @__PURE__ */ e.jsx(
|
|
194
|
+
"div",
|
|
195
|
+
{
|
|
196
|
+
className: "iw-h-7 iw-w-7 iw-rounded-md iw-bg-purple-500 iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",
|
|
197
|
+
children: "N"
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-font-medium", children: "Novara" })
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ e.jsx("h1", { className: "iw-text-base iw-font-medium", children: r }),
|
|
203
|
+
/* @__PURE__ */ e.jsx("button", { className: "iw-text-sm iw-text-gray-500 hover:iw-text-gray-700", children: "Exit Interview" })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-h-px iw-bg-gray-200" })
|
|
206
|
+
] }), _ = ({ question: r }) => /* @__PURE__ */ e.jsxs(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
className: "iw-rounded-xl iw-mb-4 message-animation iw-bg-gradient-to-b iw-from-indigo-50 iw-to-white iw-text-gray-800 iw-border iw-border-indigo-100 iw-p-5",
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-3 iw-mb-3", children: [
|
|
212
|
+
/* @__PURE__ */ e.jsx(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
className: "iw-h-12 iw-w-12 iw-rounded-lg iw-bg-purple-500 iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",
|
|
216
|
+
children: "N"
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
220
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-sm iw-font-semibold", children: "Novara" }),
|
|
221
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: "Assistant" })
|
|
222
|
+
] })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-[15px] iw-leading-6", children: r.text }),
|
|
225
|
+
r.type === "multiple-choice" && r.options && /* @__PURE__ */ e.jsx("div", { className: "iw-mt-3 iw-space-y-2", children: r.options.map((s, i) => /* @__PURE__ */ e.jsx(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: "iw-p-2 iw-rounded iw-border iw-border-gray-300 iw-hover:bg-gray-100 iw-cursor-pointer iw-transition-colors",
|
|
229
|
+
children: s
|
|
230
|
+
},
|
|
231
|
+
i
|
|
232
|
+
)) })
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
), U = ({ className: r = "" }) => {
|
|
236
|
+
const s = j(null);
|
|
237
|
+
return E(() => {
|
|
238
|
+
let i = null;
|
|
239
|
+
return (async () => {
|
|
240
|
+
try {
|
|
241
|
+
i = await navigator.mediaDevices.getUserMedia({
|
|
242
|
+
video: !0,
|
|
243
|
+
audio: !1
|
|
244
|
+
}), s.current && (s.current.srcObject = i);
|
|
245
|
+
} catch (t) {
|
|
246
|
+
console.error("Error accessing camera:", t);
|
|
247
|
+
}
|
|
248
|
+
})(), () => {
|
|
249
|
+
i && i.getTracks().forEach((t) => t.stop());
|
|
250
|
+
};
|
|
251
|
+
}, []), /* @__PURE__ */ e.jsx("div", { className: `iw-relative ${r}`, children: /* @__PURE__ */ e.jsx(
|
|
252
|
+
"video",
|
|
253
|
+
{
|
|
254
|
+
ref: s,
|
|
255
|
+
autoPlay: !0,
|
|
256
|
+
playsInline: !0,
|
|
257
|
+
muted: !0,
|
|
258
|
+
className: "iw-w-full iw-h-full iw-object-cover iw-rounded-md"
|
|
259
|
+
}
|
|
260
|
+
) });
|
|
261
|
+
}, W = ({
|
|
262
|
+
label: r,
|
|
263
|
+
error: s,
|
|
264
|
+
fullWidth: i = !1,
|
|
265
|
+
className: a = "",
|
|
266
|
+
id: t,
|
|
267
|
+
...o
|
|
268
|
+
}) => {
|
|
269
|
+
const w = t || `textarea-${Math.random().toString(36).substring(2, 9)}`, l = "iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-focus:border-primary-500 iw-focus:ring-primary-500 iw-focus:outline-none iw-transition-all", m = s ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", x = i ? "iw-w-full" : "";
|
|
270
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `${i ? "iw-w-full" : ""} ${a}`, children: [
|
|
271
|
+
r && /* @__PURE__ */ e.jsx(
|
|
272
|
+
"label",
|
|
273
|
+
{
|
|
274
|
+
htmlFor: w,
|
|
275
|
+
className: "iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",
|
|
276
|
+
children: r
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ e.jsx(
|
|
280
|
+
"textarea",
|
|
281
|
+
{
|
|
282
|
+
id: w,
|
|
283
|
+
className: `${l} ${m} ${x}`,
|
|
284
|
+
"aria-invalid": s ? "true" : "false",
|
|
285
|
+
...o
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
s && /* @__PURE__ */ e.jsx("p", { className: "iw-mt-1 iw-text-sm iw-text-red-600", children: s })
|
|
289
|
+
] });
|
|
290
|
+
}, V = ({
|
|
291
|
+
value: r,
|
|
292
|
+
onChange: s,
|
|
293
|
+
onSubmit: i,
|
|
294
|
+
isSubmitDisabled: a,
|
|
295
|
+
remainingTimeText: t
|
|
296
|
+
}) => {
|
|
297
|
+
const o = (w) => {
|
|
298
|
+
w.key === "Enter" && (w.ctrlKey || w.metaKey) && !a && (w.preventDefault(), i());
|
|
299
|
+
};
|
|
300
|
+
return /* @__PURE__ */ e.jsx("div", { className: "iw-mt-auto", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-rounded-xl iw-overflow-hidden iw-border iw-border-gray-200", children: [
|
|
301
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-px-3 iw-py-2 iw-bg-gray-50 iw-border-b iw-border-gray-200", children: [
|
|
302
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-sm iw-font-medium", children: "Your answer" }),
|
|
303
|
+
t && /* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: t })
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ e.jsx(
|
|
306
|
+
W,
|
|
307
|
+
{
|
|
308
|
+
value: r,
|
|
309
|
+
onChange: s,
|
|
310
|
+
onKeyDown: o,
|
|
311
|
+
placeholder: "Type your answer here...",
|
|
312
|
+
className: "iw-w-full iw-resize-none iw-focus:outline-none iw-bg-transparent iw-min-h-[112px]",
|
|
313
|
+
rows: 5,
|
|
314
|
+
fullWidth: !0
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-p-2 iw-flex iw-justify-between iw-items-center iw-bg-gray-50", children: [
|
|
318
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: /* @__PURE__ */ e.jsx("kbd", { children: " Press Ctrl+Enter to submit" }) }),
|
|
319
|
+
/* @__PURE__ */ e.jsx(
|
|
320
|
+
k,
|
|
321
|
+
{
|
|
322
|
+
onClick: i,
|
|
323
|
+
disabled: a,
|
|
324
|
+
size: "sm",
|
|
325
|
+
variant: "gradient",
|
|
326
|
+
children: "Submit Answer"
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
] })
|
|
330
|
+
] }) });
|
|
331
|
+
}, B = ({
|
|
332
|
+
title: r = "Interview",
|
|
333
|
+
questions: s = [],
|
|
334
|
+
onComplete: i,
|
|
335
|
+
onAnswerSubmit: a,
|
|
336
|
+
className: t = "",
|
|
337
|
+
width: o = "100%",
|
|
338
|
+
height: w = "600px"
|
|
339
|
+
}) => {
|
|
340
|
+
const [l, m] = c(0), [x, h] = c([]), [d, u] = c(""), [N, g] = c(!1), [n, f] = c(!0), [C, P] = c(!1), [S] = c(!0), M = j(null), p = s[l], T = () => {
|
|
341
|
+
const v = {
|
|
342
|
+
questionId: (p == null ? void 0 : p.id) || "",
|
|
343
|
+
answerText: d,
|
|
344
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
345
|
+
};
|
|
346
|
+
h([...x, v]), a && a(v), l < s.length - 1 ? (m((b) => b + 1), u("")) : (g(!0), i && i(x));
|
|
347
|
+
}, R = z(() => {
|
|
348
|
+
const b = 60 - Math.floor(Date.now() / 1e3 % 60), A = Math.floor(b / 60).toString().padStart(2, "0"), D = (b % 60).toString().padStart(2, "0");
|
|
349
|
+
return `Time to Talk: ${A}:${D} min`;
|
|
350
|
+
}, [l]);
|
|
351
|
+
return C ? /* @__PURE__ */ e.jsxs(
|
|
352
|
+
"div",
|
|
353
|
+
{
|
|
354
|
+
ref: M,
|
|
355
|
+
className: `interview-widget-container iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden ${t}`,
|
|
356
|
+
style: {
|
|
357
|
+
width: o,
|
|
358
|
+
height: w
|
|
359
|
+
},
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ e.jsx(Y, { title: r }),
|
|
362
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-flex-col iw-flex-grow iw-overflow-hidden iw-px-4 iw-py-5", children: N ? /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
|
|
363
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-xl iw-font-bold iw-mb-2", children: "Interview Complete!" }),
|
|
364
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-center iw-mb-4", children: "Thank you for participating in this interview." })
|
|
365
|
+
] }) : /* @__PURE__ */ e.jsxs("div", { className: "iw-h-full iw-flex iw-flex-col", children: [
|
|
366
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex-1", children: p && /* @__PURE__ */ e.jsx(_, { question: p }) }),
|
|
367
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-grid iw-grid-cols-2 iw-gap-4 iw-mt-4", children: [
|
|
368
|
+
S && /* @__PURE__ */ e.jsx(
|
|
369
|
+
"div",
|
|
370
|
+
{
|
|
371
|
+
className: "iw-mt-2 iw-border iw-border-gray-200 iw-rounded-xl iw-p-2",
|
|
372
|
+
children: /* @__PURE__ */ e.jsx(U, { className: "iw-w-full iw-h-[400px]" })
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
/* @__PURE__ */ e.jsx(
|
|
376
|
+
V,
|
|
377
|
+
{
|
|
378
|
+
value: d,
|
|
379
|
+
onChange: (v) => u(v.target.value),
|
|
380
|
+
onSubmit: T,
|
|
381
|
+
isSubmitDisabled: !d.trim() || !C,
|
|
382
|
+
remainingTimeText: R
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
] })
|
|
386
|
+
] }) })
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
) : /* @__PURE__ */ e.jsx("div", { className: "iw-h-screen iw-w-screen", children: /* @__PURE__ */ e.jsx(
|
|
390
|
+
Q,
|
|
391
|
+
{
|
|
392
|
+
isOpen: n,
|
|
393
|
+
onStart: () => {
|
|
394
|
+
console.log("Permissions granted, starting interview"), P(!0), f(!1);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
) });
|
|
398
|
+
};
|
|
399
|
+
typeof window < "u" && (window.InterviewWidget = {
|
|
400
|
+
InterviewWidget: B
|
|
401
|
+
});
|
|
402
|
+
export {
|
|
403
|
+
B as InterviewWidget,
|
|
404
|
+
B as default
|
|
405
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function(m,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],n):(m=typeof globalThis<"u"?globalThis:m||self,n(m.InterviewWidget={},m.React))})(this,function(m,n){"use strict";var C={exports:{}},b={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var M=Symbol.for("react.transitional.element"),P=Symbol.for("react.fragment");function E(r,s,i){var a=null;if(i!==void 0&&(a=""+i),s.key!==void 0&&(a=""+s.key),"key"in s){i={};for(var t in s)t!=="key"&&(i[t]=s[t])}else i=s;return s=i.ref,{$$typeof:M,type:r,key:a,ref:s!==void 0?s:null,props:i}}b.Fragment=P,b.jsx=E,b.jsxs=E,C.exports=b;var e=C.exports;const N=({children:r,variant:s="primary",size:i="md",fullWidth:a=!1,isLoading:t=!1,disabled:l,className:o="",...d})=>{const x="iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2",u={primary:"iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",secondary:"iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",outline:"iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",text:"iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",gradient:"iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"},h={sm:"iw-px-3 iw-py-1.5 iw-text-sm",md:"iw-px-4 iw-py-2 iw-text-sm",lg:"iw-px-5 iw-py-2.5 iw-text-base"},c="iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none",f=a?"iw-w-full":"";return e.jsxs("button",{className:`${x} ${u[s]} ${h[i]} ${f} ${c} ${o}`,disabled:l||t,...d,children:[t&&e.jsxs("svg",{className:"iw-animate-spin iw-mr-2 iw-h-4 iw-w-4 iw-text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"iw-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"iw-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]})},R=({isOpen:r,onStart:s,onClose:i})=>{var j;const a=n.useRef(null),t=n.useRef(null),[l,o]=n.useState(!1),[d,x]=n.useState(null),[u,h]=n.useState(!1),c=()=>{t.current&&(t.current.getTracks().forEach(w=>w.stop()),t.current=null)},f=async()=>{h(!0),x(null);try{const w=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});t.current=w,a.current&&(a.current.srcObject=w),o(!0)}catch(w){console.error("Media permission error:",w);let p="Unable to access camera or microphone.";(w==null?void 0:w.name)==="NotAllowedError"?p="Permissions denied. Please allow access to camera and microphone.":(w==null?void 0:w.name)==="NotFoundError"?p="No camera/microphone found. Please connect a device and retry.":w!=null&&w.message&&(p=w.message),o(!1),x(p)}finally{h(!1)}};if(n.useEffect(()=>{if(!r){c();return}return f(),()=>{c()}},[r]),!r)return null;const k=()=>{s(),c()};return e.jsx("div",{className:"iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/50 iw-backdrop-blur-sm",children:e.jsxs("div",{className:"iw-bg-white iw-rounded-xl iw-shadow-2xl iw-w-full iw-max-w-3xl iw-mx-4",children:[e.jsxs("div",{className:"iw-px-5 iw-py-4 iw-border-b iw-border-gray-200 iw-flex iw-items-center iw-justify-between",children:[e.jsx("h2",{className:"iw-text-base iw-font-semibold",children:"Camera & Microphone Check"}),i&&e.jsx("button",{"aria-label":"Close",className:"iw-text-gray-500 hover:iw-text-gray-700",onClick:()=>{c(),i==null||i()},children:"✕"})]}),e.jsxs("div",{className:"iw-p-4 iw-grid iw-grid-cols-1 iw-md:grid-cols-2 iw-gap-4",children:[e.jsx("div",{className:"iw-border iw-border-gray-200 iw-rounded-lg iw-overflow-hidden iw-bg-gray-900",children:e.jsx("video",{ref:a,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-64 iw-object-cover"})}),e.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-3",children:[e.jsx("p",{className:"iw-text-sm iw-text-gray-700",children:"We will need access to your camera and microphone. Grant permission to preview your setup and to enable the Start Interview button."}),!((j=navigator.mediaDevices)!=null&&j.getUserMedia)&&e.jsx("div",{className:"iw-text-xs iw-text-red-600",children:"Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox."}),d&&e.jsx("div",{className:"iw-text-xs iw-text-red-600",children:d}),e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[e.jsx(N,{onClick:f,isLoading:u,variant:"outline",size:"sm",children:l?"Recheck Permissions":"Enable Camera & Mic"}),e.jsx(N,{onClick:k,disabled:!l,size:"sm",variant:"gradient",children:"Start Interview"})]}),e.jsxs("ul",{className:"iw-text-xs iw-text-gray-500 iw-pt-2 iw-list-disc iw-pl-4",children:[e.jsx("li",{children:"Your preview is muted to avoid echo."}),e.jsx("li",{children:"You can change devices from your browser’s site settings."})]})]})]})]})})},T=({title:r})=>e.jsxs("header",{className:"iw-w-full iw-text-gray-900",children:[e.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[e.jsx("div",{className:"iw-h-7 iw-w-7 iw-rounded-md iw-bg-purple-500 iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",children:"N"}),e.jsx("p",{className:"iw-text-sm iw-font-medium",children:"Novara"})]}),e.jsx("h1",{className:"iw-text-base iw-font-medium",children:r}),e.jsx("button",{className:"iw-text-sm iw-text-gray-500 hover:iw-text-gray-700",children:"Exit Interview"})]}),e.jsx("div",{className:"iw-h-px iw-bg-gray-200"})]}),$=({question:r})=>e.jsxs("div",{className:"iw-rounded-xl iw-mb-4 message-animation iw-bg-gradient-to-b iw-from-indigo-50 iw-to-white iw-text-gray-800 iw-border iw-border-indigo-100 iw-p-5",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-3 iw-mb-3",children:[e.jsx("div",{className:"iw-h-12 iw-w-12 iw-rounded-lg iw-bg-purple-500 iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",children:"N"}),e.jsxs("div",{children:[e.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Novara"}),e.jsx("div",{className:"iw-text-xs iw-text-gray-500",children:"Assistant"})]})]}),e.jsx("p",{className:"iw-text-[15px] iw-leading-6",children:r.text}),r.type==="multiple-choice"&&r.options&&e.jsx("div",{className:"iw-mt-3 iw-space-y-2",children:r.options.map((s,i)=>e.jsx("div",{className:"iw-p-2 iw-rounded iw-border iw-border-gray-300 iw-hover:bg-gray-100 iw-cursor-pointer iw-transition-colors",children:s},i))})]}),A=({className:r=""})=>{const s=n.useRef(null);return n.useEffect(()=>{let i=null;return(async()=>{try{i=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),s.current&&(s.current.srcObject=i)}catch(t){console.error("Error accessing camera:",t)}})(),()=>{i&&i.getTracks().forEach(t=>t.stop())}},[]),e.jsx("div",{className:`iw-relative ${r}`,children:e.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-rounded-md"})})},D=({label:r,error:s,fullWidth:i=!1,className:a="",id:t,...l})=>{const o=t||`textarea-${Math.random().toString(36).substring(2,9)}`,d="iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-focus:border-primary-500 iw-focus:ring-primary-500 iw-focus:outline-none iw-transition-all",x=s?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",u=i?"iw-w-full":"";return e.jsxs("div",{className:`${i?"iw-w-full":""} ${a}`,children:[r&&e.jsx("label",{htmlFor:o,className:"iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",children:r}),e.jsx("textarea",{id:o,className:`${d} ${x} ${u}`,"aria-invalid":s?"true":"false",...l}),s&&e.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:s})]})},z=({value:r,onChange:s,onSubmit:i,isSubmitDisabled:a,remainingTimeText:t})=>{const l=o=>{o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&!a&&(o.preventDefault(),i())};return e.jsx("div",{className:"iw-mt-auto",children:e.jsxs("div",{className:"iw-rounded-xl iw-overflow-hidden iw-border iw-border-gray-200",children:[e.jsxs("div",{className:"iw-flex iw-items-center iw-justify-between iw-px-3 iw-py-2 iw-bg-gray-50 iw-border-b iw-border-gray-200",children:[e.jsx("div",{className:"iw-text-sm iw-font-medium",children:"Your answer"}),t&&e.jsx("div",{className:"iw-text-xs iw-text-gray-500",children:t})]}),e.jsx(D,{value:r,onChange:s,onKeyDown:l,placeholder:"Type your answer here...",className:"iw-w-full iw-resize-none iw-focus:outline-none iw-bg-transparent iw-min-h-[112px]",rows:5,fullWidth:!0}),e.jsxs("div",{className:"iw-p-2 iw-flex iw-justify-between iw-items-center iw-bg-gray-50",children:[e.jsx("div",{className:"iw-text-xs iw-text-gray-500",children:e.jsx("kbd",{children:" Press Ctrl+Enter to submit"})}),e.jsx(N,{onClick:i,disabled:a,size:"sm",variant:"gradient",children:"Submit Answer"})]})]})})},S=({title:r="Interview",questions:s=[],onComplete:i,onAnswerSubmit:a,className:t="",width:l="100%",height:o="600px"})=>{const[d,x]=n.useState(0),[u,h]=n.useState([]),[c,f]=n.useState(""),[k,j]=n.useState(!1),[w,p]=n.useState(!0),[I,_]=n.useState(!1),[F]=n.useState(!0),G=n.useRef(null),v=s[d],Q=()=>{const g={questionId:(v==null?void 0:v.id)||"",answerText:c,timestamp:new Date};h([...u,g]),a&&a(g),d<s.length-1?(x(y=>y+1),f("")):(j(!0),i&&i(u))},W=n.useMemo(()=>{const y=60-Math.floor(Date.now()/1e3%60),Y=Math.floor(y/60).toString().padStart(2,"0"),U=(y%60).toString().padStart(2,"0");return`Time to Talk: ${Y}:${U} min`},[d]);return I?e.jsxs("div",{ref:G,className:`interview-widget-container iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden ${t}`,style:{width:l,height:o},children:[e.jsx(T,{title:r}),e.jsx("div",{className:"iw-flex iw-flex-col iw-flex-grow iw-overflow-hidden iw-px-4 iw-py-5",children:k?e.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full",children:[e.jsx("div",{className:"iw-text-xl iw-font-bold iw-mb-2",children:"Interview Complete!"}),e.jsx("p",{className:"iw-text-center iw-mb-4",children:"Thank you for participating in this interview."})]}):e.jsxs("div",{className:"iw-h-full iw-flex iw-flex-col",children:[e.jsx("div",{className:"iw-flex-1",children:v&&e.jsx($,{question:v})}),e.jsxs("div",{className:"iw-grid iw-grid-cols-2 iw-gap-4 iw-mt-4",children:[F&&e.jsx("div",{className:"iw-mt-2 iw-border iw-border-gray-200 iw-rounded-xl iw-p-2",children:e.jsx(A,{className:"iw-w-full iw-h-[400px]"})}),e.jsx(z,{value:c,onChange:g=>f(g.target.value),onSubmit:Q,isSubmitDisabled:!c.trim()||!I,remainingTimeText:W})]})]})})]}):e.jsx("div",{className:"iw-h-screen iw-w-screen",children:e.jsx(R,{isOpen:w,onStart:()=>{console.log("Permissions granted, starting interview"),_(!0),p(!1)}})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:S}),m.InterviewWidget=S,m.default=S,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "interview-widget",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"description": "Advanced React interview widget with STT, TTS, camera access, and ML-powered analysis",
|
|
6
6
|
"main": "dist/widget.umd.js",
|
|
7
7
|
"module": "dist/widget.es.js",
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
"build:cdn": "npm run build && npm run copy:examples",
|
|
18
18
|
"copy:examples": "mkdir -p dist/examples && cp examples/*.html dist/examples/",
|
|
19
19
|
"preview": "vite preview",
|
|
20
|
-
"type-check": "tsc --noEmit"
|
|
20
|
+
"type-check": "tsc --noEmit",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
22
|
+
"publish:patch": "npm version patch && npm publish",
|
|
23
|
+
"publish:minor": "npm version minor && npm publish",
|
|
24
|
+
"publish:major": "npm version major && npm publish"
|
|
21
25
|
},
|
|
22
26
|
"peerDependencies": {
|
|
23
27
|
"react": ">=18.0.0",
|
package/dist/ChatWidget.d.ts
DELETED
package/dist/Message.d.ts
DELETED
package/dist/chat-widget.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.cw-mx-auto{margin-left:auto!important;margin-right:auto!important}.cw-mb-1{margin-bottom:.25rem!important}.cw-mb-2{margin-bottom:.5rem!important}.cw-mb-4{margin-bottom:1rem!important}.cw-mb-6{margin-bottom:1.5rem!important}.cw-mb-8{margin-bottom:2rem!important}.cw-ml-2{margin-left:.5rem!important}.cw-mt-8{margin-top:2rem!important}.cw-flex{display:flex!important}.cw-grid{display:grid!important}.cw-min-h-screen{min-height:100vh!important}.cw-w-full{width:100%!important}.cw-max-w-4xl{max-width:56rem!important}.cw-max-w-xs{max-width:20rem!important}.cw-flex-1{flex:1 1 0%!important}.cw-cursor-default{cursor:default!important}.cw-cursor-pointer{cursor:pointer!important}.cw-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))!important}.cw-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.cw-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))!important}.cw-flex-col{flex-direction:column!important}.cw-items-center{align-items:center!important}.cw-justify-start{justify-content:flex-start!important}.cw-justify-end{justify-content:flex-end!important}.cw-justify-between{justify-content:space-between!important}.cw-gap-4{gap:1rem!important}.cw-gap-8{gap:2rem!important}.cw-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0 !important;margin-right:calc(.5rem * var(--tw-space-x-reverse))!important;margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))!important}.cw-overflow-y-auto{overflow-y:auto!important}.cw-break-words{overflow-wrap:break-word!important}.cw-rounded{border-radius:.25rem!important}.cw-rounded-lg{border-radius:.5rem!important}.cw-rounded-md{border-radius:.375rem!important}.cw-rounded-t-lg{border-top-left-radius:.5rem!important;border-top-right-radius:.5rem!important}.cw-border{border-width:1px!important}.cw-border-b{border-bottom-width:1px!important}.cw-border-t{border-top-width:1px!important}.cw-border-gray-200{--tw-border-opacity: 1 !important;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))!important}.cw-border-gray-300{--tw-border-opacity: 1 !important;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))!important}.cw-border-gray-600{--tw-border-opacity: 1 !important;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))!important}.cw-bg-blue-500{--tw-bg-opacity: 1 !important;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))!important}.cw-bg-blue-600{--tw-bg-opacity: 1 !important;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))!important}.cw-bg-gray-100{--tw-bg-opacity: 1 !important;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))!important}.cw-bg-gray-200{--tw-bg-opacity: 1 !important;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))!important}.cw-bg-gray-50{--tw-bg-opacity: 1 !important;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))!important}.cw-bg-gray-700{--tw-bg-opacity: 1 !important;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))!important}.cw-bg-gray-800{--tw-bg-opacity: 1 !important;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))!important}.cw-bg-primary-500{--tw-bg-opacity: 1 !important;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))!important}.cw-bg-white{--tw-bg-opacity: 1 !important;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))!important}.cw-p-1{padding:.25rem!important}.cw-p-4{padding:1rem!important}.cw-p-8{padding:2rem!important}.cw-px-3{padding-left:.75rem!important;padding-right:.75rem!important}.cw-px-4{padding-left:1rem!important;padding-right:1rem!important}.cw-py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.cw-text-center{text-align:center!important}.cw-text-2xl{font-size:1.5rem!important;line-height:2rem!important}.cw-text-lg{font-size:1.125rem!important;line-height:1.75rem!important}.cw-text-sm{font-size:.875rem!important;line-height:1.25rem!important}.cw-text-xl{font-size:1.25rem!important;line-height:1.75rem!important}.cw-text-xs{font-size:.75rem!important;line-height:1rem!important}.cw-font-bold{font-weight:700!important}.cw-font-medium{font-weight:500!important}.cw-font-semibold{font-weight:600!important}.cw-text-blue-600{--tw-text-opacity: 1 !important;color:rgb(37 99 235 / var(--tw-text-opacity, 1))!important}.cw-text-gray-400{--tw-text-opacity: 1 !important;color:rgb(156 163 175 / var(--tw-text-opacity, 1))!important}.cw-text-gray-500{--tw-text-opacity: 1 !important;color:rgb(107 114 128 / var(--tw-text-opacity, 1))!important}.cw-text-gray-600{--tw-text-opacity: 1 !important;color:rgb(75 85 99 / var(--tw-text-opacity, 1))!important}.cw-text-gray-800{--tw-text-opacity: 1 !important;color:rgb(31 41 55 / var(--tw-text-opacity, 1))!important}.cw-text-green-600{--tw-text-opacity: 1 !important;color:rgb(22 163 74 / var(--tw-text-opacity, 1))!important}.cw-text-purple-600{--tw-text-opacity: 1 !important;color:rgb(147 51 234 / var(--tw-text-opacity, 1))!important}.cw-text-white{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1))!important}.cw-placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1 !important;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))!important}.cw-placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1 !important;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))!important}.cw-opacity-70{opacity:.7!important}.cw-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1) !important;--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important}.cw-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important;transition-duration:.15s!important}:root{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-opacity: .5}.chat-widget-container{font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.chat-messages::-webkit-scrollbar{width:6px}.chat-messages::-webkit-scrollbar-track{background:#f1f1f1}.chat-messages::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.chat-messages::-webkit-scrollbar-thumb:hover{background:#a8a8a8}@keyframes slideIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.message-animation{animation:slideIn .3s ease-out}.cw-hover\:bg-primary-600:hover{background-color:#2563eb!important}.cw-focus\:outline-none:focus{outline:2px solid transparent!important;outline-offset:2px!important}.cw-focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)!important}.cw-focus\:ring-primary-500:focus{--tw-ring-opacity: 1 !important;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1)) !important}.cw-disabled\:opacity-50:disabled{opacity:.5!important}.cw-disabled\:cursor-not-allowed:disabled{cursor:not-allowed!important}@media (min-width: 1024px){.cw-lg\:max-w-md{max-width:28rem!important}}@media (min-width: 768px){.cw-md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
|
package/dist/chat-widget.es.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { useState as p, useRef as j, useEffect as _ } from "react";
|
|
2
|
-
var k = { exports: {} }, u = {};
|
|
3
|
-
/**
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var A = Symbol.for("react.transitional.element"), L = Symbol.for("react.fragment");
|
|
13
|
-
function N(a, r, s) {
|
|
14
|
-
var c = null;
|
|
15
|
-
if (s !== void 0 && (c = "" + s), r.key !== void 0 && (c = "" + r.key), "key" in r) {
|
|
16
|
-
s = {};
|
|
17
|
-
for (var n in r)
|
|
18
|
-
n !== "key" && (s[n] = r[n]);
|
|
19
|
-
} else s = r;
|
|
20
|
-
return r = s.ref, {
|
|
21
|
-
$$typeof: A,
|
|
22
|
-
type: a,
|
|
23
|
-
key: c,
|
|
24
|
-
ref: r !== void 0 ? r : null,
|
|
25
|
-
props: s
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
u.Fragment = L;
|
|
29
|
-
u.jsx = N;
|
|
30
|
-
u.jsxs = N;
|
|
31
|
-
k.exports = u;
|
|
32
|
-
var e = k.exports;
|
|
33
|
-
const I = ({ message: a, botName: r, userName: s }) => {
|
|
34
|
-
const c = a.sender === "bot", n = (m) => m.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
35
|
-
return /* @__PURE__ */ e.jsx("div", { className: `cw-flex cw-mb-4 message-animation ${c ? "cw-justify-start" : "cw-justify-end"}`, children: /* @__PURE__ */ e.jsxs("div", { className: `cw-max-w-xs cw-lg:max-w-md cw-px-4 cw-py-2 cw-rounded-lg cw-break-words ${c ? "cw-bg-gray-200 cw-text-gray-800" : "cw-bg-primary-500 cw-text-white"}`, children: [
|
|
36
|
-
/* @__PURE__ */ e.jsxs("div", { className: "cw-flex cw-items-center cw-mb-1", children: [
|
|
37
|
-
/* @__PURE__ */ e.jsx("span", { className: "cw-text-xs cw-font-semibold", children: c ? r : s }),
|
|
38
|
-
/* @__PURE__ */ e.jsx("span", { className: "cw-text-xs cw-opacity-70 cw-ml-2", children: n(a.timestamp) })
|
|
39
|
-
] }),
|
|
40
|
-
/* @__PURE__ */ e.jsx("div", { className: "cw-text-sm", children: a.text })
|
|
41
|
-
] }) });
|
|
42
|
-
}, P = ({
|
|
43
|
-
title: a = "Chat Support",
|
|
44
|
-
placeholder: r = "Type your message...",
|
|
45
|
-
onSendMessage: s,
|
|
46
|
-
messages: c = [],
|
|
47
|
-
className: n = "",
|
|
48
|
-
botName: m = "Support Bot",
|
|
49
|
-
userName: T = "You",
|
|
50
|
-
height: E = "400px",
|
|
51
|
-
width: R = "350px",
|
|
52
|
-
position: x = "inline",
|
|
53
|
-
theme: i = "light"
|
|
54
|
-
}) => {
|
|
55
|
-
const [$, g] = p([]), [l, y] = p(""), [d, C] = p(!1), f = j(null), b = j(null), h = c.length > 0 ? c : $, S = (t) => {
|
|
56
|
-
const w = [
|
|
57
|
-
"Thanks for your message! How can I help you today?",
|
|
58
|
-
"I understand your concern. Let me assist you with that.",
|
|
59
|
-
"That's a great question! Here's what I can tell you...",
|
|
60
|
-
"I'm here to help! Can you provide more details?",
|
|
61
|
-
"Thank you for reaching out. I'll do my best to assist you."
|
|
62
|
-
], o = t.toLowerCase();
|
|
63
|
-
return o.includes("hello") || o.includes("hi") ? "Hello! Welcome to our support chat. How can I help you today?" : o.includes("help") ? "I'm here to help! What do you need assistance with?" : o.includes("price") || o.includes("cost") ? "I can help you with pricing information. What specific product or service are you interested in?" : w[Math.floor(Math.random() * w.length)] || "I'm here to help!";
|
|
64
|
-
}, D = () => {
|
|
65
|
-
var t;
|
|
66
|
-
(t = f.current) == null || t.scrollIntoView({ behavior: "smooth" });
|
|
67
|
-
};
|
|
68
|
-
_(() => {
|
|
69
|
-
D();
|
|
70
|
-
}, [h]);
|
|
71
|
-
const v = () => {
|
|
72
|
-
var w;
|
|
73
|
-
if (!l.trim()) return;
|
|
74
|
-
const t = {
|
|
75
|
-
id: Date.now().toString(),
|
|
76
|
-
text: l.trim(),
|
|
77
|
-
sender: "user",
|
|
78
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
79
|
-
};
|
|
80
|
-
c.length > 0 ? s == null || s(l.trim()) : (g((o) => [...o, t]), setTimeout(() => {
|
|
81
|
-
const o = {
|
|
82
|
-
id: (Date.now() + 1).toString(),
|
|
83
|
-
text: S(l.trim()),
|
|
84
|
-
sender: "bot",
|
|
85
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
86
|
-
};
|
|
87
|
-
g((W) => [...W, o]);
|
|
88
|
-
}, 1e3)), y(""), (w = b.current) == null || w.focus();
|
|
89
|
-
}, M = (t) => {
|
|
90
|
-
t.key === "Enter" && !t.shiftKey && (t.preventDefault(), v());
|
|
91
|
-
}, H = {
|
|
92
|
-
height: d ? "auto" : E,
|
|
93
|
-
width: R,
|
|
94
|
-
...x !== "inline" && {
|
|
95
|
-
position: "fixed",
|
|
96
|
-
bottom: "20px",
|
|
97
|
-
[x === "bottom-right" ? "right" : "left"]: "20px",
|
|
98
|
-
zIndex: 1e3
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
return /* @__PURE__ */ e.jsxs(
|
|
102
|
-
"div",
|
|
103
|
-
{
|
|
104
|
-
className: `chat-widget-container cw-bg-white cw-border cw-border-gray-300 cw-rounded-lg cw-shadow-lg cw-flex cw-flex-col ${i === "dark" ? "cw-bg-gray-800 cw-border-gray-600" : ""} ${n}`,
|
|
105
|
-
style: H,
|
|
106
|
-
children: [
|
|
107
|
-
/* @__PURE__ */ e.jsxs(
|
|
108
|
-
"div",
|
|
109
|
-
{
|
|
110
|
-
className: `cw-flex cw-items-center cw-justify-between cw-p-4 cw-border-b cw-bg-primary-500 cw-text-white cw-rounded-t-lg ${i === "dark" ? "cw-border-gray-600" : "cw-border-gray-200"}`,
|
|
111
|
-
children: [
|
|
112
|
-
/* @__PURE__ */ e.jsx("h3", { className: "cw-font-semibold cw-text-sm", children: a }),
|
|
113
|
-
x !== "inline" && /* @__PURE__ */ e.jsx(
|
|
114
|
-
"button",
|
|
115
|
-
{
|
|
116
|
-
onClick: () => C(!d),
|
|
117
|
-
className: "cw-text-white cw-hover:bg-primary-600 cw-rounded cw-p-1 cw-transition-colors",
|
|
118
|
-
children: d ? "▲" : "▼"
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
!d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
125
|
-
/* @__PURE__ */ e.jsxs(
|
|
126
|
-
"div",
|
|
127
|
-
{
|
|
128
|
-
className: `cw-flex-1 cw-overflow-y-auto cw-p-4 chat-messages ${i === "dark" ? "cw-bg-gray-700" : "cw-bg-gray-50"}`,
|
|
129
|
-
style: { maxHeight: "calc(100% - 120px)" },
|
|
130
|
-
children: [
|
|
131
|
-
h.length === 0 && /* @__PURE__ */ e.jsx(
|
|
132
|
-
"div",
|
|
133
|
-
{
|
|
134
|
-
className: `cw-text-center cw-text-gray-500 cw-text-sm cw-mt-8 ${i === "dark" ? "cw-text-gray-400" : ""}`,
|
|
135
|
-
children: "Start a conversation by typing a message below."
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
h.map((t) => /* @__PURE__ */ e.jsx(
|
|
139
|
-
I,
|
|
140
|
-
{
|
|
141
|
-
message: t,
|
|
142
|
-
botName: m,
|
|
143
|
-
userName: T
|
|
144
|
-
},
|
|
145
|
-
t.id
|
|
146
|
-
)),
|
|
147
|
-
/* @__PURE__ */ e.jsx("div", { ref: f })
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ e.jsx(
|
|
152
|
-
"div",
|
|
153
|
-
{
|
|
154
|
-
className: `cw-p-4 cw-border-t ${i === "dark" ? "cw-border-gray-600 cw-bg-gray-800" : "cw-border-gray-200"}`,
|
|
155
|
-
children: /* @__PURE__ */ e.jsxs("div", { className: "cw-flex cw-space-x-2 ", children: [
|
|
156
|
-
/* @__PURE__ */ e.jsx(
|
|
157
|
-
"input",
|
|
158
|
-
{
|
|
159
|
-
ref: b,
|
|
160
|
-
type: "text",
|
|
161
|
-
value: l,
|
|
162
|
-
onChange: (t) => y(t.target.value),
|
|
163
|
-
onKeyDown: M,
|
|
164
|
-
placeholder: r,
|
|
165
|
-
className: ` cw-w-full cw-flex-1 cw-px-3 cw-py-2 cw-border cw-rounded-md cw-text-sm cw-focus:outline-none cw-focus:ring-2 cw-focus:ring-primary-500 ${i === "dark" ? "cw-bg-gray-700 cw-border-gray-600 cw-text-white cw-placeholder-gray-400" : "cw-bg-white cw-border-gray-300"}`
|
|
166
|
-
}
|
|
167
|
-
),
|
|
168
|
-
/* @__PURE__ */ e.jsx(
|
|
169
|
-
"button",
|
|
170
|
-
{
|
|
171
|
-
onClick: v,
|
|
172
|
-
disabled: !l.trim(),
|
|
173
|
-
className: "cw-bg-primary-500 cw-text-white cw-px-4 cw-py-2 cw-rounded-md cw-text-sm cw-font-medium cw-hover:bg-primary-600 cw-disabled:opacity-50 cw-disabled:cursor-not-allowed cw-transition-colors",
|
|
174
|
-
children: "Send"
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
] })
|
|
178
|
-
}
|
|
179
|
-
)
|
|
180
|
-
] })
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
typeof window < "u" && (window.ChatWidget = {
|
|
186
|
-
ChatWidget: P,
|
|
187
|
-
Message: I
|
|
188
|
-
});
|
|
189
|
-
export {
|
|
190
|
-
P as ChatWidget,
|
|
191
|
-
I as Message,
|
|
192
|
-
P as default
|
|
193
|
-
};
|
package/dist/chat-widget.umd.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
(function(i,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],o):(i=typeof globalThis<"u"?globalThis:i||self,o(i.ChatWidget={},i.React))})(this,function(i,o){"use strict";var b={exports:{}},m={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var R=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function v(a,r,s){var c=null;if(s!==void 0&&(c=""+s),r.key!==void 0&&(c=""+r.key),"key"in r){s={};for(var l in r)l!=="key"&&(s[l]=r[l])}else s=r;return r=s.ref,{$$typeof:R,type:a,key:c,ref:r!==void 0?r:null,props:s}}m.Fragment=C,m.jsx=v,m.jsxs=v,b.exports=m;var e=b.exports;const x=({message:a,botName:r,userName:s})=>{const c=a.sender==="bot",l=g=>g.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.jsx("div",{className:`cw-flex cw-mb-4 message-animation ${c?"cw-justify-start":"cw-justify-end"}`,children:e.jsxs("div",{className:`cw-max-w-xs cw-lg:max-w-md cw-px-4 cw-py-2 cw-rounded-lg cw-break-words ${c?"cw-bg-gray-200 cw-text-gray-800":"cw-bg-primary-500 cw-text-white"}`,children:[e.jsxs("div",{className:"cw-flex cw-items-center cw-mb-1",children:[e.jsx("span",{className:"cw-text-xs cw-font-semibold",children:c?r:s}),e.jsx("span",{className:"cw-text-xs cw-opacity-70 cw-ml-2",children:l(a.timestamp)})]}),e.jsx("div",{className:"cw-text-sm",children:a.text})]})})},p=({title:a="Chat Support",placeholder:r="Type your message...",onSendMessage:s,messages:c=[],className:l="",botName:g="Support Bot",userName:E="You",height:S="400px",width:$="350px",position:y="inline",theme:d="light"})=>{const[M,j]=o.useState([]),[w,k]=o.useState(""),[h,W]=o.useState(!1),T=o.useRef(null),N=o.useRef(null),f=c.length>0?c:M,_=t=>{const u=["Thanks for your message! How can I help you today?","I understand your concern. Let me assist you with that.","That's a great question! Here's what I can tell you...","I'm here to help! Can you provide more details?","Thank you for reaching out. I'll do my best to assist you."],n=t.toLowerCase();return n.includes("hello")||n.includes("hi")?"Hello! Welcome to our support chat. How can I help you today?":n.includes("help")?"I'm here to help! What do you need assistance with?":n.includes("price")||n.includes("cost")?"I can help you with pricing information. What specific product or service are you interested in?":u[Math.floor(Math.random()*u.length)]||"I'm here to help!"},D=()=>{var t;(t=T.current)==null||t.scrollIntoView({behavior:"smooth"})};o.useEffect(()=>{D()},[f]);const I=()=>{var u;if(!w.trim())return;const t={id:Date.now().toString(),text:w.trim(),sender:"user",timestamp:new Date};c.length>0?s==null||s(w.trim()):(j(n=>[...n,t]),setTimeout(()=>{const n={id:(Date.now()+1).toString(),text:_(w.trim()),sender:"bot",timestamp:new Date};j(A=>[...A,n])},1e3)),k(""),(u=N.current)==null||u.focus()},H=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),I())},P={height:h?"auto":S,width:$,...y!=="inline"&&{position:"fixed",bottom:"20px",[y==="bottom-right"?"right":"left"]:"20px",zIndex:1e3}};return e.jsxs("div",{className:`chat-widget-container cw-bg-white cw-border cw-border-gray-300 cw-rounded-lg cw-shadow-lg cw-flex cw-flex-col ${d==="dark"?"cw-bg-gray-800 cw-border-gray-600":""} ${l}`,style:P,children:[e.jsxs("div",{className:`cw-flex cw-items-center cw-justify-between cw-p-4 cw-border-b cw-bg-primary-500 cw-text-white cw-rounded-t-lg ${d==="dark"?"cw-border-gray-600":"cw-border-gray-200"}`,children:[e.jsx("h3",{className:"cw-font-semibold cw-text-sm",children:a}),y!=="inline"&&e.jsx("button",{onClick:()=>W(!h),className:"cw-text-white cw-hover:bg-primary-600 cw-rounded cw-p-1 cw-transition-colors",children:h?"▲":"▼"})]}),!h&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`cw-flex-1 cw-overflow-y-auto cw-p-4 chat-messages ${d==="dark"?"cw-bg-gray-700":"cw-bg-gray-50"}`,style:{maxHeight:"calc(100% - 120px)"},children:[f.length===0&&e.jsx("div",{className:`cw-text-center cw-text-gray-500 cw-text-sm cw-mt-8 ${d==="dark"?"cw-text-gray-400":""}`,children:"Start a conversation by typing a message below."}),f.map(t=>e.jsx(x,{message:t,botName:g,userName:E},t.id)),e.jsx("div",{ref:T})]}),e.jsx("div",{className:`cw-p-4 cw-border-t ${d==="dark"?"cw-border-gray-600 cw-bg-gray-800":"cw-border-gray-200"}`,children:e.jsxs("div",{className:"cw-flex cw-space-x-2 ",children:[e.jsx("input",{ref:N,type:"text",value:w,onChange:t=>k(t.target.value),onKeyDown:H,placeholder:r,className:` cw-w-full cw-flex-1 cw-px-3 cw-py-2 cw-border cw-rounded-md cw-text-sm cw-focus:outline-none cw-focus:ring-2 cw-focus:ring-primary-500 ${d==="dark"?"cw-bg-gray-700 cw-border-gray-600 cw-text-white cw-placeholder-gray-400":"cw-bg-white cw-border-gray-300"}`}),e.jsx("button",{onClick:I,disabled:!w.trim(),className:"cw-bg-primary-500 cw-text-white cw-px-4 cw-py-2 cw-rounded-md cw-text-sm cw-font-medium cw-hover:bg-primary-600 cw-disabled:opacity-50 cw-disabled:cursor-not-allowed cw-transition-colors",children:"Send"})]})})]})]})};typeof window<"u"&&(window.ChatWidget={ChatWidget:p,Message:x}),i.ChatWidget=p,i.Message=x,i.default=p,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|