@eka-care/medassist-widget-embed 0.2.30 → 0.2.31

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -95,8 +95,8 @@
95
95
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
96
96
  }
97
97
  #medassist-open-btn img {
98
- width: 30px;
99
- height: 30px;
98
+ width: 45px;
99
+ height: 45px;
100
100
  }
101
101
  :host {
102
102
  position: fixed;
@@ -136,4 +136,4 @@
136
136
  }
137
137
  </style>
138
138
  <div id="medassist-widget-root"></div>
139
- `)}async loadAndRender(){var t,o,i;const n=this.shadowRoot;if(!n){console.error("Shadow root is not available");return}this.style.display="";const d=n.getElementById("medassist-open-btn"),s=n.getElementById("medassist-widget-root"),r=this.getAttribute("agent-id");let c=this.getAttribute("icon-url")||this.defaultIconUrl;const a=(t=getEnvironment(this.getAttribute("environment")))!==null&&t!==void 0?t:"production",u=this.getAttribute("connectivity"),m=u==="sse"||u==="socket"?u:void 0;let h=this.getAttribute("title")||"Medi Clinic";const f=this.getAttribute("base-url")||"https://matrix.eka.care/reloaded",p=this.getAttribute("display-mode")==="full"?"full":"widget",E=this.getAttribute("context")?JSON.parse(this.getAttribute("context")||"{}"):void 0,M=this.getAttribute("theme")?(()=>{try{return JSON.parse(this.getAttribute("theme")||"{}")}catch{return}})():void 0,g=(typeof window!="undefined"?window.__ekaMedAssistConfig__:void 0)||{},S={...E||{},...g.context||{}},I=g.auth||void 0,w=g.agentId||r,U=g.baseUrl||f,b=typeof window!="undefined"?(o=window.EkaMedAssist)===null||o===void 0?void 0:o.onClose:void 0;if(!w){console.error("Agent ID is required");return}if(!s){console.error("Widget root element is missing");return}d&&d.classList.add("hidden"),s.classList.remove("hidden");let x,A,_,k=!1;try{const l=await this.getAgentConfig();h=(l==null?void 0:l.name)||h,c=((i=l==null?void 0:l.theme)===null||i===void 0?void 0:i.icon_img)||c,x=mapAgentConfigThemeToWidgetTheme((l==null?void 0:l.theme)||void 0),A=l==null?void 0:l.allowed,_=l==null?void 0:l.connectivity,k=(l==null?void 0:l.resize)||(g==null?void 0:g.resize)||!1}catch{}const L=_||m||"socket",C={title:g.title||h,iconUrl:g.iconUrl||c,allowed:A,environment:a,connectionType:L,onClose:()=>{var l;(l=this.reactRoot)===null||l===void 0||l.unmount(),this.reactRoot=null,b&&typeof b=="function"&&b(),p==="full"?this.style.display="none":(d&&d.classList.remove("hidden"),s.classList.add("hidden"))},baseUrl:U,context:S,displayMode:p,resize:k||this.getAttribute("resize")==="true",auth:I,theme:{...x||{},...M||{},...g.theme||{}}},v=window;if(this.widgetLoaded){this.reactRoot=v.renderMedAssist(s,w,C);return}try{if(await Promise.all([this.loadWidgetCss(),this.loadWidgetScript()]),typeof v.renderMedAssist!="function")throw new Error("renderMedAssist is not available on window");this.reactRoot=v.renderMedAssist(s,w,C),this.widgetLoaded=!0}catch(l){console.error("Failed to load MedAssist widget",l),d&&d.classList.remove("hidden"),s.classList.add("hidden")}}async loadWidgetCss(){const t=this.shadowRoot;if(!t)throw new Error("Shadow root is not available");if(t.querySelector("[data-medassist-style='true']"))return;const o=await getWidgetCssTextPromise(),i=document.createElement("style");i.setAttribute("data-medassist-style","true"),i.textContent=o,t.appendChild(i)}loadWidgetScript(){return widgetScriptPromise||(widgetScriptPromise=new Promise((t,o)=>{const i=document.querySelector(`script[src="${WIDGET_JS_URL}"]`);if(i){if(i.dataset.loaded==="true"){t();return}i.addEventListener("load",()=>t()),i.addEventListener("error",d=>o(d.error||new Error("Unknown script loading error")));return}const n=document.createElement("script");n.src=WIDGET_JS_URL,n.async=!0,n.dataset.widget="medassist",n.onload=()=>{n.dataset.loaded="true",t()},n.onerror=d=>{if(d instanceof ErrorEvent&&d.error){o(d.error);return}o(new Error(`Failed to load ${WIDGET_JS_URL}`))},document.head.appendChild(n)})),widgetScriptPromise}}customElements.define("eka-medassist-widget",MedAssistWidgetLoader);
139
+ `)}async loadAndRender(){var t,o,i;const n=this.shadowRoot;if(!n){console.error("Shadow root is not available");return}this.style.display="";const d=n.getElementById("medassist-open-btn"),s=n.getElementById("medassist-widget-root"),r=this.getAttribute("agent-id");let c=this.getAttribute("icon-url")||this.defaultIconUrl;const a=(t=getEnvironment(this.getAttribute("environment")))!==null&&t!==void 0?t:"production",u=this.getAttribute("connectivity"),m=u==="sse"||u==="socket"?u:void 0;let h=this.getAttribute("title")||"Medi Clinic";const f=this.getAttribute("base-url")||"https://matrix.eka.care/reloaded",p=this.getAttribute("display-mode")==="full"?"full":"widget",E=this.getAttribute("context")?JSON.parse(this.getAttribute("context")||"{}"):void 0,M=this.getAttribute("theme")?(()=>{try{return JSON.parse(this.getAttribute("theme")||"{}")}catch{return}})():void 0,g=(typeof window!="undefined"?window.__ekaMedAssistConfig__:void 0)||{},S={...E||{},...g.context||{}},I=g.auth||void 0,w=g.agentId||r,U=g.baseUrl||f,b=typeof window!="undefined"?(o=window.EkaMedAssist)===null||o===void 0?void 0:o.onClose:void 0;if(!w){console.error("Agent ID is required");return}if(!s){console.error("Widget root element is missing");return}d&&d.classList.add("hidden"),s.classList.remove("hidden");let x,A,_,k=!1;try{const l=await this.getAgentConfig();h=(l==null?void 0:l.name)||h,c=((i=l==null?void 0:l.theme)===null||i===void 0?void 0:i.icon_img)||c,x=mapAgentConfigThemeToWidgetTheme((l==null?void 0:l.theme)||void 0),A=l==null?void 0:l.allowed,_=l==null?void 0:l.connectivity,k=(l==null?void 0:l.resize)||(g==null?void 0:g.resize)||!1}catch{}const L=_||m||"socket",C={title:g.title||h,iconUrl:c||g.iconUrl,allowed:A,environment:a,connectionType:L,onClose:()=>{var l;(l=this.reactRoot)===null||l===void 0||l.unmount(),this.reactRoot=null,b&&typeof b=="function"&&b(),p==="full"?this.style.display="none":(d&&d.classList.remove("hidden"),s.classList.add("hidden"))},baseUrl:U,context:S,displayMode:p,resize:k||this.getAttribute("resize")==="true",auth:I,theme:{...x||{},...M||{},...g.theme||{}}},v=window;if(this.widgetLoaded){this.reactRoot=v.renderMedAssist(s,w,C);return}try{if(await Promise.all([this.loadWidgetCss(),this.loadWidgetScript()]),typeof v.renderMedAssist!="function")throw new Error("renderMedAssist is not available on window");this.reactRoot=v.renderMedAssist(s,w,C),this.widgetLoaded=!0}catch(l){console.error("Failed to load MedAssist widget",l),d&&d.classList.remove("hidden"),s.classList.add("hidden")}}async loadWidgetCss(){const t=this.shadowRoot;if(!t)throw new Error("Shadow root is not available");if(t.querySelector("[data-medassist-style='true']"))return;const o=await getWidgetCssTextPromise(),i=document.createElement("style");i.setAttribute("data-medassist-style","true"),i.textContent=o,t.appendChild(i)}loadWidgetScript(){return widgetScriptPromise||(widgetScriptPromise=new Promise((t,o)=>{const i=document.querySelector(`script[src="${WIDGET_JS_URL}"]`);if(i){if(i.dataset.loaded==="true"){t();return}i.addEventListener("load",()=>t()),i.addEventListener("error",d=>o(d.error||new Error("Unknown script loading error")));return}const n=document.createElement("script");n.src=WIDGET_JS_URL,n.async=!0,n.dataset.widget="medassist",n.onload=()=>{n.dataset.loaded="true",t()},n.onerror=d=>{if(d instanceof ErrorEvent&&d.error){o(d.error);return}o(new Error(`Failed to load ${WIDGET_JS_URL}`))},document.head.appendChild(n)})),widgetScriptPromise}}customElements.define("eka-medassist-widget",MedAssistWidgetLoader);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/medassist-widget-embed",
3
- "version": "0.2.30",
3
+ "version": "0.2.31",
4
4
  "description": "Embeddable MedAssist widget loader built with Web Components.",
5
5
  "author": "Geethanjali S",
6
6
  "license": "MIT",