@mypatientspace/chatbot-widget 1.0.40 → 1.0.41
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/mypatientspace-demo.es.js +349 -367
- package/dist/mypatientspace-demo.umd.js +2 -20
- package/dist/mypatientspace-widget.es.js +1095 -1113
- package/dist/mypatientspace-widget.umd.js +50 -68
- package/package.json +1 -1
|
@@ -594,7 +594,7 @@ Error generating stack: `+a.message+`
|
|
|
594
594
|
&:active {
|
|
595
595
|
background-color: rgba(255, 255, 255, 0.4);
|
|
596
596
|
}
|
|
597
|
-
`,Hy=()=>{const{close:u,config:o,theme:s,assistant:r}=_a(),d=o.headerTitle||r?.chatUiConfig?.avatarTitle||"Chat",g=o.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL,v=o.headerSubtitle||r?.chatUiConfig?.headerSubtitle,M=o.brandingText||r?.chatUiConfig?.brandingText;return k.jsxs(_y,{theme:s,children:[k.jsxs(My,{children:[g&&k.jsx(Oy,{theme:s,hasCustomIcon:!0,children:k.jsx(Dy,{src:g,alt:""})}),k.jsxs(Ry,{children:[k.jsx(By,{fontFamily:s.fontFamily,children:d}),v&&k.jsx(Uy,{fontFamily:s.fontFamily,children:v}),M&&k.jsxs(Ny,{fontFamily:s.fontFamily,children:[M," v","1.0.
|
|
597
|
+
`,Hy=()=>{const{close:u,config:o,theme:s,assistant:r}=_a(),d=o.headerTitle||r?.chatUiConfig?.avatarTitle||"Chat",g=o.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL,v=o.headerSubtitle||r?.chatUiConfig?.headerSubtitle,M=o.brandingText||r?.chatUiConfig?.brandingText;return k.jsxs(_y,{theme:s,children:[k.jsxs(My,{children:[g&&k.jsx(Oy,{theme:s,hasCustomIcon:!0,children:k.jsx(Dy,{src:g,alt:""})}),k.jsxs(Ry,{children:[k.jsx(By,{fontFamily:s.fontFamily,children:d}),v&&k.jsx(Uy,{fontFamily:s.fontFamily,children:v}),M&&k.jsxs(Ny,{fontFamily:s.fontFamily,children:[M," v","1.0.41"]})]})]}),o.floatingMode&&k.jsx(wy,{theme:s,onClick:u,"aria-label":"Minimize chat",children:k.jsx(Mf,{size:20})})]})},qy=bt.div`
|
|
598
598
|
display: flex;
|
|
599
599
|
gap: 8px;
|
|
600
600
|
padding: 12px 16px;
|
|
@@ -968,37 +968,19 @@ Error generating stack: `+a.message+`
|
|
|
968
968
|
.chatbot-widget-container {
|
|
969
969
|
all: initial;
|
|
970
970
|
font-family: ${u.fontFamily};
|
|
971
|
-
font-size: 16px;
|
|
972
|
-
line-height: 1.5;
|
|
973
|
-
-webkit-font-smoothing: antialiased;
|
|
974
|
-
-moz-osx-font-smoothing: grayscale;
|
|
975
971
|
|
|
976
972
|
*, *::before, *::after {
|
|
977
973
|
box-sizing: border-box;
|
|
978
974
|
margin: 0;
|
|
979
975
|
padding: 0;
|
|
980
|
-
font-size: inherit;
|
|
981
|
-
line-height: inherit;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
h1, h2, h3, h4, h5, h6, p, span, div {
|
|
985
|
-
font-size: inherit;
|
|
986
|
-
font-weight: inherit;
|
|
987
|
-
line-height: inherit;
|
|
988
|
-
margin: 0;
|
|
989
|
-
padding: 0;
|
|
990
976
|
}
|
|
991
977
|
|
|
992
978
|
button {
|
|
993
979
|
font-family: inherit;
|
|
994
|
-
font-size: inherit;
|
|
995
|
-
line-height: inherit;
|
|
996
980
|
}
|
|
997
981
|
|
|
998
|
-
input
|
|
982
|
+
input {
|
|
999
983
|
font-family: inherit;
|
|
1000
|
-
font-size: inherit;
|
|
1001
|
-
line-height: inherit;
|
|
1002
984
|
}
|
|
1003
985
|
}
|
|
1004
986
|
`,b0=()=>{const{isOpen:u,toggle:o,config:s,theme:r,assistant:d}=_a(),g=s.floatingMode??!1,v=s.fabIcon||d?.chatUiConfig?.fabIcon;return k.jsxs(k.Fragment,{children:[k.jsx(zf,{styles:p0(r)}),k.jsxs(h0,{className:"chatbot-widget-container",position:s.position||"bottom-right",floatingMode:g,children:[g&&k.jsx(g0,{theme:r,isOpen:u,hasCustomIcon:!!v,onClick:o,"aria-label":"Open chat","aria-expanded":u,children:v?k.jsx(m0,{src:v,alt:"Chat"}):k.jsx(Qm,{size:24})}),k.jsxs(y0,{theme:r,isOpen:u,isClosing:!1,floatingMode:g,children:[k.jsx(Hy,{}),k.jsx(Yy,{}),k.jsx(a0,{}),k.jsx(f0,{})]})]})]})},qf={headerTitle:"AI Doctor",greeting:"Hello! Welcome to our healthcare support. How can I assist you today?",placeholder:"Type a message...",brandingText:"Developed by myPatientSpace",headerIcon:"https://web.mypatientspace.com/img/logo-symbol.png",fabIcon:"https://web.mypatientspace.com/img/logo-symbol.png",position:"bottom-right",quickActions:["I would like to book an appointment","What are your operating hours?","How can I contact you?","Where are you located?"]};let Ma=null,Pe=null,Oi=!1;const Be={open:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},close:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},toggle:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},updateConfig:u=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},v0=({config:u,onMount:o})=>{const s=R.useRef(null),r=R.useCallback(d=>{s.current=d},[]);return k.jsx(vy,{config:u,onConfigUpdate:r,children:k.jsx(S0,{onMount:o,updateConfigRef:s})})},S0=({onMount:u,updateConfigRef:o})=>{const{open:s,close:r,toggle:d}=_a();return R.useEffect(()=>{u({open:s,close:r,toggle:d,updateConfig:g=>{o.current?.(g)}})},[s,r,d,u,o]),k.jsx(b0,{})},x0={init:u=>{if(Ma){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const o={...qf,...u,quickActions:u.quickActions??qf.quickActions,floatingMode:u.floatingMode??!1};if(u.containerSelector){const s=document.querySelector(u.containerSelector);if(!s){console.error(`ChatbotWidget: Container not found for selector "${u.containerSelector}".`);return}Pe=s,Oi=!0}else Pe=document.createElement("div"),Pe.id="chatbot-widget-root",document.body.appendChild(Pe),Oi=!1;Ma=Fr.createRoot(Pe),Ma.render(k.jsx(v0,{config:o,onMount:s=>{Be.open=s.open,Be.close=s.close,Be.toggle=s.toggle,Be.updateConfig=s.updateConfig}})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{Ma&&(Ma.unmount(),Ma=null),Pe&&!Oi&&Pe.parentNode&&Pe.parentNode.removeChild(Pe),Pe=null,Oi=!1,Be.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Be.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Be.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Be.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>Be.open(),close:()=>Be.close(),toggle:()=>Be.toggle(),update:u=>Be.updateConfig(u)};window.ChatbotWidget=x0;let Al=null,xc=null,Oa=null;const jf={init:u=>{if(Al){console.warn("ChatbotWidgetDemo: Already initialized. Call destroy() first to reinitialize.");return}if(!u.containerSelector){console.error("ChatbotWidgetDemo: containerSelector is required.");return}const o=document.querySelector(u.containerSelector);if(!o){console.error(`ChatbotWidgetDemo: Container not found for selector "${u.containerSelector}".`);return}xc=o,Oa=u,Al=Fr.createRoot(xc),Al.render(k.jsx(Of,{config:u})),console.log("ChatbotWidgetDemo: Initialized successfully.")},destroy:()=>{Al&&(Al.unmount(),Al=null),window.ChatbotWidget&&window.ChatbotWidget.destroy(),xc=null,Oa=null,console.log("ChatbotWidgetDemo: Destroyed successfully.")},update:u=>{if(!Al||!Oa){console.warn("ChatbotWidgetDemo: Not initialized. Call init() first.");return}Oa={...Oa,...u},Al.render(k.jsx(Of,{config:Oa}))},getConfig:()=>window.ChatbotWidget?{}:(console.warn("ChatbotWidgetDemo: Widget not available."),{})};return window.ChatbotWidgetDemo=jf,jf}));
|