@mypatientspace/chatbot-widget 1.0.40 → 1.0.42
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 +351 -368
- package/dist/mypatientspace-demo.umd.js +4 -21
- package/dist/mypatientspace-widget.es.js +1096 -1113
- package/dist/mypatientspace-widget.umd.js +51 -68
- package/package.json +1 -1
|
@@ -468,6 +468,7 @@ Error generating stack: `+a.message+`
|
|
|
468
468
|
font-weight: ${S.fontWeight.semibold};
|
|
469
469
|
color: ${S.colors.text};
|
|
470
470
|
margin-bottom: ${S.spacing.xs};
|
|
471
|
+
padding: 0;
|
|
471
472
|
`,subtitle:X`
|
|
472
473
|
font-size: ${S.fontSize.sm};
|
|
473
474
|
color: ${S.colors.textLight};
|
|
@@ -477,7 +478,6 @@ Error generating stack: `+a.message+`
|
|
|
477
478
|
background: ${S.colors.panelBackground};
|
|
478
479
|
border-radius: ${S.borderRadius.xl};
|
|
479
480
|
box-shadow: 0 4px 24px rgba(60, 77, 115, 0.1);
|
|
480
|
-
overflow: hidden;
|
|
481
481
|
position: relative;
|
|
482
482
|
|
|
483
483
|
/* Override widget's fixed positioning to absolute within container */
|
|
@@ -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.42"]})]})]}),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;
|
|
@@ -947,6 +947,7 @@ Error generating stack: `+a.message+`
|
|
|
947
947
|
flex-direction: column;
|
|
948
948
|
width: ${({floatingMode:u})=>u?"380px":"100%"};
|
|
949
949
|
height: ${({floatingMode:u})=>u?"520px":"100%"};
|
|
950
|
+
max-height: ${({floatingMode:u})=>u?"calc(100vh - 100px)":"100%"};
|
|
950
951
|
background-color: ${({theme:u})=>u.colors.background};
|
|
951
952
|
border-radius: ${({theme:u,floatingMode:o})=>o?u.borderRadius:"0"};
|
|
952
953
|
box-shadow: ${({theme:u,floatingMode:o})=>o?u.shadow:"none"};
|
|
@@ -968,37 +969,19 @@ Error generating stack: `+a.message+`
|
|
|
968
969
|
.chatbot-widget-container {
|
|
969
970
|
all: initial;
|
|
970
971
|
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
972
|
|
|
976
973
|
*, *::before, *::after {
|
|
977
974
|
box-sizing: border-box;
|
|
978
975
|
margin: 0;
|
|
979
976
|
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
977
|
}
|
|
991
978
|
|
|
992
979
|
button {
|
|
993
980
|
font-family: inherit;
|
|
994
|
-
font-size: inherit;
|
|
995
|
-
line-height: inherit;
|
|
996
981
|
}
|
|
997
982
|
|
|
998
|
-
input
|
|
983
|
+
input {
|
|
999
984
|
font-family: inherit;
|
|
1000
|
-
font-size: inherit;
|
|
1001
|
-
line-height: inherit;
|
|
1002
985
|
}
|
|
1003
986
|
}
|
|
1004
987
|
`,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}));
|