interview-widget 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +214 -223
  2. package/dist/assets/alert-triangle-icon.d.ts +1 -0
  3. package/dist/assets/bot-icon.d.ts +1 -0
  4. package/dist/assets/circle-play-icon.d.ts +1 -0
  5. package/dist/assets/clock-fading-icon.d.ts +1 -0
  6. package/dist/assets/clock-icon.d.ts +1 -0
  7. package/dist/assets/eye-icon.d.ts +1 -0
  8. package/dist/assets/focus-icon.d.ts +1 -0
  9. package/dist/assets/index.d.ts +12 -0
  10. package/dist/assets/keyboard-icon.d.ts +1 -0
  11. package/dist/assets/loader-icon.d.ts +1 -0
  12. package/dist/assets/monitor-icon.d.ts +1 -0
  13. package/dist/assets/mouse-pointer-click-icon.d.ts +1 -0
  14. package/dist/assets/shield-icon.d.ts +2 -0
  15. package/dist/assets/speak-icon.d.ts +1 -0
  16. package/dist/components/interview/answer-area.d.ts +12 -0
  17. package/dist/components/interview/interview-content.d.ts +11 -0
  18. package/dist/components/interview/interview-controller.d.ts +10 -0
  19. package/dist/components/interview/interview-header.d.ts +7 -0
  20. package/dist/components/interview/phases/animated-blob.d.ts +13 -0
  21. package/dist/components/interview/phases/answering-phase.d.ts +10 -0
  22. package/dist/components/interview/phases/file-generation-animation.d.ts +1 -0
  23. package/dist/components/interview/phases/interview-completion-modal.d.ts +7 -0
  24. package/dist/components/interview/phases/question-reading-animation.d.ts +5 -0
  25. package/dist/components/interview/phases/thinking-phase.d.ts +8 -0
  26. package/dist/components/interview/phases/transcription-animation.d.ts +6 -0
  27. package/dist/components/interview/proctoring/cheating-warning-modal.d.ts +10 -0
  28. package/dist/components/interview/proctoring/interview-proctoring.d.ts +6 -0
  29. package/dist/components/interview/question-display.d.ts +9 -0
  30. package/dist/components/media/audio-wave-visualizer.d.ts +14 -0
  31. package/dist/components/media/video-feed.d.ts +6 -0
  32. package/dist/components/modals/exit-confirmation-modal.d.ts +7 -0
  33. package/dist/components/modals/hard-reload-warning.d.ts +16 -0
  34. package/dist/components/modals/onboarding-modal.d.ts +8 -0
  35. package/dist/components/timer/circular-timer.d.ts +11 -0
  36. package/dist/components/timer/timer-display.d.ts +13 -0
  37. package/dist/components/ui/button.d.ts +9 -0
  38. package/dist/components/ui/dialog.d.ts +13 -0
  39. package/dist/components/ui/extended/styled-button.d.ts +7 -0
  40. package/dist/components/ui/input.d.ts +8 -0
  41. package/dist/components/ui/textarea.d.ts +8 -0
  42. package/dist/context/index.d.ts +2 -0
  43. package/dist/context/interview-widget-context.d.ts +34 -0
  44. package/dist/context/proctoring-context.d.ts +17 -0
  45. package/dist/dev.d.ts +0 -1
  46. package/dist/hooks/index.d.ts +11 -0
  47. package/dist/hooks/use-api.d.ts +26 -0
  48. package/dist/hooks/use-dialog.d.ts +6 -0
  49. package/dist/hooks/use-full-screen.d.ts +17 -0
  50. package/dist/hooks/use-interview-api.d.ts +5 -0
  51. package/dist/hooks/use-keyboard-prevention.d.ts +2 -0
  52. package/dist/hooks/use-stt.d.ts +20 -0
  53. package/dist/hooks/use-tab-switch.d.ts +2 -0
  54. package/dist/hooks/use-text-selection-prevention.d.ts +1 -0
  55. package/dist/hooks/use-timer.d.ts +13 -0
  56. package/dist/hooks/use-tts.d.ts +15 -0
  57. package/dist/hooks/use-violation-logger.d.ts +13 -0
  58. package/dist/index.d.ts +6 -8
  59. package/dist/interview-widget.d.ts +4 -0
  60. package/dist/services/api/index.d.ts +2 -0
  61. package/dist/services/api/interview-api.d.ts +23 -0
  62. package/dist/services/stt/index.d.ts +1 -0
  63. package/dist/services/stt/stt-service.d.ts +79 -0
  64. package/dist/services/timer/index.d.ts +6 -0
  65. package/dist/services/timer/timer-service.d.ts +82 -0
  66. package/dist/services/tts/index.d.ts +1 -0
  67. package/dist/services/tts/tts-service.d.ts +44 -0
  68. package/dist/styles.d.ts +0 -0
  69. package/dist/types.d.ts +89 -23
  70. package/dist/utils/api-error-classifier.d.ts +2 -0
  71. package/dist/utils/constants.d.ts +3 -0
  72. package/dist/utils/helper.d.ts +8 -0
  73. package/dist/utils/resilient-fetch.d.ts +9 -0
  74. package/dist/widget.css +1 -0
  75. package/dist/widget.es.js +3204 -0
  76. package/dist/widget.umd.js +127 -0
  77. package/package.json +37 -23
  78. package/dist/ChatWidget.d.ts +0 -5
  79. package/dist/Message.d.ts +0 -10
  80. package/dist/chat-widget.css +0 -1
  81. package/dist/chat-widget.es.js +0 -189
  82. package/dist/chat-widget.umd.js +0 -9
@@ -1,189 +0,0 @@
1
- import W, { useState as h, useRef as N, useEffect as H } from "react";
2
- var _ = { exports: {} }, p = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var P = W, B = Symbol.for("react.element"), M = Symbol.for("react.fragment"), q = Object.prototype.hasOwnProperty, z = P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, F = { key: !0, ref: !0, __self: !0, __source: !0 };
13
- function k(s, c, n) {
14
- var t, i = {}, a = null, u = null;
15
- n !== void 0 && (a = "" + n), c.key !== void 0 && (a = "" + c.key), c.ref !== void 0 && (u = c.ref);
16
- for (t in c)
17
- q.call(c, t) && !F.hasOwnProperty(t) && (i[t] = c[t]);
18
- if (s && s.defaultProps)
19
- for (t in c = s.defaultProps, c)
20
- i[t] === void 0 && (i[t] = c[t]);
21
- return { $$typeof: B, type: s, key: a, ref: u, props: i, _owner: z.current };
22
- }
23
- p.Fragment = M;
24
- p.jsx = k;
25
- p.jsxs = k;
26
- _.exports = p;
27
- var e = _.exports;
28
- const I = ({ message: s, botName: c, userName: n }) => {
29
- const t = s.sender === "bot", i = (a) => a.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
30
- return /* @__PURE__ */ e.jsx("div", { className: `cw-flex cw-mb-4 message-animation ${t ? "cw-justify-start" : "cw-justify-end"}`, children: /* @__PURE__ */ e.jsxs("div", { className: `cw-max-w-xs cw-lg:max-w-md cw-px-4 cw-py-2 cw-rounded-lg cw-break-words ${t ? "cw-bg-gray-200 cw-text-gray-800" : "cw-bg-primary-500 cw-text-white"}`, children: [
31
- /* @__PURE__ */ e.jsxs("div", { className: "cw-flex cw-items-center cw-mb-1", children: [
32
- /* @__PURE__ */ e.jsx("span", { className: "cw-text-xs cw-font-semibold", children: t ? c : n }),
33
- /* @__PURE__ */ e.jsx("span", { className: "cw-text-xs cw-opacity-70 cw-ml-2", children: i(s.timestamp) })
34
- ] }),
35
- /* @__PURE__ */ e.jsx("div", { className: "cw-text-sm", children: s.text })
36
- ] }) });
37
- }, K = ({
38
- title: s = "Chat Support",
39
- placeholder: c = "Type your message...",
40
- onSendMessage: n,
41
- messages: t = [],
42
- className: i = "",
43
- botName: a = "Support Bot",
44
- userName: u = "You",
45
- height: R = "400px",
46
- width: $ = "350px",
47
- position: y = "inline",
48
- theme: l = "light"
49
- }) => {
50
- const [S, g] = h([]), [w, f] = h(""), [m, T] = h(!1), b = N(null), v = N(null), x = t.length > 0 ? t : S, C = (r) => {
51
- const d = [
52
- "Thanks for your message! How can I help you today?",
53
- "I understand your concern. Let me assist you with that.",
54
- "That's a great question! Here's what I can tell you...",
55
- "I'm here to help! Can you provide more details?",
56
- "Thank you for reaching out. I'll do my best to assist you."
57
- ], o = r.toLowerCase();
58
- return o.includes("hello") || o.includes("hi") ? "Hello! Welcome to our support chat. How can I help you today?" : o.includes("help") ? "I'm here to help! What do you need assistance with?" : o.includes("price") || o.includes("cost") ? "I can help you with pricing information. What specific product or service are you interested in?" : d[Math.floor(Math.random() * d.length)];
59
- }, E = () => {
60
- var r;
61
- (r = b.current) == null || r.scrollIntoView({ behavior: "smooth" });
62
- };
63
- H(() => {
64
- E();
65
- }, [x]);
66
- const j = () => {
67
- var d;
68
- if (!w.trim())
69
- return;
70
- const r = {
71
- id: Date.now().toString(),
72
- text: w.trim(),
73
- sender: "user",
74
- timestamp: /* @__PURE__ */ new Date()
75
- };
76
- t.length > 0 ? n == null || n(w.trim()) : (g((o) => [...o, r]), setTimeout(() => {
77
- const o = {
78
- id: (Date.now() + 1).toString(),
79
- text: C(w.trim()),
80
- sender: "bot",
81
- timestamp: /* @__PURE__ */ new Date()
82
- };
83
- g((L) => [...L, o]);
84
- }, 1e3)), f(""), (d = v.current) == null || d.focus();
85
- }, D = (r) => {
86
- r.key === "Enter" && !r.shiftKey && (r.preventDefault(), j());
87
- }, O = {
88
- height: m ? "auto" : R,
89
- width: $,
90
- ...y !== "inline" && {
91
- position: "fixed",
92
- bottom: "20px",
93
- [y === "bottom-right" ? "right" : "left"]: "20px",
94
- zIndex: 1e3
95
- }
96
- };
97
- return /* @__PURE__ */ e.jsxs(
98
- "div",
99
- {
100
- className: `chat-widget-container cw-bg-white cw-border cw-border-gray-300 cw-rounded-lg cw-shadow-lg cw-flex cw-flex-col ${l === "dark" ? "cw-bg-gray-800 cw-border-gray-600" : ""} ${i}`,
101
- style: O,
102
- children: [
103
- /* @__PURE__ */ e.jsxs(
104
- "div",
105
- {
106
- className: `cw-flex cw-items-center cw-justify-between cw-p-4 cw-border-b cw-bg-primary-500 cw-text-white cw-rounded-t-lg ${l === "dark" ? "cw-border-gray-600" : "cw-border-gray-200"}`,
107
- children: [
108
- /* @__PURE__ */ e.jsx("h3", { className: "cw-font-semibold cw-text-sm", children: s }),
109
- y !== "inline" && /* @__PURE__ */ e.jsx(
110
- "button",
111
- {
112
- onClick: () => T(!m),
113
- className: "cw-text-white cw-hover:bg-primary-600 cw-rounded cw-p-1 cw-transition-colors",
114
- children: m ? "▲" : "▼"
115
- }
116
- )
117
- ]
118
- }
119
- ),
120
- !m && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
121
- /* @__PURE__ */ e.jsxs(
122
- "div",
123
- {
124
- className: `cw-flex-1 cw-overflow-y-auto cw-p-4 chat-messages ${l === "dark" ? "cw-bg-gray-700" : "cw-bg-gray-50"}`,
125
- style: { maxHeight: "calc(100% - 120px)" },
126
- children: [
127
- x.length === 0 && /* @__PURE__ */ e.jsx(
128
- "div",
129
- {
130
- className: `cw-text-center cw-text-gray-500 cw-text-sm cw-mt-8 ${l === "dark" ? "cw-text-gray-400" : ""}`,
131
- children: "Start a conversation by typing a message below."
132
- }
133
- ),
134
- x.map((r) => /* @__PURE__ */ e.jsx(
135
- I,
136
- {
137
- message: r,
138
- botName: a,
139
- userName: u
140
- },
141
- r.id
142
- )),
143
- /* @__PURE__ */ e.jsx("div", { ref: b })
144
- ]
145
- }
146
- ),
147
- /* @__PURE__ */ e.jsx(
148
- "div",
149
- {
150
- className: `cw-p-4 cw-border-t ${l === "dark" ? "cw-border-gray-600 cw-bg-gray-800" : "cw-border-gray-200"}`,
151
- children: /* @__PURE__ */ e.jsxs("div", { className: "cw-flex cw-space-x-2 ", children: [
152
- /* @__PURE__ */ e.jsx(
153
- "input",
154
- {
155
- ref: v,
156
- type: "text",
157
- value: w,
158
- onChange: (r) => f(r.target.value),
159
- onKeyDown: D,
160
- placeholder: c,
161
- className: ` cw-w-full cw-flex-1 cw-px-3 cw-py-2 cw-border cw-rounded-md cw-text-sm cw-focus:outline-none cw-focus:ring-2 cw-focus:ring-primary-500 ${l === "dark" ? "cw-bg-gray-700 cw-border-gray-600 cw-text-white cw-placeholder-gray-400" : "cw-bg-white cw-border-gray-300"}`
162
- }
163
- ),
164
- /* @__PURE__ */ e.jsx(
165
- "button",
166
- {
167
- onClick: j,
168
- disabled: !w.trim(),
169
- className: "cw-bg-primary-500 cw-text-white cw-px-4 cw-py-2 cw-rounded-md cw-text-sm cw-font-medium cw-hover:bg-primary-600 cw-disabled:opacity-50 cw-disabled:cursor-not-allowed cw-transition-colors",
170
- children: "Send"
171
- }
172
- )
173
- ] })
174
- }
175
- )
176
- ] })
177
- ]
178
- }
179
- );
180
- };
181
- typeof window < "u" && (window.ChatWidget = {
182
- ChatWidget: K,
183
- Message: I
184
- });
185
- export {
186
- K as ChatWidget,
187
- I as Message,
188
- K as default
189
- };
@@ -1,9 +0,0 @@
1
- (function(n,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],c):(n=typeof globalThis<"u"?globalThis:n||self,c(n.ChatWidget={},n.React))})(this,function(n,c){"use strict";const V="";var v={exports:{}},p={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var S=c,T=Symbol.for("react.element"),C=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,O=S.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,D={key:!0,ref:!0,__self:!0,__source:!0};function j(o,s,a){var t,l={},d=null,f=null;a!==void 0&&(d=""+a),s.key!==void 0&&(d=""+s.key),s.ref!==void 0&&(f=s.ref);for(t in s)E.call(s,t)&&!D.hasOwnProperty(t)&&(l[t]=s[t]);if(o&&o.defaultProps)for(t in s=o.defaultProps,s)l[t]===void 0&&(l[t]=s[t]);return{$$typeof:T,type:o,key:d,ref:f,props:l,_owner:O.current}}p.Fragment=C,p.jsx=j,p.jsxs=j,v.exports=p;var e=v.exports;const y=({message:o,botName:s,userName:a})=>{const t=o.sender==="bot",l=d=>d.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.jsx("div",{className:`cw-flex cw-mb-4 message-animation ${t?"cw-justify-start":"cw-justify-end"}`,children:e.jsxs("div",{className:`cw-max-w-xs cw-lg:max-w-md cw-px-4 cw-py-2 cw-rounded-lg cw-break-words ${t?"cw-bg-gray-200 cw-text-gray-800":"cw-bg-primary-500 cw-text-white"}`,children:[e.jsxs("div",{className:"cw-flex cw-items-center cw-mb-1",children:[e.jsx("span",{className:"cw-text-xs cw-font-semibold",children:t?s:a}),e.jsx("span",{className:"cw-text-xs cw-opacity-70 cw-ml-2",children:l(o.timestamp)})]}),e.jsx("div",{className:"cw-text-sm",children:o.text})]})})},g=({title:o="Chat Support",placeholder:s="Type your message...",onSendMessage:a,messages:t=[],className:l="",botName:d="Support Bot",userName:f="You",height:W="400px",width:M="350px",position:x="inline",theme:w="light"})=>{const[L,_]=c.useState([]),[u,N]=c.useState(""),[h,P]=c.useState(!1),k=c.useRef(null),I=c.useRef(null),b=t.length>0?t:L,H=r=>{const m=["Thanks for your message! How can I help you today?","I understand your concern. Let me assist you with that.","That's a great question! Here's what I can tell you...","I'm here to help! Can you provide more details?","Thank you for reaching out. I'll do my best to assist you."],i=r.toLowerCase();return i.includes("hello")||i.includes("hi")?"Hello! Welcome to our support chat. How can I help you today?":i.includes("help")?"I'm here to help! What do you need assistance with?":i.includes("price")||i.includes("cost")?"I can help you with pricing information. What specific product or service are you interested in?":m[Math.floor(Math.random()*m.length)]},B=()=>{var r;(r=k.current)==null||r.scrollIntoView({behavior:"smooth"})};c.useEffect(()=>{B()},[b]);const R=()=>{var m;if(!u.trim())return;const r={id:Date.now().toString(),text:u.trim(),sender:"user",timestamp:new Date};t.length>0?a==null||a(u.trim()):(_(i=>[...i,r]),setTimeout(()=>{const i={id:(Date.now()+1).toString(),text:H(u.trim()),sender:"bot",timestamp:new Date};_(K=>[...K,i])},1e3)),N(""),(m=I.current)==null||m.focus()},z=r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),R())},F={height:h?"auto":W,width:M,...x!=="inline"&&{position:"fixed",bottom:"20px",[x==="bottom-right"?"right":"left"]:"20px",zIndex:1e3}};return e.jsxs("div",{className:`chat-widget-container cw-bg-white cw-border cw-border-gray-300 cw-rounded-lg cw-shadow-lg cw-flex cw-flex-col ${w==="dark"?"cw-bg-gray-800 cw-border-gray-600":""} ${l}`,style:F,children:[e.jsxs("div",{className:`cw-flex cw-items-center cw-justify-between cw-p-4 cw-border-b cw-bg-primary-500 cw-text-white cw-rounded-t-lg ${w==="dark"?"cw-border-gray-600":"cw-border-gray-200"}`,children:[e.jsx("h3",{className:"cw-font-semibold cw-text-sm",children:o}),x!=="inline"&&e.jsx("button",{onClick:()=>P(!h),className:"cw-text-white cw-hover:bg-primary-600 cw-rounded cw-p-1 cw-transition-colors",children:h?"▲":"▼"})]}),!h&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`cw-flex-1 cw-overflow-y-auto cw-p-4 chat-messages ${w==="dark"?"cw-bg-gray-700":"cw-bg-gray-50"}`,style:{maxHeight:"calc(100% - 120px)"},children:[b.length===0&&e.jsx("div",{className:`cw-text-center cw-text-gray-500 cw-text-sm cw-mt-8 ${w==="dark"?"cw-text-gray-400":""}`,children:"Start a conversation by typing a message below."}),b.map(r=>e.jsx(y,{message:r,botName:d,userName:f},r.id)),e.jsx("div",{ref:k})]}),e.jsx("div",{className:`cw-p-4 cw-border-t ${w==="dark"?"cw-border-gray-600 cw-bg-gray-800":"cw-border-gray-200"}`,children:e.jsxs("div",{className:"cw-flex cw-space-x-2 ",children:[e.jsx("input",{ref:I,type:"text",value:u,onChange:r=>N(r.target.value),onKeyDown:z,placeholder:s,className:` cw-w-full cw-flex-1 cw-px-3 cw-py-2 cw-border cw-rounded-md cw-text-sm cw-focus:outline-none cw-focus:ring-2 cw-focus:ring-primary-500 ${w==="dark"?"cw-bg-gray-700 cw-border-gray-600 cw-text-white cw-placeholder-gray-400":"cw-bg-white cw-border-gray-300"}`}),e.jsx("button",{onClick:R,disabled:!u.trim(),className:"cw-bg-primary-500 cw-text-white cw-px-4 cw-py-2 cw-rounded-md cw-text-sm cw-font-medium cw-hover:bg-primary-600 cw-disabled:opacity-50 cw-disabled:cursor-not-allowed cw-transition-colors",children:"Send"})]})})]})]})};typeof window<"u"&&(window.ChatWidget={ChatWidget:g,Message:y}),n.ChatWidget=g,n.Message=y,n.default=g,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});