@careshiphealth/sdk 2.0.5 → 2.0.7
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/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var SuperCareEmbedSDK=function(e){"use strict";var t=Object.defineProperty,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,d=(e,t,i)=>new Promise((n,r)=>{var o=e=>{try{s(i.next(e))}catch(t){r(t)}},d=e=>{try{s(i.throw(e))}catch(t){r(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,d);s((i=i.apply(e,t)).next())});const s=`https://cdn.jsdelivr.net/npm/@careshiphealth/widget@${"2.0.
|
|
1
|
+
var SuperCareEmbedSDK=function(e){"use strict";var t=Object.defineProperty,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,d=(e,t,i)=>new Promise((n,r)=>{var o=e=>{try{s(i.next(e))}catch(t){r(t)}},d=e=>{try{s(i.throw(e))}catch(t){r(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,d);s((i=i.apply(e,t)).next())});const s=`https://cdn.jsdelivr.net/npm/@careshiphealth/widget@${"2.0.7"}`,c={WIDGET_JS:`${s}/dist/widget.iife.js`,WIDGET_CSS:`${s}/dist/widget.css`};class l{constructor(){this.isWidgetEmbedded=!1,this.scriptElement=null,this.cssElement=null,this.containerElement=null,this.config=null}embed(e){return d(this,null,function*(){if(this.isWidgetEmbedded)console.warn("SuperCare widget is already embedded");else{this.config=((e,t)=>{for(var d in t||(t={}))n.call(t,d)&&o(e,d,t[d]);if(i)for(var d of i(t))r.call(t,d)&&o(e,d,t[d]);return e})({autoInit:!0},e);try{yield this.injectCSS(),yield this.injectContainer(),yield this.injectScript(),this.isWidgetEmbedded=!0}catch(t){throw console.error("Failed to embed SuperCare widget:",t),this.cleanup(),t}}})}remove(){this.isWidgetEmbedded?(this.cleanup(),this.isWidgetEmbedded=!1):console.warn("SuperCare widget is not embedded")}isEmbedded(){return this.isWidgetEmbedded}injectCSS(){return d(this,null,function*(){return new Promise((e,t)=>{if(document.querySelector(`link[href="${c.WIDGET_CSS}"]`))return void e();const i=document.createElement("link");i.rel="stylesheet",i.href=c.WIDGET_CSS,i.onload=()=>{this.cssElement=i,e()},i.onerror=()=>{t(new Error(`Failed to load CSS from ${c.WIDGET_CSS}`))},document.head.appendChild(i)})})}injectContainer(){return d(this,null,function*(){var e;if(!(null==(e=this.config)?void 0:e.containerId))throw new Error("Container ID is required");const t=document.getElementById(this.config.containerId);if(t)return void(this.containerElement=t);const i=document.createElement("div");i.id=this.config.containerId,document.body.appendChild(i),this.containerElement=i})}injectScript(){return d(this,null,function*(){return new Promise((e,t)=>{var i,n;if(!(null==(i=this.config)?void 0:i.orgId)||!(null==(n=this.config)?void 0:n.apiKey))return void t(new Error("Org ID and API Key are required"));if(document.getElementById("supercare-09u2ekhbpo-script"))return void e();const r=document.createElement("script");r.id="supercare-09u2ekhbpo-script",r.dataset[""],r.type="module",r.src=`${c.WIDGET_JS}?orgId=${this.config.orgId}&apiKey=${this.config.apiKey}`,r.onload=()=>{this.scriptElement=r,e()},r.onerror=()=>{t(new Error(`Failed to load script from ${c.WIDGET_JS}`))},document.body.appendChild(r)})})}cleanup(){this.scriptElement&&(this.scriptElement.remove(),this.scriptElement=null),this.cssElement&&(this.cssElement.remove(),this.cssElement=null),this.containerElement&&(this.containerElement.remove(),this.containerElement=null),this.config=null}}const a=new l;return"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector("script[data-supercare-org-id]");if(e){const t=e.getAttribute("data-supercare-org-id"),i=e.getAttribute("data-supercare-container-id")||void 0;t&&i&&a.embed({orgId:t,apiKey:e.getAttribute("data-supercare-api-key")||"",containerId:i}).catch(console.error)}}),"undefined"!=typeof window&&(window.SuperCareEmbed=a),e.SuperCareEmbed=l,e.default=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});
|
|
2
2
|
//# sourceMappingURL=supercare-embed-sdk.iife.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SuperCareEmbedSDK={})}(this,function(e){"use strict";var t=Object.defineProperty,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,d=(e,t,i)=>new Promise((n,r)=>{var o=e=>{try{s(i.next(e))}catch(t){r(t)}},d=e=>{try{s(i.throw(e))}catch(t){r(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,d);s((i=i.apply(e,t)).next())});const s=`https://cdn.jsdelivr.net/npm/@careshiphealth/widget@${"2.0.
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SuperCareEmbedSDK={})}(this,function(e){"use strict";var t=Object.defineProperty,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,d=(e,t,i)=>new Promise((n,r)=>{var o=e=>{try{s(i.next(e))}catch(t){r(t)}},d=e=>{try{s(i.throw(e))}catch(t){r(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,d);s((i=i.apply(e,t)).next())});const s=`https://cdn.jsdelivr.net/npm/@careshiphealth/widget@${"2.0.7"}`,c={WIDGET_JS:`${s}/dist/widget.iife.js`,WIDGET_CSS:`${s}/dist/widget.css`};class l{constructor(){this.isWidgetEmbedded=!1,this.scriptElement=null,this.cssElement=null,this.containerElement=null,this.config=null}embed(e){return d(this,null,function*(){if(this.isWidgetEmbedded)console.warn("SuperCare widget is already embedded");else{this.config=((e,t)=>{for(var d in t||(t={}))n.call(t,d)&&o(e,d,t[d]);if(i)for(var d of i(t))r.call(t,d)&&o(e,d,t[d]);return e})({autoInit:!0},e);try{yield this.injectCSS(),yield this.injectContainer(),yield this.injectScript(),this.isWidgetEmbedded=!0}catch(t){throw console.error("Failed to embed SuperCare widget:",t),this.cleanup(),t}}})}remove(){this.isWidgetEmbedded?(this.cleanup(),this.isWidgetEmbedded=!1):console.warn("SuperCare widget is not embedded")}isEmbedded(){return this.isWidgetEmbedded}injectCSS(){return d(this,null,function*(){return new Promise((e,t)=>{if(document.querySelector(`link[href="${c.WIDGET_CSS}"]`))return void e();const i=document.createElement("link");i.rel="stylesheet",i.href=c.WIDGET_CSS,i.onload=()=>{this.cssElement=i,e()},i.onerror=()=>{t(new Error(`Failed to load CSS from ${c.WIDGET_CSS}`))},document.head.appendChild(i)})})}injectContainer(){return d(this,null,function*(){var e;if(!(null==(e=this.config)?void 0:e.containerId))throw new Error("Container ID is required");const t=document.getElementById(this.config.containerId);if(t)return void(this.containerElement=t);const i=document.createElement("div");i.id=this.config.containerId,document.body.appendChild(i),this.containerElement=i})}injectScript(){return d(this,null,function*(){return new Promise((e,t)=>{var i,n;if(!(null==(i=this.config)?void 0:i.orgId)||!(null==(n=this.config)?void 0:n.apiKey))return void t(new Error("Org ID and API Key are required"));if(document.getElementById("supercare-09u2ekhbpo-script"))return void e();const r=document.createElement("script");r.id="supercare-09u2ekhbpo-script",r.dataset[""],r.type="module",r.src=`${c.WIDGET_JS}?orgId=${this.config.orgId}&apiKey=${this.config.apiKey}`,r.onload=()=>{this.scriptElement=r,e()},r.onerror=()=>{t(new Error(`Failed to load script from ${c.WIDGET_JS}`))},document.body.appendChild(r)})})}cleanup(){this.scriptElement&&(this.scriptElement.remove(),this.scriptElement=null),this.cssElement&&(this.cssElement.remove(),this.cssElement=null),this.containerElement&&(this.containerElement.remove(),this.containerElement=null),this.config=null}}const a=new l;"undefined"!=typeof window&&window.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector("script[data-supercare-org-id]");if(e){const t=e.getAttribute("data-supercare-org-id"),i=e.getAttribute("data-supercare-container-id")||void 0;t&&i&&a.embed({orgId:t,apiKey:e.getAttribute("data-supercare-api-key")||"",containerId:i}).catch(console.error)}}),"undefined"!=typeof window&&(window.SuperCareEmbed=a),e.SuperCareEmbed=l,e.default=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
2
|
//# sourceMappingURL=supercare-embed-sdk.umd.js.map
|