@mypatientspace/chatbot-widget 1.0.46 → 1.0.47

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.
@@ -12401,7 +12401,7 @@ const ug = [
12401
12401
  D && /* @__PURE__ */ K.jsxs(mg, { fontFamily: s.fontFamily, children: [
12402
12402
  D,
12403
12403
  " v",
12404
- "1.0.46"
12404
+ "1.0.47"
12405
12405
  ] })
12406
12406
  ] })
12407
12407
  ] }),
@@ -12968,7 +12968,7 @@ const ug = [
12968
12968
  transform: translateY(20px) scale(0.95);
12969
12969
  }
12970
12970
  `, kg = yt.div`
12971
- position: ${({ floatingMode: i }) => i ? "fixed" : "relative"};
12971
+ position: ${({ floatingMode: i, useAbsolutePositioning: f }) => i ? f ? "absolute" : "fixed" : "relative"};
12972
12972
  ${({ floatingMode: i, position: f }) => i && `
12973
12973
  bottom: 20px;
12974
12974
  ${f === "bottom-right" ? "right: 20px;" : "left: 20px;"}
@@ -13037,6 +13037,7 @@ const ug = [
13037
13037
  {
13038
13038
  position: s.position || "bottom-right",
13039
13039
  floatingMode: v,
13040
+ useAbsolutePositioning: s.useAbsolutePositioning,
13040
13041
  children: [
13041
13042
  v && /* @__PURE__ */ K.jsx(
13042
13043
  Wg,
@@ -78,7 +78,7 @@ Error generating stack: `+a.message+`
78
78
  &:active {
79
79
  background-color: rgba(255, 255, 255, 0.4);
80
80
  }
81
- `,Qm=()=>{const{close:i,config:f,theme:s,assistant:r}=ca(),y=f.headerTitle||r?.chatUiConfig?.avatarTitle||"Chat",v=f.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL,A=f.headerSubtitle||r?.chatUiConfig?.headerSubtitle,D=f.brandingText||r?.chatUiConfig?.brandingText;return K.jsxs(Rm,{theme:s,children:[K.jsxs(Nm,{children:[v&&K.jsx(Hm,{theme:s,hasCustomIcon:!0,children:K.jsx(jm,{src:v,alt:""})}),K.jsxs(qm,{children:[K.jsx(Bm,{fontFamily:s.fontFamily,children:y}),A&&K.jsx(Ym,{fontFamily:s.fontFamily,children:A}),D&&K.jsxs(Gm,{fontFamily:s.fontFamily,children:[D," v","1.0.46"]})]})]}),f.floatingMode&&K.jsx(Xm,{theme:s,onClick:i,"aria-label":"Minimize chat",children:K.jsx(_m,{size:20})})]})},Lm=yt.div`
81
+ `,Qm=()=>{const{close:i,config:f,theme:s,assistant:r}=ca(),y=f.headerTitle||r?.chatUiConfig?.avatarTitle||"Chat",v=f.headerIcon||r?.chatUiConfig?.avatarImage?.iconURL||r?.chatUiConfig?.avatarImage?.thumbnailURL,A=f.headerSubtitle||r?.chatUiConfig?.headerSubtitle,D=f.brandingText||r?.chatUiConfig?.brandingText;return K.jsxs(Rm,{theme:s,children:[K.jsxs(Nm,{children:[v&&K.jsx(Hm,{theme:s,hasCustomIcon:!0,children:K.jsx(jm,{src:v,alt:""})}),K.jsxs(qm,{children:[K.jsx(Bm,{fontFamily:s.fontFamily,children:y}),A&&K.jsx(Ym,{fontFamily:s.fontFamily,children:A}),D&&K.jsxs(Gm,{fontFamily:s.fontFamily,children:[D," v","1.0.47"]})]})]}),f.floatingMode&&K.jsx(Xm,{theme:s,onClick:i,"aria-label":"Minimize chat",children:K.jsx(_m,{size:20})})]})},Lm=yt.div`
82
82
  display: flex;
83
83
  gap: 8px;
84
84
  padding: 12px 16px;
@@ -415,7 +415,7 @@ Error generating stack: `+a.message+`
415
415
  transform: translateY(20px) scale(0.95);
416
416
  }
417
417
  `,Sh=yt.div`
418
- position: ${({floatingMode:i})=>i?"fixed":"relative"};
418
+ position: ${({floatingMode:i,useAbsolutePositioning:f})=>i?f?"absolute":"fixed":"relative"};
419
419
  ${({floatingMode:i,position:f})=>i&&`
420
420
  bottom: 20px;
421
421
  ${f==="bottom-right"?"right: 20px;":"left: 20px;"}
@@ -477,4 +477,4 @@ Error generating stack: `+a.message+`
477
477
  max-height: 600px;
478
478
  `}
479
479
  }
480
- `,Ah=()=>{const{isOpen:i,toggle:f,config:s,theme:r,assistant:y}=ca(),v=s.floatingMode??!1,A=s.fabIcon||y?.chatUiConfig?.fabIcon;return K.jsxs(Sh,{position:s.position||"bottom-right",floatingMode:v,children:[v&&K.jsx(Th,{theme:r,isOpen:i,hasCustomIcon:!!A,onClick:f,"aria-label":"Open chat","aria-expanded":i,children:A?K.jsx(zh,{src:A,alt:"Chat"}):K.jsx(Om,{size:24})}),K.jsxs(Eh,{theme:r,isOpen:i,isClosing:!1,floatingMode:v,children:[K.jsx(Qm,{}),K.jsx(Zm,{}),K.jsx(oh,{}),K.jsx(vh,{})]})]})},no={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 fa=null,ae=null,uu=null;const _e={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:i=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},xh=({config:i,onMount:f})=>{const s=q.useRef(null),r=q.useCallback(y=>{s.current=y},[]);return K.jsx(ym,{config:i,onConfigUpdate:r,children:K.jsx(_h,{onMount:f,updateConfigRef:s})})},_h=({onMount:i,updateConfigRef:f})=>{const{open:s,close:r,toggle:y}=ca();return q.useEffect(()=>{i({open:s,close:r,toggle:y,updateConfig:v=>{f.current?.(v)}})},[s,r,y,i,f]),K.jsx(Ah,{})},uo={init:i=>{if(fa){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const f={...no,...i,quickActions:i.quickActions??no.quickActions,floatingMode:i.floatingMode??!1};if(i.containerElement)ae=document.createElement("div"),ae.style.cssText="width: 100%; height: 100%;",i.containerElement.appendChild(ae);else if(i.containerSelector){const y=document.querySelector(i.containerSelector);if(!y){console.error(`ChatbotWidget: Container not found for selector "${i.containerSelector}".`);return}ae=document.createElement("div"),ae.style.cssText="width: 100%; height: 100%;",y.appendChild(ae)}else ae=document.createElement("div"),ae.id="chatbot-widget-root",document.body.appendChild(ae);uu=ae.attachShadow({mode:"open"});const s=document.createElement("div");s.style.cssText="width: 100%; height: 100%;",uu.appendChild(s);const r=Nr({key:"mps-chatbot",container:uu});fa=vy.createRoot(s),fa.render(K.jsx(am,{value:r,children:K.jsx(xh,{config:f,onMount:y=>{_e.open=y.open,_e.close=y.close,_e.toggle=y.toggle,_e.updateConfig=y.updateConfig}})})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{fa&&(fa.unmount(),fa=null),ae&&ae.parentNode&&ae.parentNode.removeChild(ae),ae=null,uu=null,_e.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},_e.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},_e.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},_e.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>_e.open(),close:()=>_e.close(),toggle:()=>_e.toggle(),update:i=>_e.updateConfig(i)};return window.ChatbotWidget=uo,uo}));
480
+ `,Ah=()=>{const{isOpen:i,toggle:f,config:s,theme:r,assistant:y}=ca(),v=s.floatingMode??!1,A=s.fabIcon||y?.chatUiConfig?.fabIcon;return K.jsxs(Sh,{position:s.position||"bottom-right",floatingMode:v,useAbsolutePositioning:s.useAbsolutePositioning,children:[v&&K.jsx(Th,{theme:r,isOpen:i,hasCustomIcon:!!A,onClick:f,"aria-label":"Open chat","aria-expanded":i,children:A?K.jsx(zh,{src:A,alt:"Chat"}):K.jsx(Om,{size:24})}),K.jsxs(Eh,{theme:r,isOpen:i,isClosing:!1,floatingMode:v,children:[K.jsx(Qm,{}),K.jsx(Zm,{}),K.jsx(oh,{}),K.jsx(vh,{})]})]})},no={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 fa=null,ae=null,uu=null;const _e={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:i=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")}},xh=({config:i,onMount:f})=>{const s=q.useRef(null),r=q.useCallback(y=>{s.current=y},[]);return K.jsx(ym,{config:i,onConfigUpdate:r,children:K.jsx(_h,{onMount:f,updateConfigRef:s})})},_h=({onMount:i,updateConfigRef:f})=>{const{open:s,close:r,toggle:y}=ca();return q.useEffect(()=>{i({open:s,close:r,toggle:y,updateConfig:v=>{f.current?.(v)}})},[s,r,y,i,f]),K.jsx(Ah,{})},uo={init:i=>{if(fa){console.warn("ChatbotWidget: Already initialized. Call destroy() first to reinitialize.");return}const f={...no,...i,quickActions:i.quickActions??no.quickActions,floatingMode:i.floatingMode??!1};if(i.containerElement)ae=document.createElement("div"),ae.style.cssText="width: 100%; height: 100%;",i.containerElement.appendChild(ae);else if(i.containerSelector){const y=document.querySelector(i.containerSelector);if(!y){console.error(`ChatbotWidget: Container not found for selector "${i.containerSelector}".`);return}ae=document.createElement("div"),ae.style.cssText="width: 100%; height: 100%;",y.appendChild(ae)}else ae=document.createElement("div"),ae.id="chatbot-widget-root",document.body.appendChild(ae);uu=ae.attachShadow({mode:"open"});const s=document.createElement("div");s.style.cssText="width: 100%; height: 100%;",uu.appendChild(s);const r=Nr({key:"mps-chatbot",container:uu});fa=vy.createRoot(s),fa.render(K.jsx(am,{value:r,children:K.jsx(xh,{config:f,onMount:y=>{_e.open=y.open,_e.close=y.close,_e.toggle=y.toggle,_e.updateConfig=y.updateConfig}})})),console.log("ChatbotWidget: Initialized successfully.")},destroy:()=>{fa&&(fa.unmount(),fa=null),ae&&ae.parentNode&&ae.parentNode.removeChild(ae),ae=null,uu=null,_e.open=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},_e.close=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},_e.toggle=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},_e.updateConfig=()=>{console.warn("ChatbotWidget: Widget not initialized. Call init() first.")},console.log("ChatbotWidget: Destroyed successfully.")},open:()=>_e.open(),close:()=>_e.close(),toggle:()=>_e.toggle(),update:i=>_e.updateConfig(i)};return window.ChatbotWidget=uo,uo}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mypatientspace/chatbot-widget",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "Embeddable healthcare chatbot widget for websites and mobile apps",
5
5
  "type": "module",
6
6
  "main": "dist/mypatientspace-widget.umd.js",