@opencx/widget 3.0.8 → 3.0.11
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/{basic.cjs → designs.cjs} +35 -35
- package/dist/designs.cjs.map +1 -0
- package/dist/designs.d.ts +2 -0
- package/dist/{basic.js → designs.js} +1088 -1094
- package/dist/designs.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/designs/react/index.d.ts +5 -8
- package/dist/src/designs/react/{basic/utils → utils}/group-messages-by-type.d.ts +1 -1
- package/dist/src/embedded/index.d.ts +11 -0
- package/dist/src/headless/core/api.d.ts +42 -16
- package/dist/src/headless/core/context/session.d.ts +28 -50
- package/dist/src/headless/core/sdk/schema.d.ts +80 -4
- package/dist/src/headless/core/types/WidgetConfig.d.ts +22 -9
- package/dist/src/headless/react/hooks/useDocumentDir.d.ts +2 -1
- package/dist/src/headless/react/hooks/useSession.d.ts +6 -0
- package/dist/{useUploadFiles-Cw8s18uG.js → useUploadFiles-B-HZXbPR.js} +3 -3
- package/dist/{useUploadFiles-Cw8s18uG.js.map → useUploadFiles-B-HZXbPR.js.map} +1 -1
- package/dist/{useUploadFiles-Bp-c5Nf9.cjs → useUploadFiles-WylOvupS.cjs} +2 -2
- package/dist/{useUploadFiles-Bp-c5Nf9.cjs.map → useUploadFiles-WylOvupS.cjs.map} +1 -1
- package/dist/widget-6i5ISSQC.cjs +2 -0
- package/dist/widget-6i5ISSQC.cjs.map +1 -0
- package/dist/{widget-BeNOCqB5.js → widget-BOaF1U-p.js} +128 -69
- package/dist/widget-BOaF1U-p.js.map +1 -0
- package/dist-embed/script.js +115 -115
- package/dist-embed/script.js.map +1 -1
- package/package.json +5 -5
- package/dist/basic.cjs.map +0 -1
- package/dist/basic.d.ts +0 -2
- package/dist/basic.js.map +0 -1
- package/dist/src/designs/react/basic/index.d.ts +0 -10
- package/dist/src/designs/react/basic/widget-interaction-tests/widget.test.d.ts +0 -1
- package/dist/src/designs/react/render.d.ts +0 -2
- package/dist/style.css +0 -1
- package/dist/widget-BeNOCqB5.js.map +0 -1
- package/dist/widget-DlAUwHzU.cjs +0 -2
- package/dist/widget-DlAUwHzU.cjs.map +0 -1
- /package/dist/src/designs/react/{basic/WidgetPopoverTrigger.d.ts → WidgetPopoverTrigger.d.ts} +0 -0
- /package/dist/src/designs/react/{basic/screens → screens}/chat-screen/ChatFooter.d.ts +0 -0
- /package/dist/src/designs/react/{basic/screens → screens}/chat-screen/ChatHeader.d.ts +0 -0
- /package/dist/src/designs/react/{basic/screens → screens}/chat-screen/ChatMain.d.ts +0 -0
- /package/dist/src/designs/react/{basic/screens → screens}/chat-screen/ChatScreen.d.ts +0 -0
- /package/dist/src/designs/react/{basic/screens → screens}/root-screen.d.ts +0 -0
- /package/dist/src/designs/react/{basic/screens → screens}/welcome-screen/WelcomeScreen.d.ts +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { default as React, ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
import { WidgetConfig } from '../../../headless/core';
|
|
3
|
-
declare function Widget({ className, opened, ...props }: ComponentPropsWithoutRef<"div"> & {
|
|
4
|
-
opened?: boolean;
|
|
5
|
-
}): React.JSX.Element;
|
|
6
|
-
declare function WidgetRoot({ options, children, }: {
|
|
7
|
-
options: WidgetConfig;
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
}): React.JSX.Element;
|
|
10
|
-
export { WidgetRoot, Widget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..700;1,14..32,100..700&display=swap";@import"https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap";[data-chat-widget] *,[data-chat-widget] :before,[data-chat-widget] :after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }[data-chat-widget] ::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }[data-chat-widget] *,[data-chat-widget] :before,[data-chat-widget] :after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}[data-chat-widget] :before,[data-chat-widget] :after{--tw-content: ""}[data-chat-widget] html,[data-chat-widget] :host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}[data-chat-widget] body{margin:0;line-height:inherit}[data-chat-widget] hr{height:0;color:inherit;border-top-width:1px}[data-chat-widget] abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}[data-chat-widget] h1,[data-chat-widget] h2,[data-chat-widget] h3,[data-chat-widget] h4,[data-chat-widget] h5,[data-chat-widget] h6{font-size:inherit;font-weight:inherit}[data-chat-widget] a{color:inherit;text-decoration:inherit}[data-chat-widget] b,[data-chat-widget] strong{font-weight:bolder}[data-chat-widget] code,[data-chat-widget] kbd,[data-chat-widget] samp,[data-chat-widget] 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}[data-chat-widget] small{font-size:80%}[data-chat-widget] sub,[data-chat-widget] sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}[data-chat-widget] sub{bottom:-.25em}[data-chat-widget] sup{top:-.5em}[data-chat-widget] table{text-indent:0;border-color:inherit;border-collapse:collapse}[data-chat-widget] button,[data-chat-widget] input,[data-chat-widget] optgroup,[data-chat-widget] select,[data-chat-widget] 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}[data-chat-widget] button,[data-chat-widget] select{text-transform:none}[data-chat-widget] button,[data-chat-widget] input:where([type=button]),[data-chat-widget] input:where([type=reset]),[data-chat-widget] input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}[data-chat-widget] :-moz-focusring{outline:auto}[data-chat-widget] :-moz-ui-invalid{box-shadow:none}[data-chat-widget] progress{vertical-align:baseline}[data-chat-widget] ::-webkit-inner-spin-button,[data-chat-widget] ::-webkit-outer-spin-button{height:auto}[data-chat-widget] [type=search]{-webkit-appearance:textfield;outline-offset:-2px}[data-chat-widget] ::-webkit-search-decoration{-webkit-appearance:none}[data-chat-widget] ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}[data-chat-widget] summary{display:list-item}[data-chat-widget] blockquote,[data-chat-widget] dl,[data-chat-widget] dd,[data-chat-widget] h1,[data-chat-widget] h2,[data-chat-widget] h3,[data-chat-widget] h4,[data-chat-widget] h5,[data-chat-widget] h6,[data-chat-widget] hr,[data-chat-widget] figure,[data-chat-widget] p,[data-chat-widget] pre{margin:0}[data-chat-widget] fieldset{margin:0;padding:0}[data-chat-widget] legend{padding:0}[data-chat-widget] ol,[data-chat-widget] ul,[data-chat-widget] menu{list-style:none;margin:0;padding:0}[data-chat-widget] dialog{padding:0}[data-chat-widget] textarea{resize:vertical}[data-chat-widget] input::-moz-placeholder,[data-chat-widget] textarea::-moz-placeholder{opacity:1;color:#9ca3af}[data-chat-widget] input::placeholder,[data-chat-widget] textarea::placeholder{opacity:1;color:#9ca3af}[data-chat-widget] button,[data-chat-widget] [role=button]{cursor:pointer}[data-chat-widget] :disabled{cursor:default}[data-chat-widget] img,[data-chat-widget] svg,[data-chat-widget] video,[data-chat-widget] canvas,[data-chat-widget] audio,[data-chat-widget] iframe,[data-chat-widget] embed,[data-chat-widget] object{display:block;vertical-align:middle}[data-chat-widget] img,[data-chat-widget] video{max-width:100%;height:auto}[data-chat-widget] [hidden]:where(:not([hidden=until-found])){display:none}[data-chat-widget] *{-ms-overflow-style:none;scrollbar-width:none}[data-chat-widget] *::-webkit-scrollbar{display:none}[data-chat-widget] *{border-color:hsl(var(--opencx-border))}[data-chat-widget] .container{width:100%}@media (min-width: 640px){[data-chat-widget] .container{max-width:640px}}@media (min-width: 768px){[data-chat-widget] .container{max-width:768px}}@media (min-width: 1024px){[data-chat-widget] .container{max-width:1024px}}@media (min-width: 1280px){[data-chat-widget] .container{max-width:1280px}}@media (min-width: 1536px){[data-chat-widget] .container{max-width:1536px}}[data-chat-widget] .prose{color:var(--tw-prose-body);max-width:65ch}[data-chat-widget] .prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}[data-chat-widget] .prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}[data-chat-widget] .prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}[data-chat-widget] .prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}[data-chat-widget] .prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}[data-chat-widget] .prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}[data-chat-widget] .prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}[data-chat-widget] .prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}[data-chat-widget] .prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}[data-chat-widget] .prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}[data-chat-widget] .prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}[data-chat-widget] .prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}[data-chat-widget] .prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}[data-chat-widget] .prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}[data-chat-widget] .prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}[data-chat-widget] .prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}[data-chat-widget] .prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}[data-chat-widget] .prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}[data-chat-widget] .prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}[data-chat-widget] .prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}[data-chat-widget] .prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}[data-chat-widget] .prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}[data-chat-widget] .prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}[data-chat-widget] .prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}[data-chat-widget] .prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}[data-chat-widget] .prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}[data-chat-widget] .prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}[data-chat-widget] .prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}[data-chat-widget] .prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}[data-chat-widget] .prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}[data-chat-widget] .prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}[data-chat-widget] .prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}[data-chat-widget] .prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}[data-chat-widget] .prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}[data-chat-widget] .prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}[data-chat-widget] .prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}[data-chat-widget] .prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}[data-chat-widget] .prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}[data-chat-widget] .prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}[data-chat-widget] .prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}[data-chat-widget] .prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}[data-chat-widget] .prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}[data-chat-widget] .prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}[data-chat-widget] .prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}[data-chat-widget] .prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}[data-chat-widget] .prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}[data-chat-widget] .prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}[data-chat-widget] .prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}[data-chat-widget] .prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}[data-chat-widget] .prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}[data-chat-widget] .prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}[data-chat-widget] .prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}[data-chat-widget] .prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}[data-chat-widget] .prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}[data-chat-widget] .prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}[data-chat-widget] .prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}[data-chat-widget] .prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}[data-chat-widget] .prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}[data-chat-widget] .prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}[data-chat-widget] .prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}[data-chat-widget] .prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}[data-chat-widget] .prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}[data-chat-widget] .prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}[data-chat-widget] .prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}[data-chat-widget] .prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}[data-chat-widget] .prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}[data-chat-widget] .prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}[data-chat-widget] .prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}[data-chat-widget] .prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}[data-chat-widget] .prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}[data-chat-widget] .prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}[data-chat-widget] .prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}[data-chat-widget] .prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}[data-chat-widget] .prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}[data-chat-widget] .prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}[data-chat-widget] .prose-sm{font-size:.875rem;line-height:1.7142857}[data-chat-widget] .prose-sm :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}[data-chat-widget] .prose-sm :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}[data-chat-widget] .prose-sm :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.3333333em;margin-bottom:1.3333333em;padding-inline-start:1.1111111em}[data-chat-widget] .prose-sm :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}[data-chat-widget] .prose-sm :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}[data-chat-widget] .prose-sm :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}[data-chat-widget] .prose-sm :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}[data-chat-widget] .prose-sm :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}[data-chat-widget] .prose-sm :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}[data-chat-widget] .prose-sm :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}[data-chat-widget] .prose-sm :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}[data-chat-widget] .prose-sm :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;border-radius:.3125rem;padding-top:.1428571em;padding-inline-end:.3571429em;padding-bottom:.1428571em;padding-inline-start:.3571429em}[data-chat-widget] .prose-sm :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em}[data-chat-widget] .prose-sm :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.9em}[data-chat-widget] .prose-sm :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8888889em}[data-chat-widget] .prose-sm :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}[data-chat-widget] .prose-sm :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}[data-chat-widget] .prose-sm :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}[data-chat-widget] .prose-sm :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;margin-bottom:.2857143em}[data-chat-widget] .prose-sm :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}[data-chat-widget] .prose-sm :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}[data-chat-widget] .prose-sm :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}[data-chat-widget] .prose-sm :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}[data-chat-widget] .prose-sm :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}[data-chat-widget] .prose-sm :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}[data-chat-widget] .prose-sm :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}[data-chat-widget] .prose-sm :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}[data-chat-widget] .prose-sm :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}[data-chat-widget] .prose-sm :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}[data-chat-widget] .prose-sm :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;padding-inline-start:1.5714286em}[data-chat-widget] .prose-sm :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.8571429em;margin-bottom:2.8571429em}[data-chat-widget] .prose-sm :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose-sm :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose-sm :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose-sm :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose-sm :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.5}[data-chat-widget] .prose-sm :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}[data-chat-widget] .prose-sm :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}[data-chat-widget] .prose-sm :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}[data-chat-widget] .prose-sm :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}[data-chat-widget] .prose-sm :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}[data-chat-widget] .prose-sm :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}[data-chat-widget] .prose-sm :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}[data-chat-widget] .prose-sm :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}[data-chat-widget] .prose-sm :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}[data-chat-widget] .prose-sm :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}[data-chat-widget] .prose-sm :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}[data-chat-widget] .prose-slate{--tw-prose-body: #334155;--tw-prose-headings: #0f172a;--tw-prose-lead: #475569;--tw-prose-links: #0f172a;--tw-prose-bold: #0f172a;--tw-prose-counters: #64748b;--tw-prose-bullets: #cbd5e1;--tw-prose-hr: #e2e8f0;--tw-prose-quotes: #0f172a;--tw-prose-quote-borders: #e2e8f0;--tw-prose-captions: #64748b;--tw-prose-kbd: #0f172a;--tw-prose-kbd-shadows: 15 23 42;--tw-prose-code: #0f172a;--tw-prose-pre-code: #e2e8f0;--tw-prose-pre-bg: #1e293b;--tw-prose-th-borders: #cbd5e1;--tw-prose-td-borders: #e2e8f0;--tw-prose-invert-body: #cbd5e1;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #94a3b8;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #94a3b8;--tw-prose-invert-bullets: #475569;--tw-prose-invert-hr: #334155;--tw-prose-invert-quotes: #f1f5f9;--tw-prose-invert-quote-borders: #334155;--tw-prose-invert-captions: #94a3b8;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #cbd5e1;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #475569;--tw-prose-invert-td-borders: #334155}[data-chat-widget] .pointer-events-none{pointer-events:none}[data-chat-widget] .visible{visibility:visible}[data-chat-widget] .static{position:static}[data-chat-widget] .fixed{position:fixed}[data-chat-widget] .absolute{position:absolute}[data-chat-widget] .relative{position:relative}[data-chat-widget] .inset-0{top:0;right:0;bottom:0;left:0}[data-chat-widget] .inset-x-0{left:0;right:0}[data-chat-widget] .bottom-0{bottom:0}[data-chat-widget] .bottom-2{bottom:.5rem}[data-chat-widget] .left-1\/2{left:50%}[data-chat-widget] .left-2{left:.5rem}[data-chat-widget] .isolate{isolation:isolate}[data-chat-widget] .z-10{z-index:10}[data-chat-widget] .z-50{z-index:50}[data-chat-widget] .z-\[24\]{z-index:24}[data-chat-widget] .z-\[25\]{z-index:25}[data-chat-widget] .-mx-1{margin-left:-.25rem;margin-right:-.25rem}[data-chat-widget] .my-1{margin-top:.25rem;margin-bottom:.25rem}[data-chat-widget] .mb-2{margin-bottom:.5rem}[data-chat-widget] .ml-auto{margin-left:auto}[data-chat-widget] .mt-2{margin-top:.5rem}[data-chat-widget] .line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}[data-chat-widget] .block{display:block}[data-chat-widget] .inline{display:inline}[data-chat-widget] .flex{display:flex}[data-chat-widget] .inline-flex{display:inline-flex}[data-chat-widget] .contents{display:contents}[data-chat-widget] .hidden{display:none}[data-chat-widget] .aspect-square{aspect-ratio:1 / 1}[data-chat-widget] .size-12{width:3rem;height:3rem}[data-chat-widget] .size-16{width:4rem;height:4rem}[data-chat-widget] .size-3{width:.75rem;height:.75rem}[data-chat-widget] .size-3\.5{width:.875rem;height:.875rem}[data-chat-widget] .size-4{width:1rem;height:1rem}[data-chat-widget] .size-6{width:1.5rem;height:1.5rem}[data-chat-widget] .size-8{width:2rem;height:2rem}[data-chat-widget] .size-fit{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content}[data-chat-widget] .size-full{width:100%;height:100%}[data-chat-widget] .h-10{height:2.5rem}[data-chat-widget] .h-11{height:2.75rem}[data-chat-widget] .h-2{height:.5rem}[data-chat-widget] .h-3\.5{height:.875rem}[data-chat-widget] .h-4{height:1rem}[data-chat-widget] .h-5{height:1.25rem}[data-chat-widget] .h-8{height:2rem}[data-chat-widget] .h-\[600px\]{height:600px}[data-chat-widget] .h-fit{height:-moz-fit-content;height:fit-content}[data-chat-widget] .h-full{height:100%}[data-chat-widget] .h-px{height:1px}[data-chat-widget] .max-h-\[600px\]{max-height:600px}[data-chat-widget] .max-h-full{max-height:100%}[data-chat-widget] .min-h-\[400px\]{min-height:400px}[data-chat-widget] .w-10{width:2.5rem}[data-chat-widget] .w-2{width:.5rem}[data-chat-widget] .w-2\/3{width:66.666667%}[data-chat-widget] .w-3\.5{width:.875rem}[data-chat-widget] .w-4{width:1rem}[data-chat-widget] .w-60{width:15rem}[data-chat-widget] .w-9{width:2.25rem}[data-chat-widget] .w-\[calc\(100\%-1rem\)\]{width:calc(100% - 1rem)}[data-chat-widget] .w-auto{width:auto}[data-chat-widget] .w-fit{width:-moz-fit-content;width:fit-content}[data-chat-widget] .w-full{width:100%}[data-chat-widget] .min-w-56{min-width:14rem}[data-chat-widget] .min-w-\[8rem\]{min-width:8rem}[data-chat-widget] .max-w-\[320px\]{max-width:320px}[data-chat-widget] .max-w-full{max-width:100%}[data-chat-widget] .max-w-xs{max-width:20rem}[data-chat-widget] .flex-1{flex:1 1 0%}[data-chat-widget] .shrink-0{flex-shrink:0}[data-chat-widget] .origin-bottom{transform-origin:bottom}[data-chat-widget] .translate-x-\[var\(--opencx-wobble-x\)\]{--tw-translate-x: var(--opencx-wobble-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .translate-y-\[var\(--opencx-wobble-y\)\]{--tw-translate-y: var(--opencx-wobble-y);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .scale-\[1\.01\]{--tw-scale-x: 1.01;--tw-scale-y: 1.01;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .scale-\[1\.1\]{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .scale-\[1\]{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}[data-chat-widget] .animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}[data-chat-widget] .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}[data-chat-widget] .animate-spin{animation:spin 1s linear infinite}[data-chat-widget] .cursor-default{cursor:default}[data-chat-widget] .cursor-not-allowed{cursor:not-allowed}[data-chat-widget] .cursor-pointer{cursor:pointer}[data-chat-widget] .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-chat-widget] .resize-none{resize:none}[data-chat-widget] .flex-row{flex-direction:row}[data-chat-widget] .flex-col{flex-direction:column}[data-chat-widget] .flex-wrap{flex-wrap:wrap}[data-chat-widget] .items-start{align-items:flex-start}[data-chat-widget] .items-end{align-items:flex-end}[data-chat-widget] .items-center{align-items:center}[data-chat-widget] .justify-start{justify-content:flex-start}[data-chat-widget] .justify-end{justify-content:flex-end}[data-chat-widget] .justify-center{justify-content:center}[data-chat-widget] .justify-between{justify-content:space-between}[data-chat-widget] .gap-0\.5{gap:.125rem}[data-chat-widget] .gap-1{gap:.25rem}[data-chat-widget] .gap-2{gap:.5rem}[data-chat-widget] .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))}[data-chat-widget] .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))}[data-chat-widget] .space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}[data-chat-widget] .self-end{align-self:flex-end}[data-chat-widget] .overflow-auto{overflow:auto}[data-chat-widget] .overflow-hidden{overflow:hidden}[data-chat-widget] .scroll-smooth{scroll-behavior:smooth}[data-chat-widget] .whitespace-nowrap{white-space:nowrap}[data-chat-widget] .rounded-2xl{border-radius:1rem}[data-chat-widget] .rounded-3xl{border-radius:1.5rem}[data-chat-widget] .rounded-full{border-radius:9999px}[data-chat-widget] .rounded-lg{border-radius:.5rem}[data-chat-widget] .rounded-md{border-radius:.375rem}[data-chat-widget] .rounded-sm{border-radius:.125rem}[data-chat-widget] .rounded-xl{border-radius:.75rem}[data-chat-widget] .rounded-bl-none{border-bottom-left-radius:0}[data-chat-widget] .border{border-width:1px}[data-chat-widget] .border-2{border-width:2px}[data-chat-widget] .border-b{border-bottom-width:1px}[data-chat-widget] .border-destructive{border-color:hsl(var(--opencx-destructive))}[data-chat-widget] .border-input{border-color:hsl(var(--opencx-input))}[data-chat-widget] .border-primary{border-color:hsl(var(--opencx-primary))}[data-chat-widget] .border-transparent{border-color:transparent}[data-chat-widget] .bg-background{background-color:hsl(var(--opencx-background))}[data-chat-widget] .bg-black\/50{background-color:#00000080}[data-chat-widget] .bg-destructive{background-color:hsl(var(--opencx-destructive))}[data-chat-widget] .bg-muted{background-color:hsl(var(--opencx-muted))}[data-chat-widget] .bg-primary{background-color:hsl(var(--opencx-primary))}[data-chat-widget] .bg-secondary{background-color:hsl(var(--opencx-secondary))}[data-chat-widget] .bg-transparent{background-color:transparent}[data-chat-widget] .bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}[data-chat-widget] .from-gray-100\/30{--tw-gradient-from: rgb(243 244 246 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(243 244 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}[data-chat-widget] .from-primary\/50{--tw-gradient-from: hsl(var(--opencx-primary) / .5) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--opencx-primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}[data-chat-widget] .via-primary{--tw-gradient-to: hsl(var(--opencx-primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--opencx-primary)) var(--tw-gradient-via-position), var(--tw-gradient-to)}[data-chat-widget] .to-gray-50\/30{--tw-gradient-to: rgb(249 250 251 / .3) var(--tw-gradient-to-position)}[data-chat-widget] .to-primary{--tw-gradient-to: hsl(var(--opencx-primary)) var(--tw-gradient-to-position)}[data-chat-widget] .fill-current{fill:currentColor}[data-chat-widget] .object-contain{-o-object-fit:contain;object-fit:contain}[data-chat-widget] .object-cover{-o-object-fit:cover;object-fit:cover}[data-chat-widget] .p-0{padding:0}[data-chat-widget] .p-1{padding:.25rem}[data-chat-widget] .p-2{padding:.5rem}[data-chat-widget] .p-3{padding:.75rem}[data-chat-widget] .p-4{padding:1rem}[data-chat-widget] .px-2{padding-left:.5rem;padding-right:.5rem}[data-chat-widget] .px-3{padding-left:.75rem;padding-right:.75rem}[data-chat-widget] .px-4{padding-left:1rem;padding-right:1rem}[data-chat-widget] .px-8{padding-left:2rem;padding-right:2rem}[data-chat-widget] .py-1\.5{padding-top:.375rem;padding-bottom:.375rem}[data-chat-widget] .py-12{padding-top:3rem;padding-bottom:3rem}[data-chat-widget] .py-2{padding-top:.5rem;padding-bottom:.5rem}[data-chat-widget] .pl-2{padding-left:.5rem}[data-chat-widget] .pl-3{padding-left:.75rem}[data-chat-widget] .pl-8{padding-left:2rem}[data-chat-widget] .pr-2{padding-right:.5rem}[data-chat-widget] .text-center{text-align:center}[data-chat-widget] .text-start{text-align:start}[data-chat-widget] .align-middle{vertical-align:middle}[data-chat-widget] .font-inter{font-family:Inter,Rubik,serif,sans-serif}[data-chat-widget] .text-2xl{font-size:1.5rem;line-height:2rem}[data-chat-widget] .text-\[10px\]{font-size:10px}[data-chat-widget] .text-sm{font-size:.875rem;line-height:1.25rem}[data-chat-widget] .text-xl{font-size:1.25rem;line-height:1.75rem}[data-chat-widget] .text-xs{font-size:.75rem;line-height:1rem}[data-chat-widget] .font-bold{font-weight:700}[data-chat-widget] .font-medium{font-weight:500}[data-chat-widget] .font-semibold{font-weight:600}[data-chat-widget] .leading-relaxed{line-height:1.625}[data-chat-widget] .leading-snug{line-height:1.375}[data-chat-widget] .leading-tight{line-height:1.25}[data-chat-widget] .tracking-widest{letter-spacing:.1em}[data-chat-widget] .text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}[data-chat-widget] .text-destructive{color:hsl(var(--opencx-destructive))}[data-chat-widget] .text-destructive-foreground{color:hsl(var(--opencx-destructive-foreground))}[data-chat-widget] .text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity))}[data-chat-widget] .text-foreground{color:hsl(var(--opencx-foreground))}[data-chat-widget] .text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}[data-chat-widget] .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}[data-chat-widget] .text-muted{color:hsl(var(--opencx-muted))}[data-chat-widget] .text-muted-foreground{color:hsl(var(--opencx-muted-foreground))}[data-chat-widget] .text-primary{color:hsl(var(--opencx-primary))}[data-chat-widget] .text-primary-foreground{color:hsl(var(--opencx-primary-foreground))}[data-chat-widget] .text-primary-foreground\/90{color:hsl(var(--opencx-primary-foreground) / .9)}[data-chat-widget] .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}[data-chat-widget] .text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity))}[data-chat-widget] .text-secondary-foreground{color:hsl(var(--opencx-secondary-foreground))}[data-chat-widget] .underline{text-decoration-line:underline}[data-chat-widget] .underline-offset-4{text-underline-offset:4px}[data-chat-widget] .antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-chat-widget] .opacity-0{opacity:0}[data-chat-widget] .opacity-50{opacity:.5}[data-chat-widget] .opacity-60{opacity:.6}[data-chat-widget] .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-chat-widget] .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)}[data-chat-widget] .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)}[data-chat-widget] .shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-chat-widget] .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)}[data-chat-widget] .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)}[data-chat-widget] .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}[data-chat-widget] .outline-none{outline:2px solid transparent;outline-offset:2px}[data-chat-widget] .outline{outline-style:solid}[data-chat-widget] .ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}[data-chat-widget] .ring-offset-background{--tw-ring-offset-color: hsl(var(--opencx-background))}[data-chat-widget] .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}[data-chat-widget] .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)}[data-chat-widget] .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-chat-widget] .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-chat-widget] .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}[data-chat-widget] .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[data-chat-widget] .ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}[data-chat-widget] .animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}[data-chat-widget] .fade-in-0{--tw-enter-opacity: 0}[data-chat-widget] .zoom-in-95{--tw-enter-scale: .95}[data-chat-widget] .ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}[data-chat-widget] .\[animation-delay\:-0\.15s\]{animation-delay:-.15s}[data-chat-widget] .\[animation-delay\:-0\.3s\]{animation-delay:-.3s}[data-chat-widget] .\[background\:radial-gradient\(50\%_50\%_at_50\%_100\%\,hsl\(var\(--opencx-primary-foreground\)\)_-75\%\,hsl\(var\(--opencx-primary\)\)_100\%\)\]{background:radial-gradient(50% 50% at 50% 100%,hsl(var(--opencx-primary-foreground)) -75%,hsl(var(--opencx-primary)))}[data-chat-widget] .required:after{content:" *";color:red}[data-chat-widget] .file\:border-0::file-selector-button{border-width:0px}[data-chat-widget] .file\:bg-transparent::file-selector-button{background-color:transparent}[data-chat-widget] .file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}[data-chat-widget] .file\:font-medium::file-selector-button{font-weight:500}[data-chat-widget] .file\:text-primary-foreground::file-selector-button{color:hsl(var(--opencx-primary-foreground))}[data-chat-widget] .placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--opencx-muted-foreground))}[data-chat-widget] .placeholder\:text-muted-foreground::placeholder{color:hsl(var(--opencx-muted-foreground))}[data-chat-widget] .hover\:bg-accent:hover{background-color:hsl(var(--opencx-accent))}[data-chat-widget] .hover\:bg-green-50\/50:hover{background-color:#f0fdf480}[data-chat-widget] .hover\:bg-red-50\/50:hover{background-color:#fef2f280}[data-chat-widget] .hover\:text-accent-foreground:hover{color:hsl(var(--opencx-accent-foreground))}[data-chat-widget] .hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}[data-chat-widget] .hover\:text-green-500:hover{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}[data-chat-widget] .hover\:text-primary:hover{color:hsl(var(--opencx-primary))}[data-chat-widget] .hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}[data-chat-widget] .hover\:underline:hover{text-decoration-line:underline}[data-chat-widget] .focus\:bg-accent:focus{background-color:hsl(var(--opencx-accent))}[data-chat-widget] .focus\:text-accent-foreground:focus{color:hsl(var(--opencx-accent-foreground))}[data-chat-widget] .focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}[data-chat-widget] .focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}[data-chat-widget] .focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--opencx-ring))}[data-chat-widget] .focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}[data-chat-widget] .focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--opencx-background))}[data-chat-widget] .active\:scale-90:active{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .active\:shadow-none:active{--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)}[data-chat-widget] .hover\:active\:scale-95:active:hover{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .disabled\:pointer-events-none:disabled{pointer-events:none}[data-chat-widget] .disabled\:cursor-not-allowed:disabled{cursor:not-allowed}[data-chat-widget] .disabled\:opacity-0:disabled{opacity:0}[data-chat-widget] .disabled\:opacity-50:disabled{opacity:.5}[data-chat-widget] .group:hover .group-hover\:opacity-100{opacity:1}[data-chat-widget] .group:hover .group-hover\:active\:scale-90:active,[data-chat-widget] .group:active .group-active\:scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}[data-chat-widget] .data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--opencx-primary))}[data-chat-widget] .data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--opencx-accent))}[data-chat-widget] .data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--opencx-input))}[data-chat-widget] .data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}[data-chat-widget] .data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}[data-chat-widget] .data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}[data-chat-widget] .data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}[data-chat-widget] .data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}[data-chat-widget] .data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}[data-chat-widget] .data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}[data-chat-widget] .data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}[data-chat-widget] .data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}[data-chat-widget] .data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}[data-chat-widget] .data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}[data-chat-widget] .prose-a\:underline :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-line:underline}[data-chat-widget] .prose-a\:decoration-primary :is(:where(a):not(:where([class~=not-prose],[class~=not-prose] *))){text-decoration-color:hsl(var(--opencx-primary))}[data-chat-widget] .rtl\:-scale-100:where([dir=rtl],[dir=rtl] *){--tw-scale-x: -1;--tw-scale-y: -1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}[data-chat-widget] .rtl\:flex-row-reverse:where([dir=rtl],[dir=rtl] *){flex-direction:row-reverse}[data-chat-widget] .rtl\:text-right:where([dir=rtl],[dir=rtl] *){text-align:right}[data-chat-widget] .rtl\:placeholder\:text-right:where([dir=rtl],[dir=rtl] *)::-moz-placeholder{text-align:right}[data-chat-widget] .rtl\:placeholder\:text-right:where([dir=rtl],[dir=rtl] *)::placeholder{text-align:right}[data-chat-widget] .\[\&_span\]\:size-1 span{width:.25rem;height:.25rem}[data-chat-widget] .\[\&_span\]\:bg-secondary-foreground span{background-color:hsl(var(--opencx-secondary-foreground))}[data-chat-widget] .\[\&_svg\]\:pointer-events-none svg{pointer-events:none}[data-chat-widget] .\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}[data-chat-widget] .\[\&_svg\]\:size-6 svg{width:1.5rem;height:1.5rem}[data-chat-widget] .\[\&_svg\]\:shrink-0 svg{flex-shrink:0}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget-BeNOCqB5.js","sources":["../src/headless/core/sdk/index.ts","../src/headless/core/api.ts","../src/headless/core/utils/PubSub.ts","../src/headless/core/context/contact.ts","../src/headless/core/utils/Poller.ts","../src/headless/core/utils/uuid.ts","../src/headless/core/context/session.ts","../src/headless/core/context/message.ts","../src/headless/core/context/widget.ts"],"sourcesContent":["import createClient, { type Middleware } from \"openapi-fetch\";\nimport type { paths } from \"./schema\";\nimport type { components } from \"./schema\";\n\ntype Options = {\n baseUrl: string;\n onRequest?: Middleware[\"onRequest\"];\n onResponse?: Middleware[\"onResponse\"];\n onError?: Middleware[\"onError\"];\n};\n\nconst defaultOnError: Middleware[\"onError\"] = (onErrorOptions) => {\n console.log(onErrorOptions.error);\n};\n\nexport const basicClient = (options: Options) => {\n const client = createClient<paths>({\n baseUrl: options.baseUrl,\n });\n\n const middlewares: Middleware = {\n onRequest: options.onRequest,\n onResponse: options.onResponse,\n onError: options.onError || defaultOnError,\n };\n\n client.use(middlewares);\n return client;\n};\n\nexport type Endpoint = keyof paths;\nexport type Dto = components[\"schemas\"];\n","import axios, { type AxiosInstance, type AxiosRequestConfig } from \"axios\";\nimport { type Dto, type Endpoint, basicClient } from \"./sdk\";\nimport type { WidgetConfig } from \"./types/WidgetConfig\";\nimport type { SendMessageDto, VoteInputDto } from \"./types/schemas\";\n\nexport class ApiCaller {\n private client: ReturnType<typeof basicClient>;\n private uploadFileClient: AxiosInstance;\n private config: WidgetConfig;\n\n constructor({\n config,\n }: {\n config: WidgetConfig;\n }) {\n this.config = config;\n const { baseUrl, headers } = this.constructClientOptions(\n config.contactToken,\n );\n this.client = this.createOpenAPIClient({ baseUrl, headers });\n this.uploadFileClient = this.createAxiosUploadClient({ baseUrl, headers });\n }\n\n private constructClientOptions = (token: string | null | undefined) => {\n const baseUrl = this.config.apiUrl || \"https://api.open.cx\";\n const headers = {\n \"X-Bot-Token\": this.config.token,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n Authorization: token ? `Bearer ${token}` : undefined,\n };\n\n return { baseUrl, headers };\n };\n\n private createOpenAPIClient = ({\n baseUrl,\n headers,\n }: ReturnType<typeof this.constructClientOptions>) => {\n return basicClient({\n baseUrl,\n onRequest: ({ request }) => {\n Object.entries(headers).forEach(([key, value]) => {\n if (value) {\n request.headers.set(key, value);\n }\n });\n },\n });\n };\n private createAxiosUploadClient = ({\n baseUrl,\n headers,\n }: ReturnType<typeof this.constructClientOptions>) => {\n const uploadPath = \"/backend/widget/v2/upload\" satisfies Endpoint;\n return axios.create({\n baseURL: `${baseUrl}${uploadPath}`,\n headers,\n });\n };\n\n setAuthToken = (token: string) => {\n const { baseUrl, headers } = this.constructClientOptions(token);\n this.client = this.createOpenAPIClient({ baseUrl, headers });\n this.uploadFileClient = this.createAxiosUploadClient({ baseUrl, headers });\n };\n\n widgetPrelude = async () => {\n return await this.client.GET(\"/backend/widget/v2/prelude\", {\n params: { header: { \"X-Bot-Token\": this.config.token } },\n });\n };\n\n sendMessage = async (body: SendMessageDto, abortSignal?: AbortSignal) => {\n return await this.client.POST(\"/backend/widget/v2/chat/send\", {\n body,\n signal: abortSignal,\n });\n };\n\n getSessionHistory = async ({\n sessionId,\n lastMessageTimestamp,\n abortSignal,\n }: {\n sessionId: string;\n lastMessageTimestamp?: string;\n abortSignal: AbortSignal;\n }) => {\n const query = lastMessageTimestamp ? { lastMessageTimestamp } : undefined;\n return await this.client.GET(\n \"/backend/widget/v2/session/history/{sessionId}\",\n { params: { path: { sessionId }, query }, signal: abortSignal },\n );\n };\n\n createUnverifiedContact = async (body: Dto[\"CreateUnverifiedContactDto\"]) => {\n return await this.client.POST(\n \"/backend/widget/v2/contact/create-unverified\",\n {\n params: { header: { \"x-bot-token\": this.config.token } },\n body,\n },\n );\n };\n\n createSession = async () => {\n return await this.client.POST(\"/backend/widget/v2/create-session\");\n };\n\n getSession = async ({\n sessionId,\n abortSignal,\n }: { sessionId: string; abortSignal: AbortSignal }) => {\n return await this.client.GET(\"/backend/widget/v2/session/{sessionId}\", {\n params: { path: { sessionId } },\n signal: abortSignal,\n });\n };\n\n uploadFile = async (\n file: {\n id: string;\n file: File;\n },\n config: Partial<AxiosRequestConfig> = {},\n ) => {\n const formData = new FormData();\n formData.append(\"file\", file.file);\n\n // Couldn't get this to work with the openapi client... dunno why...\n const { data } = await this.uploadFileClient.post<\n Dto[\"UploadWidgetFileResponseDto\"]\n >(\"\", formData, {\n headers: {\n \"Content-Type\": \"multipart/form-data\",\n },\n ...config,\n });\n return data;\n };\n\n vote = async (body: VoteInputDto) => {\n return await this.client.POST(\"/backend/widget/v2/chat/vote\", { body });\n };\n}\n","import isEqual from \"lodash.isequal\";\n\nexport type Subscriber<T> = (data: T) => void;\n\nexport enum LifecycleEvent {\n INIT = \"init\",\n STATE_CHANGE = \"stateChange\",\n BEFORE_UPDATE = \"beforeUpdate\",\n AFTER_UPDATE = \"afterUpdate\",\n DESTROY = \"destroy\",\n ERROR = \"error\",\n}\n\ntype LifecycleListener = (event: {\n type: LifecycleEvent;\n timestamp: number;\n data?: any;\n}) => void;\n\nexport class PubSub<S> {\n private subscribers = new Set<Subscriber<S>>();\n #state: S;\n private initialState: S;\n #lastUpdated: number | null;\n private lifecycleListeners: Map<LifecycleEvent, Set<LifecycleListener>> =\n new Map();\n\n constructor(state: S) {\n this.#state = state;\n this.initialState = state;\n this.#lastUpdated = Date.now();\n this.emitLifecycle(LifecycleEvent.INIT, { initialState: this.#state });\n }\n\n private emitLifecycle = (event: LifecycleEvent, data?: any) => {\n const listeners = this.lifecycleListeners.get(event);\n if (listeners) {\n const eventData = {\n type: event,\n timestamp: Date.now(),\n data,\n };\n listeners.forEach((listener) => {\n try {\n listener(eventData);\n } catch {\n // ignore error\n }\n });\n }\n };\n\n private notifySubscribers = (state: S) => {\n const subscribersArray = Array.from(this.subscribers);\n subscribersArray.forEach((callback) => {\n try {\n callback(state);\n } catch (error) {\n this.emitLifecycle(LifecycleEvent.ERROR, { error });\n }\n });\n };\n\n /**\n * Subscribe to state changes\n * @param callback Function to call when state changes\n * @returns Unsubscribe function\n */\n subscribe = (callback: Subscriber<S>): (() => void) => {\n this.subscribers.add(callback);\n // Don't call the callback immediately with current state\n return () => {\n this.subscribers.delete(callback);\n };\n };\n\n onLifecycle = (\n event: LifecycleEvent,\n listener: LifecycleListener,\n ): (() => void) => {\n if (!this.lifecycleListeners.has(event)) {\n this.lifecycleListeners.set(event, new Set());\n }\n const listeners = this.lifecycleListeners.get(event)!;\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size === 0) {\n this.lifecycleListeners.delete(event);\n }\n };\n };\n\n /** Get the current state */\n get = (): S => {\n return this.#state;\n };\n\n // TODO make this provide prev state\n /**\n * Set the state and notify subscribers if the state changes\n * @param newState The new state to set\n */\n set = (newState: S): void => {\n this.emitLifecycle(LifecycleEvent.BEFORE_UPDATE, {\n previousState: this.#state,\n nextState: newState,\n });\n\n if (!isEqual(this.#state, newState)) {\n this.#state = newState;\n this.#lastUpdated = Date.now();\n this.emitLifecycle(LifecycleEvent.STATE_CHANGE, { state: newState });\n this.notifySubscribers(newState);\n }\n\n this.emitLifecycle(LifecycleEvent.AFTER_UPDATE, { state: newState });\n };\n\n // TODO make this provide prev state\n setPartial = (_s: Partial<S>): void => {\n if (_s === undefined || _s === null) return;\n const newState = { ...this.#state, ..._s };\n this.set(newState);\n };\n\n /**\n * Clear all subscriptions\n */\n clear = (): void => {\n this.emitLifecycle(LifecycleEvent.DESTROY);\n this.subscribers = new Set(); // Create a new Set instead of just clearing\n this.lifecycleListeners = new Map();\n };\n\n reset = (): void => {\n this.set(this.initialState);\n };\n\n lastUpdated = (): number | null => {\n return this.#lastUpdated;\n };\n}\n","import { PubSub } from \"../utils/PubSub\";\nimport { ApiCaller } from \"../api\";\nimport { type WidgetConfig } from \"../types/WidgetConfig\";\nimport { type Dto } from \"../sdk\";\n\ntype ContactState = {\n contact: { token: string } | null;\n isCreatingUnverifiedContact: boolean;\n isErrorCreatingUnverifiedContact: boolean;\n};\n\nexport class ContactCtx {\n private config: WidgetConfig;\n private api: ApiCaller;\n state: PubSub<ContactState>;\n\n constructor({\n config,\n api,\n }: {\n api: ApiCaller;\n config: WidgetConfig;\n }) {\n this.config = config;\n this.api = api;\n\n this.state = new PubSub<ContactState>({\n contact: config.contactToken ? { token: config.contactToken } : null,\n isCreatingUnverifiedContact: false,\n isErrorCreatingUnverifiedContact: false,\n });\n\n if (!config.contactToken && !config.collectUserData) {\n this.autoCreateUnverifiedUser();\n }\n }\n\n shouldCollectData = (): boolean => {\n const currentState = this.state.get();\n\n if (!currentState.contact?.token && this.config.collectUserData) {\n return true;\n } else {\n return false;\n }\n };\n\n autoCreateUnverifiedUser = async () => {\n await this.createUnverifiedContact({\n name: this.config.user?.name || \"Anonymous\",\n email: this.config.user?.email,\n });\n };\n\n createUnverifiedContact = async (\n payload: Dto[\"CreateUnverifiedContactDto\"],\n ): Promise<void> => {\n try {\n this.state.setPartial({\n isCreatingUnverifiedContact: true,\n isErrorCreatingUnverifiedContact: false,\n });\n\n const { data } = await this.api.createUnverifiedContact(payload);\n if (data?.token) {\n this.state.setPartial({ contact: { token: data.token } });\n this.api.setAuthToken(data.token);\n } else {\n this.state.setPartial({ isErrorCreatingUnverifiedContact: true });\n }\n } finally {\n this.state.setPartial({ isCreatingUnverifiedContact: false });\n }\n };\n}\n","import { PubSub } from \"./PubSub\";\n\nexport type PollingState = {\n isPolling: boolean;\n isError: boolean;\n};\n\nexport class Poller {\n state = new PubSub<PollingState>({\n isPolling: false,\n isError: false,\n });\n private abortController = new AbortController();\n\n reset = () => {\n this.abortController.abort(\"Resetting poller\");\n this.stopPolling?.();\n this.stopPolling = null;\n };\n\n stopPolling: (() => void) | null = null;\n\n startPolling = (\n cb: (abortSignal: AbortSignal) => Promise<void>,\n interval: number,\n ) => {\n if (this.stopPolling) return;\n\n const timeouts: NodeJS.Timeout[] = [];\n\n const poll = async () => {\n this.abortController = new AbortController();\n this.state.setPartial({ isPolling: true });\n\n try {\n await cb(this.abortController.signal);\n } catch (error) {\n if (this.abortController.signal.aborted) {\n // If aborted, just return and do not schedule the nest poll\n return;\n } else {\n console.error(\"Failed to poll:\", error);\n this.state.setPartial({ isError: true });\n } \n } finally {\n this.state.setPartial({ isPolling: false });\n }\n\n // Another check to stop scheduling polls in case someone removes the early return in the catch above\n if (this.abortController.signal.aborted) {\n console.log(\"Poller aborted, not scheduling anymore\");\n } else {\n timeouts.push(setTimeout(poll, interval));\n }\n };\n\n poll();\n\n this.stopPolling = () => {\n timeouts.forEach(clearTimeout);\n this.state.reset();\n };\n };\n}\n","import { v4 as uuidv4 } from \"uuid\";\n\nexport function genUuid() {\n return uuidv4();\n}\n","import type { ApiCaller } from \"../api\";\nimport type { SessionDto } from \"../types/schemas\";\nimport { Poller } from \"../utils/Poller\";\nimport { PubSub } from \"../utils/PubSub\";\n\nexport class SessionCtx {\n private api: ApiCaller;\n private poller = new Poller();\n\n public state = new PubSub<{\n session: SessionDto | null;\n isCreatingSession: boolean;\n }>({\n session: null,\n isCreatingSession: false,\n });\n\n constructor(api: ApiCaller) {\n this.api = api;\n this.registerPolling();\n }\n\n /** Clears the session and stops polling */\n reset = async () => {\n this.state.reset();\n // The poller should automatically reset, since we're subscribed to the session state, and whenever it's null, the poller resets... but just in case, let's reset it here as well\n this.poller.reset();\n };\n\n registerPolling = () => {\n this.state.subscribe(({ session }) => {\n if (session?.id) {\n this.poller.startPolling(async (abortSignal) => {\n const { data } = await this.fetch(session.id, abortSignal);\n data && this.state.setPartial({ session: data });\n }, 1000);\n } else {\n this.poller.reset();\n }\n });\n };\n\n /**\n * Creates a new session\n * @returns The session\n */\n createSession = async () => {\n this.state.setPartial({ session: null, isCreatingSession: true });\n\n const { data: session, error } = await this.api.createSession();\n if (session) {\n this.state.setPartial({ session, isCreatingSession: false });\n return session;\n }\n\n console.error(\"Failed to create session:\", error);\n return null;\n };\n\n /**\n * Fetches the session from the API\n * @param id - The ID of the session to fetch\n * @returns The session\n */\n fetch = async (sessionId: string, abortSignal: AbortSignal) => {\n return this.api.getSession({ sessionId, abortSignal });\n };\n}\n","import { ApiCaller } from \"../api\";\nimport type { WidgetConfig } from \"../types/WidgetConfig\";\nimport type { SafeOmit, SomeOptional } from \"../types/helpers\";\nimport type { BotMessageType, MessageType, UserMessageType } from \"../types/messages\";\nimport type { MessageAttachmentType, MessageDto, SendMessageDto, SendMessageOutputDto } from \"../types/schemas\";\nimport { Poller } from \"../utils/Poller\";\nimport { PubSub } from \"../utils/PubSub\";\nimport { genUuid } from \"../utils/uuid\";\nimport { SessionCtx } from \"./session\";\n\nexport class MessageCtx {\n private config: WidgetConfig;\n private api: ApiCaller;\n private sessionCtx: SessionCtx;\n private poller = new Poller();\n\n public state = new PubSub<{\n messages: MessageType[];\n isSendingMessage: boolean;\n suggestedReplies: string[] | null;\n }>({\n messages: [],\n isSendingMessage: false,\n suggestedReplies: null,\n });\n\n private sendMessageAbortController = new AbortController();\n\n constructor({\n config,\n api,\n sessionCtx,\n }: { config: WidgetConfig; api: ApiCaller; sessionCtx: SessionCtx }) {\n this.config = config;\n this.api = api;\n this.sessionCtx = sessionCtx;\n\n this.registerPolling();\n }\n\n reset = () => {\n this.sendMessageAbortController.abort(\"Resetting chat\");\n this.state.reset();\n // The poller should automatically reset, since we're subscribed to the session state, and whenever it's null, the poller resets... but just in case, let's reset it here as well\n this.poller.reset();\n };\n\n registerPolling = () => {\n this.sessionCtx.state.subscribe(({ session }) => {\n if (session?.id) {\n this.poller.startPolling(async (abortSignal) => {\n await this.fetchAndSetHistory(session.id, abortSignal);\n }, 1000);\n } else {\n this.poller.reset();\n }\n });\n };\n\n sendMessage = async (\n input: SomeOptional<\n SafeOmit<SendMessageDto, \"bot_token\" | \"uuid\">,\n \"session_id\" | \"user\"\n >,\n ): Promise<void> => {\n this.sendMessageAbortController = new AbortController();\n /* ------------------------------------------------------ */\n /* Prevent sending while waiting for AI res */\n /* ------------------------------------------------------ */\n const isSending = this.state.get().isSendingMessage;\n const isAssignedToAI =\n this.sessionCtx.state.get().session?.assignee.kind === \"ai\";\n if (isSending && isAssignedToAI) {\n console.warn(\"Cannot send messages while awaiting AI response\");\n return;\n }\n\n /* ------------------------------------------------------ */\n /* Clear suggested replies */\n /* ------------------------------------------------------ */\n this.state.setPartial({ suggestedReplies: null });\n\n try {\n this.state.setPartial({ isSendingMessage: true });\n /* ------------------------------------------------------ */\n /* Optimistically add message to rendered messages */\n /* ------------------------------------------------------ */\n const userMessage = MessageCtx.toUserMessage(\n input.content,\n input.attachments || undefined,\n );\n const currentMessages = this.state.get().messages;\n this.state.setPartial({\n messages: [...currentMessages, userMessage],\n });\n\n /* ------------------------------------------------------ */\n /* Create session if not exists */\n /* ------------------------------------------------------ */\n if (!this.sessionCtx.state.get().session?.id) {\n const createdSession = await this.sessionCtx.createSession();\n\n // TODO: apply some retry logic here\n if (!createdSession) {\n console.error(\"Failed to create session\");\n return;\n }\n }\n const sessionId = this.sessionCtx.state.get().session?.id;\n if (!sessionId) return;\n\n /* ------------------------------------------------------ */\n /* Send and wait for bot response */\n /* ------------------------------------------------------ */\n const { data } = await this.api.sendMessage(\n {\n uuid: userMessage.id,\n bot_token: this.config.token,\n headers: this.config.headers,\n query_params: this.config.queryParams,\n session_id: sessionId,\n user: this.config.user,\n ...input,\n },\n this.sendMessageAbortController.signal,\n );\n\n if (data?.success) {\n /* ------------------------------------------------------ */\n /* Append bot reply if not fetched from polling */\n /* ------------------------------------------------------ */\n const botMessage = MessageCtx.toBotMessage(data);\n if (botMessage) {\n const prevMessages = this.state.get().messages;\n const shouldAppend = !prevMessages.some(\n (m) => m.id === botMessage.id,\n );\n if (!shouldAppend) return;\n this.state.setPartial({ messages: [...prevMessages, botMessage] });\n } else {\n /* ------------------------------------------------------ */\n /* Check if bot responded with suggested replies */\n /* ------------------------------------------------------ */\n if (data.options?.value && data.options?.value.length > 0) {\n this.state.setPartial({ suggestedReplies: data.options.value });\n }\n }\n } else {\n const errorMessage = MessageCtx.toErrorMessage(\n data?.error?.message || \"Unknown error occurred\",\n );\n const currentMessages = this.state.get().messages;\n this.state.setPartial({\n messages: [...currentMessages, errorMessage],\n });\n }\n } catch (error) {\n if (!this.sendMessageAbortController.signal.aborted) {\n console.error(\"Failed to send message:\", error);\n }\n } finally {\n this.state.setPartial({ isSendingMessage: false });\n }\n };\n\n fetchAndSetHistory = async (\n sessionId: string,\n abortSignal: AbortSignal,\n ): Promise<void> => {\n const lastMessageTimestamp = this.state.get().messages.at(-1)?.timestamp;\n\n const { data: response } = await this.api.getSessionHistory({\n sessionId,\n lastMessageTimestamp,\n abortSignal,\n });\n\n if (response && response.length > 0) {\n // Get a fresh reference to current messages after the poll is done\n const prevMessages = this.state.get().messages;\n const newMessages = response\n .map(MessageCtx.mapHistoryToMessage)\n .filter(\n (newMsg) =>\n !prevMessages.some((existingMsg) => existingMsg.id === newMsg.id),\n );\n this.state.setPartial({\n messages: [...prevMessages, ...newMessages],\n });\n\n // if (newMessages.length > 0) {\n // // const playSoundEffects = config?.settings?.playSoundEffects;\n // // Play notification sound for new messages if enabled\n // // if (\n // // playSoundEffects &&\n // // platform?.audio &&\n // // isAudioAvailable(platform.audio)\n // // ) {\n // // const botMessages = newMessages.filter(\n // // (msg) => msg.type === \"FROM_BOT\",\n // // );\n // // if (botMessages.length > 0) {\n // // await safeAudioOperation(\n // // () => platform.audio!.playNotification(),\n // // \"Failed to play notification sound for new messages\",\n // // );\n // // }\n // // }\n\n // }\n }\n };\n\n /** Not the best name but whatever */\n static mapHistoryToMessage(history: MessageDto): MessageType {\n const commonFields = {\n id: history.publicId,\n timestamp: history.sentAt || \"\",\n attachments: history.attachments || undefined,\n };\n\n if (history.sender.kind === \"user\") {\n return {\n ...commonFields,\n type: \"FROM_USER\",\n content: history.content.text || \"\",\n deliveredAt: history.sentAt || \"\",\n };\n }\n\n if (history.sender.kind === \"agent\") {\n return {\n ...commonFields,\n type: \"FROM_AGENT\",\n component: \"agent_message\",\n data: {\n message: history.content.text || \"\",\n },\n };\n }\n\n return {\n ...commonFields,\n type: \"FROM_BOT\",\n component: \"bot_message\",\n agent: {\n id: null,\n name: history.sender.name || \"\",\n isAi: history.sender.kind === \"ai\",\n avatar: history.sender.avatar || null,\n },\n data: {\n message: history.content.text,\n },\n };\n }\n\n static toUserMessage(\n content: string,\n attachments?: MessageAttachmentType[],\n ): UserMessageType {\n return {\n id: genUuid(),\n type: \"FROM_USER\",\n content,\n deliveredAt: new Date().toISOString(),\n attachments,\n timestamp: new Date().toISOString(),\n };\n }\n\n static toBotMessage(response: SendMessageOutputDto): BotMessageType | null {\n if (response.success && response.autopilotResponse) {\n return {\n type: \"FROM_BOT\",\n id: response.autopilotResponse.id || genUuid(),\n timestamp: new Date().toISOString(),\n component: \"bot_message\",\n data: {\n message: response.autopilotResponse.value.content,\n },\n };\n }\n\n if (response.success && response.uiResponse) {\n const uiVal = response.uiResponse.value;\n return {\n type: \"FROM_BOT\" as const,\n id: genUuid(),\n timestamp: new Date().toISOString(),\n component: uiVal.name,\n data: uiVal.request_response,\n };\n }\n\n return null;\n }\n\n static toErrorMessage(message: string) {\n return {\n type: \"FROM_BOT\" as const,\n id: genUuid(),\n timestamp: new Date().toISOString(),\n component: \"TEXT\",\n data: {\n message,\n variant: \"error\",\n },\n };\n }\n}\n","import { ApiCaller } from \"../api\";\nimport type { WidgetConfig } from \"../types/WidgetConfig\";\nimport { ContactCtx } from \"./contact\";\nimport { MessageCtx } from \"./message\";\nimport { SessionCtx } from \"./session\";\n\nexport class WidgetCtx {\n public config: WidgetConfig;\n public api: ApiCaller;\n public contactCtx: ContactCtx;\n public sessionCtx: SessionCtx;\n public messageCtx: MessageCtx;\n\n constructor({ config }: { config: WidgetConfig }) {\n this.config = config;\n this.api = new ApiCaller({ config });\n\n this.contactCtx = new ContactCtx({\n api: this.api,\n config: this.config,\n });\n\n this.sessionCtx = new SessionCtx(this.api);\n this.messageCtx = new MessageCtx({\n config: this.config,\n api: this.api,\n sessionCtx: this.sessionCtx,\n });\n }\n\n resetChat = () => {\n this.sessionCtx.reset();\n this.messageCtx.reset();\n };\n}\n"],"names":["defaultOnError","onErrorOptions","basicClient","options","client","createClient","middlewares","ApiCaller","config","__publicField","token","baseUrl","headers","request","key","value","axios","body","abortSignal","sessionId","lastMessageTimestamp","query","file","formData","data","PubSub","state","__privateAdd","_state","_lastUpdated","event","listeners","eventData","listener","callback","error","__privateGet","newState","isEqual","__privateSet","_s","ContactCtx","api","_a","_b","payload","Poller","cb","interval","timeouts","poll","genUuid","uuidv4","SessionCtx","session","MessageCtx","sessionCtx","input","isSending","isAssignedToAI","userMessage","currentMessages","_c","botMessage","prevMessages","m","_d","_e","errorMessage","_f","response","newMessages","newMsg","existingMsg","history","commonFields","content","attachments","uiVal","message","WidgetCtx"],"mappings":";;;;;;;;;;;AAWA,MAAMA,IAAwC,CAACC,MAAmB;AACxD,UAAA,IAAIA,EAAe,KAAK;AAClC,GAEaC,IAAc,CAACC,MAAqB;AAC/C,QAAMC,IAASC,EAAoB;AAAA,IACjC,SAASF,EAAQ;AAAA,EAAA,CAClB,GAEKG,IAA0B;AAAA,IAC9B,WAAWH,EAAQ;AAAA,IACnB,YAAYA,EAAQ;AAAA,IACpB,SAASA,EAAQ,WAAWH;AAAA,EAAA;AAG9B,SAAAI,EAAO,IAAIE,CAAW,GACfF;AACT;ACvBO,MAAMG,EAAU;AAAA,EAKrB,YAAY;AAAA,IACV,QAAAC;AA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
"use strict";var x=Object.defineProperty;var A=a=>{throw TypeError(a)};var O=(a,e,t)=>e in a?x(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var s=(a,e,t)=>O(a,typeof e!="symbol"?e+"":e,t),U=(a,e,t)=>e.has(a)||A("Cannot "+t);var c=(a,e,t)=>(U(a,e,"read from private field"),t?t.call(a):e.get(a)),S=(a,e,t)=>e.has(a)?A("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t),p=(a,e,t,i)=>(U(a,e,"write to private field"),i?i.call(a,t):e.set(a,t),t);const R=require("axios"),E=require("openapi-fetch"),F=require("lodash.isequal"),L=require("uuid"),D=a=>{console.log(a.error)},I=a=>{const e=E({baseUrl:a.baseUrl}),t={onRequest:a.onRequest,onResponse:a.onResponse,onError:a.onError||D};return e.use(t),e};class q{constructor({config:e}){s(this,"client");s(this,"uploadFileClient");s(this,"config");s(this,"constructClientOptions",e=>{const t=this.config.apiUrl||"https://api.open.cx",i={"X-Bot-Token":this.config.token,"Content-Type":"application/json",Accept:"application/json",Authorization:e?`Bearer ${e}`:void 0};return{baseUrl:t,headers:i}});s(this,"createOpenAPIClient",({baseUrl:e,headers:t})=>I({baseUrl:e,onRequest:({request:i})=>{Object.entries(t).forEach(([n,r])=>{r&&i.headers.set(n,r)})}}));s(this,"createAxiosUploadClient",({baseUrl:e,headers:t})=>R.create({baseURL:`${e}/backend/widget/v2/upload`,headers:t}));s(this,"setAuthToken",e=>{const{baseUrl:t,headers:i}=this.constructClientOptions(e);this.client=this.createOpenAPIClient({baseUrl:t,headers:i}),this.uploadFileClient=this.createAxiosUploadClient({baseUrl:t,headers:i})});s(this,"widgetPrelude",async()=>await this.client.GET("/backend/widget/v2/prelude",{params:{header:{"X-Bot-Token":this.config.token}}}));s(this,"sendMessage",async(e,t)=>await this.client.POST("/backend/widget/v2/chat/send",{body:e,signal:t}));s(this,"getSessionHistory",async({sessionId:e,lastMessageTimestamp:t,abortSignal:i})=>{const n=t?{lastMessageTimestamp:t}:void 0;return await this.client.GET("/backend/widget/v2/session/history/{sessionId}",{params:{path:{sessionId:e},query:n},signal:i})});s(this,"createUnverifiedContact",async e=>await this.client.POST("/backend/widget/v2/contact/create-unverified",{params:{header:{"x-bot-token":this.config.token}},body:e}));s(this,"createSession",async()=>await this.client.POST("/backend/widget/v2/create-session"));s(this,"getSession",async({sessionId:e,abortSignal:t})=>await this.client.GET("/backend/widget/v2/session/{sessionId}",{params:{path:{sessionId:e}},signal:t}));s(this,"uploadFile",async(e,t={})=>{const i=new FormData;i.append("file",e.file);const{data:n}=await this.uploadFileClient.post("",i,{headers:{"Content-Type":"multipart/form-data"},...t});return n});s(this,"vote",async e=>await this.client.POST("/backend/widget/v2/chat/vote",{body:e}));this.config=e;const{baseUrl:t,headers:i}=this.constructClientOptions(e.contactToken);this.client=this.createOpenAPIClient({baseUrl:t,headers:i}),this.uploadFileClient=this.createAxiosUploadClient({baseUrl:t,headers:i})}}var l,g;class f{constructor(e){s(this,"subscribers",new Set);S(this,l);s(this,"initialState");S(this,g);s(this,"lifecycleListeners",new Map);s(this,"emitLifecycle",(e,t)=>{const i=this.lifecycleListeners.get(e);if(i){const n={type:e,timestamp:Date.now(),data:t};i.forEach(r=>{try{r(n)}catch{}})}});s(this,"notifySubscribers",e=>{Array.from(this.subscribers).forEach(i=>{try{i(e)}catch(n){this.emitLifecycle("error",{error:n})}})});s(this,"subscribe",e=>(this.subscribers.add(e),()=>{this.subscribers.delete(e)}));s(this,"onLifecycle",(e,t)=>{this.lifecycleListeners.has(e)||this.lifecycleListeners.set(e,new Set);const i=this.lifecycleListeners.get(e);return i.add(t),()=>{i.delete(t),i.size===0&&this.lifecycleListeners.delete(e)}});s(this,"get",()=>c(this,l));s(this,"set",e=>{this.emitLifecycle("beforeUpdate",{previousState:c(this,l),nextState:e}),F(c(this,l),e)||(p(this,l,e),p(this,g,Date.now()),this.emitLifecycle("stateChange",{state:e}),this.notifySubscribers(e)),this.emitLifecycle("afterUpdate",{state:e})});s(this,"setPartial",e=>{if(e==null)return;const t={...c(this,l),...e};this.set(t)});s(this,"clear",()=>{this.emitLifecycle("destroy"),this.subscribers=new Set,this.lifecycleListeners=new Map});s(this,"reset",()=>{this.set(this.initialState)});s(this,"lastUpdated",()=>c(this,g));p(this,l,e),this.initialState=e,p(this,g,Date.now()),this.emitLifecycle("init",{initialState:c(this,l)})}}l=new WeakMap,g=new WeakMap;class B{constructor({config:e,api:t}){s(this,"config");s(this,"api");s(this,"state");s(this,"shouldCollectData",()=>{var t;return!!(!((t=this.state.get().contact)!=null&&t.token)&&this.config.collectUserData)});s(this,"autoCreateUnverifiedUser",async()=>{var e,t;await this.createUnverifiedContact({name:((e=this.config.user)==null?void 0:e.name)||"Anonymous",email:(t=this.config.user)==null?void 0:t.email})});s(this,"createUnverifiedContact",async e=>{try{this.state.setPartial({isCreatingUnverifiedContact:!0,isErrorCreatingUnverifiedContact:!1});const{data:t}=await this.api.createUnverifiedContact(e);t!=null&&t.token?(this.state.setPartial({contact:{token:t.token}}),this.api.setAuthToken(t.token)):this.state.setPartial({isErrorCreatingUnverifiedContact:!0})}finally{this.state.setPartial({isCreatingUnverifiedContact:!1})}});this.config=e,this.api=t,this.state=new f({contact:e.contactToken?{token:e.contactToken}:null,isCreatingUnverifiedContact:!1,isErrorCreatingUnverifiedContact:!1}),!e.contactToken&&!e.collectUserData&&this.autoCreateUnverifiedUser()}}class M{constructor(){s(this,"state",new f({isPolling:!1,isError:!1}));s(this,"abortController",new AbortController);s(this,"reset",()=>{var e;this.abortController.abort("Resetting poller"),(e=this.stopPolling)==null||e.call(this),this.stopPolling=null});s(this,"stopPolling",null);s(this,"startPolling",(e,t)=>{if(this.stopPolling)return;const i=[],n=async()=>{this.abortController=new AbortController,this.state.setPartial({isPolling:!0});try{await e(this.abortController.signal)}catch(r){if(this.abortController.signal.aborted)return;console.error("Failed to poll:",r),this.state.setPartial({isError:!0})}finally{this.state.setPartial({isPolling:!1})}this.abortController.signal.aborted?console.log("Poller aborted, not scheduling anymore"):i.push(setTimeout(n,t))};n(),this.stopPolling=()=>{i.forEach(clearTimeout),this.state.reset()}})}}function P(){return L.v4()}class _{constructor(e){s(this,"api");s(this,"poller",new M);s(this,"state",new f({session:null,isCreatingSession:!1}));s(this,"reset",async()=>{this.state.reset(),this.poller.reset()});s(this,"registerPolling",()=>{this.state.subscribe(({session:e})=>{e!=null&&e.id?this.poller.startPolling(async t=>{const{data:i}=await this.fetch(e.id,t);i&&this.state.setPartial({session:i})},1e3):this.poller.reset()})});s(this,"createSession",async()=>{this.state.setPartial({session:null,isCreatingSession:!0});const{data:e,error:t}=await this.api.createSession();return e?(this.state.setPartial({session:e,isCreatingSession:!1}),e):(console.error("Failed to create session:",t),null)});s(this,"fetch",async(e,t)=>this.api.getSession({sessionId:e,abortSignal:t}));this.api=e,this.registerPolling()}}class d{constructor({config:e,api:t,sessionCtx:i}){s(this,"config");s(this,"api");s(this,"sessionCtx");s(this,"poller",new M);s(this,"state",new f({messages:[],isSendingMessage:!1,suggestedReplies:null}));s(this,"sendMessageAbortController",new AbortController);s(this,"reset",()=>{this.sendMessageAbortController.abort("Resetting chat"),this.state.reset(),this.poller.reset()});s(this,"registerPolling",()=>{this.sessionCtx.state.subscribe(({session:e})=>{e!=null&&e.id?this.poller.startPolling(async t=>{await this.fetchAndSetHistory(e.id,t)},1e3):this.poller.reset()})});s(this,"sendMessage",async e=>{var n,r,u,m,C,b;this.sendMessageAbortController=new AbortController;const t=this.state.get().isSendingMessage,i=((n=this.sessionCtx.state.get().session)==null?void 0:n.assignee.kind)==="ai";if(t&&i){console.warn("Cannot send messages while awaiting AI response");return}this.state.setPartial({suggestedReplies:null});try{this.state.setPartial({isSendingMessage:!0});const y=d.toUserMessage(e.content,e.attachments||void 0),k=this.state.get().messages;if(this.state.setPartial({messages:[...k,y]}),!((r=this.sessionCtx.state.get().session)!=null&&r.id)&&!await this.sessionCtx.createSession()){console.error("Failed to create session");return}const v=(u=this.sessionCtx.state.get().session)==null?void 0:u.id;if(!v)return;const{data:o}=await this.api.sendMessage({uuid:y.id,bot_token:this.config.token,headers:this.config.headers,query_params:this.config.queryParams,session_id:v,user:this.config.user,...e},this.sendMessageAbortController.signal);if(o!=null&&o.success){const h=d.toBotMessage(o);if(h){const w=this.state.get().messages;if(!!w.some(T=>T.id===h.id))return;this.state.setPartial({messages:[...w,h]})}else(m=o.options)!=null&&m.value&&((C=o.options)==null?void 0:C.value.length)>0&&this.state.setPartial({suggestedReplies:o.options.value})}else{const h=d.toErrorMessage(((b=o==null?void 0:o.error)==null?void 0:b.message)||"Unknown error occurred"),w=this.state.get().messages;this.state.setPartial({messages:[...w,h]})}}catch(y){this.sendMessageAbortController.signal.aborted||console.error("Failed to send message:",y)}finally{this.state.setPartial({isSendingMessage:!1})}});s(this,"fetchAndSetHistory",async(e,t)=>{var r;const i=(r=this.state.get().messages.at(-1))==null?void 0:r.timestamp,{data:n}=await this.api.getSessionHistory({sessionId:e,lastMessageTimestamp:i,abortSignal:t});if(n&&n.length>0){const u=this.state.get().messages,m=n.map(d.mapHistoryToMessage).filter(C=>!u.some(b=>b.id===C.id));this.state.setPartial({messages:[...u,...m]})}});this.config=e,this.api=t,this.sessionCtx=i,this.registerPolling()}static mapHistoryToMessage(e){const t={id:e.publicId,timestamp:e.sentAt||"",attachments:e.attachments||void 0};return e.sender.kind==="user"?{...t,type:"FROM_USER",content:e.content.text||"",deliveredAt:e.sentAt||""}:e.sender.kind==="agent"?{...t,type:"FROM_AGENT",component:"agent_message",data:{message:e.content.text||""}}:{...t,type:"FROM_BOT",component:"bot_message",agent:{id:null,name:e.sender.name||"",isAi:e.sender.kind==="ai",avatar:e.sender.avatar||null},data:{message:e.content.text}}}static toUserMessage(e,t){return{id:P(),type:"FROM_USER",content:e,deliveredAt:new Date().toISOString(),attachments:t,timestamp:new Date().toISOString()}}static toBotMessage(e){if(e.success&&e.autopilotResponse)return{type:"FROM_BOT",id:e.autopilotResponse.id||P(),timestamp:new Date().toISOString(),component:"bot_message",data:{message:e.autopilotResponse.value.content}};if(e.success&&e.uiResponse){const t=e.uiResponse.value;return{type:"FROM_BOT",id:P(),timestamp:new Date().toISOString(),component:t.name,data:t.request_response}}return null}static toErrorMessage(e){return{type:"FROM_BOT",id:P(),timestamp:new Date().toISOString(),component:"TEXT",data:{message:e,variant:"error"}}}}class H{constructor({config:e}){s(this,"config");s(this,"api");s(this,"contactCtx");s(this,"sessionCtx");s(this,"messageCtx");s(this,"resetChat",()=>{this.sessionCtx.reset(),this.messageCtx.reset()});this.config=e,this.api=new q({config:e}),this.contactCtx=new B({api:this.api,config:this.config}),this.sessionCtx=new _(this.api),this.messageCtx=new d({config:this.config,api:this.api,sessionCtx:this.sessionCtx})}}exports.PubSub=f;exports.WidgetCtx=H;
|
|
2
|
-
//# sourceMappingURL=widget-DlAUwHzU.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget-DlAUwHzU.cjs","sources":["../src/headless/core/sdk/index.ts","../src/headless/core/api.ts","../src/headless/core/utils/PubSub.ts","../src/headless/core/context/contact.ts","../src/headless/core/utils/Poller.ts","../src/headless/core/utils/uuid.ts","../src/headless/core/context/session.ts","../src/headless/core/context/message.ts","../src/headless/core/context/widget.ts"],"sourcesContent":["import createClient, { type Middleware } from \"openapi-fetch\";\nimport type { paths } from \"./schema\";\nimport type { components } from \"./schema\";\n\ntype Options = {\n baseUrl: string;\n onRequest?: Middleware[\"onRequest\"];\n onResponse?: Middleware[\"onResponse\"];\n onError?: Middleware[\"onError\"];\n};\n\nconst defaultOnError: Middleware[\"onError\"] = (onErrorOptions) => {\n console.log(onErrorOptions.error);\n};\n\nexport const basicClient = (options: Options) => {\n const client = createClient<paths>({\n baseUrl: options.baseUrl,\n });\n\n const middlewares: Middleware = {\n onRequest: options.onRequest,\n onResponse: options.onResponse,\n onError: options.onError || defaultOnError,\n };\n\n client.use(middlewares);\n return client;\n};\n\nexport type Endpoint = keyof paths;\nexport type Dto = components[\"schemas\"];\n","import axios, { type AxiosInstance, type AxiosRequestConfig } from \"axios\";\nimport { type Dto, type Endpoint, basicClient } from \"./sdk\";\nimport type { WidgetConfig } from \"./types/WidgetConfig\";\nimport type { SendMessageDto, VoteInputDto } from \"./types/schemas\";\n\nexport class ApiCaller {\n private client: ReturnType<typeof basicClient>;\n private uploadFileClient: AxiosInstance;\n private config: WidgetConfig;\n\n constructor({\n config,\n }: {\n config: WidgetConfig;\n }) {\n this.config = config;\n const { baseUrl, headers } = this.constructClientOptions(\n config.contactToken,\n );\n this.client = this.createOpenAPIClient({ baseUrl, headers });\n this.uploadFileClient = this.createAxiosUploadClient({ baseUrl, headers });\n }\n\n private constructClientOptions = (token: string | null | undefined) => {\n const baseUrl = this.config.apiUrl || \"https://api.open.cx\";\n const headers = {\n \"X-Bot-Token\": this.config.token,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n Authorization: token ? `Bearer ${token}` : undefined,\n };\n\n return { baseUrl, headers };\n };\n\n private createOpenAPIClient = ({\n baseUrl,\n headers,\n }: ReturnType<typeof this.constructClientOptions>) => {\n return basicClient({\n baseUrl,\n onRequest: ({ request }) => {\n Object.entries(headers).forEach(([key, value]) => {\n if (value) {\n request.headers.set(key, value);\n }\n });\n },\n });\n };\n private createAxiosUploadClient = ({\n baseUrl,\n headers,\n }: ReturnType<typeof this.constructClientOptions>) => {\n const uploadPath = \"/backend/widget/v2/upload\" satisfies Endpoint;\n return axios.create({\n baseURL: `${baseUrl}${uploadPath}`,\n headers,\n });\n };\n\n setAuthToken = (token: string) => {\n const { baseUrl, headers } = this.constructClientOptions(token);\n this.client = this.createOpenAPIClient({ baseUrl, headers });\n this.uploadFileClient = this.createAxiosUploadClient({ baseUrl, headers });\n };\n\n widgetPrelude = async () => {\n return await this.client.GET(\"/backend/widget/v2/prelude\", {\n params: { header: { \"X-Bot-Token\": this.config.token } },\n });\n };\n\n sendMessage = async (body: SendMessageDto, abortSignal?: AbortSignal) => {\n return await this.client.POST(\"/backend/widget/v2/chat/send\", {\n body,\n signal: abortSignal,\n });\n };\n\n getSessionHistory = async ({\n sessionId,\n lastMessageTimestamp,\n abortSignal,\n }: {\n sessionId: string;\n lastMessageTimestamp?: string;\n abortSignal: AbortSignal;\n }) => {\n const query = lastMessageTimestamp ? { lastMessageTimestamp } : undefined;\n return await this.client.GET(\n \"/backend/widget/v2/session/history/{sessionId}\",\n { params: { path: { sessionId }, query }, signal: abortSignal },\n );\n };\n\n createUnverifiedContact = async (body: Dto[\"CreateUnverifiedContactDto\"]) => {\n return await this.client.POST(\n \"/backend/widget/v2/contact/create-unverified\",\n {\n params: { header: { \"x-bot-token\": this.config.token } },\n body,\n },\n );\n };\n\n createSession = async () => {\n return await this.client.POST(\"/backend/widget/v2/create-session\");\n };\n\n getSession = async ({\n sessionId,\n abortSignal,\n }: { sessionId: string; abortSignal: AbortSignal }) => {\n return await this.client.GET(\"/backend/widget/v2/session/{sessionId}\", {\n params: { path: { sessionId } },\n signal: abortSignal,\n });\n };\n\n uploadFile = async (\n file: {\n id: string;\n file: File;\n },\n config: Partial<AxiosRequestConfig> = {},\n ) => {\n const formData = new FormData();\n formData.append(\"file\", file.file);\n\n // Couldn't get this to work with the openapi client... dunno why...\n const { data } = await this.uploadFileClient.post<\n Dto[\"UploadWidgetFileResponseDto\"]\n >(\"\", formData, {\n headers: {\n \"Content-Type\": \"multipart/form-data\",\n },\n ...config,\n });\n return data;\n };\n\n vote = async (body: VoteInputDto) => {\n return await this.client.POST(\"/backend/widget/v2/chat/vote\", { body });\n };\n}\n","import isEqual from \"lodash.isequal\";\n\nexport type Subscriber<T> = (data: T) => void;\n\nexport enum LifecycleEvent {\n INIT = \"init\",\n STATE_CHANGE = \"stateChange\",\n BEFORE_UPDATE = \"beforeUpdate\",\n AFTER_UPDATE = \"afterUpdate\",\n DESTROY = \"destroy\",\n ERROR = \"error\",\n}\n\ntype LifecycleListener = (event: {\n type: LifecycleEvent;\n timestamp: number;\n data?: any;\n}) => void;\n\nexport class PubSub<S> {\n private subscribers = new Set<Subscriber<S>>();\n #state: S;\n private initialState: S;\n #lastUpdated: number | null;\n private lifecycleListeners: Map<LifecycleEvent, Set<LifecycleListener>> =\n new Map();\n\n constructor(state: S) {\n this.#state = state;\n this.initialState = state;\n this.#lastUpdated = Date.now();\n this.emitLifecycle(LifecycleEvent.INIT, { initialState: this.#state });\n }\n\n private emitLifecycle = (event: LifecycleEvent, data?: any) => {\n const listeners = this.lifecycleListeners.get(event);\n if (listeners) {\n const eventData = {\n type: event,\n timestamp: Date.now(),\n data,\n };\n listeners.forEach((listener) => {\n try {\n listener(eventData);\n } catch {\n // ignore error\n }\n });\n }\n };\n\n private notifySubscribers = (state: S) => {\n const subscribersArray = Array.from(this.subscribers);\n subscribersArray.forEach((callback) => {\n try {\n callback(state);\n } catch (error) {\n this.emitLifecycle(LifecycleEvent.ERROR, { error });\n }\n });\n };\n\n /**\n * Subscribe to state changes\n * @param callback Function to call when state changes\n * @returns Unsubscribe function\n */\n subscribe = (callback: Subscriber<S>): (() => void) => {\n this.subscribers.add(callback);\n // Don't call the callback immediately with current state\n return () => {\n this.subscribers.delete(callback);\n };\n };\n\n onLifecycle = (\n event: LifecycleEvent,\n listener: LifecycleListener,\n ): (() => void) => {\n if (!this.lifecycleListeners.has(event)) {\n this.lifecycleListeners.set(event, new Set());\n }\n const listeners = this.lifecycleListeners.get(event)!;\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size === 0) {\n this.lifecycleListeners.delete(event);\n }\n };\n };\n\n /** Get the current state */\n get = (): S => {\n return this.#state;\n };\n\n // TODO make this provide prev state\n /**\n * Set the state and notify subscribers if the state changes\n * @param newState The new state to set\n */\n set = (newState: S): void => {\n this.emitLifecycle(LifecycleEvent.BEFORE_UPDATE, {\n previousState: this.#state,\n nextState: newState,\n });\n\n if (!isEqual(this.#state, newState)) {\n this.#state = newState;\n this.#lastUpdated = Date.now();\n this.emitLifecycle(LifecycleEvent.STATE_CHANGE, { state: newState });\n this.notifySubscribers(newState);\n }\n\n this.emitLifecycle(LifecycleEvent.AFTER_UPDATE, { state: newState });\n };\n\n // TODO make this provide prev state\n setPartial = (_s: Partial<S>): void => {\n if (_s === undefined || _s === null) return;\n const newState = { ...this.#state, ..._s };\n this.set(newState);\n };\n\n /**\n * Clear all subscriptions\n */\n clear = (): void => {\n this.emitLifecycle(LifecycleEvent.DESTROY);\n this.subscribers = new Set(); // Create a new Set instead of just clearing\n this.lifecycleListeners = new Map();\n };\n\n reset = (): void => {\n this.set(this.initialState);\n };\n\n lastUpdated = (): number | null => {\n return this.#lastUpdated;\n };\n}\n","import { PubSub } from \"../utils/PubSub\";\nimport { ApiCaller } from \"../api\";\nimport { type WidgetConfig } from \"../types/WidgetConfig\";\nimport { type Dto } from \"../sdk\";\n\ntype ContactState = {\n contact: { token: string } | null;\n isCreatingUnverifiedContact: boolean;\n isErrorCreatingUnverifiedContact: boolean;\n};\n\nexport class ContactCtx {\n private config: WidgetConfig;\n private api: ApiCaller;\n state: PubSub<ContactState>;\n\n constructor({\n config,\n api,\n }: {\n api: ApiCaller;\n config: WidgetConfig;\n }) {\n this.config = config;\n this.api = api;\n\n this.state = new PubSub<ContactState>({\n contact: config.contactToken ? { token: config.contactToken } : null,\n isCreatingUnverifiedContact: false,\n isErrorCreatingUnverifiedContact: false,\n });\n\n if (!config.contactToken && !config.collectUserData) {\n this.autoCreateUnverifiedUser();\n }\n }\n\n shouldCollectData = (): boolean => {\n const currentState = this.state.get();\n\n if (!currentState.contact?.token && this.config.collectUserData) {\n return true;\n } else {\n return false;\n }\n };\n\n autoCreateUnverifiedUser = async () => {\n await this.createUnverifiedContact({\n name: this.config.user?.name || \"Anonymous\",\n email: this.config.user?.email,\n });\n };\n\n createUnverifiedContact = async (\n payload: Dto[\"CreateUnverifiedContactDto\"],\n ): Promise<void> => {\n try {\n this.state.setPartial({\n isCreatingUnverifiedContact: true,\n isErrorCreatingUnverifiedContact: false,\n });\n\n const { data } = await this.api.createUnverifiedContact(payload);\n if (data?.token) {\n this.state.setPartial({ contact: { token: data.token } });\n this.api.setAuthToken(data.token);\n } else {\n this.state.setPartial({ isErrorCreatingUnverifiedContact: true });\n }\n } finally {\n this.state.setPartial({ isCreatingUnverifiedContact: false });\n }\n };\n}\n","import { PubSub } from \"./PubSub\";\n\nexport type PollingState = {\n isPolling: boolean;\n isError: boolean;\n};\n\nexport class Poller {\n state = new PubSub<PollingState>({\n isPolling: false,\n isError: false,\n });\n private abortController = new AbortController();\n\n reset = () => {\n this.abortController.abort(\"Resetting poller\");\n this.stopPolling?.();\n this.stopPolling = null;\n };\n\n stopPolling: (() => void) | null = null;\n\n startPolling = (\n cb: (abortSignal: AbortSignal) => Promise<void>,\n interval: number,\n ) => {\n if (this.stopPolling) return;\n\n const timeouts: NodeJS.Timeout[] = [];\n\n const poll = async () => {\n this.abortController = new AbortController();\n this.state.setPartial({ isPolling: true });\n\n try {\n await cb(this.abortController.signal);\n } catch (error) {\n if (this.abortController.signal.aborted) {\n // If aborted, just return and do not schedule the nest poll\n return;\n } else {\n console.error(\"Failed to poll:\", error);\n this.state.setPartial({ isError: true });\n } \n } finally {\n this.state.setPartial({ isPolling: false });\n }\n\n // Another check to stop scheduling polls in case someone removes the early return in the catch above\n if (this.abortController.signal.aborted) {\n console.log(\"Poller aborted, not scheduling anymore\");\n } else {\n timeouts.push(setTimeout(poll, interval));\n }\n };\n\n poll();\n\n this.stopPolling = () => {\n timeouts.forEach(clearTimeout);\n this.state.reset();\n };\n };\n}\n","import { v4 as uuidv4 } from \"uuid\";\n\nexport function genUuid() {\n return uuidv4();\n}\n","import type { ApiCaller } from \"../api\";\nimport type { SessionDto } from \"../types/schemas\";\nimport { Poller } from \"../utils/Poller\";\nimport { PubSub } from \"../utils/PubSub\";\n\nexport class SessionCtx {\n private api: ApiCaller;\n private poller = new Poller();\n\n public state = new PubSub<{\n session: SessionDto | null;\n isCreatingSession: boolean;\n }>({\n session: null,\n isCreatingSession: false,\n });\n\n constructor(api: ApiCaller) {\n this.api = api;\n this.registerPolling();\n }\n\n /** Clears the session and stops polling */\n reset = async () => {\n this.state.reset();\n // The poller should automatically reset, since we're subscribed to the session state, and whenever it's null, the poller resets... but just in case, let's reset it here as well\n this.poller.reset();\n };\n\n registerPolling = () => {\n this.state.subscribe(({ session }) => {\n if (session?.id) {\n this.poller.startPolling(async (abortSignal) => {\n const { data } = await this.fetch(session.id, abortSignal);\n data && this.state.setPartial({ session: data });\n }, 1000);\n } else {\n this.poller.reset();\n }\n });\n };\n\n /**\n * Creates a new session\n * @returns The session\n */\n createSession = async () => {\n this.state.setPartial({ session: null, isCreatingSession: true });\n\n const { data: session, error } = await this.api.createSession();\n if (session) {\n this.state.setPartial({ session, isCreatingSession: false });\n return session;\n }\n\n console.error(\"Failed to create session:\", error);\n return null;\n };\n\n /**\n * Fetches the session from the API\n * @param id - The ID of the session to fetch\n * @returns The session\n */\n fetch = async (sessionId: string, abortSignal: AbortSignal) => {\n return this.api.getSession({ sessionId, abortSignal });\n };\n}\n","import { ApiCaller } from \"../api\";\nimport type { WidgetConfig } from \"../types/WidgetConfig\";\nimport type { SafeOmit, SomeOptional } from \"../types/helpers\";\nimport type { BotMessageType, MessageType, UserMessageType } from \"../types/messages\";\nimport type { MessageAttachmentType, MessageDto, SendMessageDto, SendMessageOutputDto } from \"../types/schemas\";\nimport { Poller } from \"../utils/Poller\";\nimport { PubSub } from \"../utils/PubSub\";\nimport { genUuid } from \"../utils/uuid\";\nimport { SessionCtx } from \"./session\";\n\nexport class MessageCtx {\n private config: WidgetConfig;\n private api: ApiCaller;\n private sessionCtx: SessionCtx;\n private poller = new Poller();\n\n public state = new PubSub<{\n messages: MessageType[];\n isSendingMessage: boolean;\n suggestedReplies: string[] | null;\n }>({\n messages: [],\n isSendingMessage: false,\n suggestedReplies: null,\n });\n\n private sendMessageAbortController = new AbortController();\n\n constructor({\n config,\n api,\n sessionCtx,\n }: { config: WidgetConfig; api: ApiCaller; sessionCtx: SessionCtx }) {\n this.config = config;\n this.api = api;\n this.sessionCtx = sessionCtx;\n\n this.registerPolling();\n }\n\n reset = () => {\n this.sendMessageAbortController.abort(\"Resetting chat\");\n this.state.reset();\n // The poller should automatically reset, since we're subscribed to the session state, and whenever it's null, the poller resets... but just in case, let's reset it here as well\n this.poller.reset();\n };\n\n registerPolling = () => {\n this.sessionCtx.state.subscribe(({ session }) => {\n if (session?.id) {\n this.poller.startPolling(async (abortSignal) => {\n await this.fetchAndSetHistory(session.id, abortSignal);\n }, 1000);\n } else {\n this.poller.reset();\n }\n });\n };\n\n sendMessage = async (\n input: SomeOptional<\n SafeOmit<SendMessageDto, \"bot_token\" | \"uuid\">,\n \"session_id\" | \"user\"\n >,\n ): Promise<void> => {\n this.sendMessageAbortController = new AbortController();\n /* ------------------------------------------------------ */\n /* Prevent sending while waiting for AI res */\n /* ------------------------------------------------------ */\n const isSending = this.state.get().isSendingMessage;\n const isAssignedToAI =\n this.sessionCtx.state.get().session?.assignee.kind === \"ai\";\n if (isSending && isAssignedToAI) {\n console.warn(\"Cannot send messages while awaiting AI response\");\n return;\n }\n\n /* ------------------------------------------------------ */\n /* Clear suggested replies */\n /* ------------------------------------------------------ */\n this.state.setPartial({ suggestedReplies: null });\n\n try {\n this.state.setPartial({ isSendingMessage: true });\n /* ------------------------------------------------------ */\n /* Optimistically add message to rendered messages */\n /* ------------------------------------------------------ */\n const userMessage = MessageCtx.toUserMessage(\n input.content,\n input.attachments || undefined,\n );\n const currentMessages = this.state.get().messages;\n this.state.setPartial({\n messages: [...currentMessages, userMessage],\n });\n\n /* ------------------------------------------------------ */\n /* Create session if not exists */\n /* ------------------------------------------------------ */\n if (!this.sessionCtx.state.get().session?.id) {\n const createdSession = await this.sessionCtx.createSession();\n\n // TODO: apply some retry logic here\n if (!createdSession) {\n console.error(\"Failed to create session\");\n return;\n }\n }\n const sessionId = this.sessionCtx.state.get().session?.id;\n if (!sessionId) return;\n\n /* ------------------------------------------------------ */\n /* Send and wait for bot response */\n /* ------------------------------------------------------ */\n const { data } = await this.api.sendMessage(\n {\n uuid: userMessage.id,\n bot_token: this.config.token,\n headers: this.config.headers,\n query_params: this.config.queryParams,\n session_id: sessionId,\n user: this.config.user,\n ...input,\n },\n this.sendMessageAbortController.signal,\n );\n\n if (data?.success) {\n /* ------------------------------------------------------ */\n /* Append bot reply if not fetched from polling */\n /* ------------------------------------------------------ */\n const botMessage = MessageCtx.toBotMessage(data);\n if (botMessage) {\n const prevMessages = this.state.get().messages;\n const shouldAppend = !prevMessages.some(\n (m) => m.id === botMessage.id,\n );\n if (!shouldAppend) return;\n this.state.setPartial({ messages: [...prevMessages, botMessage] });\n } else {\n /* ------------------------------------------------------ */\n /* Check if bot responded with suggested replies */\n /* ------------------------------------------------------ */\n if (data.options?.value && data.options?.value.length > 0) {\n this.state.setPartial({ suggestedReplies: data.options.value });\n }\n }\n } else {\n const errorMessage = MessageCtx.toErrorMessage(\n data?.error?.message || \"Unknown error occurred\",\n );\n const currentMessages = this.state.get().messages;\n this.state.setPartial({\n messages: [...currentMessages, errorMessage],\n });\n }\n } catch (error) {\n if (!this.sendMessageAbortController.signal.aborted) {\n console.error(\"Failed to send message:\", error);\n }\n } finally {\n this.state.setPartial({ isSendingMessage: false });\n }\n };\n\n fetchAndSetHistory = async (\n sessionId: string,\n abortSignal: AbortSignal,\n ): Promise<void> => {\n const lastMessageTimestamp = this.state.get().messages.at(-1)?.timestamp;\n\n const { data: response } = await this.api.getSessionHistory({\n sessionId,\n lastMessageTimestamp,\n abortSignal,\n });\n\n if (response && response.length > 0) {\n // Get a fresh reference to current messages after the poll is done\n const prevMessages = this.state.get().messages;\n const newMessages = response\n .map(MessageCtx.mapHistoryToMessage)\n .filter(\n (newMsg) =>\n !prevMessages.some((existingMsg) => existingMsg.id === newMsg.id),\n );\n this.state.setPartial({\n messages: [...prevMessages, ...newMessages],\n });\n\n // if (newMessages.length > 0) {\n // // const playSoundEffects = config?.settings?.playSoundEffects;\n // // Play notification sound for new messages if enabled\n // // if (\n // // playSoundEffects &&\n // // platform?.audio &&\n // // isAudioAvailable(platform.audio)\n // // ) {\n // // const botMessages = newMessages.filter(\n // // (msg) => msg.type === \"FROM_BOT\",\n // // );\n // // if (botMessages.length > 0) {\n // // await safeAudioOperation(\n // // () => platform.audio!.playNotification(),\n // // \"Failed to play notification sound for new messages\",\n // // );\n // // }\n // // }\n\n // }\n }\n };\n\n /** Not the best name but whatever */\n static mapHistoryToMessage(history: MessageDto): MessageType {\n const commonFields = {\n id: history.publicId,\n timestamp: history.sentAt || \"\",\n attachments: history.attachments || undefined,\n };\n\n if (history.sender.kind === \"user\") {\n return {\n ...commonFields,\n type: \"FROM_USER\",\n content: history.content.text || \"\",\n deliveredAt: history.sentAt || \"\",\n };\n }\n\n if (history.sender.kind === \"agent\") {\n return {\n ...commonFields,\n type: \"FROM_AGENT\",\n component: \"agent_message\",\n data: {\n message: history.content.text || \"\",\n },\n };\n }\n\n return {\n ...commonFields,\n type: \"FROM_BOT\",\n component: \"bot_message\",\n agent: {\n id: null,\n name: history.sender.name || \"\",\n isAi: history.sender.kind === \"ai\",\n avatar: history.sender.avatar || null,\n },\n data: {\n message: history.content.text,\n },\n };\n }\n\n static toUserMessage(\n content: string,\n attachments?: MessageAttachmentType[],\n ): UserMessageType {\n return {\n id: genUuid(),\n type: \"FROM_USER\",\n content,\n deliveredAt: new Date().toISOString(),\n attachments,\n timestamp: new Date().toISOString(),\n };\n }\n\n static toBotMessage(response: SendMessageOutputDto): BotMessageType | null {\n if (response.success && response.autopilotResponse) {\n return {\n type: \"FROM_BOT\",\n id: response.autopilotResponse.id || genUuid(),\n timestamp: new Date().toISOString(),\n component: \"bot_message\",\n data: {\n message: response.autopilotResponse.value.content,\n },\n };\n }\n\n if (response.success && response.uiResponse) {\n const uiVal = response.uiResponse.value;\n return {\n type: \"FROM_BOT\" as const,\n id: genUuid(),\n timestamp: new Date().toISOString(),\n component: uiVal.name,\n data: uiVal.request_response,\n };\n }\n\n return null;\n }\n\n static toErrorMessage(message: string) {\n return {\n type: \"FROM_BOT\" as const,\n id: genUuid(),\n timestamp: new Date().toISOString(),\n component: \"TEXT\",\n data: {\n message,\n variant: \"error\",\n },\n };\n }\n}\n","import { ApiCaller } from \"../api\";\nimport type { WidgetConfig } from \"../types/WidgetConfig\";\nimport { ContactCtx } from \"./contact\";\nimport { MessageCtx } from \"./message\";\nimport { SessionCtx } from \"./session\";\n\nexport class WidgetCtx {\n public config: WidgetConfig;\n public api: ApiCaller;\n public contactCtx: ContactCtx;\n public sessionCtx: SessionCtx;\n public messageCtx: MessageCtx;\n\n constructor({ config }: { config: WidgetConfig }) {\n this.config = config;\n this.api = new ApiCaller({ config });\n\n this.contactCtx = new ContactCtx({\n api: this.api,\n config: this.config,\n });\n\n this.sessionCtx = new SessionCtx(this.api);\n this.messageCtx = new MessageCtx({\n config: this.config,\n api: this.api,\n sessionCtx: this.sessionCtx,\n });\n }\n\n resetChat = () => {\n this.sessionCtx.reset();\n this.messageCtx.reset();\n };\n}\n"],"names":["defaultOnError","onErrorOptions","basicClient","options","client","createClient","middlewares","ApiCaller","config","__publicField","token","baseUrl","headers","request","key","value","axios","body","abortSignal","sessionId","lastMessageTimestamp","query","file","formData","data","PubSub","state","__privateAdd","_state","_lastUpdated","event","listeners","eventData","listener","callback","error","__privateGet","newState","isEqual","__privateSet","_s","ContactCtx","api","_a","_b","payload","Poller","cb","interval","timeouts","poll","genUuid","uuidv4","SessionCtx","session","MessageCtx","sessionCtx","input","isSending","isAssignedToAI","userMessage","currentMessages","_c","botMessage","prevMessages","m","_d","_e","errorMessage","_f","response","newMessages","newMsg","existingMsg","history","commonFields","content","attachments","uiVal","message","WidgetCtx"],"mappings":"0lBAWMA,EAAyCC,GAAmB,CACxD,QAAA,IAAIA,EAAe,KAAK,CAClC,EAEaC,EAAeC,GAAqB,CAC/C,MAAMC,EAASC,EAAoB,CACjC,QAASF,EAAQ,OAAA,CAClB,EAEKG,EAA0B,CAC9B,UAAWH,EAAQ,UACnB,WAAYA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KAAK,IAAM,IAAID,EAAU,CAAE,OAAAC,CAAQ,CAAA,EAE9B,KAAA,WAAa,IAAIiC,EAAW,CAC/B,IAAK,KAAK,IACV,OAAQ,KAAK,MAAA,CACd,EAED,KAAK,WAAa,IAAIY,EAAW,KAAK,GAAG,EACpC,KAAA,WAAa,IAAIE,EAAW,CAC/B,OAAQ,KAAK,OACb,IAAK,KAAK,IACV,WAAY,KAAK,UAAA,CAClB,CACH,CAMF"}
|
/package/dist/src/designs/react/{basic/WidgetPopoverTrigger.d.ts → WidgetPopoverTrigger.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|