UNPKG

@canopyconnect/components

Version:

Canopy Connect Components loading utility

2 lines 1.05 kB
var e={d:(n,o)=>{for(var t in o)e.o(o,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:o[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},n={};let o;function t(){return void 0!==o||(o=new Promise(((e,n)=>{!function(e,n){const o=document.createElement("script");o.src="https://components.usecanopy.com/v1/cc-components.js",o.async=!0,o.fetchPriority="high",o.addEventListener("load",r,{once:!0}),o.addEventListener("error",c,{once:!0});const t=document.head||document.body;if(!t)throw new Error("Failed to find <head> or <body> element to append script");function r(){o.removeEventListener("error",c),e()}function c(e){o.removeEventListener("load",r),n(e.error)}t.appendChild(o)}((()=>{"CanopyConnectComponents"in window?e(window.CanopyConnectComponents):n(new Error("Failed to initialize Canopy Connect Components script"))}),(e=>{o=void 0,n(new Error("Failed to load Canopy Connect Components script",{cause:e}))}))}))),o}e.d(n,{O:()=>t});var r=n.O;export{r as loadCanopyConnectComponents}; //# sourceMappingURL=index.mjs.map