@mypatientspace/chatbot-widget 1.0.73 → 1.0.74
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.
|
@@ -14871,7 +14871,7 @@ const Ba = () => {
|
|
|
14871
14871
|
/* @__PURE__ */ x.jsxs(g1, { fontFamily: s.fontFamily, children: [
|
|
14872
14872
|
A,
|
|
14873
14873
|
" v",
|
|
14874
|
-
"1.0.
|
|
14874
|
+
"1.0.74"
|
|
14875
14875
|
] })
|
|
14876
14876
|
] })
|
|
14877
14877
|
] }),
|
|
@@ -17096,7 +17096,7 @@ const jp = H.div`
|
|
|
17096
17096
|
}
|
|
17097
17097
|
|
|
17098
17098
|
@media (max-width: 420px) {
|
|
17099
|
-
${({ floatingMode: l, isExpanded: u }) => l && !u && `
|
|
17099
|
+
${({ floatingMode: l, isExpanded: u, isOpen: s }) => l && !u && s && `
|
|
17100
17100
|
top: 0;
|
|
17101
17101
|
left: 0;
|
|
17102
17102
|
right: 0;
|
|
@@ -17178,6 +17178,7 @@ const jp = H.div`
|
|
|
17178
17178
|
floatingMode: y,
|
|
17179
17179
|
useAbsolutePositioning: s.useAbsolutePositioning,
|
|
17180
17180
|
isExpanded: h,
|
|
17181
|
+
isOpen: l,
|
|
17181
17182
|
children: [
|
|
17182
17183
|
y && /* @__PURE__ */ x.jsx(
|
|
17183
17184
|
xx,
|
|
@@ -812,7 +812,7 @@ Error generating stack: `+a.message+`
|
|
|
812
812
|
@media (max-width: 420px) {
|
|
813
813
|
${({floatingMode:l})=>l&&"display: none;"}
|
|
814
814
|
}
|
|
815
|
-
`,D0=()=>{const{close:l,config:u,theme:s,assistant:r,isExpanded:d,toggleExpanded:h,startNewChat:y}=pa(),T=u.headerTitle||r?.chatUiConfig?.avatarTitle||"AI Doctor",S=u.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL||"https://web.mypatientspace.com/img/logo-symbol.png",g=u.headerSubtitle||r?.chatUiConfig?.headerSubtitle,A=u.brandingText||r?.chatUiConfig?.brandingText||"Developed by myPatientSpace";return x.jsxs(C0,{theme:s,children:[x.jsxs(T0,{children:[x.jsx(E0,{theme:s,hasCustomIcon:!0,children:x.jsx(z0,{src:S,alt:""})}),x.jsxs(A0,{children:[x.jsx(M0,{fontFamily:s.fontFamily,children:T}),g&&x.jsx(_0,{fontFamily:s.fontFamily,children:g}),x.jsxs(w0,{fontFamily:s.fontFamily,children:[A," v","1.0.
|
|
815
|
+
`,D0=()=>{const{close:l,config:u,theme:s,assistant:r,isExpanded:d,toggleExpanded:h,startNewChat:y}=pa(),T=u.headerTitle||r?.chatUiConfig?.avatarTitle||"AI Doctor",S=u.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL||"https://web.mypatientspace.com/img/logo-symbol.png",g=u.headerSubtitle||r?.chatUiConfig?.headerSubtitle,A=u.brandingText||r?.chatUiConfig?.brandingText||"Developed by myPatientSpace";return x.jsxs(C0,{theme:s,children:[x.jsxs(T0,{children:[x.jsx(E0,{theme:s,hasCustomIcon:!0,children:x.jsx(z0,{src:S,alt:""})}),x.jsxs(A0,{children:[x.jsx(M0,{fontFamily:s.fontFamily,children:T}),g&&x.jsx(_0,{fontFamily:s.fontFamily,children:g}),x.jsxs(w0,{fontFamily:s.fontFamily,children:[A," v","1.0.74"]})]})]}),x.jsxs(O0,{children:[x.jsx(qu,{theme:s,onClick:y,"aria-label":"Start new chat",children:x.jsx($m,{size:16})}),x.jsx($0,{floatingMode:u.floatingMode,children:x.jsx(qu,{theme:s,onClick:h,"aria-label":d?"Collapse chat":"Expand chat",children:d?x.jsx(Qs,{size:16}):x.jsx(Ys,{size:16})})}),u.floatingMode&&x.jsx(qu,{theme:s,onClick:l,"aria-label":"Close chat",children:x.jsx(ql,{size:16})})]})]})},B0=j.div`
|
|
816
816
|
position: relative;
|
|
817
817
|
background-color: ${({theme:l})=>l.colors.background};
|
|
818
818
|
border-bottom: 1px solid ${({theme:l})=>l.colors.borderLight};
|
|
@@ -2080,7 +2080,7 @@ Error generating stack: `+a.message+`
|
|
|
2080
2080
|
}
|
|
2081
2081
|
|
|
2082
2082
|
@media (max-width: 420px) {
|
|
2083
|
-
${({floatingMode:l,isExpanded:u})=>l&&!u&&`
|
|
2083
|
+
${({floatingMode:l,isExpanded:u,isOpen:s})=>l&&!u&&s&&`
|
|
2084
2084
|
top: 0;
|
|
2085
2085
|
left: 0;
|
|
2086
2086
|
right: 0;
|
|
@@ -2147,4 +2147,4 @@ Error generating stack: `+a.message+`
|
|
|
2147
2147
|
border-radius: 0;
|
|
2148
2148
|
`}
|
|
2149
2149
|
}
|
|
2150
|
-
`,Hb=()=>{const{isOpen:l,toggle:u,config:s,theme:r,assistant:d,isExpanded:h}=pa(),y=s.floatingMode??!1,[T,S]=C.useState(null),g=C.useCallback(k=>{S(k)},[]),A=C.useCallback(()=>{S(null)},[]),z=s.fabIcon||d?.chatUiConfig?.fabIcon||"https://web.mypatientspace.com/img/logo-symbol.png";return x.jsxs(x.Fragment,{children:[x.jsx(Db,{isVisible:h}),x.jsxs(Bb,{position:s.position||"bottom-right",floatingMode:y,useAbsolutePositioning:s.useAbsolutePositioning,isExpanded:h,children:[y&&x.jsx(Rb,{theme:r,isOpen:l,hasCustomIcon:!0,onClick:u,"aria-label":"Open chat","aria-expanded":l,children:x.jsx(Nb,{src:z,alt:"Chat"})}),x.jsxs(jb,{theme:r,isOpen:l,isClosing:!1,floatingMode:y,isExpanded:h,useAbsolutePositioning:s.useAbsolutePositioning,children:[x.jsx(D0,{}),x.jsx(H0,{}),x.jsx(gy,{onCardExpand:g}),x.jsx(pb,{}),T&&x.jsx(_b,{citation:T,theme:r,onClose:A})]})]})]})},Ub={position:"bottom-right",colorMode:"light"};let Ga=null,re=null,Vi=null;const Se={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:l=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},startNewChat:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},kb=({config:l,onMount:u})=>{const s=C.useRef(null),r=C.useCallback(d=>{s.current=d},[]);return x.jsx(p0,{config:l,onConfigUpdate:r,children:x.jsx(qb,{onMount:u,updateConfigRef:s})})},qb=({onMount:l,updateConfigRef:u})=>{const{open:s,close:r,toggle:d,startNewChat:h}=pa();return C.useEffect(()=>{l({open:s,close:r,toggle:d,updateConfig:y=>{u.current?.(y)},startNewChat:h})},[s,r,d,h,l,u]),x.jsx(Hb,{})},Lb={init:l=>{if(Ga){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const u={...Ub,...l,floatingMode:l.floatingMode??!1};if(l.containerElement)re=document.createElement("div"),re.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",l.containerElement.appendChild(re);else if(u.floatingMode)re=document.createElement("div"),re.id="chatbot-widget-root",document.body.appendChild(re);else if(l.containerSelector){const d=document.querySelector(l.containerSelector);if(!d){console.error(`ChatbotWidget: Container not found for selector "${l.containerSelector}".`);return}re=document.createElement("div"),re.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",d.appendChild(re)}else re=document.createElement("div"),re.id="chatbot-widget-root",document.body.appendChild(re);Vi=re.attachShadow({mode:"open"});const s=document.createElement("div");s.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",Vi.appendChild(s);const r=zu({key:"mps-chatbot",container:Vi});Ga=hs.createRoot(s),Ga.render(x.jsx(Du,{value:r,children:x.jsx(kb,{config:u,onMount:d=>{Se.open=d.open,Se.close=d.close,Se.toggle=d.toggle,Se.updateConfig=d.updateConfig,Se.startNewChat=d.startNewChat}})})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{Ga&&(Ga.unmount(),Ga=null),re&&re.parentNode&&re.parentNode.removeChild(re),re=null,Vi=null,Se.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.startNewChat=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>Se.open(),close:()=>Se.close(),toggle:()=>Se.toggle(),update:l=>Se.updateConfig(l),startNewChat:()=>Se.startNewChat()};window.ChatbotWidget=Lb;let qn=null,hn=null,Zi=null,Ll=null,Qa=null,Ki=!1;const xf={init:l=>{if(qn){console.warn("ChatbotWidgetDemo: Already initialized. Call destroy() first to reinitialize.");return}if(l.containerSelector){const s=document.querySelector(l.containerSelector);if(!s){console.error(`ChatbotWidgetDemo: Container not found for selector "${l.containerSelector}".`);return}hn=s,Ki=!0}else hn=document.createElement("div"),hn.id="chatbot-demo-root",document.body.appendChild(hn),Ki=!1;Zi=hn.attachShadow({mode:"open"});const u=document.createElement("div");u.style.cssText="width: 100%; height: 100%;",Zi.appendChild(u),Ll=zu({key:"mps-demo",container:Zi}),Qa=l,qn=hs.createRoot(u),qn.render(x.jsx(Du,{value:Ll,children:x.jsx(Ws,{config:l})})),console.log("ChatbotWidgetDemo: Initialized successfully.")},destroy:()=>{qn&&(qn.unmount(),qn=null),window.ChatbotWidget&&window.ChatbotWidget.destroy(),hn&&!Ki&&hn.parentNode&&hn.parentNode.removeChild(hn),hn=null,Zi=null,Ll=null,Ki=!1,Qa=null,console.log("ChatbotWidgetDemo: Destroyed successfully.")},update:l=>{if(!qn||!Qa||!Ll){console.warn("ChatbotWidgetDemo: Not initialized. Call init() first.");return}Qa={...Qa,...l},qn.render(x.jsx(Du,{value:Ll,children:x.jsx(Ws,{config:Qa})}))},getConfig:()=>window.ChatbotWidget?{}:(console.warn("ChatbotWidgetDemo: Widget not available."),{})};return window.ChatbotWidgetDemo=xf,xf}));
|
|
2150
|
+
`,Hb=()=>{const{isOpen:l,toggle:u,config:s,theme:r,assistant:d,isExpanded:h}=pa(),y=s.floatingMode??!1,[T,S]=C.useState(null),g=C.useCallback(k=>{S(k)},[]),A=C.useCallback(()=>{S(null)},[]),z=s.fabIcon||d?.chatUiConfig?.fabIcon||"https://web.mypatientspace.com/img/logo-symbol.png";return x.jsxs(x.Fragment,{children:[x.jsx(Db,{isVisible:h}),x.jsxs(Bb,{position:s.position||"bottom-right",floatingMode:y,useAbsolutePositioning:s.useAbsolutePositioning,isExpanded:h,isOpen:l,children:[y&&x.jsx(Rb,{theme:r,isOpen:l,hasCustomIcon:!0,onClick:u,"aria-label":"Open chat","aria-expanded":l,children:x.jsx(Nb,{src:z,alt:"Chat"})}),x.jsxs(jb,{theme:r,isOpen:l,isClosing:!1,floatingMode:y,isExpanded:h,useAbsolutePositioning:s.useAbsolutePositioning,children:[x.jsx(D0,{}),x.jsx(H0,{}),x.jsx(gy,{onCardExpand:g}),x.jsx(pb,{}),T&&x.jsx(_b,{citation:T,theme:r,onClose:A})]})]})]})},Ub={position:"bottom-right",colorMode:"light"};let Ga=null,re=null,Vi=null;const Se={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:l=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},startNewChat:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},kb=({config:l,onMount:u})=>{const s=C.useRef(null),r=C.useCallback(d=>{s.current=d},[]);return x.jsx(p0,{config:l,onConfigUpdate:r,children:x.jsx(qb,{onMount:u,updateConfigRef:s})})},qb=({onMount:l,updateConfigRef:u})=>{const{open:s,close:r,toggle:d,startNewChat:h}=pa();return C.useEffect(()=>{l({open:s,close:r,toggle:d,updateConfig:y=>{u.current?.(y)},startNewChat:h})},[s,r,d,h,l,u]),x.jsx(Hb,{})},Lb={init:l=>{if(Ga){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const u={...Ub,...l,floatingMode:l.floatingMode??!1};if(l.containerElement)re=document.createElement("div"),re.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",l.containerElement.appendChild(re);else if(u.floatingMode)re=document.createElement("div"),re.id="chatbot-widget-root",document.body.appendChild(re);else if(l.containerSelector){const d=document.querySelector(l.containerSelector);if(!d){console.error(`ChatbotWidget: Container not found for selector "${l.containerSelector}".`);return}re=document.createElement("div"),re.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",d.appendChild(re)}else re=document.createElement("div"),re.id="chatbot-widget-root",document.body.appendChild(re);Vi=re.attachShadow({mode:"open"});const s=document.createElement("div");s.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",Vi.appendChild(s);const r=zu({key:"mps-chatbot",container:Vi});Ga=hs.createRoot(s),Ga.render(x.jsx(Du,{value:r,children:x.jsx(kb,{config:u,onMount:d=>{Se.open=d.open,Se.close=d.close,Se.toggle=d.toggle,Se.updateConfig=d.updateConfig,Se.startNewChat=d.startNewChat}})})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{Ga&&(Ga.unmount(),Ga=null),re&&re.parentNode&&re.parentNode.removeChild(re),re=null,Vi=null,Se.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},Se.startNewChat=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>Se.open(),close:()=>Se.close(),toggle:()=>Se.toggle(),update:l=>Se.updateConfig(l),startNewChat:()=>Se.startNewChat()};window.ChatbotWidget=Lb;let qn=null,hn=null,Zi=null,Ll=null,Qa=null,Ki=!1;const xf={init:l=>{if(qn){console.warn("ChatbotWidgetDemo: Already initialized. Call destroy() first to reinitialize.");return}if(l.containerSelector){const s=document.querySelector(l.containerSelector);if(!s){console.error(`ChatbotWidgetDemo: Container not found for selector "${l.containerSelector}".`);return}hn=s,Ki=!0}else hn=document.createElement("div"),hn.id="chatbot-demo-root",document.body.appendChild(hn),Ki=!1;Zi=hn.attachShadow({mode:"open"});const u=document.createElement("div");u.style.cssText="width: 100%; height: 100%;",Zi.appendChild(u),Ll=zu({key:"mps-demo",container:Zi}),Qa=l,qn=hs.createRoot(u),qn.render(x.jsx(Du,{value:Ll,children:x.jsx(Ws,{config:l})})),console.log("ChatbotWidgetDemo: Initialized successfully.")},destroy:()=>{qn&&(qn.unmount(),qn=null),window.ChatbotWidget&&window.ChatbotWidget.destroy(),hn&&!Ki&&hn.parentNode&&hn.parentNode.removeChild(hn),hn=null,Zi=null,Ll=null,Ki=!1,Qa=null,console.log("ChatbotWidgetDemo: Destroyed successfully.")},update:l=>{if(!qn||!Qa||!Ll){console.warn("ChatbotWidgetDemo: Not initialized. Call init() first.");return}Qa={...Qa,...l},qn.render(x.jsx(Du,{value:Ll,children:x.jsx(Ws,{config:Qa})}))},getConfig:()=>window.ChatbotWidget?{}:(console.warn("ChatbotWidgetDemo: Widget not available."),{})};return window.ChatbotWidgetDemo=xf,xf}));
|
|
@@ -12763,7 +12763,7 @@ const Gp = [
|
|
|
12763
12763
|
/* @__PURE__ */ v.jsxs(Wp, { fontFamily: s.fontFamily, children: [
|
|
12764
12764
|
O,
|
|
12765
12765
|
" v",
|
|
12766
|
-
"1.0.
|
|
12766
|
+
"1.0.74"
|
|
12767
12767
|
] })
|
|
12768
12768
|
] })
|
|
12769
12769
|
] }),
|
|
@@ -14988,7 +14988,7 @@ const K0 = N.div`
|
|
|
14988
14988
|
}
|
|
14989
14989
|
|
|
14990
14990
|
@media (max-width: 420px) {
|
|
14991
|
-
${({ floatingMode: n, isExpanded: c }) => n && !c && `
|
|
14991
|
+
${({ floatingMode: n, isExpanded: c, isOpen: s }) => n && !c && s && `
|
|
14992
14992
|
top: 0;
|
|
14993
14993
|
left: 0;
|
|
14994
14994
|
right: 0;
|
|
@@ -15070,6 +15070,7 @@ const K0 = N.div`
|
|
|
15070
15070
|
floatingMode: S,
|
|
15071
15071
|
useAbsolutePositioning: s.useAbsolutePositioning,
|
|
15072
15072
|
isExpanded: y,
|
|
15073
|
+
isOpen: n,
|
|
15073
15074
|
children: [
|
|
15074
15075
|
S && /* @__PURE__ */ v.jsx(
|
|
15075
15076
|
eb,
|
|
@@ -88,7 +88,7 @@ Error generating stack: `+a.message+`
|
|
|
88
88
|
@media (max-width: 420px) {
|
|
89
89
|
${({floatingMode:n})=>n&&"display: none;"}
|
|
90
90
|
}
|
|
91
|
-
`,xm=()=>{const{close:n,config:c,theme:s,assistant:r,isExpanded:d,toggleExpanded:y,startNewChat:S}=Wl(),C=c.headerTitle||r?.chatUiConfig?.avatarTitle||"AI Doctor",x=c.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL||"https://web.mypatientspace.com/img/logo-symbol.png",m=c.headerSubtitle||r?.chatUiConfig?.headerSubtitle,_=c.brandingText||r?.chatUiConfig?.brandingText||"Developed by myPatientSpace";return v.jsxs(sm,{theme:s,children:[v.jsxs(fm,{children:[v.jsx(dm,{theme:s,hasCustomIcon:!0,children:v.jsx(hm,{src:x,alt:""})}),v.jsxs(ym,{children:[v.jsx(mm,{fontFamily:s.fontFamily,children:C}),m&&v.jsx(gm,{fontFamily:s.fontFamily,children:m}),v.jsxs(pm,{fontFamily:s.fontFamily,children:[_," v","1.0.
|
|
91
|
+
`,xm=()=>{const{close:n,config:c,theme:s,assistant:r,isExpanded:d,toggleExpanded:y,startNewChat:S}=Wl(),C=c.headerTitle||r?.chatUiConfig?.avatarTitle||"AI Doctor",x=c.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL||"https://web.mypatientspace.com/img/logo-symbol.png",m=c.headerSubtitle||r?.chatUiConfig?.headerSubtitle,_=c.brandingText||r?.chatUiConfig?.brandingText||"Developed by myPatientSpace";return v.jsxs(sm,{theme:s,children:[v.jsxs(fm,{children:[v.jsx(dm,{theme:s,hasCustomIcon:!0,children:v.jsx(hm,{src:x,alt:""})}),v.jsxs(ym,{children:[v.jsx(mm,{fontFamily:s.fontFamily,children:C}),m&&v.jsx(gm,{fontFamily:s.fontFamily,children:m}),v.jsxs(pm,{fontFamily:s.fontFamily,children:[_," v","1.0.74"]})]})]}),v.jsxs(vm,{children:[v.jsx(nc,{theme:s,onClick:S,"aria-label":"Start new chat",children:v.jsx(cm,{size:16})}),v.jsx(bm,{floatingMode:c.floatingMode,children:v.jsx(nc,{theme:s,onClick:y,"aria-label":d?"Collapse chat":"Expand chat",children:d?v.jsx(gs,{size:16}):v.jsx(ys,{size:16})})}),c.floatingMode&&v.jsx(nc,{theme:s,onClick:n,"aria-label":"Close chat",children:v.jsx(pi,{size:16})})]})]})},Sm=N.div`
|
|
92
92
|
position: relative;
|
|
93
93
|
background-color: ${({theme:n})=>n.colors.background};
|
|
94
94
|
border-bottom: 1px solid ${({theme:n})=>n.colors.borderLight};
|
|
@@ -1356,7 +1356,7 @@ Error generating stack: `+a.message+`
|
|
|
1356
1356
|
}
|
|
1357
1357
|
|
|
1358
1358
|
@media (max-width: 420px) {
|
|
1359
|
-
${({floatingMode:n,isExpanded:c})=>n&&!c&&`
|
|
1359
|
+
${({floatingMode:n,isExpanded:c,isOpen:s})=>n&&!c&&s&&`
|
|
1360
1360
|
top: 0;
|
|
1361
1361
|
left: 0;
|
|
1362
1362
|
right: 0;
|
|
@@ -1423,4 +1423,4 @@ Error generating stack: `+a.message+`
|
|
|
1423
1423
|
border-radius: 0;
|
|
1424
1424
|
`}
|
|
1425
1425
|
}
|
|
1426
|
-
`,Ap=()=>{const{isOpen:n,toggle:c,config:s,theme:r,assistant:d,isExpanded:y}=Wl(),S=s.floatingMode??!1,[C,x]=M.useState(null),m=M.useCallback(w=>{x(w)},[]),_=M.useCallback(()=>{x(null)},[]),A=s.fabIcon||d?.chatUiConfig?.fabIcon||"https://web.mypatientspace.com/img/logo-symbol.png";return v.jsxs(v.Fragment,{children:[v.jsx(xp,{isVisible:y}),v.jsxs(Sp,{position:s.position||"bottom-right",floatingMode:S,useAbsolutePositioning:s.useAbsolutePositioning,isExpanded:y,children:[S&&v.jsx(Tp,{theme:r,isOpen:n,hasCustomIcon:!0,onClick:c,"aria-label":"Open chat","aria-expanded":n,children:v.jsx(Ep,{src:A,alt:"Chat"})}),v.jsxs(zp,{theme:r,isOpen:n,isClosing:!1,floatingMode:S,isExpanded:y,useAbsolutePositioning:s.useAbsolutePositioning,children:[v.jsx(xm,{}),v.jsx(Am,{}),v.jsx(ag,{onCardExpand:m}),v.jsx(lp,{}),C&&v.jsx(gp,{citation:C,theme:r,onClose:_})]})]})]})},Cp={position:"bottom-right",colorMode:"light"};let xa=null,ee=null,bi=null;const ye={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:n=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},startNewChat:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},_p=({config:n,onMount:c})=>{const s=M.useRef(null),r=M.useCallback(d=>{s.current=d},[]);return v.jsx(ky,{config:n,onConfigUpdate:r,children:v.jsx(Op,{onMount:c,updateConfigRef:s})})},Op=({onMount:n,updateConfigRef:c})=>{const{open:s,close:r,toggle:d,startNewChat:y}=Wl();return M.useEffect(()=>{n({open:s,close:r,toggle:d,updateConfig:S=>{c.current?.(S)},startNewChat:y})},[s,r,d,y,n,c]),v.jsx(Ap,{})},Rs={init:n=>{if(xa){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const c={...Cp,...n,floatingMode:n.floatingMode??!1};if(n.containerElement)ee=document.createElement("div"),ee.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",n.containerElement.appendChild(ee);else if(c.floatingMode)ee=document.createElement("div"),ee.id="chatbot-widget-root",document.body.appendChild(ee);else if(n.containerSelector){const d=document.querySelector(n.containerSelector);if(!d){console.error(`ChatbotWidget: Container not found for selector "${n.containerSelector}".`);return}ee=document.createElement("div"),ee.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",d.appendChild(ee)}else ee=document.createElement("div"),ee.id="chatbot-widget-root",document.body.appendChild(ee);bi=ee.attachShadow({mode:"open"});const s=document.createElement("div");s.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",bi.appendChild(s);const r=Qr({key:"mps-chatbot",container:bi});xa=Gh.createRoot(s),xa.render(v.jsx(Oy,{value:r,children:v.jsx(_p,{config:c,onMount:d=>{ye.open=d.open,ye.close=d.close,ye.toggle=d.toggle,ye.updateConfig=d.updateConfig,ye.startNewChat=d.startNewChat}})})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{xa&&(xa.unmount(),xa=null),ee&&ee.parentNode&&ee.parentNode.removeChild(ee),ee=null,bi=null,ye.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.startNewChat=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>ye.open(),close:()=>ye.close(),toggle:()=>ye.toggle(),update:n=>ye.updateConfig(n),startNewChat:()=>ye.startNewChat()};return window.ChatbotWidget=Rs,Rs}));
|
|
1426
|
+
`,Ap=()=>{const{isOpen:n,toggle:c,config:s,theme:r,assistant:d,isExpanded:y}=Wl(),S=s.floatingMode??!1,[C,x]=M.useState(null),m=M.useCallback(w=>{x(w)},[]),_=M.useCallback(()=>{x(null)},[]),A=s.fabIcon||d?.chatUiConfig?.fabIcon||"https://web.mypatientspace.com/img/logo-symbol.png";return v.jsxs(v.Fragment,{children:[v.jsx(xp,{isVisible:y}),v.jsxs(Sp,{position:s.position||"bottom-right",floatingMode:S,useAbsolutePositioning:s.useAbsolutePositioning,isExpanded:y,isOpen:n,children:[S&&v.jsx(Tp,{theme:r,isOpen:n,hasCustomIcon:!0,onClick:c,"aria-label":"Open chat","aria-expanded":n,children:v.jsx(Ep,{src:A,alt:"Chat"})}),v.jsxs(zp,{theme:r,isOpen:n,isClosing:!1,floatingMode:S,isExpanded:y,useAbsolutePositioning:s.useAbsolutePositioning,children:[v.jsx(xm,{}),v.jsx(Am,{}),v.jsx(ag,{onCardExpand:m}),v.jsx(lp,{}),C&&v.jsx(gp,{citation:C,theme:r,onClose:_})]})]})]})},Cp={position:"bottom-right",colorMode:"light"};let xa=null,ee=null,bi=null;const ye={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:n=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},startNewChat:()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},_p=({config:n,onMount:c})=>{const s=M.useRef(null),r=M.useCallback(d=>{s.current=d},[]);return v.jsx(ky,{config:n,onConfigUpdate:r,children:v.jsx(Op,{onMount:c,updateConfigRef:s})})},Op=({onMount:n,updateConfigRef:c})=>{const{open:s,close:r,toggle:d,startNewChat:y}=Wl();return M.useEffect(()=>{n({open:s,close:r,toggle:d,updateConfig:S=>{c.current?.(S)},startNewChat:y})},[s,r,d,y,n,c]),v.jsx(Ap,{})},Rs={init:n=>{if(xa){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const c={...Cp,...n,floatingMode:n.floatingMode??!1};if(n.containerElement)ee=document.createElement("div"),ee.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",n.containerElement.appendChild(ee);else if(c.floatingMode)ee=document.createElement("div"),ee.id="chatbot-widget-root",document.body.appendChild(ee);else if(n.containerSelector){const d=document.querySelector(n.containerSelector);if(!d){console.error(`ChatbotWidget: Container not found for selector "${n.containerSelector}".`);return}ee=document.createElement("div"),ee.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",d.appendChild(ee)}else ee=document.createElement("div"),ee.id="chatbot-widget-root",document.body.appendChild(ee);bi=ee.attachShadow({mode:"open"});const s=document.createElement("div");s.style.cssText="width: 100%; height: 100%; border-radius: inherit; overflow: hidden;",bi.appendChild(s);const r=Qr({key:"mps-chatbot",container:bi});xa=Gh.createRoot(s),xa.render(v.jsx(Oy,{value:r,children:v.jsx(_p,{config:c,onMount:d=>{ye.open=d.open,ye.close=d.close,ye.toggle=d.toggle,ye.updateConfig=d.updateConfig,ye.startNewChat=d.startNewChat}})})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{xa&&(xa.unmount(),xa=null),ee&&ee.parentNode&&ee.parentNode.removeChild(ee),ee=null,bi=null,ye.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},ye.startNewChat=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>ye.open(),close:()=>ye.close(),toggle:()=>ye.toggle(),update:n=>ye.updateConfig(n),startNewChat:()=>ye.startNewChat()};return window.ChatbotWidget=Rs,Rs}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mypatientspace/chatbot-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.74",
|
|
4
4
|
"description": "Embeddable healthcare chatbot widget for websites and mobile apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/mypatientspace-widget.umd.js",
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
"typescript-eslint": "^8.46.4",
|
|
50
50
|
"vite": "^7.2.4"
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|