interview-widget 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/APIUsageExample.d.ts +5 -0
- package/dist/hooks/useAPI.d.ts +12 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/interview-api.d.ts +47 -0
- package/dist/types.d.ts +29 -0
- package/dist/utils/api-error-classifier.d.ts +2 -0
- package/dist/utils/resilient-fetch.d.ts +9 -0
- package/dist/widget.css +1 -1
- package/dist/widget.es.js +524 -222
- package/dist/widget.umd.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { APIError, APIHookState } from '../types';
|
|
2
|
+
type UseAPIOptions<T> = {
|
|
3
|
+
immediate?: boolean;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
onError?: (error: APIError) => void;
|
|
6
|
+
onSuccess?: (data: T) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function useAPI<T>(apiCall: () => Promise<T>, options?: UseAPIOptions<T>): APIHookState<T> & {
|
|
9
|
+
execute: () => Promise<void>;
|
|
10
|
+
retry: () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { InterviewQuestion, InterviewAnswer, InterviewSession, InterviewResult } from '../types';
|
|
2
|
+
declare class InterviewAPI {
|
|
3
|
+
private baseURL;
|
|
4
|
+
private authToken;
|
|
5
|
+
constructor(baseURL?: string, authToken?: string);
|
|
6
|
+
/**
|
|
7
|
+
* Set authentication token for API requests
|
|
8
|
+
*/
|
|
9
|
+
setAuthToken(token: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Get default headers for API requests
|
|
12
|
+
*/
|
|
13
|
+
private getHeaders;
|
|
14
|
+
/**
|
|
15
|
+
* Start a new interview session
|
|
16
|
+
*/
|
|
17
|
+
startInterview(candidateId: string): Promise<InterviewSession>;
|
|
18
|
+
/**
|
|
19
|
+
* Get questions for an interview
|
|
20
|
+
*/
|
|
21
|
+
getQuestions(interviewId: string): Promise<InterviewQuestion[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Submit an answer for a question
|
|
24
|
+
*/
|
|
25
|
+
submitAnswer(answer: InterviewAnswer): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Complete an interview session
|
|
28
|
+
*/
|
|
29
|
+
completeInterview(sessionId: string): Promise<InterviewResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Get interview statistics
|
|
32
|
+
*/
|
|
33
|
+
getInterviewStats(): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Get interview session details
|
|
36
|
+
*/
|
|
37
|
+
getInterviewSession(sessionId: string): Promise<InterviewSession>;
|
|
38
|
+
/**
|
|
39
|
+
* Get Products
|
|
40
|
+
* Fake API example
|
|
41
|
+
* This API endpoint retrieves a list of products from the fake store API.
|
|
42
|
+
*/
|
|
43
|
+
getProducts(): Promise<any>;
|
|
44
|
+
deleteProduct(productId: number): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export declare const interviewAPI: InterviewAPI;
|
|
47
|
+
export { InterviewAPI };
|
package/dist/types.d.ts
CHANGED
|
@@ -18,3 +18,32 @@ export interface InterviewWidgetProps {
|
|
|
18
18
|
onAnswerSubmit?: (answer: InterviewAnswer) => void;
|
|
19
19
|
className?: string;
|
|
20
20
|
}
|
|
21
|
+
export type APIErrorType = "network" | "timeout" | "server" | "client" | "auth" | "rate-limit" | "unknown";
|
|
22
|
+
export interface APIError {
|
|
23
|
+
type: APIErrorType;
|
|
24
|
+
status?: number;
|
|
25
|
+
message: string;
|
|
26
|
+
retryable: boolean;
|
|
27
|
+
userMessage: string;
|
|
28
|
+
originalError?: Error;
|
|
29
|
+
}
|
|
30
|
+
export interface APIHookState<T> {
|
|
31
|
+
data: T | null;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
error: APIError | null;
|
|
34
|
+
}
|
|
35
|
+
export interface InterviewSession {
|
|
36
|
+
id: string;
|
|
37
|
+
candidateId: string;
|
|
38
|
+
status: "active" | "completed" | "paused";
|
|
39
|
+
currentQuestionIndex: number;
|
|
40
|
+
startedAt: Date;
|
|
41
|
+
completedAt?: Date;
|
|
42
|
+
}
|
|
43
|
+
export interface InterviewResult {
|
|
44
|
+
sessionId: string;
|
|
45
|
+
totalQuestions: number;
|
|
46
|
+
completedQuestions: number;
|
|
47
|
+
score?: number;
|
|
48
|
+
feedback?: string;
|
|
49
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface RetryConfig {
|
|
2
|
+
attempts: number;
|
|
3
|
+
backoff: "fixed" | "exponential";
|
|
4
|
+
baseDelay: number;
|
|
5
|
+
maxDelay: number;
|
|
6
|
+
jitter: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function resilientFetch(url: string, options?: RequestInit, retryConfig?: RetryConfig): Promise<Response>;
|
|
9
|
+
export {};
|
package/dist/widget.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.interview-widget-container .iw-fixed{position:fixed}.interview-widget-container .iw-relative{position:relative}.interview-widget-container .iw-inset-0{top:0;right:0;bottom:0;left:0}.interview-widget-container .iw-z-50{z-index:50}.interview-widget-container .iw-mx-4{margin-left:1rem;margin-right:1rem}.interview-widget-container .iw-mx-auto{margin-left:auto;margin-right:auto}.interview-widget-container .iw-mb-1{margin-bottom:.25rem}.interview-widget-container .iw-mb-2{margin-bottom:.5rem}.interview-widget-container .iw-mb-3{margin-bottom:.75rem}.interview-widget-container .iw-mb-4{margin-bottom:1rem}.interview-widget-container .iw-mr-2{margin-right:.5rem}.interview-widget-container .iw-mt-1{margin-top:.25rem}.interview-widget-container .iw-mt-2{margin-top:.5rem}.interview-widget-container .iw-mt-3{margin-top:.75rem}.interview-widget-container .iw-mt-4{margin-top:1rem}.interview-widget-container .iw-mt-auto{margin-top:auto}.interview-widget-container .iw-block{display:block}.interview-widget-container .iw-flex{display:flex}.interview-widget-container .iw-inline-flex{display:inline-flex}.interview-widget-container .iw-grid{display:grid}.interview-widget-container .iw-h-12{height:3rem}.interview-widget-container .iw-h-4{height:1rem}.interview-widget-container .iw-h-64{height:16rem}.interview-widget-container .iw-h-7{height:1.75rem}.interview-widget-container .iw-h-\[400px\]{height:400px}.interview-widget-container .iw-h-\[calc\(100vh-1rem\)\]{height:calc(100vh - 1rem)}.interview-widget-container .iw-h-full{height:100%}.interview-widget-container .iw-h-px{height:1px}.interview-widget-container .iw-h-screen{height:100vh}.interview-widget-container .iw-min-h-\[112px\]{min-height:112px}.interview-widget-container .iw-w-12{width:3rem}.interview-widget-container .iw-w-4{width:1rem}.interview-widget-container .iw-w-7{width:1.75rem}.interview-widget-container .iw-w-full{width:100%}.interview-widget-container .iw-w-screen{width:100vw}.interview-widget-container .iw-max-w-3xl{max-width:48rem}.interview-widget-container .iw-flex-1{flex:1 1 0%}.interview-widget-container .iw-flex-grow{flex-grow:1}@keyframes iw-spin{to{transform:rotate(360deg)}}.interview-widget-container .iw-animate-spin{animation:iw-spin 1s linear infinite}.interview-widget-container .iw-cursor-pointer{cursor:pointer}.interview-widget-container .iw-resize-none{resize:none}.interview-widget-container .iw-list-disc{list-style-type:disc}.interview-widget-container .iw-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.interview-widget-container .iw-flex-col{flex-direction:column}.interview-widget-container .iw-items-center{align-items:center}.interview-widget-container .iw-justify-center{justify-content:center}.interview-widget-container .iw-justify-between{justify-content:space-between}.interview-widget-container .iw-gap-2{gap:.5rem}.interview-widget-container .iw-gap-3{gap:.75rem}.interview-widget-container .iw-gap-4{gap:1rem}.interview-widget-container :is(.iw-space-x-2>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.interview-widget-container :is(.iw-space-x-3>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.interview-widget-container :is(.iw-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.interview-widget-container .iw-overflow-hidden{overflow:hidden}.interview-widget-container .iw-rounded{border-radius:.25rem}.interview-widget-container .iw-rounded-lg{border-radius:.5rem}.interview-widget-container .iw-rounded-md{border-radius:.375rem}.interview-widget-container .iw-rounded-none{border-radius:0}.interview-widget-container .iw-rounded-xl{border-radius:.75rem}.interview-widget-container .iw-border{border-width:1px}.interview-widget-container .iw-border-b{border-bottom-width:1px}.interview-widget-container .iw-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-indigo-100{--tw-border-opacity: 1;border-color:rgb(224 231 255 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-primary-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-transparent{border-color:transparent}.interview-widget-container .\!iw-bg-orange-200{--tw-bg-opacity: 1 !important;background-color:rgb(254 215 170 / var(--tw-bg-opacity, 1))!important}.interview-widget-container .iw-bg-black\/50{background-color:#00000080}.interview-widget-container .iw-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-primary-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-primary-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-transparent{background-color:transparent}.interview-widget-container .iw-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-object-cover{-o-object-fit:cover;object-fit:cover}.interview-widget-container .iw-p-2{padding:.5rem}.interview-widget-container .iw-p-4{padding:1rem}.interview-widget-container .iw-p-5{padding:1.25rem}.interview-widget-container .iw-px-3{padding-left:.75rem;padding-right:.75rem}.interview-widget-container .iw-px-4{padding-left:1rem;padding-right:1rem}.interview-widget-container .iw-px-5{padding-left:1.25rem;padding-right:1.25rem}.interview-widget-container .iw-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.interview-widget-container .iw-py-2{padding-top:.5rem;padding-bottom:.5rem}.interview-widget-container .iw-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.interview-widget-container .iw-py-3{padding-top:.75rem;padding-bottom:.75rem}.interview-widget-container .iw-py-4{padding-top:1rem;padding-bottom:1rem}.interview-widget-container .iw-py-5{padding-top:1.25rem;padding-bottom:1.25rem}.interview-widget-container .iw-pl-4{padding-left:1rem}.interview-widget-container .iw-pt-2{padding-top:.5rem}.interview-widget-container .iw-text-center{text-align:center}.interview-widget-container .iw-text-\[15px\]{font-size:15px}.interview-widget-container .iw-text-base{font-size:1rem;line-height:1.5rem}.interview-widget-container .iw-text-sm{font-size:.875rem;line-height:1.25rem}.interview-widget-container .iw-text-xl{font-size:1.25rem;line-height:1.75rem}.interview-widget-container .iw-text-xs{font-size:.75rem;line-height:1rem}.interview-widget-container .iw-font-bold{font-weight:700}.interview-widget-container .iw-font-medium{font-weight:500}.interview-widget-container .iw-font-semibold{font-weight:600}.interview-widget-container .iw-leading-6{line-height:1.5rem}.interview-widget-container .iw-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-primary-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-primary-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-opacity-25{opacity:.25}.interview-widget-container .iw-opacity-75{opacity:.75}.interview-widget-container .iw-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-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);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)}.interview-widget-container .iw-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.interview-widget-container .iw-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.interview-widget-container{font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;--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;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: transparent var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container *,.interview-widget-container *:before,.interview-widget-container *:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb;--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: }.interview-widget-container *:before,.interview-widget-container *:after{--tw-content: ""}.interview-widget-container h1,.interview-widget-container h2,.interview-widget-container h3,.interview-widget-container h4,.interview-widget-container h5,.interview-widget-container h6{font-size:inherit;font-weight:inherit}.interview-widget-container a{color:inherit;text-decoration:inherit}.interview-widget-container b,.interview-widget-container strong{font-weight:bolder}.interview-widget-container code,.interview-widget-container kbd,.interview-widget-container samp,.interview-widget-container 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}.interview-widget-container small{font-size:80%}.interview-widget-container button,.interview-widget-container input,.interview-widget-container optgroup,.interview-widget-container select,.interview-widget-container 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}.interview-widget-container button,.interview-widget-container select{text-transform:none}.interview-widget-container button,.interview-widget-container [type=button],.interview-widget-container [type=reset],.interview-widget-container [type=submit]{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:transparent;background-image:none}.interview-widget-container button,.interview-widget-container [role=button]{cursor:pointer}.interview-widget-container :disabled{cursor:default}.interview-widget-container img,.interview-widget-container svg,.interview-widget-container video,.interview-widget-container canvas,.interview-widget-container audio,.interview-widget-container iframe,.interview-widget-container embed,.interview-widget-container object{display:block}.interview-widget-container img,.interview-widget-container video{max-width:100%;height:auto}.interview-widget-container [hidden]{display:none}.interview-widget-container blockquote,.interview-widget-container dl,.interview-widget-container dd,.interview-widget-container h1,.interview-widget-container h2,.interview-widget-container h3,.interview-widget-container h4,.interview-widget-container h5,.interview-widget-container h6,.interview-widget-container hr,.interview-widget-container figure,.interview-widget-container p,.interview-widget-container pre{margin:0}.interview-widget-container fieldset{margin:0;padding:0}.interview-widget-container legend{padding:0}.interview-widget-container ol,.interview-widget-container ul,.interview-widget-container menu{list-style:none;margin:0;padding:0}.interview-widget-container dialog{padding:0}.interview-widget-container textarea{resize:vertical}.interview-widget-container input::placeholder,.interview-widget-container textarea::placeholder{opacity:1;color:#9ca3af}.interview-widget-container input::-moz-placeholder,.interview-widget-container textarea::-moz-placeholder{opacity:1;color:#9ca3af}.interview-widget-container .iw-bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.interview-widget-container .iw-bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.interview-widget-container .iw-from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container .iw-from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container .iw-to-white{--tw-gradient-to: #fff var(--tw-gradient-to-position)}.interview-widget-container .iw-to-indigo-500{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.interview-widget-container .iw-to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.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}.interview-widget-container .hover\:iw-from-purple-600:hover{--tw-gradient-from: #9333ea var(--tw-gradient-from-position);--tw-gradient-to: rgb(147 51 234 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container .hover\:iw-to-indigo-600:hover{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.interview-widget-container .hover\:iw-text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}
|
|
1
|
+
.interview-widget-container .iw-fixed{position:fixed}.interview-widget-container .iw-relative{position:relative}.interview-widget-container .iw-inset-0{top:0;right:0;bottom:0;left:0}.interview-widget-container .iw-z-50{z-index:50}.interview-widget-container .iw-mx-4{margin-left:1rem;margin-right:1rem}.interview-widget-container .iw-mx-auto{margin-left:auto;margin-right:auto}.interview-widget-container .iw-mb-1{margin-bottom:.25rem}.interview-widget-container .iw-mb-2{margin-bottom:.5rem}.interview-widget-container .iw-mb-3{margin-bottom:.75rem}.interview-widget-container .iw-mb-4{margin-bottom:1rem}.interview-widget-container .iw-mr-2{margin-right:.5rem}.interview-widget-container .iw-mt-1{margin-top:.25rem}.interview-widget-container .iw-mt-2{margin-top:.5rem}.interview-widget-container .iw-mt-4{margin-top:1rem}.interview-widget-container .iw-mt-auto{margin-top:auto}.interview-widget-container .iw-block{display:block}.interview-widget-container .iw-flex{display:flex}.interview-widget-container .iw-inline-flex{display:inline-flex}.interview-widget-container .iw-grid{display:grid}.interview-widget-container .iw-h-12{height:3rem}.interview-widget-container .iw-h-4{height:1rem}.interview-widget-container .iw-h-64{height:16rem}.interview-widget-container .iw-h-7{height:1.75rem}.interview-widget-container .iw-h-\[400px\]{height:400px}.interview-widget-container .iw-h-\[calc\(100vh-1rem\)\]{height:calc(100vh - 1rem)}.interview-widget-container .iw-h-full{height:100%}.interview-widget-container .iw-h-px{height:1px}.interview-widget-container .iw-h-screen{height:100vh}.interview-widget-container .iw-min-h-\[112px\]{min-height:112px}.interview-widget-container .iw-w-12{width:3rem}.interview-widget-container .iw-w-4{width:1rem}.interview-widget-container .iw-w-7{width:1.75rem}.interview-widget-container .iw-w-full{width:100%}.interview-widget-container .iw-w-screen{width:100vw}.interview-widget-container .iw-max-w-3xl{max-width:48rem}.interview-widget-container .iw-flex-1{flex:1 1 0%}.interview-widget-container .iw-flex-grow{flex-grow:1}@keyframes iw-spin{to{transform:rotate(360deg)}}.interview-widget-container .iw-animate-spin{animation:iw-spin 1s linear infinite}.interview-widget-container .iw-cursor-pointer{cursor:pointer}.interview-widget-container .iw-resize-none{resize:none}.interview-widget-container .iw-list-disc{list-style-type:disc}.interview-widget-container .iw-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.interview-widget-container .iw-flex-col{flex-direction:column}.interview-widget-container .iw-items-center{align-items:center}.interview-widget-container .iw-justify-center{justify-content:center}.interview-widget-container .iw-justify-between{justify-content:space-between}.interview-widget-container .iw-gap-2{gap:.5rem}.interview-widget-container .iw-gap-3{gap:.75rem}.interview-widget-container .iw-gap-4{gap:1rem}.interview-widget-container :is(.iw-space-x-2>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.interview-widget-container :is(.iw-space-x-3>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.interview-widget-container :is(.iw-space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.interview-widget-container .iw-overflow-hidden{overflow:hidden}.interview-widget-container .iw-rounded-lg{border-radius:.5rem}.interview-widget-container .iw-rounded-md{border-radius:.375rem}.interview-widget-container .iw-rounded-none{border-radius:0}.interview-widget-container .iw-rounded-xl{border-radius:.75rem}.interview-widget-container .iw-border{border-width:1px}.interview-widget-container .iw-border-b{border-bottom-width:1px}.interview-widget-container .iw-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-indigo-100{--tw-border-opacity: 1;border-color:rgb(224 231 255 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-primary-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.interview-widget-container .iw-border-transparent{border-color:transparent}.interview-widget-container .\!iw-bg-orange-200{--tw-bg-opacity: 1 !important;background-color:rgb(254 215 170 / var(--tw-bg-opacity, 1))!important}.interview-widget-container .iw-bg-black\/50{background-color:#00000080}.interview-widget-container .iw-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-primary-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-primary-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-bg-transparent{background-color:transparent}.interview-widget-container .iw-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.interview-widget-container .iw-object-cover{-o-object-fit:cover;object-fit:cover}.interview-widget-container .iw-p-2{padding:.5rem}.interview-widget-container .iw-p-4{padding:1rem}.interview-widget-container .iw-p-5{padding:1.25rem}.interview-widget-container .iw-px-3{padding-left:.75rem;padding-right:.75rem}.interview-widget-container .iw-px-4{padding-left:1rem;padding-right:1rem}.interview-widget-container .iw-px-5{padding-left:1.25rem;padding-right:1.25rem}.interview-widget-container .iw-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.interview-widget-container .iw-py-2{padding-top:.5rem;padding-bottom:.5rem}.interview-widget-container .iw-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.interview-widget-container .iw-py-3{padding-top:.75rem;padding-bottom:.75rem}.interview-widget-container .iw-py-4{padding-top:1rem;padding-bottom:1rem}.interview-widget-container .iw-py-5{padding-top:1.25rem;padding-bottom:1.25rem}.interview-widget-container .iw-pl-4{padding-left:1rem}.interview-widget-container .iw-pl-5{padding-left:1.25rem}.interview-widget-container .iw-pt-2{padding-top:.5rem}.interview-widget-container .iw-text-center{text-align:center}.interview-widget-container .iw-text-\[15px\]{font-size:15px}.interview-widget-container .iw-text-base{font-size:1rem;line-height:1.5rem}.interview-widget-container .iw-text-sm{font-size:.875rem;line-height:1.25rem}.interview-widget-container .iw-text-xl{font-size:1.25rem;line-height:1.75rem}.interview-widget-container .iw-text-xs{font-size:.75rem;line-height:1rem}.interview-widget-container .iw-font-bold{font-weight:700}.interview-widget-container .iw-font-medium{font-weight:500}.interview-widget-container .iw-font-semibold{font-weight:600}.interview-widget-container .iw-leading-6{line-height:1.5rem}.interview-widget-container .iw-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-primary-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-primary-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.interview-widget-container .iw-opacity-25{opacity:.25}.interview-widget-container .iw-opacity-75{opacity:.75}.interview-widget-container .iw-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.interview-widget-container .iw-backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-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);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)}.interview-widget-container .iw-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.interview-widget-container .iw-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.interview-widget-container{font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;--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;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: transparent var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container *,.interview-widget-container *:before,.interview-widget-container *:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb;--tw-content: ""}.interview-widget-container h1,.interview-widget-container h2,.interview-widget-container h3,.interview-widget-container h4,.interview-widget-container h5,.interview-widget-container h6{font-size:inherit;font-weight:inherit}.interview-widget-container a{color:inherit;text-decoration:inherit}.interview-widget-container b,.interview-widget-container strong{font-weight:bolder}.interview-widget-container code,.interview-widget-container kbd,.interview-widget-container samp,.interview-widget-container 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}.interview-widget-container small{font-size:80%}.interview-widget-container button,.interview-widget-container input,.interview-widget-container optgroup,.interview-widget-container select,.interview-widget-container 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}.interview-widget-container button,.interview-widget-container select{text-transform:none}.interview-widget-container button,.interview-widget-container [type=button],.interview-widget-container [type=reset],.interview-widget-container [type=submit]{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:transparent;background-image:none}.interview-widget-container button,.interview-widget-container [role=button]{cursor:pointer}.interview-widget-container :disabled{cursor:default}.interview-widget-container img,.interview-widget-container svg,.interview-widget-container video,.interview-widget-container canvas,.interview-widget-container audio,.interview-widget-container iframe,.interview-widget-container embed,.interview-widget-container object{display:block}.interview-widget-container img,.interview-widget-container video{max-width:100%;height:auto}.interview-widget-container [hidden]{display:none}.interview-widget-container blockquote,.interview-widget-container dl,.interview-widget-container dd,.interview-widget-container h1,.interview-widget-container h2,.interview-widget-container h3,.interview-widget-container h4,.interview-widget-container h5,.interview-widget-container h6,.interview-widget-container hr,.interview-widget-container figure,.interview-widget-container p,.interview-widget-container pre{margin:0}.interview-widget-container ol,.interview-widget-container ul,.interview-widget-container menu{list-style:none;margin:0;padding:0}.interview-widget-container dialog{padding:0}.interview-widget-container textarea{resize:vertical}.interview-widget-container input::placeholder,.interview-widget-container textarea::placeholder{opacity:1;color:#9ca3af}.interview-widget-container input::-moz-placeholder,.interview-widget-container textarea::-moz-placeholder{opacity:1;color:#9ca3af}.interview-widget-container .iw-bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.interview-widget-container .iw-bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.interview-widget-container .iw-from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container .iw-from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container .iw-to-white{--tw-gradient-to: #fff var(--tw-gradient-to-position)}.interview-widget-container .iw-to-indigo-500{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.interview-widget-container .iw-to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.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}.interview-widget-container .hover\:iw-from-purple-600:hover{--tw-gradient-from: #9333ea var(--tw-gradient-from-position);--tw-gradient-to: rgb(147 51 234 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.interview-widget-container .hover\:iw-to-indigo-600:hover{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.interview-widget-container .hover\:iw-text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}
|
package/dist/widget.es.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var q = (i, e, s) => e in i ? L(i, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[e] = s;
|
|
3
|
+
var $ = (i, e, s) => q(i, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { useRef as j, useState as m, useEffect as P, useCallback as T, useMemo as H } from "react";
|
|
5
|
+
var M = { exports: {} }, N = {};
|
|
3
6
|
/**
|
|
4
7
|
* @license React
|
|
5
8
|
* react-jsx-runtime.production.js
|
|
@@ -9,56 +12,56 @@ var E = { exports: {} }, y = {};
|
|
|
9
12
|
* This source code is licensed under the MIT license found in the
|
|
10
13
|
* LICENSE file in the root directory of this source tree.
|
|
11
14
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
var
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
for (var
|
|
18
|
-
|
|
19
|
-
} else
|
|
20
|
-
return
|
|
21
|
-
$$typeof:
|
|
22
|
-
type:
|
|
23
|
-
key:
|
|
24
|
-
ref:
|
|
25
|
-
props:
|
|
15
|
+
var G = Symbol.for("react.transitional.element"), z = Symbol.for("react.fragment");
|
|
16
|
+
function I(i, e, s) {
|
|
17
|
+
var n = null;
|
|
18
|
+
if (s !== void 0 && (n = "" + s), e.key !== void 0 && (n = "" + e.key), "key" in e) {
|
|
19
|
+
s = {};
|
|
20
|
+
for (var r in e)
|
|
21
|
+
r !== "key" && (s[r] = e[r]);
|
|
22
|
+
} else s = e;
|
|
23
|
+
return e = s.ref, {
|
|
24
|
+
$$typeof: G,
|
|
25
|
+
type: i,
|
|
26
|
+
key: n,
|
|
27
|
+
ref: e !== void 0 ? e : null,
|
|
28
|
+
props: s
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
const
|
|
34
|
-
children:
|
|
35
|
-
variant:
|
|
36
|
-
size:
|
|
37
|
-
fullWidth:
|
|
38
|
-
isLoading:
|
|
39
|
-
disabled:
|
|
40
|
-
className:
|
|
41
|
-
...
|
|
31
|
+
N.Fragment = z;
|
|
32
|
+
N.jsx = I;
|
|
33
|
+
N.jsxs = I;
|
|
34
|
+
M.exports = N;
|
|
35
|
+
var t = M.exports;
|
|
36
|
+
const E = ({
|
|
37
|
+
children: i,
|
|
38
|
+
variant: e = "primary",
|
|
39
|
+
size: s = "md",
|
|
40
|
+
fullWidth: n = !1,
|
|
41
|
+
isLoading: r = !1,
|
|
42
|
+
disabled: a,
|
|
43
|
+
className: o = "",
|
|
44
|
+
...l
|
|
42
45
|
}) => {
|
|
43
|
-
const
|
|
46
|
+
const w = "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", d = {
|
|
44
47
|
primary: "iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",
|
|
45
48
|
secondary: "iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",
|
|
46
49
|
outline: "iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",
|
|
47
50
|
text: "iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",
|
|
48
51
|
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
|
-
},
|
|
52
|
+
}, u = {
|
|
50
53
|
sm: "iw-px-3 iw-py-1.5 iw-text-sm",
|
|
51
54
|
md: "iw-px-4 iw-py-2 iw-text-sm",
|
|
52
55
|
lg: "iw-px-5 iw-py-2.5 iw-text-base"
|
|
53
|
-
},
|
|
54
|
-
return /* @__PURE__ */
|
|
56
|
+
}, h = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", f = n ? "iw-w-full" : "";
|
|
57
|
+
return /* @__PURE__ */ t.jsxs(
|
|
55
58
|
"button",
|
|
56
59
|
{
|
|
57
|
-
className: `${
|
|
58
|
-
disabled:
|
|
59
|
-
...
|
|
60
|
+
className: `${w} ${d[e]} ${u[s]} ${f} ${h} ${o}`,
|
|
61
|
+
disabled: a || r,
|
|
62
|
+
...l,
|
|
60
63
|
children: [
|
|
61
|
-
|
|
64
|
+
r && /* @__PURE__ */ t.jsxs(
|
|
62
65
|
"svg",
|
|
63
66
|
{
|
|
64
67
|
className: "iw-animate-spin iw-mr-2 iw-h-4 iw-w-4 iw-text-white",
|
|
@@ -66,7 +69,7 @@ const k = ({
|
|
|
66
69
|
fill: "none",
|
|
67
70
|
viewBox: "0 0 24 24",
|
|
68
71
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ t.jsx(
|
|
70
73
|
"circle",
|
|
71
74
|
{
|
|
72
75
|
className: "iw-opacity-25",
|
|
@@ -77,7 +80,7 @@ const k = ({
|
|
|
77
80
|
strokeWidth: "4"
|
|
78
81
|
}
|
|
79
82
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ t.jsx(
|
|
81
84
|
"path",
|
|
82
85
|
{
|
|
83
86
|
className: "iw-opacity-75",
|
|
@@ -88,250 +91,549 @@ const k = ({
|
|
|
88
91
|
]
|
|
89
92
|
}
|
|
90
93
|
),
|
|
91
|
-
|
|
94
|
+
i
|
|
92
95
|
]
|
|
93
96
|
}
|
|
94
97
|
);
|
|
95
|
-
},
|
|
96
|
-
isOpen:
|
|
97
|
-
onStart:
|
|
98
|
-
onClose:
|
|
98
|
+
}, O = ({
|
|
99
|
+
isOpen: i,
|
|
100
|
+
onStart: e,
|
|
101
|
+
onClose: s
|
|
99
102
|
}) => {
|
|
100
|
-
var
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
+
var y;
|
|
104
|
+
const n = j(null), r = j(null), [a, o] = m(!1), [l, w] = m(null), [d, u] = m(!1), h = () => {
|
|
105
|
+
r.current && (r.current.getTracks().forEach((c) => c.stop()), r.current = null);
|
|
103
106
|
}, f = async () => {
|
|
104
|
-
|
|
107
|
+
u(!0), w(null);
|
|
105
108
|
try {
|
|
106
|
-
const
|
|
109
|
+
const c = await navigator.mediaDevices.getUserMedia({
|
|
107
110
|
video: { width: { ideal: 1280 }, height: { ideal: 720 } },
|
|
108
111
|
audio: !0
|
|
109
112
|
});
|
|
110
|
-
|
|
111
|
-
} catch (
|
|
112
|
-
console.error("Media permission error:",
|
|
113
|
-
let
|
|
114
|
-
(
|
|
113
|
+
r.current = c, n.current && (n.current.srcObject = c), o(!0);
|
|
114
|
+
} catch (c) {
|
|
115
|
+
console.error("Media permission error:", c);
|
|
116
|
+
let g = "Unable to access camera or microphone.";
|
|
117
|
+
(c == null ? void 0 : c.name) === "NotAllowedError" ? g = "Permissions denied. Please allow access to camera and microphone." : (c == null ? void 0 : c.name) === "NotFoundError" ? g = "No camera/microphone found. Please connect a device and retry." : c != null && c.message && (g = c.message), o(!1), w(g);
|
|
115
118
|
} finally {
|
|
116
|
-
|
|
119
|
+
u(!1);
|
|
117
120
|
}
|
|
118
121
|
};
|
|
119
|
-
if (
|
|
120
|
-
if (!
|
|
121
|
-
|
|
122
|
+
if (P(() => {
|
|
123
|
+
if (!i) {
|
|
124
|
+
h();
|
|
122
125
|
return;
|
|
123
126
|
}
|
|
124
127
|
return f(), () => {
|
|
125
|
-
|
|
128
|
+
h();
|
|
126
129
|
};
|
|
127
|
-
}, [
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
+
}, [i]), !i) return null;
|
|
131
|
+
const k = () => {
|
|
132
|
+
e(), h();
|
|
130
133
|
};
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
134
|
+
return /* @__PURE__ */ t.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__ */ t.jsxs("div", { className: "iw-bg-white iw-rounded-xl iw-shadow-2xl iw-w-full iw-max-w-3xl iw-mx-4", children: [
|
|
135
|
+
/* @__PURE__ */ t.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: [
|
|
136
|
+
/* @__PURE__ */ t.jsx("h2", { className: "iw-text-base iw-font-semibold", children: "Camera & Microphone Check" }),
|
|
137
|
+
s && /* @__PURE__ */ t.jsx(
|
|
135
138
|
"button",
|
|
136
139
|
{
|
|
137
140
|
"aria-label": "Close",
|
|
138
141
|
className: "iw-text-gray-500 hover:iw-text-gray-700",
|
|
139
142
|
onClick: () => {
|
|
140
|
-
|
|
143
|
+
h(), s == null || s();
|
|
141
144
|
},
|
|
142
145
|
children: "✕"
|
|
143
146
|
}
|
|
144
147
|
)
|
|
145
148
|
] }),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-p-4 iw-grid iw-grid-cols-2 iw-gap-4", children: [
|
|
150
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-border iw-border-gray-200 iw-rounded-lg iw-overflow-hidden iw-bg-gray-900", children: /* @__PURE__ */ t.jsx(
|
|
148
151
|
"video",
|
|
149
152
|
{
|
|
150
|
-
ref:
|
|
153
|
+
ref: n,
|
|
151
154
|
autoPlay: !0,
|
|
152
155
|
playsInline: !0,
|
|
153
156
|
muted: !0,
|
|
154
157
|
className: "iw-w-full iw-h-64 iw-object-cover"
|
|
155
158
|
}
|
|
156
159
|
) }),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
!((
|
|
160
|
-
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
|
|
160
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-3", children: [
|
|
161
|
+
/* @__PURE__ */ t.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." }),
|
|
162
|
+
!((y = navigator.mediaDevices) != null && y.getUserMedia) && /* @__PURE__ */ t.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." }),
|
|
163
|
+
l && /* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-red-600", children: l }),
|
|
164
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-2", children: [
|
|
165
|
+
/* @__PURE__ */ t.jsx(
|
|
166
|
+
E,
|
|
164
167
|
{
|
|
165
168
|
onClick: f,
|
|
166
|
-
isLoading:
|
|
169
|
+
isLoading: d,
|
|
167
170
|
variant: "outline",
|
|
168
171
|
size: "sm",
|
|
169
|
-
children:
|
|
172
|
+
children: a ? "Recheck Permissions" : "Enable Camera & Mic"
|
|
170
173
|
}
|
|
171
174
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
|
|
175
|
+
/* @__PURE__ */ t.jsx(
|
|
176
|
+
E,
|
|
174
177
|
{
|
|
175
|
-
onClick:
|
|
176
|
-
disabled: !
|
|
178
|
+
onClick: k,
|
|
179
|
+
disabled: !a,
|
|
177
180
|
size: "sm",
|
|
178
181
|
children: "Start Interview"
|
|
179
182
|
}
|
|
180
183
|
)
|
|
181
184
|
] }),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ t.jsxs("ul", { className: "iw-text-xs iw-text-gray-500 iw-pt-2 iw-list-disc iw-pl-4", children: [
|
|
186
|
+
/* @__PURE__ */ t.jsx("li", { children: "Your preview is muted to avoid echo." }),
|
|
187
|
+
/* @__PURE__ */ t.jsx("li", { children: "You can change devices from your browser’s site settings." })
|
|
185
188
|
] })
|
|
186
189
|
] })
|
|
187
190
|
] })
|
|
188
191
|
] }) });
|
|
189
|
-
},
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
192
|
+
}, Q = ({ title: i }) => /* @__PURE__ */ t.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
|
|
193
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3", children: [
|
|
194
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
|
|
195
|
+
/* @__PURE__ */ t.jsx(
|
|
193
196
|
"div",
|
|
194
197
|
{
|
|
195
198
|
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",
|
|
196
199
|
children: "N"
|
|
197
200
|
}
|
|
198
201
|
),
|
|
199
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ t.jsx("p", { className: "iw-text-sm iw-font-medium", children: "Novara" })
|
|
200
203
|
] }),
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ t.jsx("h1", { className: "iw-text-base iw-font-medium", children: i }),
|
|
205
|
+
/* @__PURE__ */ t.jsx("button", { className: "iw-text-sm iw-text-gray-500 hover:iw-text-gray-700", children: "Exit Interview" })
|
|
203
206
|
] }),
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
] })
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
207
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-h-px iw-bg-gray-200" })
|
|
208
|
+
] });
|
|
209
|
+
function Y(i, e = {
|
|
210
|
+
immediate: !0,
|
|
211
|
+
enabled: !0
|
|
212
|
+
}) {
|
|
213
|
+
const [s, n] = m({
|
|
214
|
+
data: null,
|
|
215
|
+
loading: !1,
|
|
216
|
+
error: null
|
|
217
|
+
}), r = T(async () => {
|
|
218
|
+
var o, l;
|
|
219
|
+
if (e.enabled !== !1) {
|
|
220
|
+
n((w) => ({ ...w, loading: !0, error: null }));
|
|
221
|
+
try {
|
|
222
|
+
const w = await i();
|
|
223
|
+
n((d) => ({
|
|
224
|
+
...d,
|
|
225
|
+
data: w,
|
|
226
|
+
loading: !1,
|
|
227
|
+
error: null
|
|
228
|
+
})), (o = e.onSuccess) == null || o.call(e, w);
|
|
229
|
+
} catch (w) {
|
|
230
|
+
const d = w.type ? w : {
|
|
231
|
+
type: "unknown",
|
|
232
|
+
message: w.message || "Unknown error",
|
|
233
|
+
retryable: !0,
|
|
234
|
+
userMessage: "Something went wrong. Please try again.",
|
|
235
|
+
originalError: w
|
|
236
|
+
};
|
|
237
|
+
n((u) => ({
|
|
238
|
+
...u,
|
|
239
|
+
loading: !1,
|
|
240
|
+
error: d
|
|
241
|
+
})), (l = e.onError) == null || l.call(e, d);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}, [i, e]), a = T(() => {
|
|
245
|
+
e.enabled !== !1 && r();
|
|
246
|
+
}, [r, e.enabled]);
|
|
247
|
+
return P(() => {
|
|
248
|
+
(e.immediate && e.enabled !== !1 || e.enabled === !0) && r();
|
|
249
|
+
}, [e.immediate, e.enabled]), {
|
|
250
|
+
...s,
|
|
251
|
+
execute: r,
|
|
252
|
+
retry: a
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function _(i) {
|
|
256
|
+
var e;
|
|
257
|
+
if (!navigator.onLine)
|
|
258
|
+
return {
|
|
259
|
+
type: "network",
|
|
260
|
+
message: "No internet connection",
|
|
261
|
+
retryable: !0,
|
|
262
|
+
userMessage: "Please check your internet connection and try again."
|
|
263
|
+
};
|
|
264
|
+
if (i.name === "AbortError" || (e = i.message) != null && e.includes("timeout"))
|
|
265
|
+
return {
|
|
266
|
+
type: "timeout",
|
|
267
|
+
message: "Request timed out",
|
|
268
|
+
retryable: !0,
|
|
269
|
+
userMessage: "The request is taking longer than expected. Please try again."
|
|
270
|
+
};
|
|
271
|
+
if (i.status) {
|
|
272
|
+
const { status: s } = i;
|
|
273
|
+
if (s === 401 || s === 403)
|
|
274
|
+
return {
|
|
275
|
+
type: "auth",
|
|
276
|
+
status: s,
|
|
277
|
+
message: "Authentication failed",
|
|
278
|
+
retryable: !1,
|
|
279
|
+
userMessage: "Your session has expired. Please refresh the page."
|
|
280
|
+
};
|
|
281
|
+
if (s === 429)
|
|
282
|
+
return {
|
|
283
|
+
type: "rate-limit",
|
|
284
|
+
status: s,
|
|
285
|
+
message: "Too many requests",
|
|
286
|
+
retryable: !0,
|
|
287
|
+
userMessage: "Please wait a moment before trying again."
|
|
288
|
+
};
|
|
289
|
+
if (s >= 500)
|
|
290
|
+
return {
|
|
291
|
+
type: "server",
|
|
292
|
+
status: s,
|
|
293
|
+
message: `Server error: ${s}`,
|
|
294
|
+
retryable: !0,
|
|
295
|
+
userMessage: "Our servers are experiencing issues. Please try again in a few moments."
|
|
296
|
+
};
|
|
297
|
+
if (s >= 400)
|
|
298
|
+
return {
|
|
299
|
+
type: "client",
|
|
300
|
+
status: s,
|
|
301
|
+
message: `Client error: ${s}`,
|
|
302
|
+
retryable: !1,
|
|
303
|
+
userMessage: "There was an issue with your request. Please check your input."
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
type: "unknown",
|
|
308
|
+
message: i.message || "Unknown error occurred",
|
|
309
|
+
retryable: !0,
|
|
310
|
+
userMessage: "Something unexpected happened. Please try again.",
|
|
311
|
+
originalError: i
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
async function x(i, e = {}, s = {
|
|
315
|
+
attempts: 3,
|
|
316
|
+
backoff: "exponential",
|
|
317
|
+
baseDelay: 1e3,
|
|
318
|
+
maxDelay: 1e4,
|
|
319
|
+
jitter: !0
|
|
320
|
+
}) {
|
|
321
|
+
let n;
|
|
322
|
+
for (let r = 1; r <= s.attempts; r++)
|
|
323
|
+
try {
|
|
324
|
+
const a = new AbortController(), o = setTimeout(() => a.abort(), 6e4), l = await fetch(i, {
|
|
325
|
+
...e,
|
|
326
|
+
signal: a.signal
|
|
327
|
+
});
|
|
328
|
+
if (clearTimeout(o), l.status >= 400 && l.status < 500 && l.status !== 429)
|
|
329
|
+
return l;
|
|
330
|
+
if (!l.ok)
|
|
331
|
+
throw new Error(`HTTP ${l.status}: ${l.statusText}`);
|
|
332
|
+
return l;
|
|
333
|
+
} catch (a) {
|
|
334
|
+
n = a;
|
|
335
|
+
const o = _(a);
|
|
336
|
+
if (!o.retryable || r === s.attempts)
|
|
337
|
+
throw o;
|
|
338
|
+
const l = W(r, s);
|
|
339
|
+
console.warn(
|
|
340
|
+
`API request failed (attempt ${r}/${s.attempts}), retrying in ${l}ms:`,
|
|
341
|
+
o.message
|
|
342
|
+
), await new Promise((w) => setTimeout(w, l));
|
|
343
|
+
}
|
|
344
|
+
throw n;
|
|
345
|
+
}
|
|
346
|
+
function W(i, e) {
|
|
347
|
+
let s;
|
|
348
|
+
return e.backoff === "exponential" ? s = e.baseDelay * Math.pow(2, i - 1) : s = e.baseDelay, s = Math.min(s, e.maxDelay), e.jitter && (s = s * (0.5 + Math.random() * 0.5)), Math.round(s);
|
|
349
|
+
}
|
|
350
|
+
class B {
|
|
351
|
+
constructor(e = "/api", s) {
|
|
352
|
+
$(this, "baseURL");
|
|
353
|
+
$(this, "authToken");
|
|
354
|
+
this.baseURL = e, this.authToken = s;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Set authentication token for API requests
|
|
358
|
+
*/
|
|
359
|
+
setAuthToken(e) {
|
|
360
|
+
this.authToken = e;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Get default headers for API requests
|
|
364
|
+
*/
|
|
365
|
+
getHeaders() {
|
|
366
|
+
const e = {
|
|
367
|
+
"Content-Type": "application/json"
|
|
368
|
+
};
|
|
369
|
+
return this.authToken && (e.Authorization = `Bearer ${this.authToken}`), e;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Start a new interview session
|
|
373
|
+
*/
|
|
374
|
+
async startInterview(e) {
|
|
375
|
+
const s = await x(`${this.baseURL}/interviews/start`, {
|
|
376
|
+
method: "POST",
|
|
377
|
+
headers: this.getHeaders(),
|
|
378
|
+
body: JSON.stringify({ candidateId: e })
|
|
379
|
+
});
|
|
380
|
+
if (!s.ok)
|
|
381
|
+
throw new Error(`Failed to start interview: ${s.status}`);
|
|
382
|
+
return s.json();
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Get questions for an interview
|
|
386
|
+
*/
|
|
387
|
+
async getQuestions(e) {
|
|
388
|
+
const s = await x(
|
|
389
|
+
`${this.baseURL}/interviews/${e}/questions`,
|
|
390
|
+
{
|
|
391
|
+
method: "GET",
|
|
392
|
+
headers: this.getHeaders()
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
if (!s.ok)
|
|
396
|
+
throw new Error(`Failed to get questions: ${s.status}`);
|
|
397
|
+
const n = await s.json();
|
|
398
|
+
return n.questions || n;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Submit an answer for a question
|
|
402
|
+
*/
|
|
403
|
+
async submitAnswer(e) {
|
|
404
|
+
const s = await x(`${this.baseURL}/answers`, {
|
|
405
|
+
method: "POST",
|
|
406
|
+
headers: this.getHeaders(),
|
|
407
|
+
body: JSON.stringify(e)
|
|
408
|
+
});
|
|
409
|
+
if (!s.ok)
|
|
410
|
+
throw new Error(`Failed to submit answer: ${s.status}`);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Complete an interview session
|
|
414
|
+
*/
|
|
415
|
+
async completeInterview(e) {
|
|
416
|
+
const s = await x(
|
|
417
|
+
`${this.baseURL}/interviews/${e}/complete`,
|
|
418
|
+
{
|
|
419
|
+
method: "POST",
|
|
420
|
+
headers: this.getHeaders()
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
if (!s.ok)
|
|
424
|
+
throw new Error(`Failed to complete interview: ${s.status}`);
|
|
425
|
+
return s.json();
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Get interview statistics
|
|
429
|
+
*/
|
|
430
|
+
async getInterviewStats() {
|
|
431
|
+
const e = await x(`${this.baseURL}/interviews/stats`, {
|
|
432
|
+
method: "GET",
|
|
433
|
+
headers: this.getHeaders()
|
|
434
|
+
});
|
|
435
|
+
if (!e.ok)
|
|
436
|
+
throw new Error(`Failed to get stats: ${e.status}`);
|
|
437
|
+
return e.json();
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Get interview session details
|
|
441
|
+
*/
|
|
442
|
+
async getInterviewSession(e) {
|
|
443
|
+
const s = await x(
|
|
444
|
+
`${this.baseURL}/interviews/${e}`,
|
|
445
|
+
{
|
|
446
|
+
method: "GET",
|
|
447
|
+
headers: this.getHeaders()
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
if (!s.ok)
|
|
451
|
+
throw new Error(`Failed to get session: ${s.status}`);
|
|
452
|
+
return s.json();
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Get Products
|
|
456
|
+
* Fake API example
|
|
457
|
+
* This API endpoint retrieves a list of products from the fake store API.
|
|
458
|
+
*/
|
|
459
|
+
async getProducts() {
|
|
460
|
+
const e = await x(`${this.baseURL}/products`, {
|
|
461
|
+
method: "GET",
|
|
462
|
+
headers: this.getHeaders()
|
|
463
|
+
});
|
|
464
|
+
if (!e.ok)
|
|
465
|
+
throw new Error(`Failed to get products: ${e.status}`);
|
|
466
|
+
return e.json();
|
|
467
|
+
}
|
|
468
|
+
// Delete product
|
|
469
|
+
async deleteProduct(e) {
|
|
470
|
+
const s = await x(
|
|
471
|
+
`${this.baseURL}/products/${e}`,
|
|
472
|
+
{
|
|
473
|
+
method: "DELETE",
|
|
474
|
+
headers: this.getHeaders()
|
|
475
|
+
}
|
|
476
|
+
);
|
|
477
|
+
if (!s.ok)
|
|
478
|
+
throw new Error(`Failed to delete product: ${s.status}`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
const S = new B("https://fakestoreapi.com"), J = ({ question: i }) => {
|
|
482
|
+
console.log("🚀 ~ question:", i);
|
|
483
|
+
const {
|
|
484
|
+
data: e,
|
|
485
|
+
loading: s,
|
|
486
|
+
retry: n
|
|
487
|
+
} = Y(() => S.getProducts(), {
|
|
488
|
+
immediate: !0,
|
|
489
|
+
onSuccess: (a) => {
|
|
490
|
+
console.log("Products loaded:", a);
|
|
214
491
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
492
|
+
onError: (a) => {
|
|
493
|
+
console.error("Failed to load products:", a.userMessage);
|
|
494
|
+
}
|
|
495
|
+
}), r = async (a) => {
|
|
496
|
+
try {
|
|
497
|
+
await S.deleteProduct(a), console.log(`Product ${a} deleted successfully`), n();
|
|
498
|
+
} catch (o) {
|
|
499
|
+
console.error("Failed to delete product:", o);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
return /* @__PURE__ */ t.jsxs(
|
|
503
|
+
"div",
|
|
504
|
+
{
|
|
505
|
+
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",
|
|
506
|
+
style: {
|
|
507
|
+
// Fallback styles in case CSS classes don't load properly
|
|
508
|
+
background: "linear-gradient(to bottom, #eef2ff, #ffffff)",
|
|
509
|
+
border: "1px solid #e0e7ff",
|
|
510
|
+
color: "#1f2937"
|
|
511
|
+
},
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-3 iw-mb-3", children: [
|
|
514
|
+
/* @__PURE__ */ t.jsx(
|
|
515
|
+
"div",
|
|
516
|
+
{
|
|
517
|
+
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",
|
|
518
|
+
children: "N"
|
|
519
|
+
}
|
|
520
|
+
),
|
|
521
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
522
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-text-sm iw-font-semibold", children: "Novara" }),
|
|
523
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: "Assistant" })
|
|
524
|
+
] })
|
|
525
|
+
] }),
|
|
526
|
+
s ? /* @__PURE__ */ t.jsx("p", { children: "Loading products..." }) : /* @__PURE__ */ t.jsx("ul", { className: "iw-list-disc iw-pl-5 iw-space-y-1", children: e == null ? void 0 : e.slice(0, 10).map((a) => /* @__PURE__ */ t.jsxs(
|
|
527
|
+
"li",
|
|
219
528
|
{
|
|
220
|
-
className: "iw-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)) })
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
), Y = ({ className: r = "" }) => {
|
|
241
|
-
const s = j(null);
|
|
242
|
-
return C(() => {
|
|
243
|
-
let i = null;
|
|
529
|
+
className: "iw-cursor-pointer",
|
|
530
|
+
onClick: () => r(a.id),
|
|
531
|
+
children: [
|
|
532
|
+
/* @__PURE__ */ t.jsx("span", { className: "iw-font-medium", children: a.title }),
|
|
533
|
+
" - $",
|
|
534
|
+
a.price
|
|
535
|
+
]
|
|
536
|
+
},
|
|
537
|
+
a.id
|
|
538
|
+
)) })
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}, V = ({ className: i = "" }) => {
|
|
543
|
+
const e = j(null);
|
|
544
|
+
return P(() => {
|
|
545
|
+
let s = null;
|
|
244
546
|
return (async () => {
|
|
245
547
|
try {
|
|
246
|
-
|
|
548
|
+
s = await navigator.mediaDevices.getUserMedia({
|
|
247
549
|
video: !0,
|
|
248
550
|
audio: !1
|
|
249
|
-
}),
|
|
250
|
-
} catch (
|
|
251
|
-
console.error("Error accessing camera:",
|
|
551
|
+
}), e.current && (e.current.srcObject = s);
|
|
552
|
+
} catch (r) {
|
|
553
|
+
console.error("Error accessing camera:", r);
|
|
252
554
|
}
|
|
253
555
|
})(), () => {
|
|
254
|
-
|
|
556
|
+
s && s.getTracks().forEach((r) => r.stop());
|
|
255
557
|
};
|
|
256
|
-
}, []), /* @__PURE__ */
|
|
558
|
+
}, []), /* @__PURE__ */ t.jsx("div", { className: `iw-relative ${i}`, children: /* @__PURE__ */ t.jsx(
|
|
257
559
|
"video",
|
|
258
560
|
{
|
|
259
|
-
ref:
|
|
561
|
+
ref: e,
|
|
260
562
|
autoPlay: !0,
|
|
261
563
|
playsInline: !0,
|
|
262
564
|
muted: !0,
|
|
263
565
|
className: "iw-w-full iw-h-full iw-object-cover iw-rounded-md"
|
|
264
566
|
}
|
|
265
567
|
) });
|
|
266
|
-
},
|
|
267
|
-
label:
|
|
268
|
-
error:
|
|
269
|
-
fullWidth:
|
|
270
|
-
className:
|
|
271
|
-
id:
|
|
272
|
-
...
|
|
568
|
+
}, X = ({
|
|
569
|
+
label: i,
|
|
570
|
+
error: e,
|
|
571
|
+
fullWidth: s = !1,
|
|
572
|
+
className: n = "",
|
|
573
|
+
id: r,
|
|
574
|
+
...a
|
|
273
575
|
}) => {
|
|
274
|
-
const
|
|
275
|
-
return /* @__PURE__ */
|
|
576
|
+
const o = r || `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", w = e ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", d = s ? "iw-w-full" : "", u = n.includes("iw-h-full") ? "iw-h-full" : "";
|
|
577
|
+
return /* @__PURE__ */ t.jsxs(
|
|
276
578
|
"div",
|
|
277
579
|
{
|
|
278
|
-
className: `${
|
|
580
|
+
className: `${s ? "iw-w-full iw-h-full" : ""} ${u ? "iw-flex iw-flex-col" : ""}`,
|
|
279
581
|
children: [
|
|
280
|
-
|
|
582
|
+
i && /* @__PURE__ */ t.jsx(
|
|
281
583
|
"label",
|
|
282
584
|
{
|
|
283
|
-
htmlFor:
|
|
585
|
+
htmlFor: o,
|
|
284
586
|
className: "iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",
|
|
285
|
-
children:
|
|
587
|
+
children: i
|
|
286
588
|
}
|
|
287
589
|
),
|
|
288
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ t.jsx(
|
|
289
591
|
"textarea",
|
|
290
592
|
{
|
|
291
|
-
id:
|
|
292
|
-
className: `${
|
|
293
|
-
"aria-invalid":
|
|
294
|
-
...
|
|
593
|
+
id: o,
|
|
594
|
+
className: `${l} ${w} ${d} ${u} ${n}`,
|
|
595
|
+
"aria-invalid": e ? "true" : "false",
|
|
596
|
+
...a
|
|
295
597
|
}
|
|
296
598
|
),
|
|
297
|
-
|
|
599
|
+
e && /* @__PURE__ */ t.jsx("p", { className: "iw-mt-1 iw-text-sm iw-text-red-600", children: e })
|
|
298
600
|
]
|
|
299
601
|
}
|
|
300
602
|
);
|
|
301
|
-
},
|
|
302
|
-
value:
|
|
303
|
-
onChange:
|
|
304
|
-
onSubmit:
|
|
305
|
-
isSubmitDisabled:
|
|
306
|
-
remainingTimeText:
|
|
603
|
+
}, Z = ({
|
|
604
|
+
value: i,
|
|
605
|
+
onChange: e,
|
|
606
|
+
onSubmit: s,
|
|
607
|
+
isSubmitDisabled: n,
|
|
608
|
+
remainingTimeText: r
|
|
307
609
|
}) => {
|
|
308
|
-
const
|
|
309
|
-
|
|
610
|
+
const a = (o) => {
|
|
611
|
+
o.key === "Enter" && (o.ctrlKey || o.metaKey) && !n && (o.preventDefault(), s());
|
|
310
612
|
};
|
|
311
|
-
return /* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
|
|
613
|
+
return /* @__PURE__ */ t.jsx("div", { className: "iw-mt-auto", children: /* @__PURE__ */ t.jsxs("div", { className: "iw-rounded-xl iw-overflow-hidden iw-border iw-border-gray-200", children: [
|
|
614
|
+
/* @__PURE__ */ t.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: [
|
|
615
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-text-sm iw-font-medium", children: "Your answer" }),
|
|
616
|
+
r && /* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: r })
|
|
315
617
|
] }),
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
|
|
618
|
+
/* @__PURE__ */ t.jsx(
|
|
619
|
+
X,
|
|
318
620
|
{
|
|
319
|
-
value:
|
|
320
|
-
onChange:
|
|
321
|
-
onKeyDown:
|
|
621
|
+
value: i,
|
|
622
|
+
onChange: e,
|
|
623
|
+
onKeyDown: a,
|
|
322
624
|
placeholder: "Type your answer here...",
|
|
323
625
|
className: "iw-bg-gray-50 iw-w-full iw-resize-none iw-focus:outline-none iw-bg-transparent iw-min-h-[112px]",
|
|
324
626
|
rows: 5,
|
|
325
627
|
fullWidth: !0
|
|
326
628
|
}
|
|
327
629
|
),
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
/* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
|
|
630
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-p-2 iw-flex iw-justify-between iw-items-center iw-bg-gray-50", children: [
|
|
631
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: /* @__PURE__ */ t.jsx("kbd", { children: " Press Ctrl+Enter to submit" }) }),
|
|
632
|
+
/* @__PURE__ */ t.jsx(
|
|
633
|
+
E,
|
|
332
634
|
{
|
|
333
|
-
onClick:
|
|
334
|
-
disabled:
|
|
635
|
+
onClick: s,
|
|
636
|
+
disabled: n,
|
|
335
637
|
size: "sm",
|
|
336
638
|
variant: "gradient",
|
|
337
639
|
children: "Submit Answer"
|
|
@@ -339,72 +641,72 @@ const k = ({
|
|
|
339
641
|
)
|
|
340
642
|
] })
|
|
341
643
|
] }) });
|
|
342
|
-
},
|
|
343
|
-
title:
|
|
344
|
-
questions:
|
|
345
|
-
onComplete:
|
|
346
|
-
onAnswerSubmit:
|
|
347
|
-
className:
|
|
644
|
+
}, K = ({
|
|
645
|
+
title: i = "Interview",
|
|
646
|
+
questions: e = [],
|
|
647
|
+
onComplete: s,
|
|
648
|
+
onAnswerSubmit: n,
|
|
649
|
+
className: r = ""
|
|
348
650
|
}) => {
|
|
349
|
-
const [
|
|
350
|
-
const
|
|
651
|
+
const [a, o] = m(0), [l, w] = m([]), [d, u] = m(""), [h, f] = m(!1), [k, y] = m(!0), [c, g] = m(!1), [C] = m(!0), R = j(null), p = e[a], A = () => {
|
|
652
|
+
const b = {
|
|
351
653
|
questionId: (p == null ? void 0 : p.id) || "",
|
|
352
|
-
answerText:
|
|
654
|
+
answerText: d,
|
|
353
655
|
timestamp: /* @__PURE__ */ new Date()
|
|
354
656
|
};
|
|
355
|
-
|
|
356
|
-
},
|
|
357
|
-
const
|
|
358
|
-
return `Time to Talk: ${
|
|
359
|
-
}, [
|
|
360
|
-
return
|
|
657
|
+
w([...l, b]), n && n(b), a < e.length - 1 ? (o((v) => v + 1), u("")) : (f(!0), s && s(l));
|
|
658
|
+
}, D = H(() => {
|
|
659
|
+
const v = 60 - Math.floor(Date.now() / 1e3 % 60), F = Math.floor(v / 60).toString().padStart(2, "0"), U = (v % 60).toString().padStart(2, "0");
|
|
660
|
+
return `Time to Talk: ${F}:${U} min`;
|
|
661
|
+
}, [a]);
|
|
662
|
+
return c ? /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ t.jsx(
|
|
361
663
|
"div",
|
|
362
664
|
{
|
|
363
|
-
ref:
|
|
364
|
-
className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${
|
|
365
|
-
children: /* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
] }) : /* @__PURE__ */
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
|
|
665
|
+
ref: R,
|
|
666
|
+
className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${r}`,
|
|
667
|
+
children: /* @__PURE__ */ t.jsxs("div", { className: " iw-h-full iw-flex iw-flex-col", children: [
|
|
668
|
+
/* @__PURE__ */ t.jsx(Q, { title: i }),
|
|
669
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-flex iw-flex-col iw-flex-grow iw-overflow-hidden iw-px-4 iw-py-5", children: h ? /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
|
|
670
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-text-xl iw-font-bold iw-mb-2", children: "Interview Complete!" }),
|
|
671
|
+
/* @__PURE__ */ t.jsx("p", { className: "iw-text-center iw-mb-4", children: "Thank you for participating in this interview." })
|
|
672
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: "iw-h-full iw-flex iw-flex-col ", children: [
|
|
673
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-flex-1", children: p && /* @__PURE__ */ t.jsx(J, { question: p }) }),
|
|
674
|
+
/* @__PURE__ */ t.jsxs("div", { className: "iw-grid iw-grid-cols-2 iw-gap-4 iw-mt-4", children: [
|
|
675
|
+
C && /* @__PURE__ */ t.jsx(
|
|
374
676
|
"div",
|
|
375
677
|
{
|
|
376
678
|
className: "iw-mt-2 iw-border iw-border-gray-200 iw-rounded-xl iw-p-2",
|
|
377
|
-
children: /* @__PURE__ */
|
|
679
|
+
children: /* @__PURE__ */ t.jsx(V, { className: "iw-w-full iw-h-[400px]" })
|
|
378
680
|
}
|
|
379
681
|
),
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
|
|
682
|
+
/* @__PURE__ */ t.jsx(
|
|
683
|
+
Z,
|
|
382
684
|
{
|
|
383
|
-
value:
|
|
384
|
-
onChange: (
|
|
385
|
-
onSubmit:
|
|
386
|
-
isSubmitDisabled: !
|
|
387
|
-
remainingTimeText:
|
|
685
|
+
value: d,
|
|
686
|
+
onChange: (b) => u(b.target.value),
|
|
687
|
+
onSubmit: A,
|
|
688
|
+
isSubmitDisabled: !d.trim() || !c,
|
|
689
|
+
remainingTimeText: D
|
|
388
690
|
}
|
|
389
691
|
)
|
|
390
692
|
] })
|
|
391
693
|
] }) })
|
|
392
694
|
] })
|
|
393
695
|
}
|
|
394
|
-
) }) : /* @__PURE__ */
|
|
395
|
-
|
|
696
|
+
) }) : /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container iw-h-screen iw-w-screen", children: /* @__PURE__ */ t.jsx(
|
|
697
|
+
O,
|
|
396
698
|
{
|
|
397
|
-
isOpen:
|
|
699
|
+
isOpen: k,
|
|
398
700
|
onStart: () => {
|
|
399
|
-
console.log("Permissions granted, starting interview"),
|
|
701
|
+
console.log("Permissions granted, starting interview"), g(!0), y(!1);
|
|
400
702
|
}
|
|
401
703
|
}
|
|
402
704
|
) });
|
|
403
705
|
};
|
|
404
706
|
typeof window < "u" && (window.InterviewWidget = {
|
|
405
|
-
InterviewWidget:
|
|
707
|
+
InterviewWidget: K
|
|
406
708
|
});
|
|
407
709
|
export {
|
|
408
|
-
|
|
409
|
-
|
|
710
|
+
K as InterviewWidget,
|
|
711
|
+
K as default
|
|
410
712
|
};
|
package/dist/widget.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u.InterviewWidget={},u.React))})(this,function(u,a){"use strict";var J=Object.defineProperty;var V=(u,a,g)=>a in u?J(u,a,{enumerable:!0,configurable:!0,writable:!0,value:g}):u[a]=g;var S=(u,a,g)=>V(u,typeof a!="symbol"?a+"":a,g);var g={exports:{}},j={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var I=Symbol.for("react.transitional.element"),$=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:I,type:r,key:a,ref:s!==void 0?s:null,props:i}}b.Fragment=$,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:o,className:l="",...c})=>{const u="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",m={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"},d={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"},f="iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none",h=a?"iw-w-full":"";return e.jsxs("button",{className:`${u} ${m[s]} ${d[i]} ${h} ${f} ${l}`,disabled:o||t,...c,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]})},M=({isOpen:r,onStart:s,onClose:i})=>{var j;const a=n.useRef(null),t=n.useRef(null),[o,l]=n.useState(!1),[c,u]=n.useState(null),[m,d]=n.useState(!1),f=()=>{t.current&&(t.current.getTracks().forEach(w=>w.stop()),t.current=null)},h=async()=>{d(!0),u(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),l(!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),l(!1),u(p)}finally{d(!1)}};if(n.useEffect(()=>{if(!r){f();return}return h(),()=>{f()}},[r]),!r)return null;const k=()=>{s(),f()};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:()=>{f(),i==null||i()},children:"✕"})]}),e.jsxs("div",{className:"iw-p-4 iw-grid iw-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."}),c&&e.jsx("div",{className:"iw-text-xs iw-text-red-600",children:c}),e.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[e.jsx(N,{onClick:h,isLoading:m,variant:"outline",size:"sm",children:o?"Recheck Permissions":"Enable Camera & Mic"}),e.jsx(N,{onClick:k,disabled:!o,size:"sm",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."})]})]})]})]})})},P=({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"})]}),R=({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",style:{background:"linear-gradient(to bottom, #eef2ff, #ffffff)",border:"1px solid #e0e7ff",color:"#1f2937"},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))})]}),T=({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"})})},A=({label:r,error:s,fullWidth:i=!1,className:a="",id:t,...o})=>{const l=t||`textarea-${Math.random().toString(36).substring(2,9)}`,c="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",u=s?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",m=i?"iw-w-full":"",d=a.includes("iw-h-full")?"iw-h-full":"";return e.jsxs("div",{className:`${i?"iw-w-full iw-h-full":""} ${d?"iw-flex iw-flex-col":""}`,children:[r&&e.jsx("label",{htmlFor:l,className:"iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",children:r}),e.jsx("textarea",{id:l,className:`${c} ${u} ${m} ${d} ${a}`,"aria-invalid":s?"true":"false",...o}),s&&e.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:s})]})},D=({value:r,onChange:s,onSubmit:i,isSubmitDisabled:a,remainingTimeText:t})=>{const o=l=>{l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&!a&&(l.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(A,{value:r,onChange:s,onKeyDown:o,placeholder:"Type your answer here...",className:"iw-bg-gray-50 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=""})=>{const[o,l]=n.useState(0),[c,u]=n.useState([]),[m,d]=n.useState(""),[f,h]=n.useState(!1),[k,j]=n.useState(!0),[w,p]=n.useState(!1),[z]=n.useState(!0),_=n.useRef(null),v=s[o],F=()=>{const g={questionId:(v==null?void 0:v.id)||"",answerText:m,timestamp:new Date};u([...c,g]),a&&a(g),o<s.length-1?(l(y=>y+1),d("")):(h(!0),i&&i(c))},G=n.useMemo(()=>{const y=60-Math.floor(Date.now()/1e3%60),Q=Math.floor(y/60).toString().padStart(2,"0"),W=(y%60).toString().padStart(2,"0");return`Time to Talk: ${Q}:${W} min`},[o]);return w?e.jsx("div",{className:"interview-widget-container",children:e.jsx("div",{ref:_,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${t}`,children:e.jsxs("div",{className:" iw-h-full iw-flex iw-flex-col",children:[e.jsx(P,{title:r}),e.jsx("div",{className:"iw-flex iw-flex-col iw-flex-grow iw-overflow-hidden iw-px-4 iw-py-5",children:f?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(R,{question:v})}),e.jsxs("div",{className:"iw-grid iw-grid-cols-2 iw-gap-4 iw-mt-4",children:[z&&e.jsx("div",{className:"iw-mt-2 iw-border iw-border-gray-200 iw-rounded-xl iw-p-2",children:e.jsx(T,{className:"iw-w-full iw-h-[400px]"})}),e.jsx(D,{value:m,onChange:g=>d(g.target.value),onSubmit:F,isSubmitDisabled:!m.trim()||!w,remainingTimeText:G})]})]})})]})})}):e.jsx("div",{className:"interview-widget-container iw-h-screen iw-w-screen",children:e.jsx(M,{isOpen:k,onStart:()=>{console.log("Permissions granted, starting interview"),p(!0),j(!1)}})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:S}),x.InterviewWidget=S,x.default=S,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
9
|
+
*/var I=Symbol.for("react.transitional.element"),R=Symbol.for("react.fragment");function T(i,e,s){var o=null;if(s!==void 0&&(o=""+s),e.key!==void 0&&(o=""+e.key),"key"in e){s={};for(var r in e)r!=="key"&&(s[r]=e[r])}else s=e;return e=s.ref,{$$typeof:I,type:i,key:o,ref:e!==void 0?e:null,props:s}}j.Fragment=R,j.jsx=T,j.jsxs=T,g.exports=j;var t=g.exports;const E=({children:i,variant:e="primary",size:s="md",fullWidth:o=!1,isLoading:r=!1,disabled:n,className:l="",...w})=>{const d="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",m={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"},f="iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none",p=o?"iw-w-full":"";return t.jsxs("button",{className:`${d} ${m[e]} ${h[s]} ${p} ${f} ${l}`,disabled:n||r,...w,children:[r&&t.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:[t.jsx("circle",{className:"iw-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.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"})]}),i]})},C=({isOpen:i,onStart:e,onClose:s})=>{var N;const o=a.useRef(null),r=a.useRef(null),[n,l]=a.useState(!1),[w,d]=a.useState(null),[m,h]=a.useState(!1),f=()=>{r.current&&(r.current.getTracks().forEach(c=>c.stop()),r.current=null)},p=async()=>{h(!0),d(null);try{const c=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720}},audio:!0});r.current=c,o.current&&(o.current.srcObject=c),l(!0)}catch(c){console.error("Media permission error:",c);let b="Unable to access camera or microphone.";(c==null?void 0:c.name)==="NotAllowedError"?b="Permissions denied. Please allow access to camera and microphone.":(c==null?void 0:c.name)==="NotFoundError"?b="No camera/microphone found. Please connect a device and retry.":c!=null&&c.message&&(b=c.message),l(!1),d(b)}finally{h(!1)}};if(a.useEffect(()=>{if(!i){f();return}return p(),()=>{f()}},[i]),!i)return null;const P=()=>{e(),f()};return t.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:t.jsxs("div",{className:"iw-bg-white iw-rounded-xl iw-shadow-2xl iw-w-full iw-max-w-3xl iw-mx-4",children:[t.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:[t.jsx("h2",{className:"iw-text-base iw-font-semibold",children:"Camera & Microphone Check"}),s&&t.jsx("button",{"aria-label":"Close",className:"iw-text-gray-500 hover:iw-text-gray-700",onClick:()=>{f(),s==null||s()},children:"✕"})]}),t.jsxs("div",{className:"iw-p-4 iw-grid iw-grid-cols-2 iw-gap-4",children:[t.jsx("div",{className:"iw-border iw-border-gray-200 iw-rounded-lg iw-overflow-hidden iw-bg-gray-900",children:t.jsx("video",{ref:o,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-64 iw-object-cover"})}),t.jsxs("div",{className:"iw-flex iw-flex-col iw-gap-3",children:[t.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."}),!((N=navigator.mediaDevices)!=null&&N.getUserMedia)&&t.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."}),w&&t.jsx("div",{className:"iw-text-xs iw-text-red-600",children:w}),t.jsxs("div",{className:"iw-flex iw-items-center iw-gap-2",children:[t.jsx(E,{onClick:p,isLoading:m,variant:"outline",size:"sm",children:n?"Recheck Permissions":"Enable Camera & Mic"}),t.jsx(E,{onClick:P,disabled:!n,size:"sm",children:"Start Interview"})]}),t.jsxs("ul",{className:"iw-text-xs iw-text-gray-500 iw-pt-2 iw-list-disc iw-pl-4",children:[t.jsx("li",{children:"Your preview is muted to avoid echo."}),t.jsx("li",{children:"You can change devices from your browser’s site settings."})]})]})]})]})})},A=({title:i})=>t.jsxs("header",{className:"iw-w-full iw-text-gray-900",children:[t.jsxs("div",{className:"iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3",children:[t.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-2",children:[t.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"}),t.jsx("p",{className:"iw-text-sm iw-font-medium",children:"Novara"})]}),t.jsx("h1",{className:"iw-text-base iw-font-medium",children:i}),t.jsx("button",{className:"iw-text-sm iw-text-gray-500 hover:iw-text-gray-700",children:"Exit Interview"})]}),t.jsx("div",{className:"iw-h-px iw-bg-gray-200"})]});function D(i,e={immediate:!0,enabled:!0}){const[s,o]=a.useState({data:null,loading:!1,error:null}),r=a.useCallback(async()=>{var l,w;if(e.enabled!==!1){o(d=>({...d,loading:!0,error:null}));try{const d=await i();o(m=>({...m,data:d,loading:!1,error:null})),(l=e.onSuccess)==null||l.call(e,d)}catch(d){const m=d.type?d:{type:"unknown",message:d.message||"Unknown error",retryable:!0,userMessage:"Something went wrong. Please try again.",originalError:d};o(h=>({...h,loading:!1,error:m})),(w=e.onError)==null||w.call(e,m)}}},[i,e]),n=a.useCallback(()=>{e.enabled!==!1&&r()},[r,e.enabled]);return a.useEffect(()=>{(e.immediate&&e.enabled!==!1||e.enabled===!0)&&r()},[e.immediate,e.enabled]),{...s,execute:r,retry:n}}function F(i){var e;if(!navigator.onLine)return{type:"network",message:"No internet connection",retryable:!0,userMessage:"Please check your internet connection and try again."};if(i.name==="AbortError"||(e=i.message)!=null&&e.includes("timeout"))return{type:"timeout",message:"Request timed out",retryable:!0,userMessage:"The request is taking longer than expected. Please try again."};if(i.status){const{status:s}=i;if(s===401||s===403)return{type:"auth",status:s,message:"Authentication failed",retryable:!1,userMessage:"Your session has expired. Please refresh the page."};if(s===429)return{type:"rate-limit",status:s,message:"Too many requests",retryable:!0,userMessage:"Please wait a moment before trying again."};if(s>=500)return{type:"server",status:s,message:`Server error: ${s}`,retryable:!0,userMessage:"Our servers are experiencing issues. Please try again in a few moments."};if(s>=400)return{type:"client",status:s,message:`Client error: ${s}`,retryable:!1,userMessage:"There was an issue with your request. Please check your input."}}return{type:"unknown",message:i.message||"Unknown error occurred",retryable:!0,userMessage:"Something unexpected happened. Please try again.",originalError:i}}async function x(i,e={},s={attempts:3,backoff:"exponential",baseDelay:1e3,maxDelay:1e4,jitter:!0}){let o;for(let r=1;r<=s.attempts;r++)try{const n=new AbortController,l=setTimeout(()=>n.abort(),6e4),w=await fetch(i,{...e,signal:n.signal});if(clearTimeout(l),w.status>=400&&w.status<500&&w.status!==429)return w;if(!w.ok)throw new Error(`HTTP ${w.status}: ${w.statusText}`);return w}catch(n){o=n;const l=F(n);if(!l.retryable||r===s.attempts)throw l;const w=U(r,s);console.warn(`API request failed (attempt ${r}/${s.attempts}), retrying in ${w}ms:`,l.message),await new Promise(d=>setTimeout(d,w))}throw o}function U(i,e){let s;return e.backoff==="exponential"?s=e.baseDelay*Math.pow(2,i-1):s=e.baseDelay,s=Math.min(s,e.maxDelay),e.jitter&&(s=s*(.5+Math.random()*.5)),Math.round(s)}class q{constructor(e="/api",s){S(this,"baseURL");S(this,"authToken");this.baseURL=e,this.authToken=s}setAuthToken(e){this.authToken=e}getHeaders(){const e={"Content-Type":"application/json"};return this.authToken&&(e.Authorization=`Bearer ${this.authToken}`),e}async startInterview(e){const s=await x(`${this.baseURL}/interviews/start`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify({candidateId:e})});if(!s.ok)throw new Error(`Failed to start interview: ${s.status}`);return s.json()}async getQuestions(e){const s=await x(`${this.baseURL}/interviews/${e}/questions`,{method:"GET",headers:this.getHeaders()});if(!s.ok)throw new Error(`Failed to get questions: ${s.status}`);const o=await s.json();return o.questions||o}async submitAnswer(e){const s=await x(`${this.baseURL}/answers`,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if(!s.ok)throw new Error(`Failed to submit answer: ${s.status}`)}async completeInterview(e){const s=await x(`${this.baseURL}/interviews/${e}/complete`,{method:"POST",headers:this.getHeaders()});if(!s.ok)throw new Error(`Failed to complete interview: ${s.status}`);return s.json()}async getInterviewStats(){const e=await x(`${this.baseURL}/interviews/stats`,{method:"GET",headers:this.getHeaders()});if(!e.ok)throw new Error(`Failed to get stats: ${e.status}`);return e.json()}async getInterviewSession(e){const s=await x(`${this.baseURL}/interviews/${e}`,{method:"GET",headers:this.getHeaders()});if(!s.ok)throw new Error(`Failed to get session: ${s.status}`);return s.json()}async getProducts(){const e=await x(`${this.baseURL}/products`,{method:"GET",headers:this.getHeaders()});if(!e.ok)throw new Error(`Failed to get products: ${e.status}`);return e.json()}async deleteProduct(e){const s=await x(`${this.baseURL}/products/${e}`,{method:"DELETE",headers:this.getHeaders()});if(!s.ok)throw new Error(`Failed to delete product: ${s.status}`)}}const M=new q("https://fakestoreapi.com"),L=({question:i})=>{console.log("🚀 ~ question:",i);const{data:e,loading:s,retry:o}=D(()=>M.getProducts(),{immediate:!0,onSuccess:n=>{console.log("Products loaded:",n)},onError:n=>{console.error("Failed to load products:",n.userMessage)}}),r=async n=>{try{await M.deleteProduct(n),console.log(`Product ${n} deleted successfully`),o()}catch(l){console.error("Failed to delete product:",l)}};return t.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",style:{background:"linear-gradient(to bottom, #eef2ff, #ffffff)",border:"1px solid #e0e7ff",color:"#1f2937"},children:[t.jsxs("div",{className:"iw-flex iw-items-center iw-space-x-3 iw-mb-3",children:[t.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"}),t.jsxs("div",{children:[t.jsx("div",{className:"iw-text-sm iw-font-semibold",children:"Novara"}),t.jsx("div",{className:"iw-text-xs iw-text-gray-500",children:"Assistant"})]})]}),s?t.jsx("p",{children:"Loading products..."}):t.jsx("ul",{className:"iw-list-disc iw-pl-5 iw-space-y-1",children:e==null?void 0:e.slice(0,10).map(n=>t.jsxs("li",{className:"iw-cursor-pointer",onClick:()=>r(n.id),children:[t.jsx("span",{className:"iw-font-medium",children:n.title})," - $",n.price]},n.id))})]})},H=({className:i=""})=>{const e=a.useRef(null);return a.useEffect(()=>{let s=null;return(async()=>{try{s=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),e.current&&(e.current.srcObject=s)}catch(r){console.error("Error accessing camera:",r)}})(),()=>{s&&s.getTracks().forEach(r=>r.stop())}},[]),t.jsx("div",{className:`iw-relative ${i}`,children:t.jsx("video",{ref:e,autoPlay:!0,playsInline:!0,muted:!0,className:"iw-w-full iw-h-full iw-object-cover iw-rounded-md"})})},G=({label:i,error:e,fullWidth:s=!1,className:o="",id:r,...n})=>{const l=r||`textarea-${Math.random().toString(36).substring(2,9)}`,w="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",d=e?"iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500":"",m=s?"iw-w-full":"",h=o.includes("iw-h-full")?"iw-h-full":"";return t.jsxs("div",{className:`${s?"iw-w-full iw-h-full":""} ${h?"iw-flex iw-flex-col":""}`,children:[i&&t.jsx("label",{htmlFor:l,className:"iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",children:i}),t.jsx("textarea",{id:l,className:`${w} ${d} ${m} ${h} ${o}`,"aria-invalid":e?"true":"false",...n}),e&&t.jsx("p",{className:"iw-mt-1 iw-text-sm iw-text-red-600",children:e})]})},z=({value:i,onChange:e,onSubmit:s,isSubmitDisabled:o,remainingTimeText:r})=>{const n=l=>{l.key==="Enter"&&(l.ctrlKey||l.metaKey)&&!o&&(l.preventDefault(),s())};return t.jsx("div",{className:"iw-mt-auto",children:t.jsxs("div",{className:"iw-rounded-xl iw-overflow-hidden iw-border iw-border-gray-200",children:[t.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:[t.jsx("div",{className:"iw-text-sm iw-font-medium",children:"Your answer"}),r&&t.jsx("div",{className:"iw-text-xs iw-text-gray-500",children:r})]}),t.jsx(G,{value:i,onChange:e,onKeyDown:n,placeholder:"Type your answer here...",className:"iw-bg-gray-50 iw-w-full iw-resize-none iw-focus:outline-none iw-bg-transparent iw-min-h-[112px]",rows:5,fullWidth:!0}),t.jsxs("div",{className:"iw-p-2 iw-flex iw-justify-between iw-items-center iw-bg-gray-50",children:[t.jsx("div",{className:"iw-text-xs iw-text-gray-500",children:t.jsx("kbd",{children:" Press Ctrl+Enter to submit"})}),t.jsx(E,{onClick:s,disabled:o,size:"sm",variant:"gradient",children:"Submit Answer"})]})]})})},$=({title:i="Interview",questions:e=[],onComplete:s,onAnswerSubmit:o,className:r=""})=>{const[n,l]=a.useState(0),[w,d]=a.useState([]),[m,h]=a.useState(""),[f,p]=a.useState(!1),[P,N]=a.useState(!0),[c,b]=a.useState(!1),[O]=a.useState(!0),Q=a.useRef(null),y=e[n],Y=()=>{const v={questionId:(y==null?void 0:y.id)||"",answerText:m,timestamp:new Date};d([...w,v]),o&&o(v),n<e.length-1?(l(k=>k+1),h("")):(p(!0),s&&s(w))},_=a.useMemo(()=>{const k=60-Math.floor(Date.now()/1e3%60),W=Math.floor(k/60).toString().padStart(2,"0"),B=(k%60).toString().padStart(2,"0");return`Time to Talk: ${W}:${B} min`},[n]);return c?t.jsx("div",{className:"interview-widget-container",children:t.jsx("div",{ref:Q,className:`iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${r}`,children:t.jsxs("div",{className:" iw-h-full iw-flex iw-flex-col",children:[t.jsx(A,{title:i}),t.jsx("div",{className:"iw-flex iw-flex-col iw-flex-grow iw-overflow-hidden iw-px-4 iw-py-5",children:f?t.jsxs("div",{className:"iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full",children:[t.jsx("div",{className:"iw-text-xl iw-font-bold iw-mb-2",children:"Interview Complete!"}),t.jsx("p",{className:"iw-text-center iw-mb-4",children:"Thank you for participating in this interview."})]}):t.jsxs("div",{className:"iw-h-full iw-flex iw-flex-col ",children:[t.jsx("div",{className:"iw-flex-1",children:y&&t.jsx(L,{question:y})}),t.jsxs("div",{className:"iw-grid iw-grid-cols-2 iw-gap-4 iw-mt-4",children:[O&&t.jsx("div",{className:"iw-mt-2 iw-border iw-border-gray-200 iw-rounded-xl iw-p-2",children:t.jsx(H,{className:"iw-w-full iw-h-[400px]"})}),t.jsx(z,{value:m,onChange:v=>h(v.target.value),onSubmit:Y,isSubmitDisabled:!m.trim()||!c,remainingTimeText:_})]})]})})]})})}):t.jsx("div",{className:"interview-widget-container iw-h-screen iw-w-screen",children:t.jsx(C,{isOpen:P,onStart:()=>{console.log("Permissions granted, starting interview"),b(!0),N(!1)}})})};typeof window<"u"&&(window.InterviewWidget={InterviewWidget:$}),u.InterviewWidget=$,u.default=$,Object.defineProperties(u,{__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.8",
|
|
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",
|