@knowbl_ai/nexus-chat 1.12.0 → 1.12.1
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/package.json +1 -1
- package/widget.js +7 -7
- package/widget.js.map +1 -1
- package/widget.umd.js +1 -1
- package/widget.umd.js.map +1 -1
package/package.json
CHANGED
package/widget.js
CHANGED
|
@@ -29,18 +29,18 @@ return be(_,{children:[
|
|
|
29
29
|
/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-center ncw:gap-1 "+("bottom"===E?"ncw:mt-2":"top"===E?"ncw:mb-2":"ncw:ml-2 ncw:inline-flex"),children:Array.from({length:e},(e,t)=>t+1).map(t=>/* @__PURE__ */be("button",{type:"button",disabled:c||null!==a&&!M,onClick:()=>{B(t)},class:`${O[A]} ${D[R]} ${c?"ncw:opacity-50 ncw:cursor-not-allowed":"ncw:cursor-pointer"}`,style:{color:"number"==typeof a&&t<=a?r:n},"aria-label":`Rate ${t} out of ${e}`,children:"⭐"},t))}),h&&/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-center ncw:gap-1 ncw:mt-1 "+("inline"===E?"ncw:ml-2":""),children:[is(s.behavior?.confirmationIcon??os,A),/* @__PURE__ */be("span",{class:"ncw:text-xs ncw:text-gray-700",style:s.behavior?.confirmationTextColor?{color:s.behavior.confirmationTextColor}:void 0,children:s.behavior?.confirmationMessage||"Thanks for your feedback!"})]}),L&&/* @__PURE__ */be(ls,{show:g,mode:L,promptText:(null!==f?s.commentPrompts?.[String(f)]?.prompt:void 0)??s.commentPrompt,placeholderOverride:null!==f?s.commentPrompts?.[String(f)]?.placeholder:void 0,config:t,showSkip:!s.mandatoryComment,requireText:!!s.mandatoryComment,onClose:()=>{m(!1),v(null)},onSubmit:e=>{B(f??a??0,e)},onSkip:()=>{B(f??a??0,"")}}),s.showSubmittedFeedback&&null!==a&&x&&/* @__PURE__ */be(as,{comment:x,config:t})]})}if("emoji"===$){const e=s.buttons?.emojis||[{value:"love",icon:"❤️",label:"Love"},{value:"like",icon:"👍",label:"Like"},{value:"neutral",icon:"😐",label:"Neutral"},{value:"dislike",icon:"👎",label:"Dislike"}];/* @__PURE__ */
|
|
30
30
|
return be(_,{children:[
|
|
31
31
|
/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-center ncw:gap-2 "+("bottom"===E?"ncw:mt-2":"top"===E?"ncw:mb-2":"ncw:ml-2 ncw:inline-flex"),style:{gap:s.buttons?.spacing||"8px"},children:e.map(e=>/* @__PURE__ */be("button",{type:"button",disabled:c||null!==a&&!M,onClick:()=>{B(e.value)},class:`ncw:rounded ${O[A]} ${D[R]} ${a===e.value?"ncw:bg-blue-100":"hover:ncw:bg-gray-100"} ${c?"ncw:opacity-50 ncw:cursor-not-allowed":"ncw:cursor-pointer"}`,"aria-label":e.label||e.value,children:/* @__PURE__ */be("span",{class:"ncw:flex ncw:items-center ncw:gap-1",children:[/* @__PURE__ */be("span",{children:e.icon}),z&&e.label&&/* @__PURE__ */be("span",{class:"ncw:text-xs",children:e.label})]})},e.value))}),h&&/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-center ncw:gap-1 ncw:mt-1 "+("inline"===E?"ncw:ml-2":""),children:[is(s.behavior?.confirmationIcon??os,A),/* @__PURE__ */be("span",{class:"ncw:text-xs ncw:text-gray-700",style:s.behavior?.confirmationTextColor?{color:s.behavior.confirmationTextColor}:void 0,children:s.behavior?.confirmationMessage||"Thanks for your feedback!"})]}),L&&/* @__PURE__ */be(ls,{show:g,mode:L,promptText:(null!==f?s.commentPrompts?.[String(f)]?.prompt:void 0)??s.commentPrompt,placeholderOverride:null!==f?s.commentPrompts?.[String(f)]?.placeholder:void 0,config:t,showSkip:!s.mandatoryComment,requireText:!!s.mandatoryComment,onClose:()=>{m(!1),v(null)},onSubmit:e=>{B(f??a??"",e)},onSkip:()=>{B(f??a??"","")}}),s.showSubmittedFeedback&&null!==a&&x&&/* @__PURE__ */be(as,{comment:x,config:t})]})}return null}function as({comment:e,config:t}){const n=t.features?.feedback?.submittedFeedbackDisplay,r="dark"===t.theme,o=n?.backgroundColor||(r?"#1f2937":"#f9fafb"),i=n?.textColor||(r?"#d1d5db":"#6b7280"),s=n?.borderColor||(r?"#374151":"#e5e7eb");/* @__PURE__ */
|
|
32
|
-
return be("div",{class:"ncw:mt-2 ncw:text-sm",style:{backgroundColor:o,color:i,border:void 0!==n?.border?n.border:`1px solid ${s}`,borderRadius:n?.borderRadius||"4px",padding:n?.padding||"8px 12px"},children:[n?.prefix&&/* @__PURE__ */be("span",{class:"ncw:font-medium ncw:mr-1",children:n.prefix}),e]})}function ls({show:e,mode:t,promptText:n,placeholderOverride:r,config:o,showSkip:i,requireText:s,onClose:a,onSubmit:l,onSkip:c}){const[d,u]=ie(""),p=ae(null),h=ae(null),w=de(()=>{const e=h.current;if(!e)return;e.style.height="auto";const t=8*(parseInt(getComputedStyle(e).lineHeight,10)||20)+(parseInt(getComputedStyle(e).paddingTop,10)+parseInt(getComputedStyle(e).paddingBottom,10));e.scrollHeight<=t?(e.style.height=`${e.scrollHeight}px`,e.style.overflowY="hidden"):(e.style.height=`${t}px`,e.style.overflowY="auto")},[]);if(se(()=>{"inline"===t&&e&&p.current&&setTimeout(()=>{p.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},50)},[e,t]),se(()=>{"inline"===t&&e&&w()},[e,t,w]),!e)return null;const g=o.features?.feedback,m=g?.inlineInput,f="dark"===o.theme,v=m?.backgroundColor||(f?"#1f2937":"#ffffff"),b=m?.textareaBackgroundColor||(f?"#374151":"#ffffff"),y=m?.textColor||(f?"#e5e7eb":"#374151"),x=m?.borderColor||(f?"#4b5563":"#d1d5db"),k=m?.submitColor||g?.buttons?.negative?.activeColor||"#2563eb",_=m?.submitTextColor||"#ffffff",S=m?.cancelColor||y,C=m?.cancelBackgroundColor||"transparent",I=m?.skipColor||y,T=m?.skipBackgroundColor||"transparent",$=m?.closeButtonColor||y,E=m?.closeButtonSize,A=m?.closeButtonFontWeight,z=void 0!==m?.border?m.border:`1px solid ${x}`,R=r||m?.placeholder||"What could be improved?",M=m?.submitLabel||"Submit",L=m?.skipLabel||"Skip",O=m?.submitBorder?m.submitBorder:m?.submitBorderColor?`${m.submitBorderWidth??"1px"} solid ${m.submitBorderColor}`:void 0,D=!!m?.submitBorderRadius,B=!!m?.submitPadding,P=!!m?.submitFontSize,F=m?.promptLabel,W=m?.optionalLabel,U=W?W.message??"Optional":null,H=g?.commentCharacterLimit,N=H?.max??500,q=H?.thresholds,j=void 0!==H&&(H.showCounter??!0),V=H?.
|
|
32
|
+
return be("div",{class:"ncw:mt-2 ncw:text-sm",style:{backgroundColor:o,color:i,border:void 0!==n?.border?n.border:`1px solid ${s}`,borderRadius:n?.borderRadius||"4px",padding:n?.padding||"8px 12px"},children:[n?.prefix&&/* @__PURE__ */be("span",{class:"ncw:font-medium ncw:mr-1",children:n.prefix}),e]})}function ls({show:e,mode:t,promptText:n,placeholderOverride:r,config:o,showSkip:i,requireText:s,onClose:a,onSubmit:l,onSkip:c}){const[d,u]=ie(""),p=ae(null),h=ae(null),w=de(()=>{const e=h.current;if(!e)return;e.style.height="auto";const t=8*(parseInt(getComputedStyle(e).lineHeight,10)||20)+(parseInt(getComputedStyle(e).paddingTop,10)+parseInt(getComputedStyle(e).paddingBottom,10));e.scrollHeight<=t?(e.style.height=`${e.scrollHeight}px`,e.style.overflowY="hidden"):(e.style.height=`${t}px`,e.style.overflowY="auto")},[]);if(se(()=>{"inline"===t&&e&&p.current&&setTimeout(()=>{p.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},50)},[e,t]),se(()=>{"inline"===t&&e&&w()},[e,t,w]),!e)return null;const g=o.features?.feedback,m=g?.inlineInput,f="dark"===o.theme,v=m?.backgroundColor||(f?"#1f2937":"#ffffff"),b=m?.textareaBackgroundColor||(f?"#374151":"#ffffff"),y=m?.textColor||(f?"#e5e7eb":"#374151"),x=m?.borderColor||(f?"#4b5563":"#d1d5db"),k=m?.submitColor||g?.buttons?.negative?.activeColor||"#2563eb",_=m?.submitTextColor||"#ffffff",S=m?.cancelColor||y,C=m?.cancelBackgroundColor||"transparent",I=m?.skipColor||y,T=m?.skipBackgroundColor||"transparent",$=m?.closeButtonColor||y,E=m?.closeButtonSize,A=m?.closeButtonFontWeight,z=void 0!==m?.border?m.border:`1px solid ${x}`,R=r||m?.placeholder||"What could be improved?",M=m?.submitLabel||"Submit",L=m?.skipLabel||"Skip",O=m?.submitBorder?m.submitBorder:m?.submitBorderColor?`${m.submitBorderWidth??"1px"} solid ${m.submitBorderColor}`:void 0,D=!!m?.submitBorderRadius,B=!!m?.submitPadding,P=!!m?.submitFontSize,F=m?.promptLabel,W=m?.optionalLabel,U=W?W.message??"Optional":null,H=g?.commentCharacterLimit,N=H?.max??500,q=H?.thresholds,j=void 0!==H&&(H.showCounter??!0),V=void 0!==H&&(q?.length??0)>0,Z=H?.counterStyle,K=N>0?d.length/N*100:0,Q=q?.slice().sort((e,t)=>t.percentage-e.percentage).find(e=>K>=e.percentage),J=Q?.color??(f?"#9ca3af":"#6b7280"),Y=(!s||d.trim().length>0)&&(void 0===H||d.length<=N);if("inline"===t)/* @__PURE__ */return be("div",{ref:p,class:"ncw:mt-2 ncw:rounded ncw:p-3",style:{backgroundColor:v,border:z},children:[
|
|
33
33
|
/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-start ncw:justify-between ncw:mb-2",children:[/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-center ncw:gap-2",children:[n&&/* @__PURE__ */be("p",{class:"ncw:text-sm",style:{color:F?.color??y,fontWeight:F?.fontWeight,fontStyle:F?.fontStyle,fontFamily:F?.fontFamily,fontSize:F?.fontSize},children:n}),U&&/* @__PURE__ */be("span",{class:"ncw:font-medium ncw:uppercase ncw:px-1.5 ncw:py-0.5 ncw:rounded ncw:tracking-wide",style:{backgroundColor:W?.backgroundColor??(f?"#374151":"#e5e7eb"),color:W?.color??(f?"#9ca3af":"#6b7280"),fontSize:W?.fontSize??"12px",fontWeight:W?.fontWeight,fontStyle:W?.fontStyle,fontFamily:W?.fontFamily},children:U})]}),/* @__PURE__ */be("button",{type:"button",onClick:()=>{u(""),a()},class:[!E&&"ncw:text-lg","ncw:leading-none ncw:cursor-pointer ncw:ml-2 ncw:opacity-60 hover:ncw:opacity-100"].filter(Boolean).join(" "),style:{color:$,fontSize:E,fontWeight:A},"aria-label":"Close",children:"✕"})]}),
|
|
34
|
-
/* @__PURE__ */be("textarea",{ref:h,value:d,onChange:e=>{u(e.target.value),w()},maxLength:void 0!==H?N:void 0,rows:4,class:"ncw:w-full ncw:rounded ncw:p-2 ncw:mb-2 ncw:text-sm ncw:resize-none",style:{color:y,backgroundColor:b,border:`1px solid ${x}`},placeholder:R,autoFocus:!0}),j&&/* @__PURE__ */be("div",{class:"ncw:flex ncw:justify-between ncw:items-center ncw:mb-2",style:{color:
|
|
34
|
+
/* @__PURE__ */be("textarea",{ref:h,value:d,onChange:e=>{u(e.target.value),w()},maxLength:void 0!==H?N:void 0,rows:4,class:"ncw:w-full ncw:rounded ncw:p-2 ncw:mb-2 ncw:text-sm ncw:resize-none",style:{color:y,backgroundColor:b,border:`1px solid ${x}`},placeholder:R,autoFocus:!0}),(j||V)&&/* @__PURE__ */be("div",{class:"ncw:flex ncw:justify-between ncw:items-center ncw:mb-2",style:{color:J},children:[/* @__PURE__ */be("span",V&&Q?.message?{class:"ncw:text-xs ncw:min-w-0 ncw:mr-2",style:{...Z},children:Q.message}:{}),j&&/* @__PURE__ */be("span",{class:"ncw:text-xs ncw:whitespace-nowrap ncw:shrink-0",style:{...Z},children:[d.length,"/",N]})]}),
|
|
35
35
|
/* @__PURE__ */be("div",{class:"ncw:flex ncw:justify-end ncw:gap-2",children:[i&&c&&!U&&/* @__PURE__ */be("button",{type:"button",onClick:()=>{u(""),c()},class:"ncw:px-3 ncw:py-1.5 ncw:text-sm ncw:rounded ncw:cursor-pointer",style:{color:I,backgroundColor:T},children:L}),
|
|
36
36
|
/* @__PURE__ */be("button",{type:"button",onClick:a,class:"ncw:px-3 ncw:py-1.5 ncw:text-sm ncw:rounded ncw:cursor-pointer",style:{color:S,backgroundColor:C},children:"Cancel"}),
|
|
37
|
-
/* @__PURE__ */be("button",{type:"button",disabled:!
|
|
38
|
-
return be("div",{class:"ncw:fixed ncw:inset-0 ncw:flex ncw:items-center ncw:justify-center ncw:z-50",style:{backgroundColor:
|
|
37
|
+
/* @__PURE__ */be("button",{type:"button",disabled:!Y,onClick:()=>{Y&&(l(d),u(""))},class:["ncw:transition-opacity hover:ncw:opacity-90",!D&&"ncw:rounded",!B&&"ncw:px-3 ncw:py-1.5",!P&&"ncw:text-sm"].filter(Boolean).join(" "),style:{backgroundColor:k,color:_,opacity:Y?1:.5,cursor:Y?"pointer":"not-allowed",...O&&{border:O},...D&&{borderRadius:m?.submitBorderRadius},...B&&{padding:m?.submitPadding},...m?.submitFontFamily&&{fontFamily:m.submitFontFamily},...m?.submitFontSize&&{fontSize:m.submitFontSize},...m?.submitFontWeight&&{fontWeight:m.submitFontWeight}},children:M})]})]});const G=f?"rgba(0, 0, 0, 0.7)":"rgba(0, 0, 0, 0.5)",X=m?.cancelBackgroundColor||(f?"rgba(255,255,255,0.08)":"#f3f4f6");/* @__PURE__ */
|
|
38
|
+
return be("div",{class:"ncw:fixed ncw:inset-0 ncw:flex ncw:items-center ncw:justify-center ncw:z-50",style:{backgroundColor:G},children:/* @__PURE__ */be("div",{class:"ncw:rounded-lg ncw:p-4 ncw:max-w-md ncw:w-full ncw:mx-4 ncw:shadow-xl",style:{backgroundColor:v,border:z},children:[
|
|
39
39
|
/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-start ncw:justify-between ncw:mb-2",children:[/* @__PURE__ */be("div",{class:"ncw:flex ncw:items-center ncw:gap-2",children:[/* @__PURE__ */be("h3",{class:"ncw:text-lg ncw:font-semibold",style:{color:y},children:n||"Please tell us more"}),U&&/* @__PURE__ */be("span",{class:"ncw:font-medium ncw:uppercase ncw:px-1.5 ncw:py-0.5 ncw:rounded ncw:tracking-wide",style:{backgroundColor:W?.backgroundColor??(f?"#374151":"#e5e7eb"),color:W?.color??(f?"#9ca3af":"#6b7280"),fontSize:W?.fontSize??"12px",fontWeight:W?.fontWeight,fontStyle:W?.fontStyle,fontFamily:W?.fontFamily},children:U})]}),U&&/* @__PURE__ */be("button",{type:"button",onClick:a,class:"ncw:text-lg ncw:leading-none ncw:cursor-pointer ncw:ml-2 ncw:opacity-60 hover:ncw:opacity-100",style:{color:y},children:"✕"})]}),
|
|
40
|
-
/* @__PURE__ */be("textarea",{value:d,onChange:e=>u(e.target.value),maxLength:void 0!==H?N:void 0,class:"ncw:w-full ncw:border ncw:rounded ncw:p-2 ncw:mb-2 ncw:min-h-25",style:{color:y,backgroundColor:b,borderColor:x},placeholder:R,autoFocus:!0}),j&&/* @__PURE__ */be("div",{class:"ncw:flex ncw:justify-between ncw:items-center ncw:mb-3",style:{color:
|
|
40
|
+
/* @__PURE__ */be("textarea",{value:d,onChange:e=>u(e.target.value),maxLength:void 0!==H?N:void 0,class:"ncw:w-full ncw:border ncw:rounded ncw:p-2 ncw:mb-2 ncw:min-h-25",style:{color:y,backgroundColor:b,borderColor:x},placeholder:R,autoFocus:!0}),(j||V)&&/* @__PURE__ */be("div",{class:"ncw:flex ncw:justify-between ncw:items-center ncw:mb-3",style:{color:J},children:[/* @__PURE__ */be("span",V&&Q?.message?{class:"ncw:text-xs ncw:min-w-0 ncw:mr-2",style:{...Z},children:Q.message}:{}),j&&/* @__PURE__ */be("span",{class:"ncw:text-xs ncw:whitespace-nowrap ncw:shrink-0",style:{...Z},children:[d.length,"/",N]})]}),
|
|
41
41
|
/* @__PURE__ */be("div",{class:"ncw:flex ncw:justify-end ncw:gap-2",children:[i&&c&&!U&&/* @__PURE__ */be("button",{type:"button",onClick:()=>{u(""),c()},class:"ncw:px-4 ncw:py-2 ncw:rounded ncw:transition-colors ncw:cursor-pointer",style:{color:I,backgroundColor:T},children:L}),
|
|
42
|
-
/* @__PURE__ */be("button",{type:"button",onClick:a,class:"ncw:px-4 ncw:py-2 ncw:rounded ncw:transition-colors",style:{color:S,backgroundColor:C},onMouseEnter:e=>{m?.cancelBackgroundColor||(e.currentTarget.style.backgroundColor=
|
|
43
|
-
/* @__PURE__ */be("button",{type:"button",disabled:!
|
|
42
|
+
/* @__PURE__ */be("button",{type:"button",onClick:a,class:"ncw:px-4 ncw:py-2 ncw:rounded ncw:transition-colors",style:{color:S,backgroundColor:C},onMouseEnter:e=>{m?.cancelBackgroundColor||(e.currentTarget.style.backgroundColor=X)},onMouseLeave:e=>{m?.cancelBackgroundColor||(e.currentTarget.style.backgroundColor=C)},children:"Cancel"}),
|
|
43
|
+
/* @__PURE__ */be("button",{type:"button",disabled:!Y,onClick:()=>{Y&&(l(d),u(""))},class:["ncw:transition-opacity hover:ncw:opacity-90",!D&&"ncw:rounded",!B&&"ncw:px-4 ncw:py-2"].filter(Boolean).join(" "),style:{backgroundColor:k,color:_,opacity:Y?1:.5,cursor:Y?"pointer":"not-allowed",...O&&{border:O},...D&&{borderRadius:m?.submitBorderRadius},...B&&{padding:m?.submitPadding},...m?.submitFontFamily&&{fontFamily:m.submitFontFamily},...m?.submitFontSize&&{fontSize:m.submitFontSize},...m?.submitFontWeight&&{fontWeight:m.submitFontWeight}},children:M})]})]})})}function cs(){/* @__PURE__ */
|
|
44
44
|
return be("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:/* @__PURE__ */be("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"})})}function ds(){/* @__PURE__ */
|
|
45
45
|
return be("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","stroke-width":"1",children:[
|
|
46
46
|
/* @__PURE__ */be("path",{d:"M10 2C5.5 2 2 5.5 2 10v3c0 1.1.9 2 2 2h2V9H4c.5-2.5 2.5-4 6-4s5.5 1.5 6 4h-2v6h2c1.1 0 2-.9 2-2v-3c0-4.5-3.5-8-8-8z"}),
|