Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@calcom/embed-core

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@calcom/embed-core - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

6

CHANGELOG.md
# @calcom/embed-core
## 1.3.0
### Minor Changes
- Supports new booker layout
## 1.2.1

@@ -4,0 +10,0 @@

4

dist/embed/embed.js

@@ -87,4 +87,4 @@ !function(){const v=({buttonText:n,buttonClasses:t,buttonColor:r,buttonTextColor:e})=>`<button class="z-[10000000000] hidden fixed md:bottom-6 bottom-4 md:right-10 right-4 md:left-10 left-4 ${t.join(" ")} flex h-16 origin-center bg-red-50 transform cursor-pointer items-center

</div>`;class g extends HTMLElement{static get observedAttributes(){return["state"]}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}show(t){this.assertHasShadowRoot(),this.shadowRoot.host.style.visibility=t?"visible":"hidden",t||(document.body.style.overflow=g.htmlOverflow)}close(){this.show(!1)}getLoaderElement(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector(".loader");if(!t)throw new Error("No loader element");return t}getErrorElement(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector("#error");if(!t)throw new Error("No error element");return t}attributeChangedCallback(t,r,e){if(t==="state"){if(e=="loaded")this.getLoaderElement().style.display="none";else if(e==="started")this.show(!0);else if(e=="closed")this.show(!1);else if(e==="failed"){this.getLoaderElement().style.display="none",this.getErrorElement().style.display="inline-block";const o=k(this.dataset.errorCode);this.getErrorElement().innerText=o}}}connectedCallback(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector(".close");document.addEventListener("keydown",r=>{r.key==="Escape"&&this.close()},{once:!0}),this.shadowRoot.host.addEventListener("click",()=>{this.close()}),t&&(t.onclick=()=>{this.close()})}constructor(){super();const t=`<style>${window.Cal.__css}</style><style>${A}</style>${R}`;this.attachShadow({mode:"open"}),g.htmlOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.assertHasShadowRoot(),this.shadowRoot.innerHTML=t}}const L=`.cal-embed{border:0px;min-height:300px;margin:0 auto;width:100%}
`;function b(n,t){const r=new window.CustomEvent(n,{detail:t});window.dispatchEvent(r)}class x{static parseAction(t){if(!t)return null;const[r,e,o]=t.split(":");return r!=="CAL"?null:{ns:e,type:o}}getFullActionName(t){return this.namespace?`CAL:${this.namespace}:${t}`:`CAL::${t}`}fire(t,r){const e=this.getFullActionName(t),o={type:t,namespace:this.namespace,fullType:e,data:r};b(e,o),b(this.getFullActionName("*"),o)}on(t,r){const e=this.getFullActionName(t);window.addEventListener(e,r)}off(t,r){const e=this.getFullActionName(t);window.removeEventListener(e,r)}constructor(t){t=t||"",this.namespace=t}}const M=`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:var(--font-inter),ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Roboto Mono,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[type=text],[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow: 0 0 #0000}[type=text]:focus,[type=email]:focus,[type=url]:focus,[type=password]:focus,[type=number]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=month]:focus,[type=search]:focus,[type=tel]:focus,[type=time]:focus,[type=week]:focus,[multiple]:focus,textarea:focus,select:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#2563eb;background-color:#fff;border-color:#6b7280;border-width:1px;--tw-shadow: 0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 2px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}[type=checkbox]:checked,[type=radio]:checked{border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}[type=radio]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{border-color:transparent;background-color:currentColor}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{border-color:transparent;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*{scrollbar-color:initial;scrollbar-width:initial}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-4{bottom:1rem}.right-4{right:1rem}.left-4{left:1rem}.left-1\\/2{left:50%}.z-\\[10000000000\\]{z-index:10000000000}.z-\\[999999999999\\]{z-index:999999999999}.mr-3{margin-right:.75rem}.flex{display:flex}.hidden{display:none}.h-16{height:4rem}.h-7{height:1.75rem}.w-7{width:1.75rem}.w-full{width:100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.bg-brand{background-color:var(--cal-brand-color, black)}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.text-inverted{color:var(--cal-text-inverted, white)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-md{--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@font-face{font-family:Cal Sans;src:url(https://cal.com/cal.ttf)}h1,h2,h3,h4,h5,h6{font-family:Cal Sans;font-weight:400;letter-spacing:normal}html,body,:host{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-gray-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity))}.focus\\:ring-opacity-50:focus{--tw-ring-opacity: .5}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\\:bottom-6{bottom:1.5rem}.md\\:right-10{right:2.5rem}.md\\:left-10{left:2.5rem}}
`,j="https://app.cal.com";customElements.define("cal-modal-box",g);customElements.define("cal-floating-button",m);customElements.define("cal-inline",z);const h=window.Cal;if(!h||!h.q)throw new Error("Cal is not defined. This shouldn't happen");h.fingerprint="641917e07";h.__css=M;document.head.appendChild(document.createElement("style")).innerHTML=L;function y(...n){console.log(...n)}function w(n,t){function r(o,i){return typeof i=="string"?typeof o==i:o instanceof i}function e(o){return typeof o>"u"}if(t.required&&e(n))throw new Error("Argument is required");for(const[o,i]of Object.entries(t.props||{})){if(i.required&&e(n[o]))throw new Error(`"${o}" is required`);let a=!0;if(i.type&&!e(n[o])&&(i.type instanceof Array?i.type.forEach(s=>{a=a||r(n[o],s)}):a=r(n[o],i.type)),!a)throw new Error(`"${o}" is of wrong type.Expected type "${i.type}"`)}}class p{constructor(t,r){this.iframeDoQueue=[],this.__config={calOrigin:j},this.api=new q(this),this.namespace=t,this.actionManager=new x(t),p.actionsManagers=p.actionsManagers||{},p.actionsManagers[t]=this.actionManager,this.processQueue(r),this.actionManager.on("__dimensionChanged",e=>{const{data:o}=e.detail,i=this.iframe;if(!i)return;const a="px";o.iframeHeight&&(i.style.height=o.iframeHeight+a),this.modalBox&&(i.style.maxHeight=window.innerHeight-100+"px")}),this.actionManager.on("__iframeReady",()=>{this.iframeReady=!0,this.doInIframe({method:"parentKnowsIframeReady"}),this.iframeDoQueue.forEach(e=>{this.doInIframe(e)})}),this.actionManager.on("__routeChanged",()=>{const{top:e,height:o}=this.inlineEl.getBoundingClientRect();e<0&&Math.abs(e/o)>=.25&&this.inlineEl.scrollIntoView({behavior:"smooth"})}),this.actionManager.on("linkReady",()=>{var e,o;(e=this.modalBox)==null||e.setAttribute("state","loaded"),(o=this.inlineEl)==null||o.setAttribute("loading","done")}),this.actionManager.on("linkFailed",e=>{var i,a,s,d;this.iframe&&((i=this.inlineEl)==null||i.setAttribute("data-error-code",e.detail.data.code),(a=this.modalBox)==null||a.setAttribute("data-error-code",e.detail.data.code),(s=this.inlineEl)==null||s.setAttribute("loading","failed"),(d=this.modalBox)==null||d.setAttribute("state","failed"))})}static getQueryObject(t){return t=t||{},{...t,guest:t.guests??void 0}}processInstruction(t){const r=[].slice.call(t);if(typeof r[0]!="string"){r.forEach(i=>{this.processInstruction(i)});return}const[e,...o]=r;this.api[e]||y(`Instruction ${e} not FOUND`);try{this.api[e](...o)}catch(i){y("Instruction couldn't be executed",i)}return r}processQueue(t){t.forEach(r=>{this.processInstruction(r)}),t.splice(0),t.push=r=>{this.processInstruction(r)}}createIframe({calLink:t,queryObject:r={},calOrigin:e}){const o=this.iframe=document.createElement("iframe");o.className="cal-embed",o.name="cal-embed";const i=this.getConfig(),{iframeAttrs:a,...s}=r;a&&a.id&&o.setAttribute("id",a.id);const d=new URLSearchParams;for(const[u,l]of Object.entries(s))l!==void 0&&(l instanceof Array?l.forEach(f=>d.append(u,f)):d.set(u,l));const c=new URL(`${e||i.calOrigin}/${t}`);c.pathname.endsWith("embed")||(c.pathname=`${c.pathname}/embed`),c.searchParams.set("embed",this.namespace),i.debug&&c.searchParams.set("debug",""+i.debug),i.uiDebug&&(o.style.border="1px solid green");for(const[u,l]of d)c.searchParams.append(u,l);return o.src=c.toString(),o}getConfig(){return this.__config}doInIframe(t){if(!this.iframeReady){this.iframeDoQueue.push(t);return}if(!this.iframe)throw new Error("iframe doesn't exist. `createIframe` must be called before `doInIframe`");this.iframe.contentWindow&&this.iframe.contentWindow.postMessage({originator:"CAL",method:t.method,arg:t.arg},"*")}}class q{constructor(t){this.cal=t}init(t,r={}){typeof t!="string"&&(r=t||{});const{calOrigin:e,origin:o,...i}=r;this.cal.__config.calOrigin=e||o||this.cal.__config.calOrigin,this.cal.__config={...this.cal.__config,...i}}inline({calLink:t,elementOrSelector:r,config:e}){if(w(arguments[0],{required:!0,props:{calLink:{required:!0,type:"string"},elementOrSelector:{required:!0,type:["string",HTMLElement]},config:{required:!1,type:Object}}}),e=e||{},typeof e.iframeAttrs=="string"||e.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");e.embedType="inline";const o=this.cal.createIframe({calLink:t,queryObject:p.getQueryObject(e)});o.style.height="100%",o.style.width="100%";const i=r instanceof HTMLElement?r:document.querySelector(r);if(!i)throw new Error("Element not found");i.classList.add("cal-inline-container");const a=document.createElement("template");a.innerHTML='<cal-inline style="max-height:inherit;height:inherit;min-height:inherit;display:flex;position:relative;flex-wrap:wrap;width:100%"></cal-inline><style>.cal-inline-container::-webkit-scrollbar{display:none}.cal-inline-container{scrollbar-width:none}</style>',this.cal.inlineEl=a.content.children[0],this.cal.inlineEl.appendChild(o),i.appendChild(a.content)}floatingButton({calLink:t,buttonText:r="Book my Cal",hideButtonIcon:e=!1,attributes:o,buttonPosition:i="bottom-right",buttonColor:a="rgb(0, 0, 0)",buttonTextColor:s="rgb(255, 255, 255)",calOrigin:d,config:c}){let u=null;o!=null&&o.id&&(u=document.getElementById(o.id));let l;u?l=u:(l=document.createElement("cal-floating-button"),l.dataset.calLink=t,l.dataset.calNamespace=this.cal.namespace,l.dataset.calOrigin=d??"",c&&(l.dataset.calConfig=JSON.stringify(c)),o!=null&&o.id&&(l.id=o.id),document.body.appendChild(l));const f=l.dataset;f.buttonText=r,f.hideButtonIcon=""+e,f.buttonPosition=""+i,f.buttonColor=""+a,f.buttonTextColor=""+s}modal({calLink:t,calOrigin:r,config:e={},uid:o}){o=o||0;const i=document.querySelector(`cal-modal-box[uid="${o}"]`);if(i){i.setAttribute("state","started");return}if(typeof e.iframeAttrs=="string"||e.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");e.embedType="modal";const a=this.cal.createIframe({calLink:t,calOrigin:r,queryObject:p.getQueryObject(e)});a.style.borderRadius="8px",a.style.height="100%",a.style.width="100%";const s=document.createElement("template");s.innerHTML=`<cal-modal-box uid="${o}"></cal-modal-box>`,this.cal.modalBox=s.content.children[0],this.cal.modalBox.appendChild(a),this.cal.actionManager.on("__closeIframe",()=>{this.cal.modalBox.setAttribute("state","closed")}),document.body.appendChild(s.content)}on({action:t,callback:r}){w(arguments[0],{required:!0,props:{action:{required:!0,type:"string"},callback:{required:!0,type:Function}}}),this.cal.actionManager.on(t,r)}off({action:t,callback:r}){this.cal.actionManager.off(t,r)}preload({calLink:t}){w(arguments[0],{required:!0,props:{calLink:{type:"string",required:!0}}});const r=document.body.appendChild(document.createElement("iframe")),e=this.cal.getConfig(),o=new URL(`${e.calOrigin}/${t}`);o.searchParams.set("prerender","true"),r.src=o.toString(),r.style.width="0",r.style.height="0",r.style.display="none"}ui(t){w(t,{required:!0,props:{theme:{required:!1,type:"string"},styles:{required:!1,type:Object}}}),this.cal.doInIframe({method:"ui",arg:t})}}h.instance=new p("",h.q);for(const[n,t]of Object.entries(h.ns))t.instance=new p(n,t.q);window.addEventListener("message",n=>{const t=n.data,r=t.fullType,e=x.parseAction(r);if(!e)return;const o=p.actionsManagers[e.ns];if(h.__logQueue=h.__logQueue||[],h.__logQueue.push({...e,data:t.data}),!o)throw new Error("Unhandled Action"+e);o.fire(e.type,t.data)});document.addEventListener("click",n=>{const t=n.target;if(!(t instanceof HTMLElement))return;const r=t.dataset.calLink;if(!r)return;const e=t.dataset.uniqueId=t.dataset.uniqueId||String(Date.now()),o=t.dataset.calNamespace,i=t.dataset.calConfig||"",a=t.dataset.calOrigin||"";let s;try{s=JSON.parse(i)}catch{s={}}let d=h;if(o&&(d=h.ns[o]),!d)throw new Error(`Namespace ${o} isn't defined`);d("modal",{calLink:r,config:s,uid:e,calOrigin:a})});
`;function b(n,t){const r=new window.CustomEvent(n,{detail:t});window.dispatchEvent(r)}class x{static parseAction(t){if(!t)return null;const[r,e,o]=t.split(":");return r!=="CAL"?null:{ns:e,type:o}}getFullActionName(t){return this.namespace?`CAL:${this.namespace}:${t}`:`CAL::${t}`}fire(t,r){const e=this.getFullActionName(t),o={type:t,namespace:this.namespace,fullType:e,data:r};b(e,o),b(this.getFullActionName("*"),o)}on(t,r){const e=this.getFullActionName(t);window.addEventListener(e,r)}off(t,r){const e=this.getFullActionName(t);window.removeEventListener(e,r)}constructor(t){t=t||"",this.namespace=t}}const M=`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:var(--font-inter),ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Roboto Mono,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[type=text],[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow: 0 0 #0000}[type=text]:focus,[type=email]:focus,[type=url]:focus,[type=password]:focus,[type=number]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=month]:focus,[type=search]:focus,[type=tel]:focus,[type=time]:focus,[type=week]:focus,[multiple]:focus,textarea:focus,select:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#2563eb;background-color:#fff;border-color:#6b7280;border-width:1px;--tw-shadow: 0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 2px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}[type=checkbox]:checked,[type=radio]:checked{border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}[type=radio]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{border-color:transparent;background-color:currentColor}[type=checkbox]:indeterminate{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{border-color:transparent;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*{scrollbar-color:initial;scrollbar-width:initial}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-4{bottom:1rem}.left-1\\/2{left:50%}.left-4{left:1rem}.right-4{right:1rem}.z-\\[10000000000\\]{z-index:10000000000}.z-\\[999999999999\\]{z-index:999999999999}.mr-3{margin-right:.75rem}.flex{display:flex}.hidden{display:none}.h-16{height:4rem}.h-7{height:1.75rem}.w-7{width:1.75rem}.w-full{width:100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.bg-brand{background-color:var(--cal-brand-color, black)}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.text-inverted{color:var(--cal-text-inverted, white)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-md{--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@font-face{font-family:Cal Sans;src:url(https://cal.com/cal.ttf)}h1,h2,h3,h4,h5,h6{font-family:Cal Sans;font-weight:400;letter-spacing:normal}html,body,:host{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-gray-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity))}.focus\\:ring-opacity-50:focus{--tw-ring-opacity: .5}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\\:bottom-6{bottom:1.5rem}.md\\:left-10{left:2.5rem}.md\\:right-10{right:2.5rem}}
`,j="https://app.cal.com";customElements.define("cal-modal-box",g);customElements.define("cal-floating-button",m);customElements.define("cal-inline",z);const h=window.Cal;if(!h||!h.q)throw new Error("Cal is not defined. This shouldn't happen");h.fingerprint="a983184824";h.__css=M;document.head.appendChild(document.createElement("style")).innerHTML=L;function y(...n){console.log(...n)}function w(n,t){function r(o,i){return typeof i=="string"?typeof o==i:o instanceof i}function e(o){return typeof o>"u"}if(t.required&&e(n))throw new Error("Argument is required");for(const[o,i]of Object.entries(t.props||{})){if(i.required&&e(n[o]))throw new Error(`"${o}" is required`);let a=!0;if(i.type&&!e(n[o])&&(i.type instanceof Array?i.type.forEach(s=>{a=a||r(n[o],s)}):a=r(n[o],i.type)),!a)throw new Error(`"${o}" is of wrong type.Expected type "${i.type}"`)}}class p{constructor(t,r){this.iframeDoQueue=[],this.__config={calOrigin:j},this.api=new q(this),this.namespace=t,this.actionManager=new x(t),p.actionsManagers=p.actionsManagers||{},p.actionsManagers[t]=this.actionManager,this.processQueue(r),this.actionManager.on("__dimensionChanged",e=>{const{data:o}=e.detail,i=this.iframe;if(!i)return;const a="px";o.iframeHeight&&(i.style.height=o.iframeHeight+a),this.modalBox&&(i.style.maxHeight=window.innerHeight-100+"px")}),this.actionManager.on("__iframeReady",()=>{this.iframeReady=!0,this.doInIframe({method:"parentKnowsIframeReady"}),this.iframeDoQueue.forEach(e=>{this.doInIframe(e)})}),this.actionManager.on("__routeChanged",()=>{const{top:e,height:o}=this.inlineEl.getBoundingClientRect();e<0&&Math.abs(e/o)>=.25&&this.inlineEl.scrollIntoView({behavior:"smooth"})}),this.actionManager.on("linkReady",()=>{var e,o;(e=this.modalBox)==null||e.setAttribute("state","loaded"),(o=this.inlineEl)==null||o.setAttribute("loading","done")}),this.actionManager.on("linkFailed",e=>{var i,a,s,d;this.iframe&&((i=this.inlineEl)==null||i.setAttribute("data-error-code",e.detail.data.code),(a=this.modalBox)==null||a.setAttribute("data-error-code",e.detail.data.code),(s=this.inlineEl)==null||s.setAttribute("loading","failed"),(d=this.modalBox)==null||d.setAttribute("state","failed"))})}static getQueryObject(t){return t=t||{},{...t,guest:t.guests??void 0}}processInstruction(t){const r=[].slice.call(t);if(typeof r[0]!="string"){r.forEach(i=>{this.processInstruction(i)});return}const[e,...o]=r;this.api[e]||y(`Instruction ${e} not FOUND`);try{this.api[e](...o)}catch(i){y("Instruction couldn't be executed",i)}return r}processQueue(t){t.forEach(r=>{this.processInstruction(r)}),t.splice(0),t.push=r=>{this.processInstruction(r)}}createIframe({calLink:t,queryObject:r={},calOrigin:e}){const o=this.iframe=document.createElement("iframe");o.className="cal-embed",o.name=`cal-embed=${this.namespace}`;const i=this.getConfig(),{iframeAttrs:a,...s}=r;a&&a.id&&o.setAttribute("id",a.id);const d=new URLSearchParams;for(const[u,l]of Object.entries(s))l!==void 0&&(l instanceof Array?l.forEach(f=>d.append(u,f)):d.set(u,l));const c=new URL(`${e||i.calOrigin}/${t}`);c.pathname.endsWith("embed")||(c.pathname=`${c.pathname}/embed`),c.searchParams.set("embed",this.namespace),i.debug&&c.searchParams.set("debug",""+i.debug),i.uiDebug&&(o.style.border="1px solid green");for(const[u,l]of d)c.searchParams.append(u,l);return o.src=c.toString(),o}getConfig(){return this.__config}doInIframe(t){if(!this.iframeReady){this.iframeDoQueue.push(t);return}if(!this.iframe)throw new Error("iframe doesn't exist. `createIframe` must be called before `doInIframe`");this.iframe.contentWindow&&this.iframe.contentWindow.postMessage({originator:"CAL",method:t.method,arg:t.arg},"*")}}class q{constructor(t){this.cal=t}init(t,r={}){typeof t!="string"&&(r=t||{});const{calOrigin:e,origin:o,...i}=r;this.cal.__config.calOrigin=e||o||this.cal.__config.calOrigin,this.cal.__config={...this.cal.__config,...i}}inline({calLink:t,elementOrSelector:r,config:e}){if(w(arguments[0],{required:!0,props:{calLink:{required:!0,type:"string"},elementOrSelector:{required:!0,type:["string",HTMLElement]},config:{required:!1,type:Object}}}),e=e||{},typeof e.iframeAttrs=="string"||e.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");e.embedType="inline";const o=this.cal.createIframe({calLink:t,queryObject:p.getQueryObject(e)});o.style.height="100%",o.style.width="100%";const i=r instanceof HTMLElement?r:document.querySelector(r);if(!i)throw new Error("Element not found");i.classList.add("cal-inline-container");const a=document.createElement("template");a.innerHTML='<cal-inline style="max-height:inherit;height:inherit;min-height:inherit;display:flex;position:relative;flex-wrap:wrap;width:100%"></cal-inline><style>.cal-inline-container::-webkit-scrollbar{display:none}.cal-inline-container{scrollbar-width:none}</style>',this.cal.inlineEl=a.content.children[0],this.cal.inlineEl.appendChild(o),i.appendChild(a.content)}floatingButton({calLink:t,buttonText:r="Book my Cal",hideButtonIcon:e=!1,attributes:o,buttonPosition:i="bottom-right",buttonColor:a="rgb(0, 0, 0)",buttonTextColor:s="rgb(255, 255, 255)",calOrigin:d,config:c}){let u=null;o!=null&&o.id&&(u=document.getElementById(o.id));let l;u?l=u:(l=document.createElement("cal-floating-button"),l.dataset.calLink=t,l.dataset.calNamespace=this.cal.namespace,l.dataset.calOrigin=d??"",c&&(l.dataset.calConfig=JSON.stringify(c)),o!=null&&o.id&&(l.id=o.id),document.body.appendChild(l));const f=l.dataset;f.buttonText=r,f.hideButtonIcon=""+e,f.buttonPosition=""+i,f.buttonColor=""+a,f.buttonTextColor=""+s}modal({calLink:t,calOrigin:r,config:e={},uid:o}){o=o||0;const i=document.querySelector(`cal-modal-box[uid="${o}"]`);if(i){i.setAttribute("state","started");return}if(typeof e.iframeAttrs=="string"||e.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");e.embedType="modal";const a=this.cal.createIframe({calLink:t,calOrigin:r,queryObject:p.getQueryObject(e)});a.style.borderRadius="8px",a.style.height="100%",a.style.width="100%";const s=document.createElement("template");s.innerHTML=`<cal-modal-box uid="${o}"></cal-modal-box>`,this.cal.modalBox=s.content.children[0],this.cal.modalBox.appendChild(a),this.cal.actionManager.on("__closeIframe",()=>{this.cal.modalBox.setAttribute("state","closed")}),document.body.appendChild(s.content)}on({action:t,callback:r}){w(arguments[0],{required:!0,props:{action:{required:!0,type:"string"},callback:{required:!0,type:Function}}}),this.cal.actionManager.on(t,r)}off({action:t,callback:r}){this.cal.actionManager.off(t,r)}preload({calLink:t}){w(arguments[0],{required:!0,props:{calLink:{type:"string",required:!0}}});const r=document.body.appendChild(document.createElement("iframe")),e=this.cal.getConfig(),o=new URL(`${e.calOrigin}/${t}`);o.searchParams.set("prerender","true"),r.src=o.toString(),r.style.width="0",r.style.height="0",r.style.display="none"}ui(t){w(t,{required:!0,props:{theme:{required:!1,type:"string"},styles:{required:!1,type:Object}}}),this.cal.doInIframe({method:"ui",arg:t})}}h.instance=new p("",h.q);for(const[n,t]of Object.entries(h.ns))t.instance=new p(n,t.q);window.addEventListener("message",n=>{const t=n.data,r=t.fullType,e=x.parseAction(r);if(!e)return;const o=p.actionsManagers[e.ns];if(h.__logQueue=h.__logQueue||[],h.__logQueue.push({...e,data:t.data}),!o)throw new Error("Unhandled Action"+e);o.fire(e.type,t.data)});document.addEventListener("click",n=>{const t=n.target;if(!(t instanceof HTMLElement))return;const r=t.dataset.calLink;if(!r)return;const e=t.dataset.uniqueId=t.dataset.uniqueId||String(Date.now()),o=t.dataset.calNamespace,i=t.dataset.calConfig||"",a=t.dataset.calOrigin||"";let s;try{s=JSON.parse(i)}catch{s={}}let d=h;if(o&&(d=h.ns[o]),!d)throw new Error(`Namespace ${o} isn't defined`);d("modal",{calLink:r,config:s,uid:e,calOrigin:a})});
}()

@@ -1,1 +0,1 @@

(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))i(t);new MutationObserver(t=>{for(const e of t)if(e.type==="childList")for(const r of e.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function s(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?e.credentials="include":t.crossOrigin==="anonymous"?e.credentials="omit":e.credentials="same-origin",e}function i(t){if(t.ep)return;t.ep=!0;const e=s(t);fetch(t.href,e)}})();const f="https://app.cal.com",p="http://localhost:3000/embed/embed.js";(function(o,n,s){const i=function(e,r){e.q.push(r)},t=o.document;o.Cal=o.Cal||function(){const e=o.Cal,r=arguments;if(e.loaded||(e.ns={},e.q=e.q||[],t.head.appendChild(t.createElement("script")).src=n,e.loaded=!0),r[0]===s){const c=function(){i(c,arguments)},u=r[1];c.q=c.q||[],typeof u=="string"?(e.ns[u]=c)&&i(c,r):i(e,r);return}i(e,r)}})(window,p,"init");const a=window;a.Cal.fingerprint="641917e07";a.Cal("init",{origin:f});const m=new URL(document.URL).searchParams,l=m.get("embedType"),d=m.get("calLink");if(!d)throw new Error('Missing "calLink" query parameter');if(l==="inline")a.Cal("inline",{elementOrSelector:"#my-embed",calLink:d});else if(l==="floating-popup")a.Cal("floatingButton",{calLink:d,attributes:{id:"my-floating-button"}});else if(l==="element-click"){const o=document.createElement("button");o.setAttribute("data-cal-link",d),o.innerHTML="I am a button that exists on your website",document.body.appendChild(o)}a.addEventListener("message",o=>{const n=o.data;if(n.mode!=="cal:preview")return;const s=window.Cal;if(!s)throw new Error("Cal is not defined yet");if(n.type=="instruction"&&s(n.instruction.name,n.instruction.arg),n.type=="inlineEmbedDimensionUpdate"){const i=document.querySelector("#my-embed");i&&(i.style.width=n.data.width,i.style.height=n.data.height)}});function h(){const o=window.matchMedia("(prefers-color-scheme: dark)");function n(s){s.matches?(document.body.classList.remove("light"),document.body.classList.add("dark")):(document.body.classList.add("light"),document.body.classList.remove("dark"))}o.addEventListener("change",n),n(new MediaQueryListEvent("change",{matches:o.matches}))}h();
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))o(t);new MutationObserver(t=>{for(const e of t)if(e.type==="childList")for(const r of e.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&o(r)}).observe(document,{childList:!0,subtree:!0});function s(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?e.credentials="include":t.crossOrigin==="anonymous"?e.credentials="omit":e.credentials="same-origin",e}function o(t){if(t.ep)return;t.ep=!0;const e=s(t);fetch(t.href,e)}})();const f="https://app.cal.com",p="https://app.cal.com/embed/embed.js";(function(i,n,s){const o=function(e,r){e.q.push(r)},t=i.document;i.Cal=i.Cal||function(){const e=i.Cal,r=arguments;if(e.loaded||(e.ns={},e.q=e.q||[],t.head.appendChild(t.createElement("script")).src=n,e.loaded=!0),r[0]===s){const c=function(){o(c,arguments)},u=r[1];c.q=c.q||[],typeof u=="string"?(e.ns[u]=c)&&o(c,r):o(e,r);return}o(e,r)}})(window,p,"init");const a=window;a.Cal.fingerprint="a983184824";a.Cal("init",{origin:f});const m=new URL(document.URL).searchParams,l=m.get("embedType"),d=m.get("calLink");if(!d)throw new Error('Missing "calLink" query parameter');if(l==="inline")a.Cal("inline",{elementOrSelector:"#my-embed",calLink:d});else if(l==="floating-popup")a.Cal("floatingButton",{calLink:d,attributes:{id:"my-floating-button"}});else if(l==="element-click"){const i=document.createElement("button");i.setAttribute("data-cal-link",d),i.innerHTML="I am a button that exists on your website",document.body.appendChild(i)}a.addEventListener("message",i=>{const n=i.data;if(n.mode!=="cal:preview")return;const s=window.Cal;if(!s)throw new Error("Cal is not defined yet");if(n.type=="instruction"&&s(n.instruction.name,n.instruction.arg),n.type=="inlineEmbedDimensionUpdate"){const o=document.querySelector("#my-embed");o&&(o.style.width=n.data.width,o.style.height=n.data.height)}});function h(){const i=window.matchMedia("(prefers-color-scheme: dark)");function n(s){s.matches?(document.body.classList.remove("light"),document.body.classList.add("dark")):(document.body.classList.add("light"),document.body.classList.remove("dark"))}i.addEventListener("change",n),n(new MediaQueryListEvent("change",{matches:i.matches}))}h();
import type { CSSProperties } from "react";
import type { BookerStore } from "@calcom/features/bookings/Booker/store";
import { BookerLayouts } from "@calcom/prisma/zod-utils";
type Theme = "dark" | "light";

@@ -6,8 +8,12 @@ export type EmbedThemeConfig = Theme | "auto";

hideEventTypeDetails?: boolean;
theme?: EmbedThemeConfig;
theme?: EmbedThemeConfig | null;
styles?: EmbedStyles & EmbedNonStylesConfig;
cssVarsPerTheme?: Record<Theme, Record<string, string>>;
layout?: BookerLayouts;
};
type SetStyles = React.Dispatch<React.SetStateAction<EmbedStyles>>;
type setNonStylesConfig = React.Dispatch<React.SetStateAction<EmbedNonStylesConfig>>;
/**
* This is in-memory persistence needed so that when user browses through the embed, the configurations from the instructions aren't lost.
*/
declare const embedStore: {

@@ -23,5 +29,9 @@ styles: EmbedStyles | undefined;

setTheme: ((arg0: EmbedThemeConfig) => void) | undefined;
theme: EmbedThemeConfig | undefined;
theme: EmbedThemeConfig | null | undefined;
uiConfig: Omit<UiConfig, "theme" | "styles"> | undefined;
setUiConfig: ((arg0: UiConfig) => void) | undefined;
/**
* We maintain a list of all setUiConfig setters that are in use at the moment so that we can update all those components.
*/
setUiConfig: ((arg0: UiConfig) => void)[];
layout: typeof BookerLayouts;
};

@@ -34,8 +44,8 @@ declare global {

applyCssVars: (cssVarsPerTheme: UiConfig["cssVarsPerTheme"]) => void;
setLayout?: BookerStore["setLayout"];
};
CalComPageStatus: string;
isEmbed?: () => boolean;
resetEmbedStatus: () => void;
getEmbedNamespace: () => string | null;
getEmbedTheme: () => "dark" | "light" | null;
getEmbedTheme: () => EmbedThemeConfig | null;
}

@@ -57,3 +67,8 @@ }

}
export declare const useEmbedTheme: () => "light" | "dark" | "auto" | undefined;
export declare const useEmbedTheme: () => "dark" | "light" | "auto" | null | undefined;
/**
* It serves following purposes
* - Gives consistent values for ui config even after Soft Navigation. When a new React component mounts, it would ensure that the component get's the correct value of ui config
* - Ensures that all the components using useEmbedUiConfig are updated when ui config changes. It is done by maintaining a list of all non-stale setters.
*/
export declare const useEmbedUiConfig: () => Omit<UiConfig, "theme" | "styles">;

@@ -60,0 +75,0 @@ export declare const useEmbedStyles: (elementName: keyof EmbedStyles) => Pick<CSSProperties, "background">;

@@ -0,1 +1,2 @@

import type { BookerLayouts } from "@calcom/prisma/zod-utils";
import type { InterfaceWithParent, interfaceWithParent, UiConfig, EmbedThemeConfig } from "./embed-iframe";

@@ -32,6 +33,10 @@ import type { EventData, EventDataMap } from "./sdk-action-manager";

export type InstructionQueue = Instruction[];
type PrefillAndIframeAttrsConfig = Record<string, string | string[] | Record<string, string>> & {
/**
* All types of config that are critical to be processed as soon as possible are provided as query params to the iframe
*/
export type PrefillAndIframeAttrsConfig = Record<string, string | string[] | Record<string, string>> & {
iframeAttrs?: Record<string, string> & {
id?: string;
};
layout?: `${BookerLayouts}`;
theme?: EmbedThemeConfig;

@@ -50,6 +55,7 @@ };

static actionsManagers: Record<Namespace, SdkActionManager>;
static getQueryObject(config: PrefillAndIframeAttrsConfig): Record<string, string | Record<string, string> | string[]> & {
static getQueryObject(config: PrefillAndIframeAttrsConfig): Record<string, string | string[] | Record<string, string>> & {
iframeAttrs?: (Record<string, string> & {
id?: string | undefined;
}) | undefined;
layout?: "week_view" | "column_view" | "month_view" | undefined;
theme?: EmbedThemeConfig | undefined;

@@ -105,5 +111,5 @@ } & {

}): void;
off({ action, callback }: {
action: never;
callback: never;
off<T extends keyof EventDataMap>({ action, callback, }: {
action: T;
callback: (arg0: CustomEvent<EventData<T>>) => void;
}): void;

@@ -110,0 +116,0 @@ preload({ calLink }: {

@@ -1,7 +0,3 @@

/**
* @file
* This module is supposed to instantiate the SDK with appropriate namespace
*/
import { SdkActionManager } from "./sdk-action-manager";
export declare let sdkActionManager: SdkActionManager | null;
//# sourceMappingURL=sdk-event.d.ts.map
{
"name": "@calcom/embed-core",
"version": "1.2.1",
"version": "1.3.0",
"description": "This is the vanilla JS core script that embeds Cal Link",

@@ -18,3 +18,3 @@ "main": "./dist/embed/embed.js",

"__dev": "yarn tailwind && vite build --mode development",
"build": "NEXT_PUBLIC_EMBED_FINGER_PRINT=$(git rev-parse --short HEAD) yarn __build",
"build": "rm -rf dist && NEXT_PUBLIC_EMBED_FINGER_PRINT=$(git rev-parse --short HEAD) yarn __build",
"build-preview": "PREVIEW_BUILD=1 yarn __build ",

@@ -33,3 +33,4 @@ "vite": "vite",

"embed-tests-update-snapshots:ci": "yarn embed-tests-quick --update-snapshots",
"prepack": "NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn build",
"withEmbedPublishEnv": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn",
"prepack": "yarn withEmbedPublishEnv build",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf ../../../apps/web/public/embed"

@@ -52,3 +53,3 @@ },

"postcss": "^8.4.18",
"tailwindcss": "^3.2.1",
"tailwindcss": "^3.3.1",
"typescript": "^4.9.4",

@@ -55,0 +56,0 @@ "vite": "^4.1.2"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc