@mypatientspace/chatbot-widget 1.0.38 → 1.0.40
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 +374 -353
- package/dist/mypatientspace-demo.umd.js +27 -6
- package/dist/mypatientspace-widget.es.js +1113 -1095
- package/dist/mypatientspace-widget.umd.js +68 -50
- package/package.json +1 -1
|
@@ -454,8 +454,12 @@ Error generating stack: `+a.message+`
|
|
|
454
454
|
background: ${S.colors.pageBackground};
|
|
455
455
|
position: relative;
|
|
456
456
|
height: 100%;
|
|
457
|
-
min-height: ${S.layout.minPreviewHeight};
|
|
458
457
|
overflow: hidden;
|
|
458
|
+
|
|
459
|
+
@media (max-width: ${S.breakpoints.mobile}) {
|
|
460
|
+
height: auto;
|
|
461
|
+
min-height: ${S.layout.minPreviewHeight};
|
|
462
|
+
}
|
|
459
463
|
`,header:X`
|
|
460
464
|
margin-bottom: ${S.spacing.md};
|
|
461
465
|
flex-shrink: 0;
|
|
@@ -469,7 +473,7 @@ Error generating stack: `+a.message+`
|
|
|
469
473
|
color: ${S.colors.textLight};
|
|
470
474
|
`,container:X`
|
|
471
475
|
flex: 1;
|
|
472
|
-
min-height:
|
|
476
|
+
min-height: 0;
|
|
473
477
|
background: ${S.colors.panelBackground};
|
|
474
478
|
border-radius: ${S.borderRadius.xl};
|
|
475
479
|
box-shadow: 0 4px 24px rgba(60, 77, 115, 0.1);
|
|
@@ -479,7 +483,6 @@ Error generating stack: `+a.message+`
|
|
|
479
483
|
/* Override widget's fixed positioning to absolute within container */
|
|
480
484
|
.chatbot-widget-container {
|
|
481
485
|
position: absolute !important;
|
|
482
|
-
inset: 0;
|
|
483
486
|
}
|
|
484
487
|
`,containerFloating:X`
|
|
485
488
|
background: transparent;
|
|
@@ -502,12 +505,12 @@ Error generating stack: `+a.message+`
|
|
|
502
505
|
display: grid;
|
|
503
506
|
grid-template-columns: ${S.layout.controlsPanelWidth} 1fr;
|
|
504
507
|
height: 100%;
|
|
505
|
-
min-height: ${S.layout.minPreviewHeight};
|
|
506
508
|
width: 100%;
|
|
507
509
|
|
|
508
510
|
@media (max-width: ${S.breakpoints.mobile}) {
|
|
509
511
|
grid-template-columns: 1fr;
|
|
510
512
|
height: auto;
|
|
513
|
+
min-height: 100%;
|
|
511
514
|
}
|
|
512
515
|
`,layoutPreviewOnly:X`
|
|
513
516
|
grid-template-columns: 1fr;
|
|
@@ -591,7 +594,7 @@ Error generating stack: `+a.message+`
|
|
|
591
594
|
&:active {
|
|
592
595
|
background-color: rgba(255, 255, 255, 0.4);
|
|
593
596
|
}
|
|
594
|
-
`,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.40"]})]})]}),o.floatingMode&&k.jsx(wy,{theme:s,onClick:u,"aria-label":"Minimize chat",children:k.jsx(Mf,{size:20})})]})},qy=bt.div`
|
|
595
598
|
display: flex;
|
|
596
599
|
gap: 8px;
|
|
597
600
|
padding: 12px 16px;
|
|
@@ -965,19 +968,37 @@ Error generating stack: `+a.message+`
|
|
|
965
968
|
.chatbot-widget-container {
|
|
966
969
|
all: initial;
|
|
967
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;
|
|
968
975
|
|
|
969
976
|
*, *::before, *::after {
|
|
970
977
|
box-sizing: border-box;
|
|
971
978
|
margin: 0;
|
|
972
979
|
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;
|
|
973
990
|
}
|
|
974
991
|
|
|
975
992
|
button {
|
|
976
993
|
font-family: inherit;
|
|
994
|
+
font-size: inherit;
|
|
995
|
+
line-height: inherit;
|
|
977
996
|
}
|
|
978
997
|
|
|
979
|
-
input {
|
|
998
|
+
input, textarea {
|
|
980
999
|
font-family: inherit;
|
|
1000
|
+
font-size: inherit;
|
|
1001
|
+
line-height: inherit;
|
|
981
1002
|
}
|
|
982
1003
|
}
|
|
983
1004
|
`,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}));
|